Title: [103851] trunk
Revision
103851
Author
rob...@webkit.org
Date
2011-12-30 12:58:29 -0800 (Fri, 30 Dec 2011)

Log Message

REGRESSION (r94492): Text is shifted to the right in some buttons in the Mac App Store
https://bugs.webkit.org/show_bug.cgi?id=74723

Reviewed by Dan Bernstein.

Source/WebCore:

Tests: fast/css/absolute-inline-alignment-2.html
       fast/css/absolute-inline-alignment.html

Inline positioned elements in the leading spaces of an inline run need to align to
adjacent text, so add them to the run as they're encountered.

* rendering/RenderBlockLineLayout.cpp:
(WebCore::LineInfo::LineInfo): Keep a count of positioned objects encountered when
 skipping leading whitespace.
(WebCore::LineInfo::runsFromLeadingWhitespace):
(WebCore::LineInfo::resetRunsFromLeadingWhitespace):
(WebCore::LineInfo::incrementRunsFromLeadingWhitespace):
(WebCore::RenderBlock::constructLine): Leading positioned objects should not be considered
 when deciding the number of runs in a line. Otherwise they would contribute towards line
 height themselves and prevent a free-standing BR following the positioned object from providing a full
 20px of height.
(WebCore::RenderBlock::layoutRunsAndFloatsInRange): Since a run containing line-breaks will enter
 skipLeadingWhitespace for each new line we reset the count every time so that the count of positioned
 objects we encounter only affects the line they appear on. This case is covered by
 fast/inline/styledEmptyInlinesWithBRs.html
(WebCore::RenderBlock::LineBreaker::skipLeadingWhitespace): Add a run for each inline positioned object
 encountered in leading white space. Keep a count of them so that they can be excluded from
 the total number of runs in constructLine.

LayoutTests:

* fast/css/absolute-inline-alignment-2-expected.html: Added.
* fast/css/absolute-inline-alignment-2.html: Added.
* fast/css/absolute-inline-alignment-expected.html: Added.
* fast/css/absolute-inline-alignment.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (103850 => 103851)


--- trunk/LayoutTests/ChangeLog	2011-12-30 20:53:28 UTC (rev 103850)
+++ trunk/LayoutTests/ChangeLog	2011-12-30 20:58:29 UTC (rev 103851)
@@ -1,3 +1,15 @@
+2011-12-30  Robert Hogan  <rob...@webkit.org>
+
+        REGRESSION (r94492): Text is shifted to the right in some buttons in the Mac App Store
+        https://bugs.webkit.org/show_bug.cgi?id=74723
+
+        Reviewed by Dan Bernstein.
+
+        * fast/css/absolute-inline-alignment-2-expected.html: Added.
+        * fast/css/absolute-inline-alignment-2.html: Added.
+        * fast/css/absolute-inline-alignment-expected.html: Added.
+        * fast/css/absolute-inline-alignment.html: Added.
+
 2011-12-30  Dale Curtis  <dalecur...@chromium.org>
 
         media/video-scales-in-media-document.html is Chromium specific

Added: trunk/LayoutTests/fast/css/absolute-inline-alignment-2-expected.html (0 => 103851)


--- trunk/LayoutTests/fast/css/absolute-inline-alignment-2-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/absolute-inline-alignment-2-expected.html	2011-12-30 20:58:29 UTC (rev 103851)
@@ -0,0 +1,25 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<style>
+    body {
+        height: 200%;
+    }
+    div {
+        width: 400px;
+        height: 25px;
+        background-color: silver;
+        text-align: center;
+        margin: 8px 0;
+    }
+    #absolute {
+        position: absolute;
+        width: 25px;
+        height: 25px;
+        background-color: rgba(0, 0, 255, 0.5);
+    }
+</style>
+<div dir="rtl">&#x200b;<span id="absolute"></span>Lorem ipsum dolor sit amet</span></div>
+<div dir="ltr">&#x200b;<span id="absolute"></span>Lorem ipsum dolor sit amet</span></div>
+<div>&#x200b;<span dir="rtl"><span id="absolute"></span>Lorem ipsum dolor sit amet</span></span></div>
+<div>&#x200b;<span id="absolute"></span>Lorem ipsum dolor sit amet</div>
+<div style="text-align: left;">&#x200b;<span dir="rtl"><span id="absolute"></span>Lorem ipsum dolor sit amet</span></span></div>
+<div style="text-align: right;">&#x200b;<span dir="rtl"><span id="absolute"></span>Lorem ipsum dolor sit amet</span></span></div>
Property changes on: trunk/LayoutTests/fast/css/absolute-inline-alignment-2-expected.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/css/absolute-inline-alignment-2.html (0 => 103851)


