| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 337 |
| 338 // Protect the view from being deleted during layout (in recalcStyle) | 338 // Protect the view from being deleted during layout (in recalcStyle) |
| 339 RefPtr<FrameView> protector(this); | 339 RefPtr<FrameView> protector(this); |
| 340 | 340 |
| 341 m_hasPendingLayout = false; | 341 m_hasPendingLayout = false; |
| 342 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo
utClean); | 342 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo
utClean); |
| 343 | 343 |
| 344 RELEASE_ASSERT(!isPainting()); | 344 RELEASE_ASSERT(!isPainting()); |
| 345 | 345 |
| 346 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout",
"beginData", InspectorLayoutEvent::beginData(this)); | 346 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout",
"beginData", InspectorLayoutEvent::beginData(this)); |
| 347 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 347 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); |
| 348 | 348 |
| 349 if (!allowSubtree && isSubtreeLayout()) { | 349 if (!allowSubtree && isSubtreeLayout()) { |
| 350 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); | 350 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); |
| 351 m_layoutSubtreeRoot = 0; | 351 m_layoutSubtreeRoot = 0; |
| 352 } | 352 } |
| 353 | 353 |
| 354 performPreLayoutTasks(); | 354 performPreLayoutTasks(); |
| 355 | 355 |
| 356 // If there is only one ref to this view left, then its going to be destroye
d as soon as we exit, | 356 // If there is only one ref to this view left, then its going to be destroye
d as soon as we exit, |
| 357 // so there's no point to continuing to layout | 357 // so there's no point to continuing to layout |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 // The plan is to move to compositor-queried paint invalidation, in which case t
his | 438 // The plan is to move to compositor-queried paint invalidation, in which case t
his |
| 439 // method would setNeedsRedraw on the GraphicsLayers with invalidations and | 439 // method would setNeedsRedraw on the GraphicsLayers with invalidations and |
| 440 // let the compositor pick which to actually draw. | 440 // let the compositor pick which to actually draw. |
| 441 // See http://crbug.com/306706 | 441 // See http://crbug.com/306706 |
| 442 void FrameView::invalidateTreeIfNeeded() | 442 void FrameView::invalidateTreeIfNeeded() |
| 443 { | 443 { |
| 444 ASSERT(renderView()); | 444 ASSERT(renderView()); |
| 445 RenderView& rootForPaintInvalidation = *renderView(); | 445 RenderView& rootForPaintInvalidation = *renderView(); |
| 446 ASSERT(!rootForPaintInvalidation.needsLayout()); | 446 ASSERT(!rootForPaintInvalidation.needsLayout()); |
| 447 | 447 |
| 448 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval
idation.debugName().ascii()); | 448 TRACE_EVENT1("blink", "FrameView::invalidateTree", "root", rootForPaintInval
idation.debugName().ascii().data()); |
| 449 | 449 |
| 450 PaintInvalidationState rootPaintInvalidationState(rootForPaintInvalidation); | 450 PaintInvalidationState rootPaintInvalidationState(rootForPaintInvalidation); |
| 451 | 451 |
| 452 rootForPaintInvalidation.invalidateTreeIfNeeded(rootPaintInvalidationState); | 452 rootForPaintInvalidation.invalidateTreeIfNeeded(rootPaintInvalidationState); |
| 453 | 453 |
| 454 m_doFullPaintInvalidation = false; | 454 m_doFullPaintInvalidation = false; |
| 455 #ifndef NDEBUG | 455 #ifndef NDEBUG |
| 456 renderView()->assertSubtreeClearedPaintInvalidationState(); | 456 renderView()->assertSubtreeClearedPaintInvalidationState(); |
| 457 #endif | 457 #endif |
| 458 | 458 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 if (isSubtreeLayout()) { | 598 if (isSubtreeLayout()) { |
| 599 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); | 599 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); |
| 600 m_layoutSubtreeRoot = 0; | 600 m_layoutSubtreeRoot = 0; |
| 601 } | 601 } |
| 602 if (!m_layoutSchedulingEnabled) | 602 if (!m_layoutSchedulingEnabled) |
| 603 return; | 603 return; |
| 604 if (!needsLayout()) | 604 if (!needsLayout()) |
| 605 return; | 605 return; |
| 606 if (!m_frame->document()->shouldScheduleLayout()) | 606 if (!m_frame->document()->shouldScheduleLayout()) |
| 607 return; | 607 return; |
| 608 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Invali
dateLayout", "frame", m_frame.get()); | 608 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Invali
dateLayout", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get()); |
| 609 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 609 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); |
| 610 | 610 |
| 611 if (m_hasPendingLayout) | 611 if (m_hasPendingLayout) |
| 612 return; | 612 return; |
| 613 m_hasPendingLayout = true; | 613 m_hasPendingLayout = true; |
| 614 | 614 |
| 615 page()->animator().scheduleVisualUpdate(); | 615 page()->animator().scheduleVisualUpdate(); |
| 616 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); | 616 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); |
| 617 } | 617 } |
| 618 | 618 |
| 619 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de
scendant) | 619 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de
scendant) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 } | 660 } |
| 661 } | 661 } |
| 662 } else if (m_layoutSchedulingEnabled) { | 662 } else if (m_layoutSchedulingEnabled) { |
| 663 m_layoutSubtreeRoot = relayoutRoot; | 663 m_layoutSubtreeRoot = relayoutRoot; |
| 664 ASSERT(!m_layoutSubtreeRoot->container() || !m_layoutSubtreeRoot->contai
ner()->needsLayout()); | 664 ASSERT(!m_layoutSubtreeRoot->container() || !m_layoutSubtreeRoot->contai
ner()->needsLayout()); |
| 665 m_hasPendingLayout = true; | 665 m_hasPendingLayout = true; |
| 666 | 666 |
| 667 page()->animator().scheduleVisualUpdate(); | 667 page()->animator().scheduleVisualUpdate(); |
| 668 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); | 668 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); |
| 669 } | 669 } |
| 670 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Invali
dateLayout", "frame", m_frame.get()); | 670 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Invali
dateLayout", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get()); |
| 671 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 671 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); |
| 672 } | 672 } |
| 673 | 673 |
| 674 bool FrameView::layoutPending() const | 674 bool FrameView::layoutPending() const |
| 675 { | 675 { |
| 676 // FIXME: This should check Document::lifecycle instead. | 676 // FIXME: This should check Document::lifecycle instead. |
| 677 return m_hasPendingLayout; | 677 return m_hasPendingLayout; |
| 678 } | 678 } |
| 679 | 679 |
| 680 bool FrameView::isInPerformLayout() const | 680 bool FrameView::isInPerformLayout() const |
| 681 { | 681 { |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 RenderView* renderView = this->renderView(); | 906 RenderView* renderView = this->renderView(); |
| 907 if (!renderView) { | 907 if (!renderView) { |
| 908 WTF_LOG_ERROR("called FrameView::paint with nil renderer"); | 908 WTF_LOG_ERROR("called FrameView::paint with nil renderer"); |
| 909 return; | 909 return; |
| 910 } | 910 } |
| 911 | 911 |
| 912 RELEASE_ASSERT(!needsLayout()); | 912 RELEASE_ASSERT(!needsLayout()); |
| 913 ASSERT(document->lifecycle().state() >= DocumentLifecycle::CompositingClean)
; | 913 ASSERT(document->lifecycle().state() >= DocumentLifecycle::CompositingClean)
; |
| 914 | 914 |
| 915 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Paint", "data"
, InspectorPaintEvent::data(renderView, rect, 0)); | 915 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Paint", "data"
, InspectorPaintEvent::data(renderView, rect, 0)); |
| 916 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", "stack", InspectorCallStackEvent::currentCallStack()); | 916 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); |
| 917 | 917 |
| 918 bool isTopLevelPainter = !s_inPaintContents; | 918 bool isTopLevelPainter = !s_inPaintContents; |
| 919 s_inPaintContents = true; | 919 s_inPaintContents = true; |
| 920 | 920 |
| 921 FontCachePurgePreventer fontCachePurgePreventer; | 921 FontCachePurgePreventer fontCachePurgePreventer; |
| 922 | 922 |
| 923 PaintBehavior oldPaintBehavior = m_paintBehavior; // FIXME(sky): is this nee
ded? | 923 PaintBehavior oldPaintBehavior = m_paintBehavior; // FIXME(sky): is this nee
ded? |
| 924 | 924 |
| 925 if (m_paintBehavior == PaintBehaviorNormal) | 925 if (m_paintBehavior == PaintBehaviorNormal) |
| 926 document->markers().invalidateRenderedRectsForMarkersInRect(rect); | 926 document->markers().invalidateRenderedRectsForMarkersInRect(rect); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 } | 976 } |
| 977 | 977 |
| 978 void FrameView::updateLayoutAndStyleForPainting() | 978 void FrameView::updateLayoutAndStyleForPainting() |
| 979 { | 979 { |
| 980 // Updating layout can run script, which can tear down the FrameView. | 980 // Updating layout can run script, which can tear down the FrameView. |
| 981 RefPtr<FrameView> protector(this); | 981 RefPtr<FrameView> protector(this); |
| 982 | 982 |
| 983 updateLayoutAndStyleIfNeededRecursive(); | 983 updateLayoutAndStyleIfNeededRecursive(); |
| 984 | 984 |
| 985 if (RenderView* view = renderView()) { | 985 if (RenderView* view = renderView()) { |
| 986 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up
dateLayerTree", "frame", m_frame.get()); | 986 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up
dateLayerTree", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get()); |
| 987 view->compositor()->updateIfNeededRecursive(); | 987 view->compositor()->updateIfNeededRecursive(); |
| 988 | 988 |
| 989 if (view->compositor()->inCompositingMode()) | 989 if (view->compositor()->inCompositingMode()) |
| 990 m_frame->page()->scrollingCoordinator()->updateAfterCompositingChang
eIfNeeded(); | 990 m_frame->page()->scrollingCoordinator()->updateAfterCompositingChang
eIfNeeded(); |
| 991 | 991 |
| 992 updateCompositedSelectionBoundsIfNeeded(); | 992 updateCompositedSelectionBoundsIfNeeded(); |
| 993 | 993 |
| 994 invalidateTreeIfNeededRecursive(); | 994 invalidateTreeIfNeededRecursive(); |
| 995 } | 995 } |
| 996 | 996 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations) | 1062 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations) |
| 1063 { | 1063 { |
| 1064 if (trackPaintInvalidations == m_isTrackingPaintInvalidations) | 1064 if (trackPaintInvalidations == m_isTrackingPaintInvalidations) |
| 1065 return; | 1065 return; |
| 1066 | 1066 |
| 1067 // FIXME(sky): simplify | 1067 // FIXME(sky): simplify |
| 1068 if (RenderView* renderView = m_frame->contentRenderer()) | 1068 if (RenderView* renderView = m_frame->contentRenderer()) |
| 1069 renderView->compositor()->setTracksPaintInvalidations(trackPaintInvalida
tions); | 1069 renderView->compositor()->setTracksPaintInvalidations(trackPaintInvalida
tions); |
| 1070 | 1070 |
| 1071 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), | 1071 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), |
| 1072 "FrameView::setTracksPaintInvalidations", "enabled", trackPaintInvalidat
ions); | 1072 "FrameView::setTracksPaintInvalidations", TRACE_EVENT_SCOPE_PROCESS, "en
abled", trackPaintInvalidations); |
| 1073 | 1073 |
| 1074 resetTrackedPaintInvalidations(); | 1074 resetTrackedPaintInvalidations(); |
| 1075 m_isTrackingPaintInvalidations = trackPaintInvalidations; | 1075 m_isTrackingPaintInvalidations = trackPaintInvalidations; |
| 1076 } | 1076 } |
| 1077 | 1077 |
| 1078 void FrameView::resetTrackedPaintInvalidations() | 1078 void FrameView::resetTrackedPaintInvalidations() |
| 1079 { | 1079 { |
| 1080 m_trackedPaintInvalidationRects.clear(); | 1080 m_trackedPaintInvalidationRects.clear(); |
| 1081 if (RenderView* renderView = this->renderView()) | 1081 if (RenderView* renderView = this->renderView()) |
| 1082 renderView->compositor()->resetTrackedPaintInvalidationRects(); | 1082 renderView->compositor()->resetTrackedPaintInvalidationRects(); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 void FrameView::setLayoutSizeInternal(const IntSize& size) | 1161 void FrameView::setLayoutSizeInternal(const IntSize& size) |
| 1162 { | 1162 { |
| 1163 if (m_layoutSize == size) | 1163 if (m_layoutSize == size) |
| 1164 return; | 1164 return; |
| 1165 | 1165 |
| 1166 m_layoutSize = size; | 1166 m_layoutSize = size; |
| 1167 contentsResized(); | 1167 contentsResized(); |
| 1168 } | 1168 } |
| 1169 | 1169 |
| 1170 } // namespace blink | 1170 } // namespace blink |
| OLD | NEW |