Title: [180472] branches/safari-600.1.4.15-branch

Diff

Modified: branches/safari-600.1.4.15-branch/LayoutTests/ChangeLog (180471 => 180472)


--- branches/safari-600.1.4.15-branch/LayoutTests/ChangeLog	2015-02-21 02:18:35 UTC (rev 180471)
+++ branches/safari-600.1.4.15-branch/LayoutTests/ChangeLog	2015-02-21 02:43:55 UTC (rev 180472)
@@ -1,5 +1,22 @@
 2015-02-20  Lucas Forschler  <[email protected]>
 
+        Merge r180278
+
+    2015-02-18  Myles C. Maxfield  <[email protected]>
+
+            Justified ruby can cause lines to grow beyond their container
+            https://bugs.webkit.org/show_bug.cgi?id=141732
+
+            Reviewed by David Hyatt.
+
+            Make sure that the right edge of a justified ruby line matches up with
+            the same line without ruby.
+
+            * fast/text/ruby-justification-flush-expected.html: Added.
+            * fast/text/ruby-justification-flush.html: Added.
+
+2015-02-20  Lucas Forschler  <[email protected]>
+
         Merge r180150
 
     2015-02-12  David Hyatt  <[email protected]>

Copied: branches/safari-600.1.4.15-branch/LayoutTests/fast/text/ruby-justification-flush-expected.html (from rev 180278, trunk/LayoutTests/fast/text/ruby-justification-flush-expected.html) (0 => 180472)


--- branches/safari-600.1.4.15-branch/LayoutTests/fast/text/ruby-justification-flush-expected.html	                        (rev 0)
+++ branches/safari-600.1.4.15-branch/LayoutTests/fast/text/ruby-justification-flush-expected.html	2015-02-21 02:43:55 UTC (rev 180472)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+#outer {
+    position: absolute;
+    width: 500px;
+    height: 500px;
+    overflow: hidden;
+}
+
+#inner {
+    font-size: 127px;
+    text-align: justify;
+    position: absolute;
+    bottom: 0px;
+    left: 73px;
+    width: 1200px;
+    font-family: Ahem;
+}
+</style>
+</head>
+<body>
+This test makes sure that ruby overhangs don't make text grow beyond the bound of the enclosing box.
+At the bottom left of this page, there are two black squares on top of each other. This test passes if the two squares are exactly vertically aligned.
+<div id="outer"><div id="inner">a<br>a<br>&nbsp;</div></div>
+</body>
+</html>

Copied: branches/safari-600.1.4.15-branch/LayoutTests/fast/text/ruby-justification-flush.html (from rev 180278, trunk/LayoutTests/fast/text/ruby-justification-flush.html) (0 => 180472)


--- branches/safari-600.1.4.15-branch/LayoutTests/fast/text/ruby-justification-flush.html	                        (rev 0)
+++ branches/safari-600.1.4.15-branch/LayoutTests/fast/text/ruby-justification-flush.html	2015-02-21 02:43:55 UTC (rev 180472)
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<style>
+#outer {
+    position: absolute;
+    width: 500px;
+    height: 500px;
+    overflow: hidden;
+}
+
+#inner {
+    font-size: 127px;
+    text-align: justify;
+    position: absolute;
+    bottom: 0px;
+    left: -1000px;
+    width: 1200px;
+    font-family: Ahem;
+}
+</style>
+</head>
+<body>
+This test makes sure that ruby overhangs don't make text grow beyond the bound of the enclosing box.
+At the bottom left of this page, there are two black squares on top of each other. This test passes if the two squares are exactly vertically aligned.
+<div id="outer"><div id="inner">a<ruby> a <rt>aaaa</rt> a <rt>aaaa</rt></ruby>a a a a a a a a</div></div>
+</body>
+</html>

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog (180471 => 180472)


--- branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog	2015-02-21 02:18:35 UTC (rev 180471)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/ChangeLog	2015-02-21 02:43:55 UTC (rev 180472)
@@ -1,5 +1,36 @@
 2015-02-20  Lucas Forschler  <[email protected]>
 