--- trunk/LayoutTests/fast/css/absolute-inline-alignment-2.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/absolute-inline-alignment-2.html	2011-12-30 20:58:29 UTC (rev 103851)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<style>
+    body {
+        height: 200%;
+    }
+    div {
+        width: 400px;
+        height: 25px;
+        background-color: silver;
+        text-align: center;
+        margin: 8px 0;
+    }
+    #absolute {
+        position: absolute;
+        width: 25px;
+        height: 25px;
+        background-color: rgba(0, 0, 255, 0.5);
+    }
+</style>
+<div dir="rtl"><span id="absolute"></span> Lorem ipsum dolor sit amet</span></div>
+<div dir="ltr"><span id="absolute"></span> Lorem ipsum dolor sit amet</span></div>
+<div><span dir="rtl"><span id="absolute"></span> Lorem ipsum dolor sit amet</span></span></div>
+<div> <span id="absolute"></span>Lorem ipsum dolor sit amet</div>
+<div style="text-align: left;"><span dir="rtl"><span id="absolute"></span> Lorem ipsum dolor sit amet</span></span></div>
+<div style="text-align: right;"><span dir="rtl"><span id="absolute"></span> Lorem ipsum dolor sit amet</span></span></div>
Property changes on: trunk/LayoutTests/fast/css/absolute-inline-alignment-2.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/css/absolute-inline-alignment-expected.html (0 => 103851)


--- trunk/LayoutTests/fast/css/absolute-inline-alignment-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/absolute-inline-alignment-expected.html	2011-12-30 20:58:29 UTC (rev 103851)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<style>
+    body {
+        height: 200%;
+    }
+    div {
+        width: 400px;
+        height: 25px;
+        background-color: silver;
+        text-align: center;
+        margin: 8px 0;
+    }
+
+    #float {
+        float: left;
+        width: 25px;
+        height: 25px;
+        background-color: rgba(0, 0, 255, 0.5);
+    }
+    #absolute {
+        position: absolute;
+        width: 25px;
+        height: 25px;
+        background-color: rgba(0, 0, 255, 0.5);
+    }
+</style>
+<div>&#x200b;<span id="absolute"></span>Lorem ipsum dolor sit amet</div>
+<div>&#x200b;<span id="absolute"></span>Lorem ipsum dolor sit amet</div>
+<div>&#x200b;<span id="absolute"></span>Lorem ipsum<span id="absolute"></span>    dolor sit amet</div>
+<div>&#x200b;<span id="absolute"></span><span id="absolute"></span>Lorem ipsum dolor sit amet</div>
+<div>&#x200b;<span id="absolute"></span><span id="absolute"></span>Lorem ipsum dolor sit amet</div>
+<div>&#x200b;<span id="absolute"></span>Lorem ipsum dolor sit amet</div>
+<div>&#x200b;<span id="absolute"></span>Lorem ipsum dolor sit amet</div>
+<div>&#x200b;<span id="float"></span>Lorem ipsum dolor sit amet</div>
+<div>&#x200b;<span id="absolute"></span>Lorem ipsum<span id="absolute"></span> dolor sit amet</div>
+<div>&#x200b;<span id="absolute"></span><span id="float"></span>Lorem ipsum dolor sit amet</div>
+<div>&#x200b;<span id="float"></span><span id="absolute"></span>Lorem ipsum dolor sit amet</div>
+<div>&#x200b;<span id="absolute"></span><span id="float"></span>Lorem ipsum dolor sit amet</div>
Property changes on: trunk/LayoutTests/fast/css/absolute-inline-alignment-expected.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/css/absolute-inline-alignment.html (0 => 103851)


