Changeset 164867 in webkit
- Timestamp:
- Feb 28, 2014 10:12:52 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r164866 r164867 1 2014-02-28 Mario Sanchez Prada <mario.prada@samsung.com> 2 3 paragraphs with different directionality in textarea with unicode-bidi: plaintext are aligned the same 4 https://bugs.webkit.org/show_bug.cgi?id=71194 5 6 Reviewed by David Hyatt. 7 8 Merged from Blink r157263 by <igor.o@sisa.samsung.com> 9 <https://src.chromium.org/viewvc/blink?revision=157263&view=revision> 10 11 Modified expectations for two layout tests to make them conforming to the spec. 12 13 * fast/text/international/unicode-bidi-plaintext-expected.html: 14 * platform/gtk/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt: 15 * platform/mac-mountainlion/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt: 16 1 17 2014-02-28 Jochen Eisinger <jochen@chromium.org> 2 18 -
trunk/LayoutTests/fast/text/international/unicode-bidi-plaintext-expected.html
r101949 r164867 3 3 <head> 4 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 5 <style> 6 .rightAligned { 7 display: block; 8 text-align: right; 9 } 10 </style> 5 11 </head> 6 12 <body> … … 9 15 <div dir=ltr> 10 16 !hello.<br> 11 <span dir=rtl>17 <span class="rightAligned" dir=rtl> 12 18 !שלום. 13 </span> <br>19 </span> 14 20 <span dir=ltr> 15 21 hello, לוי! 16 22 </span><br> 17 <span dir=rtl>18 שלום, WebKit!</span> <br>19 <pre >23 <span class="rightAligned" dir=rtl> 24 שלום, WebKit!</span> 25 <pre style="margin-bottom: 0px"> 20 26 a 21 27 ( 22 !WebKit ,שלום 28 </pre> 29 <pre dir="rtl" style="margin: 0px"> 30 שלום, WebKit! 31 </pre> 32 <pre style="margin-top: 0px"> 23 33 hello, לוי! 24 34 ) -
trunk/LayoutTests/platform/gtk/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt
r148815 r164867 17 17 RenderTextControl {TEXTAREA} at (2,2) size 471x74 [bgcolor=#FFFFFF] [border: (1px solid #000000)] 18 18 RenderBlock {DIV} at (3,3) size 465x51 19 RenderText {#text} at (424,0) size 4 1x3419 RenderText {#text} at (424,0) size 465x34 20 20 text run at (424,0) width 0 RTL: " " 21 21 text run at (424,0) width 41 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!" 22 text run at ( 426,17) width 39: "hello!"23 text run at ( 465,17) width 0: " "22 text run at (0,17) width 39: "hello!" 23 text run at (39,17) width 0: " " 24 24 RenderBR {BR} at (465,34) size 0x17 25 25 layer at (10,125) size 471x74 clip at (11,126) size 469x72 26 26 RenderTextControl {TEXTAREA} at (2,83) size 471x74 [bgcolor=#FFFFFF] [border: (1px solid #000000)] 27 27 RenderBlock {DIV} at (3,3) size 465x51 28 RenderText {#text} at ( 0,0) size 41x3429 text run at ( 0,0) width 0 RTL: " "30 text run at ( 0,0) width 41 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"28 RenderText {#text} at (424,0) size 465x34 29 text run at (424,0) width 0 RTL: " " 30 text run at (424,0) width 41 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!" 31 31 text run at (0,17) width 39: "hello!" 32 32 text run at (39,17) width 0: " " … … 35 35 RenderTextControl {TEXTAREA} at (2,164) size 471x74 [bgcolor=#FFFFFF] [border: (1px solid #000000)] 36 36 RenderBlock {DIV} at (3,3) size 465x51 37 RenderText {#text} at ( 0,0) size 41x3438 text run at ( 0,0) width 0 RTL: " "39 text run at ( 0,0) width 41 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"37 RenderText {#text} at (424,0) size 465x34 38 text run at (424,0) width 0 RTL: " " 39 text run at (424,0) width 41 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!" 40 40 text run at (0,17) width 39: "hello!" 41 41 text run at (39,17) width 0: " " … … 44 44 RenderTextControl {TEXTAREA} at (2,245) size 471x74 [bgcolor=#FFFFFF] [border: (1px solid #000000)] 45 45 RenderBlock {DIV} at (3,3) size 465x51 46 RenderText {#text} at (424,0) size 4 1x3446 RenderText {#text} at (424,0) size 465x34 47 47 text run at (424,0) width 0 RTL: " " 48 48 text run at (424,0) width 41 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!" 49 text run at ( 426,17) width 39: "hello!"50 text run at ( 465,17) width 0: " "49 text run at (0,17) width 39: "hello!" 50 text run at (39,17) width 0: " " 51 51 RenderBR {BR} at (465,34) size 0x17 -
trunk/LayoutTests/platform/mac-mountainlion/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt
r158041 r164867 17 17 RenderTextControl {TEXTAREA} at (2,2) size 371x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)] 18 18 RenderBlock {DIV} at (3,3) size 365x39 19 RenderText {#text} at (336,0) size 3 0x2619 RenderText {#text} at (336,0) size 365x26 20 20 text run at (336,0) width 1 RTL: " " 21 21 text run at (336,0) width 29 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!" 22 text run at ( 335,13) width 30: "hello!"23 text run at ( 365,13) width 0: " "22 text run at (0,13) width 30: "hello!" 23 text run at (29,13) width 1: " " 24 24 RenderBR {BR} at (365,26) size 0x13 25 25 layer at (10,112) size 371x58 clip at (11,113) size 369x56 26 26 RenderTextControl {TEXTAREA} at (2,68) size 371x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)] 27 27 RenderBlock {DIV} at (3,3) size 365x39 28 RenderText {#text} at ( 0,0) size 30x2629 text run at ( 0,0) width 0RTL: " "30 text run at ( 0,0) width 29 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"28 RenderText {#text} at (336,0) size 365x26 29 text run at (336,0) width 1 RTL: " " 30 text run at (336,0) width 29 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!" 31 31 text run at (0,13) width 30: "hello!" 32 32 text run at (29,13) width 1: " " … … 35 35 RenderTextControl {TEXTAREA} at (2,134) size 371x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)] 36 36 RenderBlock {DIV} at (3,3) size 365x39 37 RenderText {#text} at ( 0,0) size 30x2638 text run at ( 0,0) width 0RTL: " "39 text run at ( 0,0) width 29 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"37 RenderText {#text} at (336,0) size 365x26 38 text run at (336,0) width 1 RTL: " " 39 text run at (336,0) width 29 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!" 40 40 text run at (0,13) width 30: "hello!" 41 41 text run at (29,13) width 1: " " … … 44 44 RenderTextControl {TEXTAREA} at (2,200) size 371x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)] 45 45 RenderBlock {DIV} at (3,3) size 365x39 46 RenderText {#text} at (336,0) size 3 0x2646 RenderText {#text} at (336,0) size 365x26 47 47 text run at (336,0) width 1 RTL: " " 48 48 text run at (336,0) width 29 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!" 49 text run at ( 335,13) width 30: "hello!"50 text run at ( 365,13) width 0: " "49 text run at (0,13) width 30: "hello!" 50 text run at (29,13) width 1: " " 51 51 RenderBR {BR} at (365,26) size 0x13 -
trunk/Source/WebCore/ChangeLog
r164866 r164867 1 2014-02-28 Mario Sanchez Prada <mario.prada@samsung.com> 2 3 paragraphs with different directionality in textarea with unicode-bidi: plaintext are aligned the same 4 https://bugs.webkit.org/show_bug.cgi?id=71194 5 6 Reviewed by David Hyatt. 7 8 Merged from Blink r157263 by <igor.o@sisa.samsung.com> 9 <https://src.chromium.org/viewvc/blink?revision=157263&view=revision> 10 11 In the css3-text spec (http://www.w3.org/TR/css3-text/#bidi-linebox): 12 13 The start and end edges of a line box are determined by the inline 14 base direction of the line box. In most cases, this is given by 15 its containing block's computed ‘direction’. However if its 16 containing block has ‘unicode-bidi: plaintext’, the inline base 17 direction the line box must be determined by the base direction of 18 the bidi paragraph to which it belongs: that is, the bidi 19 paragraph for which the line box holds content. 20 21 This patch just implements the behavior described above modifying 22 updateLogicalWidthForAlignment and setting the bidi level of the 23 RootInlineBox. 24 25 * rendering/RenderBlockFlow.h: 26 * rendering/RenderBlockLineLayout.cpp: 27 (WebCore::RenderBlockFlow::updateLogicalWidthForAlignment): 28 (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment): 29 (WebCore::RenderBlockFlow::createLineBoxesFromBidiRuns): 30 (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange): 31 (WebCore::RenderBlockFlow::deleteEllipsisLineBoxes): 32 (WebCore::RenderBlockFlow::checkLinesForTextOverflow): 33 (WebCore::RenderBlockFlow::startAlignedOffsetForLine): 34 1 35 2014-02-28 Jochen Eisinger <jochen@chromium.org> 2 36 -
trunk/Source/WebCore/rendering/RenderBlockFlow.h
r164440 r164867 536 536 void appendFloatingObjectToLastLine(FloatingObject*); 537 537 // Helper function for layoutInlineChildren() 538 RootInlineBox* createLineBoxesFromBidiRuns( BidiRunList<BidiRun>&, const InlineIterator& end, LineInfo&, VerticalPositionCache&, BidiRun* trailingSpaceRun, WordMeasurements&);538 RootInlineBox* createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<BidiRun>&, const InlineIterator& end, LineInfo&, VerticalPositionCache&, BidiRun* trailingSpaceRun, WordMeasurements&); 539 539 void layoutRunsAndFloats(LineLayoutState&, bool hasInlineChild); 540 540 const InlineIterator& restartLayoutRunsAndFloatsInRange(LayoutUnit oldLogicalHeight, LayoutUnit newLogicalHeight, FloatingObject* lastFloatFromPreviousLine, InlineBidiResolver&, const InlineIterator&); … … 561 561 // line, i.e., that it can't be re-used. 562 562 bool lineWidthForPaginatedLineChanged(RootInlineBox*, LayoutUnit lineDelta, RenderFlowThread*) const; 563 void updateLogicalWidthForAlignment(const ETextAlign&, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount);563 void updateLogicalWidthForAlignment(const ETextAlign&, const RootInlineBox*, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount); 564 564 565 565 // END METHODS DEFINED IN RenderBlockLineLayout -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r164441 r164867 572 572 } 573 573 574 void RenderBlockFlow::updateLogicalWidthForAlignment(const ETextAlign& textAlign, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount) 575 { 574 void RenderBlockFlow::updateLogicalWidthForAlignment(const ETextAlign& textAlign, const RootInlineBox* rootInlineBox, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount) 575 { 576 TextDirection direction; 577 if (rootInlineBox && style().unicodeBidi() == Plaintext) 578 direction = rootInlineBox->direction(); 579 else 580 direction = style().direction(); 581 576 582 // Armed with the total width of the line (without justification), 577 583 // we now examine our text-align property in order to determine where to position the … … 602 608 FALLTHROUGH; 603 609 case TASTART: 604 if ( style().isLeftToRightDirection())610 if (direction == LTR) 605 611 updateLogicalWidthForLeftAlignedBlock(style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 606 612 else … … 608 614 break; 609 615 case TAEND: 610 if ( style().isLeftToRightDirection())616 if (direction == LTR) 611 617 updateLogicalWidthForRightAlignedBlock(style().isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 612 618 else … … 748 754 } 749 755 750 updateLogicalWidthForAlignment(textAlign, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth, expansionOpportunityCount);756 updateLogicalWidthForAlignment(textAlign, lineBox, trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth, expansionOpportunityCount); 751 757 752 758 computeExpansionForJustifiedText(firstRun, trailingSpaceRun, expansionOpportunities, expansionOpportunityCount, totalLogicalWidth, availableLogicalWidth); … … 979 985 980 986 // This function constructs line boxes for all of the text runs in the resolver and computes their position. 981 RootInlineBox* RenderBlockFlow::createLineBoxesFromBidiRuns( BidiRunList<BidiRun>& bidiRuns, const InlineIterator& end, LineInfo& lineInfo, VerticalPositionCache& verticalPositionCache, BidiRun* trailingSpaceRun, WordMeasurements& wordMeasurements)987 RootInlineBox* RenderBlockFlow::createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<BidiRun>& bidiRuns, const InlineIterator& end, LineInfo& lineInfo, VerticalPositionCache& verticalPositionCache, BidiRun* trailingSpaceRun, WordMeasurements& wordMeasurements) 982 988 { 983 989 if (!bidiRuns.runCount()) … … 991 997 return 0; 992 998 999 lineBox->setBidiLevel(bidiLevel); 993 1000 lineBox->setEndsWithBreak(lineInfo.previousLineBrokeCleanly()); 994 1001 … … 1382 1389 1383 1390 LayoutUnit oldLogicalHeight = logicalHeight(); 1384 RootInlineBox* lineBox = createLineBoxesFromBidiRuns( bidiRuns, end, layoutState.lineInfo(), verticalPositionCache, trailingSpaceRun, wordMeasurements);1391 RootInlineBox* lineBox = createLineBoxesFromBidiRuns(resolver.status().context->level(), bidiRuns, end, layoutState.lineInfo(), verticalPositionCache, trailingSpaceRun, wordMeasurements); 1385 1392 1386 1393 bidiRuns.deleteRuns(); … … 2037 2044 float availableLogicalWidth = logicalRightOffsetForLine(curr->lineTop(), false) - logicalLeft; 2038 2045 float totalLogicalWidth = curr->logicalWidth(); 2039 updateLogicalWidthForAlignment(textAlign, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0);2046 updateLogicalWidthForAlignment(textAlign, curr, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0); 2040 2047 2041 2048 if (ltr) … … 2084 2091 float logicalLeft = 0; // We are only interested in the delta from the base position. 2085 2092 float truncatedWidth = pixelSnappedLogicalRightOffsetForLine(curr->lineTop(), firstLine); 2086 updateLogicalWidthForAlignment(textAlign, 0, logicalLeft, totalLogicalWidth, truncatedWidth, 0);2093 updateLogicalWidthForAlignment(textAlign, curr, 0, logicalLeft, totalLogicalWidth, truncatedWidth, 0); 2087 2094 if (ltr) 2088 2095 curr->adjustLogicalPosition(logicalLeft, 0); … … 2166 2173 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false); 2167 2174 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), false) - logicalLeft; 2168 updateLogicalWidthForAlignment(textAlign, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0); 2175 2176 // FIXME: Bug 129311: We need to pass a valid RootInlineBox here, considering the bidi level used to construct the line. 2177 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWidth, availableLogicalWidth, 0); 2169 2178 2170 2179 if (!style().isLeftToRightDirection())
Note: See TracChangeset
for help on using the changeset viewer.