Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004-2018 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004-2018 Apple Inc. All rights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) |
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
429 const bool isLocalActiveOrigin = activeSecurityOrigin.isLocal(); | 429 const bool isLocalActiveOrigin = activeSecurityOrigin.isLocal(); |
430 for (Frame* ancestorFrame = targetFrame; ancestorFrame; ancestorFrame = ance storFrame->tree().parent()) { | 430 for (Frame* ancestorFrame = targetFrame; ancestorFrame; ancestorFrame = ance storFrame->tree().parent()) { |
431 Document* ancestorDocument = ancestorFrame->document(); | 431 Document* ancestorDocument = ancestorFrame->document(); |
432 // FIXME: Should be an ASSERT? Frames should alway have documents. | 432 // FIXME: Should be an ASSERT? Frames should alway have documents. |
433 if (!ancestorDocument) | 433 if (!ancestorDocument) |
434 return true; | 434 return true; |
435 | 435 |
436 const SecurityOrigin& ancestorSecurityOrigin = ancestorDocument->securit yOrigin(); | 436 const SecurityOrigin& ancestorSecurityOrigin = ancestorDocument->securit yOrigin(); |
437 if (activeSecurityOrigin.canAccess(ancestorSecurityOrigin)) | 437 if (activeSecurityOrigin.canAccess(ancestorSecurityOrigin)) |
438 return true; | 438 return true; |
439 | 439 |
440 // Allow file URL descendant navigation even when allowFileAccessFromFil eURLs is false. | 440 // Allow file URL descendant navigation even when allowFileAccessFromFil eURLs is false. |
441 // FIXME: It's a bit strange to special-case local origins here. Should we be doing | 441 // FIXME: It's a bit strange to special-case local origins here. Should we be doing |
442 // something more general instead? | 442 // something more general instead? |
443 if (isLocalActiveOrigin && ancestorSecurityOrigin.isLocal()) | 443 if (isLocalActiveOrigin && ancestorSecurityOrigin.isLocal()) |
444 return true; | 444 return true; |
445 } | 445 } |
446 | 446 |
447 return false; | 447 return false; |
448 } | 448 } |
449 | 449 |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
636 | 636 |
637 // It's possible for multiple Documents to end up referencing the same Cache dResourceLoader (e.g., SVGImages | 637 // It's possible for multiple Documents to end up referencing the same Cache dResourceLoader (e.g., SVGImages |
638 // load the initial empty document and the SVGDocument with the same Documen tLoader). | 638 // load the initial empty document and the SVGDocument with the same Documen tLoader). |
639 if (m_cachedResourceLoader->document() == this) | 639 if (m_cachedResourceLoader->document() == this) |
640 m_cachedResourceLoader->setDocument(nullptr); | 640 m_cachedResourceLoader->setDocument(nullptr); |
641 | 641 |
642 #if ENABLE(VIDEO) | 642 #if ENABLE(VIDEO) |
643 if (auto* platformMediaSessionManager = PlatformMediaSessionManager::sharedM anagerIfExists()) | 643 if (auto* platformMediaSessionManager = PlatformMediaSessionManager::sharedM anagerIfExists()) |
644 platformMediaSessionManager->stopAllMediaPlaybackForDocument(this); | 644 platformMediaSessionManager->stopAllMediaPlaybackForDocument(this); |
645 #endif | 645 #endif |
646 | 646 |
647 // We must call clearRareData() here since a Document class inherits TreeSco pe | 647 // We must call clearRareData() here since a Document class inherits TreeSco pe |
648 // as well as Node. See a comment on TreeScope.h for the reason. | 648 // as well as Node. See a comment on TreeScope.h for the reason. |
649 if (hasRareData()) | 649 if (hasRareData()) |
650 clearRareData(); | 650 clearRareData(); |
651 | 651 |
652 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_listsInvalidatedAtDocument.isEmpt y()); | 652 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_listsInvalidatedAtDocument.isEmpt y()); |
653 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_collectionsInvalidatedAtDocument. isEmpty()); | 653 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_collectionsInvalidatedAtDocument. isEmpty()); |
654 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_svgUseElements.isEmpty()); | 654 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(m_svgUseElements.isEmpty()); |
655 | 655 |
656 for (unsigned count : m_nodeListAndCollectionCounts) | 656 for (unsigned count : m_nodeListAndCollectionCounts) |
(...skipping 26 matching lines...) Expand all Loading... | |
683 | 683 |
684 detachParser(); | 684 detachParser(); |
685 | 685 |
686 // removeDetachedChildren() doesn't always unregister IDs, | 686 // removeDetachedChildren() doesn't always unregister IDs, |
687 // so tear down scope information up front to avoid having | 687 // so tear down scope information up front to avoid having |
688 // stale references in the map. | 688 // stale references in the map. |
689 | 689 |
690 destroyTreeScopeData(); | 690 destroyTreeScopeData(); |
691 removeDetachedChildren(); | 691 removeDetachedChildren(); |
692 m_formController = nullptr; | 692 m_formController = nullptr; |
693 | 693 |
694 m_markers->detach(); | 694 m_markers->detach(); |
695 | 695 |
696 m_cssCanvasElements.clear(); | 696 m_cssCanvasElements.clear(); |
697 | 697 |
698 commonTeardown(); | 698 commonTeardown(); |
699 | 699 |
700 #ifndef NDEBUG | 700 #ifndef NDEBUG |
701 // We need to do this right now since selfOnlyDeref() can delete this. | 701 // We need to do this right now since selfOnlyDeref() can delete this. |
702 m_inRemovedLastRefFunction = false; | 702 m_inRemovedLastRefFunction = false; |
703 #endif | 703 #endif |
704 decrementReferencingNodeCount(); | 704 decrementReferencingNodeCount(); |
705 } else { | 705 } else { |
706 #ifndef NDEBUG | 706 #ifndef NDEBUG |
707 m_inRemovedLastRefFunction = false; | 707 m_inRemovedLastRefFunction = false; |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
995 case DOCUMENT_NODE: | 995 case DOCUMENT_NODE: |
996 return Exception { NotSupportedError }; | 996 return Exception { NotSupportedError }; |
997 case ATTRIBUTE_NODE: { | 997 case ATTRIBUTE_NODE: { |
998 auto& attr = downcast<Attr>(source); | 998 auto& attr = downcast<Attr>(source); |
999 if (auto* element = attr.ownerElement()) { | 999 if (auto* element = attr.ownerElement()) { |
1000 auto result = element->removeAttributeNode(attr); | 1000 auto result = element->removeAttributeNode(attr); |
1001 if (result.hasException()) | 1001 if (result.hasException()) |
1002 return result.releaseException(); | 1002 return result.releaseException(); |
1003 } | 1003 } |
1004 break; | 1004 break; |
1005 } | 1005 } |
1006 default: | 1006 default: |
1007 if (source.isShadowRoot()) { | 1007 if (source.isShadowRoot()) { |
1008 // ShadowRoot cannot disconnect itself from the host node. | 1008 // ShadowRoot cannot disconnect itself from the host node. |
1009 return Exception { HierarchyRequestError }; | 1009 return Exception { HierarchyRequestError }; |
1010 } | 1010 } |
1011 if (is<HTMLFrameOwnerElement>(source)) { | 1011 if (is<HTMLFrameOwnerElement>(source)) { |
1012 auto& frameOwnerElement = downcast<HTMLFrameOwnerElement>(source); | 1012 auto& frameOwnerElement = downcast<HTMLFrameOwnerElement>(source); |
1013 if (frame() && frame()->tree().isDescendantOf(frameOwnerElement.cont entFrame())) | 1013 if (frame() && frame()->tree().isDescendantOf(frameOwnerElement.cont entFrame())) |
1014 return Exception { HierarchyRequestError }; | 1014 return Exception { HierarchyRequestError }; |
1015 } | 1015 } |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1244 | 1244 |
1245 if (view() && !view()->visualUpdatesAllowedByClient()) | 1245 if (view() && !view()->visualUpdatesAllowedByClient()) |
1246 return; | 1246 return; |
1247 | 1247 |
1248 setVisualUpdatesAllowed(true); | 1248 setVisualUpdatesAllowed(true); |
1249 } else | 1249 } else |
1250 ASSERT(m_visualUpdatesAllowed); | 1250 ASSERT(m_visualUpdatesAllowed); |
1251 break; | 1251 break; |
1252 } | 1252 } |
1253 } | 1253 } |
1254 | 1254 |
1255 void Document::setVisualUpdatesAllowed(bool visualUpdatesAllowed) | 1255 void Document::setVisualUpdatesAllowed(bool visualUpdatesAllowed) |
1256 { | 1256 { |
1257 if (m_visualUpdatesAllowed == visualUpdatesAllowed) | 1257 if (m_visualUpdatesAllowed == visualUpdatesAllowed) |
1258 return; | 1258 return; |
1259 | 1259 |
1260 m_visualUpdatesAllowed = visualUpdatesAllowed; | 1260 m_visualUpdatesAllowed = visualUpdatesAllowed; |
1261 | 1261 |
1262 if (visualUpdatesAllowed) | 1262 if (visualUpdatesAllowed) |
1263 m_visualUpdatesSuppressionTimer.stop(); | 1263 m_visualUpdatesSuppressionTimer.stop(); |
1264 else | 1264 else |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1743 { | 1743 { |
1744 ASSERT(!m_renderView || !m_renderView->inHitTesting()); | 1744 ASSERT(!m_renderView || !m_renderView->inHitTesting()); |
1745 | 1745 |
1746 if (m_styleRecalcTimer.isActive() || pageCacheState() != NotInPageCache) | 1746 if (m_styleRecalcTimer.isActive() || pageCacheState() != NotInPageCache) |
1747 return; | 1747 return; |
1748 | 1748 |
1749 ASSERT(childNeedsStyleRecalc() || m_pendingStyleRecalcShouldForce); | 1749 ASSERT(childNeedsStyleRecalc() || m_pendingStyleRecalcShouldForce); |
1750 | 1750 |
1751 // FIXME: Why on earth is this here? This is clearly misplaced. | 1751 // FIXME: Why on earth is this here? This is clearly misplaced. |
1752 invalidateAccessKeyMap(); | 1752 invalidateAccessKeyMap(); |
1753 | 1753 |
1754 m_styleRecalcTimer.startOneShot(0_s); | 1754 m_styleRecalcTimer.startOneShot(0_s); |
1755 | 1755 |
1756 InspectorInstrumentation::didScheduleStyleRecalculation(*this); | 1756 InspectorInstrumentation::didScheduleStyleRecalculation(*this); |
1757 } | 1757 } |
1758 | 1758 |
1759 void Document::unscheduleStyleRecalc() | 1759 void Document::unscheduleStyleRecalc() |
1760 { | 1760 { |
1761 ASSERT(!childNeedsStyleRecalc()); | 1761 ASSERT(!childNeedsStyleRecalc()); |
1762 | 1762 |
1763 m_styleRecalcTimer.stop(); | 1763 m_styleRecalcTimer.stop(); |
(...skipping 15 matching lines...) Expand all Loading... | |
1779 ASSERT(!view() || !view()->isPainting()); | 1779 ASSERT(!view() || !view()->isPainting()); |
1780 | 1780 |
1781 // NOTE: XSL code seems to be the only client stumbling in here without a Re nderView. | 1781 // NOTE: XSL code seems to be the only client stumbling in here without a Re nderView. |
1782 if (!m_renderView) | 1782 if (!m_renderView) |
1783 return; | 1783 return; |
1784 | 1784 |
1785 FrameView& frameView = m_renderView->frameView(); | 1785 FrameView& frameView = m_renderView->frameView(); |
1786 Ref<FrameView> protect(frameView); | 1786 Ref<FrameView> protect(frameView); |
1787 if (frameView.isPainting()) | 1787 if (frameView.isPainting()) |
1788 return; | 1788 return; |
1789 | 1789 |
1790 if (m_inStyleRecalc) | 1790 if (m_inStyleRecalc) |
1791 return; // Guard against re-entrancy. -dwh | 1791 return; // Guard against re-entrancy. -dwh |
1792 | 1792 |
1793 TraceScope tracingScope(StyleRecalcStart, StyleRecalcEnd); | 1793 TraceScope tracingScope(StyleRecalcStart, StyleRecalcEnd); |
1794 | 1794 |
1795 RenderView::RepaintRegionAccumulator repaintRegionAccumulator(renderView()); | 1795 RenderView::RepaintRegionAccumulator repaintRegionAccumulator(renderView()); |
1796 AnimationUpdateBlock animationUpdateBlock(&m_frame->animation()); | 1796 AnimationUpdateBlock animationUpdateBlock(&m_frame->animation()); |
1797 | 1797 |
1798 // FIXME: Do this update per tree scope. | 1798 // FIXME: Do this update per tree scope. |
1799 { | 1799 { |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1987 | 1987 |
1988 RenderView::RepaintRegionAccumulator repaintRegionAccumulator(renderView()); | 1988 RenderView::RepaintRegionAccumulator repaintRegionAccumulator(renderView()); |
1989 | 1989 |
1990 if (HTMLFrameOwnerElement* owner = ownerElement()) | 1990 if (HTMLFrameOwnerElement* owner = ownerElement()) |
1991 owner->document().updateLayout(); | 1991 owner->document().updateLayout(); |
1992 | 1992 |
1993 updateStyleIfNeeded(); | 1993 updateStyleIfNeeded(); |
1994 | 1994 |
1995 StackStats::LayoutCheckPoint layoutCheckPoint; | 1995 StackStats::LayoutCheckPoint layoutCheckPoint; |
1996 | 1996 |
1997 // Only do a layout if changes have occurred that make it necessary. | 1997 // Only do a layout if changes have occurred that make it necessary. |
1998 if (frameView && renderView() && (frameView->layoutContext().isLayoutPending () || renderView()->needsLayout())) | 1998 if (frameView && renderView() && (frameView->layoutContext().isLayoutPending () || renderView()->needsLayout())) |
1999 frameView->layoutContext().layout(); | 1999 frameView->layoutContext().layout(); |
2000 } | 2000 } |
2001 | 2001 |
2002 void Document::updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks runPostLayoutTasks) | 2002 void Document::updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks runPostLayoutTasks) |
2003 { | 2003 { |
2004 bool oldIgnore = m_ignorePendingStylesheets; | 2004 bool oldIgnore = m_ignorePendingStylesheets; |
2005 | 2005 |
2006 if (!haveStylesheetsLoaded()) { | 2006 if (!haveStylesheetsLoaded()) { |
2007 m_ignorePendingStylesheets = true; | 2007 m_ignorePendingStylesheets = true; |
(...skipping 30 matching lines...) Expand all Loading... | |
2038 Style::Update emptyUpdate(*this); | 2038 Style::Update emptyUpdate(*this); |
2039 Style::commitRelations(WTFMove(elementStyle.relations), emptyUpdate); | 2039 Style::commitRelations(WTFMove(elementStyle.relations), emptyUpdate); |
2040 } | 2040 } |
2041 | 2041 |
2042 return WTFMove(elementStyle.renderStyle); | 2042 return WTFMove(elementStyle.renderStyle); |
2043 } | 2043 } |
2044 | 2044 |
2045 bool Document::updateLayoutIfDimensionsOutOfDate(Element& element, DimensionsChe ck dimensionsCheck) | 2045 bool Document::updateLayoutIfDimensionsOutOfDate(Element& element, DimensionsChe ck dimensionsCheck) |
2046 { | 2046 { |
2047 ASSERT(isMainThread()); | 2047 ASSERT(isMainThread()); |
2048 | 2048 |
2049 // If the stylesheets haven't loaded, just give up and do a full layout igno ring pending stylesheets. | 2049 // If the stylesheets haven't loaded, just give up and do a full layout igno ring pending stylesheets. |
2050 if (!haveStylesheetsLoaded()) { | 2050 if (!haveStylesheetsLoaded()) { |
2051 updateLayoutIgnorePendingStylesheets(); | 2051 updateLayoutIgnorePendingStylesheets(); |
2052 return true; | 2052 return true; |
2053 } | 2053 } |
2054 | 2054 |
2055 // Check for re-entrancy and assert (same code that is in updateLayout()). | 2055 // Check for re-entrancy and assert (same code that is in updateLayout()). |
2056 RefPtr<FrameView> frameView = view(); | 2056 RefPtr<FrameView> frameView = view(); |
2057 if (frameView && frameView->layoutContext().isInRenderTreeLayout()) { | 2057 if (frameView && frameView->layoutContext().isInRenderTreeLayout()) { |
2058 // View layout should not be re-entrant. | 2058 // View layout should not be re-entrant. |
2059 ASSERT_NOT_REACHED(); | 2059 ASSERT_NOT_REACHED(); |
2060 return true; | 2060 return true; |
2061 } | 2061 } |
2062 | 2062 |
2063 RenderView::RepaintRegionAccumulator repaintRegionAccumulator(renderView()); | 2063 RenderView::RepaintRegionAccumulator repaintRegionAccumulator(renderView()); |
2064 | 2064 |
2065 // Mimic the structure of updateLayout(), but at each step, see if we have b een forced into doing a full | 2065 // Mimic the structure of updateLayout(), but at each step, see if we have b een forced into doing a full |
2066 // layout. | 2066 // layout. |
2067 bool requireFullLayout = false; | 2067 bool requireFullLayout = false; |
2068 if (HTMLFrameOwnerElement* owner = ownerElement()) { | 2068 if (HTMLFrameOwnerElement* owner = ownerElement()) { |
2069 if (owner->document().updateLayoutIfDimensionsOutOfDate(*owner)) | 2069 if (owner->document().updateLayoutIfDimensionsOutOfDate(*owner)) |
2070 requireFullLayout = true; | 2070 requireFullLayout = true; |
2071 } | 2071 } |
2072 | 2072 |
2073 updateStyleIfNeeded(); | 2073 updateStyleIfNeeded(); |
2074 | 2074 |
2075 RenderObject* renderer = element.renderer(); | 2075 RenderObject* renderer = element.renderer(); |
2076 if (!renderer || renderer->needsLayout()) { | 2076 if (!renderer || renderer->needsLayout()) { |
2077 // If we don't have a renderer or if the renderer needs layout for any r eason, give up. | 2077 // If we don't have a renderer or if the renderer needs layout for any r eason, give up. |
2078 requireFullLayout = true; | 2078 requireFullLayout = true; |
2079 } | 2079 } |
2080 | 2080 |
2081 // Turn off this optimization for input elements with shadow content. | 2081 // Turn off this optimization for input elements with shadow content. |
2082 if (is<HTMLInputElement>(element)) | 2082 if (is<HTMLInputElement>(element)) |
2083 requireFullLayout = true; | 2083 requireFullLayout = true; |
2084 | 2084 |
2085 bool isVertical = renderer && !renderer->isHorizontalWritingMode(); | 2085 bool isVertical = renderer && !renderer->isHorizontalWritingMode(); |
2086 bool checkingLogicalWidth = ((dimensionsCheck & WidthDimensionsCheck) && !is Vertical) || ((dimensionsCheck & HeightDimensionsCheck) && isVertical); | 2086 bool checkingLogicalWidth = ((dimensionsCheck & WidthDimensionsCheck) && !is Vertical) || ((dimensionsCheck & HeightDimensionsCheck) && isVertical); |
2087 bool checkingLogicalHeight = ((dimensionsCheck & HeightDimensionsCheck) && ! isVertical) || ((dimensionsCheck & WidthDimensionsCheck) && isVertical); | 2087 bool checkingLogicalHeight = ((dimensionsCheck & HeightDimensionsCheck) && ! isVertical) || ((dimensionsCheck & WidthDimensionsCheck) && isVertical); |
2088 bool hasSpecifiedLogicalHeight = renderer && renderer->style().logicalMinHei ght() == Length(0, Fixed) && renderer->style().logicalHeight().isFixed() && rend erer->style().logicalMaxHeight().isAuto(); | 2088 bool hasSpecifiedLogicalHeight = renderer && renderer->style().logicalMinHei ght() == Length(0, Fixed) && renderer->style().logicalHeight().isFixed() && rend erer->style().logicalMaxHeight().isAuto(); |
2089 | 2089 |
2090 if (!requireFullLayout) { | 2090 if (!requireFullLayout) { |
2091 RenderBox* previousBox = nullptr; | 2091 RenderBox* previousBox = nullptr; |
2092 RenderBox* currentBox = nullptr; | 2092 RenderBox* currentBox = nullptr; |
2093 | 2093 |
2094 // Check our containing block chain. If anything in the chain needs a la yout, then require a full layout. | 2094 // Check our containing block chain. If anything in the chain needs a la yout, then require a full layout. |
2095 for (RenderObject* currRenderer = element.renderer(); currRenderer && !c urrRenderer->isRenderView(); currRenderer = currRenderer->container()) { | 2095 for (RenderObject* currRenderer = element.renderer(); currRenderer && !c urrRenderer->isRenderView(); currRenderer = currRenderer->container()) { |
2096 | 2096 |
2097 // Require the entire container chain to be boxes. | 2097 // Require the entire container chain to be boxes. |
2098 if (!is<RenderBox>(currRenderer)) { | 2098 if (!is<RenderBox>(currRenderer)) { |
2099 requireFullLayout = true; | 2099 requireFullLayout = true; |
2100 break; | 2100 break; |
2101 } | 2101 } |
2102 | 2102 |
2103 previousBox = currentBox; | 2103 previousBox = currentBox; |
2104 currentBox = downcast<RenderBox>(currRenderer); | 2104 currentBox = downcast<RenderBox>(currRenderer); |
2105 | 2105 |
2106 // If a box needs layout for itself or if a box has changed children and sizes its width to | 2106 // If a box needs layout for itself or if a box has changed children and sizes its width to |
2107 // its content, then require a full layout. | 2107 // its content, then require a full layout. |
2108 if (currentBox->selfNeedsLayout() || | 2108 if (currentBox->selfNeedsLayout() || |
2109 (checkingLogicalWidth && currRenderer->needsLayout() && currentB ox->sizesLogicalWidthToFitContent(MainOrPreferredSize))) { | 2109 (checkingLogicalWidth && currRenderer->needsLayout() && currentB ox->sizesLogicalWidthToFitContent(MainOrPreferredSize))) { |
2110 requireFullLayout = true; | 2110 requireFullLayout = true; |
2111 break; | 2111 break; |
2112 } | 2112 } |
2113 | 2113 |
2114 // If a block contains floats and the child's height isn't specified , then | 2114 // If a block contains floats and the child's height isn't specified , then |
2115 // give up also, since our height could end up being influenced by t he floats. | 2115 // give up also, since our height could end up being influenced by t he floats. |
2116 if (checkingLogicalHeight && !hasSpecifiedLogicalHeight && currentBo x->isRenderBlockFlow()) { | 2116 if (checkingLogicalHeight && !hasSpecifiedLogicalHeight && currentBo x->isRenderBlockFlow()) { |
2117 RenderBlockFlow* currentBlockFlow = downcast<RenderBlockFlow>(cu rrentBox); | 2117 RenderBlockFlow* currentBlockFlow = downcast<RenderBlockFlow>(cu rrentBox); |
2118 if (currentBlockFlow->containsFloats() && previousBox && !previo usBox->isFloatingOrOutOfFlowPositioned()) { | 2118 if (currentBlockFlow->containsFloats() && previousBox && !previo usBox->isFloatingOrOutOfFlowPositioned()) { |
2119 requireFullLayout = true; | 2119 requireFullLayout = true; |
2120 break; | 2120 break; |
2121 } | 2121 } |
2122 } | 2122 } |
2123 | 2123 |
2124 if (!currentBox->isRenderBlockFlow() || currentBox->enclosingFragmen tedFlow() || currentBox->isWritingModeRoot()) { | 2124 if (!currentBox->isRenderBlockFlow() || currentBox->enclosingFragmen tedFlow() || currentBox->isWritingModeRoot()) { |
2125 // FIXME: For now require only block flows all the way back to t he root. This limits the optimization | 2125 // FIXME: For now require only block flows all the way back to t he root. This limits the optimization |
2126 // for now, and we'll expand it in future patches to apply to mo re and more scenarios. | 2126 // for now, and we'll expand it in future patches to apply to mo re and more scenarios. |
2127 // Disallow columns from having the optimization. | 2127 // Disallow columns from having the optimization. |
2128 // Give up if the writing mode changes at all in the containing block chain. | 2128 // Give up if the writing mode changes at all in the containing block chain. |
2129 requireFullLayout = true; | 2129 requireFullLayout = true; |
2130 break; | 2130 break; |
2131 } | 2131 } |
2132 | 2132 |
2133 if (currRenderer == frameView->layoutContext().subtreeLayoutRoot()) | 2133 if (currRenderer == frameView->layoutContext().subtreeLayoutRoot()) |
2134 break; | 2134 break; |
2135 } | 2135 } |
2136 } | 2136 } |
2137 | 2137 |
2138 StackStats::LayoutCheckPoint layoutCheckPoint; | 2138 StackStats::LayoutCheckPoint layoutCheckPoint; |
2139 | 2139 |
2140 // Only do a layout if changes have occurred that make it necessary. | 2140 // Only do a layout if changes have occurred that make it necessary. |
2141 if (requireFullLayout && frameView && renderView() && (frameView->layoutCont ext().isLayoutPending() || renderView()->needsLayout())) | 2141 if (requireFullLayout && frameView && renderView() && (frameView->layoutCont ext().isLayoutPending() || renderView()->needsLayout())) |
2142 frameView->layoutContext().layout(); | 2142 frameView->layoutContext().layout(); |
2143 | 2143 |
2144 return requireFullLayout; | 2144 return requireFullLayout; |
2145 } | 2145 } |
2146 | 2146 |
2147 bool Document::isPageBoxVisible(int pageIndex) | 2147 bool Document::isPageBoxVisible(int pageIndex) |
2148 { | 2148 { |
2149 updateStyleIfNeeded(); | 2149 updateStyleIfNeeded(); |
2150 std::unique_ptr<RenderStyle> pageStyle(styleScope().resolver().styleForPage( pageIndex)); | 2150 std::unique_ptr<RenderStyle> pageStyle(styleScope().resolver().styleForPage( pageIndex)); |
2151 return pageStyle->visibility() != Visibility::Hidden; // display property do esn't apply to @page. | 2151 return pageStyle->visibility() != Visibility::Hidden; // display property do esn't apply to @page. |
2152 } | 2152 } |
2153 | 2153 |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2551 AXObjectCache* Document::existingAXObjectCacheSlow() const | 2551 AXObjectCache* Document::existingAXObjectCacheSlow() const |
2552 { | 2552 { |
2553 ASSERT(hasEverCreatedAnAXObjectCache); | 2553 ASSERT(hasEverCreatedAnAXObjectCache); |
2554 return topDocument().m_axObjectCache.get(); | 2554 return topDocument().m_axObjectCache.get(); |
2555 } | 2555 } |
2556 | 2556 |
2557 AXObjectCache* Document::axObjectCache() const | 2557 AXObjectCache* Document::axObjectCache() const |
2558 { | 2558 { |
2559 if (!AXObjectCache::accessibilityEnabled()) | 2559 if (!AXObjectCache::accessibilityEnabled()) |
2560 return nullptr; | 2560 return nullptr; |
2561 | 2561 |
2562 // The only document that actually has a AXObjectCache is the top-level | 2562 // The only document that actually has a AXObjectCache is the top-level |
2563 // document. This is because we need to be able to get from any WebCoreAXOb ject | 2563 // document. This is because we need to be able to get from any WebCoreAXOb ject |
2564 // to any other WebCoreAXObject on the same page. Using a single cache allo ws | 2564 // to any other WebCoreAXObject on the same page. Using a single cache allo ws |
2565 // lookups across nested webareas (i.e. multiple documents). | 2565 // lookups across nested webareas (i.e. multiple documents). |
2566 Document& topDocument = this->topDocument(); | 2566 Document& topDocument = this->topDocument(); |
2567 | 2567 |
2568 // If the document has already been detached, do not make a new axObjectCach e. | 2568 // If the document has already been detached, do not make a new axObjectCach e. |
2569 if (!topDocument.hasLivingRenderTree()) | 2569 if (!topDocument.hasLivingRenderTree()) |
2570 return nullptr; | 2570 return nullptr; |
2571 | 2571 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2781 void Document::implicitClose() | 2781 void Document::implicitClose() |
2782 { | 2782 { |
2783 // If we're in the middle of recalcStyle, we need to defer the close until t he style information is accurate and all elements are re-attached. | 2783 // If we're in the middle of recalcStyle, we need to defer the close until t he style information is accurate and all elements are re-attached. |
2784 if (m_inStyleRecalc) { | 2784 if (m_inStyleRecalc) { |
2785 m_closeAfterStyleRecalc = true; | 2785 m_closeAfterStyleRecalc = true; |
2786 return; | 2786 return; |
2787 } | 2787 } |
2788 | 2788 |
2789 bool wasLocationChangePending = frame() && frame()->navigationScheduler().lo cationChangePending(); | 2789 bool wasLocationChangePending = frame() && frame()->navigationScheduler().lo cationChangePending(); |
2790 bool doload = !parsing() && m_parser && !m_processingLoadEvent && !wasLocati onChangePending; | 2790 bool doload = !parsing() && m_parser && !m_processingLoadEvent && !wasLocati onChangePending; |
2791 | 2791 |
2792 if (!doload) | 2792 if (!doload) |
2793 return; | 2793 return; |
2794 | 2794 |
2795 // Call to dispatchWindowLoadEvent can blow us from underneath. | 2795 // Call to dispatchWindowLoadEvent can blow us from underneath. |
2796 Ref<Document> protectedThis(*this); | 2796 Ref<Document> protectedThis(*this); |
2797 | 2797 |
2798 m_processingLoadEvent = true; | 2798 m_processingLoadEvent = true; |
2799 | 2799 |
2800 ScriptableDocumentParser* parser = scriptableDocumentParser(); | 2800 ScriptableDocumentParser* parser = scriptableDocumentParser(); |
2801 m_wellFormed = parser && parser->wellFormed(); | 2801 m_wellFormed = parser && parser->wellFormed(); |
2802 | 2802 |
2803 // We have to clear the parser, in case someone document.write()s from the | 2803 // We have to clear the parser, in case someone document.write()s from the |
2804 // onLoad event handler, as in Radar 3206524. | 2804 // onLoad event handler, as in Radar 3206524. |
2805 detachParser(); | 2805 detachParser(); |
2806 | 2806 |
2807 // FIXME: We kick off the icon loader when the Document is done parsing. | 2807 // FIXME: We kick off the icon loader when the Document is done parsing. |
2808 // There are earlier opportunities we could start it: | 2808 // There are earlier opportunities we could start it: |
2809 // -When the <head> finishes parsing | 2809 // -When the <head> finishes parsing |
2810 // -When any new HTMLLinkElement is inserted into the document | 2810 // -When any new HTMLLinkElement is inserted into the document |
2811 // But those add a dynamic component to the favicon that has UI | 2811 // But those add a dynamic component to the favicon that has UI |
2812 // ramifications, and we need to decide what is the Right Thing To Do(tm) | 2812 // ramifications, and we need to decide what is the Right Thing To Do(tm) |
2813 RefPtr<Frame> f = frame(); | 2813 RefPtr<Frame> f = frame(); |
2814 if (f) { | 2814 if (f) { |
2815 #if ENABLE(XSLT) | 2815 #if ENABLE(XSLT) |
2816 // Apply XSL transforms before load events so that event handlers can ac cess the transformed DOM tree. | 2816 // Apply XSL transforms before load events so that event handlers can ac cess the transformed DOM tree. |
2817 applyPendingXSLTransformsNowIfScheduled(); | 2817 applyPendingXSLTransformsNowIfScheduled(); |
2818 #endif | 2818 #endif |
2819 | 2819 |
2820 if (auto* documentLoader = loader()) | 2820 if (auto* documentLoader = loader()) |
2821 documentLoader->startIconLoading(); | 2821 documentLoader->startIconLoading(); |
(...skipping 29 matching lines...) Expand all Loading... | |
2851 m_processingLoadEvent = false; | 2851 m_processingLoadEvent = false; |
2852 return; | 2852 return; |
2853 } | 2853 } |
2854 | 2854 |
2855 // Make sure both the initial layout and reflow happen after the onload | 2855 // Make sure both the initial layout and reflow happen after the onload |
2856 // fires. This will improve onload scores, and other browsers do it. | 2856 // fires. This will improve onload scores, and other browsers do it. |
2857 // If they wanna cheat, we can too. -dwh | 2857 // If they wanna cheat, we can too. -dwh |
2858 | 2858 |
2859 if (frame()->navigationScheduler().locationChangePending() && timeSinceDocum entCreation() < settings().layoutInterval()) { | 2859 if (frame()->navigationScheduler().locationChangePending() && timeSinceDocum entCreation() < settings().layoutInterval()) { |
2860 // Just bail out. Before or during the onload we were shifted to another page. | 2860 // Just bail out. Before or during the onload we were shifted to another page. |
2861 // The old i-Bench suite does this. When this happens don't bother paint ing or laying out. | 2861 // The old i-Bench suite does this. When this happens don't bother paint ing or laying out. |
2862 m_processingLoadEvent = false; | 2862 m_processingLoadEvent = false; |
2863 view()->layoutContext().unscheduleLayout(); | 2863 view()->layoutContext().unscheduleLayout(); |
2864 return; | 2864 return; |
2865 } | 2865 } |
2866 | 2866 |
2867 frame()->loader().checkCallImplicitClose(); | 2867 frame()->loader().checkCallImplicitClose(); |
2868 | 2868 |
2869 // We used to force a synchronous display and flush here. This really isn't | 2869 // We used to force a synchronous display and flush here. This really isn't |
2870 // necessary and can in fact be actively harmful if pages are loading at a r ate of > 60fps | 2870 // necessary and can in fact be actively harmful if pages are loading at a r ate of > 60fps |
2871 // (if your platform is syncing flushes and limiting them to 60fps). | 2871 // (if your platform is syncing flushes and limiting them to 60fps). |
2872 m_overMinimumLayoutThreshold = true; | 2872 m_overMinimumLayoutThreshold = true; |
2873 if (!ownerElement() || (ownerElement()->renderer() && !ownerElement()->rende rer()->needsLayout())) { | 2873 if (!ownerElement() || (ownerElement()->renderer() && !ownerElement()->rende rer()->needsLayout())) { |
2874 updateStyleIfNeeded(); | 2874 updateStyleIfNeeded(); |
2875 | 2875 |
2876 // Always do a layout after loading if needed. | 2876 // Always do a layout after loading if needed. |
2877 if (view() && renderView() && (!renderView()->firstChild() || renderView ()->needsLayout())) | 2877 if (view() && renderView() && (!renderView()->firstChild() || renderView ()->needsLayout())) |
2878 view()->layoutContext().layout(); | 2878 view()->layoutContext().layout(); |
2879 } | 2879 } |
2880 | 2880 |
2881 m_processingLoadEvent = false; | 2881 m_processingLoadEvent = false; |
2882 | 2882 |
2883 #if PLATFORM(COCOA) || PLATFORM(WIN) || PLATFORM(GTK) | 2883 #if PLATFORM(COCOA) || PLATFORM(WIN) || PLATFORM(GTK) |
2884 if (f && hasLivingRenderTree() && AXObjectCache::accessibilityEnabled()) { | 2884 if (f && hasLivingRenderTree() && AXObjectCache::accessibilityEnabled()) { |
2885 // The AX cache may have been cleared at this point, but we need to make sure it contains an | 2885 // The AX cache may have been cleared at this point, but we need to make sure it contains an |
2886 // AX object to send the notification to. getOrCreate will make sure tha t an valid AX object | 2886 // AX object to send the notification to. getOrCreate will make sure tha t an valid AX object |
2887 // exists in the cache (we ignore the return value because we don't need it here). This is | 2887 // exists in the cache (we ignore the return value because we don't need it here). This is |
2888 // only safe to call when a layout is not in progress, so it can not be used in postNotification. | 2888 // only safe to call when a layout is not in progress, so it can not be used in postNotification. |
2889 // | 2889 // |
2890 // This notification is now called AXNewDocumentLoadComplete because the re are other handlers that will | 2890 // This notification is now called AXNewDocumentLoadComplete because the re are other handlers that will |
2891 // catch new AND page history loads, and that uses AXLoadComplete | 2891 // catch new AND page history loads, and that uses AXLoadComplete |
2892 | 2892 |
2893 axObjectCache()->getOrCreate(renderView()); | 2893 axObjectCache()->getOrCreate(renderView()); |
2894 if (this == &topDocument()) | 2894 if (this == &topDocument()) |
2895 axObjectCache()->postNotification(renderView(), AXObjectCache::AXNew DocumentLoadComplete); | 2895 axObjectCache()->postNotification(renderView(), AXObjectCache::AXNew DocumentLoadComplete); |
2896 else { | 2896 else { |
2897 // AXLoadComplete can only be posted on the top document, so if it's a document | 2897 // AXLoadComplete can only be posted on the top document, so if it's a document |
2898 // in an iframe that just finished loading, post AXLayoutComplete in stead. | 2898 // in an iframe that just finished loading, post AXLayoutComplete in stead. |
2899 axObjectCache()->postNotification(renderView(), AXObjectCache::AXLay outComplete); | 2899 axObjectCache()->postNotification(renderView(), AXObjectCache::AXLay outComplete); |
2900 } | 2900 } |
2901 } | 2901 } |
2902 #endif | 2902 #endif |
(...skipping 19 matching lines...) Expand all Loading... | |
2922 return false; | 2922 return false; |
2923 if (!is<HTMLHtmlElement>(*documentElement())) | 2923 if (!is<HTMLHtmlElement>(*documentElement())) |
2924 return true; | 2924 return true; |
2925 if (!bodyOrFrameset()) | 2925 if (!bodyOrFrameset()) |
2926 return false; | 2926 return false; |
2927 if (styleScope().hasPendingSheetsBeforeBody()) | 2927 if (styleScope().hasPendingSheetsBeforeBody()) |
2928 return false; | 2928 return false; |
2929 | 2929 |
2930 return true; | 2930 return true; |
2931 } | 2931 } |
2932 | 2932 |
2933 bool Document::isLayoutTimerActive() | 2933 bool Document::isLayoutTimerActive() |
2934 { | 2934 { |
2935 return view() && view()->layoutContext().isLayoutPending() && !minimumLayout Delay(); | 2935 return view() && view()->layoutContext().isLayoutPending() && !minimumLayout Delay(); |
2936 } | 2936 } |
2937 | 2937 |
2938 Seconds Document::minimumLayoutDelay() | 2938 Seconds Document::minimumLayoutDelay() |
2939 { | 2939 { |
2940 if (m_overMinimumLayoutThreshold) | 2940 if (m_overMinimumLayoutThreshold) |
2941 return 0_s; | 2941 return 0_s; |
2942 | 2942 |
2943 auto elapsed = timeSinceDocumentCreation(); | 2943 auto elapsed = timeSinceDocumentCreation(); |
2944 m_overMinimumLayoutThreshold = elapsed > settings().layoutInterval(); | 2944 m_overMinimumLayoutThreshold = elapsed > settings().layoutInterval(); |
2945 | 2945 |
2946 // We'll want to schedule the timer to fire at the minimum layout threshold. | 2946 // We'll want to schedule the timer to fire at the minimum layout threshold. |
2947 return std::max(0_s, settings().layoutInterval() - elapsed); | 2947 return std::max(0_s, settings().layoutInterval() - elapsed); |
2948 } | 2948 } |
2949 | 2949 |
2950 Seconds Document::timeSinceDocumentCreation() const | 2950 Seconds Document::timeSinceDocumentCreation() const |
2951 { | 2951 { |
2952 return MonotonicTime::now() - m_documentCreationTime; | 2952 return MonotonicTime::now() - m_documentCreationTime; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3170 m_idbConnectionProxy = ¤tPage->idbConnection().proxy(); | 3170 m_idbConnectionProxy = ¤tPage->idbConnection().proxy(); |
3171 } | 3171 } |
3172 return m_idbConnectionProxy.get(); | 3172 return m_idbConnectionProxy.get(); |
3173 } | 3173 } |
3174 #endif | 3174 #endif |
3175 | 3175 |
3176 SocketProvider* Document::socketProvider() | 3176 SocketProvider* Document::socketProvider() |
3177 { | 3177 { |
3178 return m_socketProvider.get(); | 3178 return m_socketProvider.get(); |
3179 } | 3179 } |
3180 | 3180 |
3181 bool Document::canNavigate(Frame* targetFrame) | 3181 bool Document::canNavigate(Frame* targetFrame) |
3182 { | 3182 { |
3183 if (!m_frame) | 3183 if (!m_frame) |
3184 return false; | 3184 return false; |
3185 | 3185 |
3186 // FIXME: We shouldn't call this function without a target frame, but | 3186 // FIXME: We shouldn't call this function without a target frame, but |
3187 // fast/forms/submit-to-blank-multiple-times.html depends on this function | 3187 // fast/forms/submit-to-blank-multiple-times.html depends on this function |
3188 // returning true when supplied with a 0 targetFrame. | 3188 // returning true when supplied with a 0 targetFrame. |
3189 if (!targetFrame) | 3189 if (!targetFrame) |
3190 return true; | 3190 return true; |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3486 | 3486 |
3487 // Documents in a Content-Disposition: attachment sandbox should never send a Referer header, | 3487 // Documents in a Content-Disposition: attachment sandbox should never send a Referer header, |
3488 // even if the document has a meta tag saying otherwise. | 3488 // even if the document has a meta tag saying otherwise. |
3489 if (shouldEnforceContentDispositionAttachmentSandbox()) | 3489 if (shouldEnforceContentDispositionAttachmentSandbox()) |
3490 return; | 3490 return; |
3491 | 3491 |
3492 #if USE(QUICK_LOOK) | 3492 #if USE(QUICK_LOOK) |
3493 if (shouldEnforceQuickLookSandbox()) | 3493 if (shouldEnforceQuickLookSandbox()) |
3494 return; | 3494 return; |
3495 #endif | 3495 #endif |
3496 | 3496 |
3497 auto referrerPolicy = parseReferrerPolicy(policy, source); | 3497 auto referrerPolicy = parseReferrerPolicy(policy, source); |
3498 if (!referrerPolicy) { | 3498 if (!referrerPolicy) { |
3499 // Unknown policy values are ignored (https://w3c.github.io/webappsec-re ferrer-policy/#unknown-policy-values). | 3499 // Unknown policy values are ignored (https://w3c.github.io/webappsec-re ferrer-policy/#unknown-policy-values). |
3500 addConsoleMessage(MessageSource::Rendering, MessageLevel::Error, "Failed to set referrer policy: The value '" + policy + "' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'same-origin', 'origin', 'strict-origin', 'origin -when-cross-origin', 'strict-origin-when-cross-origin' or 'unsafe-url'."); | 3500 addConsoleMessage(MessageSource::Rendering, MessageLevel::Error, "Failed to set referrer policy: The value '" + policy + "' is not one of 'no-referrer', 'no-referrer-when-downgrade', 'same-origin', 'origin', 'strict-origin', 'origin -when-cross-origin', 'strict-origin-when-cross-origin' or 'unsafe-url'."); |
3501 return; | 3501 return; |
3502 } | 3502 } |
3503 setReferrerPolicy(referrerPolicy.value()); | 3503 setReferrerPolicy(referrerPolicy.value()); |
3504 } | 3504 } |
3505 | 3505 |
3506 MouseEventWithHitTestResults Document::prepareMouseEvent(const HitTestRequest& r equest, const LayoutPoint& documentPoint, const PlatformMouseEvent& event) | 3506 MouseEventWithHitTestResults Document::prepareMouseEvent(const HitTestRequest& r equest, const LayoutPoint& documentPoint, const PlatformMouseEvent& event) |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3653 { | 3653 { |
3654 if (!m_styleSheetList) | 3654 if (!m_styleSheetList) |
3655 m_styleSheetList = StyleSheetList::create(this); | 3655 m_styleSheetList = StyleSheetList::create(this); |
3656 return *m_styleSheetList; | 3656 return *m_styleSheetList; |
3657 } | 3657 } |
3658 | 3658 |
3659 void Document::evaluateMediaQueryList() | 3659 void Document::evaluateMediaQueryList() |
3660 { | 3660 { |
3661 if (m_mediaQueryMatcher) | 3661 if (m_mediaQueryMatcher) |
3662 m_mediaQueryMatcher->styleResolverChanged(); | 3662 m_mediaQueryMatcher->styleResolverChanged(); |
3663 | 3663 |
3664 checkViewportDependentPictures(); | 3664 checkViewportDependentPictures(); |
3665 } | 3665 } |
3666 | 3666 |
3667 void Document::checkViewportDependentPictures() | 3667 void Document::checkViewportDependentPictures() |
3668 { | 3668 { |
3669 Vector<HTMLPictureElement*, 16> changedPictures; | 3669 Vector<HTMLPictureElement*, 16> changedPictures; |
3670 HashSet<HTMLPictureElement*>::iterator end = m_viewportDependentPictures.end (); | 3670 HashSet<HTMLPictureElement*>::iterator end = m_viewportDependentPictures.end (); |
3671 for (HashSet<HTMLPictureElement*>::iterator it = m_viewportDependentPictures .begin(); it != end; ++it) { | 3671 for (HashSet<HTMLPictureElement*>::iterator it = m_viewportDependentPictures .begin(); it != end; ++it) { |
3672 if ((*it)->viewportChangeAffectedPicture()) | 3672 if ((*it)->viewportChangeAffectedPicture()) |
3673 changedPictures.append(*it); | 3673 changedPictures.append(*it); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3739 | 3739 |
3740 if (m_userHasInteractedWithMediaElement) | 3740 if (m_userHasInteractedWithMediaElement) |
3741 state |= MediaProducer::HasUserInteractedWithMediaElement; | 3741 state |= MediaProducer::HasUserInteractedWithMediaElement; |
3742 | 3742 |
3743 if (state == m_mediaState) | 3743 if (state == m_mediaState) |
3744 return; | 3744 return; |
3745 | 3745 |
3746 #if ENABLE(MEDIA_STREAM) | 3746 #if ENABLE(MEDIA_STREAM) |
3747 bool captureStateChanged = MediaProducer::isCapturing(m_mediaState) != Media Producer::isCapturing(state); | 3747 bool captureStateChanged = MediaProducer::isCapturing(m_mediaState) != Media Producer::isCapturing(state); |
3748 #endif | 3748 #endif |
3749 | 3749 |
3750 m_mediaState = state; | 3750 m_mediaState = state; |
3751 | 3751 |
3752 if (page()) | 3752 if (page()) |
3753 page()->updateIsPlayingMedia(sourceElementID); | 3753 page()->updateIsPlayingMedia(sourceElementID); |
3754 | 3754 |
3755 #if ENABLE(MEDIA_STREAM) | 3755 #if ENABLE(MEDIA_STREAM) |
3756 if (captureStateChanged) | 3756 if (captureStateChanged) |
3757 mediaStreamCaptureStateChanged(); | 3757 mediaStreamCaptureStateChanged(); |
3758 #endif | 3758 #endif |
3759 } | 3759 } |
(...skipping 13 matching lines...) Expand all Loading... | |
3773 } | 3773 } |
3774 | 3774 |
3775 void Document::removeFocusedNodeOfSubtree(Node& node, bool amongChildrenOnly) | 3775 void Document::removeFocusedNodeOfSubtree(Node& node, bool amongChildrenOnly) |
3776 { | 3776 { |
3777 if (!m_focusedElement || pageCacheState() != NotInPageCache) // If the docum ent is in the page cache, then we don't need to clear out the focused node. | 3777 if (!m_focusedElement || pageCacheState() != NotInPageCache) // If the docum ent is in the page cache, then we don't need to clear out the focused node. |
3778 return; | 3778 return; |
3779 | 3779 |
3780 Element* focusedElement = node.treeScope().focusedElementInScope(); | 3780 Element* focusedElement = node.treeScope().focusedElementInScope(); |
3781 if (!focusedElement) | 3781 if (!focusedElement) |
3782 return; | 3782 return; |
3783 | 3783 |
3784 if (isNodeInSubtree(*focusedElement, node, amongChildrenOnly)) { | 3784 if (isNodeInSubtree(*focusedElement, node, amongChildrenOnly)) { |
3785 // FIXME: We should avoid synchronously updating the style inside setFoc usedElement. | 3785 // FIXME: We should avoid synchronously updating the style inside setFoc usedElement. |
3786 // FIXME: Object elements should avoid loading a frame synchronously in a post style recalc callback. | 3786 // FIXME: Object elements should avoid loading a frame synchronously in a post style recalc callback. |
3787 SubframeLoadingDisabler disabler(is<ContainerNode>(node) ? &downcast<Con tainerNode>(node) : nullptr); | 3787 SubframeLoadingDisabler disabler(is<ContainerNode>(node) ? &downcast<Con tainerNode>(node) : nullptr); |
3788 setFocusedElement(nullptr, FocusDirectionNone, FocusRemovalEventsMode::D oNotDispatch); | 3788 setFocusedElement(nullptr, FocusDirectionNone, FocusRemovalEventsMode::D oNotDispatch); |
3789 // Set the focus navigation starting node to the previous focused elemen t so that | 3789 // Set the focus navigation starting node to the previous focused elemen t so that |
3790 // we can fallback to the siblings or parent node for the next search. | 3790 // we can fallback to the siblings or parent node for the next search. |
3791 // Also we need to call removeFocusNavigationNodeOfSubtree after this fu nction because | 3791 // Also we need to call removeFocusNavigationNodeOfSubtree after this fu nction because |
3792 // setFocusedElement(nullptr) will reset m_focusNavigationStartingNode. | 3792 // setFocusedElement(nullptr) will reset m_focusNavigationStartingNode. |
3793 setFocusNavigationStartingNode(focusedElement); | 3793 setFocusNavigationStartingNode(focusedElement); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4018 { | 4018 { |
4019 if (m_focusedElement) { | 4019 if (m_focusedElement) { |
4020 if (!m_focusNavigationStartingNode || !m_focusNavigationStartingNode->is DescendantOf(m_focusedElement.get())) | 4020 if (!m_focusNavigationStartingNode || !m_focusNavigationStartingNode->is DescendantOf(m_focusedElement.get())) |
4021 return m_focusedElement.get(); | 4021 return m_focusedElement.get(); |
4022 } | 4022 } |
4023 | 4023 |
4024 if (!m_focusNavigationStartingNode) | 4024 if (!m_focusNavigationStartingNode) |
4025 return nullptr; | 4025 return nullptr; |
4026 | 4026 |
4027 Node* node = m_focusNavigationStartingNode.get(); | 4027 Node* node = m_focusNavigationStartingNode.get(); |
4028 | 4028 |
4029 // When the node was removed from the document tree. This case is not specif ied in the spec: | 4029 // When the node was removed from the document tree. This case is not specif ied in the spec: |
4030 // https://html.spec.whatwg.org/multipage/interaction.html#sequential-focus- navigation-starting-point | 4030 // https://html.spec.whatwg.org/multipage/interaction.html#sequential-focus- navigation-starting-point |
4031 // Current behaivor is to move the sequential navigation node to / after (ba sed on the focus direction) | 4031 // Current behaivor is to move the sequential navigation node to / after (ba sed on the focus direction) |
4032 // the previous sibling of the removed node. | 4032 // the previous sibling of the removed node. |
4033 if (m_focusNavigationStartingNodeIsRemoved) { | 4033 if (m_focusNavigationStartingNodeIsRemoved) { |
4034 Node* nextNode = NodeTraversal::next(*node); | 4034 Node* nextNode = NodeTraversal::next(*node); |
4035 if (!nextNode) | 4035 if (!nextNode) |
4036 nextNode = node; | 4036 nextNode = node; |
4037 if (direction == FocusDirectionForward) | 4037 if (direction == FocusDirectionForward) |
4038 return ElementTraversal::previous(*nextNode); | 4038 return ElementTraversal::previous(*nextNode); |
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4970 void Document::registerForDocumentSuspensionCallbacks(Element* e) | 4970 void Document::registerForDocumentSuspensionCallbacks(Element* e) |
4971 { | 4971 { |
4972 m_documentSuspensionCallbackElements.add(e); | 4972 m_documentSuspensionCallbackElements.add(e); |
4973 } | 4973 } |
4974 | 4974 |
4975 void Document::unregisterForDocumentSuspensionCallbacks(Element* e) | 4975 void Document::unregisterForDocumentSuspensionCallbacks(Element* e) |
4976 { | 4976 { |
4977 m_documentSuspensionCallbackElements.remove(e); | 4977 m_documentSuspensionCallbackElements.remove(e); |
4978 } | 4978 } |
4979 | 4979 |
4980 void Document::mediaVolumeDidChange() | 4980 void Document::mediaVolumeDidChange() |
4981 { | 4981 { |
4982 for (auto* element : m_mediaVolumeCallbackElements) | 4982 for (auto* element : m_mediaVolumeCallbackElements) |
4983 element->mediaVolumeDidChange(); | 4983 element->mediaVolumeDidChange(); |
4984 } | 4984 } |
4985 | 4985 |
4986 void Document::registerForMediaVolumeCallbacks(Element* e) | 4986 void Document::registerForMediaVolumeCallbacks(Element* e) |
4987 { | 4987 { |
4988 m_mediaVolumeCallbackElements.add(e); | 4988 m_mediaVolumeCallbackElements.add(e); |
4989 } | 4989 } |
4990 | 4990 |
(...skipping 24 matching lines...) Expand all Loading... | |
5015 } | 5015 } |
5016 | 5016 |
5017 return settings().videoPlaybackRequiresUserGesture(); | 5017 return settings().videoPlaybackRequiresUserGesture(); |
5018 } | 5018 } |
5019 | 5019 |
5020 void Document::storageBlockingStateDidChange() | 5020 void Document::storageBlockingStateDidChange() |
5021 { | 5021 { |
5022 securityOrigin().setStorageBlockingPolicy(settings().storageBlockingPolicy() ); | 5022 securityOrigin().setStorageBlockingPolicy(settings().storageBlockingPolicy() ); |
5023 } | 5023 } |
5024 | 5024 |
5025 void Document::privateBrowsingStateDidChange() | 5025 void Document::privateBrowsingStateDidChange() |
5026 { | 5026 { |
5027 m_sessionID = SessionID::emptySessionID(); | 5027 m_sessionID = SessionID::emptySessionID(); |
5028 if (m_logger) | 5028 if (m_logger) |
5029 m_logger->setEnabled(this, sessionID().isAlwaysOnLoggingAllowed()); | 5029 m_logger->setEnabled(this, sessionID().isAlwaysOnLoggingAllowed()); |
5030 | 5030 |
5031 for (auto* element : m_privateBrowsingStateChangedElements) | 5031 for (auto* element : m_privateBrowsingStateChangedElements) |
5032 element->privateBrowsingStateDidChange(); | 5032 element->privateBrowsingStateDidChange(); |
5033 | 5033 |
5034 #if ENABLE(SERVICE_WORKER) | 5034 #if ENABLE(SERVICE_WORKER) |
5035 ASSERT(sessionID().isValid()); | 5035 ASSERT(sessionID().isValid()); |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5596 return; | 5596 return; |
5597 } | 5597 } |
5598 | 5598 |
5599 Document* openerDocument = openerFrame ? openerFrame->document() : nullptr; | 5599 Document* openerDocument = openerFrame ? openerFrame->document() : nullptr; |
5600 | 5600 |
5601 // Per <http://www.w3.org/TR/upgrade-insecure-requests/>, new browsing conte xts must inherit from an | 5601 // Per <http://www.w3.org/TR/upgrade-insecure-requests/>, new browsing conte xts must inherit from an |
5602 // ongoing set of upgraded requests. When opening a new browsing context, we need to capture its | 5602 // ongoing set of upgraded requests. When opening a new browsing context, we need to capture its |
5603 // existing upgrade request. Nested browsing contexts are handled during Doc umentWriter::begin. | 5603 // existing upgrade request. Nested browsing contexts are handled during Doc umentWriter::begin. |
5604 if (openerDocument) | 5604 if (openerDocument) |
5605 contentSecurityPolicy()->inheritInsecureNavigationRequestsToUpgradeFromO pener(*openerDocument->contentSecurityPolicy()); | 5605 contentSecurityPolicy()->inheritInsecureNavigationRequestsToUpgradeFromO pener(*openerDocument->contentSecurityPolicy()); |
5606 | 5606 |
5607 if (isSandboxed(SandboxOrigin)) { | 5607 if (isSandboxed(SandboxOrigin)) { |
5608 // If we're supposed to inherit our security origin from our owner, | 5608 // If we're supposed to inherit our security origin from our owner, |
5609 // but we're also sandboxed, the only thing we inherit is the ability | 5609 // but we're also sandboxed, the only thing we inherit is the ability |
5610 // to load local resources. This lets about:blank iframes in file:// | 5610 // to load local resources. This lets about:blank iframes in file:// |
5611 // URL documents load images and other resources from the file system. | 5611 // URL documents load images and other resources from the file system. |
5612 if (ownerFrame->document()->securityOrigin().canLoadLocalResources()) | 5612 if (ownerFrame->document()->securityOrigin().canLoadLocalResources()) |
5613 securityOrigin().grantLoadLocalResources(); | 5613 securityOrigin().grantLoadLocalResources(); |
5614 return; | 5614 return; |
5615 } | 5615 } |
5616 | 5616 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5681 f->loader().setOutgoingReferrer(url); | 5681 f->loader().setOutgoingReferrer(url); |
5682 | 5682 |
5683 if (DocumentLoader* documentLoader = loader()) | 5683 if (DocumentLoader* documentLoader = loader()) |
5684 documentLoader->replaceRequestURLForSameDocumentNavigation(url); | 5684 documentLoader->replaceRequestURLForSameDocumentNavigation(url); |
5685 } | 5685 } |
5686 | 5686 |
5687 void Document::statePopped(Ref<SerializedScriptValue>&& stateObject) | 5687 void Document::statePopped(Ref<SerializedScriptValue>&& stateObject) |
5688 { | 5688 { |
5689 if (!frame()) | 5689 if (!frame()) |
5690 return; | 5690 return; |
5691 | 5691 |
5692 // Per step 11 of section 6.5.9 (history traversal) of the HTML5 spec, we | 5692 // Per step 11 of section 6.5.9 (history traversal) of the HTML5 spec, we |
5693 // defer firing of popstate until we're in the complete state. | 5693 // defer firing of popstate until we're in the complete state. |
5694 if (m_readyState == Complete) | 5694 if (m_readyState == Complete) |
5695 dispatchPopstateEvent(WTFMove(stateObject)); | 5695 dispatchPopstateEvent(WTFMove(stateObject)); |
5696 else | 5696 else |
5697 m_pendingStateObject = WTFMove(stateObject); | 5697 m_pendingStateObject = WTFMove(stateObject); |
5698 } | 5698 } |
5699 | 5699 |
5700 void Document::attachRange(Range* range) | 5700 void Document::attachRange(Range* range) |
5701 { | 5701 { |
5702 ASSERT(!m_ranges.contains(range)); | 5702 ASSERT(!m_ranges.contains(range)); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5760 m_textAutoSizing = std::make_unique<TextAutoSizing>(); | 5760 m_textAutoSizing = std::make_unique<TextAutoSizing>(); |
5761 return *m_textAutoSizing; | 5761 return *m_textAutoSizing; |
5762 } | 5762 } |
5763 #endif // ENABLE(TEXT_AUTOSIZING) | 5763 #endif // ENABLE(TEXT_AUTOSIZING) |
5764 | 5764 |
5765 void Document::initDNSPrefetch() | 5765 void Document::initDNSPrefetch() |
5766 { | 5766 { |
5767 m_haveExplicitlyDisabledDNSPrefetch = false; | 5767 m_haveExplicitlyDisabledDNSPrefetch = false; |
5768 m_isDNSPrefetchEnabled = settings().dnsPrefetchingEnabled() && securityOrigi n().protocol() == "http"; | 5768 m_isDNSPrefetchEnabled = settings().dnsPrefetchingEnabled() && securityOrigi n().protocol() == "http"; |
5769 | 5769 |
5770 // Inherit DNS prefetch opt-out from parent frame | 5770 // Inherit DNS prefetch opt-out from parent frame |
5771 if (Document* parent = parentDocument()) { | 5771 if (Document* parent = parentDocument()) { |
5772 if (!parent->isDNSPrefetchEnabled()) | 5772 if (!parent->isDNSPrefetchEnabled()) |
5773 m_isDNSPrefetchEnabled = false; | 5773 m_isDNSPrefetchEnabled = false; |
5774 } | 5774 } |
5775 } | 5775 } |
5776 | 5776 |
5777 void Document::parseDNSPrefetchControlHeader(const String& dnsPrefetchControl) | 5777 void Document::parseDNSPrefetchControlHeader(const String& dnsPrefetchControl) |
5778 { | 5778 { |
5779 if (!settings().dnsPrefetchingEnabled()) | 5779 if (!settings().dnsPrefetchingEnabled()) |
5780 return; | 5780 return; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5890 #if ENABLE(XSLT) | 5890 #if ENABLE(XSLT) |
5891 if (m_hasPendingXSLTransforms) | 5891 if (m_hasPendingXSLTransforms) |
5892 m_applyPendingXSLTransformsTimer.startOneShot(0_s); | 5892 m_applyPendingXSLTransformsTimer.startOneShot(0_s); |
5893 #endif | 5893 #endif |
5894 | 5894 |
5895 if (!m_pendingTasks.isEmpty()) | 5895 if (!m_pendingTasks.isEmpty()) |
5896 m_pendingTasksTimer.startOneShot(0_s); | 5896 m_pendingTasksTimer.startOneShot(0_s); |
5897 scriptRunner()->resume(); | 5897 scriptRunner()->resume(); |
5898 resumeActiveDOMObjects(reason); | 5898 resumeActiveDOMObjects(reason); |
5899 resumeScriptedAnimationControllerCallbacks(); | 5899 resumeScriptedAnimationControllerCallbacks(); |
5900 | 5900 |
5901 m_scheduledTasksAreSuspended = false; | 5901 m_scheduledTasksAreSuspended = false; |
5902 } | 5902 } |
5903 | 5903 |
5904 void Document::suspendScriptedAnimationControllerCallbacks() | 5904 void Document::suspendScriptedAnimationControllerCallbacks() |
5905 { | 5905 { |
5906 if (m_scriptedAnimationController) | 5906 if (m_scriptedAnimationController) |
5907 m_scriptedAnimationController->suspend(); | 5907 m_scriptedAnimationController->suspend(); |
5908 } | 5908 } |
5909 | 5909 |
5910 void Document::resumeScriptedAnimationControllerCallbacks() | 5910 void Document::resumeScriptedAnimationControllerCallbacks() |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5992 { | 5992 { |
5993 ASSERT(element); | 5993 ASSERT(element); |
5994 return isAttributeOnAllOwners(allowfullscreenAttr, webkitallowfullscreenAttr , element->document().ownerElement()); | 5994 return isAttributeOnAllOwners(allowfullscreenAttr, webkitallowfullscreenAttr , element->document().ownerElement()); |
5995 } | 5995 } |
5996 | 5996 |
5997 void Document::requestFullScreenForElement(Element* element, FullScreenCheckType checkType) | 5997 void Document::requestFullScreenForElement(Element* element, FullScreenCheckType checkType) |
5998 { | 5998 { |
5999 do { | 5999 do { |
6000 if (!element) | 6000 if (!element) |
6001 element = documentElement(); | 6001 element = documentElement(); |
6002 | 6002 |
6003 // 1. If any of the following conditions are true, terminate these steps and queue a task to fire | 6003 // 1. If any of the following conditions are true, terminate these steps and queue a task to fire |
6004 // an event named fullscreenerror with its bubbles attribute set to true on the context object's | 6004 // an event named fullscreenerror with its bubbles attribute set to true on the context object's |
6005 // node document: | 6005 // node document: |
6006 | 6006 |
6007 // The context object is not in a document. | 6007 // The context object is not in a document. |
6008 if (!element->isConnected()) | 6008 if (!element->isConnected()) |
6009 break; | 6009 break; |
6010 | 6010 |
6011 // The context object's node document, or an ancestor browsing context's document does not have | 6011 // The context object's node document, or an ancestor browsing context's document does not have |
6012 // the fullscreen enabled flag set. | 6012 // the fullscreen enabled flag set. |
6013 if (checkType == EnforceIFrameAllowFullScreenRequirement && !fullScreenI sAllowedForElement(element)) | 6013 if (checkType == EnforceIFrameAllowFullScreenRequirement && !fullScreenI sAllowedForElement(element)) |
6014 break; | 6014 break; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6117 | 6117 |
6118 m_fullScreenErrorEventTargetQueue.append(element ? element : documentElement ()); | 6118 m_fullScreenErrorEventTargetQueue.append(element ? element : documentElement ()); |
6119 m_fullScreenTaskQueue.enqueueTask([this] { | 6119 m_fullScreenTaskQueue.enqueueTask([this] { |
6120 dispatchFullScreenChangeEvents(); | 6120 dispatchFullScreenChangeEvents(); |
6121 }); | 6121 }); |
6122 } | 6122 } |
6123 | 6123 |
6124 void Document::webkitCancelFullScreen() | 6124 void Document::webkitCancelFullScreen() |
6125 { | 6125 { |
6126 // The Mozilla "cancelFullScreen()" API behaves like the W3C "fully exit ful lscreen" behavior, which | 6126 // The Mozilla "cancelFullScreen()" API behaves like the W3C "fully exit ful lscreen" behavior, which |
6127 // is defined as: | 6127 // is defined as: |
6128 // "To fully exit fullscreen act as if the exitFullscreen() method was invok ed on the top-level browsing | 6128 // "To fully exit fullscreen act as if the exitFullscreen() method was invok ed on the top-level browsing |
6129 // context's document and subsequently empty that document's fullscreen elem ent stack." | 6129 // context's document and subsequently empty that document's fullscreen elem ent stack." |
6130 Document& topDocument = this->topDocument(); | 6130 Document& topDocument = this->topDocument(); |
6131 if (!topDocument.webkitFullscreenElement()) | 6131 if (!topDocument.webkitFullscreenElement()) |
6132 return; | 6132 return; |
6133 | 6133 |
6134 // To achieve that aim, remove all the elements from the top document's stac k except for the first before | 6134 // To achieve that aim, remove all the elements from the top document's stac k except for the first before |
6135 // calling webkitExitFullscreen(): | 6135 // calling webkitExitFullscreen(): |
6136 Vector<RefPtr<Element>> replacementFullscreenElementStack; | 6136 Vector<RefPtr<Element>> replacementFullscreenElementStack; |
6137 replacementFullscreenElementStack.append(topDocument.webkitFullscreenElement ()); | 6137 replacementFullscreenElementStack.append(topDocument.webkitFullscreenElement ()); |
6138 topDocument.m_fullScreenElementStack.swap(replacementFullscreenElementStack) ; | 6138 topDocument.m_fullScreenElementStack.swap(replacementFullscreenElementStack) ; |
6139 | 6139 |
6140 topDocument.webkitExitFullscreen(); | 6140 topDocument.webkitExitFullscreen(); |
6141 } | 6141 } |
6142 | 6142 |
6143 void Document::webkitExitFullscreen() | 6143 void Document::webkitExitFullscreen() |
6144 { | 6144 { |
6145 // The exitFullscreen() method must run these steps: | 6145 // The exitFullscreen() method must run these steps: |
6146 | 6146 |
6147 // 1. Let doc be the context object. (i.e. "this") | 6147 // 1. Let doc be the context object. (i.e. "this") |
6148 Document* currentDoc = this; | 6148 Document* currentDoc = this; |
6149 | 6149 |
6150 // 2. If doc's fullscreen element stack is empty, terminate these steps. | 6150 // 2. If doc's fullscreen element stack is empty, terminate these steps. |
6151 if (m_fullScreenElementStack.isEmpty()) | 6151 if (m_fullScreenElementStack.isEmpty()) |
6152 return; | 6152 return; |
6153 | 6153 |
6154 // 3. Let descendants be all the doc's descendant browsing context's documen ts with a non-empty fullscreen | 6154 // 3. Let descendants be all the doc's descendant browsing context's documen ts with a non-empty fullscreen |
6155 // element stack (if any), ordered so that the child of the doc is last and the document furthest | 6155 // element stack (if any), ordered so that the child of the doc is last and the document furthest |
6156 // away from the doc is first. | 6156 // away from the doc is first. |
6157 Deque<RefPtr<Document>> descendants; | 6157 Deque<RefPtr<Document>> descendants; |
6158 for (Frame* descendant = frame() ? frame()->tree().traverseNext() : nullptr; descendant; descendant = descendant->tree().traverseNext()) { | 6158 for (Frame* descendant = frame() ? frame()->tree().traverseNext() : nullptr; descendant; descendant = descendant->tree().traverseNext()) { |
6159 if (descendant->document()->webkitFullscreenElement()) | 6159 if (descendant->document()->webkitFullscreenElement()) |
6160 descendants.prepend(descendant->document()); | 6160 descendants.prepend(descendant->document()); |
6161 } | 6161 } |
6162 | 6162 |
6163 // 4. For each descendant in descendants, empty descendant's fullscreen elem ent stack, and queue a | 6163 // 4. For each descendant in descendants, empty descendant's fullscreen elem ent stack, and queue a |
6164 // task to fire an event named fullscreenchange with its bubbles attribute s et to true on descendant. | 6164 // task to fire an event named fullscreenchange with its bubbles attribute s et to true on descendant. |
6165 for (auto& document : descendants) { | 6165 for (auto& document : descendants) { |
6166 document->clearFullscreenElementStack(); | 6166 document->clearFullscreenElementStack(); |
6167 addDocumentToFullScreenChangeEventQueue(document.get()); | 6167 addDocumentToFullScreenChangeEventQueue(document.get()); |
6168 } | 6168 } |
6169 | 6169 |
6170 // 5. While doc is not null, run these substeps: | 6170 // 5. While doc is not null, run these substeps: |
6171 Element* newTop = nullptr; | 6171 Element* newTop = nullptr; |
6172 while (currentDoc) { | 6172 while (currentDoc) { |
(...skipping 21 matching lines...) Expand all Loading... | |
6194 currentDoc = nullptr; | 6194 currentDoc = nullptr; |
6195 } | 6195 } |
6196 | 6196 |
6197 // 6. Return, and run the remaining steps asynchronously. | 6197 // 6. Return, and run the remaining steps asynchronously. |
6198 // 7. Optionally, perform some animation. | 6198 // 7. Optionally, perform some animation. |
6199 m_fullScreenTaskQueue.enqueueTask([this, newTop = makeRefPtr(newTop), fullSc reenElement = m_fullScreenElement] { | 6199 m_fullScreenTaskQueue.enqueueTask([this, newTop = makeRefPtr(newTop), fullSc reenElement = m_fullScreenElement] { |
6200 auto* page = this->page(); | 6200 auto* page = this->page(); |
6201 if (!page) | 6201 if (!page) |
6202 return; | 6202 return; |
6203 | 6203 |
6204 // Only exit out of full screen window mode if there are no remaining el ements in the | 6204 // Only exit out of full screen window mode if there are no remaining el ements in the |
6205 // full screen stack. | 6205 // full screen stack. |
6206 if (!newTop) { | 6206 if (!newTop) { |
6207 page->chrome().client().exitFullScreenForElement(fullScreenElement.g et()); | 6207 page->chrome().client().exitFullScreenForElement(fullScreenElement.g et()); |
6208 return; | 6208 return; |
6209 } | 6209 } |
6210 | 6210 |
6211 // Otherwise, notify the chrome of the new full screen element. | 6211 // Otherwise, notify the chrome of the new full screen element. |
6212 page->chrome().client().enterFullScreenForElement(*newTop); | 6212 page->chrome().client().enterFullScreenForElement(*newTop); |
6213 }); | 6213 }); |
6214 } | 6214 } |
(...skipping 28 matching lines...) Expand all Loading... | |
6243 // Protect against being called after the document has been removed from the page. | 6243 // Protect against being called after the document has been removed from the page. |
6244 if (!page()) | 6244 if (!page()) |
6245 return; | 6245 return; |
6246 | 6246 |
6247 ASSERT(page()->settings().fullScreenEnabled()); | 6247 ASSERT(page()->settings().fullScreenEnabled()); |
6248 | 6248 |
6249 unwrapFullScreenRenderer(m_fullScreenRenderer.get(), m_fullScreenElement.get ()); | 6249 unwrapFullScreenRenderer(m_fullScreenRenderer.get(), m_fullScreenElement.get ()); |
6250 | 6250 |
6251 if (element) | 6251 if (element) |
6252 element->willBecomeFullscreenElement(); | 6252 element->willBecomeFullscreenElement(); |
6253 | 6253 |
6254 m_fullScreenElement = element; | 6254 m_fullScreenElement = element; |
6255 | 6255 |
6256 #if USE(NATIVE_FULLSCREEN_VIDEO) | 6256 #if USE(NATIVE_FULLSCREEN_VIDEO) |
6257 if (element && element->isMediaElement()) | 6257 if (element && element->isMediaElement()) |
6258 return; | 6258 return; |
6259 #endif | 6259 #endif |
6260 | 6260 |
6261 // Create a placeholder block for a the full-screen element, to keep the pag e from reflowing | 6261 // Create a placeholder block for a the full-screen element, to keep the pag e from reflowing |
6262 // when the element is removed from the normal flow. Only do this for a Ren derBox, as only | 6262 // when the element is removed from the normal flow. Only do this for a Ren derBox, as only |
6263 // a box will have a frameRect. The placeholder will be created in setFullS creenRenderer() | 6263 // a box will have a frameRect. The placeholder will be created in setFullS creenRenderer() |
6264 // during layout. | 6264 // during layout. |
6265 auto renderer = m_fullScreenElement->renderer(); | 6265 auto renderer = m_fullScreenElement->renderer(); |
6266 bool shouldCreatePlaceholder = is<RenderBox>(renderer); | 6266 bool shouldCreatePlaceholder = is<RenderBox>(renderer); |
6267 if (shouldCreatePlaceholder) { | 6267 if (shouldCreatePlaceholder) { |
6268 m_savedPlaceholderFrameRect = downcast<RenderBox>(*renderer).frameRect() ; | 6268 m_savedPlaceholderFrameRect = downcast<RenderBox>(*renderer).frameRect() ; |
6269 m_savedPlaceholderRenderStyle = RenderStyle::clonePtr(renderer->style()) ; | 6269 m_savedPlaceholderRenderStyle = RenderStyle::clonePtr(renderer->style()) ; |
6270 } | 6270 } |
6271 | 6271 |
6272 if (m_fullScreenElement != documentElement() && renderer) | 6272 if (m_fullScreenElement != documentElement() && renderer) |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6385 void Document::fullScreenElementRemoved() | 6385 void Document::fullScreenElementRemoved() |
6386 { | 6386 { |
6387 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false); | 6387 m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBou ndaries(false); |
6388 webkitCancelFullScreen(); | 6388 webkitCancelFullScreen(); |
6389 } | 6389 } |
6390 | 6390 |
6391 void Document::removeFullScreenElementOfSubtree(Node& node, bool amongChildrenOn ly) | 6391 void Document::removeFullScreenElementOfSubtree(Node& node, bool amongChildrenOn ly) |
6392 { | 6392 { |
6393 if (!m_fullScreenElement) | 6393 if (!m_fullScreenElement) |
6394 return; | 6394 return; |
6395 | 6395 |
6396 bool elementInSubtree = false; | 6396 bool elementInSubtree = false; |
6397 if (amongChildrenOnly) | 6397 if (amongChildrenOnly) |
6398 elementInSubtree = m_fullScreenElement->isDescendantOf(node); | 6398 elementInSubtree = m_fullScreenElement->isDescendantOf(node); |
6399 else | 6399 else |
6400 elementInSubtree = (m_fullScreenElement == &node) || m_fullScreenElement ->isDescendantOf(node); | 6400 elementInSubtree = (m_fullScreenElement == &node) || m_fullScreenElement ->isDescendantOf(node); |
6401 | 6401 |
6402 if (elementInSubtree) | 6402 if (elementInSubtree) |
6403 fullScreenElementRemoved(); | 6403 fullScreenElementRemoved(); |
6404 } | 6404 } |
6405 | 6405 |
6406 bool Document::isAnimatingFullScreen() const | 6406 bool Document::isAnimatingFullScreen() const |
6407 { | 6407 { |
6408 return m_isAnimatingFullScreen; | 6408 return m_isAnimatingFullScreen; |
6409 } | 6409 } |
6410 | 6410 |
6411 void Document::setAnimatingFullScreen(bool flag) | 6411 void Document::setAnimatingFullScreen(bool flag) |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6679 #else | 6679 #else |
6680 return 0; | 6680 return 0; |
6681 #endif | 6681 #endif |
6682 } | 6682 } |
6683 | 6683 |
6684 LayoutRect Document::absoluteEventHandlerBounds(bool& includesFixedPositionEleme nts) | 6684 LayoutRect Document::absoluteEventHandlerBounds(bool& includesFixedPositionEleme nts) |
6685 { | 6685 { |
6686 includesFixedPositionElements = false; | 6686 includesFixedPositionElements = false; |
6687 if (RenderView* renderView = this->renderView()) | 6687 if (RenderView* renderView = this->renderView()) |
6688 return renderView->documentRect(); | 6688 return renderView->documentRect(); |
6689 | 6689 |
6690 return LayoutRect(); | 6690 return LayoutRect(); |
6691 } | 6691 } |
6692 | 6692 |
6693 Document::RegionFixedPair Document::absoluteRegionForEventTargets(const EventTar getSet* targets) | 6693 Document::RegionFixedPair Document::absoluteRegionForEventTargets(const EventTar getSet* targets) |
6694 { | 6694 { |
6695 LayoutDisallowedScope layoutDisallowedScope(LayoutDisallowedScope::Reason::R eentrancyAvoidance); | 6695 LayoutDisallowedScope layoutDisallowedScope(LayoutDisallowedScope::Reason::R eentrancyAvoidance); |
6696 | 6696 |
6697 if (!targets) | 6697 if (!targets) |
6698 return RegionFixedPair(Region(), false); | 6698 return RegionFixedPair(Region(), false); |
6699 | 6699 |
(...skipping 11 matching lines...) Expand all Loading... | |
6711 rootRelativeBounds = element->absoluteEventHandlerBounds(insideF ixedPosition); | 6711 rootRelativeBounds = element->absoluteEventHandlerBounds(insideF ixedPosition); |
6712 } else if (is<Element>(keyValuePair.key)) { | 6712 } else if (is<Element>(keyValuePair.key)) { |
6713 Element* element = downcast<Element>(keyValuePair.key); | 6713 Element* element = downcast<Element>(keyValuePair.key); |
6714 if (is<HTMLBodyElement>(element)) { | 6714 if (is<HTMLBodyElement>(element)) { |
6715 // For the body, just use the document bounds. | 6715 // For the body, just use the document bounds. |
6716 // The body may not cover this whole area, but it's OK for this region to be an overestimate. | 6716 // The body may not cover this whole area, but it's OK for this region to be an overestimate. |
6717 rootRelativeBounds = absoluteEventHandlerBounds(insideFixedPosit ion); | 6717 rootRelativeBounds = absoluteEventHandlerBounds(insideFixedPosit ion); |
6718 } else | 6718 } else |
6719 rootRelativeBounds = element->absoluteEventHandlerBounds(insideF ixedPosition); | 6719 rootRelativeBounds = element->absoluteEventHandlerBounds(insideF ixedPosition); |
6720 } | 6720 } |
6721 | 6721 |
6722 if (!rootRelativeBounds.isEmpty()) | 6722 if (!rootRelativeBounds.isEmpty()) |
6723 targetRegion.unite(Region(enclosingIntRect(rootRelativeBounds))); | 6723 targetRegion.unite(Region(enclosingIntRect(rootRelativeBounds))); |
6724 } | 6724 } |
6725 | 6725 |
6726 return RegionFixedPair(targetRegion, insideFixedPosition); | 6726 return RegionFixedPair(targetRegion, insideFixedPosition); |
6727 } | 6727 } |
6728 | 6728 |
6729 void Document::updateLastHandledUserGestureTimestamp(MonotonicTime time) | 6729 void Document::updateLastHandledUserGestureTimestamp(MonotonicTime time) |
6730 { | 6730 { |
6731 m_lastHandledUserGestureTimestamp = time; | 6731 m_lastHandledUserGestureTimestamp = time; |
6732 | 6732 |
6733 if (static_cast<bool>(time) && m_scriptedAnimationController) { | 6733 if (static_cast<bool>(time) && m_scriptedAnimationController) { |
6734 // It's OK to always remove NonInteractedCrossOriginFrame even if this f rame isn't cross-origin. | 6734 // It's OK to always remove NonInteractedCrossOriginFrame even if this f rame isn't cross-origin. |
6735 m_scriptedAnimationController->removeThrottlingReason(ScriptedAnimationC ontroller::ThrottlingReason::NonInteractedCrossOriginFrame); | 6735 m_scriptedAnimationController->removeThrottlingReason(ScriptedAnimationC ontroller::ThrottlingReason::NonInteractedCrossOriginFrame); |
6736 } | 6736 } |
6737 | 6737 |
6738 // DOM Timer alignment may depend on the user having interacted with the doc ument. | 6738 // DOM Timer alignment may depend on the user having interacted with the doc ument. |
6739 didChangeTimerAlignmentInterval(); | 6739 didChangeTimerAlignmentInterval(); |
6740 | 6740 |
6741 if (HTMLFrameOwnerElement* element = ownerElement()) | 6741 if (HTMLFrameOwnerElement* element = ownerElement()) |
6742 element->document().updateLastHandledUserGestureTimestamp(time); | 6742 element->document().updateLastHandledUserGestureTimestamp(time); |
6743 } | 6743 } |
6744 | 6744 |
6745 bool Document::processingUserGestureForMedia() const | 6745 bool Document::processingUserGestureForMedia() const |
6746 { | 6746 { |
6747 if (UserGestureIndicator::processingUserGestureForMedia()) | 6747 if (UserGestureIndicator::processingUserGestureForMedia()) |
6748 return true; | 6748 return true; |
6749 | 6749 |
6750 if (settings().mediaUserGestureInheritsFromDocument()) | 6750 if (settings().mediaUserGestureInheritsFromDocument()) |
(...skipping 13 matching lines...) Expand all Loading... | |
6764 | 6764 |
6765 unsigned Document::styleRecalcCount() const | 6765 unsigned Document::styleRecalcCount() const |
6766 { | 6766 { |
6767 return m_styleRecalcCount; | 6767 return m_styleRecalcCount; |
6768 } | 6768 } |
6769 | 6769 |
6770 DocumentLoader* Document::loader() const | 6770 DocumentLoader* Document::loader() const |
6771 { | 6771 { |
6772 if (!m_frame) | 6772 if (!m_frame) |
6773 return nullptr; | 6773 return nullptr; |
6774 | 6774 |
6775 DocumentLoader* loader = m_frame->loader().documentLoader(); | 6775 DocumentLoader* loader = m_frame->loader().documentLoader(); |
6776 if (!loader) | 6776 if (!loader) |
6777 return nullptr; | 6777 return nullptr; |
6778 | 6778 |
6779 if (m_frame->document() != this) | 6779 if (m_frame->document() != this) |
6780 return nullptr; | 6780 return nullptr; |
6781 | 6781 |
6782 return loader; | 6782 return loader; |
6783 } | 6783 } |
6784 | 6784 |
6785 #if ENABLE(CSS_DEVICE_ADAPTATION) | 6785 #if ENABLE(CSS_DEVICE_ADAPTATION) |
6786 | 6786 |
6787 IntSize Document::initialViewportSize() const | 6787 IntSize Document::initialViewportSize() const |
6788 { | 6788 { |
6789 if (!view()) | 6789 if (!view()) |
6790 return IntSize(); | 6790 return IntSize(); |
6791 return view()->initialViewportSize(); | 6791 return view()->initialViewportSize(); |
(...skipping 24 matching lines...) Expand all Loading... | |
6816 float inverseFrameScale = frameView.absoluteToDocumentScaleFactor(style.effe ctiveZoom()); | 6816 float inverseFrameScale = frameView.absoluteToDocumentScaleFactor(style.effe ctiveZoom()); |
6817 auto documentToClientOffset = frameView.documentToClientOffset(); | 6817 auto documentToClientOffset = frameView.documentToClientOffset(); |
6818 | 6818 |
6819 for (auto& quad : quads) { | 6819 for (auto& quad : quads) { |
6820 if (inverseFrameScale != 1) | 6820 if (inverseFrameScale != 1) |
6821 quad.scale(inverseFrameScale); | 6821 quad.scale(inverseFrameScale); |
6822 | 6822 |
6823 quad.move(documentToClientOffset); | 6823 quad.move(documentToClientOffset); |
6824 } | 6824 } |
6825 } | 6825 } |
6826 | 6826 |
6827 void Document::convertAbsoluteToClientRects(Vector<FloatRect>& rects, const Rend erStyle& style) | 6827 void Document::convertAbsoluteToClientRects(Vector<FloatRect>& rects, const Rend erStyle& style) |
6828 { | 6828 { |
6829 if (!view()) | 6829 if (!view()) |
6830 return; | 6830 return; |
6831 | 6831 |
6832 auto& frameView = *view(); | 6832 auto& frameView = *view(); |
6833 float inverseFrameScale = frameView.absoluteToDocumentScaleFactor(style.effe ctiveZoom()); | 6833 float inverseFrameScale = frameView.absoluteToDocumentScaleFactor(style.effe ctiveZoom()); |
6834 auto documentToClientOffset = frameView.documentToClientOffset(); | 6834 auto documentToClientOffset = frameView.documentToClientOffset(); |
6835 | 6835 |
6836 for (auto& rect : rects) { | 6836 for (auto& rect : rects) { |
6837 if (inverseFrameScale != 1) | 6837 if (inverseFrameScale != 1) |
6838 rect.scale(inverseFrameScale); | 6838 rect.scale(inverseFrameScale); |
6839 | 6839 |
6840 rect.move(documentToClientOffset); | 6840 rect.move(documentToClientOffset); |
6841 } | 6841 } |
6842 } | 6842 } |
6843 | 6843 |
6844 void Document::convertAbsoluteToClientRect(FloatRect& rect, const RenderStyle& s tyle) | 6844 void Document::convertAbsoluteToClientRect(FloatRect& rect, const RenderStyle& s tyle) |
6845 { | 6845 { |
6846 if (!view()) | 6846 if (!view()) |
6847 return; | 6847 return; |
6848 | 6848 |
6849 const auto& frameView = *view(); | 6849 const auto& frameView = *view(); |
6850 rect = frameView.absoluteToDocumentRect(rect, style.effectiveZoom()); | 6850 rect = frameView.absoluteToDocumentRect(rect, style.effectiveZoom()); |
6851 rect = frameView.documentToClientRect(rect); | 6851 rect = frameView.documentToClientRect(rect); |
6852 } | 6852 } |
6853 | 6853 |
6854 bool Document::hasActiveParser() | 6854 bool Document::hasActiveParser() |
6855 { | 6855 { |
6856 return m_activeParserCount || (m_parser && m_parser->processingData()); | 6856 return m_activeParserCount || (m_parser && m_parser->processingData()); |
6857 } | 6857 } |
6858 | 6858 |
6859 void Document::decrementActiveParserCount() | 6859 void Document::decrementActiveParserCount() |
6860 { | 6860 { |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7365 | 7365 |
7366 void Document::collectIntersectionObservers(HashSet<IntersectionObserver*>& obse rvers) | 7366 void Document::collectIntersectionObservers(HashSet<IntersectionObserver*>& obse rvers) |
7367 { | 7367 { |
7368 for (auto element : m_intersectionObserverTargets) { | 7368 for (auto element : m_intersectionObserverTargets) { |
7369 auto registrations = element->intersectionObserverRegistrations(); | 7369 auto registrations = element->intersectionObserverRegistrations(); |
7370 if (!registrations) | 7370 if (!registrations) |
7371 continue; | 7371 continue; |
7372 | 7372 |
7373 for (auto& registration : *registrations) { | 7373 for (auto& registration : *registrations) { |
7374 auto root = registration.observer->root(); | 7374 auto root = registration.observer->root(); |
7375 if ((!root && &topDocument() == this) || (root->isConnected() && &ro ot->document() == this)) | 7375 if (!root || (root->isConnected() && &root->document() == this)) |
7376 observers.add(registration.observer.get()); | 7376 observers.add(registration.observer.get()); |
7377 } | 7377 } |
7378 } | 7378 } |
7379 } | 7379 } |
7380 | 7380 |
7381 void Document::updateIntersectionObservations() | 7381 void Document::updateIntersectionObservations() |
7382 { | 7382 { |
7383 if (m_intersectionObserverTargets.isEmpty()) | 7383 if (m_intersectionObserverTargets.isEmpty()) |
7384 return; | 7384 return; |
7385 | 7385 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7428 // If the intersection root is a scrollable element, it's the elements c ontent area. | 7428 // If the intersection root is a scrollable element, it's the elements c ontent area. |
7429 if (root->canBeScrolledAndHasScrollableArea()) { | 7429 if (root->canBeScrolledAndHasScrollableArea()) { |
7430 // This is local/content space. See RenderBox::absoluteContentQuad. | 7430 // This is local/content space. See RenderBox::absoluteContentQuad. |
7431 rootBounds = root->contentBoxRect(); | 7431 rootBounds = root->contentBoxRect(); |
7432 } else { | 7432 } else { |
7433 // Otherwise, it's the result of running the getBoundingClientRect() algorithm on the intersection root. | 7433 // Otherwise, it's the result of running the getBoundingClientRect() algorithm on the intersection root. |
7434 // We just take the RenderBox's bounds in local coordinates (see Ren derBox::absoluteQuads() which is what getBoundingClientRect() uses); | 7434 // We just take the RenderBox's bounds in local coordinates (see Ren derBox::absoluteQuads() which is what getBoundingClientRect() uses); |
7435 rootBounds = { { 0, 0 }, root->size() }; | 7435 rootBounds = { { 0, 0 }, root->size() }; |
7436 } | 7436 } |
7437 | 7437 |
7438 // Page zoom should not affect visiual viewport, so we will only set the | 7438 // Page zoom should not affect visiual viewport, so we will only set the |
ajuma
2018/07/03 18:21:48
Typo: visual
| |
7439 // scale factor here, for the case where the root element is specified. | 7439 // scale factor here, for the case where the root element is specified. |
ajuma
2018/07/03 18:21:48
See the "Coordinate systems" comment in FrameView.
| |
7440 cssToLayoutScale = frameView.frame().pageZoomFactor() * frameView.frame( ).frameScaleFactor(); | 7440 cssToLayoutScale = frameView.frame().pageZoomFactor() * frameView.frame( ).frameScaleFactor(); |
7441 } else { | 7441 } else { |
7442 // If the intersection root is the implicit root, it's the (visual) view port's size. | 7442 // If the intersection root is the implicit root, it's the (visual) view port's size. |
7443 coordinateRoot = &target.view(); | 7443 coordinateRoot = &target.view(); |
7444 | 7444 |
7445 if (frameView.frame().isMainFrame()) | 7445 if (frameView.frame().isMainFrame()) |
7446 rootBounds = frameView.visibleContentRect(); | 7446 rootBounds = frameView.visibleContentRect(); |
7447 else { | 7447 else { |
7448 // FIXME: need a version of windowClipRect() that ignores paintsEnti reContents() | 7448 // FIXME: need a version of windowClipRect() that ignores paintsEnti reContents() |
7449 rootBounds = frameView.windowToContents(frameView.windowClipRect()); | 7449 rootBounds = frameView.windowToContents(frameView.windowClipRect()); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7490 // 6. Map intersectionRect to the coordinate space of the viewport of the Do cument containing the target. | 7490 // 6. Map intersectionRect to the coordinate space of the viewport of the Do cument containing the target. |
7491 // We'll use absolute coordinates instead. | 7491 // We'll use absolute coordinates instead. |
7492 return coordinateRoot->localToAbsoluteQuad(intersectionRect).boundingBox(); | 7492 return coordinateRoot->localToAbsoluteQuad(intersectionRect).boundingBox(); |
7493 } | 7493 } |
7494 | 7494 |
7495 bool Document::updateIntersectionObserveration(IntersectionObserver& observer, d ouble timeStamp) | 7495 bool Document::updateIntersectionObserveration(IntersectionObserver& observer, d ouble timeStamp) |
7496 { | 7496 { |
7497 FrameView* frameView = view(); | 7497 FrameView* frameView = view(); |
7498 if (!frameView) | 7498 if (!frameView) |
7499 return false; | 7499 return false; |
7500 | |
7501 if (frameView->frame().isMainFrame()) | |
7502 frameView->frame().setPageZoomFactor(2.0f); | |
7503 | 7500 |
7504 bool anyNeedNotify = false; | 7501 bool anyNeedNotify = false; |
7505 | 7502 |
7506 // 2. For each target in observer's internal [[ObservationTargets]] slot, | 7503 // 2. For each target in observer's internal [[ObservationTargets]] slot, |
7507 // processed in the same order that observe() was called on each target: | 7504 // processed in the same order that observe() was called on each target: |
7508 for (auto target : observer.observationTargets()) { | 7505 for (auto target : observer.observationTargets()) { |
7509 if (!target->renderer()) | 7506 if (!target->renderer()) |
7510 continue; | 7507 continue; |
7511 | 7508 |
7512 // FIXME: for now, only allow same-document observation: https://github. com/WICG/IntersectionObserver/issues/173 | 7509 // FIXME: for now, only allow same-document observation: https://github. com/WICG/IntersectionObserver/issues/173 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7834 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) | 7831 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) |
7835 if (m_frame && hasFrameSpecificStorageAccess()) { | 7832 if (m_frame && hasFrameSpecificStorageAccess()) { |
7836 promise->resolve<IDLBoolean>(true); | 7833 promise->resolve<IDLBoolean>(true); |
7837 return; | 7834 return; |
7838 } | 7835 } |
7839 | 7836 |
7840 if (!m_frame || securityOrigin().isUnique()) { | 7837 if (!m_frame || securityOrigin().isUnique()) { |
7841 promise->resolve<IDLBoolean>(false); | 7838 promise->resolve<IDLBoolean>(false); |
7842 return; | 7839 return; |
7843 } | 7840 } |
7844 | 7841 |
7845 if (m_frame->isMainFrame()) { | 7842 if (m_frame->isMainFrame()) { |
7846 promise->resolve<IDLBoolean>(true); | 7843 promise->resolve<IDLBoolean>(true); |
7847 return; | 7844 return; |
7848 } | 7845 } |
7849 | 7846 |
7850 auto& securityOrigin = this->securityOrigin(); | 7847 auto& securityOrigin = this->securityOrigin(); |
7851 auto& topSecurityOrigin = topDocument().securityOrigin(); | 7848 auto& topSecurityOrigin = topDocument().securityOrigin(); |
7852 if (securityOrigin.equal(&topSecurityOrigin)) { | 7849 if (securityOrigin.equal(&topSecurityOrigin)) { |
7853 promise->resolve<IDLBoolean>(true); | 7850 promise->resolve<IDLBoolean>(true); |
7854 return; | 7851 return; |
7855 } | 7852 } |
7856 | 7853 |
7857 auto frameID = m_frame->loader().client().frameID(); | 7854 auto frameID = m_frame->loader().client().frameID(); |
7858 auto pageID = m_frame->loader().client().pageID(); | 7855 auto pageID = m_frame->loader().client().pageID(); |
7859 if (!frameID || !pageID) { | 7856 if (!frameID || !pageID) { |
7860 promise->reject(); | 7857 promise->reject(); |
7861 return; | 7858 return; |
7862 } | 7859 } |
7863 | 7860 |
7864 if (Page* page = this->page()) { | 7861 if (Page* page = this->page()) { |
7865 auto iframeHost = securityOrigin.host(); | 7862 auto iframeHost = securityOrigin.host(); |
7866 auto topHost = topSecurityOrigin.host(); | 7863 auto topHost = topSecurityOrigin.host(); |
7867 page->chrome().client().hasStorageAccess(WTFMove(iframeHost), WTFMove(to pHost), frameID.value(), pageID.value(), [documentReference = makeWeakPtr(*this) , promise = WTFMove(promise)] (bool hasAccess) { | 7864 page->chrome().client().hasStorageAccess(WTFMove(iframeHost), WTFMove(to pHost), frameID.value(), pageID.value(), [documentReference = makeWeakPtr(*this) , promise = WTFMove(promise)] (bool hasAccess) { |
7868 Document* document = documentReference.get(); | 7865 Document* document = documentReference.get(); |
7869 if (!document) | 7866 if (!document) |
7870 return; | 7867 return; |
7871 | 7868 |
7872 promise->resolve<IDLBoolean>(hasAccess); | 7869 promise->resolve<IDLBoolean>(hasAccess); |
7873 }); | 7870 }); |
7874 return; | 7871 return; |
7875 } | 7872 } |
7876 #endif | 7873 #endif |
7877 | 7874 |
7878 promise->reject(); | 7875 promise->reject(); |
7879 } | 7876 } |
7880 | 7877 |
7881 void Document::requestStorageAccess(Ref<DeferredPromise>&& promise) | 7878 void Document::requestStorageAccess(Ref<DeferredPromise>&& promise) |
7882 { | 7879 { |
7883 ASSERT(settings().storageAccessAPIEnabled()); | 7880 ASSERT(settings().storageAccessAPIEnabled()); |
7884 | 7881 |
7885 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) | 7882 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) |
7886 if (m_frame && hasFrameSpecificStorageAccess()) { | 7883 if (m_frame && hasFrameSpecificStorageAccess()) { |
7887 promise->resolve(); | 7884 promise->resolve(); |
7888 return; | 7885 return; |
7889 } | 7886 } |
7890 | 7887 |
7891 if (!m_frame || securityOrigin().isUnique()) { | 7888 if (!m_frame || securityOrigin().isUnique()) { |
7892 promise->reject(); | 7889 promise->reject(); |
7893 return; | 7890 return; |
7894 } | 7891 } |
7895 | 7892 |
7896 if (m_frame->isMainFrame()) { | 7893 if (m_frame->isMainFrame()) { |
7897 promise->resolve(); | 7894 promise->resolve(); |
7898 return; | 7895 return; |
7899 } | 7896 } |
7900 | 7897 |
7901 auto& topDocument = this->topDocument(); | 7898 auto& topDocument = this->topDocument(); |
7902 auto& topSecurityOrigin = topDocument.securityOrigin(); | 7899 auto& topSecurityOrigin = topDocument.securityOrigin(); |
7903 auto& securityOrigin = this->securityOrigin(); | 7900 auto& securityOrigin = this->securityOrigin(); |
7904 if (securityOrigin.equal(&topSecurityOrigin)) { | 7901 if (securityOrigin.equal(&topSecurityOrigin)) { |
7905 promise->resolve(); | 7902 promise->resolve(); |
7906 return; | 7903 return; |
7907 } | 7904 } |
7908 | 7905 |
7909 // If there is a sandbox, it has to allow the storage access API to be calle d. | 7906 // If there is a sandbox, it has to allow the storage access API to be calle d. |
7910 if (sandboxFlags() != SandboxNone && isSandboxed(SandboxStorageAccessByUserA ctivation)) { | 7907 if (sandboxFlags() != SandboxNone && isSandboxed(SandboxStorageAccessByUserA ctivation)) { |
7911 promise->reject(); | 7908 promise->reject(); |
7912 return; | 7909 return; |
7913 } | 7910 } |
7914 | 7911 |
7915 // The iframe has to be a direct child of the top document. | 7912 // The iframe has to be a direct child of the top document. |
7916 if (&topDocument != parentDocument()) { | 7913 if (&topDocument != parentDocument()) { |
7917 promise->reject(); | 7914 promise->reject(); |
7918 return; | 7915 return; |
7919 } | 7916 } |
7920 | 7917 |
7921 if (!UserGestureIndicator::processingUserGesture()) { | 7918 if (!UserGestureIndicator::processingUserGesture()) { |
7922 promise->reject(); | 7919 promise->reject(); |
7923 return; | 7920 return; |
7924 } | 7921 } |
7925 | 7922 |
7926 auto iframeHost = securityOrigin.host(); | 7923 auto iframeHost = securityOrigin.host(); |
7927 auto topHost = topSecurityOrigin.host(); | 7924 auto topHost = topSecurityOrigin.host(); |
7928 | 7925 |
7929 Page* page = this->page(); | 7926 Page* page = this->page(); |
7930 auto frameID = m_frame->loader().client().frameID(); | 7927 auto frameID = m_frame->loader().client().frameID(); |
7931 auto pageID = m_frame->loader().client().pageID(); | 7928 auto pageID = m_frame->loader().client().pageID(); |
7932 if (!page || !frameID || !pageID) { | 7929 if (!page || !frameID || !pageID) { |
7933 promise->reject(); | 7930 promise->reject(); |
7934 return; | 7931 return; |
7935 } | 7932 } |
(...skipping 30 matching lines...) Expand all Loading... | |
7966 void Document::consumeTemporaryTimeUserGesture() | 7963 void Document::consumeTemporaryTimeUserGesture() |
7967 { | 7964 { |
7968 m_temporaryUserGesture = nullptr; | 7965 m_temporaryUserGesture = nullptr; |
7969 } | 7966 } |
7970 | 7967 |
7971 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) | 7968 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) |
7972 bool Document::hasFrameSpecificStorageAccess() const | 7969 bool Document::hasFrameSpecificStorageAccess() const |
7973 { | 7970 { |
7974 return m_frame->loader().client().hasFrameSpecificStorageAccess(); | 7971 return m_frame->loader().client().hasFrameSpecificStorageAccess(); |
7975 } | 7972 } |
7976 | 7973 |
7977 void Document::setHasFrameSpecificStorageAccess(bool value) | 7974 void Document::setHasFrameSpecificStorageAccess(bool value) |
7978 { | 7975 { |
7979 m_frame->loader().client().setHasFrameSpecificStorageAccess(value); | 7976 m_frame->loader().client().setHasFrameSpecificStorageAccess(value); |
7980 } | 7977 } |
7981 | 7978 |
7982 bool Document::hasRequestedPageSpecificStorageAccessWithUserInteraction(const St ring& primaryDomain) | 7979 bool Document::hasRequestedPageSpecificStorageAccessWithUserInteraction(const St ring& primaryDomain) |
7983 { | 7980 { |
7984 return m_primaryDomainRequestedPageSpecificStorageAccessWithUserInteraction == primaryDomain; | 7981 return m_primaryDomainRequestedPageSpecificStorageAccessWithUserInteraction == primaryDomain; |
7985 } | 7982 } |
7986 | 7983 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8139 | 8136 |
8140 String Document::signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const URL& url) | 8137 String Document::signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const URL& url) |
8141 { | 8138 { |
8142 Page* page = this->page(); | 8139 Page* page = this->page(); |
8143 if (!page) | 8140 if (!page) |
8144 return emptyString(); | 8141 return emptyString(); |
8145 return page->chrome().client().signedPublicKeyAndChallengeString(keySizeInde x, challengeString, url); | 8142 return page->chrome().client().signedPublicKeyAndChallengeString(keySizeInde x, challengeString, url); |
8146 } | 8143 } |
8147 | 8144 |
8148 } // namespace WebCore | 8145 } // namespace WebCore |
LEFT | RIGHT |