--- trunk/LayoutTests/fast/css/absolute-inline-alignment.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/absolute-inline-alignment.html	2011-12-30 20:58:29 UTC (rev 103851)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<style>
+    body {
+        height: 200%;
+    }
+    div {
+        width: 400px;
+        height: 25px;
+        background-color: silver;
+        text-align: center;
+        margin: 8px 0;
+    }
+
+    #float {
+        float: left;
+        width: 25px;
+        height: 25px;
+        background-color: rgba(0, 0, 255, 0.5);
+    }
+    #absolute {
+        position: absolute;
+        width: 25px;
+        height: 25px;
+        background-color: rgba(0, 0, 255, 0.5);
+    }
+</style>
+<div><span id="absolute"></span>Lorem ipsum dolor sit amet</div>
+<div> <span id="absolute"></span> Lorem ipsum dolor sit amet</div>
+<div><span id="absolute"></span> Lorem ipsum<span id="absolute"></span>    dolor sit amet</div>
+<div><span id="absolute"></span> <span id="absolute"></span> Lorem ipsum dolor sit amet</div>
+<div>  <span id="absolute"></span> <span id="absolute"></span>    Lorem ipsum dolor sit amet</div>
+<div> <span id="absolute"></span>     Lorem ipsum dolor sit amet</div>
+<div> <span id="absolute"></span> Lorem ipsum dolor sit amet</div>
+<div><span id="float"></span>Lorem ipsum dolor sit amet</div>
+<div><span id="absolute"></span> Lorem ipsum<span id="absolute"></span>    dolor sit amet</div>
+<div> <span id="absolute"></span> <span id="float"></span> Lorem ipsum dolor sit amet</div>
+<div> <span id="float"></span> <span id="absolute"></span> Lorem ipsum dolor sit amet</div>
+<div>  <span id="absolute"></span> <span id="float"></span>    Lorem ipsum dolor sit amet</div>
Property changes on: trunk/LayoutTests/fast/css/absolute-inline-alignment.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (103850 => 103851)


--- trunk/Source/WebCore/ChangeLog	2011-12-30 20:53:28 UTC (rev 103850)
+++ trunk/Source/WebCore/ChangeLog	2011-12-30 20:58:29 UTC (rev 103851)
@@ -1,3 +1,34 @@
+2011-12-30  Robert Hogan  <rob...@webkit.org>
+
+        REGRESSION (r94492): Text is shifted to the right in some buttons in the Mac App Store
+        https://bugs.webkit.org/show_bug.cgi?id=74723
+
+        Reviewed by Dan Bernstein.
+
+        Tests: fast/css/absolute-inline-alignment-2.html
+               fast/css/absolute-inline-alignment.html
+
+        Inline positioned elements in the leading spaces of an inline run need to align to 
+        adjacent text, so add them to the run as they're encountered.
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::LineInfo::LineInfo): Keep a count of positioned objects encountered when
+         skipping leading whitespace.
+        (WebCore::LineInfo::runsFromLeadingWhitespace):
+        (WebCore::LineInfo::resetRunsFromLeadingWhitespace):
+        (WebCore::LineInfo::incrementRunsFromLeadingWhitespace):
+        (WebCore::RenderBlock::constructLine): Leading positioned objects should not be considered
+         when deciding the number of runs in a line. Otherwise they would contribute towards line 
+         height themselves and prevent a free-standing BR following the positioned object from providing a full 
+         20px of height.
+        (WebCore::RenderBlock::layoutRunsAndFloatsInRange): Since a run containing line-breaks will enter
+         skipLeadingWhitespace for each new line we reset the count every time so that the count of positioned
+         objects we encounter only affects the line they appear on. This case is covered by 
+         fast/inline/styledEmptyInlinesWithBRs.html
+        (WebCore::RenderBlock::LineBreaker::skipLeadingWhitespace): Add a run for each inline positioned object
+         encountered in leading white space. Keep a count of them so that they can be excluded from
+         the total number of runs in constructLine. 
+
 2011-12-30  Raymond Liu  <raymond....@intel.com>
 
         Remove unnecessary [Custom] attribute in CanvasRenderingContext2D.idl

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (103850 => 103851)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2011-12-30 20:53:28 UTC (rev 103850)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2011-12-30 20:58:29 UTC (rev 103851)
@@ -193,6 +193,7 @@
         , m_isEmpty(true)
         , m_previousLineBrokeCleanly(true)
         , m_floatPaginationStrut(0)