+        Merge r180278
+
+    2015-02-18  Myles C. Maxfield  <[email protected]>
+
+            Justified ruby can cause lines to grow beyond their container
+            https://bugs.webkit.org/show_bug.cgi?id=141732
+
+            Reviewed by David Hyatt.
+
+            After we re-layout RenderRubyRuns, this can change the environment upon which
+            ruby's overhang calculation is sensitive to. Before this patch, we would recalculate
+            the overhang after the RenderRubyRun gets relaid out. However, doing such causes the
+            effective width of the RenderRubyRun to change, which causes out subsequent
+            justification calculations to be off.
+
+            Therefore, we have a cycle; the amount of ruby overhang can change the justification
+            in a line, and the layout of the line affects the ruby overhang calculation. Instead
+            of performing a layout in a loop until it converges, this patch simply observes that
+            having a flush right edge is more valuable than having a perfectly correct overhang.
+            It therefore simply removes the secondary overhang calculation.
+
+            Test: fast/text/ruby-justification-flush.html
+
+            * rendering/RenderBlockFlow.h:
+            * rendering/RenderBlockLineLayout.cpp:
+            (WebCore::RenderBlockFlow::updateRubyForJustifiedText):
+            (WebCore::RenderBlockFlow::computeExpansionForJustifiedText):
+            (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
+
+2015-02-20  Lucas Forschler  <[email protected]>
+
         Merge r180150
 
     2015-02-12  David Hyatt  <[email protected]>

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/rendering/RenderBlockFlow.h (180471 => 180472)


--- branches/safari-600.1.4.15-branch/Source/WebCore/rendering/RenderBlockFlow.h	2015-02-21 02:18:35 UTC (rev 180471)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/rendering/RenderBlockFlow.h	2015-02-21 02:43:55 UTC (rev 180472)
@@ -552,8 +552,8 @@
     RootInlineBox* constructLine(BidiRunList<BidiRun>&, const LineInfo&);
     void setMarginsForRubyRun(BidiRun*, RenderRubyRun&, RenderObject*, const LineInfo&);
     void computeInlineDirectionPositionsForLine(RootInlineBox*, const LineInfo&, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&, WordMeasurements&);
-    void updateRubyForJustifiedText(RenderRubyRun&, BidiRun&, const Vector<unsigned, 16>& expansionOpportunities, unsigned& expansionOpportunityCount, float& totalLogicalWidth, float availableLogicalWidth, RenderObject* previousObject, const LineInfo&, size_t& expansionIndex);
-    void computeExpansionForJustifiedText(BidiRun* firstRun, BidiRun* trailingSpaceRun, const Vector<unsigned, 16>& expansionOpportunities, unsigned expansionOpportunityCount, float totalLogicalWidth, float availableLogicalWidth, const LineInfo&);
+    void updateRubyForJustifiedText(RenderRubyRun&, BidiRun&, const Vector<unsigned, 16>& expansionOpportunities, unsigned& expansionOpportunityCount, float& totalLogicalWidth, float availableLogicalWidth, size_t& expansionIndex);
+    void computeExpansionForJustifiedText(BidiRun* firstRun, BidiRun* trailingSpaceRun, const Vector<unsigned, 16>& expansionOpportunities, unsigned expansionOpportunityCount, float totalLogicalWidth, float availableLogicalWidth);
     BidiRun* computeInlineDirectionPositionsForSegment(RootInlineBox*, const LineInfo&, ETextAlign, float& logicalLeft,
         float& availableLogicalWidth, BidiRun* firstRun, BidiRun* trailingSpaceRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache&, WordMeasurements&);
     void computeBlockDirectionPositionsForLine(RootInlineBox*, BidiRun*, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&);

Modified: branches/safari-600.1.4.15-branch/Source/WebCore/rendering/RenderBlockLineLayout.cpp (180471 => 180472)


--- branches/safari-600.1.4.15-branch/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2015-02-21 02:18:35 UTC (rev 180471)
+++ branches/safari-600.1.4.15-branch/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2015-02-21 02:43:55 UTC (rev 180472)
@@ -540,7 +540,7 @@
     }
 }
 
