Title: [103772] trunk
Revision
103772
Author
[email protected]
Date
2011-12-28 11:18:05 -0800 (Wed, 28 Dec 2011)

Log Message

Inline flow not learning height of all text descendants
https://bugs.webkit.org/show_bug.cgi?id=75305

Reviewed by Dan Bernstein.

Source/WebCore:

Tests: fast/inline/nested-text-descendants-expected.html
       fast/inline/nested-text-descendants.html

The root inline box would only learn it had text descendants if its first grandchild
was text. It wasn't informed of subsequent text grandchildren so could not factor them
into its calculation of the line height.
To fix this, propagate the existence of a text descendant to the root inline box
by walking up through the text child's ancestors.

* rendering/InlineFlowBox.cpp:
(WebCore::setHasTextDescendantsOnAncestors):
(WebCore::InlineFlowBox::addToLine):
* rendering/InlineFlowBox.h:
(WebCore::InlineFlowBox::setHasTextDescendants):

LayoutTests:

* fast/inline/nested-text-descendants-expected.html: Added.
* fast/inline/nested-text-descendants.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (103771 => 103772)


--- trunk/LayoutTests/ChangeLog	2011-12-28 19:16:31 UTC (rev 103771)
+++ trunk/LayoutTests/ChangeLog	2011-12-28 19:18:05 UTC (rev 103772)
@@ -1,3 +1,13 @@
+2011-12-28  Robert Hogan  <[email protected]>
+
+        Inline flow not learning height of all text descendants
+        https://bugs.webkit.org/show_bug.cgi?id=75305
+
+        Reviewed by Dan Bernstein.
+
+        * fast/inline/nested-text-descendants-expected.html: Added.
+        * fast/inline/nested-text-descendants.html: Added.
+
 2011-12-28  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r103620.

Added: trunk/LayoutTests/fast/inline/nested-text-descendants-expected.html (0 => 103772)


--- trunk/LayoutTests/fast/inline/nested-text-descendants-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/nested-text-descendants-expected.html	2011-12-28 19:18:05 UTC (rev 103772)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<span style="outline: 1px dotted blue;">&#x200b;<span style="margin: 0 10px;"></span>text</span>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/inline/nested-text-descendants-expected.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/inline/nested-text-descendants.html (0 => 103772)


--- trunk/LayoutTests/fast/inline/nested-text-descendants.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/nested-text-descendants.html	2011-12-28 19:18:05 UTC (rev 103772)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<span style="outline: 1px dotted blue;"> <span style="margin: 0 10px;"></span> text</span>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/inline/nested-text-descendants.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (103771 => 103772)


--- trunk/Source/WebCore/ChangeLog	2011-12-28 19:16:31 UTC (rev 103771)
+++ trunk/Source/WebCore/ChangeLog	2011-12-28 19:18:05 UTC (rev 103772)
@@ -1,3 +1,25 @@
+2011-12-28  Robert Hogan  <[email protected]>
+
+        Inline flow not learning height of all text descendants
+        https://bugs.webkit.org/show_bug.cgi?id=75305
+
+        Reviewed by Dan Bernstein.
+
+        Tests: fast/inline/nested-text-descendants-expected.html
+               fast/inline/nested-text-descendants.html
+
+        The root inline box would only learn it had text descendants if its first grandchild
+        was text. It wasn't informed of subsequent text grandchildren so could not factor them 
+        into its calculation of the line height.
+        To fix this, propagate the existence of a text descendant to the root inline box
+        by walking up through the text child's ancestors.
+
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::setHasTextDescendantsOnAncestors):
+        (WebCore::InlineFlowBox::addToLine):
+        * rendering/InlineFlowBox.h:
+        (WebCore::InlineFlowBox::setHasTextDescendants):
+
 2011-12-28  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r103620.

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (103771 => 103772)


--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2011-12-28 19:16:31 UTC (rev 103771)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2011-12-28 19:18:05 UTC (rev 103772)
@@ -78,6 +78,14 @@
     return IntRect(snappedX, snappedY, snappedMaxX - snappedX, snappedMaxY - snappedY);
 }
 
+static void setHasTextDescendantsOnAncestors(InlineFlowBox* box)
+{
+    while (box && !box->hasTextDescendants()) {
+        box->setHasTextDescendants();
+        box = box->parent();
+    }
+}
+
 void InlineFlowBox::addToLine(InlineBox* child) 
 {
     ASSERT(!child->parent());
@@ -99,10 +107,10 @@
     if (child->isText()) {
         if (child->renderer()->parent() == renderer())
             m_hasTextChildren = true;
-        m_hasTextDescendants = true;
+        setHasTextDescendantsOnAncestors(this);
     } else if (child->isInlineFlowBox()) {
         if (toInlineFlowBox(child)->hasTextDescendants())
-            m_hasTextDescendants = true;
+            setHasTextDescendantsOnAncestors(this);
     }
 
     if (descendantsHaveSameLineHeightAndBaseline() && !child->renderer()->isPositioned()) {

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.h (103771 => 103772)


--- trunk/Source/WebCore/rendering/InlineFlowBox.h	2011-12-28 19:16:31 UTC (rev 103771)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.h	2011-12-28 19:18:05 UTC (rev 103772)
@@ -192,6 +192,7 @@
 
     bool hasTextChildren() const { return m_hasTextChildren; }
     bool hasTextDescendants() const { return m_hasTextDescendants; }
+    void setHasTextDescendants() { m_hasTextDescendants = true; }
 
     void checkConsistency() const;
     void setHasBadChildList();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to