Title: [238349] trunk
Revision
238349
Author
za...@apple.com
Date
2018-11-17 08:11:24 -0800 (Sat, 17 Nov 2018)

Log Message

[LFC][IFC] InlineFormattingState::addDetachingRule should accumulate rules.
https://bugs.webkit.org/show_bug.cgi?id=191801

Reviewed by Antti Koivisto.

Source/WebCore:

before<span style="position: relative">positioned</span>after
In the example above the <positioned> inline box has both the BreakAtStart and the BreakAtEnd rules.
While walking through the inline tree, we add BreakAtStart first and when we figure it's the last child too,
we add BreakAtEnd as well. BreakAtEnd should not clear the BreakAtStart rule.

Test: fast/inline/simple-inline-with-out-of-flow-descendant2.html

* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):
* layout/inlineformatting/InlineFormattingState.cpp:
(WebCore::Layout::InlineFormattingState::addDetachingRule):
* layout/inlineformatting/InlineFormattingState.h:
(WebCore::Layout::InlineFormattingState::addDetachingRule): Deleted.

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

LayoutTests:

* fast/inline/simple-inline-with-out-of-flow-descendant2-expected.txt: Added.
* fast/inline/simple-inline-with-out-of-flow-descendant2.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238348 => 238349)


--- trunk/LayoutTests/ChangeLog	2018-11-17 15:13:07 UTC (rev 238348)
+++ trunk/LayoutTests/ChangeLog	2018-11-17 16:11:24 UTC (rev 238349)
@@ -1,3 +1,13 @@
+2018-11-17  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][IFC] InlineFormattingState::addDetachingRule should accumulate rules.
+        https://bugs.webkit.org/show_bug.cgi?id=191801
+
+        Reviewed by Antti Koivisto.
+
+        * fast/inline/simple-inline-with-out-of-flow-descendant2-expected.txt: Added.
+        * fast/inline/simple-inline-with-out-of-flow-descendant2.html: Added.
+
 2018-11-17  Jonathan Hammer  <jonat...@e3software.com>
 
         Caret stops blinking after context menu shown

Added: trunk/LayoutTests/fast/inline/simple-inline-with-out-of-flow-descendant2-expected.txt (0 => 238349)


