Changeset 82105 in webkit
- Timestamp:
- Mar 28, 2011 5:04:56 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r82100 r82105 1 2011-03-27 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 WebKit's behavior for text-align inherit differs from other browsers 6 https://bugs.webkit.org/show_bug.cgi?id=56377 7 8 Added test more cases to text-align, which already has some tests for text-align: start and text-align: end. 9 10 * fast/css/text-align-expected.txt: 11 * fast/css/text-align.html: 12 * platform/mac/fast/css/text-align-expected.checksum: 13 * platform/mac/fast/css/text-align-expected.png: 14 1 15 2011-03-28 Yuta Kitamura <yutak@chromium.org> 2 16 -
trunk/LayoutTests/fast/css/text-align-expected.txt
r63403 r82105 1 1 layer at (0,0) size 800x600 2 2 RenderView at (0,0) size 800x600 3 layer at (0,0) size 800x152 4 RenderBlock {HTML} at (0,0) size 800x152 5 RenderBody {BODY} at (8,16) size 784x120 6 RenderBlock {P} at (0,0) size 784x18 3 layer at (0,0) size 800x520 4 RenderBlock {HTML} at (0,0) size 800x520 5 RenderBody {BODY} at (8,10) size 784x494 6 RenderBlock {H1} at (0,0) size 784x18 7 RenderText {#text} at (0,0) size 78x18 8 text run at (0,0) width 78: "Simple case" 9 RenderBlock {P} at (0,34) size 784x18 7 10 RenderText {#text} at (0,0) size 64x18 8 11 text run at (0,0) width 64: "LTR Start" 9 RenderBlock {P} at (0, 34) size 784x1812 RenderBlock {P} at (0,68) size 784x18 10 13 RenderText {#text} at (723,0) size 61x18 11 14 text run at (723,0) width 61: "LTR End" 12 RenderBlock {P} at (0, 68) size 784x1815 RenderBlock {P} at (0,102) size 784x18 13 16 RenderText {#text} at (720,0) size 64x18 14 17 text run at (720,0) width 64: "RTL Start" 15 RenderBlock {P} at (0,1 02) size 784x1818 RenderBlock {P} at (0,136) size 784x18 16 19 RenderText {#text} at (0,0) size 61x18 17 20 text run at (0,0) width 61: "RTL End" 21 RenderBlock {H1} at (0,170) size 784x18 22 RenderText {#text} at (0,0) size 95x18 23 text run at (0,0) width 95: "Inherited case" 24 RenderBlock {DIV} at (0,204) size 784x18 25 RenderBlock {P} at (0,0) size 784x18 26 RenderText {#text} at (0,0) size 64x18 27 text run at (0,0) width 64: "LTR Start" 28 RenderBlock {DIV} at (0,238) size 784x18 29 RenderBlock {P} at (0,0) size 784x18 30 RenderText {#text} at (723,0) size 61x18 31 text run at (723,0) width 61: "LTR End" 32 RenderBlock {DIV} at (0,272) size 784x18 33 RenderBlock {P} at (0,0) size 784x18 34 RenderText {#text} at (720,0) size 64x18 35 text run at (720,0) width 64: "RTL Start" 36 RenderBlock {DIV} at (0,306) size 784x18 37 RenderBlock {P} at (0,0) size 784x18 38 RenderText {#text} at (0,0) size 61x18 39 text run at (0,0) width 61: "RTL End" 40 RenderBlock {H1} at (0,340) size 784x18 41 RenderText {#text} at (0,0) size 415x18 42 text run at (0,0) width 415: "Inherited case where parent block has opposite directionality." 43 RenderBlock {DIV} at (0,374) size 784x18 44 RenderBlock {P} at (0,0) size 784x18 45 RenderText {#text} at (0,0) size 64x18 46 text run at (0,0) width 64: "LTR Start" 47 RenderBlock {DIV} at (0,408) size 784x18 48 RenderBlock {P} at (0,0) size 784x18 49 RenderText {#text} at (723,0) size 61x18 50 text run at (723,0) width 61: "LTR End" 51 RenderBlock {DIV} at (0,442) size 784x18 52 RenderBlock {P} at (0,0) size 784x18 53 RenderText {#text} at (720,0) size 64x18 54 text run at (720,0) width 64: "RTL Start" 55 RenderBlock {DIV} at (0,476) size 784x18 56 RenderBlock {P} at (0,0) size 784x18 57 RenderText {#text} at (0,0) size 61x18 58 text run at (0,0) width 61: "RTL End" -
trunk/LayoutTests/fast/css/text-align.html
r26469 r82105 2 2 <html lang="en"> 3 3 <title>Test Case for text-align: start/end</title> 4 <h1 style="font-size: 1em;">Simple case</h1> 4 5 <p dir="ltr" style="text-align:start">LTR Start 5 6 <p dir="ltr" style="text-align:end">LTR End 6 7 <p dir="rtl" style="text-align:start">RTL Start 7 8 <p dir="rtl" style="text-align:end">RTL End 9 <h1 style="font-size: 1em;">Inherited case</h1> 10 <div style="text-align: start;"><p dir="ltr" style="text-align: inherit">LTR Start</div> 11 <div style="text-align: end;"><p dir="ltr" style="text-align: inherit">LTR End</div> 12 <div style="text-align: start;"><p dir="rtl" style="text-align: inherit">RTL Start</div> 13 <div style="text-align: end;"><p dir="rtl" style="text-align: inherit">RTL End</div> 14 <h1 style="font-size: 1em;">Inherited case where parent block has opposite directionality.</h1> 15 <div dir="rtl" style="text-align: start;"><p dir="ltr" style="text-align: inherit">LTR Start</div> 16 <div dir="rtl" style="text-align: end;"><p dir="ltr" style="text-align: inherit">LTR End</div> 17 <div dir="ltr" style="text-align: start;"><p dir="rtl" style="text-align: inherit">RTL Start</div> 18 <div dir="ltr" style="text-align: end;"><p dir="rtl" style="text-align: inherit">RTL End</div> 8 19 </html> -
trunk/LayoutTests/platform/mac/fast/css/text-align-expected.checksum
r71088 r82105 1 a0b9172d02f1de1895f983b9183c332f 1 7326dc495a79d91ab1572f8493bf72f5 -
trunk/Source/WebCore/ChangeLog
r82103 r82105 1 2011-03-27 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 WebKit's behavior for text-align inherit differs from other browsers 6 https://bugs.webkit.org/show_bug.cgi?id=56377 7 8 The bug was caused by WebKit's resolving text-align: start and text-align: end too early. 9 As discussed on the bug, when text-align: start and text-align: end are inherited by descendent nodes, 10 the alignment of the text in those nodes should be determined based on the directionality of the text, 11 not by the directionality of the ancestor node from which text-align property is inherited. 12 13 Fixed the bug by introducing new enum values to ETextAlign: TASTART and TAEND. These two values will 14 align text to the left in a LTR context and to the right in a RTL context respectively. 15 16 * css/CSSPrimitiveValueMappings.h: 17 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Added the support for TASTART and TAEND. 18 (WebCore::CSSPrimitiveValue::operator ETextAlign): Ditto. 19 * css/CSSStyleSelector.cpp: 20 (WebCore::CSSStyleSelector::applyProperty): No longer processes CSSValueStart and CSSValueEnd. 21 * rendering/RenderBlock.cpp: 22 (WebCore::RenderBlock::localCaretRect): Added the support for TASTART and TAEND. 23 * rendering/RenderBlockLineLayout.cpp: 24 (WebCore::RenderBlock::computeInlineDirectionPositionsForLine): Added the support for TASTART and TAEND. 25 * rendering/RenderText.cpp: 26 (WebCore::RenderText::localCaretRect): Ditto. 27 * rendering/style/RenderStyle.h: ETextAlign now has 10 values and requires 4 bits. 28 * rendering/style/RenderStyleConstants.h: Added TASTART and TAEND to ETextAlign. 29 1 30 2011-03-28 Pavel Podivilov <podivilov@chromium.org> 2 31 -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r80582 r82105 1618 1618 { 1619 1619 switch (e) { 1620 case TAAUTO: 1621 m_value.ident = CSSValueWebkitAuto; 1622 break; 1623 case LEFT: 1624 m_value.ident = CSSValueLeft; 1625 break; 1626 case RIGHT: 1627 m_value.ident = CSSValueRight; 1628 break; 1629 case CENTER: 1630 m_value.ident = CSSValueCenter; 1631 break; 1632 case JUSTIFY: 1633 m_value.ident = CSSValueJustify; 1634 break; 1635 case WEBKIT_LEFT: 1636 m_value.ident = CSSValueWebkitLeft; 1637 break; 1638 case WEBKIT_RIGHT: 1639 m_value.ident = CSSValueWebkitRight; 1640 break; 1641 case WEBKIT_CENTER: 1642 m_value.ident = CSSValueWebkitCenter; 1643 break; 1620 case TAAUTO: 1621 m_value.ident = CSSValueWebkitAuto; 1622 break; 1623 case TASTART: 1624 m_value.ident = CSSValueStart; 1625 break; 1626 case TAEND: 1627 m_value.ident = CSSValueEnd; 1628 break; 1629 case LEFT: 1630 m_value.ident = CSSValueLeft; 1631 break; 1632 case RIGHT: 1633 m_value.ident = CSSValueRight; 1634 break; 1635 case CENTER: 1636 m_value.ident = CSSValueCenter; 1637 break; 1638 case JUSTIFY: 1639 m_value.ident = CSSValueJustify; 1640 break; 1641 case WEBKIT_LEFT: 1642 m_value.ident = CSSValueWebkitLeft; 1643 break; 1644 case WEBKIT_RIGHT: 1645 m_value.ident = CSSValueWebkitRight; 1646 break; 1647 case WEBKIT_CENTER: 1648 m_value.ident = CSSValueWebkitCenter; 1649 break; 1644 1650 } 1645 1651 } … … 1649 1655 switch (m_value.ident) { 1650 1656 case CSSValueStart: 1657 return TASTART; 1651 1658 case CSSValueEnd: 1652 ASSERT_NOT_REACHED(); // Depends on direction, thus should be handled by the caller. 1653 return LEFT; 1659 return TAEND; 1654 1660 default: 1655 1661 return static_cast<ETextAlign>(m_value.ident - CSSValueWebkitAuto); -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r82053 r82105 4622 4622 if (!primitiveValue) 4623 4623 return; 4624 int id = primitiveValue->getIdent(); 4625 if (id == CSSValueStart) 4626 m_style->setTextAlign(m_style->isLeftToRightDirection() ? LEFT : RIGHT); 4627 else if (id == CSSValueEnd) 4628 m_style->setTextAlign(m_style->isLeftToRightDirection() ? RIGHT : LEFT); 4629 else 4630 m_style->setTextAlign(*primitiveValue); 4624 m_style->setTextAlign(*primitiveValue); 4631 4625 return; 4632 4626 } -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r81992 r82105 5818 5818 alignment = alignRight; 5819 5819 break; 5820 case TASTART: 5821 if (!currentStyle->isLeftToRightDirection()) 5822 alignment = alignRight; 5823 break; 5824 case TAEND: 5825 if (currentStyle->isLeftToRightDirection()) 5826 alignment = alignRight; 5827 break; 5820 5828 } 5821 5829 -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r82091 r82105 497 497 case WEBKIT_CENTER: 498 498 updateLogicalWidthForCenterAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 499 break; 500 case TASTART: 501 if (style()->isLeftToRightDirection()) 502 updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 503 else 504 updateLogicalWidthForRightAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 505 break; 506 case TAEND: 507 if (style()->isLeftToRightDirection()) 508 updateLogicalWidthForRightAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 509 else 510 updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); 499 511 break; 500 512 } -
trunk/Source/WebCore/rendering/RenderText.cpp
r81794 r82105 552 552 case WEBKIT_CENTER: 553 553 break; 554 case TASTART: 555 rightAligned = !cbStyle->isLeftToRightDirection(); 556 break; 557 case TAEND: 558 rightAligned = cbStyle->isLeftToRightDirection(); 559 break; 554 560 } 555 561 -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r81807 r82105 188 188 unsigned _list_style_position : 1; // EListStylePosition 189 189 unsigned _visibility : 2; // EVisibility 190 unsigned _text_align : 3; // ETextAlign190 unsigned _text_align : 4; // ETextAlign 191 191 unsigned _text_transform : 2; // ETextTransform 192 192 unsigned _text_decorations : 4; -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r81992 r82105 320 320 321 321 enum ETextAlign { 322 TAAUTO, LEFT, RIGHT, CENTER, JUSTIFY, WEBKIT_LEFT, WEBKIT_RIGHT, WEBKIT_CENTER 322 TAAUTO, LEFT, RIGHT, CENTER, JUSTIFY, WEBKIT_LEFT, WEBKIT_RIGHT, WEBKIT_CENTER, TASTART, TAEND, 323 323 }; 324 324
Note: See TracChangeset
for help on using the changeset viewer.