Diff
Modified: trunk/LayoutTests/ChangeLog (164866 => 164867)
--- trunk/LayoutTests/ChangeLog 2014-02-28 18:09:24 UTC (rev 164866)
+++ trunk/LayoutTests/ChangeLog 2014-02-28 18:12:52 UTC (rev 164867)
@@ -1,3 +1,19 @@
+2014-02-28 Mario Sanchez Prada <mario.pr...@samsung.com>
+
+ paragraphs with different directionality in textarea with unicode-bidi: plaintext are aligned the same
+ https://bugs.webkit.org/show_bug.cgi?id=71194
+
+ Reviewed by David Hyatt.
+
+ Merged from Blink r157263 by <igo...@sisa.samsung.com>
+ <https://src.chromium.org/viewvc/blink?revision=157263&view=revision>
+
+ Modified expectations for two layout tests to make them conforming to the spec.
+
+ * fast/text/international/unicode-bidi-plaintext-expected.html:
+ * platform/gtk/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt:
+ * platform/mac-mountainlion/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt:
+
2014-02-28 Jochen Eisinger <joc...@chromium.org>
Update meta-referrer behavior for invalid policies
Modified: trunk/LayoutTests/fast/text/international/unicode-bidi-plaintext-expected.html (164866 => 164867)
--- trunk/LayoutTests/fast/text/international/unicode-bidi-plaintext-expected.html 2014-02-28 18:09:24 UTC (rev 164866)
+++ trunk/LayoutTests/fast/text/international/unicode-bidi-plaintext-expected.html 2014-02-28 18:12:52 UTC (rev 164867)
@@ -2,24 +2,34 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<style>
+.rightAligned {
+ display: block;
+ text-align: right;
+}
+</style>
</head>
<body>
<div>This tests proper handling of unicode-bidi: plaintext. You should not see any red.</div>
<div dir=ltr>
!hello.<br>
-<span dir=rtl>
+<span class="rightAligned" dir=rtl>
!שלום.
-</span><br>
+</span>
<span dir=ltr>
hello, לוי!
</span><br>
-<span dir=rtl>
-שלום, WebKit!</span><br>
-<pre>
+<span class="rightAligned" dir=rtl>
+שלום, WebKit!</span>
+<pre style="margin-bottom: 0px">
a
(
-!WebKit ,שלום
+</pre>
+<pre dir="rtl" style="margin: 0px">
+שלום, WebKit!
+</pre>
+<pre style="margin-top: 0px">
hello, לוי!
)
</pre>
Modified: trunk/LayoutTests/platform/gtk/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt (164866 => 164867)
--- trunk/LayoutTests/platform/gtk/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt 2014-02-28 18:09:24 UTC (rev 164866)
+++ trunk/LayoutTests/platform/gtk/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt 2014-02-28 18:12:52 UTC (rev 164867)
@@ -16,36 +16,36 @@
layer at (10,44) size 471x74 clip at (11,45) size 469x72
RenderTextControl {TEXTAREA} at (2,2) size 471x74 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
RenderBlock {DIV} at (3,3) size 465x51
- RenderText {#text} at (424,0) size 41x34
+ RenderText {#text} at (424,0) size 465x34
text run at (424,0) width 0 RTL: " "
text run at (424,0) width 41 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
- text run at (426,17) width 39: "hello!"
- text run at (465,17) width 0: " "
+ text run at (0,17) width 39: "hello!"
+ text run at (39,17) width 0: " "
RenderBR {BR} at (465,34) size 0x17
layer at (10,125) size 471x74 clip at (11,126) size 469x72
RenderTextControl {TEXTAREA} at (2,83) size 471x74 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
RenderBlock {DIV} at (3,3) size 465x51
- RenderText {#text} at (0,0) size 41x34
- text run at (0,0) width 0 RTL: " "
- text run at (0,0) width 41 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
+ RenderText {#text} at (424,0) size 465x34
+ text run at (424,0) width 0 RTL: " "
+ text run at (424,0) width 41 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
text run at (0,17) width 39: "hello!"
text run at (39,17) width 0: " "
RenderBR {BR} at (0,34) size 0x17
layer at (10,206) size 471x74 clip at (11,207) size 469x72
RenderTextControl {TEXTAREA} at (2,164) size 471x74 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
RenderBlock {DIV} at (3,3) size 465x51
- RenderText {#text} at (0,0) size 41x34
- text run at (0,0) width 0 RTL: " "
- text run at (0,0) width 41 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
+ RenderText {#text} at (424,0) size 465x34
+ text run at (424,0) width 0 RTL: " "
+ text run at (424,0) width 41 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
text run at (0,17) width 39: "hello!"
text run at (39,17) width 0: " "
RenderBR {BR} at (0,34) size 0x17
layer at (10,287) size 471x74 clip at (11,288) size 469x72
RenderTextControl {TEXTAREA} at (2,245) size 471x74 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
RenderBlock {DIV} at (3,3) size 465x51
- RenderText {#text} at (424,0) size 41x34
+ RenderText {#text} at (424,0) size 465x34
text run at (424,0) width 0 RTL: " "
text run at (424,0) width 41 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
- text run at (426,17) width 39: "hello!"
- text run at (465,17) width 0: " "
+ text run at (0,17) width 39: "hello!"
+ text run at (39,17) width 0: " "
RenderBR {BR} at (465,34) size 0x17
Modified: trunk/LayoutTests/platform/mac-mountainlion/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt (164866 => 164867)
--- trunk/LayoutTests/platform/mac-mountainlion/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt 2014-02-28 18:09:24 UTC (rev 164866)
+++ trunk/LayoutTests/platform/mac-mountainlion/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt 2014-02-28 18:12:52 UTC (rev 164867)
@@ -16,36 +16,36 @@
layer at (10,46) size 371x58 clip at (11,47) size 369x56
RenderTextControl {TEXTAREA} at (2,2) size 371x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
RenderBlock {DIV} at (3,3) size 365x39
- RenderText {#text} at (336,0) size 30x26
+ RenderText {#text} at (336,0) size 365x26
text run at (336,0) width 1 RTL: " "
text run at (336,0) width 29 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
- text run at (335,13) width 30: "hello!"
- text run at (365,13) width 0: " "
+ text run at (0,13) width 30: "hello!"
+ text run at (29,13) width 1: " "
RenderBR {BR} at (365,26) size 0x13
layer at (10,112) size 371x58 clip at (11,113) size 369x56
RenderTextControl {TEXTAREA} at (2,68) size 371x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
RenderBlock {DIV} at (3,3) size 365x39
- RenderText {#text} at (0,0) size 30x26
- text run at (0,0) width 0 RTL: " "
- text run at (0,0) width 29 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
+ RenderText {#text} at (336,0) size 365x26
+ text run at (336,0) width 1 RTL: " "
+ text run at (336,0) width 29 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
text run at (0,13) width 30: "hello!"
text run at (29,13) width 1: " "
RenderBR {BR} at (0,26) size 0x13
layer at (10,178) size 371x58 clip at (11,179) size 369x56
RenderTextControl {TEXTAREA} at (2,134) size 371x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
RenderBlock {DIV} at (3,3) size 365x39
- RenderText {#text} at (0,0) size 30x26
- text run at (0,0) width 0 RTL: " "
- text run at (0,0) width 29 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
+ RenderText {#text} at (336,0) size 365x26
+ text run at (336,0) width 1 RTL: " "
+ text run at (336,0) width 29 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
text run at (0,13) width 30: "hello!"
text run at (29,13) width 1: " "
RenderBR {BR} at (0,26) size 0x13
layer at (10,244) size 371x58 clip at (11,245) size 369x56
RenderTextControl {TEXTAREA} at (2,200) size 371x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
RenderBlock {DIV} at (3,3) size 365x39
- RenderText {#text} at (336,0) size 30x26
+ RenderText {#text} at (336,0) size 365x26
text run at (336,0) width 1 RTL: " "
text run at (336,0) width 29 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
- text run at (335,13) width 30: "hello!"
- text run at (365,13) width 0: " "
+ text run at (0,13) width 30: "hello!"
+ text run at (29,13) width 1: " "
RenderBR {BR} at (365,26) size 0x13
Modified: trunk/Source/WebCore/ChangeLog (164866 => 164867)
--- trunk/Source/WebCore/ChangeLog 2014-02-28 18:09:24 UTC (rev 164866)
+++ trunk/Source/WebCore/ChangeLog 2014-02-28 18:12:52 UTC (rev 164867)
@@ -1,3 +1,37 @@
+2014-02-28 Mario Sanchez Prada <mario.pr...@samsung.com>
+
+ paragraphs with different directionality in textarea with unicode-bidi: plaintext are aligned the same
+ https://bugs.webkit.org/show_bug.cgi?id=71194
+
+ Reviewed by David Hyatt.
+
+ Merged from Blink r157263 by <igo...@sisa.samsung.com>
+ <https://src.chromium.org/viewvc/blink?revision=157263&view=revision>
+
+ In the css3-text spec (http://www.w3.org/TR/css3-text/#bidi-linebox):
+
+ The start and end edges of a line box are determined by the inline
+ base direction of the line box. In most cases, this is given by
+ its containing block's computed ‘direction’. However if its
+ containing block has ‘unicode-bidi: plaintext’, the inline base
+ direction the line box must be determined by the base direction of
+ the bidi paragraph to which it belongs: that is, the bidi
+ paragraph for which the line box holds content.
+
+ This patch just implements the behavior described above modifying
+ updateLogicalWidthForAlignment and setting the bidi level of the
+ RootInlineBox.
+
+ * rendering/RenderBlockFlow.h:
+ * rendering/RenderBlockLineLayout.cpp:
+ (WebCore::RenderBlockFlow::updateLogicalWidthForAlignment):
+ (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
+ (WebCore::RenderBlockFlow::createLineBoxesFromBidiRuns):
+ (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
+ (WebCore::RenderBlockFlow::deleteEllipsisLineBoxes):
+ (WebCore::RenderBlockFlow::checkLinesForTextOverflow):
+ (WebCore::RenderBlockFlow::startAlignedOffsetForLine):
+
2014-02-28 Jochen Eisinger <joc...@chromium.org>
Update meta-referrer behavior for invalid policies
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.h (164866 => 164867)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.h 2014-02-28 18:09:24 UTC (rev 164866)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.h 2014-02-28 18:12:52 UTC (rev 164867)
@@ -535,7 +535,7 @@
BidiRun* handleTrailingSpaces(BidiRunList<BidiRun>&, BidiContext*);
void appendFloatingObjectToLastLine(FloatingObject*);
// Helper function for layoutInlineChildren()
- RootInlineBox* createLineBoxesFromBidiRuns(BidiRunList<BidiRun>&, const InlineIterator& end, LineInfo&, VerticalPositionCache&, BidiRun* trailingSpaceRun, WordMeasurements&);
+ RootInlineBox* createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<BidiRun>&, const InlineIterator& end, LineInfo&, VerticalPositionCache&, BidiRun* trailingSpaceRun, WordMeasurements&);
void layoutRunsAndFloats(LineLayoutState&, bool hasInlineChild);
const InlineIterator& restartLayoutRunsAndFloatsInRange(LayoutUnit oldLogicalHeight, LayoutUnit newLogicalHeight, FloatingObject* lastFloatFromPreviousLine, InlineBidiResolver&, const InlineIterator&);
void layoutRunsAndFloatsInRange(LineLayoutState&, InlineBidiResolver&, const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiStatus, unsigned consecutiveHyphenatedLines);
@@ -560,7 +560,7 @@
// region/page/column that has a different available line width than the old one. Used to know when you have to dirty a
// line, i.e., that it can't be re-used.
bool lineWidthForPaginatedLineChanged(RootInlineBox*, LayoutUnit lineDelta, RenderFlowThread*) const;
- void updateLogicalWidthForAlignment(const ETextAlign&, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount);
+ void updateLogicalWidthForAlignment(const ETextAlign&, const RootInlineBox*, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount);
// END METHODS DEFINED IN RenderBlockLineLayout
Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (164866 => 164867)
--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2014-02-28 18:09:24 UTC (rev 164866)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp 2014-02-28 18:12:52 UTC (rev 164867)
@@ -571,8 +571,14 @@
}
}
-void RenderBlockFlow::updateLogicalWidthForAlignment(const ETextAlign& textAlign, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount)
+void RenderBlockFlow::updateLogicalWidthForAlignment(const ETextAlign& textAlign, const RootInlineBox* rootInlineBox, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount)
{
+ TextDirection direction;
+ if (rootInlineBox && style().unicodeBidi() == Plaintext)
+ direction = rootInlineBox->direction();
+ else
+ direction = style().direction();
+
// Armed with the total width of the line (without justification),
// we now examine our text-align property in order to determine where to position the
// objects horizontally. The total width of the line can be increased if we end up
@@ -601,13 +607,13 @@
}
FALLTHROUGH;
case TASTART:
- if (style().isLeftToRightDirection())
+ if (direction == LTR)
updateLogicalWidthForLeftAlignedBlock(style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);
else
updateLogicalWidthForRightAlignedBlock(style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);
break;
case TAEND:
- if (style().isLeftToRightDirection())
+ if (direction == LTR)
updateLogicalWidthForRightAlignedBlock(style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);
else
updateLogicalWidthForLeftAlignedBlock(style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth);
@@ -747,7 +753,7 @@
expansionOpportunityCount--;
}
- updateLogicalWidthForAlignment(textAlign, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth, expansionOpportunityCount);
+ updateLogicalWidthForAlignment(textAlign, lineBox, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth, expansionOpportunityCount);
computeExpansionForJustifiedText(firstRun, trailingSpaceRun, expansionOpportunities, expansionOpportunityCount, totalLogicalWidth, availableLogicalWidth);
@@ -978,7 +984,7 @@
}
// This function constructs line boxes for all of the text runs in the resolver and computes their position.
-RootInlineBox* RenderBlockFlow::createLineBoxesFromBidiRuns(BidiRunList<BidiRun>& bidiRuns, const InlineIterator& end, LineInfo& lineInfo, VerticalPositionCache& verticalPositionCache, BidiRun* trailingSpaceRun, WordMeasurements& wordMeasurements)
+RootInlineBox* RenderBlockFlow::createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<BidiRun>& bidiRuns, const InlineIterator& end, LineInfo& lineInfo, VerticalPositionCache& verticalPositionCache, BidiRun* trailingSpaceRun, WordMeasurements& wordMeasurements)
{
if (!bidiRuns.runCount())
return 0;
@@ -990,6 +996,7 @@
if (!lineBox)
return 0;
+ lineBox->setBidiLevel(bidiLevel);
lineBox->setEndsWithBreak(lineInfo.previousLineBrokeCleanly());
bool isSVGRootInlineBox = lineBox->isSVGRootInlineBox();
@@ -1381,7 +1388,7 @@
// inline flow boxes.
LayoutUnit oldLogicalHeight = logicalHeight();
- RootInlineBox* lineBox = createLineBoxesFromBidiRuns(bidiRuns, end, layoutState.lineInfo(), verticalPositionCache, trailingSpaceRun, wordMeasurements);
+ RootInlineBox* lineBox = createLineBoxesFromBidiRuns(resolver.status().context->level(), bidiRuns, end, layoutState.lineInfo(), verticalPositionCache, trailingSpaceRun, wordMeasurements);
bidiRuns.deleteRuns();
resolver.markCurrentRunEmpty(); // FIXME: This can probably be replaced by an ASSERT (or just removed).
@@ -2036,7 +2043,7 @@
float logicalLeft = pixelSnappedLogicalLeftOffsetForLine(curr->lineTop(), firstLine);
float availableLogicalWidth = logicalRightOffsetForLine(curr->lineTop(), false) - logicalLeft;
float totalLogicalWidth = curr->logicalWidth();
- updateLogicalWidthForAlignment(textAlign, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0);
+ updateLogicalWidthForAlignment(textAlign, curr, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0);
if (ltr)
curr->adjustLogicalPosition((logicalLeft - curr->logicalLeft()), 0);
@@ -2083,7 +2090,7 @@
float logicalLeft = 0; // We are only interested in the delta from the base position.
float truncatedWidth = pixelSnappedLogicalRightOffsetForLine(curr->lineTop(), firstLine);
- updateLogicalWidthForAlignment(textAlign, 0, logicalLeft, totalLogicalWidth, truncatedWidth, 0);
+ updateLogicalWidthForAlignment(textAlign, curr, 0, logicalLeft, totalLogicalWidth, truncatedWidth, 0);
if (ltr)
curr->adjustLogicalPosition(logicalLeft, 0);
else
@@ -2165,8 +2172,10 @@
float totalLogicalWidth = 0;
float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false);
float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), false) - logicalLeft;
- updateLogicalWidthForAlignment(textAlign, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0);
+ // FIXME: Bug 129311: We need to pass a valid RootInlineBox here, considering the bidi level used to construct the line.
+ updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0);
+
if (!style().isLeftToRightDirection())
return logicalWidth() - logicalLeft;
return logicalLeft;