<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[224637] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/224637">224637</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2017-11-09 10:50:03 -0800 (Thu, 09 Nov 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[LayoutState cleanup] Remove renderer data members from state maintainers.
https://bugs.webkit.org/show_bug.cgi?id=179483
<rdar://problem/35442548>

Reviewed by Darin Adler.

Although layout is not supposed to mutate the tree anymore, it's safer to use LayoutContext instead.

No change in functionality.

* page/LayoutContext.cpp:
* page/LayoutContext.h:
* rendering/LayoutState.cpp:
(WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
(WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
(WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer):
(WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer):
* rendering/LayoutState.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageLayoutContextcpp">trunk/Source/WebCore/page/LayoutContext.cpp</a></li>
<li><a href="#trunkSourceWebCorepageLayoutContexth">trunk/Source/WebCore/page/LayoutContext.h</a></li>
<li><a href="#trunkSourceWebCorerenderingLayoutStatecpp">trunk/Source/WebCore/rendering/LayoutState.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingLayoutStateh">trunk/Source/WebCore/rendering/LayoutState.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (224636 => 224637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2017-11-09 18:37:09 UTC (rev 224636)
+++ trunk/Source/WebCore/ChangeLog      2017-11-09 18:50:03 UTC (rev 224637)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2017-11-09  Zalan Bujtas  <zalan@apple.com>
+
+        [LayoutState cleanup] Remove renderer data members from state maintainers.
+        https://bugs.webkit.org/show_bug.cgi?id=179483
+        <rdar://problem/35442548>
+
+        Reviewed by Darin Adler.
+
+        Although layout is not supposed to mutate the tree anymore, it's safer to use LayoutContext instead.
+
+        No change in functionality.
+
+        * page/LayoutContext.cpp:
+        * page/LayoutContext.h:
+        * rendering/LayoutState.cpp:
+        (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
+        (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
+        (WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer):
+        (WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer):
+        * rendering/LayoutState.h:
+
</ins><span class="cx"> 2017-11-09  Maciej Stachowiak  <mjs@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Remove support for iOS-only softbank-sjis encoding if possible
</span></span></pre></div>
<a id="trunkSourceWebCorepageLayoutContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/LayoutContext.cpp (224636 => 224637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/LayoutContext.cpp      2017-11-09 18:37:09 UTC (rev 224636)
+++ trunk/Source/WebCore/page/LayoutContext.cpp 2017-11-09 18:50:03 UTC (rev 224637)
</span><span class="lines">@@ -573,11 +573,6 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-void LayoutContext::popLayoutState(RenderObject&)
-{
-    return popLayoutState();
-}
-    
</del><span class="cx"> bool LayoutContext::pushLayoutState(RenderBox& renderer, const LayoutSize& offset, LayoutUnit pageHeight, bool pageHeightChanged)
</span><span class="cx"> {
</span><span class="cx">     // We push LayoutState even if layoutState is disabled because it stores layoutDelta too.
</span></span></pre></div>
<a id="trunkSourceWebCorepageLayoutContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/LayoutContext.h (224636 => 224637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/LayoutContext.h        2017-11-09 18:37:09 UTC (rev 224636)
+++ trunk/Source/WebCore/page/LayoutContext.h   2017-11-09 18:50:03 UTC (rev 224637)
</span><span class="lines">@@ -92,10 +92,6 @@
</span><span class="cx"> 
</span><span class="cx">     void flushAsynchronousTasks();
</span><span class="cx"> 
</span><del>-    // Subtree push/pop
-    void pushLayoutState(RenderElement&);
-    bool pushLayoutStateForPaginationIfNeeded(RenderBlockFlow&);
-    void popLayoutState(RenderObject&);
</del><span class="cx">     LayoutState* layoutState() const;
</span><span class="cx">     // Returns true if layoutState should be used for its cached offset and clip.
</span><span class="cx">     bool isPaintOffsetCacheEnabled() const { return !m_paintOffsetCacheDisableCount && layoutState(); }
</span><span class="lines">@@ -117,6 +113,7 @@
</span><span class="cx">     friend class LayoutStateMaintainer;
</span><span class="cx">     friend class LayoutStateDisabler;
</span><span class="cx">     friend class SubtreeLayoutStateMaintainer;
</span><ins>+    friend class PaginatedLayoutStateMaintainer;
</ins><span class="cx"> 
</span><span class="cx">     bool canPerformLayout() const;
</span><span class="cx">     bool layoutDisallowed() const { return m_layoutDisallowedCount; }
</span><span class="lines">@@ -138,6 +135,9 @@
</span><span class="cx">     void startLayoutAtMainFrameViewIfNeeded();
</span><span class="cx"> 
</span><span class="cx">     // These functions may only be accessed by LayoutStateMaintainer.
</span><ins>+    // Subtree push/pop
+    void pushLayoutState(RenderElement&);
+    bool pushLayoutStateForPaginationIfNeeded(RenderBlockFlow&);
</ins><span class="cx">     bool pushLayoutState(RenderBox& renderer, const LayoutSize& offset, LayoutUnit pageHeight = 0, bool pageHeightChanged = false);
</span><span class="cx">     void popLayoutState();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingLayoutStatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/LayoutState.cpp (224636 => 224637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/LayoutState.cpp   2017-11-09 18:37:09 UTC (rev 224636)
+++ trunk/Source/WebCore/rendering/LayoutState.cpp      2017-11-09 18:50:03 UTC (rev 224637)
</span><span class="lines">@@ -273,14 +273,14 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> LayoutStateMaintainer::LayoutStateMaintainer(RenderBox& root, LayoutSize offset, bool disablePaintOffsetCache, LayoutUnit pageHeight, bool pageHeightChanged)
</span><del>-    : m_layoutContext(root.view().frameView().layoutContext())
</del><ins>+    : m_context(root.view().frameView().layoutContext())
</ins><span class="cx">     , m_paintOffsetCacheIsDisabled(disablePaintOffsetCache)
</span><span class="cx"> {
</span><span class="cx">     push(root, offset, pageHeight, pageHeightChanged);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutStateMaintainer::LayoutStateMaintainer(LayoutContext& layoutContext)
-    : m_layoutContext(layoutContext)
</del><ins>+LayoutStateMaintainer::LayoutStateMaintainer(LayoutContext& context)
+    : m_context(context)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -297,11 +297,11 @@
</span><span class="cx">     ASSERT(!m_didCallPush);
</span><span class="cx">     m_didCallPush = true;
</span><span class="cx">     // We push state even if disabled, because we still need to store layoutDelta
</span><del>-    m_didPushLayoutState = m_layoutContext.pushLayoutState(root, offset, pageHeight, pageHeightChanged);
</del><ins>+    m_didPushLayoutState = m_context.pushLayoutState(root, offset, pageHeight, pageHeightChanged);
</ins><span class="cx">     if (!m_didPushLayoutState)
</span><span class="cx">         return;
</span><span class="cx">     if (m_paintOffsetCacheIsDisabled)
</span><del>-        m_layoutContext.disablePaintOffsetCache();
</del><ins>+        m_context.disablePaintOffsetCache();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void LayoutStateMaintainer::pop()
</span><span class="lines">@@ -312,20 +312,20 @@
</span><span class="cx">         return;
</span><span class="cx">     if (!m_didPushLayoutState)
</span><span class="cx">         return;
</span><del>-    m_layoutContext.popLayoutState();
</del><ins>+    m_context.popLayoutState();
</ins><span class="cx">     if (m_paintOffsetCacheIsDisabled)
</span><del>-        m_layoutContext.enablePaintOffsetCache();
</del><ins>+        m_context.enablePaintOffsetCache();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-LayoutStateDisabler::LayoutStateDisabler(LayoutContext& layoutContext)
-    : m_layoutContext(layoutContext)
</del><ins>+LayoutStateDisabler::LayoutStateDisabler(LayoutContext& context)
+    : m_context(context)
</ins><span class="cx"> {
</span><del>-    m_layoutContext.disablePaintOffsetCache();
</del><ins>+    m_context.disablePaintOffsetCache();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> LayoutStateDisabler::~LayoutStateDisabler()
</span><span class="cx"> {
</span><del>-    m_layoutContext.enablePaintOffsetCache();
</del><ins>+    m_context.enablePaintOffsetCache();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool shouldDisablePaintOffsetCacheForSubtree(RenderElement& subtreeLayoutRoot)
</span><span class="lines">@@ -338,13 +338,12 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer(RenderElement* subtreeLayoutRoot)
</span><del>-    : m_subtreeLayoutRoot(subtreeLayoutRoot)
</del><span class="cx"> {
</span><del>-    if (m_subtreeLayoutRoot) {
-        auto& layoutContext = m_subtreeLayoutRoot->view().frameView().layoutContext();
-        layoutContext.pushLayoutState(*m_subtreeLayoutRoot);
-        if (shouldDisablePaintOffsetCacheForSubtree(*m_subtreeLayoutRoot)) {
-            layoutContext.disablePaintOffsetCache();
</del><ins>+    if (subtreeLayoutRoot) {
+        m_context = &subtreeLayoutRoot->view().frameView().layoutContext();
+        m_context->pushLayoutState(*subtreeLayoutRoot);
+        if (shouldDisablePaintOffsetCacheForSubtree(*subtreeLayoutRoot)) {
+            m_context->disablePaintOffsetCache();
</ins><span class="cx">             m_didDisablePaintOffsetCache = true;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -352,17 +351,16 @@
</span><span class="cx"> 
</span><span class="cx"> SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer()
</span><span class="cx"> {
</span><del>-    if (m_subtreeLayoutRoot) {
-        auto& layoutContext = m_subtreeLayoutRoot->view().frameView().layoutContext();
-        layoutContext.popLayoutState(*m_subtreeLayoutRoot);
</del><ins>+    if (m_context) {
+        m_context->popLayoutState();
</ins><span class="cx">         if (m_didDisablePaintOffsetCache)
</span><del>-            layoutContext.enablePaintOffsetCache();
</del><ins>+            m_context->enablePaintOffsetCache();
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer(RenderBlockFlow& flow)
</span><del>-    : m_flow(flow)
-    , m_pushed(flow.view().frameView().layoutContext().pushLayoutStateForPaginationIfNeeded(flow))
</del><ins>+    : m_context(flow.view().frameView().layoutContext())
+    , m_pushed(m_context.pushLayoutStateForPaginationIfNeeded(flow))
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -369,7 +367,7 @@
</span><span class="cx"> PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer()
</span><span class="cx"> {
</span><span class="cx">     if (m_pushed)
</span><del>-        m_flow.view().frameView().layoutContext().popLayoutState(m_flow);
</del><ins>+        m_context.popLayoutState();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingLayoutStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/LayoutState.h (224636 => 224637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/LayoutState.h     2017-11-09 18:37:09 UTC (rev 224636)
+++ trunk/Source/WebCore/rendering/LayoutState.h        2017-11-09 18:50:03 UTC (rev 224637)
</span><span class="lines">@@ -149,7 +149,7 @@
</span><span class="cx">     bool didPush() const { return m_didCallPush; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    LayoutContext& m_layoutContext;
</del><ins>+    LayoutContext& m_context;
</ins><span class="cx">     bool m_paintOffsetCacheIsDisabled { false };
</span><span class="cx">     bool m_didCallPush { false };
</span><span class="cx">     bool m_didCallPop { false };
</span><span class="lines">@@ -162,7 +162,7 @@
</span><span class="cx">     ~SubtreeLayoutStateMaintainer();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    RenderElement* m_subtreeLayoutRoot { nullptr };
</del><ins>+    LayoutContext* m_context { nullptr };
</ins><span class="cx">     bool m_didDisablePaintOffsetCache { false };
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -173,7 +173,7 @@
</span><span class="cx">     ~LayoutStateDisabler();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    LayoutContext& m_layoutContext;
</del><ins>+    LayoutContext& m_context;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> class PaginatedLayoutStateMaintainer {
</span><span class="lines">@@ -182,7 +182,7 @@
</span><span class="cx">     ~PaginatedLayoutStateMaintainer();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    RenderBlockFlow& m_flow;
</del><ins>+    LayoutContext& m_context;
</ins><span class="cx">     bool m_pushed { false };
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>