- Revision
- 188163
- Author
- za...@apple.com
- Date
- 2015-08-07 14:25:34 -0700 (Fri, 07 Aug 2015)
Log Message
Subtree layout code should use RenderElement.
https://bugs.webkit.org/show_bug.cgi?id=147694
Reviewed by Simon Fraser.
Subtree layout will never begin at a RenderText, so tighten up
the code to operate on RenderElements instead of RenderObjects.
(This patch is based on webkit.org/b/126878)
No change in functionality.
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::willLayout):
* page/FrameView.cpp:
(WebCore::FrameView::FrameView): Deleted.
(WebCore::FrameView::layoutRoot): Deleted.
* page/FrameView.h:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalWidthInRegion):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::clearLayoutRootIfNeeded):
(WebCore::RenderElement::willBeDestroyed):
* rendering/RenderElement.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::clearLayoutRootIfNeeded): Deleted.
(WebCore::RenderObject::willBeDestroyed): Deleted.
* rendering/RenderObject.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (188162 => 188163)
--- trunk/Source/WebCore/ChangeLog 2015-08-07 21:12:47 UTC (rev 188162)
+++ trunk/Source/WebCore/ChangeLog 2015-08-07 21:25:34 UTC (rev 188163)
@@ -1,3 +1,33 @@
+2015-08-07 Zalan Bujtas <za...@apple.com>
+
+ Subtree layout code should use RenderElement.
+ https://bugs.webkit.org/show_bug.cgi?id=147694
+
+ Reviewed by Simon Fraser.
+
+ Subtree layout will never begin at a RenderText, so tighten up
+ the code to operate on RenderElements instead of RenderObjects.
+ (This patch is based on webkit.org/b/126878)
+
+ No change in functionality.
+
+ * inspector/InspectorTimelineAgent.cpp:
+ (WebCore::InspectorTimelineAgent::willLayout):
+ * page/FrameView.cpp:
+ (WebCore::FrameView::FrameView): Deleted.
+ (WebCore::FrameView::layoutRoot): Deleted.
+ * page/FrameView.h:
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::computeLogicalWidthInRegion):
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::clearLayoutRootIfNeeded):
+ (WebCore::RenderElement::willBeDestroyed):
+ * rendering/RenderElement.h:
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::clearLayoutRootIfNeeded): Deleted.
+ (WebCore::RenderObject::willBeDestroyed): Deleted.
+ * rendering/RenderObject.h:
+
2015-08-07 Wenson Hsieh <wenson_hs...@apple.com>
Temporarily allow programmatic input assistance for adding Gmail account
Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (188162 => 188163)
--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp 2015-08-07 21:12:47 UTC (rev 188162)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp 2015-08-07 21:25:34 UTC (rev 188163)
@@ -349,7 +349,7 @@
void InspectorTimelineAgent::willLayout(Frame& frame)
{
- RenderObject* root = frame.view()->layoutRoot();
+ auto* root = frame.view()->layoutRoot();
bool partialLayout = !!root;
if (!partialLayout)
Modified: trunk/Source/WebCore/page/FrameView.cpp (188162 => 188163)
--- trunk/Source/WebCore/page/FrameView.cpp 2015-08-07 21:12:47 UTC (rev 188162)
+++ trunk/Source/WebCore/page/FrameView.cpp 2015-08-07 21:25:34 UTC (rev 188163)
@@ -164,7 +164,6 @@
: m_frame(frame)
, m_canHaveScrollbars(true)
, m_layoutTimer(*this, &FrameView::layoutTimerFired)
- , m_layoutRoot(nullptr)
, m_layoutPhase(OutsideLayout)
, m_inSynchronousPostLayout(false)
, m_postLayoutTasksTimer(*this, &FrameView::performPostLayoutTasks)
@@ -1129,11 +1128,6 @@
renderView->setIsInWindow(isInWindow);
}
-RenderObject* FrameView::layoutRoot(bool onlyDuringLayout) const
-{
- return onlyDuringLayout && layoutPending() ? nullptr : m_layoutRoot;
-}
-
inline void FrameView::forceLayoutParentViewIfNeeded()
{
RenderWidget* ownerRenderer = frame().ownerRenderer();
Modified: trunk/Source/WebCore/page/FrameView.h (188162 => 188163)
--- trunk/Source/WebCore/page/FrameView.h 2015-08-07 21:12:47 UTC (rev 188162)
+++ trunk/Source/WebCore/page/FrameView.h 2015-08-07 21:25:34 UTC (rev 188163)
@@ -117,7 +117,7 @@
bool isInLayout() const { return m_layoutPhase == InLayout; }
WEBCORE_EXPORT bool inPaintableState() { return m_layoutPhase != InLayout && m_layoutPhase != InViewSizeAdjust && m_layoutPhase != InPostLayout; }
- RenderObject* layoutRoot(bool _onlyDuringLayout_ = false) const;
+ RenderElement* layoutRoot() const { return m_layoutRoot; }
void clearLayoutRoot() { m_layoutRoot = nullptr; }
int layoutCount() const { return m_layoutCount; }
@@ -696,7 +696,7 @@
Timer m_layoutTimer;
bool m_delayedLayout;
- RenderElement* m_layoutRoot;
+ RenderElement* m_layoutRoot { nullptr };
LayoutPhase m_layoutPhase;
bool m_layoutSchedulingEnabled;
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (188162 => 188163)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2015-08-07 21:12:47 UTC (rev 188162)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2015-08-07 21:25:34 UTC (rev 188163)
@@ -2347,7 +2347,7 @@
}
// If layout is limited to a subtree, the subtree root's logical width does not change.
- if (element() && view().frameView().layoutRoot(true) == this)
+ if (element() && !view().frameView().layoutPending() && view().frameView().layoutRoot() == this)
return;
// The parent box is flexing us, so it has increased or decreased our
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (188162 => 188163)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2015-08-07 21:12:47 UTC (rev 188162)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2015-08-07 21:25:34 UTC (rev 188163)
@@ -1073,6 +1073,24 @@
RenderObject::willBeRemovedFromTree();
}
+inline void RenderElement::clearLayoutRootIfNeeded() const
+{
+ if (documentBeingDestroyed())
+ return;
+
+ if (view().frameView().layoutRoot() != this)
+ return;
+
+ // Normally when a renderer is detached from the tree, the appropriate dirty bits get set
+ // which ensures that this renderer is no longer the layout root.
+ ASSERT_NOT_REACHED();
+
+ // This indicates a failure to layout the child, which is why
+ // the layout root is still set to |this|. Make sure to clear it
+ // since we are getting destroyed.
+ view().frameView().clearLayoutRoot();
+}
+
void RenderElement::willBeDestroyed()
{
animation().cancelAnimations(*this);
@@ -1093,6 +1111,7 @@
}
}
#endif
+ clearLayoutRootIfNeeded();
}
void RenderElement::setNeedsPositionedMovementLayout(const RenderStyle* oldStyle)
Modified: trunk/Source/WebCore/rendering/RenderElement.h (188162 => 188163)
--- trunk/Source/WebCore/rendering/RenderElement.h 2015-08-07 21:12:47 UTC (rev 188162)
+++ trunk/Source/WebCore/rendering/RenderElement.h 2015-08-07 21:25:34 UTC (rev 188163)
@@ -298,6 +298,8 @@
bool getLeadingCorner(FloatPoint& output) const;
bool getTrailingCorner(FloatPoint& output) const;
+ void clearLayoutRootIfNeeded() const;
+
unsigned m_baseTypeFlags : 6;
unsigned m_ancestorLineBoxDirty : 1;
unsigned m_hasInitializedStyle : 1;
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (188162 => 188163)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2015-08-07 21:12:47 UTC (rev 188162)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2015-08-07 21:25:34 UTC (rev 188163)
@@ -1876,20 +1876,6 @@
|| view().selectionUnsplitEnd() == this;
}
-inline void RenderObject::clearLayoutRootIfNeeded() const
-{
- if (documentBeingDestroyed())
- return;
-
- if (view().frameView().layoutRoot() == this) {
- ASSERT_NOT_REACHED();
- // This indicates a failure to layout the child, which is why
- // the layout root is still set to |this|. Make sure to clear it
- // since we are getting destroyed.
- view().frameView().clearLayoutRoot();
- }
-}
-
void RenderObject::willBeDestroyed()
{
// For accessibility management, notify the parent of the imminent change to its child set.
@@ -1913,7 +1899,6 @@
downcast<RenderLayerModelObject>(*this).destroyLayer();
}
- clearLayoutRootIfNeeded();
removeRareData();
}
Modified: trunk/Source/WebCore/rendering/RenderObject.h (188162 => 188163)
--- trunk/Source/WebCore/rendering/RenderObject.h 2015-08-07 21:12:47 UTC (rev 188162)
+++ trunk/Source/WebCore/rendering/RenderObject.h 2015-08-07 21:25:34 UTC (rev 188163)
@@ -866,7 +866,6 @@
void adjustRectForOutlineAndShadow(LayoutRect&) const;
- void clearLayoutRootIfNeeded() const;
virtual void willBeDestroyed();
virtual void insertedIntoTree();