-void RenderBlockFlow::updateRubyForJustifiedText(RenderRubyRun& rubyRun, BidiRun& r, const Vector<unsigned, 16>& expansionOpportunities, unsigned& expansionOpportunityCount, float& totalLogicalWidth, float availableLogicalWidth, RenderObject* previousObject, const LineInfo& lineInfo, size_t& i)
+void RenderBlockFlow::updateRubyForJustifiedText(RenderRubyRun& rubyRun, BidiRun& r, const Vector<unsigned, 16>& expansionOpportunities, unsigned& expansionOpportunityCount, float& totalLogicalWidth, float availableLogicalWidth, size_t& i)
 {
     if (!rubyRun.rubyBase() || !rubyRun.rubyBase()->firstRootBox() || rubyRun.rubyBase()->firstRootBox()->nextRootBox() || !r.renderer().style().collapseWhiteSpace())
         return;
@@ -575,7 +575,6 @@
         }
         rubyRun.layoutBlock(true);
         rubyRun.clearOverrideLogicalContentWidth();
-        setMarginsForRubyRun(&r, rubyRun, previousObject, lineInfo); // Expanding the base might mean there's less of a need for overhang
         r.box()->setExpansion(newRubyRunWidth - r.box()->logicalWidth());
 
         // This relayout caused the size of the RenderRubyText and the RenderRubyBase to change, dependent on the line's current expansion. Next time we relayout the
@@ -591,19 +590,15 @@
     }
 }
 
-void RenderBlockFlow::computeExpansionForJustifiedText(BidiRun* firstRun, BidiRun* trailingSpaceRun, const Vector<unsigned, 16>& expansionOpportunities, unsigned expansionOpportunityCount, float totalLogicalWidth, float availableLogicalWidth, const LineInfo& lineInfo)
+void RenderBlockFlow::computeExpansionForJustifiedText(BidiRun* firstRun, BidiRun* trailingSpaceRun, const Vector<unsigned, 16>& expansionOpportunities, unsigned expansionOpportunityCount, float totalLogicalWidth, float availableLogicalWidth)
 {
     if (!expansionOpportunityCount || availableLogicalWidth <= totalLogicalWidth)
         return;
 
-    RenderObject* previousObject = nullptr;
-
     size_t i = 0;
     for (BidiRun* r = firstRun; r; r = r->next()) {
-        if (!r->box() || r == trailingSpaceRun) {
-            previousObject = &r->renderer();
+        if (!r->box() || r == trailingSpaceRun)
             continue;
-        }
         
         if (r->renderer().isText()) {
             unsigned opportunitiesInRun = expansionOpportunities[i++];
@@ -619,10 +614,8 @@
             }
             expansionOpportunityCount -= opportunitiesInRun;
         } else if (r->renderer().isRubyRun())
-            updateRubyForJustifiedText(toRenderRubyRun(r->renderer()), *r, expansionOpportunities, expansionOpportunityCount, totalLogicalWidth, availableLogicalWidth, previousObject, lineInfo, i);
+            updateRubyForJustifiedText(toRenderRubyRun(r->renderer()), *r, expansionOpportunities, expansionOpportunityCount, totalLogicalWidth, availableLogicalWidth, i);
 
-        previousObject = &r->renderer();
-
         if (!expansionOpportunityCount)
             break;
     }
@@ -807,7 +800,7 @@
 
     updateLogicalWidthForAlignment(textAlign, lineBox, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth, expansionOpportunityCount);
 
-    computeExpansionForJustifiedText(firstRun, trailingSpaceRun, expansionOpportunities, expansionOpportunityCount, totalLogicalWidth, availableLogicalWidth, lineInfo);
+    computeExpansionForJustifiedText(firstRun, trailingSpaceRun, expansionOpportunities, expansionOpportunityCount, totalLogicalWidth, availableLogicalWidth);
 
     return r;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to