Title: [155046] trunk/Source/WebCore
- Revision
- 155046
- Author
- [email protected]
- Date
- 2013-09-04 09:41:36 -0700 (Wed, 04 Sep 2013)
Log Message
Simplify subtree relayout scheduling a bit.
<https://webkit.org/b/120684>
Reviewed by Antti Koivisto.
Subtree relayout scheduling should only happen while there's a render tree up,
the code can freely assume that there's a RenderView present.
Added an assertion that the render tree isn't being torn down. This should catch
renderers doing unnecessary work during document detach and could be a source
of "performance freebies."
I also un-nested scheduleRelayoutOfSubtree() with early-return style to make
the code more human-readable.
* page/FrameView.h:
* page/FrameView.cpp:
(WebCore::FrameView::scheduleRelayoutOfSubtree):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::scheduleRelayout):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (155045 => 155046)
--- trunk/Source/WebCore/ChangeLog 2013-09-04 16:39:53 UTC (rev 155045)
+++ trunk/Source/WebCore/ChangeLog 2013-09-04 16:41:36 UTC (rev 155046)
@@ -1,3 +1,26 @@
+2013-09-04 Andreas Kling <[email protected]>
+
+ Simplify subtree relayout scheduling a bit.
+ <https://webkit.org/b/120684>
+
+ Reviewed by Antti Koivisto.
+
+ Subtree relayout scheduling should only happen while there's a render tree up,
+ the code can freely assume that there's a RenderView present.
+
+ Added an assertion that the render tree isn't being torn down. This should catch
+ renderers doing unnecessary work during document detach and could be a source
+ of "performance freebies."
+
+ I also un-nested scheduleRelayoutOfSubtree() with early-return style to make
+ the code more human-readable.
+
+ * page/FrameView.h:
+ * page/FrameView.cpp:
+ (WebCore::FrameView::scheduleRelayoutOfSubtree):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::scheduleRelayout):
+
2013-09-04 Jae Hyun Park <[email protected]>
[Coordinated Graphics] Remove unused method in CoordinatedGraphicsLayer
Modified: trunk/Source/WebCore/page/FrameView.cpp (155045 => 155046)
--- trunk/Source/WebCore/page/FrameView.cpp 2013-09-04 16:39:53 UTC (rev 155045)
+++ trunk/Source/WebCore/page/FrameView.cpp 2013-09-04 16:41:36 UTC (rev 155046)
@@ -2417,46 +2417,61 @@
return false;
}
-void FrameView::scheduleRelayoutOfSubtree(RenderObject* relayoutRoot)
+void FrameView::scheduleRelayoutOfSubtree(RenderObject& newRelayoutRoot)
{
+ ASSERT(renderView());
+ RenderView& renderView = *this->renderView();
+
+ // Try to catch unnecessary work during render tree teardown.
+ ASSERT(!renderView.documentBeingDestroyed());
ASSERT(frame().view() == this);
- RenderView* renderView = this->renderView();
- if (renderView && renderView->needsLayout()) {
- if (relayoutRoot)
- relayoutRoot->markContainingBlocksForLayout(false);
+ if (renderView.needsLayout()) {
+ newRelayoutRoot.markContainingBlocksForLayout(false);
return;
}
- if (layoutPending() || !m_layoutSchedulingEnabled) {
- if (m_layoutRoot != relayoutRoot) {
- if (isObjectAncestorContainerOf(m_layoutRoot, relayoutRoot)) {
- // Keep the current root
- relayoutRoot->markContainingBlocksForLayout(false, m_layoutRoot);
- ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout());
- } else if (m_layoutRoot && isObjectAncestorContainerOf(relayoutRoot, m_layoutRoot)) {
- // Re-root at relayoutRoot
- m_layoutRoot->markContainingBlocksForLayout(false, relayoutRoot);
- m_layoutRoot = relayoutRoot;
- ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout());
- InspectorInstrumentation::didInvalidateLayout(&frame());
- } else {
- // Just do a full relayout
- if (m_layoutRoot)
- m_layoutRoot->markContainingBlocksForLayout(false);
- m_layoutRoot = 0;
- relayoutRoot->markContainingBlocksForLayout(false);
- InspectorInstrumentation::didInvalidateLayout(&frame());
- }
- }
- } else if (m_layoutSchedulingEnabled) {
- int delay = frame().document()->minimumLayoutDelay();
- m_layoutRoot = relayoutRoot;
- ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout());
+ if (!layoutPending() && m_layoutSchedulingEnabled) {
+ int delay = renderView.document().minimumLayoutDelay();
+ ASSERT(!newRelayoutRoot.container() || !newRelayoutRoot.container()->needsLayout());
+ m_layoutRoot = &newRelayoutRoot;
InspectorInstrumentation::didInvalidateLayout(&frame());
m_delayedLayout = delay != 0;
m_layoutTimer.startOneShot(delay * 0.001);
+ return;
}
+
+ if (m_layoutRoot == &newRelayoutRoot)
+ return;
+
+ if (!m_layoutRoot) {
+ // Just relayout the subtree.
+ newRelayoutRoot.markContainingBlocksForLayout(false);
+ InspectorInstrumentation::didInvalidateLayout(&frame());
+ return;
+ }
+
+ if (isObjectAncestorContainerOf(m_layoutRoot, &newRelayoutRoot)) {
+ // Keep the current root.
+ newRelayoutRoot.markContainingBlocksForLayout(false, m_layoutRoot);
+ ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout());
+ return;
+ }
+
+ if (isObjectAncestorContainerOf(&newRelayoutRoot, m_layoutRoot)) {
+ // Re-root at newRelayoutRoot.
+ m_layoutRoot->markContainingBlocksForLayout(false, &newRelayoutRoot);
+ m_layoutRoot = &newRelayoutRoot;
+ ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout());
+ InspectorInstrumentation::didInvalidateLayout(&frame());
+ return;
+ }
+
+ // Just do a full relayout.
+ m_layoutRoot->markContainingBlocksForLayout(false);
+ m_layoutRoot = 0;
+ newRelayoutRoot.markContainingBlocksForLayout(false);
+ InspectorInstrumentation::didInvalidateLayout(&frame());
}
bool FrameView::layoutPending() const
Modified: trunk/Source/WebCore/page/FrameView.h (155045 => 155046)
--- trunk/Source/WebCore/page/FrameView.h 2013-09-04 16:39:53 UTC (rev 155045)
+++ trunk/Source/WebCore/page/FrameView.h 2013-09-04 16:41:36 UTC (rev 155046)
@@ -101,7 +101,7 @@
bool didFirstLayout() const;
void layoutTimerFired(Timer<FrameView>*);
void scheduleRelayout();
- void scheduleRelayoutOfSubtree(RenderObject*);
+ void scheduleRelayoutOfSubtree(RenderObject&);
void unscheduleRelayout();
bool layoutPending() const;
bool isInLayout() const { return m_inLayout; }
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (155045 => 155046)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2013-09-04 16:39:53 UTC (rev 155045)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2013-09-04 16:41:36 UTC (rev 155046)
@@ -2768,7 +2768,7 @@
toRenderView(*this).frameView().scheduleRelayout();
else {
if (isRooted())
- view().frameView().scheduleRelayoutOfSubtree(this);
+ view().frameView().scheduleRelayoutOfSubtree(*this);
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes