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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 , m_frameTimingRequestsDirty(true) | 163 , m_frameTimingRequestsDirty(true) |
164 , m_viewportIntersectionValid(false) | 164 , m_viewportIntersectionValid(false) |
165 , m_hiddenForThrottling(false) | 165 , m_hiddenForThrottling(false) |
166 , m_crossOriginForThrottling(false) | 166 , m_crossOriginForThrottling(false) |
167 , m_subtreeThrottled(false) | 167 , m_subtreeThrottled(false) |
168 , m_currentUpdateLifecyclePhasesTargetState(DocumentLifecycle::Uninitialized ) | 168 , m_currentUpdateLifecyclePhasesTargetState(DocumentLifecycle::Uninitialized ) |
169 , m_needsScrollbarsUpdate(false) | 169 , m_needsScrollbarsUpdate(false) |
170 , m_suppressAdjustViewSize(false) | 170 , m_suppressAdjustViewSize(false) |
171 , m_allowsLayoutInvalidationAfterLayoutClean(true) | 171 , m_allowsLayoutInvalidationAfterLayoutClean(true) |
172 { | 172 { |
173 ASSERT(m_frame); | 173 DCHECK(m_frame); |
174 init(); | 174 init(); |
175 } | 175 } |
176 | 176 |
177 FrameView* FrameView::create(LocalFrame* frame) | 177 FrameView* FrameView::create(LocalFrame* frame) |
178 { | 178 { |
179 FrameView* view = new FrameView(frame); | 179 FrameView* view = new FrameView(frame); |
180 view->show(); | 180 view->show(); |
181 return view; | 181 return view; |
182 } | 182 } |
183 | 183 |
184 FrameView* FrameView::create(LocalFrame* frame, const IntSize& initialSize) | 184 FrameView* FrameView::create(LocalFrame* frame, const IntSize& initialSize) |
185 { | 185 { |
186 FrameView* view = new FrameView(frame); | 186 FrameView* view = new FrameView(frame); |
187 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); | 187 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); |
188 view->setLayoutSizeInternal(initialSize); | 188 view->setLayoutSizeInternal(initialSize); |
189 | 189 |
190 view->show(); | 190 view->show(); |
191 return view; | 191 return view; |
192 } | 192 } |
193 | 193 |
194 FrameView::~FrameView() | 194 FrameView::~FrameView() |
195 { | 195 { |
196 ASSERT(m_hasBeenDisposed); | 196 #if ENABLE(ASSERT) |
197 DCHECK(m_hasBeenDisposed); | |
198 #endif | |
197 } | 199 } |
198 | 200 |
199 DEFINE_TRACE(FrameView) | 201 DEFINE_TRACE(FrameView) |
200 { | 202 { |
201 visitor->trace(m_frame); | 203 visitor->trace(m_frame); |
202 visitor->trace(m_fragmentAnchor); | 204 visitor->trace(m_fragmentAnchor); |
203 visitor->trace(m_scrollableAreas); | 205 visitor->trace(m_scrollableAreas); |
204 visitor->trace(m_animatingScrollableAreas); | 206 visitor->trace(m_animatingScrollableAreas); |
205 visitor->trace(m_autoSizeInfo); | 207 visitor->trace(m_autoSizeInfo); |
206 visitor->trace(m_horizontalScrollbar); | 208 visitor->trace(m_horizontalScrollbar); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
259 | 261 |
260 m_size = LayoutSize(); | 262 m_size = LayoutSize(); |
261 | 263 |
262 // Propagate the marginwidth/height and scrolling modes to the view. | 264 // Propagate the marginwidth/height and scrolling modes to the view. |
263 if (m_frame->owner() && m_frame->owner()->scrollingMode() == ScrollbarAlways Off) | 265 if (m_frame->owner() && m_frame->owner()->scrollingMode() == ScrollbarAlways Off) |
264 setCanHaveScrollbars(false); | 266 setCanHaveScrollbars(false); |
265 } | 267 } |
266 | 268 |
267 void FrameView::dispose() | 269 void FrameView::dispose() |
268 { | 270 { |
269 RELEASE_ASSERT(!isInPerformLayout()); | 271 CHECK(!isInPerformLayout()); |
270 | 272 |
271 if (ScrollAnimatorBase* scrollAnimator = existingScrollAnimator()) | 273 if (ScrollAnimatorBase* scrollAnimator = existingScrollAnimator()) |
272 scrollAnimator->cancelAnimation(); | 274 scrollAnimator->cancelAnimation(); |
273 cancelProgrammaticScrollAnimation(); | 275 cancelProgrammaticScrollAnimation(); |
274 | 276 |
275 detachScrollbars(); | 277 detachScrollbars(); |
276 | 278 |
277 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) | 279 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) |
278 scrollingCoordinator->willDestroyScrollableArea(this); | 280 scrollingCoordinator->willDestroyScrollableArea(this); |
279 | 281 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
531 | 533 |
532 void FrameView::adjustViewSize() | 534 void FrameView::adjustViewSize() |
533 { | 535 { |
534 if (m_suppressAdjustViewSize) | 536 if (m_suppressAdjustViewSize) |
535 return; | 537 return; |
536 | 538 |
537 LayoutViewItem layoutViewItem = this->layoutViewItem(); | 539 LayoutViewItem layoutViewItem = this->layoutViewItem(); |
538 if (layoutViewItem.isNull()) | 540 if (layoutViewItem.isNull()) |
539 return; | 541 return; |
540 | 542 |
541 ASSERT(m_frame->view() == this); | 543 DCHECK(m_frame->view() == this); |
542 | 544 |
543 const IntRect rect = layoutViewItem.documentRect(); | 545 const IntRect rect = layoutViewItem.documentRect(); |
544 const IntSize& size = rect.size(); | 546 const IntSize& size = rect.size(); |
545 | 547 |
546 const IntPoint origin(-rect.x(), -rect.y()); | 548 const IntPoint origin(-rect.x(), -rect.y()); |
547 if (scrollOrigin() != origin) { | 549 if (scrollOrigin() != origin) { |
548 ScrollableArea::setScrollOrigin(origin); | 550 ScrollableArea::setScrollOrigin(origin); |
549 // setContentSize (below) also calls updateScrollbars so we can avoid | 551 // setContentSize (below) also calls updateScrollbars so we can avoid |
550 // updating scrollbars twice by skipping the call here when the content | 552 // updating scrollbars twice by skipping the call here when the content |
551 // size does not change. | 553 // size does not change. |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
630 | 632 |
631 void FrameView::updateAcceleratedCompositingSettings() | 633 void FrameView::updateAcceleratedCompositingSettings() |
632 { | 634 { |
633 if (LayoutViewItem layoutViewItem = this->layoutViewItem()) | 635 if (LayoutViewItem layoutViewItem = this->layoutViewItem()) |
634 layoutViewItem.compositor()->updateAcceleratedCompositingSettings(); | 636 layoutViewItem.compositor()->updateAcceleratedCompositingSettings(); |
635 } | 637 } |
636 | 638 |
637 void FrameView::recalcOverflowAfterStyleChange() | 639 void FrameView::recalcOverflowAfterStyleChange() |
638 { | 640 { |
639 LayoutViewItem layoutViewItem = this->layoutViewItem(); | 641 LayoutViewItem layoutViewItem = this->layoutViewItem(); |
640 RELEASE_ASSERT(!layoutViewItem.isNull()); | 642 CHECK(!layoutViewItem.isNull()); |
641 if (!layoutViewItem.needsOverflowRecalcAfterStyleChange()) | 643 if (!layoutViewItem.needsOverflowRecalcAfterStyleChange()) |
642 return; | 644 return; |
643 | 645 |
644 layoutViewItem.recalcOverflowAfterStyleChange(); | 646 layoutViewItem.recalcOverflowAfterStyleChange(); |
645 | 647 |
646 // Changing overflow should notify scrolling coordinator to ensures that it | 648 // Changing overflow should notify scrolling coordinator to ensures that it |
647 // updates non-fast scroll rects even if there is no layout. | 649 // updates non-fast scroll rects even if there is no layout. |
648 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) | 650 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) |
649 scrollingCoordinator->notifyOverflowUpdated(); | 651 scrollingCoordinator->notifyOverflowUpdated(); |
650 | 652 |
(...skipping 27 matching lines...) Expand all Loading... | |
678 | 680 |
679 if (scrollOriginChanged()) | 681 if (scrollOriginChanged()) |
680 setNeedsLayout(); | 682 setNeedsLayout(); |
681 } | 683 } |
682 | 684 |
683 bool FrameView::usesCompositedScrolling() const | 685 bool FrameView::usesCompositedScrolling() const |
684 { | 686 { |
685 LayoutViewItem layoutView = this->layoutViewItem(); | 687 LayoutViewItem layoutView = this->layoutViewItem(); |
686 if (layoutView.isNull()) | 688 if (layoutView.isNull()) |
687 return false; | 689 return false; |
688 if (m_frame->settings() && m_frame->settings()->preferCompositingToLCDTextEn abled()) | 690 if (layoutView.layer()->needsCompositedScrolling()) |
chrishtr
2016/07/27 19:26:00
I don't think this will work, because the view is
Stephen Chennney
2016/07/28 13:55:38
Done.
| |
689 return layoutView.compositor()->inCompositingMode(); | 691 return layoutView.compositor()->inCompositingMode(); |
690 return false; | 692 return false; |
691 } | 693 } |
692 | 694 |
693 bool FrameView::shouldScrollOnMainThread() const | 695 bool FrameView::shouldScrollOnMainThread() const |
694 { | 696 { |
695 if (ScrollingCoordinator* sc = scrollingCoordinator()) { | 697 if (ScrollingCoordinator* sc = scrollingCoordinator()) { |
696 if (sc->shouldUpdateScrollLayerPositionOnMainThread()) | 698 if (sc->shouldUpdateScrollLayerPositionOnMainThread()) |
697 return true; | 699 return true; |
698 } | 700 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
771 // bothering to lay out the SVG document, mark the ownerLayoutObject needing layout and ask its | 773 // bothering to lay out the SVG document, mark the ownerLayoutObject needing layout and ask its |
772 // FrameView for a layout. After that the LayoutEmbeddedObject (ownerLayoutO bject) carries the | 774 // FrameView for a layout. After that the LayoutEmbeddedObject (ownerLayoutO bject) carries the |
773 // correct size, which LayoutSVGRoot::computeReplacedLogicalWidth/Height rel y on, when laying | 775 // correct size, which LayoutSVGRoot::computeReplacedLogicalWidth/Height rel y on, when laying |
774 // out for the first time, or when the LayoutSVGRoot size has changed dynami cally (eg. via <script>). | 776 // out for the first time, or when the LayoutSVGRoot size has changed dynami cally (eg. via <script>). |
775 FrameView* frameView = ownerLayoutObject->frame()->view(); | 777 FrameView* frameView = ownerLayoutObject->frame()->view(); |
776 | 778 |
777 // Mark the owner layoutObject as needing layout. | 779 // Mark the owner layoutObject as needing layout. |
778 ownerLayoutObject->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation (LayoutInvalidationReason::Unknown); | 780 ownerLayoutObject->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation (LayoutInvalidationReason::Unknown); |
779 | 781 |
780 // Synchronously enter layout, to layout the view containing the host object /embed/iframe. | 782 // Synchronously enter layout, to layout the view containing the host object /embed/iframe. |
781 ASSERT(frameView); | 783 DCHECK(frameView); |
782 frameView->layout(); | 784 frameView->layout(); |
783 } | 785 } |
784 | 786 |
785 void FrameView::performPreLayoutTasks() | 787 void FrameView::performPreLayoutTasks() |
786 { | 788 { |
787 TRACE_EVENT0("blink,benchmark", "FrameView::performPreLayoutTasks"); | 789 TRACE_EVENT0("blink,benchmark", "FrameView::performPreLayoutTasks"); |
788 lifecycle().advanceTo(DocumentLifecycle::InPreLayout); | 790 lifecycle().advanceTo(DocumentLifecycle::InPreLayout); |
789 | 791 |
790 // Don't schedule more layouts, we're in one. | 792 // Don't schedule more layouts, we're in one. |
791 AutoReset<bool> changeSchedulingEnabled(&m_layoutSchedulingEnabled, false); | 793 AutoReset<bool> changeSchedulingEnabled(&m_layoutSchedulingEnabled, false); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
865 value->setInteger("contentsHeightAfterLayout", layoutViewItem().documentRect ().height()); | 867 value->setInteger("contentsHeightAfterLayout", layoutViewItem().documentRect ().height()); |
866 value->setInteger("visibleHeight", visibleHeight()); | 868 value->setInteger("visibleHeight", visibleHeight()); |
867 value->setInteger("approximateBlankCharacterCount", FontFaceSet::approximate BlankCharacterCount(*m_frame->document())); | 869 value->setInteger("approximateBlankCharacterCount", FontFaceSet::approximate BlankCharacterCount(*m_frame->document())); |
868 return value; | 870 return value; |
869 } | 871 } |
870 | 872 |
871 #define PERFORM_LAYOUT_TRACE_CATEGORIES "blink,benchmark," TRACE_DISABLED_BY_DEF AULT("blink.debug.layout") | 873 #define PERFORM_LAYOUT_TRACE_CATEGORIES "blink,benchmark," TRACE_DISABLED_BY_DEF AULT("blink.debug.layout") |
872 | 874 |
873 void FrameView::performLayout(bool inSubtreeLayout) | 875 void FrameView::performLayout(bool inSubtreeLayout) |
874 { | 876 { |
875 ASSERT(inSubtreeLayout || m_layoutSubtreeRootList.isEmpty()); | 877 DCHECK(inSubtreeLayout || m_layoutSubtreeRootList.isEmpty()); |
876 | 878 |
877 TRACE_EVENT_BEGIN1(PERFORM_LAYOUT_TRACE_CATEGORIES, "FrameView::performLayou t", | 879 TRACE_EVENT_BEGIN1(PERFORM_LAYOUT_TRACE_CATEGORIES, "FrameView::performLayou t", |
878 "contentsHeightBeforeLayout", layoutViewItem().documentRect().height()); | 880 "contentsHeightBeforeLayout", layoutViewItem().documentRect().height()); |
879 prepareLayoutAnalyzer(); | 881 prepareLayoutAnalyzer(); |
880 | 882 |
881 ScriptForbiddenScope forbidScript; | 883 ScriptForbiddenScope forbidScript; |
882 | 884 |
883 ASSERT(!isInPerformLayout()); | 885 DCHECK(!isInPerformLayout()); |
884 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); | 886 lifecycle().advanceTo(DocumentLifecycle::InPerformLayout); |
885 | 887 |
886 // performLayout is the actual guts of layout(). | 888 // performLayout is the actual guts of layout(). |
887 // FIXME: The 300 other lines in layout() probably belong in other helper fu nctions | 889 // FIXME: The 300 other lines in layout() probably belong in other helper fu nctions |
888 // so that a single human could understand what layout() is actually doing. | 890 // so that a single human could understand what layout() is actually doing. |
889 | 891 |
890 forceLayoutParentViewIfNeeded(); | 892 forceLayoutParentViewIfNeeded(); |
891 | 893 |
892 if (hasOrthogonalWritingModeRoots()) | 894 if (hasOrthogonalWritingModeRoots()) |
893 layoutOrthogonalWritingModeRoots(); | 895 layoutOrthogonalWritingModeRoots(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
938 // we call it through the timer here. | 940 // we call it through the timer here. |
939 m_postLayoutTasksTimer.startOneShot(0, BLINK_FROM_HERE); | 941 m_postLayoutTasksTimer.startOneShot(0, BLINK_FROM_HERE); |
940 if (needsLayout()) | 942 if (needsLayout()) |
941 layout(); | 943 layout(); |
942 } | 944 } |
943 } | 945 } |
944 | 946 |
945 void FrameView::layout() | 947 void FrameView::layout() |
946 { | 948 { |
947 // We should never layout a Document which is not in a LocalFrame. | 949 // We should never layout a Document which is not in a LocalFrame. |
948 ASSERT(m_frame); | 950 DCHECK(m_frame); |
949 ASSERT(m_frame->view() == this); | 951 DCHECK(m_frame->view() == this); |
950 ASSERT(m_frame->page()); | 952 DCHECK(m_frame->page()); |
951 | 953 |
952 ScriptForbiddenScope forbidScript; | 954 ScriptForbiddenScope forbidScript; |
953 | 955 |
954 if (isInPerformLayout() || shouldThrottleRendering() || !m_frame->document() ->isActive()) | 956 if (isInPerformLayout() || shouldThrottleRendering() || !m_frame->document() ->isActive()) |
955 return; | 957 return; |
956 | 958 |
957 TRACE_EVENT0("blink,benchmark", "FrameView::layout"); | 959 TRACE_EVENT0("blink,benchmark", "FrameView::layout"); |
958 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); | 960 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); |
959 | 961 |
960 if (m_autoSizeInfo) | 962 if (m_autoSizeInfo) |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1054 } | 1056 } |
1055 | 1057 |
1056 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink.deb ug.layout.trees"), "LayoutTree", | 1058 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink.deb ug.layout.trees"), "LayoutTree", |
1057 this, TracedLayoutObject::create(*layoutView(), false)); | 1059 this, TracedLayoutObject::create(*layoutView(), false)); |
1058 | 1060 |
1059 performLayout(inSubtreeLayout); | 1061 performLayout(inSubtreeLayout); |
1060 | 1062 |
1061 if (!inSubtreeLayout && !document->printing()) | 1063 if (!inSubtreeLayout && !document->printing()) |
1062 adjustViewSizeAndLayout(); | 1064 adjustViewSizeAndLayout(); |
1063 | 1065 |
1064 ASSERT(m_layoutSubtreeRootList.isEmpty()); | 1066 DCHECK(m_layoutSubtreeRootList.isEmpty()); |
1065 } // Reset m_layoutSchedulingEnabled to its previous value. | 1067 } // Reset m_layoutSchedulingEnabled to its previous value. |
1066 checkDoesNotNeedLayout(); | 1068 checkDoesNotNeedLayout(); |
1067 | 1069 |
1068 m_frameTimingRequestsDirty = true; | 1070 m_frameTimingRequestsDirty = true; |
1069 | 1071 |
1070 // FIXME: Could find the common ancestor layer of all dirty subtrees and mar k from there. crbug.com/462719 | 1072 // FIXME: Could find the common ancestor layer of all dirty subtrees and mar k from there. crbug.com/462719 |
1071 layoutViewItem().enclosingLayer()->updateLayerPositionsAfterLayout(); | 1073 layoutViewItem().enclosingLayer()->updateLayerPositionsAfterLayout(); |
1072 | 1074 |
1073 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink.debug.l ayout.trees"), "LayoutTree", | 1075 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink.debug.l ayout.trees"), "LayoutTree", |
1074 this, TracedLayoutObject::create(*layoutView(), true)); | 1076 this, TracedLayoutObject::create(*layoutView(), true)); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1107 | 1109 |
1108 void FrameView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInvali dationState) | 1110 void FrameView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInvali dationState) |
1109 { | 1111 { |
1110 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); | 1112 DCHECK(!RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); |
1111 | 1113 |
1112 if (shouldThrottleRendering()) | 1114 if (shouldThrottleRendering()) |
1113 return; | 1115 return; |
1114 | 1116 |
1115 lifecycle().advanceTo(DocumentLifecycle::InPaintInvalidation); | 1117 lifecycle().advanceTo(DocumentLifecycle::InPaintInvalidation); |
1116 | 1118 |
1117 RELEASE_ASSERT(!layoutViewItem().isNull()); | 1119 CHECK(!layoutViewItem().isNull()); |
1118 LayoutViewItem rootForPaintInvalidation = layoutViewItem(); | 1120 LayoutViewItem rootForPaintInvalidation = layoutViewItem(); |
1119 ASSERT(!rootForPaintInvalidation.needsLayout()); | 1121 DCHECK(!rootForPaintInvalidation.needsLayout()); |
1120 | 1122 |
1121 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation.debugName().ascii()); | 1123 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval idation.debugName().ascii()); |
1122 | 1124 |
1123 rootForPaintInvalidation.invalidateTreeIfNeeded(paintInvalidationState); | 1125 rootForPaintInvalidation.invalidateTreeIfNeeded(paintInvalidationState); |
1124 invalidatePaintIfNeeded(paintInvalidationState); | 1126 invalidatePaintIfNeeded(paintInvalidationState); |
1125 | 1127 |
1126 #if ENABLE(ASSERT) | 1128 #if ENABLE(ASSERT) |
1127 layoutView()->assertSubtreeClearedPaintInvalidationFlags(); | 1129 layoutView()->assertSubtreeClearedPaintInvalidationFlags(); |
1128 #endif | 1130 #endif |
1129 | 1131 |
1130 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); | 1132 lifecycle().advanceTo(DocumentLifecycle::PaintInvalidationClean); |
1131 } | 1133 } |
1132 | 1134 |
1133 void FrameView::invalidatePaintIfNeeded(const PaintInvalidationState& paintInval idationState) | 1135 void FrameView::invalidatePaintIfNeeded(const PaintInvalidationState& paintInval idationState) |
1134 { | 1136 { |
1135 RELEASE_ASSERT(!layoutViewItem().isNull()); | 1137 CHECK(!layoutViewItem().isNull()); |
1136 if (!m_frame->settings() || !m_frame->settings()->rootLayerScrolls()) | 1138 if (!m_frame->settings() || !m_frame->settings()->rootLayerScrolls()) |
1137 invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState); | 1139 invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState); |
1138 | 1140 |
1139 if (m_frame->selection().isCaretBoundsDirty()) | 1141 if (m_frame->selection().isCaretBoundsDirty()) |
1140 m_frame->selection().invalidateCaretRect(); | 1142 m_frame->selection().invalidateCaretRect(); |
1141 | 1143 |
1142 // Temporary callback for crbug.com/487345,402044 | 1144 // Temporary callback for crbug.com/487345,402044 |
1143 // TODO(ojan): Make this more general to be used by PositionObserver | 1145 // TODO(ojan): Make this more general to be used by PositionObserver |
1144 // and rAF throttling. | 1146 // and rAF throttling. |
1145 IntRect visibleRect = rootFrameToContents(computeVisibleArea()); | 1147 IntRect visibleRect = rootFrameToContents(computeVisibleArea()); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1250 frameView->checkDoesNotNeedLayout(); | 1252 frameView->checkDoesNotNeedLayout(); |
1251 } else { | 1253 } else { |
1252 part->updateWidgetGeometry(); | 1254 part->updateWidgetGeometry(); |
1253 } | 1255 } |
1254 } | 1256 } |
1255 } | 1257 } |
1256 } | 1258 } |
1257 | 1259 |
1258 void FrameView::addPartToUpdate(LayoutEmbeddedObject& object) | 1260 void FrameView::addPartToUpdate(LayoutEmbeddedObject& object) |
1259 { | 1261 { |
1260 ASSERT(isInPerformLayout()); | 1262 DCHECK(isInPerformLayout()); |
1261 // Tell the DOM element that it needs a widget update. | 1263 // Tell the DOM element that it needs a widget update. |
1262 Node* node = object.node(); | 1264 Node* node = object.node(); |
1263 ASSERT(node); | 1265 DCHECK(node); |
1264 if (isHTMLObjectElement(*node) || isHTMLEmbedElement(*node)) | 1266 if (isHTMLObjectElement(*node) || isHTMLEmbedElement(*node)) |
1265 toHTMLPlugInElement(node)->setNeedsWidgetUpdate(true); | 1267 toHTMLPlugInElement(node)->setNeedsWidgetUpdate(true); |
1266 | 1268 |
1267 m_partUpdateSet.add(&object); | 1269 m_partUpdateSet.add(&object); |
1268 } | 1270 } |
1269 | 1271 |
1270 void FrameView::setDisplayMode(WebDisplayMode mode) | 1272 void FrameView::setDisplayMode(WebDisplayMode mode) |
1271 { | 1273 { |
1272 if (mode == m_displayMode) | 1274 if (mode == m_displayMode) |
1273 return; | 1275 return; |
1274 | 1276 |
1275 m_displayMode = mode; | 1277 m_displayMode = mode; |
1276 | 1278 |
1277 if (m_frame->document()) | 1279 if (m_frame->document()) |
1278 m_frame->document()->mediaQueryAffectingValueChanged(); | 1280 m_frame->document()->mediaQueryAffectingValueChanged(); |
1279 } | 1281 } |
1280 | 1282 |
1281 void FrameView::setMediaType(const AtomicString& mediaType) | 1283 void FrameView::setMediaType(const AtomicString& mediaType) |
1282 { | 1284 { |
1283 ASSERT(m_frame->document()); | 1285 DCHECK(m_frame->document()); |
1284 m_frame->document()->mediaQueryAffectingValueChanged(); | 1286 m_frame->document()->mediaQueryAffectingValueChanged(); |
1285 m_mediaType = mediaType; | 1287 m_mediaType = mediaType; |
1286 } | 1288 } |
1287 | 1289 |
1288 AtomicString FrameView::mediaType() const | 1290 AtomicString FrameView::mediaType() const |
1289 { | 1291 { |
1290 // See if we have an override type. | 1292 // See if we have an override type. |
1291 if (m_frame->settings() && !m_frame->settings()->mediaTypeOverride().isEmpty ()) | 1293 if (m_frame->settings() && !m_frame->settings()->mediaTypeOverride().isEmpty ()) |
1292 return AtomicString(m_frame->settings()->mediaTypeOverride()); | 1294 return AtomicString(m_frame->settings()->mediaTypeOverride()); |
1293 return m_mediaType; | 1295 return m_mediaType; |
(...skipping 13 matching lines...) Expand all Loading... | |
1307 } | 1309 } |
1308 | 1310 |
1309 bool FrameView::contentsInCompositedLayer() const | 1311 bool FrameView::contentsInCompositedLayer() const |
1310 { | 1312 { |
1311 LayoutViewItem layoutViewItem = this->layoutViewItem(); | 1313 LayoutViewItem layoutViewItem = this->layoutViewItem(); |
1312 return !layoutViewItem.isNull() && layoutViewItem.compositingState() == Pain tsIntoOwnBacking; | 1314 return !layoutViewItem.isNull() && layoutViewItem.compositingState() == Pain tsIntoOwnBacking; |
1313 } | 1315 } |
1314 | 1316 |
1315 void FrameView::addBackgroundAttachmentFixedObject(LayoutObject* object) | 1317 void FrameView::addBackgroundAttachmentFixedObject(LayoutObject* object) |
1316 { | 1318 { |
1317 ASSERT(!m_backgroundAttachmentFixedObjects.contains(object)); | 1319 DCHECK(!m_backgroundAttachmentFixedObjects.contains(object)); |
1318 | 1320 |
1319 m_backgroundAttachmentFixedObjects.add(object); | 1321 m_backgroundAttachmentFixedObjects.add(object); |
1320 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) | 1322 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) |
1321 scrollingCoordinator->frameViewHasBackgroundAttachmentFixedObjectsDidCha nge(this); | 1323 scrollingCoordinator->frameViewHasBackgroundAttachmentFixedObjectsDidCha nge(this); |
1322 } | 1324 } |
1323 | 1325 |
1324 void FrameView::removeBackgroundAttachmentFixedObject(LayoutObject* object) | 1326 void FrameView::removeBackgroundAttachmentFixedObject(LayoutObject* object) |
1325 { | 1327 { |
1326 ASSERT(m_backgroundAttachmentFixedObjects.contains(object)); | 1328 DCHECK(m_backgroundAttachmentFixedObjects.contains(object)); |
1327 | 1329 |
1328 m_backgroundAttachmentFixedObjects.remove(object); | 1330 m_backgroundAttachmentFixedObjects.remove(object); |
1329 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) | 1331 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) |
1330 scrollingCoordinator->frameViewHasBackgroundAttachmentFixedObjectsDidCha nge(this); | 1332 scrollingCoordinator->frameViewHasBackgroundAttachmentFixedObjectsDidCha nge(this); |
1331 } | 1333 } |
1332 | 1334 |
1333 void FrameView::addViewportConstrainedObject(LayoutObject* object) | 1335 void FrameView::addViewportConstrainedObject(LayoutObject* object) |
1334 { | 1336 { |
1335 if (!m_viewportConstrainedObjects) | 1337 if (!m_viewportConstrainedObjects) |
1336 m_viewportConstrainedObjects = wrapUnique(new ViewportConstrainedObjectS et); | 1338 m_viewportConstrainedObjects = wrapUnique(new ViewportConstrainedObjectS et); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1413 for (const auto& layoutObject : m_backgroundAttachmentFixedObjects) | 1415 for (const auto& layoutObject : m_backgroundAttachmentFixedObjects) |
1414 layoutObject->setShouldDoFullPaintInvalidation(); | 1416 layoutObject->setShouldDoFullPaintInvalidation(); |
1415 } | 1417 } |
1416 | 1418 |
1417 bool FrameView::invalidateViewportConstrainedObjects() | 1419 bool FrameView::invalidateViewportConstrainedObjects() |
1418 { | 1420 { |
1419 bool fastPathAllowed = true; | 1421 bool fastPathAllowed = true; |
1420 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { | 1422 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects) { |
1421 LayoutObject* layoutObject = viewportConstrainedObject; | 1423 LayoutObject* layoutObject = viewportConstrainedObject; |
1422 LayoutItem layoutItem = LayoutItem(layoutObject); | 1424 LayoutItem layoutItem = LayoutItem(layoutObject); |
1423 ASSERT(layoutItem.style()->hasViewportConstrainedPosition()); | 1425 DCHECK(layoutItem.style()->hasViewportConstrainedPosition()); |
1424 ASSERT(layoutItem.hasLayer()); | 1426 DCHECK(layoutItem.hasLayer()); |
1425 PaintLayer* layer = LayoutBoxModel(layoutItem).layer(); | 1427 PaintLayer* layer = LayoutBoxModel(layoutItem).layer(); |
1426 | 1428 |
1427 if (layer->isPaintInvalidationContainer()) | 1429 if (layer->isPaintInvalidationContainer()) |
1428 continue; | 1430 continue; |
1429 | 1431 |
1430 if (layer->subtreeIsInvisible()) | 1432 if (layer->subtreeIsInvisible()) |
1431 continue; | 1433 continue; |
1432 | 1434 |
1433 // invalidate even if there is an ancestor with a filter that moves pixe ls. | 1435 // invalidate even if there is an ancestor with a filter that moves pixe ls. |
1434 layoutItem.setShouldDoFullPaintInvalidationIncludingNonCompositingDescen dants(); | 1436 layoutItem.setShouldDoFullPaintInvalidationIncludingNonCompositingDescen dants(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1466 InspectorInstrumentation::didUpdateLayout(m_frame.get()); | 1468 InspectorInstrumentation::didUpdateLayout(m_frame.get()); |
1467 return true; | 1469 return true; |
1468 } | 1470 } |
1469 | 1471 |
1470 void FrameView::scrollContentsSlowPath(const IntRect& updateRect) | 1472 void FrameView::scrollContentsSlowPath(const IntRect& updateRect) |
1471 { | 1473 { |
1472 TRACE_EVENT0("blink", "FrameView::scrollContentsSlowPath"); | 1474 TRACE_EVENT0("blink", "FrameView::scrollContentsSlowPath"); |
1473 // We need full invalidation during slow scrolling. For slimming paint, full invalidation | 1475 // We need full invalidation during slow scrolling. For slimming paint, full invalidation |
1474 // of the LayoutView is not enough. We also need to invalidate all of the ob jects. | 1476 // of the LayoutView is not enough. We also need to invalidate all of the ob jects. |
1475 // FIXME: Find out what are enough to invalidate in slow path scrolling. crb ug.com/451090#9. | 1477 // FIXME: Find out what are enough to invalidate in slow path scrolling. crb ug.com/451090#9. |
1476 ASSERT(!layoutViewItem().isNull()); | 1478 DCHECK(!layoutViewItem().isNull()); |
1477 if (contentsInCompositedLayer()) | 1479 if (contentsInCompositedLayer()) |
1478 layoutViewItem().layer()->compositedLayerMapping()->setContentsNeedDispl ay(); | 1480 layoutViewItem().layer()->compositedLayerMapping()->setContentsNeedDispl ay(); |
1479 else | 1481 else |
1480 layoutViewItem().setShouldDoFullPaintInvalidationIncludingNonCompositing Descendants(); | 1482 layoutViewItem().setShouldDoFullPaintInvalidationIncludingNonCompositing Descendants(); |
1481 | 1483 |
1482 | 1484 |
1483 if (contentsInCompositedLayer()) { | 1485 if (contentsInCompositedLayer()) { |
1484 IntRect updateRect = visibleContentRect(); | 1486 IntRect updateRect = visibleContentRect(); |
1485 ASSERT(!layoutViewItem().isNull()); | 1487 DCHECK(!layoutViewItem().isNull()); |
1486 // FIXME: We should not allow paint invalidation out of paint invalidati on state. crbug.com/457415 | 1488 // FIXME: We should not allow paint invalidation out of paint invalidati on state. crbug.com/457415 |
1487 DisablePaintInvalidationStateAsserts disabler; | 1489 DisablePaintInvalidationStateAsserts disabler; |
1488 layoutViewItem().invalidatePaintRectangle(LayoutRect(updateRect)); | 1490 layoutViewItem().invalidatePaintRectangle(LayoutRect(updateRect)); |
1489 } | 1491 } |
1490 if (LayoutPart* frameLayoutObject = m_frame->ownerLayoutObject()) { | 1492 if (LayoutPart* frameLayoutObject = m_frame->ownerLayoutObject()) { |
1491 if (isEnclosedInCompositingLayer()) { | 1493 if (isEnclosedInCompositingLayer()) { |
1492 LayoutRect rect(frameLayoutObject->borderLeft() + frameLayoutObject- >paddingLeft(), | 1494 LayoutRect rect(frameLayoutObject->borderLeft() + frameLayoutObject- >paddingLeft(), |
1493 frameLayoutObject->borderTop() + frameLayoutObject->paddingTop() , | 1495 frameLayoutObject->borderTop() + frameLayoutObject->paddingTop() , |
1494 LayoutUnit(visibleWidth()), LayoutUnit(visibleHeight())); | 1496 LayoutUnit(visibleWidth()), LayoutUnit(visibleHeight())); |
1495 // FIXME: We should not allow paint invalidation out of paint invali dation state. crbug.com/457415 | 1497 // FIXME: We should not allow paint invalidation out of paint invali dation state. crbug.com/457415 |
(...skipping 27 matching lines...) Expand all Loading... | |
1523 return; | 1525 return; |
1524 | 1526 |
1525 // Try again after decoding the ref, based on the document's encoding. | 1527 // Try again after decoding the ref, based on the document's encoding. |
1526 if (m_frame->document()->encoding().isValid()) | 1528 if (m_frame->document()->encoding().isValid()) |
1527 processUrlFragmentHelper(decodeURLEscapeSequences(fragmentIdentifier, m_ frame->document()->encoding()), behavior); | 1529 processUrlFragmentHelper(decodeURLEscapeSequences(fragmentIdentifier, m_ frame->document()->encoding()), behavior); |
1528 | 1530 |
1529 } | 1531 } |
1530 | 1532 |
1531 bool FrameView::processUrlFragmentHelper(const String& name, UrlFragmentBehavior behavior) | 1533 bool FrameView::processUrlFragmentHelper(const String& name, UrlFragmentBehavior behavior) |
1532 { | 1534 { |
1533 ASSERT(m_frame->document()); | 1535 DCHECK(m_frame->document()); |
1534 | 1536 |
1535 if (behavior == UrlFragmentScroll && !m_frame->document()->isRenderingReady( )) { | 1537 if (behavior == UrlFragmentScroll && !m_frame->document()->isRenderingReady( )) { |
1536 m_frame->document()->setGotoAnchorNeededAfterStylesheetsLoad(true); | 1538 m_frame->document()->setGotoAnchorNeededAfterStylesheetsLoad(true); |
1537 return false; | 1539 return false; |
1538 } | 1540 } |
1539 | 1541 |
1540 m_frame->document()->setGotoAnchorNeededAfterStylesheetsLoad(false); | 1542 m_frame->document()->setGotoAnchorNeededAfterStylesheetsLoad(false); |
1541 | 1543 |
1542 Element* anchorNode = m_frame->document()->findAnchor(name); | 1544 Element* anchorNode = m_frame->document()->findAnchor(name); |
1543 | 1545 |
(...skipping 27 matching lines...) Expand all Loading... | |
1571 if (behavior == UrlFragmentScroll) | 1573 if (behavior == UrlFragmentScroll) |
1572 m_frame->document()->setSequentialFocusNavigationStartingPoint(a nchorNode); | 1574 m_frame->document()->setSequentialFocusNavigationStartingPoint(a nchorNode); |
1573 m_frame->document()->clearFocusedElement(); | 1575 m_frame->document()->clearFocusedElement(); |
1574 } | 1576 } |
1575 } | 1577 } |
1576 return true; | 1578 return true; |
1577 } | 1579 } |
1578 | 1580 |
1579 void FrameView::setFragmentAnchor(Node* anchorNode) | 1581 void FrameView::setFragmentAnchor(Node* anchorNode) |
1580 { | 1582 { |
1581 ASSERT(anchorNode); | 1583 DCHECK(anchorNode); |
1582 m_fragmentAnchor = anchorNode; | 1584 m_fragmentAnchor = anchorNode; |
1583 | 1585 |
1584 // We need to update the layout tree before scrolling. | 1586 // We need to update the layout tree before scrolling. |
1585 m_frame->document()->updateStyleAndLayoutTree(); | 1587 m_frame->document()->updateStyleAndLayoutTree(); |
1586 | 1588 |
1587 // If layout is needed, we will scroll in performPostLayoutTasks. Otherwise, scroll immediately. | 1589 // If layout is needed, we will scroll in performPostLayoutTasks. Otherwise, scroll immediately. |
1588 LayoutViewItem layoutViewItem = this->layoutViewItem(); | 1590 LayoutViewItem layoutViewItem = this->layoutViewItem(); |
1589 if (!layoutViewItem.isNull() && layoutViewItem.needsLayout()) | 1591 if (!layoutViewItem.isNull() && layoutViewItem.needsLayout()) |
1590 layout(); | 1592 layout(); |
1591 else | 1593 else |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1633 } | 1635 } |
1634 } | 1636 } |
1635 | 1637 |
1636 IntSize FrameView::layoutSize(IncludeScrollbarsInRect scrollbarInclusion) const | 1638 IntSize FrameView::layoutSize(IncludeScrollbarsInRect scrollbarInclusion) const |
1637 { | 1639 { |
1638 return scrollbarInclusion == ExcludeScrollbars ? excludeScrollbars(m_layoutS ize) : m_layoutSize; | 1640 return scrollbarInclusion == ExcludeScrollbars ? excludeScrollbars(m_layoutS ize) : m_layoutSize; |
1639 } | 1641 } |
1640 | 1642 |
1641 void FrameView::setLayoutSize(const IntSize& size) | 1643 void FrameView::setLayoutSize(const IntSize& size) |
1642 { | 1644 { |
1643 ASSERT(!layoutSizeFixedToFrameSize()); | 1645 DCHECK(!layoutSizeFixedToFrameSize()); |
1644 | 1646 |
1645 setLayoutSizeInternal(size); | 1647 setLayoutSizeInternal(size); |
1646 } | 1648 } |
1647 | 1649 |
1648 void FrameView::didScrollTimerFired(Timer<FrameView>*) | 1650 void FrameView::didScrollTimerFired(Timer<FrameView>*) |
1649 { | 1651 { |
1650 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull()) | 1652 if (m_frame->document() && !m_frame->document()->layoutViewItem().isNull()) |
1651 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); | 1653 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); |
1652 } | 1654 } |
1653 | 1655 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1719 } | 1721 } |
1720 | 1722 |
1721 void FrameView::updateCompositedSelectionIfNeeded() | 1723 void FrameView::updateCompositedSelectionIfNeeded() |
1722 { | 1724 { |
1723 if (!RuntimeEnabledFeatures::compositedSelectionUpdateEnabled()) | 1725 if (!RuntimeEnabledFeatures::compositedSelectionUpdateEnabled()) |
1724 return; | 1726 return; |
1725 | 1727 |
1726 TRACE_EVENT0("blink", "FrameView::updateCompositedSelectionIfNeeded"); | 1728 TRACE_EVENT0("blink", "FrameView::updateCompositedSelectionIfNeeded"); |
1727 | 1729 |
1728 Page* page = frame().page(); | 1730 Page* page = frame().page(); |
1729 ASSERT(page); | 1731 DCHECK(page); |
1730 | 1732 |
1731 CompositedSelection selection; | 1733 CompositedSelection selection; |
1732 LocalFrame* focusedFrame = page->focusController().focusedFrame(); | 1734 LocalFrame* focusedFrame = page->focusController().focusedFrame(); |
1733 LocalFrame* localFrame = (focusedFrame && (focusedFrame->localFrameRoot() == m_frame->localFrameRoot())) ? focusedFrame : nullptr; | 1735 LocalFrame* localFrame = (focusedFrame && (focusedFrame->localFrameRoot() == m_frame->localFrameRoot())) ? focusedFrame : nullptr; |
1734 if (!localFrame || !computeCompositedSelection(*localFrame, selection)) { | 1736 if (!localFrame || !computeCompositedSelection(*localFrame, selection)) { |
1735 page->chromeClient().clearCompositedSelection(); | 1737 page->chromeClient().clearCompositedSelection(); |
1736 return; | 1738 return; |
1737 } | 1739 } |
1738 | 1740 |
1739 page->chromeClient().updateCompositedSelection(selection); | 1741 page->chromeClient().updateCompositedSelection(selection); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1817 } | 1819 } |
1818 | 1820 |
1819 bool FrameView::hasOrthogonalWritingModeRoots() const | 1821 bool FrameView::hasOrthogonalWritingModeRoots() const |
1820 { | 1822 { |
1821 return !m_orthogonalWritingModeRootList.isEmpty(); | 1823 return !m_orthogonalWritingModeRootList.isEmpty(); |
1822 } | 1824 } |
1823 | 1825 |
1824 void FrameView::layoutOrthogonalWritingModeRoots() | 1826 void FrameView::layoutOrthogonalWritingModeRoots() |
1825 { | 1827 { |
1826 for (auto& root : m_orthogonalWritingModeRootList.ordered()) { | 1828 for (auto& root : m_orthogonalWritingModeRootList.ordered()) { |
1827 ASSERT(root->isBox() && toLayoutBox(*root).isOrthogonalWritingModeRoot() ); | 1829 DCHECK(root->isBox() && toLayoutBox(*root).isOrthogonalWritingModeRoot() ); |
1828 if (!root->needsLayout() | 1830 if (!root->needsLayout() |
1829 || root->isOutOfFlowPositioned() | 1831 || root->isOutOfFlowPositioned() |
1830 || root->isColumnSpanAll() | 1832 || root->isColumnSpanAll() |
1831 || !root->styleRef().logicalHeight().isIntrinsicOrAuto()) { | 1833 || !root->styleRef().logicalHeight().isIntrinsicOrAuto()) { |
1832 continue; | 1834 continue; |
1833 } | 1835 } |
1834 LayoutState layoutState(*root); | 1836 LayoutState layoutState(*root); |
1835 root->layout(); | 1837 root->layout(); |
1836 } | 1838 } |
1837 } | 1839 } |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2027 // The fragment anchor should only be maintained while the frame is still lo ading. | 2029 // The fragment anchor should only be maintained while the frame is still lo ading. |
2028 // If the frame is done loading, clear the anchor now. Otherwise, restore it | 2030 // If the frame is done loading, clear the anchor now. Otherwise, restore it |
2029 // since it may have been cleared during scrollRectToVisible. | 2031 // since it may have been cleared during scrollRectToVisible. |
2030 m_fragmentAnchor = m_frame->document()->isLoadCompleted() ? nullptr : anchor Node; | 2032 m_fragmentAnchor = m_frame->document()->isLoadCompleted() ? nullptr : anchor Node; |
2031 } | 2033 } |
2032 | 2034 |
2033 bool FrameView::updateWidgets() | 2035 bool FrameView::updateWidgets() |
2034 { | 2036 { |
2035 // This is always called from updateWidgetsTimerFired. | 2037 // This is always called from updateWidgetsTimerFired. |
2036 // m_updateWidgetsTimer should only be scheduled if we have widgets to updat e. | 2038 // m_updateWidgetsTimer should only be scheduled if we have widgets to updat e. |
2037 // Thus I believe we can stop checking isEmpty here, and just ASSERT isEmpty : | 2039 // Thus I believe we can stop checking isEmpty here, and just DCHECK isEmpty : |
2038 // FIXME: This assert has been temporarily removed due to https://crbug.com/ 430344 | 2040 // FIXME: This assert has been temporarily removed due to https://crbug.com/ 430344 |
2039 if (m_nestedLayoutCount > 1 || m_partUpdateSet.isEmpty()) | 2041 if (m_nestedLayoutCount > 1 || m_partUpdateSet.isEmpty()) |
2040 return true; | 2042 return true; |
2041 | 2043 |
2042 // Need to swap because script will run inside the below loop and invalidate the iterator. | 2044 // Need to swap because script will run inside the below loop and invalidate the iterator. |
2043 EmbeddedObjectSet objects; | 2045 EmbeddedObjectSet objects; |
2044 objects.swap(m_partUpdateSet); | 2046 objects.swap(m_partUpdateSet); |
2045 | 2047 |
2046 for (const auto& embeddedObject : objects) { | 2048 for (const auto& embeddedObject : objects) { |
2047 LayoutEmbeddedObject& object = *embeddedObject; | 2049 LayoutEmbeddedObject& object = *embeddedObject; |
(...skipping 15 matching lines...) Expand all Loading... | |
2063 // Prevent plugins from causing infinite updates of themselves. | 2065 // Prevent plugins from causing infinite updates of themselves. |
2064 // FIXME: Do we really need to prevent this? | 2066 // FIXME: Do we really need to prevent this? |
2065 m_partUpdateSet.remove(&object); | 2067 m_partUpdateSet.remove(&object); |
2066 } | 2068 } |
2067 | 2069 |
2068 return m_partUpdateSet.isEmpty(); | 2070 return m_partUpdateSet.isEmpty(); |
2069 } | 2071 } |
2070 | 2072 |
2071 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) | 2073 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) |
2072 { | 2074 { |
2073 ASSERT(!isInPerformLayout()); | 2075 DCHECK(!isInPerformLayout()); |
2074 m_updateWidgetsTimer.stop(); | 2076 m_updateWidgetsTimer.stop(); |
2075 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { | 2077 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { |
2076 if (updateWidgets()) | 2078 if (updateWidgets()) |
2077 return; | 2079 return; |
2078 } | 2080 } |
2079 } | 2081 } |
2080 | 2082 |
2081 void FrameView::flushAnyPendingPostLayoutTasks() | 2083 void FrameView::flushAnyPendingPostLayoutTasks() |
2082 { | 2084 { |
2083 ASSERT(!isInPerformLayout()); | 2085 DCHECK(!isInPerformLayout()); |
2084 if (m_postLayoutTasksTimer.isActive()) | 2086 if (m_postLayoutTasksTimer.isActive()) |
2085 performPostLayoutTasks(); | 2087 performPostLayoutTasks(); |
2086 if (m_updateWidgetsTimer.isActive()) | 2088 if (m_updateWidgetsTimer.isActive()) |
2087 updateWidgetsTimerFired(0); | 2089 updateWidgetsTimerFired(0); |
2088 } | 2090 } |
2089 | 2091 |
2090 void FrameView::scheduleUpdateWidgetsIfNecessary() | 2092 void FrameView::scheduleUpdateWidgetsIfNecessary() |
2091 { | 2093 { |
2092 ASSERT(!isInPerformLayout()); | 2094 DCHECK(!isInPerformLayout()); |
2093 if (m_updateWidgetsTimer.isActive() || m_partUpdateSet.isEmpty()) | 2095 if (m_updateWidgetsTimer.isActive() || m_partUpdateSet.isEmpty()) |
2094 return; | 2096 return; |
2095 m_updateWidgetsTimer.startOneShot(0, BLINK_FROM_HERE); | 2097 m_updateWidgetsTimer.startOneShot(0, BLINK_FROM_HERE); |
2096 } | 2098 } |
2097 | 2099 |
2098 void FrameView::performPostLayoutTasks() | 2100 void FrameView::performPostLayoutTasks() |
2099 { | 2101 { |
2100 // FIXME: We can reach here, even when the page is not active! | 2102 // FIXME: We can reach here, even when the page is not active! |
2101 // http/tests/inspector/elements/html-link-import.html and many other | 2103 // http/tests/inspector/elements/html-link-import.html and many other |
2102 // tests hit that case. | 2104 // tests hit that case. |
2103 // We should ASSERT(isActive()); or at least return early if we can! | 2105 // We should DCHECK(isActive()); or at least return early if we can! |
2104 ASSERT(!isInPerformLayout()); // Always before or after performLayout(), par t of the highest-level layout() call. | 2106 DCHECK(!isInPerformLayout()); // Always before or after performLayout(), par t of the highest-level layout() call. |
2105 TRACE_EVENT0("blink,benchmark", "FrameView::performPostLayoutTasks"); | 2107 TRACE_EVENT0("blink,benchmark", "FrameView::performPostLayoutTasks"); |
2106 | 2108 |
2107 m_postLayoutTasksTimer.stop(); | 2109 m_postLayoutTasksTimer.stop(); |
2108 | 2110 |
2109 m_frame->selection().setCaretRectNeedsUpdate(); | 2111 m_frame->selection().setCaretRectNeedsUpdate(); |
2110 m_frame->selection().updateAppearance(); | 2112 m_frame->selection().updateAppearance(); |
2111 | 2113 |
2112 ASSERT(m_frame->document()); | 2114 DCHECK(m_frame->document()); |
2113 | 2115 |
2114 FontFaceSet::didLayout(*m_frame->document()); | 2116 FontFaceSet::didLayout(*m_frame->document()); |
2115 // Cursor update scheduling is done by the local root, which is the main fra me if there | 2117 // Cursor update scheduling is done by the local root, which is the main fra me if there |
2116 // are no RemoteFrame ancestors in the frame tree. Use of localFrameRoot() i s | 2118 // are no RemoteFrame ancestors in the frame tree. Use of localFrameRoot() i s |
2117 // discouraged but will change when cursor update scheduling is moved from E ventHandler | 2119 // discouraged but will change when cursor update scheduling is moved from E ventHandler |
2118 // to PageEventHandler. | 2120 // to PageEventHandler. |
2119 frame().localFrameRoot()->eventHandler().scheduleCursorUpdate(); | 2121 frame().localFrameRoot()->eventHandler().scheduleCursorUpdate(); |
2120 | 2122 |
2121 updateWidgetGeometries(); | 2123 updateWidgetGeometries(); |
2122 | 2124 |
2123 // Plugins could have torn down the page inside updateWidgetGeometries(). | 2125 // Plugins could have torn down the page inside updateWidgetGeometries(). |
2124 if (layoutViewItem().isNull()) | 2126 if (layoutViewItem().isNull()) |
2125 return; | 2127 return; |
2126 | 2128 |
2127 scheduleUpdateWidgetsIfNecessary(); | 2129 scheduleUpdateWidgetsIfNecessary(); |
2128 | 2130 |
2129 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) | 2131 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) |
2130 scrollingCoordinator->notifyGeometryChanged(); | 2132 scrollingCoordinator->notifyGeometryChanged(); |
2131 | 2133 |
2132 scrollToFragmentAnchor(); | 2134 scrollToFragmentAnchor(); |
2133 // TODO(skobes): Figure out interactions between scroll anchor, fragment anc hor, and history restoration. | 2135 // TODO(skobes): Figure out interactions between scroll anchor, fragment anc hor, and history restoration. |
2134 if (shouldPerformScrollAnchoring()) | 2136 if (shouldPerformScrollAnchoring()) |
2135 m_scrollAnchor.restore(); | 2137 m_scrollAnchor.restore(); |
2136 | 2138 |
2137 sendResizeEventIfNeeded(); | 2139 sendResizeEventIfNeeded(); |
2138 } | 2140 } |
2139 | 2141 |
2140 bool FrameView::wasViewportResized() | 2142 bool FrameView::wasViewportResized() |
2141 { | 2143 { |
2142 ASSERT(m_frame); | 2144 DCHECK(m_frame); |
2143 LayoutViewItem layoutViewItem = this->layoutViewItem(); | 2145 LayoutViewItem layoutViewItem = this->layoutViewItem(); |
2144 if (layoutViewItem.isNull()) | 2146 if (layoutViewItem.isNull()) |
2145 return false; | 2147 return false; |
2146 ASSERT(layoutViewItem.style()); | 2148 DCHECK(layoutViewItem.style()); |
2147 return (layoutSize(IncludeScrollbars) != m_lastViewportSize || layoutViewIte m.style()->zoom() != m_lastZoomFactor); | 2149 return (layoutSize(IncludeScrollbars) != m_lastViewportSize || layoutViewIte m.style()->zoom() != m_lastZoomFactor); |
2148 } | 2150 } |
2149 | 2151 |
2150 void FrameView::sendResizeEventIfNeeded() | 2152 void FrameView::sendResizeEventIfNeeded() |
2151 { | 2153 { |
2152 ASSERT(m_frame); | 2154 DCHECK(m_frame); |
2153 | 2155 |
2154 LayoutViewItem layoutViewItem = this->layoutViewItem(); | 2156 LayoutViewItem layoutViewItem = this->layoutViewItem(); |
2155 if (layoutViewItem.isNull() || layoutViewItem.document().printing()) | 2157 if (layoutViewItem.isNull() || layoutViewItem.document().printing()) |
2156 return; | 2158 return; |
2157 | 2159 |
2158 if (!wasViewportResized()) | 2160 if (!wasViewportResized()) |
2159 return; | 2161 return; |
2160 | 2162 |
2161 m_lastViewportSize = layoutSize(IncludeScrollbars); | 2163 m_lastViewportSize = layoutSize(IncludeScrollbars); |
2162 m_lastZoomFactor = layoutViewItem.style()->zoom(); | 2164 m_lastZoomFactor = layoutViewItem.style()->zoom(); |
(...skipping 18 matching lines...) Expand all Loading... | |
2181 for (LayoutObject* layoutObject = view; layoutObject; layoutObject = layoutO bject->nextInPreOrder()) { | 2183 for (LayoutObject* layoutObject = view; layoutObject; layoutObject = layoutO bject->nextInPreOrder()) { |
2182 if (!layoutObject->isCounter()) | 2184 if (!layoutObject->isCounter()) |
2183 continue; | 2185 continue; |
2184 | 2186 |
2185 toLayoutCounter(layoutObject)->updateCounter(); | 2187 toLayoutCounter(layoutObject)->updateCounter(); |
2186 } | 2188 } |
2187 } | 2189 } |
2188 | 2190 |
2189 IntRect FrameView::windowClipRect(IncludeScrollbarsInRect scrollbarInclusion) co nst | 2191 IntRect FrameView::windowClipRect(IncludeScrollbarsInRect scrollbarInclusion) co nst |
2190 { | 2192 { |
2191 ASSERT(m_frame->view() == this); | 2193 DCHECK(m_frame->view() == this); |
2192 | 2194 |
2193 LayoutRect clipRect(LayoutPoint(), LayoutSize(visibleContentSize(scrollbarIn clusion))); | 2195 LayoutRect clipRect(LayoutPoint(), LayoutSize(visibleContentSize(scrollbarIn clusion))); |
2194 layoutViewItem().mapToVisualRectInAncestorSpace(&layoutView()->containerForP aintInvalidation(), clipRect); | 2196 layoutViewItem().mapToVisualRectInAncestorSpace(&layoutView()->containerForP aintInvalidation(), clipRect); |
2195 return enclosingIntRect(clipRect); | 2197 return enclosingIntRect(clipRect); |
2196 } | 2198 } |
2197 | 2199 |
2198 bool FrameView::shouldUseIntegerScrollOffset() const | 2200 bool FrameView::shouldUseIntegerScrollOffset() const |
2199 { | 2201 { |
2200 if (m_frame->settings() && !m_frame->settings()->preferCompositingToLCDTextE nabled()) | 2202 LayoutViewItem layoutView = this->layoutViewItem(); |
chrishtr
2016/07/27 19:26:00
Ditto.
I think you should just write:
if (m_fra
Stephen Chennney
2016/07/28 13:55:38
We don't need anything at all. The logic works suc
| |
2203 if (layoutView.isNull()) | |
2204 return false; | |
2205 if (layoutView.layer()->needsCompositedScrolling()) | |
2201 return true; | 2206 return true; |
2202 | 2207 |
2203 return ScrollableArea::shouldUseIntegerScrollOffset(); | 2208 return ScrollableArea::shouldUseIntegerScrollOffset(); |
2204 } | 2209 } |
2205 | 2210 |
2206 bool FrameView::isActive() const | 2211 bool FrameView::isActive() const |
2207 { | 2212 { |
2208 Page* page = frame().page(); | 2213 Page* page = frame().page(); |
2209 return page && page->focusController().isActive(); | 2214 return page && page->focusController().isActive(); |
2210 } | 2215 } |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2597 }); | 2602 }); |
2598 } | 2603 } |
2599 | 2604 |
2600 updateViewportIntersectionsForSubtree(targetState); | 2605 updateViewportIntersectionsForSubtree(targetState); |
2601 } | 2606 } |
2602 | 2607 |
2603 void FrameView::updatePaintProperties() | 2608 void FrameView::updatePaintProperties() |
2604 { | 2609 { |
2605 TRACE_EVENT0("blink", "FrameView::updatePaintProperties"); | 2610 TRACE_EVENT0("blink", "FrameView::updatePaintProperties"); |
2606 | 2611 |
2607 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 2612 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
2608 | 2613 |
2609 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InPrePaint); }); | 2614 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InPrePaint); }); |
2610 PrePaintTreeWalk().walk(*this); | 2615 PrePaintTreeWalk().walk(*this); |
2611 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::PrePaintClean); }); | 2616 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::PrePaintClean); }); |
2612 } | 2617 } |
2613 | 2618 |
2614 void FrameView::synchronizedPaint() | 2619 void FrameView::synchronizedPaint() |
2615 { | 2620 { |
2616 TRACE_EVENT0("blink", "FrameView::synchronizedPaint"); | 2621 TRACE_EVENT0("blink", "FrameView::synchronizedPaint"); |
2617 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime"); | 2622 SCOPED_BLINK_UMA_HISTOGRAM_TIMER("Blink.Paint.UpdateTime"); |
2618 | 2623 |
2619 ASSERT(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame())); | 2624 DCHECK(frame() == page()->mainFrame() || (!frame().tree().parent()->isLocalF rame())); |
2620 | 2625 |
2621 LayoutViewItem view = layoutViewItem(); | 2626 LayoutViewItem view = layoutViewItem(); |
2622 ASSERT(!view.isNull()); | 2627 DCHECK(!view.isNull()); |
2623 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InPaint); }); | 2628 forAllNonThrottledFrameViews([](FrameView& frameView) { frameView.lifecycle( ).advanceTo(DocumentLifecycle::InPaint); }); |
2624 | 2629 |
2625 // A null graphics layer can occur for painting of SVG images that are not p arented into the main frame tree, | 2630 // A null graphics layer can occur for painting of SVG images that are not p arented into the main frame tree, |
2626 // or when the FrameView is the main frame view of a page overlay. The page overlay is in the layer tree of | 2631 // or when the FrameView is the main frame view of a page overlay. The page overlay is in the layer tree of |
2627 // the host page and will be painted during synchronized painting of the hos t page. | 2632 // the host page and will be painted during synchronized painting of the hos t page. |
2628 if (GraphicsLayer* rootGraphicsLayer = view.compositor()->rootGraphicsLayer( )) { | 2633 if (GraphicsLayer* rootGraphicsLayer = view.compositor()->rootGraphicsLayer( )) { |
2629 synchronizedPaintRecursively(rootGraphicsLayer); | 2634 synchronizedPaintRecursively(rootGraphicsLayer); |
2630 } | 2635 } |
2631 if (GraphicsLayer* layerForHorizontalScrollbar = view.compositor()->layerFor HorizontalScrollbar()) { | 2636 if (GraphicsLayer* layerForHorizontalScrollbar = view.compositor()->layerFor HorizontalScrollbar()) { |
2632 synchronizedPaintRecursively(layerForHorizontalScrollbar); | 2637 synchronizedPaintRecursively(layerForHorizontalScrollbar); |
(...skipping 28 matching lines...) Expand all Loading... | |
2661 } | 2666 } |
2662 | 2667 |
2663 for (auto& child : graphicsLayer->children()) | 2668 for (auto& child : graphicsLayer->children()) |
2664 synchronizedPaintRecursively(child); | 2669 synchronizedPaintRecursively(child); |
2665 } | 2670 } |
2666 | 2671 |
2667 void FrameView::pushPaintArtifactToCompositor() | 2672 void FrameView::pushPaintArtifactToCompositor() |
2668 { | 2673 { |
2669 TRACE_EVENT0("blink", "FrameView::pushPaintArtifactToCompositor"); | 2674 TRACE_EVENT0("blink", "FrameView::pushPaintArtifactToCompositor"); |
2670 | 2675 |
2671 ASSERT(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 2676 DCHECK(RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
2672 | 2677 |
2673 LayoutViewItem viewItem = layoutViewItem(); | 2678 LayoutViewItem viewItem = layoutViewItem(); |
2674 ASSERT(!viewItem.isNull()); | 2679 DCHECK(!viewItem.isNull()); |
2675 | 2680 |
2676 // TODO(jbroman): Simplify the path to PaintController. | 2681 // TODO(jbroman): Simplify the path to PaintController. |
2677 PaintLayer* layer = viewItem.layer(); | 2682 PaintLayer* layer = viewItem.layer(); |
2678 ASSERT(layer); | 2683 DCHECK(layer); |
2679 if (!layer->hasCompositedLayerMapping()) | 2684 if (!layer->hasCompositedLayerMapping()) |
2680 return; | 2685 return; |
2681 GraphicsLayer* rootGraphicsLayer = layer->compositedLayerMapping()->mainGrap hicsLayer(); | 2686 GraphicsLayer* rootGraphicsLayer = layer->compositedLayerMapping()->mainGrap hicsLayer(); |
2682 if (!rootGraphicsLayer->drawsContent()) | 2687 if (!rootGraphicsLayer->drawsContent()) |
2683 return; | 2688 return; |
2684 const PaintArtifact& paintArtifact = rootGraphicsLayer->getPaintController() .paintArtifact(); | 2689 const PaintArtifact& paintArtifact = rootGraphicsLayer->getPaintController() .paintArtifact(); |
2685 | 2690 |
2686 Page* page = frame().page(); | 2691 Page* page = frame().page(); |
2687 if (!page) | 2692 if (!page) |
2688 return; | 2693 return; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2754 // extra style recalc. See PaintLayer::filterNeedsPaintInvalidation(). | 2759 // extra style recalc. See PaintLayer::filterNeedsPaintInvalidation(). |
2755 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { | 2760 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { |
2756 m_frame->document()->updateStyleAndLayoutTree(); | 2761 m_frame->document()->updateStyleAndLayoutTree(); |
2757 | 2762 |
2758 if (needsLayout()) | 2763 if (needsLayout()) |
2759 layout(); | 2764 layout(); |
2760 } | 2765 } |
2761 | 2766 |
2762 // These asserts ensure that parent frames are clean, when child frames fini shed updating layout and style. | 2767 // These asserts ensure that parent frames are clean, when child frames fini shed updating layout and style. |
2763 checkDoesNotNeedLayout(); | 2768 checkDoesNotNeedLayout(); |
2764 ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); | 2769 DCHECK(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); |
2765 #if ENABLE(ASSERT) | 2770 #if ENABLE(ASSERT) |
2766 m_frame->document()->layoutView()->assertLaidOut(); | 2771 m_frame->document()->layoutView()->assertLaidOut(); |
2767 #endif | 2772 #endif |
2768 | 2773 |
2769 updateWidgetGeometriesIfNeeded(); | 2774 updateWidgetGeometriesIfNeeded(); |
2770 | 2775 |
2771 if (lifecycle().state() < DocumentLifecycle::LayoutClean) | 2776 if (lifecycle().state() < DocumentLifecycle::LayoutClean) |
2772 lifecycle().advanceTo(DocumentLifecycle::LayoutClean); | 2777 lifecycle().advanceTo(DocumentLifecycle::LayoutClean); |
2773 | 2778 |
2774 // Ensure that we become visually non-empty eventually. | 2779 // Ensure that we become visually non-empty eventually. |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3083 if (!m_resizerAreas) | 3088 if (!m_resizerAreas) |
3084 return; | 3089 return; |
3085 | 3090 |
3086 ResizerAreaSet::iterator it = m_resizerAreas->find(&resizerBox); | 3091 ResizerAreaSet::iterator it = m_resizerAreas->find(&resizerBox); |
3087 if (it != m_resizerAreas->end()) | 3092 if (it != m_resizerAreas->end()) |
3088 m_resizerAreas->remove(it); | 3093 m_resizerAreas->remove(it); |
3089 } | 3094 } |
3090 | 3095 |
3091 void FrameView::addScrollableArea(ScrollableArea* scrollableArea) | 3096 void FrameView::addScrollableArea(ScrollableArea* scrollableArea) |
3092 { | 3097 { |
3093 ASSERT(scrollableArea); | 3098 DCHECK(scrollableArea); |
3094 if (!m_scrollableAreas) | 3099 if (!m_scrollableAreas) |
3095 m_scrollableAreas = new ScrollableAreaSet; | 3100 m_scrollableAreas = new ScrollableAreaSet; |
3096 m_scrollableAreas->add(scrollableArea); | 3101 m_scrollableAreas->add(scrollableArea); |
3097 | 3102 |
3098 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) | 3103 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) |
3099 scrollingCoordinator->scrollableAreasDidChange(); | 3104 scrollingCoordinator->scrollableAreasDidChange(); |
3100 } | 3105 } |
3101 | 3106 |
3102 void FrameView::removeScrollableArea(ScrollableArea* scrollableArea) | 3107 void FrameView::removeScrollableArea(ScrollableArea* scrollableArea) |
3103 { | 3108 { |
3104 if (!m_scrollableAreas) | 3109 if (!m_scrollableAreas) |
3105 return; | 3110 return; |
3106 m_scrollableAreas->remove(scrollableArea); | 3111 m_scrollableAreas->remove(scrollableArea); |
3107 | 3112 |
3108 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) | 3113 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator( )) |
3109 scrollingCoordinator->scrollableAreasDidChange(); | 3114 scrollingCoordinator->scrollableAreasDidChange(); |
3110 } | 3115 } |
3111 | 3116 |
3112 void FrameView::addAnimatingScrollableArea(ScrollableArea* scrollableArea) | 3117 void FrameView::addAnimatingScrollableArea(ScrollableArea* scrollableArea) |
3113 { | 3118 { |
3114 ASSERT(scrollableArea); | 3119 DCHECK(scrollableArea); |
3115 if (!m_animatingScrollableAreas) | 3120 if (!m_animatingScrollableAreas) |
3116 m_animatingScrollableAreas = new ScrollableAreaSet; | 3121 m_animatingScrollableAreas = new ScrollableAreaSet; |
3117 m_animatingScrollableAreas->add(scrollableArea); | 3122 m_animatingScrollableAreas->add(scrollableArea); |
3118 } | 3123 } |
3119 | 3124 |
3120 void FrameView::removeAnimatingScrollableArea(ScrollableArea* scrollableArea) | 3125 void FrameView::removeAnimatingScrollableArea(ScrollableArea* scrollableArea) |
3121 { | 3126 { |
3122 if (!m_animatingScrollableAreas) | 3127 if (!m_animatingScrollableAreas) |
3123 return; | 3128 return; |
3124 m_animatingScrollableAreas->remove(scrollableArea); | 3129 m_animatingScrollableAreas->remove(scrollableArea); |
(...skipping 11 matching lines...) Expand all Loading... | |
3136 | 3141 |
3137 if (m_scrollbarsAvoidingResizer && parent()) | 3142 if (m_scrollbarsAvoidingResizer && parent()) |
3138 toFrameView(parent())->adjustScrollbarsAvoidingResizerCount(m_scrollbars AvoidingResizer); | 3143 toFrameView(parent())->adjustScrollbarsAvoidingResizerCount(m_scrollbars AvoidingResizer); |
3139 | 3144 |
3140 updateScrollableAreaSet(); | 3145 updateScrollableAreaSet(); |
3141 setNeedsUpdateViewportIntersection(); | 3146 setNeedsUpdateViewportIntersection(); |
3142 } | 3147 } |
3143 | 3148 |
3144 void FrameView::removeChild(Widget* child) | 3149 void FrameView::removeChild(Widget* child) |
3145 { | 3150 { |
3146 ASSERT(child->parent() == this); | 3151 DCHECK(child->parent() == this); |
3147 | 3152 |
3148 if (child->isFrameView()) | 3153 if (child->isFrameView()) |
3149 removeScrollableArea(toFrameView(child)); | 3154 removeScrollableArea(toFrameView(child)); |
3150 | 3155 |
3151 child->setParent(0); | 3156 child->setParent(0); |
3152 m_children.remove(child); | 3157 m_children.remove(child); |
3153 } | 3158 } |
3154 | 3159 |
3155 bool FrameView::visualViewportSuppliesScrollbars() const | 3160 bool FrameView::visualViewportSuppliesScrollbars() const |
3156 { | 3161 { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3207 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() | 3212 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() |
3208 // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/ 422331. | 3213 // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/ 422331. |
3209 IntSize visibleSize = visibleContentSize(ExcludeScrollbars) + topControlsSiz e(); | 3214 IntSize visibleSize = visibleContentSize(ExcludeScrollbars) + topControlsSiz e(); |
3210 IntSize contentBounds = contentsSize(); | 3215 IntSize contentBounds = contentsSize(); |
3211 IntPoint maximumPosition = -scrollOrigin() + (contentBounds - visibleSize); | 3216 IntPoint maximumPosition = -scrollOrigin() + (contentBounds - visibleSize); |
3212 return maximumPosition.expandedTo(minimumScrollPosition()); | 3217 return maximumPosition.expandedTo(minimumScrollPosition()); |
3213 } | 3218 } |
3214 | 3219 |
3215 void FrameView::addChild(Widget* child) | 3220 void FrameView::addChild(Widget* child) |
3216 { | 3221 { |
3217 ASSERT(child != this && !child->parent()); | 3222 DCHECK(child != this && !child->parent()); |
3218 child->setParent(this); | 3223 child->setParent(this); |
3219 m_children.add(child); | 3224 m_children.add(child); |
3220 } | 3225 } |
3221 | 3226 |
3222 void FrameView::setHasHorizontalScrollbar(bool hasBar) | 3227 void FrameView::setHasHorizontalScrollbar(bool hasBar) |
3223 { | 3228 { |
3224 if (hasBar == !!m_horizontalScrollbar) | 3229 if (hasBar == !!m_horizontalScrollbar) |
3225 return; | 3230 return; |
3226 | 3231 |
3227 if (hasBar) { | 3232 if (hasBar) { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3363 // ScrollableArea::scrollPositionChanged to only pass clamped offsets. | 3368 // ScrollableArea::scrollPositionChanged to only pass clamped offsets. |
3364 DoublePoint newPosition = clampScrollPosition(offset); | 3369 DoublePoint newPosition = clampScrollPosition(offset); |
3365 | 3370 |
3366 DoublePoint oldPosition = m_scrollPosition; | 3371 DoublePoint oldPosition = m_scrollPosition; |
3367 DoubleSize scrollDelta = newPosition - oldPosition; | 3372 DoubleSize scrollDelta = newPosition - oldPosition; |
3368 if (scrollDelta.isZero()) | 3373 if (scrollDelta.isZero()) |
3369 return; | 3374 return; |
3370 | 3375 |
3371 if (m_frame->settings() && m_frame->settings()->rootLayerScrolls()) { | 3376 if (m_frame->settings() && m_frame->settings()->rootLayerScrolls()) { |
3372 // Don't scroll the FrameView! | 3377 // Don't scroll the FrameView! |
3373 ASSERT_NOT_REACHED(); | 3378 NOTREACHED(); |
3374 } | 3379 } |
3375 | 3380 |
3376 m_scrollPosition = newPosition; | 3381 m_scrollPosition = newPosition; |
3377 | 3382 |
3378 if (!scrollbarsSuppressed()) | 3383 if (!scrollbarsSuppressed()) |
3379 m_pendingScrollDelta += scrollDelta; | 3384 m_pendingScrollDelta += scrollDelta; |
3380 | 3385 |
3381 clearFragmentAnchor(); | 3386 clearFragmentAnchor(); |
3382 updateLayersAndCompositingAfterScrollIfNeeded(scrollDelta); | 3387 updateLayersAndCompositingAfterScrollIfNeeded(scrollDelta); |
3383 | 3388 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3538 } | 3543 } |
3539 if (overlapsResizer != scrollbar.overlapsResizer()) { | 3544 if (overlapsResizer != scrollbar.overlapsResizer()) { |
3540 scrollbar.setOverlapsResizer(overlapsResizer); | 3545 scrollbar.setOverlapsResizer(overlapsResizer); |
3541 adjustScrollbarsAvoidingResizerCount(overlapsResizer ? 1 : -1); | 3546 adjustScrollbarsAvoidingResizerCount(overlapsResizer ? 1 : -1); |
3542 } | 3547 } |
3543 return adjustedRect; | 3548 return adjustedRect; |
3544 } | 3549 } |
3545 | 3550 |
3546 bool FrameView::adjustScrollbarExistence(ComputeScrollbarExistenceOption option) | 3551 bool FrameView::adjustScrollbarExistence(ComputeScrollbarExistenceOption option) |
3547 { | 3552 { |
3548 ASSERT(m_inUpdateScrollbars); | 3553 DCHECK(m_inUpdateScrollbars); |
3549 | 3554 |
3550 // If we came in here with the view already needing a layout, then go ahead and do that | 3555 // If we came in here with the view already needing a layout, then go ahead and do that |
3551 // first. (This will be the common case, e.g., when the page changes due to window resizing for example). | 3556 // first. (This will be the common case, e.g., when the page changes due to window resizing for example). |
3552 // This layout will not re-enter updateScrollbars and does not count towards our max layout pass total. | 3557 // This layout will not re-enter updateScrollbars and does not count towards our max layout pass total. |
3553 if (!m_scrollbarsSuppressed) | 3558 if (!m_scrollbarsSuppressed) |
3554 scrollbarExistenceDidChange(); | 3559 scrollbarExistenceDidChange(); |
3555 | 3560 |
3556 bool hasHorizontalScrollbar = m_horizontalScrollbar; | 3561 bool hasHorizontalScrollbar = m_horizontalScrollbar; |
3557 bool hasVerticalScrollbar = m_verticalScrollbar; | 3562 bool hasVerticalScrollbar = m_verticalScrollbar; |
3558 | 3563 |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4139 { | 4144 { |
4140 if (!m_needsUpdateViewportIntersection) | 4145 if (!m_needsUpdateViewportIntersection) |
4141 return; | 4146 return; |
4142 m_needsUpdateViewportIntersection = false; | 4147 m_needsUpdateViewportIntersection = false; |
4143 m_viewportIntersectionValid = true; | 4148 m_viewportIntersectionValid = true; |
4144 FrameView* parent = parentFrameView(); | 4149 FrameView* parent = parentFrameView(); |
4145 if (!parent) { | 4150 if (!parent) { |
4146 m_viewportIntersection = frameRect(); | 4151 m_viewportIntersection = frameRect(); |
4147 return; | 4152 return; |
4148 } | 4153 } |
4149 ASSERT(!parent->m_needsUpdateViewportIntersection); | 4154 DCHECK(!parent->m_needsUpdateViewportIntersection); |
4150 | 4155 |
4151 // If our parent is hidden, then we are too. | 4156 // If our parent is hidden, then we are too. |
4152 if (parent->m_viewportIntersection.isEmpty()) { | 4157 if (parent->m_viewportIntersection.isEmpty()) { |
4153 m_viewportIntersection = parent->m_viewportIntersection; | 4158 m_viewportIntersection = parent->m_viewportIntersection; |
4154 return; | 4159 return; |
4155 } | 4160 } |
4156 | 4161 |
4157 // Transform our bounds into the root frame's content coordinate space, | 4162 // Transform our bounds into the root frame's content coordinate space, |
4158 // making sure we have valid layout data in our parent document. If our | 4163 // making sure we have valid layout data in our parent document. If our |
4159 // parent is throttled, we'll use possible stale layout information and | 4164 // parent is throttled, we'll use possible stale layout information and |
4160 // rely on the fact that another lifecycle update will be scheduled once | 4165 // rely on the fact that another lifecycle update will be scheduled once |
4161 // our parent becomes unthrottled. | 4166 // our parent becomes unthrottled. |
4162 ASSERT(parent->lifecycle().state() >= DocumentLifecycle::LayoutClean || pare nt->shouldThrottleRendering()); | 4167 DCHECK(parent->lifecycle().state() >= DocumentLifecycle::LayoutClean || pare nt->shouldThrottleRendering()); |
4163 m_viewportIntersection = parent->contentsToRootFrame(frameRect()); | 4168 m_viewportIntersection = parent->contentsToRootFrame(frameRect()); |
4164 | 4169 |
4165 // TODO(skyostil): Expand the viewport to make it less likely to see stale c ontent while scrolling. | 4170 // TODO(skyostil): Expand the viewport to make it less likely to see stale c ontent while scrolling. |
4166 IntRect viewport = parent->m_viewportIntersection; | 4171 IntRect viewport = parent->m_viewportIntersection; |
4167 m_viewportIntersection.intersect(viewport); | 4172 m_viewportIntersection.intersect(viewport); |
4168 } | 4173 } |
4169 | 4174 |
4170 void FrameView::updateViewportIntersectionsForSubtree(DocumentLifecycle::Lifecyc leState targetState) | 4175 void FrameView::updateViewportIntersectionsForSubtree(DocumentLifecycle::Lifecyc leState targetState) |
4171 { | 4176 { |
4172 bool hadValidIntersection = m_viewportIntersectionValid; | 4177 bool hadValidIntersection = m_viewportIntersectionValid; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4283 } | 4288 } |
4284 | 4289 |
4285 bool FrameView::canThrottleRendering() const | 4290 bool FrameView::canThrottleRendering() const |
4286 { | 4291 { |
4287 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) | 4292 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) |
4288 return false; | 4293 return false; |
4289 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); | 4294 return m_subtreeThrottled || (m_hiddenForThrottling && m_crossOriginForThrot tling); |
4290 } | 4295 } |
4291 | 4296 |
4292 } // namespace blink | 4297 } // namespace blink |
OLD | NEW |