| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
| 3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
| 4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
| 5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 | 568 |
| 569 ASSERT(m_frame->view() == this); | 569 ASSERT(m_frame->view() == this); |
| 570 | 570 |
| 571 const IntRect rect = renderView->documentRect(); | 571 const IntRect rect = renderView->documentRect(); |
| 572 const IntSize& size = rect.size(); | 572 const IntSize& size = rect.size(); |
| 573 setScrollOrigin(IntPoint(-rect.x(), -rect.y()), !m_frame->document()->printi
ng(), size == contentsSize()); | 573 setScrollOrigin(IntPoint(-rect.x(), -rect.y()), !m_frame->document()->printi
ng(), size == contentsSize()); |
| 574 | 574 |
| 575 setContentsSize(size); | 575 setContentsSize(size); |
| 576 } | 576 } |
| 577 | 577 |
| 578 void FrameView::applyOverflowToViewportAndSetRenderer(RenderObject* o, Scrollbar
Mode& hMode, ScrollbarMode& vMode) | 578 void FrameView::applyOverflowToViewportAndSetRenderer(LayoutObject* o, Scrollbar
Mode& hMode, ScrollbarMode& vMode) |
| 579 { | 579 { |
| 580 // Handle the overflow:hidden/scroll case for the body/html elements. WinIE
treats | 580 // Handle the overflow:hidden/scroll case for the body/html elements. WinIE
treats |
| 581 // overflow:hidden and overflow:scroll on <body> as applying to the document
's | 581 // overflow:hidden and overflow:scroll on <body> as applying to the document
's |
| 582 // scrollbars. The CSS2.1 draft states that HTML UAs should use the <html>
or <body> element and XML/XHTML UAs should | 582 // scrollbars. The CSS2.1 draft states that HTML UAs should use the <html>
or <body> element and XML/XHTML UAs should |
| 583 // use the root element. | 583 // use the root element. |
| 584 | 584 |
| 585 EOverflow overflowX = o->style()->overflowX(); | 585 EOverflow overflowX = o->style()->overflowX(); |
| 586 EOverflow overflowY = o->style()->overflowY(); | 586 EOverflow overflowY = o->style()->overflowY(); |
| 587 | 587 |
| 588 if (o->isSVGRoot()) { | 588 if (o->isSVGRoot()) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 vMode = ScrollbarAlwaysOff; | 657 vMode = ScrollbarAlwaysOff; |
| 658 } | 658 } |
| 659 | 659 |
| 660 if (!isSubtreeLayout()) { | 660 if (!isSubtreeLayout()) { |
| 661 Document* document = m_frame->document(); | 661 Document* document = m_frame->document(); |
| 662 Node* body = document->body(); | 662 Node* body = document->body(); |
| 663 if (isHTMLFrameSetElement(body) && body->renderer()) { | 663 if (isHTMLFrameSetElement(body) && body->renderer()) { |
| 664 vMode = ScrollbarAlwaysOff; | 664 vMode = ScrollbarAlwaysOff; |
| 665 hMode = ScrollbarAlwaysOff; | 665 hMode = ScrollbarAlwaysOff; |
| 666 } else if (Element* viewportElement = document->viewportDefiningElement(
)) { | 666 } else if (Element* viewportElement = document->viewportDefiningElement(
)) { |
| 667 if (RenderObject* viewportRenderer = viewportElement->renderer()) { | 667 if (LayoutObject* viewportRenderer = viewportElement->renderer()) { |
| 668 if (viewportRenderer->style()) | 668 if (viewportRenderer->style()) |
| 669 applyOverflowToViewportAndSetRenderer(viewportRenderer, hMod
e, vMode); | 669 applyOverflowToViewportAndSetRenderer(viewportRenderer, hMod
e, vMode); |
| 670 } | 670 } |
| 671 } | 671 } |
| 672 } | 672 } |
| 673 } | 673 } |
| 674 | 674 |
| 675 void FrameView::updateAcceleratedCompositingSettings() | 675 void FrameView::updateAcceleratedCompositingSettings() |
| 676 { | 676 { |
| 677 if (RenderView* renderView = this->renderView()) | 677 if (RenderView* renderView = this->renderView()) |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 if (!renderView) | 752 if (!renderView) |
| 753 return nullptr; | 753 return nullptr; |
| 754 return renderView->compositor()->layerForScrollCorner(); | 754 return renderView->compositor()->layerForScrollCorner(); |
| 755 } | 755 } |
| 756 | 756 |
| 757 bool FrameView::isEnclosedInCompositingLayer() const | 757 bool FrameView::isEnclosedInCompositingLayer() const |
| 758 { | 758 { |
| 759 // FIXME: It's a bug that compositing state isn't always up to date when thi
s is called. crbug.com/366314 | 759 // FIXME: It's a bug that compositing state isn't always up to date when thi
s is called. crbug.com/366314 |
| 760 DisableCompositingQueryAsserts disabler; | 760 DisableCompositingQueryAsserts disabler; |
| 761 | 761 |
| 762 RenderObject* frameOwnerRenderer = m_frame->ownerRenderer(); | 762 LayoutObject* frameOwnerRenderer = m_frame->ownerRenderer(); |
| 763 return frameOwnerRenderer && frameOwnerRenderer->enclosingLayer()->enclosing
LayerForPaintInvalidationCrossingFrameBoundaries(); | 763 return frameOwnerRenderer && frameOwnerRenderer->enclosingLayer()->enclosing
LayerForPaintInvalidationCrossingFrameBoundaries(); |
| 764 } | 764 } |
| 765 | 765 |
| 766 RenderObject* FrameView::layoutRoot(bool onlyDuringLayout) const | 766 LayoutObject* FrameView::layoutRoot(bool onlyDuringLayout) const |
| 767 { | 767 { |
| 768 return onlyDuringLayout && layoutPending() ? nullptr : m_layoutSubtreeRoot; | 768 return onlyDuringLayout && layoutPending() ? nullptr : m_layoutSubtreeRoot; |
| 769 } | 769 } |
| 770 | 770 |
| 771 inline void FrameView::forceLayoutParentViewIfNeeded() | 771 inline void FrameView::forceLayoutParentViewIfNeeded() |
| 772 { | 772 { |
| 773 RenderPart* ownerRenderer = m_frame->ownerRenderer(); | 773 RenderPart* ownerRenderer = m_frame->ownerRenderer(); |
| 774 if (!ownerRenderer || !ownerRenderer->frame()) | 774 if (!ownerRenderer || !ownerRenderer->frame()) |
| 775 return; | 775 return; |
| 776 | 776 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 document->styleResolverChanged(); | 823 document->styleResolverChanged(); |
| 824 document->mediaQueryAffectingValueChanged(); | 824 document->mediaQueryAffectingValueChanged(); |
| 825 } else { | 825 } else { |
| 826 document->evaluateMediaQueryList(); | 826 document->evaluateMediaQueryList(); |
| 827 } | 827 } |
| 828 | 828 |
| 829 document->updateRenderTreeIfNeeded(); | 829 document->updateRenderTreeIfNeeded(); |
| 830 lifecycle().advanceTo(DocumentLifecycle::StyleClean); | 830 lifecycle().advanceTo(DocumentLifecycle::StyleClean); |
| 831 } | 831 } |
| 832 | 832 |
| 833 void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLay
out) | 833 void FrameView::performLayout(LayoutObject* rootForThisLayout, bool inSubtreeLay
out) |
| 834 { | 834 { |
| 835 TRACE_EVENT0("blink,benchmark", "FrameView::performLayout"); | 835 TRACE_EVENT0("blink,benchmark", "FrameView::performLayout"); |
| 836 double start = WTF::currentTimeMS(); | 836 double start = WTF::currentTimeMS(); |
| 837 | 837 |
| 838 ScriptForbiddenScope forbidScript; | 838 ScriptForbiddenScope forbidScript; |
| 839 | 839 |
| 840 ASSERT(!isInPerformLayout()); | 840 ASSERT(!isInPerformLayout()); |
| 841 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); | 841 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); |
| 842 | 842 |
| 843 TemporaryChange<bool> changeInPerformLayout(m_inPerformLayout, true); | 843 TemporaryChange<bool> changeInPerformLayout(m_inPerformLayout, true); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 | 926 |
| 927 #if !ENABLE(OILPAN) | 927 #if !ENABLE(OILPAN) |
| 928 // If there is only one ref to this view left, then its going to be destroye
d as soon as we exit, | 928 // If there is only one ref to this view left, then its going to be destroye
d as soon as we exit, |
| 929 // so there's no point to continuing to layout | 929 // so there's no point to continuing to layout |
| 930 if (protector->hasOneRef()) | 930 if (protector->hasOneRef()) |
| 931 return; | 931 return; |
| 932 #endif | 932 #endif |
| 933 | 933 |
| 934 Document* document = m_frame->document(); | 934 Document* document = m_frame->document(); |
| 935 bool inSubtreeLayout = isSubtreeLayout(); | 935 bool inSubtreeLayout = isSubtreeLayout(); |
| 936 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do
cument->renderView(); | 936 LayoutObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do
cument->renderView(); |
| 937 if (!rootForThisLayout) { | 937 if (!rootForThisLayout) { |
| 938 // FIXME: Do we need to set m_size here? | 938 // FIXME: Do we need to set m_size here? |
| 939 ASSERT_NOT_REACHED(); | 939 ASSERT_NOT_REACHED(); |
| 940 return; | 940 return; |
| 941 } | 941 } |
| 942 | 942 |
| 943 FontCachePurgePreventer fontCachePurgePreventer; | 943 FontCachePurgePreventer fontCachePurgePreventer; |
| 944 Layer* layer; | 944 Layer* layer; |
| 945 { | 945 { |
| 946 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled,
false); | 946 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled,
false); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 | 997 |
| 998 if (oldSize != m_size && !m_firstLayout) { | 998 if (oldSize != m_size && !m_firstLayout) { |
| 999 RenderBox* rootRenderer = document->documentElement() ? document
->documentElement()->renderBox() : 0; | 999 RenderBox* rootRenderer = document->documentElement() ? document
->documentElement()->renderBox() : 0; |
| 1000 RenderBox* bodyRenderer = rootRenderer && document->body() ? doc
ument->body()->renderBox() : 0; | 1000 RenderBox* bodyRenderer = rootRenderer && document->body() ? doc
ument->body()->renderBox() : 0; |
| 1001 if (bodyRenderer && bodyRenderer->stretchesToViewport()) | 1001 if (bodyRenderer && bodyRenderer->stretchesToViewport()) |
| 1002 bodyRenderer->setChildNeedsLayout(); | 1002 bodyRenderer->setChildNeedsLayout(); |
| 1003 else if (rootRenderer && rootRenderer->stretchesToViewport()) | 1003 else if (rootRenderer && rootRenderer->stretchesToViewport()) |
| 1004 rootRenderer->setChildNeedsLayout(); | 1004 rootRenderer->setChildNeedsLayout(); |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 // We need to set m_doFullPaintInvalidation before triggering layout
as RenderObject::checkForPaintInvalidation | 1007 // We need to set m_doFullPaintInvalidation before triggering layout
as LayoutObject::checkForPaintInvalidation |
| 1008 // checks the boolean to disable local paint invalidations. | 1008 // checks the boolean to disable local paint invalidations. |
| 1009 m_doFullPaintInvalidation |= renderView()->shouldDoFullPaintInvalida
tionForNextLayout(); | 1009 m_doFullPaintInvalidation |= renderView()->shouldDoFullPaintInvalida
tionForNextLayout(); |
| 1010 } | 1010 } |
| 1011 | 1011 |
| 1012 layer = rootForThisLayout->enclosingLayer(); | 1012 layer = rootForThisLayout->enclosingLayer(); |
| 1013 | 1013 |
| 1014 performLayout(rootForThisLayout, inSubtreeLayout); | 1014 performLayout(rootForThisLayout, inSubtreeLayout); |
| 1015 | 1015 |
| 1016 m_layoutSubtreeRoot = nullptr; | 1016 m_layoutSubtreeRoot = nullptr; |
| 1017 // We need to ensure that we mark up all renderers up to the RenderView | 1017 // We need to ensure that we mark up all renderers up to the RenderView |
| 1018 // for paint invalidation. This simplifies our code as we just always | 1018 // for paint invalidation. This simplifies our code as we just always |
| 1019 // do a full tree walk. | 1019 // do a full tree walk. |
| 1020 if (RenderObject* container = rootForThisLayout->container()) | 1020 if (LayoutObject* container = rootForThisLayout->container()) |
| 1021 container->setMayNeedPaintInvalidation(); | 1021 container->setMayNeedPaintInvalidation(); |
| 1022 } // Reset m_layoutSchedulingEnabled to its previous value. | 1022 } // Reset m_layoutSchedulingEnabled to its previous value. |
| 1023 | 1023 |
| 1024 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin
g()) | 1024 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin
g()) |
| 1025 adjustViewSize(); | 1025 adjustViewSize(); |
| 1026 | 1026 |
| 1027 layer->updateLayerPositionsAfterLayout(); | 1027 layer->updateLayerPositionsAfterLayout(); |
| 1028 | 1028 |
| 1029 renderView()->compositor()->didLayout(); | 1029 renderView()->compositor()->didLayout(); |
| 1030 | 1030 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 | 1100 |
| 1101 if (m_frame->selection().isCaretBoundsDirty()) | 1101 if (m_frame->selection().isCaretBoundsDirty()) |
| 1102 m_frame->selection().invalidateCaretRect(); | 1102 m_frame->selection().invalidateCaretRect(); |
| 1103 } | 1103 } |
| 1104 | 1104 |
| 1105 DocumentLifecycle& FrameView::lifecycle() const | 1105 DocumentLifecycle& FrameView::lifecycle() const |
| 1106 { | 1106 { |
| 1107 return m_frame->document()->lifecycle(); | 1107 return m_frame->document()->lifecycle(); |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 void FrameView::gatherDebugLayoutRects(RenderObject* layoutRoot) | 1110 void FrameView::gatherDebugLayoutRects(LayoutObject* layoutRoot) |
| 1111 { | 1111 { |
| 1112 bool isTracing; | 1112 bool isTracing; |
| 1113 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.debug.la
yout"), &isTracing); | 1113 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.debug.la
yout"), &isTracing); |
| 1114 if (!isTracing) | 1114 if (!isTracing) |
| 1115 return; | 1115 return; |
| 1116 if (!layoutRoot->enclosingLayer()->hasCompositedLayerMapping()) | 1116 if (!layoutRoot->enclosingLayer()->hasCompositedLayerMapping()) |
| 1117 return; | 1117 return; |
| 1118 // For access to compositedLayerMapping(). | 1118 // For access to compositedLayerMapping(). |
| 1119 DisableCompositingQueryAsserts disabler; | 1119 DisableCompositingQueryAsserts disabler; |
| 1120 GraphicsLayer* graphicsLayer = layoutRoot->enclosingLayer()->compositedLayer
Mapping()->mainGraphicsLayer(); | 1120 GraphicsLayer* graphicsLayer = layoutRoot->enclosingLayer()->compositedLayer
Mapping()->mainGraphicsLayer(); |
| 1121 if (!graphicsLayer) | 1121 if (!graphicsLayer) |
| 1122 return; | 1122 return; |
| 1123 | 1123 |
| 1124 GraphicsLayerDebugInfo& debugInfo = graphicsLayer->debugInfo(); | 1124 GraphicsLayerDebugInfo& debugInfo = graphicsLayer->debugInfo(); |
| 1125 | 1125 |
| 1126 debugInfo.currentLayoutRects().clear(); | 1126 debugInfo.currentLayoutRects().clear(); |
| 1127 for (RenderObject* renderer = layoutRoot; renderer; renderer = renderer->nex
tInPreOrder()) { | 1127 for (LayoutObject* renderer = layoutRoot; renderer; renderer = renderer->nex
tInPreOrder()) { |
| 1128 if (renderer->layoutDidGetCalledSinceLastFrame()) { | 1128 if (renderer->layoutDidGetCalledSinceLastFrame()) { |
| 1129 FloatQuad quad = renderer->localToAbsoluteQuad(FloatQuad(renderer->p
reviousPaintInvalidationRect())); | 1129 FloatQuad quad = renderer->localToAbsoluteQuad(FloatQuad(renderer->p
reviousPaintInvalidationRect())); |
| 1130 LayoutRect rect = quad.enclosingBoundingBox(); | 1130 LayoutRect rect = quad.enclosingBoundingBox(); |
| 1131 debugInfo.currentLayoutRects().append(rect); | 1131 debugInfo.currentLayoutRects().append(rect); |
| 1132 } | 1132 } |
| 1133 } | 1133 } |
| 1134 } | 1134 } |
| 1135 | 1135 |
| 1136 RenderBox* FrameView::embeddedContentBox() const | 1136 RenderBox* FrameView::embeddedContentBox() const |
| 1137 { | 1137 { |
| 1138 RenderView* renderView = this->renderView(); | 1138 RenderView* renderView = this->renderView(); |
| 1139 if (!renderView) | 1139 if (!renderView) |
| 1140 return nullptr; | 1140 return nullptr; |
| 1141 | 1141 |
| 1142 RenderObject* firstChild = renderView->firstChild(); | 1142 LayoutObject* firstChild = renderView->firstChild(); |
| 1143 if (!firstChild || !firstChild->isBox()) | 1143 if (!firstChild || !firstChild->isBox()) |
| 1144 return nullptr; | 1144 return nullptr; |
| 1145 | 1145 |
| 1146 // Curently only embedded SVG documents participate in the size-negotiation
logic. | 1146 // Curently only embedded SVG documents participate in the size-negotiation
logic. |
| 1147 if (firstChild->isSVGRoot()) | 1147 if (firstChild->isSVGRoot()) |
| 1148 return toRenderBox(firstChild); | 1148 return toRenderBox(firstChild); |
| 1149 | 1149 |
| 1150 return nullptr; | 1150 return nullptr; |
| 1151 } | 1151 } |
| 1152 | 1152 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 void FrameView::removeSlowRepaintObject() | 1240 void FrameView::removeSlowRepaintObject() |
| 1241 { | 1241 { |
| 1242 ASSERT(m_slowRepaintObjectCount > 0); | 1242 ASSERT(m_slowRepaintObjectCount > 0); |
| 1243 m_slowRepaintObjectCount--; | 1243 m_slowRepaintObjectCount--; |
| 1244 if (!m_slowRepaintObjectCount) { | 1244 if (!m_slowRepaintObjectCount) { |
| 1245 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1245 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
| 1246 scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this); | 1246 scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this); |
| 1247 } | 1247 } |
| 1248 } | 1248 } |
| 1249 | 1249 |
| 1250 void FrameView::addViewportConstrainedObject(RenderObject* object) | 1250 void FrameView::addViewportConstrainedObject(LayoutObject* object) |
| 1251 { | 1251 { |
| 1252 if (!m_viewportConstrainedObjects) | 1252 if (!m_viewportConstrainedObjects) |
| 1253 m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet
); | 1253 m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet
); |
| 1254 | 1254 |
| 1255 if (!m_viewportConstrainedObjects->contains(object)) { | 1255 if (!m_viewportConstrainedObjects->contains(object)) { |
| 1256 m_viewportConstrainedObjects->add(object); | 1256 m_viewportConstrainedObjects->add(object); |
| 1257 | 1257 |
| 1258 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1258 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
| 1259 scrollingCoordinator->frameViewFixedObjectsDidChange(this); | 1259 scrollingCoordinator->frameViewFixedObjectsDidChange(this); |
| 1260 } | 1260 } |
| 1261 } | 1261 } |
| 1262 | 1262 |
| 1263 void FrameView::removeViewportConstrainedObject(RenderObject* object) | 1263 void FrameView::removeViewportConstrainedObject(LayoutObject* object) |
| 1264 { | 1264 { |
| 1265 if (m_viewportConstrainedObjects && m_viewportConstrainedObjects->contains(o
bject)) { | 1265 if (m_viewportConstrainedObjects && m_viewportConstrainedObjects->contains(o
bject)) { |
| 1266 m_viewportConstrainedObjects->remove(object); | 1266 m_viewportConstrainedObjects->remove(object); |
| 1267 | 1267 |
| 1268 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1268 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
| 1269 scrollingCoordinator->frameViewFixedObjectsDidChange(this); | 1269 scrollingCoordinator->frameViewFixedObjectsDidChange(this); |
| 1270 } | 1270 } |
| 1271 } | 1271 } |
| 1272 | 1272 |
| 1273 LayoutRect FrameView::viewportConstrainedVisibleContentRect() const | 1273 LayoutRect FrameView::viewportConstrainedVisibleContentRect() const |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1287 // Otherwise, viewport constrained objects need their layout flags set separ
ately to ensure | 1287 // Otherwise, viewport constrained objects need their layout flags set separ
ately to ensure |
| 1288 // they are positioned correctly. In the virtual-viewport pinch mode frame r
ect changes wont | 1288 // they are positioned correctly. In the virtual-viewport pinch mode frame r
ect changes wont |
| 1289 // necessarily cause a layout size change so only take this early-out if we'
re in old-style | 1289 // necessarily cause a layout size change so only take this early-out if we'
re in old-style |
| 1290 // pinch. | 1290 // pinch. |
| 1291 if (m_frame->settings() | 1291 if (m_frame->settings() |
| 1292 && !m_frame->settings()->viewportEnabled() | 1292 && !m_frame->settings()->viewportEnabled() |
| 1293 && !m_frame->settings()->pinchVirtualViewportEnabled()) | 1293 && !m_frame->settings()->pinchVirtualViewportEnabled()) |
| 1294 return; | 1294 return; |
| 1295 | 1295 |
| 1296 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects)
{ | 1296 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects)
{ |
| 1297 RenderObject* renderer = viewportConstrainedObject; | 1297 LayoutObject* renderer = viewportConstrainedObject; |
| 1298 RenderStyle* style = renderer->style(); | 1298 RenderStyle* style = renderer->style(); |
| 1299 if (widthChanged) { | 1299 if (widthChanged) { |
| 1300 if (style->width().isFixed() && (style->left().isAuto() || style->ri
ght().isAuto())) | 1300 if (style->width().isFixed() && (style->left().isAuto() || style->ri
ght().isAuto())) |
| 1301 renderer->setNeedsPositionedMovementLayout(); | 1301 renderer->setNeedsPositionedMovementLayout(); |
| 1302 else | 1302 else |
| 1303 renderer->setNeedsLayoutAndFullPaintInvalidation(); | 1303 renderer->setNeedsLayoutAndFullPaintInvalidation(); |
| 1304 } | 1304 } |
| 1305 if (heightChanged) { | 1305 if (heightChanged) { |
| 1306 if (style->height().isFixed() && (style->top().isAuto() || style->bo
ttom().isAuto())) | 1306 if (style->height().isFixed() && (style->top().isAuto() || style->bo
ttom().isAuto())) |
| 1307 renderer->setNeedsPositionedMovementLayout(); | 1307 renderer->setNeedsPositionedMovementLayout(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 { | 1357 { |
| 1358 if (!contentsInCompositedLayer() || hasSlowRepaintObjects()) | 1358 if (!contentsInCompositedLayer() || hasSlowRepaintObjects()) |
| 1359 return false; | 1359 return false; |
| 1360 | 1360 |
| 1361 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty()
) { | 1361 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty()
) { |
| 1362 InspectorInstrumentation::didScroll(m_frame.get()); | 1362 InspectorInstrumentation::didScroll(m_frame.get()); |
| 1363 return true; | 1363 return true; |
| 1364 } | 1364 } |
| 1365 | 1365 |
| 1366 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects)
{ | 1366 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects)
{ |
| 1367 RenderObject* renderer = viewportConstrainedObject; | 1367 LayoutObject* renderer = viewportConstrainedObject; |
| 1368 ASSERT(renderer->style()->hasViewportConstrainedPosition()); | 1368 ASSERT(renderer->style()->hasViewportConstrainedPosition()); |
| 1369 ASSERT(renderer->hasLayer()); | 1369 ASSERT(renderer->hasLayer()); |
| 1370 Layer* layer = toRenderBoxModelObject(renderer)->layer(); | 1370 Layer* layer = toRenderBoxModelObject(renderer)->layer(); |
| 1371 | 1371 |
| 1372 if (layer->isPaintInvalidationContainer()) | 1372 if (layer->isPaintInvalidationContainer()) |
| 1373 continue; | 1373 continue; |
| 1374 | 1374 |
| 1375 if (layer->subtreeIsInvisible()) | 1375 if (layer->subtreeIsInvisible()) |
| 1376 continue; | 1376 continue; |
| 1377 | 1377 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1544 cancelProgrammaticScrollAnimation(); | 1544 cancelProgrammaticScrollAnimation(); |
| 1545 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); | 1545 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); |
| 1546 m_maintainScrollPositionAnchor = nullptr; | 1546 m_maintainScrollPositionAnchor = nullptr; |
| 1547 | 1547 |
| 1548 DoublePoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint)
; | 1548 DoublePoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint)
; |
| 1549 if (newScrollPosition == scrollPositionDouble()) | 1549 if (newScrollPosition == scrollPositionDouble()) |
| 1550 return; | 1550 return; |
| 1551 | 1551 |
| 1552 if (scrollBehavior == ScrollBehaviorAuto) { | 1552 if (scrollBehavior == ScrollBehaviorAuto) { |
| 1553 Element* scrollElement = RuntimeEnabledFeatures::scrollTopLeftInteropEna
bled() ? m_frame->document()->documentElement() : m_frame->document()->body(); | 1553 Element* scrollElement = RuntimeEnabledFeatures::scrollTopLeftInteropEna
bled() ? m_frame->document()->documentElement() : m_frame->document()->body(); |
| 1554 RenderObject* renderer = scrollElement ? scrollElement->renderer() : nul
lptr; | 1554 LayoutObject* renderer = scrollElement ? scrollElement->renderer() : nul
lptr; |
| 1555 if (renderer && renderer->style()->scrollBehavior() == ScrollBehaviorSmo
oth) | 1555 if (renderer && renderer->style()->scrollBehavior() == ScrollBehaviorSmo
oth) |
| 1556 scrollBehavior = ScrollBehaviorSmooth; | 1556 scrollBehavior = ScrollBehaviorSmooth; |
| 1557 else | 1557 else |
| 1558 scrollBehavior = ScrollBehaviorInstant; | 1558 scrollBehavior = ScrollBehaviorInstant; |
| 1559 } | 1559 } |
| 1560 | 1560 |
| 1561 if (scrollBehavior == ScrollBehaviorInstant) { | 1561 if (scrollBehavior == ScrollBehaviorInstant) { |
| 1562 DoubleSize newOffset(newScrollPosition.x(), newScrollPosition.y()); | 1562 DoubleSize newOffset(newScrollPosition.x(), newScrollPosition.y()); |
| 1563 updateScrollbars(newOffset); | 1563 updateScrollbars(newOffset); |
| 1564 } else { | 1564 } else { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1825 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); | 1825 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); |
| 1826 | 1826 |
| 1827 if (m_hasPendingLayout) | 1827 if (m_hasPendingLayout) |
| 1828 return; | 1828 return; |
| 1829 m_hasPendingLayout = true; | 1829 m_hasPendingLayout = true; |
| 1830 | 1830 |
| 1831 page()->animator().scheduleVisualUpdate(m_frame.get()); | 1831 page()->animator().scheduleVisualUpdate(m_frame.get()); |
| 1832 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); | 1832 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); |
| 1833 } | 1833 } |
| 1834 | 1834 |
| 1835 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de
scendant) | 1835 static bool isObjectAncestorContainerOf(LayoutObject* ancestor, LayoutObject* de
scendant) |
| 1836 { | 1836 { |
| 1837 for (RenderObject* r = descendant; r; r = r->container()) { | 1837 for (LayoutObject* r = descendant; r; r = r->container()) { |
| 1838 if (r == ancestor) | 1838 if (r == ancestor) |
| 1839 return true; | 1839 return true; |
| 1840 } | 1840 } |
| 1841 return false; | 1841 return false; |
| 1842 } | 1842 } |
| 1843 | 1843 |
| 1844 void FrameView::scheduleRelayoutOfSubtree(RenderObject* relayoutRoot) | 1844 void FrameView::scheduleRelayoutOfSubtree(LayoutObject* relayoutRoot) |
| 1845 { | 1845 { |
| 1846 ASSERT(m_frame->view() == this); | 1846 ASSERT(m_frame->view() == this); |
| 1847 | 1847 |
| 1848 // FIXME: Should this call shouldScheduleLayout instead? | 1848 // FIXME: Should this call shouldScheduleLayout instead? |
| 1849 if (!m_frame->document()->isActive()) | 1849 if (!m_frame->document()->isActive()) |
| 1850 return; | 1850 return; |
| 1851 | 1851 |
| 1852 RenderView* renderView = this->renderView(); | 1852 RenderView* renderView = this->renderView(); |
| 1853 if (renderView && renderView->needsLayout()) { | 1853 if (renderView && renderView->needsLayout()) { |
| 1854 if (relayoutRoot) | 1854 if (relayoutRoot) |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2155 { | 2155 { |
| 2156 performPostLayoutTasks(); | 2156 performPostLayoutTasks(); |
| 2157 } | 2157 } |
| 2158 | 2158 |
| 2159 void FrameView::updateCounters() | 2159 void FrameView::updateCounters() |
| 2160 { | 2160 { |
| 2161 RenderView* view = renderView(); | 2161 RenderView* view = renderView(); |
| 2162 if (!view->hasLayoutCounters()) | 2162 if (!view->hasLayoutCounters()) |
| 2163 return; | 2163 return; |
| 2164 | 2164 |
| 2165 for (RenderObject* renderer = view; renderer; renderer = renderer->nextInPre
Order()) { | 2165 for (LayoutObject* renderer = view; renderer; renderer = renderer->nextInPre
Order()) { |
| 2166 if (!renderer->isCounter()) | 2166 if (!renderer->isCounter()) |
| 2167 continue; | 2167 continue; |
| 2168 | 2168 |
| 2169 toLayoutCounter(renderer)->updateCounter(); | 2169 toLayoutCounter(renderer)->updateCounter(); |
| 2170 } | 2170 } |
| 2171 } | 2171 } |
| 2172 | 2172 |
| 2173 void FrameView::updateOverflowStatus(bool horizontalOverflow, bool verticalOverf
low) | 2173 void FrameView::updateOverflowStatus(bool horizontalOverflow, bool verticalOverf
low) |
| 2174 { | 2174 { |
| 2175 if (!m_viewportRenderer) | 2175 if (!m_viewportRenderer) |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2450 | 2450 |
| 2451 void FrameView::updateScrollCorner() | 2451 void FrameView::updateScrollCorner() |
| 2452 { | 2452 { |
| 2453 RefPtr<RenderStyle> cornerStyle; | 2453 RefPtr<RenderStyle> cornerStyle; |
| 2454 IntRect cornerRect = scrollCornerRect(); | 2454 IntRect cornerRect = scrollCornerRect(); |
| 2455 Document* doc = m_frame->document(); | 2455 Document* doc = m_frame->document(); |
| 2456 | 2456 |
| 2457 if (doc && !cornerRect.isEmpty()) { | 2457 if (doc && !cornerRect.isEmpty()) { |
| 2458 // Try the <body> element first as a scroll corner source. | 2458 // Try the <body> element first as a scroll corner source. |
| 2459 if (Element* body = doc->body()) { | 2459 if (Element* body = doc->body()) { |
| 2460 if (RenderObject* renderer = body->renderer()) | 2460 if (LayoutObject* renderer = body->renderer()) |
| 2461 cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleReques
t(SCROLLBAR_CORNER), renderer->style()); | 2461 cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleReques
t(SCROLLBAR_CORNER), renderer->style()); |
| 2462 } | 2462 } |
| 2463 | 2463 |
| 2464 if (!cornerStyle) { | 2464 if (!cornerStyle) { |
| 2465 // If the <body> didn't have a custom style, then the root element m
ight. | 2465 // If the <body> didn't have a custom style, then the root element m
ight. |
| 2466 if (Element* docElement = doc->documentElement()) { | 2466 if (Element* docElement = doc->documentElement()) { |
| 2467 if (RenderObject* renderer = docElement->renderer()) | 2467 if (LayoutObject* renderer = docElement->renderer()) |
| 2468 cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRe
quest(SCROLLBAR_CORNER), renderer->style()); | 2468 cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRe
quest(SCROLLBAR_CORNER), renderer->style()); |
| 2469 } | 2469 } |
| 2470 } | 2470 } |
| 2471 | 2471 |
| 2472 if (!cornerStyle) { | 2472 if (!cornerStyle) { |
| 2473 // If we have an owning ipage/LocalFrame element, then it can set th
e custom scrollbar also. | 2473 // If we have an owning ipage/LocalFrame element, then it can set th
e custom scrollbar also. |
| 2474 if (RenderPart* renderer = m_frame->ownerRenderer()) | 2474 if (RenderPart* renderer = m_frame->ownerRenderer()) |
| 2475 cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleReques
t(SCROLLBAR_CORNER), renderer->style()); | 2475 cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleReques
t(SCROLLBAR_CORNER), renderer->style()); |
| 2476 } | 2476 } |
| 2477 } | 2477 } |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2748 if (!horizontalWritingMode) | 2748 if (!horizontalWritingMode) |
| 2749 overflow = overflow.transposedRect(); | 2749 overflow = overflow.transposedRect(); |
| 2750 renderView->clearLayoutOverflow(); | 2750 renderView->clearLayoutOverflow(); |
| 2751 renderView->addLayoutOverflow(overflow); // This is how we clip in c
ase we overflow again. | 2751 renderView->addLayoutOverflow(overflow); // This is how we clip in c
ase we overflow again. |
| 2752 } | 2752 } |
| 2753 } | 2753 } |
| 2754 | 2754 |
| 2755 adjustViewSize(); | 2755 adjustViewSize(); |
| 2756 } | 2756 } |
| 2757 | 2757 |
| 2758 IntRect FrameView::convertFromRenderer(const RenderObject& renderer, const IntRe
ct& rendererRect) const | 2758 IntRect FrameView::convertFromRenderer(const LayoutObject& renderer, const IntRe
ct& rendererRect) const |
| 2759 { | 2759 { |
| 2760 IntRect rect = pixelSnappedIntRect(enclosingLayoutRect(renderer.localToAbsol
uteQuad(FloatRect(rendererRect)).boundingBox())); | 2760 IntRect rect = pixelSnappedIntRect(enclosingLayoutRect(renderer.localToAbsol
uteQuad(FloatRect(rendererRect)).boundingBox())); |
| 2761 | 2761 |
| 2762 // Convert from page ("absolute") to FrameView coordinates. | 2762 // Convert from page ("absolute") to FrameView coordinates. |
| 2763 rect.moveBy(-scrollPosition()); | 2763 rect.moveBy(-scrollPosition()); |
| 2764 | 2764 |
| 2765 return rect; | 2765 return rect; |
| 2766 } | 2766 } |
| 2767 | 2767 |
| 2768 IntRect FrameView::convertToRenderer(const RenderObject& renderer, const IntRect
& viewRect) const | 2768 IntRect FrameView::convertToRenderer(const LayoutObject& renderer, const IntRect
& viewRect) const |
| 2769 { | 2769 { |
| 2770 IntRect rect = viewRect; | 2770 IntRect rect = viewRect; |
| 2771 | 2771 |
| 2772 // Convert from FrameView coords into page ("absolute") coordinates. | 2772 // Convert from FrameView coords into page ("absolute") coordinates. |
| 2773 rect.moveBy(scrollPosition()); | 2773 rect.moveBy(scrollPosition()); |
| 2774 | 2774 |
| 2775 // FIXME: we don't have a way to map an absolute rect down to a local quad,
so just | 2775 // FIXME: we don't have a way to map an absolute rect down to a local quad,
so just |
| 2776 // move the rect for now. | 2776 // move the rect for now. |
| 2777 rect.setLocation(roundedIntPoint(renderer.absoluteToLocal(rect.location(), U
seTransforms))); | 2777 rect.setLocation(roundedIntPoint(renderer.absoluteToLocal(rect.location(), U
seTransforms))); |
| 2778 return rect; | 2778 return rect; |
| 2779 } | 2779 } |
| 2780 | 2780 |
| 2781 IntPoint FrameView::convertFromRenderer(const RenderObject& renderer, const IntP
oint& rendererPoint) const | 2781 IntPoint FrameView::convertFromRenderer(const LayoutObject& renderer, const IntP
oint& rendererPoint) const |
| 2782 { | 2782 { |
| 2783 IntPoint point = roundedIntPoint(renderer.localToAbsolute(rendererPoint, Use
Transforms)); | 2783 IntPoint point = roundedIntPoint(renderer.localToAbsolute(rendererPoint, Use
Transforms)); |
| 2784 | 2784 |
| 2785 // Convert from page ("absolute") to FrameView coordinates. | 2785 // Convert from page ("absolute") to FrameView coordinates. |
| 2786 point.moveBy(-scrollPosition()); | 2786 point.moveBy(-scrollPosition()); |
| 2787 return point; | 2787 return point; |
| 2788 } | 2788 } |
| 2789 | 2789 |
| 2790 IntPoint FrameView::convertToRenderer(const RenderObject& renderer, const IntPoi
nt& viewPoint) const | 2790 IntPoint FrameView::convertToRenderer(const LayoutObject& renderer, const IntPoi
nt& viewPoint) const |
| 2791 { | 2791 { |
| 2792 IntPoint point = viewPoint; | 2792 IntPoint point = viewPoint; |
| 2793 | 2793 |
| 2794 // Convert from FrameView coords into page ("absolute") coordinates. | 2794 // Convert from FrameView coords into page ("absolute") coordinates. |
| 2795 point += IntSize(scrollX(), scrollY()); | 2795 point += IntSize(scrollX(), scrollY()); |
| 2796 | 2796 |
| 2797 return roundedIntPoint(renderer.absoluteToLocal(point, UseTransforms)); | 2797 return roundedIntPoint(renderer.absoluteToLocal(point, UseTransforms)); |
| 2798 } | 2798 } |
| 2799 | 2799 |
| 2800 IntRect FrameView::convertToContainingView(const IntRect& localRect) const | 2800 IntRect FrameView::convertToContainingView(const IntRect& localRect) const |
| (...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4040 { | 4040 { |
| 4041 Settings* settings = frame().settings(); | 4041 Settings* settings = frame().settings(); |
| 4042 if (!settings || !settings->rootLayerScrolls()) | 4042 if (!settings || !settings->rootLayerScrolls()) |
| 4043 return this; | 4043 return this; |
| 4044 | 4044 |
| 4045 RenderView* renderView = this->renderView(); | 4045 RenderView* renderView = this->renderView(); |
| 4046 return renderView ? renderView->scrollableArea() : nullptr; | 4046 return renderView ? renderView->scrollableArea() : nullptr; |
| 4047 } | 4047 } |
| 4048 | 4048 |
| 4049 } // namespace blink | 4049 } // namespace blink |
| OLD | NEW |