<!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>[248364] 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/248364">248364</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2019-08-07 07:23:54 -0700 (Wed, 07 Aug 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>[LFC] Introduce Layout::Phase class
https://bugs.webkit.org/show_bug.cgi?id=200473
<rdar://problem/53996061>

Reviewed by Antti Koivisto.

It helps to check whether we could run certain actions like layout while constructing the tree.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/LayoutState.h:
* layout/floats/FloatingContext.cpp:
* layout/inlineformatting/InlineLine.cpp:
* layout/layouttree/LayoutBox.cpp:
(WebCore::Layout::Box::establishesFormattingContext const):
(WebCore::Layout::Box::containingBlock const):
(WebCore::Layout::Box::formattingContextRoot const):
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::TreeBuilder::createLayoutTree):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreSourcestxt">trunk/Source/WebCore/Sources.txt</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorelayoutLayoutStatecpp">trunk/Source/WebCore/layout/LayoutState.cpp</a></li>
<li><a href="#trunkSourceWebCorelayoutLayoutStateh">trunk/Source/WebCore/layout/LayoutState.h</a></li>
<li><a href="#trunkSourceWebCorelayoutfloatsFloatingContextcpp">trunk/Source/WebCore/layout/floats/FloatingContext.cpp</a></li>
<li><a href="#trunkSourceWebCorelayoutinlineformattingInlineLinecpp">trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp</a></li>
<li><a href="#trunkSourceWebCorelayoutlayouttreeLayoutBoxcpp">trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp</a></li>
<li><a href="#trunkSourceWebCorelayoutlayouttreeLayoutTreeBuildercpp">trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorelayoutLayoutPhasecpp">trunk/Source/WebCore/layout/LayoutPhase.cpp</a></li>
<li><a href="#trunkSourceWebCorelayoutLayoutPhaseh">trunk/Source/WebCore/layout/LayoutPhase.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (248363 => 248364)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-08-07 12:41:01 UTC (rev 248363)
+++ trunk/Source/WebCore/ChangeLog      2019-08-07 14:23:54 UTC (rev 248364)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2019-08-07  Zalan Bujtas  <zalan@apple.com>
+
+        [LFC] Introduce Layout::Phase class
+        https://bugs.webkit.org/show_bug.cgi?id=200473
+        <rdar://problem/53996061>
+
+        Reviewed by Antti Koivisto.
+
+        It helps to check whether we could run certain actions like layout while constructing the tree.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * layout/LayoutState.h:
+        * layout/floats/FloatingContext.cpp:
+        * layout/inlineformatting/InlineLine.cpp:
+        * layout/layouttree/LayoutBox.cpp:
+        (WebCore::Layout::Box::establishesFormattingContext const):
+        (WebCore::Layout::Box::containingBlock const):
+        (WebCore::Layout::Box::formattingContextRoot const):
+        * layout/layouttree/LayoutTreeBuilder.cpp:
+        (WebCore::Layout::TreeBuilder::createLayoutTree):
+
</ins><span class="cx"> 2019-08-07  Chris Lord  <clord@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         context-attributes-alpha-depth-stencil-antialias fails on WPE WebKit
</span></span></pre></div>
<a id="trunkSourceWebCoreSourcestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Sources.txt (248363 => 248364)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Sources.txt 2019-08-07 12:41:01 UTC (rev 248363)
+++ trunk/Source/WebCore/Sources.txt    2019-08-07 14:23:54 UTC (rev 248364)
</span><span class="lines">@@ -1385,6 +1385,7 @@
</span><span class="cx"> layout/FormattingContextGeometry.cpp
</span><span class="cx"> layout/FormattingContextQuirks.cpp
</span><span class="cx"> layout/FormattingState.cpp
</span><ins>+layout/LayoutPhase.cpp
</ins><span class="cx"> layout/LayoutState.cpp
</span><span class="cx"> layout/Verification.cpp
</span><span class="cx"> layout/blockformatting/BlockFormattingContext.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (248363 => 248364)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj   2019-08-07 12:41:01 UTC (rev 248363)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj      2019-08-07 14:23:54 UTC (rev 248364)
</span><span class="lines">@@ -9134,6 +9134,7 @@
</span><span class="cx">          6F35EFAF2187CBD50044E0F4 /* InlineFormattingContextGeometry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InlineFormattingContextGeometry.cpp; sourceTree = "<group>"; };
</span><span class="cx">          6F3E1F5F2136141700A65A08 /* FloatBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FloatBox.cpp; sourceTree = "<group>"; };
</span><span class="cx">          6F3E1F612136141700A65A08 /* FloatBox.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FloatBox.h; sourceTree = "<group>"; };
</span><ins>+               6F4A5BD522F9F16B00A80F25 /* LayoutPhase.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutPhase.cpp; sourceTree = "<group>"; };
</ins><span class="cx">           6F73918C2106CEDD006AF262 /* LayoutUnits.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutUnits.h; sourceTree = "<group>"; };
</span><span class="cx">          6F7CA3C4208C2956002F29AB /* LayoutState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutState.h; sourceTree = "<group>"; };
</span><span class="cx">          6F7CA3C5208C2956002F29AB /* LayoutState.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutState.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -9184,6 +9185,7 @@
</span><span class="cx">          6FE7AA2621C37B6300296DCD /* MarginTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MarginTypes.h; sourceTree = "<group>"; };
</span><span class="cx">          6FE7CFA02177EEF1005B1573 /* InlineItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineItem.h; sourceTree = "<group>"; };
</span><span class="cx">          6FE9F09222211035004C5082 /* ContentChangeObserver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentChangeObserver.cpp; sourceTree = "<group>"; };
</span><ins>+               6FEFE81D22F9D22A00114927 /* LayoutPhase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LayoutPhase.h; sourceTree = "<group>"; };
</ins><span class="cx">           6FFDC43E212EFF1600A9CA91 /* FloatAvoider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FloatAvoider.cpp; sourceTree = "<group>"; };
</span><span class="cx">          6FFDC440212EFF1600A9CA91 /* FloatAvoider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatAvoider.h; sourceTree = "<group>"; };
</span><span class="cx">          709A01FD1E3D0BCC006B0D4C /* ModuleFetchFailureKind.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModuleFetchFailureKind.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -16350,6 +16352,8 @@
</span><span class="cx">                          115CFA75208AFE30001E6991 /* FormattingState.cpp */,
</span><span class="cx">                          115CFA74208AFE30001E6991 /* FormattingState.h */,
</span><span class="cx">                          115F7805209CBCBD00739C13 /* Invalidation.h */,
</span><ins>+                               6F4A5BD522F9F16B00A80F25 /* LayoutPhase.cpp */,
+                               6FEFE81D22F9D22A00114927 /* LayoutPhase.h */,
</ins><span class="cx">                           6F7CA3C5208C2956002F29AB /* LayoutState.cpp */,
</span><span class="cx">                          6F7CA3C4208C2956002F29AB /* LayoutState.h */,
</span><span class="cx">                          6F73918C2106CEDD006AF262 /* LayoutUnits.h */,
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutLayoutPhasecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/layout/LayoutPhase.cpp (0 => 248364)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/LayoutPhase.cpp                              (rev 0)
+++ trunk/Source/WebCore/layout/LayoutPhase.cpp 2019-08-07 14:23:54 UTC (rev 248364)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "LayoutPhase.h"
+
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+
+namespace WebCore {
+namespace Layout {
+
+static Phase& phase()
+{
+    static NeverDestroyed<Phase> phase;
+    return phase;
+}
+
+bool Phase::isInTreeBuilding()
+{ 
+    return *phase() && (*phase()).value() == Type::TreeBuilding;
+}
+
+bool Phase::isInLayout()
+{ 
+    return *phase() && (*phase()).value() == Type::Layout;
+}
+
+bool Phase::isInInvalidation()
+{ 
+    return *phase() && (*phase()).value() == Type::Invalidation;
+}
+
+PhaseScope::PhaseScope(Phase::Type type)
+{ 
+    // Should never nest states like calling TreeBuilding from Layout. 
+    ASSERT(!(*phase()).hasValue());
+    phase().set(type);
+}
+    
+PhaseScope::~PhaseScope()
+{
+    phase().reset();
+}
+
+}
+}
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCorelayoutLayoutPhaseh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/layout/LayoutPhase.h (0 => 248364)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/LayoutPhase.h                                (rev 0)
+++ trunk/Source/WebCore/layout/LayoutPhase.h   2019-08-07 14:23:54 UTC (rev 248364)
</span><span class="lines">@@ -0,0 +1,64 @@
</span><ins>+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+
+namespace WebCore {
+namespace Layout {
+
+class PhaseScope;
+
+class Phase {
+public:
+    enum class Type {
+        TreeBuilding,
+        Invalidation,
+        Layout
+    };
+    static bool isInTreeBuilding();
+    static bool isInLayout();
+    static bool isInInvalidation();
+
+private:
+    friend class PhaseScope;
+
+    void set(Type type) { m_type = type; }
+    void reset() { m_type = { }; }
+    Optional<Type> operator*() const { return m_type; }
+
+    Optional<Type> m_type;
+};
+
+class PhaseScope {
+public:
+    PhaseScope(Phase::Type);
+    ~PhaseScope();
+};
+
+}
+}
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCorelayoutLayoutStatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/LayoutState.cpp (248363 => 248364)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/LayoutState.cpp      2019-08-07 12:41:01 UTC (rev 248363)
+++ trunk/Source/WebCore/layout/LayoutState.cpp 2019-08-07 14:23:54 UTC (rev 248364)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> #include "Invalidation.h"
</span><span class="cx"> #include "LayoutBox.h"
</span><span class="cx"> #include "LayoutContainer.h"
</span><ins>+#include "LayoutPhase.h"
</ins><span class="cx"> #include "LayoutTreeBuilder.h"
</span><span class="cx"> #include "RenderView.h"
</span><span class="cx"> #include "TableFormattingContext.h"
</span><span class="lines">@@ -71,6 +72,8 @@
</span><span class="cx"> 
</span><span class="cx"> void LayoutState::updateLayout()
</span><span class="cx"> {
</span><ins>+    PhaseScope scope(Phase::Type::Layout);
+
</ins><span class="cx">     ASSERT(!m_formattingContextRootListForLayout.isEmpty());
</span><span class="cx">     for (auto* layoutRoot : m_formattingContextRootListForLayout)
</span><span class="cx">         layoutFormattingContextSubtree(*layoutRoot);
</span><span class="lines">@@ -94,6 +97,8 @@
</span><span class="cx"> 
</span><span class="cx"> void LayoutState::styleChanged(const Box& layoutBox, StyleDiff styleDiff)
</span><span class="cx"> {
</span><ins>+    PhaseScope scope(Phase::Type::Invalidation);
+
</ins><span class="cx">     auto& formattingState = formattingStateForBox(layoutBox);
</span><span class="cx">     const Container* invalidationRoot = nullptr;
</span><span class="cx">     if (is<BlockFormattingState>(formattingState))
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutLayoutStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/LayoutState.h (248363 => 248364)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/LayoutState.h        2019-08-07 12:41:01 UTC (rev 248363)
+++ trunk/Source/WebCore/layout/LayoutState.h   2019-08-07 14:23:54 UTC (rev 248364)
</span><span class="lines">@@ -36,9 +36,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
</del><span class="cx"> class RenderView;
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx"> namespace Display {
</span><span class="cx"> class Box;
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutfloatsFloatingContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/floats/FloatingContext.cpp (248363 => 248364)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/floats/FloatingContext.cpp   2019-08-07 12:41:01 UTC (rev 248363)
+++ trunk/Source/WebCore/layout/floats/FloatingContext.cpp      2019-08-07 14:23:54 UTC (rev 248364)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "DisplayBox.h"
</span><span class="cx"> #include "FloatAvoider.h"
</span><span class="cx"> #include "FloatBox.h"
</span><ins>+#include "FormattingContext.h"
</ins><span class="cx"> #include "LayoutBox.h"
</span><span class="cx"> #include "LayoutContainer.h"
</span><span class="cx"> #include "LayoutState.h"
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutinlineformattingInlineLinecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp (248363 => 248364)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp      2019-08-07 12:41:01 UTC (rev 248363)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLine.cpp 2019-08-07 14:23:54 UTC (rev 248364)
</span><span class="lines">@@ -28,6 +28,8 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
</span><span class="cx"> 
</span><ins>+#include "InlineFormattingContext.h"
+#include "TextUtil.h"
</ins><span class="cx"> #include <wtf/IsoMallocInlines.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutlayouttreeLayoutBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp (248363 => 248364)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp     2019-08-07 12:41:01 UTC (rev 248363)
+++ trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp        2019-08-07 14:23:54 UTC (rev 248364)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
</span><span class="cx"> 
</span><span class="cx"> #include "LayoutContainer.h"
</span><ins>+#include "LayoutPhase.h"
</ins><span class="cx"> #include "RenderStyle.h"
</span><span class="cx"> #include <wtf/IsoMallocInlines.h>
</span><span class="cx"> 
</span><span class="lines">@@ -65,6 +66,8 @@
</span><span class="cx"> 
</span><span class="cx"> bool Box::establishesFormattingContext() const
</span><span class="cx"> {
</span><ins>+    // We need the final tree structure to tell whether a box establishes a certain formatting context. 
+    ASSERT(!Phase::isInTreeBuilding());
</ins><span class="cx">     return establishesBlockFormattingContext() || establishesInlineFormattingContext() || establishesTableFormattingContext();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -177,6 +180,8 @@
</span><span class="cx"> 
</span><span class="cx"> const Container* Box::containingBlock() const
</span><span class="cx"> {
</span><ins>+    // Finding the containing block by traversing the tree during tree construction could provide incorrect result.
+    ASSERT(!Phase::isInTreeBuilding());
</ins><span class="cx">     // The containing block in which the root element lives is a rectangle called the initial containing block.
</span><span class="cx">     // For other elements, if the element's position is 'relative' or 'static', the containing block is formed by the
</span><span class="cx">     // content edge of the nearest block container ancestor box.
</span><span class="lines">@@ -210,6 +215,8 @@
</span><span class="cx"> 
</span><span class="cx"> const Container& Box::formattingContextRoot() const
</span><span class="cx"> {
</span><ins>+    // Finding the context root by traversing the tree during tree construction could provide incorrect result.
+    ASSERT(!Phase::isInTreeBuilding());
</ins><span class="cx">     // We should never need to ask this question on the ICB.
</span><span class="cx">     ASSERT(!isInitialContainingBlock());
</span><span class="cx">     // A box lives in the same formatting context as its containing block unless the containing block establishes a formatting context.
</span></span></pre></div>
<a id="trunkSourceWebCorelayoutlayouttreeLayoutTreeBuildercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (248363 => 248364)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp     2019-08-07 12:41:01 UTC (rev 248363)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp        2019-08-07 14:23:54 UTC (rev 248364)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include "LayoutChildIterator.h"
</span><span class="cx"> #include "LayoutContainer.h"
</span><span class="cx"> #include "LayoutDescendantIterator.h"
</span><ins>+#include "LayoutPhase.h"
</ins><span class="cx"> #include "LayoutState.h"
</span><span class="cx"> #include "RenderBlock.h"
</span><span class="cx"> #include "RenderChildIterator.h"
</span><span class="lines">@@ -69,6 +70,8 @@
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr<Container> TreeBuilder::createLayoutTree(const RenderView& renderView)
</span><span class="cx"> {
</span><ins>+    PhaseScope scope(Phase::Type::TreeBuilding);
+
</ins><span class="cx">     auto style = RenderStyle::clone(renderView.style());
</span><span class="cx">     style.setLogicalWidth(Length(renderView.width(), Fixed));
</span><span class="cx">     style.setLogicalHeight(Length(renderView.height(), Fixed));
</span></span></pre>
</div>
</div>

</body>
</html>