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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::lineLayoutTime(double ms) | 833 void FrameView::lineLayoutTime(double ms) |
834 { | 834 { |
835 m_lineLayoutMs += ms; | 835 m_lineLayoutMs += ms; |
836 } | 836 } |
837 | 837 |
838 void FrameView::performLayout(RenderObject* rootForThisLayout, bool inSubtreeLay
out) | 838 void FrameView::performLayout(LayoutObject* rootForThisLayout, bool inSubtreeLay
out) |
839 { | 839 { |
840 m_lineLayoutMs = 0; | 840 m_lineLayoutMs = 0; |
841 TRACE_EVENT0("blink,benchmark", "FrameView::performLayout"); | 841 TRACE_EVENT0("blink,benchmark", "FrameView::performLayout"); |
842 double start = WTF::currentTimeMS(); | 842 double start = WTF::currentTimeMS(); |
843 | 843 |
844 ScriptForbiddenScope forbidScript; | 844 ScriptForbiddenScope forbidScript; |
845 | 845 |
846 ASSERT(!isInPerformLayout()); | 846 ASSERT(!isInPerformLayout()); |
847 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); | 847 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); |
848 | 848 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 | 933 |
934 #if !ENABLE(OILPAN) | 934 #if !ENABLE(OILPAN) |
935 // If there is only one ref to this view left, then its going to be destroye
d as soon as we exit, | 935 // If there is only one ref to this view left, then its going to be destroye
d as soon as we exit, |
936 // so there's no point to continuing to layout | 936 // so there's no point to continuing to layout |
937 if (protector->hasOneRef()) | 937 if (protector->hasOneRef()) |
938 return; | 938 return; |
939 #endif | 939 #endif |
940 | 940 |
941 Document* document = m_frame->document(); | 941 Document* document = m_frame->document(); |
942 bool inSubtreeLayout = isSubtreeLayout(); | 942 bool inSubtreeLayout = isSubtreeLayout(); |
943 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do
cument->renderView(); | 943 LayoutObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do
cument->renderView(); |
944 if (!rootForThisLayout) { | 944 if (!rootForThisLayout) { |
945 // FIXME: Do we need to set m_size here? | 945 // FIXME: Do we need to set m_size here? |
946 ASSERT_NOT_REACHED(); | 946 ASSERT_NOT_REACHED(); |
947 return; | 947 return; |
948 } | 948 } |
949 | 949 |
950 FontCachePurgePreventer fontCachePurgePreventer; | 950 FontCachePurgePreventer fontCachePurgePreventer; |
951 Layer* layer; | 951 Layer* layer; |
952 { | 952 { |
953 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled,
false); | 953 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled,
false); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 | 1004 |
1005 if (oldSize != m_size && !m_firstLayout) { | 1005 if (oldSize != m_size && !m_firstLayout) { |
1006 RenderBox* rootRenderer = document->documentElement() ? document
->documentElement()->renderBox() : 0; | 1006 RenderBox* rootRenderer = document->documentElement() ? document
->documentElement()->renderBox() : 0; |
1007 RenderBox* bodyRenderer = rootRenderer && document->body() ? doc
ument->body()->renderBox() : 0; | 1007 RenderBox* bodyRenderer = rootRenderer && document->body() ? doc
ument->body()->renderBox() : 0; |
1008 if (bodyRenderer && bodyRenderer->stretchesToViewport()) | 1008 if (bodyRenderer && bodyRenderer->stretchesToViewport()) |
1009 bodyRenderer->setChildNeedsLayout(); | 1009 bodyRenderer->setChildNeedsLayout(); |
1010 else if (rootRenderer && rootRenderer->stretchesToViewport()) | 1010 else if (rootRenderer && rootRenderer->stretchesToViewport()) |
1011 rootRenderer->setChildNeedsLayout(); | 1011 rootRenderer->setChildNeedsLayout(); |
1012 } | 1012 } |
1013 | 1013 |
1014 // We need to set m_doFullPaintInvalidation before triggering layout
as RenderObject::checkForPaintInvalidation | 1014 // We need to set m_doFullPaintInvalidation before triggering layout
as LayoutObject::checkForPaintInvalidation |
1015 // checks the boolean to disable local paint invalidations. | 1015 // checks the boolean to disable local paint invalidations. |
1016 m_doFullPaintInvalidation |= renderView()->shouldDoFullPaintInvalida
tionForNextLayout(); | 1016 m_doFullPaintInvalidation |= renderView()->shouldDoFullPaintInvalida
tionForNextLayout(); |
1017 } | 1017 } |
1018 | 1018 |
1019 layer = rootForThisLayout->enclosingLayer(); | 1019 layer = rootForThisLayout->enclosingLayer(); |
1020 | 1020 |
1021 performLayout(rootForThisLayout, inSubtreeLayout); | 1021 performLayout(rootForThisLayout, inSubtreeLayout); |
1022 | 1022 |
1023 m_layoutSubtreeRoot = nullptr; | 1023 m_layoutSubtreeRoot = nullptr; |
1024 // We need to ensure that we mark up all renderers up to the RenderView | 1024 // We need to ensure that we mark up all renderers up to the RenderView |
1025 // for paint invalidation. This simplifies our code as we just always | 1025 // for paint invalidation. This simplifies our code as we just always |
1026 // do a full tree walk. | 1026 // do a full tree walk. |
1027 if (RenderObject* container = rootForThisLayout->container()) | 1027 if (LayoutObject* container = rootForThisLayout->container()) |
1028 container->setMayNeedPaintInvalidation(); | 1028 container->setMayNeedPaintInvalidation(); |
1029 } // Reset m_layoutSchedulingEnabled to its previous value. | 1029 } // Reset m_layoutSchedulingEnabled to its previous value. |
1030 | 1030 |
1031 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin
g()) | 1031 if (!inSubtreeLayout && !toRenderView(rootForThisLayout)->document().printin
g()) |
1032 adjustViewSize(); | 1032 adjustViewSize(); |
1033 | 1033 |
1034 layer->updateLayerPositionsAfterLayout(); | 1034 layer->updateLayerPositionsAfterLayout(); |
1035 | 1035 |
1036 renderView()->compositor()->didLayout(); | 1036 renderView()->compositor()->didLayout(); |
1037 | 1037 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 | 1107 |
1108 if (m_frame->selection().isCaretBoundsDirty()) | 1108 if (m_frame->selection().isCaretBoundsDirty()) |
1109 m_frame->selection().invalidateCaretRect(); | 1109 m_frame->selection().invalidateCaretRect(); |
1110 } | 1110 } |
1111 | 1111 |
1112 DocumentLifecycle& FrameView::lifecycle() const | 1112 DocumentLifecycle& FrameView::lifecycle() const |
1113 { | 1113 { |
1114 return m_frame->document()->lifecycle(); | 1114 return m_frame->document()->lifecycle(); |
1115 } | 1115 } |
1116 | 1116 |
1117 void FrameView::gatherDebugLayoutRects(RenderObject* layoutRoot) | 1117 void FrameView::gatherDebugLayoutRects(LayoutObject* layoutRoot) |
1118 { | 1118 { |
1119 bool isTracing; | 1119 bool isTracing; |
1120 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.debug.la
yout"), &isTracing); | 1120 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.debug.la
yout"), &isTracing); |
1121 if (!isTracing) | 1121 if (!isTracing) |
1122 return; | 1122 return; |
1123 if (!layoutRoot->enclosingLayer()->hasCompositedLayerMapping()) | 1123 if (!layoutRoot->enclosingLayer()->hasCompositedLayerMapping()) |
1124 return; | 1124 return; |
1125 // For access to compositedLayerMapping(). | 1125 // For access to compositedLayerMapping(). |
1126 DisableCompositingQueryAsserts disabler; | 1126 DisableCompositingQueryAsserts disabler; |
1127 GraphicsLayer* graphicsLayer = layoutRoot->enclosingLayer()->compositedLayer
Mapping()->mainGraphicsLayer(); | 1127 GraphicsLayer* graphicsLayer = layoutRoot->enclosingLayer()->compositedLayer
Mapping()->mainGraphicsLayer(); |
1128 if (!graphicsLayer) | 1128 if (!graphicsLayer) |
1129 return; | 1129 return; |
1130 | 1130 |
1131 GraphicsLayerDebugInfo& debugInfo = graphicsLayer->debugInfo(); | 1131 GraphicsLayerDebugInfo& debugInfo = graphicsLayer->debugInfo(); |
1132 | 1132 |
1133 debugInfo.currentLayoutRects().clear(); | 1133 debugInfo.currentLayoutRects().clear(); |
1134 for (RenderObject* renderer = layoutRoot; renderer; renderer = renderer->nex
tInPreOrder()) { | 1134 for (LayoutObject* renderer = layoutRoot; renderer; renderer = renderer->nex
tInPreOrder()) { |
1135 if (renderer->layoutDidGetCalledSinceLastFrame()) { | 1135 if (renderer->layoutDidGetCalledSinceLastFrame()) { |
1136 FloatQuad quad = renderer->localToAbsoluteQuad(FloatQuad(renderer->p
reviousPaintInvalidationRect())); | 1136 FloatQuad quad = renderer->localToAbsoluteQuad(FloatQuad(renderer->p
reviousPaintInvalidationRect())); |
1137 LayoutRect rect = quad.enclosingBoundingBox(); | 1137 LayoutRect rect = quad.enclosingBoundingBox(); |
1138 debugInfo.currentLayoutRects().append(rect); | 1138 debugInfo.currentLayoutRects().append(rect); |
1139 } | 1139 } |
1140 } | 1140 } |
1141 } | 1141 } |
1142 | 1142 |
1143 RenderBox* FrameView::embeddedContentBox() const | 1143 RenderBox* FrameView::embeddedContentBox() const |
1144 { | 1144 { |
1145 RenderView* renderView = this->renderView(); | 1145 RenderView* renderView = this->renderView(); |
1146 if (!renderView) | 1146 if (!renderView) |
1147 return nullptr; | 1147 return nullptr; |
1148 | 1148 |
1149 RenderObject* firstChild = renderView->firstChild(); | 1149 LayoutObject* firstChild = renderView->firstChild(); |
1150 if (!firstChild || !firstChild->isBox()) | 1150 if (!firstChild || !firstChild->isBox()) |
1151 return nullptr; | 1151 return nullptr; |
1152 | 1152 |
1153 // Curently only embedded SVG documents participate in the size-negotiation
logic. | 1153 // Curently only embedded SVG documents participate in the size-negotiation
logic. |
1154 if (firstChild->isSVGRoot()) | 1154 if (firstChild->isSVGRoot()) |
1155 return toRenderBox(firstChild); | 1155 return toRenderBox(firstChild); |
1156 | 1156 |
1157 return nullptr; | 1157 return nullptr; |
1158 } | 1158 } |
1159 | 1159 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1247 void FrameView::removeSlowRepaintObject() | 1247 void FrameView::removeSlowRepaintObject() |
1248 { | 1248 { |
1249 ASSERT(m_slowRepaintObjectCount > 0); | 1249 ASSERT(m_slowRepaintObjectCount > 0); |
1250 m_slowRepaintObjectCount--; | 1250 m_slowRepaintObjectCount--; |
1251 if (!m_slowRepaintObjectCount) { | 1251 if (!m_slowRepaintObjectCount) { |
1252 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1252 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
1253 scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this); | 1253 scrollingCoordinator->frameViewHasSlowRepaintObjectsDidChange(this); |
1254 } | 1254 } |
1255 } | 1255 } |
1256 | 1256 |
1257 void FrameView::addViewportConstrainedObject(RenderObject* object) | 1257 void FrameView::addViewportConstrainedObject(LayoutObject* object) |
1258 { | 1258 { |
1259 if (!m_viewportConstrainedObjects) | 1259 if (!m_viewportConstrainedObjects) |
1260 m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet
); | 1260 m_viewportConstrainedObjects = adoptPtr(new ViewportConstrainedObjectSet
); |
1261 | 1261 |
1262 if (!m_viewportConstrainedObjects->contains(object)) { | 1262 if (!m_viewportConstrainedObjects->contains(object)) { |
1263 m_viewportConstrainedObjects->add(object); | 1263 m_viewportConstrainedObjects->add(object); |
1264 | 1264 |
1265 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1265 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
1266 scrollingCoordinator->frameViewFixedObjectsDidChange(this); | 1266 scrollingCoordinator->frameViewFixedObjectsDidChange(this); |
1267 } | 1267 } |
1268 } | 1268 } |
1269 | 1269 |
1270 void FrameView::removeViewportConstrainedObject(RenderObject* object) | 1270 void FrameView::removeViewportConstrainedObject(LayoutObject* object) |
1271 { | 1271 { |
1272 if (m_viewportConstrainedObjects && m_viewportConstrainedObjects->contains(o
bject)) { | 1272 if (m_viewportConstrainedObjects && m_viewportConstrainedObjects->contains(o
bject)) { |
1273 m_viewportConstrainedObjects->remove(object); | 1273 m_viewportConstrainedObjects->remove(object); |
1274 | 1274 |
1275 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) | 1275 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordina
tor()) |
1276 scrollingCoordinator->frameViewFixedObjectsDidChange(this); | 1276 scrollingCoordinator->frameViewFixedObjectsDidChange(this); |
1277 } | 1277 } |
1278 } | 1278 } |
1279 | 1279 |
1280 LayoutRect FrameView::viewportConstrainedVisibleContentRect() const | 1280 LayoutRect FrameView::viewportConstrainedVisibleContentRect() const |
(...skipping 13 matching lines...) Expand all Loading... |
1294 // Otherwise, viewport constrained objects need their layout flags set separ
ately to ensure | 1294 // Otherwise, viewport constrained objects need their layout flags set separ
ately to ensure |
1295 // they are positioned correctly. In the virtual-viewport pinch mode frame r
ect changes wont | 1295 // they are positioned correctly. In the virtual-viewport pinch mode frame r
ect changes wont |
1296 // necessarily cause a layout size change so only take this early-out if we'
re in old-style | 1296 // necessarily cause a layout size change so only take this early-out if we'
re in old-style |
1297 // pinch. | 1297 // pinch. |
1298 if (m_frame->settings() | 1298 if (m_frame->settings() |
1299 && !m_frame->settings()->viewportEnabled() | 1299 && !m_frame->settings()->viewportEnabled() |
1300 && !m_frame->settings()->pinchVirtualViewportEnabled()) | 1300 && !m_frame->settings()->pinchVirtualViewportEnabled()) |
1301 return; | 1301 return; |
1302 | 1302 |
1303 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects)
{ | 1303 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects)
{ |
1304 RenderObject* renderer = viewportConstrainedObject; | 1304 LayoutObject* renderer = viewportConstrainedObject; |
1305 RenderStyle* style = renderer->style(); | 1305 RenderStyle* style = renderer->style(); |
1306 if (widthChanged) { | 1306 if (widthChanged) { |
1307 if (style->width().isFixed() && (style->left().isAuto() || style->ri
ght().isAuto())) | 1307 if (style->width().isFixed() && (style->left().isAuto() || style->ri
ght().isAuto())) |
1308 renderer->setNeedsPositionedMovementLayout(); | 1308 renderer->setNeedsPositionedMovementLayout(); |
1309 else | 1309 else |
1310 renderer->setNeedsLayoutAndFullPaintInvalidation(); | 1310 renderer->setNeedsLayoutAndFullPaintInvalidation(); |
1311 } | 1311 } |
1312 if (heightChanged) { | 1312 if (heightChanged) { |
1313 if (style->height().isFixed() && (style->top().isAuto() || style->bo
ttom().isAuto())) | 1313 if (style->height().isFixed() && (style->top().isAuto() || style->bo
ttom().isAuto())) |
1314 renderer->setNeedsPositionedMovementLayout(); | 1314 renderer->setNeedsPositionedMovementLayout(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 { | 1364 { |
1365 if (!contentsInCompositedLayer() || hasSlowRepaintObjects()) | 1365 if (!contentsInCompositedLayer() || hasSlowRepaintObjects()) |
1366 return false; | 1366 return false; |
1367 | 1367 |
1368 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty()
) { | 1368 if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty()
) { |
1369 InspectorInstrumentation::didScroll(m_frame.get()); | 1369 InspectorInstrumentation::didScroll(m_frame.get()); |
1370 return true; | 1370 return true; |
1371 } | 1371 } |
1372 | 1372 |
1373 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects)
{ | 1373 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects)
{ |
1374 RenderObject* renderer = viewportConstrainedObject; | 1374 LayoutObject* renderer = viewportConstrainedObject; |
1375 ASSERT(renderer->style()->hasViewportConstrainedPosition()); | 1375 ASSERT(renderer->style()->hasViewportConstrainedPosition()); |
1376 ASSERT(renderer->hasLayer()); | 1376 ASSERT(renderer->hasLayer()); |
1377 Layer* layer = toRenderBoxModelObject(renderer)->layer(); | 1377 Layer* layer = toRenderBoxModelObject(renderer)->layer(); |
1378 | 1378 |
1379 if (layer->isPaintInvalidationContainer()) | 1379 if (layer->isPaintInvalidationContainer()) |
1380 continue; | 1380 continue; |
1381 | 1381 |
1382 if (layer->subtreeIsInvisible()) | 1382 if (layer->subtreeIsInvisible()) |
1383 continue; | 1383 continue; |
1384 | 1384 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 cancelProgrammaticScrollAnimation(); | 1551 cancelProgrammaticScrollAnimation(); |
1552 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); | 1552 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru
e); |
1553 m_maintainScrollPositionAnchor = nullptr; | 1553 m_maintainScrollPositionAnchor = nullptr; |
1554 | 1554 |
1555 DoublePoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint)
; | 1555 DoublePoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint)
; |
1556 if (newScrollPosition == scrollPositionDouble()) | 1556 if (newScrollPosition == scrollPositionDouble()) |
1557 return; | 1557 return; |
1558 | 1558 |
1559 if (scrollBehavior == ScrollBehaviorAuto) { | 1559 if (scrollBehavior == ScrollBehaviorAuto) { |
1560 Element* scrollElement = RuntimeEnabledFeatures::scrollTopLeftInteropEna
bled() ? m_frame->document()->documentElement() : m_frame->document()->body(); | 1560 Element* scrollElement = RuntimeEnabledFeatures::scrollTopLeftInteropEna
bled() ? m_frame->document()->documentElement() : m_frame->document()->body(); |
1561 RenderObject* renderer = scrollElement ? scrollElement->renderer() : nul
lptr; | 1561 LayoutObject* renderer = scrollElement ? scrollElement->renderer() : nul
lptr; |
1562 if (renderer && renderer->style()->scrollBehavior() == ScrollBehaviorSmo
oth) | 1562 if (renderer && renderer->style()->scrollBehavior() == ScrollBehaviorSmo
oth) |
1563 scrollBehavior = ScrollBehaviorSmooth; | 1563 scrollBehavior = ScrollBehaviorSmooth; |
1564 else | 1564 else |
1565 scrollBehavior = ScrollBehaviorInstant; | 1565 scrollBehavior = ScrollBehaviorInstant; |
1566 } | 1566 } |
1567 | 1567 |
1568 if (scrollBehavior == ScrollBehaviorInstant) { | 1568 if (scrollBehavior == ScrollBehaviorInstant) { |
1569 DoubleSize newOffset(newScrollPosition.x(), newScrollPosition.y()); | 1569 DoubleSize newOffset(newScrollPosition.x(), newScrollPosition.y()); |
1570 updateScrollbars(newOffset); | 1570 updateScrollbars(newOffset); |
1571 } else { | 1571 } else { |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1832 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); | 1832 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); |
1833 | 1833 |
1834 if (m_hasPendingLayout) | 1834 if (m_hasPendingLayout) |
1835 return; | 1835 return; |
1836 m_hasPendingLayout = true; | 1836 m_hasPendingLayout = true; |
1837 | 1837 |
1838 page()->animator().scheduleVisualUpdate(m_frame.get()); | 1838 page()->animator().scheduleVisualUpdate(m_frame.get()); |
1839 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); | 1839 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); |
1840 } | 1840 } |
1841 | 1841 |
1842 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de
scendant) | 1842 static bool isObjectAncestorContainerOf(LayoutObject* ancestor, LayoutObject* de
scendant) |
1843 { | 1843 { |
1844 for (RenderObject* r = descendant; r; r = r->container()) { | 1844 for (LayoutObject* r = descendant; r; r = r->container()) { |
1845 if (r == ancestor) | 1845 if (r == ancestor) |
1846 return true; | 1846 return true; |
1847 } | 1847 } |
1848 return false; | 1848 return false; |
1849 } | 1849 } |
1850 | 1850 |
1851 void FrameView::scheduleRelayoutOfSubtree(RenderObject* relayoutRoot) | 1851 void FrameView::scheduleRelayoutOfSubtree(LayoutObject* relayoutRoot) |
1852 { | 1852 { |
1853 ASSERT(m_frame->view() == this); | 1853 ASSERT(m_frame->view() == this); |
1854 | 1854 |
1855 // FIXME: Should this call shouldScheduleLayout instead? | 1855 // FIXME: Should this call shouldScheduleLayout instead? |
1856 if (!m_frame->document()->isActive()) | 1856 if (!m_frame->document()->isActive()) |
1857 return; | 1857 return; |
1858 | 1858 |
1859 RenderView* renderView = this->renderView(); | 1859 RenderView* renderView = this->renderView(); |
1860 if (renderView && renderView->needsLayout()) { | 1860 if (renderView && renderView->needsLayout()) { |
1861 if (relayoutRoot) | 1861 if (relayoutRoot) |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2162 { | 2162 { |
2163 performPostLayoutTasks(); | 2163 performPostLayoutTasks(); |
2164 } | 2164 } |
2165 | 2165 |
2166 void FrameView::updateCounters() | 2166 void FrameView::updateCounters() |
2167 { | 2167 { |
2168 RenderView* view = renderView(); | 2168 RenderView* view = renderView(); |
2169 if (!view->hasLayoutCounters()) | 2169 if (!view->hasLayoutCounters()) |
2170 return; | 2170 return; |
2171 | 2171 |
2172 for (RenderObject* renderer = view; renderer; renderer = renderer->nextInPre
Order()) { | 2172 for (LayoutObject* renderer = view; renderer; renderer = renderer->nextInPre
Order()) { |
2173 if (!renderer->isCounter()) | 2173 if (!renderer->isCounter()) |
2174 continue; | 2174 continue; |
2175 | 2175 |
2176 toLayoutCounter(renderer)->updateCounter(); | 2176 toLayoutCounter(renderer)->updateCounter(); |
2177 } | 2177 } |
2178 } | 2178 } |
2179 | 2179 |
2180 void FrameView::updateOverflowStatus(bool horizontalOverflow, bool verticalOverf
low) | 2180 void FrameView::updateOverflowStatus(bool horizontalOverflow, bool verticalOverf
low) |
2181 { | 2181 { |
2182 if (!m_viewportRenderer) | 2182 if (!m_viewportRenderer) |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2457 | 2457 |
2458 void FrameView::updateScrollCorner() | 2458 void FrameView::updateScrollCorner() |
2459 { | 2459 { |
2460 RefPtr<RenderStyle> cornerStyle; | 2460 RefPtr<RenderStyle> cornerStyle; |
2461 IntRect cornerRect = scrollCornerRect(); | 2461 IntRect cornerRect = scrollCornerRect(); |
2462 Document* doc = m_frame->document(); | 2462 Document* doc = m_frame->document(); |
2463 | 2463 |
2464 if (doc && !cornerRect.isEmpty()) { | 2464 if (doc && !cornerRect.isEmpty()) { |
2465 // Try the <body> element first as a scroll corner source. | 2465 // Try the <body> element first as a scroll corner source. |
2466 if (Element* body = doc->body()) { | 2466 if (Element* body = doc->body()) { |
2467 if (RenderObject* renderer = body->renderer()) | 2467 if (LayoutObject* renderer = body->renderer()) |
2468 cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleReques
t(SCROLLBAR_CORNER), renderer->style()); | 2468 cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleReques
t(SCROLLBAR_CORNER), renderer->style()); |
2469 } | 2469 } |
2470 | 2470 |
2471 if (!cornerStyle) { | 2471 if (!cornerStyle) { |
2472 // If the <body> didn't have a custom style, then the root element m
ight. | 2472 // If the <body> didn't have a custom style, then the root element m
ight. |
2473 if (Element* docElement = doc->documentElement()) { | 2473 if (Element* docElement = doc->documentElement()) { |
2474 if (RenderObject* renderer = docElement->renderer()) | 2474 if (LayoutObject* renderer = docElement->renderer()) |
2475 cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRe
quest(SCROLLBAR_CORNER), renderer->style()); | 2475 cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleRe
quest(SCROLLBAR_CORNER), renderer->style()); |
2476 } | 2476 } |
2477 } | 2477 } |
2478 | 2478 |
2479 if (!cornerStyle) { | 2479 if (!cornerStyle) { |
2480 // If we have an owning ipage/LocalFrame element, then it can set th
e custom scrollbar also. | 2480 // If we have an owning ipage/LocalFrame element, then it can set th
e custom scrollbar also. |
2481 if (RenderPart* renderer = m_frame->ownerRenderer()) | 2481 if (RenderPart* renderer = m_frame->ownerRenderer()) |
2482 cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleReques
t(SCROLLBAR_CORNER), renderer->style()); | 2482 cornerStyle = renderer->getUncachedPseudoStyle(PseudoStyleReques
t(SCROLLBAR_CORNER), renderer->style()); |
2483 } | 2483 } |
2484 } | 2484 } |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2755 if (!horizontalWritingMode) | 2755 if (!horizontalWritingMode) |
2756 overflow = overflow.transposedRect(); | 2756 overflow = overflow.transposedRect(); |
2757 renderView->clearLayoutOverflow(); | 2757 renderView->clearLayoutOverflow(); |
2758 renderView->addLayoutOverflow(overflow); // This is how we clip in c
ase we overflow again. | 2758 renderView->addLayoutOverflow(overflow); // This is how we clip in c
ase we overflow again. |
2759 } | 2759 } |
2760 } | 2760 } |
2761 | 2761 |
2762 adjustViewSize(); | 2762 adjustViewSize(); |
2763 } | 2763 } |
2764 | 2764 |
2765 IntRect FrameView::convertFromRenderer(const RenderObject& renderer, const IntRe
ct& rendererRect) const | 2765 IntRect FrameView::convertFromRenderer(const LayoutObject& renderer, const IntRe
ct& rendererRect) const |
2766 { | 2766 { |
2767 IntRect rect = pixelSnappedIntRect(enclosingLayoutRect(renderer.localToAbsol
uteQuad(FloatRect(rendererRect)).boundingBox())); | 2767 IntRect rect = pixelSnappedIntRect(enclosingLayoutRect(renderer.localToAbsol
uteQuad(FloatRect(rendererRect)).boundingBox())); |
2768 | 2768 |
2769 // Convert from page ("absolute") to FrameView coordinates. | 2769 // Convert from page ("absolute") to FrameView coordinates. |
2770 rect.moveBy(-scrollPosition()); | 2770 rect.moveBy(-scrollPosition()); |
2771 | 2771 |
2772 return rect; | 2772 return rect; |
2773 } | 2773 } |
2774 | 2774 |
2775 IntRect FrameView::convertToRenderer(const RenderObject& renderer, const IntRect
& viewRect) const | 2775 IntRect FrameView::convertToRenderer(const LayoutObject& renderer, const IntRect
& viewRect) const |
2776 { | 2776 { |
2777 IntRect rect = viewRect; | 2777 IntRect rect = viewRect; |
2778 | 2778 |
2779 // Convert from FrameView coords into page ("absolute") coordinates. | 2779 // Convert from FrameView coords into page ("absolute") coordinates. |
2780 rect.moveBy(scrollPosition()); | 2780 rect.moveBy(scrollPosition()); |
2781 | 2781 |
2782 // FIXME: we don't have a way to map an absolute rect down to a local quad,
so just | 2782 // FIXME: we don't have a way to map an absolute rect down to a local quad,
so just |
2783 // move the rect for now. | 2783 // move the rect for now. |
2784 rect.setLocation(roundedIntPoint(renderer.absoluteToLocal(rect.location(), U
seTransforms))); | 2784 rect.setLocation(roundedIntPoint(renderer.absoluteToLocal(rect.location(), U
seTransforms))); |
2785 return rect; | 2785 return rect; |
2786 } | 2786 } |
2787 | 2787 |
2788 IntPoint FrameView::convertFromRenderer(const RenderObject& renderer, const IntP
oint& rendererPoint) const | 2788 IntPoint FrameView::convertFromRenderer(const LayoutObject& renderer, const IntP
oint& rendererPoint) const |
2789 { | 2789 { |
2790 IntPoint point = roundedIntPoint(renderer.localToAbsolute(rendererPoint, Use
Transforms)); | 2790 IntPoint point = roundedIntPoint(renderer.localToAbsolute(rendererPoint, Use
Transforms)); |
2791 | 2791 |
2792 // Convert from page ("absolute") to FrameView coordinates. | 2792 // Convert from page ("absolute") to FrameView coordinates. |
2793 point.moveBy(-scrollPosition()); | 2793 point.moveBy(-scrollPosition()); |
2794 return point; | 2794 return point; |
2795 } | 2795 } |
2796 | 2796 |
2797 IntPoint FrameView::convertToRenderer(const RenderObject& renderer, const IntPoi
nt& viewPoint) const | 2797 IntPoint FrameView::convertToRenderer(const LayoutObject& renderer, const IntPoi
nt& viewPoint) const |
2798 { | 2798 { |
2799 IntPoint point = viewPoint; | 2799 IntPoint point = viewPoint; |
2800 | 2800 |
2801 // Convert from FrameView coords into page ("absolute") coordinates. | 2801 // Convert from FrameView coords into page ("absolute") coordinates. |
2802 point += IntSize(scrollX(), scrollY()); | 2802 point += IntSize(scrollX(), scrollY()); |
2803 | 2803 |
2804 return roundedIntPoint(renderer.absoluteToLocal(point, UseTransforms)); | 2804 return roundedIntPoint(renderer.absoluteToLocal(point, UseTransforms)); |
2805 } | 2805 } |
2806 | 2806 |
2807 IntRect FrameView::convertToContainingView(const IntRect& localRect) const | 2807 IntRect FrameView::convertToContainingView(const IntRect& localRect) const |
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4047 { | 4047 { |
4048 Settings* settings = frame().settings(); | 4048 Settings* settings = frame().settings(); |
4049 if (!settings || !settings->rootLayerScrolls()) | 4049 if (!settings || !settings->rootLayerScrolls()) |
4050 return this; | 4050 return this; |
4051 | 4051 |
4052 RenderView* renderView = this->renderView(); | 4052 RenderView* renderView = this->renderView(); |
4053 return renderView ? renderView->scrollableArea() : nullptr; | 4053 return renderView ? renderView->scrollableArea() : nullptr; |
4054 } | 4054 } |
4055 | 4055 |
4056 } // namespace blink | 4056 } // namespace blink |
OLD | NEW |