+        , m_runsFromLeadingWhitespace(0)
     { }
 
     bool isFirstLine() const { return m_isFirstLine; }
@@ -200,6 +201,9 @@
     bool isEmpty() const { return m_isEmpty; }
     bool previousLineBrokeCleanly() const { return m_previousLineBrokeCleanly; }
     LayoutUnit floatPaginationStrut() const { return m_floatPaginationStrut; }
+    unsigned runsFromLeadingWhitespace() const { return m_runsFromLeadingWhitespace; }
+    void resetRunsFromLeadingWhitespace() { m_runsFromLeadingWhitespace = 0; }
+    void incrementRunsFromLeadingWhitespace() { m_runsFromLeadingWhitespace++; }
 
     void setFirstLine(bool firstLine) { m_isFirstLine = firstLine; }
     void setLastLine(bool lastLine) { m_isLastLine = lastLine; }
@@ -224,6 +228,7 @@
     bool m_isEmpty;
     bool m_previousLineBrokeCleanly;
     LayoutUnit m_floatPaginationStrut;
+    unsigned m_runsFromLeadingWhitespace;
 };
 
 static inline LayoutUnit borderPaddingMarginStart(RenderInline* child)
@@ -479,10 +484,11 @@
 
     bool rootHasSelectedChildren = false;
     InlineFlowBox* parentBox = 0;
+    int runCount = bidiRuns.runCount() - lineInfo.runsFromLeadingWhitespace();
     for (BidiRun* r = bidiRuns.firstRun(); r; r = r->next()) {
         // Create a box for our object.
-        bool isOnlyRun = (bidiRuns.runCount() == 1);
-        if (bidiRuns.runCount() == 2 && !r->m_object->isListMarker())
+        bool isOnlyRun = (runCount == 1);
+        if (runCount == 2 && !r->m_object->isListMarker())
             isOnlyRun = (!style()->isLeftToRightDirection() ? bidiRuns.lastRun() : bidiRuns.firstRun())->m_object->isListMarker();
 
         InlineBox* box = createInlineBoxForRenderer(r->m_object, false, isOnlyRun);
@@ -1226,6 +1232,7 @@
         lineMidpointState.reset();
 
         layoutState.lineInfo().setEmpty(true);
+        layoutState.lineInfo().resetRunsFromLeadingWhitespace();
 
         const InlineIterator oldEnd = end;
         bool isNewUBAParagraph = layoutState.lineInfo().previousLineBrokeCleanly();
@@ -1874,9 +1881,13 @@
 {
     while (!resolver.position().atEnd() && !requiresLineBox(resolver.position(), lineInfo, LeadingWhitespace)) {
         RenderObject* object = resolver.position().m_obj;
-        if (object->isPositioned())
+        if (object->isPositioned()) {
             setStaticPositions(m_block, toRenderBox(object));
-        else if (object->isFloating())
+            if (object->style()->isOriginalDisplayInlineType()) {
+                resolver.runs().addRun(createRun(0, 1, object, resolver));
+                lineInfo.incrementRunsFromLeadingWhitespace();
+            }
+        } else if (object->isFloating())
             m_block->positionNewFloatOnLine(m_block->insertFloatingObject(toRenderBox(object)), lastFloatFromPreviousLine, lineInfo, width);
         resolver.increment();
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to