--- trunk/LayoutTests/fast/inline/simple-inline-with-out-of-flow-descendant2-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/simple-inline-with-out-of-flow-descendant2-expected.txt	2018-11-17 16:11:24 UTC (rev 238349)
@@ -0,0 +1,15 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+layer at (8,8) size 202x202 clip at (9,9) size 200x200
+  RenderBlock {DIV} at (0,0) size 202x202 [border: (1px solid #008000)]
+    RenderText {#text} at (1,1) size 31x14
+      text run at (1,1) width 31: "before"
+    RenderText {#text} at (62,1) size 23x14
+      text run at (62,1) width 23: "after"
+layer at (108,108) size 32x14
+  RenderInline (relative positioned) {SPAN} at (0,0) size 32x14
+    RenderText {#text} at (31,1) size 32x14
+      text run at (31,1) width 32: "nested"

Added: trunk/LayoutTests/fast/inline/simple-inline-with-out-of-flow-descendant2.html (0 => 238349)


--- trunk/LayoutTests/fast/inline/simple-inline-with-out-of-flow-descendant2.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/simple-inline-with-out-of-flow-descendant2.html	2018-11-17 16:11:24 UTC (rev 238349)
@@ -0,0 +1,17 @@
+<style>
+.inlineRoot {
+	border: 1px solid green;
+	width: 200px;
+	height: 200px;
+	overflow: hidden;
+	font-size: 12px;
+}
+
+.blockRoot {
+	position: relative;
+	top: 100px;
+	left: 100px;
+}
+</style>
+
+<div class=inlineRoot>before<span class=blockRoot>nested</span>after</div>

Modified: trunk/Source/WebCore/ChangeLog (238348 => 238349)


--- trunk/Source/WebCore/ChangeLog	2018-11-17 15:13:07 UTC (rev 238348)
+++ trunk/Source/WebCore/ChangeLog	2018-11-17 16:11:24 UTC (rev 238349)
@@ -1,3 +1,24 @@
+2018-11-17  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][IFC] InlineFormattingState::addDetachingRule should accumulate rules.
+        https://bugs.webkit.org/show_bug.cgi?id=191801
+
+        Reviewed by Antti Koivisto.
+
+        before<span style="position: relative">positioned</span>after
+        In the example above the <positioned> inline box has both the BreakAtStart and the BreakAtEnd rules.
+        While walking through the inline tree, we add BreakAtStart first and when we figure it's the last child too,
+        we add BreakAtEnd as well. BreakAtEnd should not clear the BreakAtStart rule.
+
+        Test: fast/inline/simple-inline-with-out-of-flow-descendant2.html
+
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):
+        * layout/inlineformatting/InlineFormattingState.cpp:
+        (WebCore::Layout::InlineFormattingState::addDetachingRule):
+        * layout/inlineformatting/InlineFormattingState.h:
+        (WebCore::Layout::InlineFormattingState::addDetachingRule): Deleted.
+
 2018-11-17  Jonathan Hammer  <jonat...@e3software.com>
 
         Caret stops blinking after context menu shown

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (238348 => 238349)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2018-11-17 15:13:07 UTC (rev 238348)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2018-11-17 16:11:24 UTC (rev 238349)
@@ -175,7 +175,7 @@
         auto detachingRules = inlineFormattingState().detachingRules(inlineItem.layoutBox());
 
         // #1
-        if (!detachingRules) {
+        if (detachingRules.isEmpty()) {
             uncommittedLength += currentLength();
             firstUncommittedInlineItem = !firstUncommittedInlineItem ? &inlineItem : firstUncommittedInlineItem;
             continue;
@@ -194,7 +194,7 @@
         };
 
         // #2
-        if (*detachingRules == InlineFormattingState::DetachingRule::BreakAtStart) {
+        if (detachingRules == InlineFormattingState::DetachingRule::BreakAtStart) {
             commit();
             firstUncommittedInlineItem = &inlineItem;
             uncommittedLength = currentLength();
@@ -202,7 +202,7 @@
         }
 
         // #3
-        if (*detachingRules == InlineFormattingState::DetachingRule::BreakAtEnd) {
+        if (detachingRules == InlineFormattingState::DetachingRule::BreakAtEnd) {
             ASSERT(firstUncommittedInlineItem);
             uncommittedLength += currentLength();
             commit();
@@ -455,7 +455,7 @@
     if (root.establishesFormattingContext() && &root != &(this->root())) {
         // Skip formatting root subtree. They are not part of this inline formatting context.
         inlineRunProvider.append(root);
-        inlineFormattingState.addDetachingRule(root, { InlineFormattingState::DetachingRule::BreakAtStart, InlineFormattingState::DetachingRule::BreakAtEnd });
+        inlineFormattingState.setDetachingRules(root, { InlineFormattingState::DetachingRule::BreakAtStart, InlineFormattingState::DetachingRule::BreakAtEnd });
         return;
     }
 

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.cpp (238348 => 238349)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.cpp	2018-11-17 15:13:07 UTC (rev 238348)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.cpp	2018-11-17 16:11:24 UTC (rev 238349)
@@ -50,8 +50,13 @@
     return std::make_unique<InlineFormattingContext>(formattingContextRoot, *this);
 }
 
-std::optional<InlineFormattingState::DetachingRules> InlineFormattingState::detachingRules(const Box& layoutBox) const
+void InlineFormattingState::addDetachingRule(const Box& layoutBox, DetachingRule detachingRule)
 {
+    m_detachingRules.add(&layoutBox, DetachingRule { }).iterator->value.add(detachingRule);
+}
+
+OptionSet<InlineFormattingState::DetachingRule> InlineFormattingState::detachingRules(const Box& layoutBox) const
+{
     auto detachingRules = m_detachingRules.get(&layoutBox);
     if (!detachingRules)
         return { };

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h (238348 => 238349)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h	2018-11-17 15:13:07 UTC (rev 238348)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingState.h	2018-11-17 16:11:24 UTC (rev 238349)
@@ -70,16 +70,17 @@
         BreakAtStart = 1 << 0,
         BreakAtEnd = 1 << 1
     };
-    using DetachingRules = OptionSet<DetachingRule>;
-    std::optional<DetachingRules> detachingRules(const Box& layoutBox) const;
-    void addDetachingRule(const Box& layoutBox, DetachingRules detachingRules) { m_detachingRules.set(&layoutBox, detachingRules); }
+    void addDetachingRule(const Box& layoutBox, DetachingRule);
 
+    OptionSet<DetachingRule> detachingRules(const Box& layoutBox) const;
+    void setDetachingRules(const Box& layoutBox, OptionSet<DetachingRule> detachingRules) { m_detachingRules.set(&layoutBox, detachingRules); }
+
     // Temp
     InlineRuns& inlineRuns() { return m_inlineRuns; }
     void appendInlineRun(InlineRun inlineRun) { m_inlineRuns.append(inlineRun); }
 
 private:
-    using DetachingRulesForInlineItems = HashMap<const Box*, DetachingRules>;
+    using DetachingRulesForInlineItems = HashMap<const Box*, OptionSet<DetachingRule>>;
 
     InlineContent m_inlineContent;
     InlineRuns m_inlineRuns;

Modified: trunk/Tools/ChangeLog (238348 => 238349)


--- trunk/Tools/ChangeLog	2018-11-17 15:13:07 UTC (rev 238348)
+++ trunk/Tools/ChangeLog	2018-11-17 16:11:24 UTC (rev 238349)
@@ -1,3 +1,12 @@
+2018-11-17  Zalan Bujtas  <za...@apple.com>
+
+        [LFC][IFC] InlineFormattingState::addDetachingRule should accumulate rules.
+        https://bugs.webkit.org/show_bug.cgi?id=191801
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
 2018-11-17  Jer Noble  <jer.no...@apple.com>
 
         Regression(r233865): Causes synchronous IPC in the middle of layout

Modified: trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt (238348 => 238349)


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-11-17 15:13:07 UTC (rev 238348)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2018-11-17 16:11:24 UTC (rev 238349)
@@ -71,6 +71,7 @@
 fast/inline/simple-shrink-to-fit-inline-block.html
 fast/inline/simple-inline-inflow-positioned.html
 fast/inline/simple-inline-with-out-of-flow-descendant.html
+fast/inline/simple-inline-with-out-of-flow-descendant2.html
 fast/block/basic/height-percentage-simple.html
 fast/block/basic/child-block-level-box-with-height-percent.html
 fast/block/basic/quirk-mode-percent-height.html
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to