Skip to content

Commit 4bf7648

Browse files
author
Robert Hogan
committed
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. Canonical link: https://commits.webkit.org/92073@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@103772 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 46a6ade commit 4bf7648

6 files changed

Lines changed: 53 additions & 2 deletions

File tree

LayoutTests/ChangeLog

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
2011-12-28 Robert Hogan <robert@webkit.org>
2+
3+
Inline flow not learning height of all text descendants
4+
https://bugs.webkit.org/show_bug.cgi?id=75305
5+
6+
Reviewed by Dan Bernstein.
7+
8+
* fast/inline/nested-text-descendants-expected.html: Added.
9+
* fast/inline/nested-text-descendants.html: Added.
10+
111
2011-12-28 Sheriff Bot <webkit.review.bot@gmail.com>
212

313
Unreviewed, rolling out r103620.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<html>
2+
<body>
3+
<span style="outline: 1px dotted blue;">&#x200b;<span style="margin: 0 10px;"></span>text</span>
4+
</body>
5+
</html>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<html>
2+
<body>
3+
<span style="outline: 1px dotted blue;"> <span style="margin: 0 10px;"></span> text</span>
4+
</body>
5+
</html>

Source/WebCore/ChangeLog

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
2011-12-28 Robert Hogan <robert@webkit.org>
2+
3+
Inline flow not learning height of all text descendants
4+
https://bugs.webkit.org/show_bug.cgi?id=75305
5+
6+
Reviewed by Dan Bernstein.
7+
8+
Tests: fast/inline/nested-text-descendants-expected.html
9+
fast/inline/nested-text-descendants.html
10+
11+
The root inline box would only learn it had text descendants if its first grandchild
12+
was text. It wasn't informed of subsequent text grandchildren so could not factor them
13+
into its calculation of the line height.
14+
To fix this, propagate the existence of a text descendant to the root inline box
15+
by walking up through the text child's ancestors.
16+
17+
* rendering/InlineFlowBox.cpp:
18+
(WebCore::setHasTextDescendantsOnAncestors):
19+
(WebCore::InlineFlowBox::addToLine):
20+
* rendering/InlineFlowBox.h:
21+
(WebCore::InlineFlowBox::setHasTextDescendants):
22+
123
2011-12-28 Sheriff Bot <webkit.review.bot@gmail.com>
224

325
Unreviewed, rolling out r103620.

Source/WebCore/rendering/InlineFlowBox.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ IntRect InlineFlowBox::roundedFrameRect() const
7878
return IntRect(snappedX, snappedY, snappedMaxX - snappedX, snappedMaxY - snappedY);
7979
}
8080

81+
static void setHasTextDescendantsOnAncestors(InlineFlowBox* box)
82+
{
83+
while (box && !box->hasTextDescendants()) {
84+
box->setHasTextDescendants();
85+
box = box->parent();
86+
}
87+
}
88+
8189
void InlineFlowBox::addToLine(InlineBox* child)
8290
{
8391
ASSERT(!child->parent());
@@ -99,10 +107,10 @@ void InlineFlowBox::addToLine(InlineBox* child)
99107
if (child->isText()) {
100108
if (child->renderer()->parent() == renderer())
101109
m_hasTextChildren = true;
102-
m_hasTextDescendants = true;
110+
setHasTextDescendantsOnAncestors(this);
103111
} else if (child->isInlineFlowBox()) {
104112
if (toInlineFlowBox(child)->hasTextDescendants())
105-
m_hasTextDescendants = true;
113+
setHasTextDescendantsOnAncestors(this);
106114
}
107115

108116
if (descendantsHaveSameLineHeightAndBaseline() && !child->renderer()->isPositioned()) {

Source/WebCore/rendering/InlineFlowBox.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ class InlineFlowBox : public InlineBox {
192192

193193
bool hasTextChildren() const { return m_hasTextChildren; }
194194
bool hasTextDescendants() const { return m_hasTextDescendants; }
195+
void setHasTextDescendants() { m_hasTextDescendants = true; }
195196

196197
void checkConsistency() const;
197198
void setHasBadChildList();

0 commit comments

Comments
 (0)