Changeset 136142 in webkit
- Timestamp:
- Nov 29, 2012, 10:43:56 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r136132 r136142 1 2012-11-29 Dan Bernstein <mitz@apple.com> 2 3 <rdar://problem/12771885> Support ruby-position: {before, after} 4 https://bugs.webkit.org/show_bug.cgi?id=103569 5 6 Reviewed by Anders Carlsson. 7 8 * fast/ruby/position-after.html: Added. 9 * platform/mac/fast/ruby/position-after-expected.png: Added. 10 * platform/mac/fast/ruby/position-after-expected.txt: Added. 11 1 12 2012-11-29 Mike West <mkwst@chromium.org> 2 13 -
trunk/Source/WebCore/ChangeLog
r136136 r136142 1 2012-11-29 Dan Bernstein <mitz@apple.com> 2 3 <rdar://problem/12771885> Support ruby-position: {before, after} 4 https://bugs.webkit.org/show_bug.cgi?id=103569 5 6 Reviewed by Anders Carlsson. 7 8 Specified in <http://www.w3.org/TR/2011/WD-css3-ruby-20110630/#rubypos>, the ruby-position 9 property takes four values: before, after, inter-character, and inline. This change adds 10 support for the values before and after. 11 12 Test: fast/ruby/position-after.html 13 14 * css/CSSComputedStyleDeclaration.cpp: 15 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Handle ruby-position. 16 * css/CSSParser.cpp: 17 (WebCore::isValidKeywordPropertyAndValue): Accept before and after as valid values for 18 ruby-position. 19 (WebCore::isKeywordPropertyID): Added ruby-position to the list of properties with keyword 20 values. 21 (WebCore::CSSParser::parseValue): Added ruby-position to the switch statement. 22 * css/CSSPrimitiveValueMappings.h: 23 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Added mapping from RubyPosition. 24 (WebCore::CSSPrimitiveValue::operator RubyPosition): Added mapping from CSSPrimitiveValue. 25 * css/CSSProperty.cpp: 26 (WebCore::CSSProperty::isInheritedProperty): Added ruby-position as an inherited property. 27 * css/CSSPropertyNames.in: Added -webkit-ruby-position. 28 * css/CSSValueKeywords.in: Added after and before. 29 * css/StyleBuilder.cpp: 30 (WebCore::StyleBuilder::StyleBuilder): Added a handler for ruby-position. 31 * css/StyleResolver.cpp: 32 (WebCore::StyleResolver::applyProperty): Added ruby-position. 33 * rendering/InlineFlowBox.cpp: 34 (WebCore::InlineFlowBox::placeBoxesInBlockDirection): Changed to choose which of 35 hasAnnotationsBefore and hasAnnotationsAfter to set based on ruby position. 36 (WebCore::InlineFlowBox::computeOverAnnotationAdjustment): Changed to adjust only for 37 ruby positioned before the base. 38 (WebCore::InlineFlowBox::computeUnderAnnotationAdjustment): Added adjustment for ruby 39 positioned after the base. 40 * rendering/RenderRubyRun.cpp: 41 (WebCore::RenderRubyRun::layout): Account for ruby-position when positioning the ruby text 42 relative to the base. 43 * rendering/style/RenderStyle.cpp: 44 (WebCore::RenderStyle::diff): Made a ruby-position difference a layout difference. 45 * rendering/style/RenderStyle.h: Added rubyPosition(), setRubyPosition(), and 46 initialRubyPosition(). 47 * rendering/style/RenderStyleConstants.h: Added the RubyPosition enum. 48 * rendering/style/StyleRareInheritedData.cpp: 49 (WebCore::StyleRareInheritedData::StyleRareInheritedData): Added initialized for 50 m_rubyPosition. Added copying the value of this member to the copy constructor. 51 (WebCore::StyleRareInheritedData::operator==): Added comparison of m_rubyPosition. 52 * rendering/style/StyleRareInheritedData.h: 53 (StyleRareInheritedData): Added m_rubyPosition member variable. 54 1 55 2012-11-29 Tiancheng Jiang <tijiang@rim.com> 2 56 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r136080 r136142 2026 2026 case CSSPropertyRight: 2027 2027 return getPositionOffsetValue(style.get(), CSSPropertyRight, m_node->document()->renderView()); 2028 case CSSPropertyWebkitRubyPosition: 2029 return cssValuePool().createValue(style->rubyPosition()); 2028 2030 case CSSPropertyTableLayout: 2029 2031 return cssValuePool().createValue(style->tableLayout()); -
trunk/Source/WebCore/css/CSSParser.cpp
r136080 r136142 891 891 return true; 892 892 break; 893 894 case CSSPropertyWebkitRubyPosition: 895 if (valueID == CSSValueBefore || valueID == CSSValueAfter) 896 return true; 897 break; 898 893 899 #if ENABLE(CSS3_TEXT) 894 900 case CSSPropertyWebkitTextAlignLast: … … 1058 1064 #endif 1059 1065 case CSSPropertyWebkitRtlOrdering: 1066 case CSSPropertyWebkitRubyPosition: 1060 1067 #if ENABLE(CSS3_TEXT) 1061 1068 case CSSPropertyWebkitTextAlignLast: … … 2874 2881 #endif 2875 2882 case CSSPropertyWebkitRtlOrdering: 2883 case CSSPropertyWebkitRubyPosition: 2876 2884 #if ENABLE(CSS3_TEXT) 2877 2885 case CSSPropertyWebkitTextAlignLast: -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r136053 r136142 2810 2810 ASSERT_NOT_REACHED(); 2811 2811 return TextCombineNone; 2812 } 2813 2814 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(RubyPosition position) 2815 : CSSValue(PrimitiveClass) 2816 { 2817 m_primitiveUnitType = CSS_IDENT; 2818 switch (position) { 2819 case RubyPositionBefore: 2820 m_value.ident = CSSValueBefore; 2821 break; 2822 case RubyPositionAfter: 2823 m_value.ident = CSSValueAfter; 2824 break; 2825 } 2826 } 2827 2828 template<> inline CSSPrimitiveValue::operator RubyPosition() const 2829 { 2830 switch (m_value.ident) { 2831 case CSSValueBefore: 2832 return RubyPositionBefore; 2833 case CSSValueAfter: 2834 return RubyPositionAfter; 2835 } 2836 2837 ASSERT_NOT_REACHED(); 2838 return RubyPositionBefore; 2812 2839 } 2813 2840 -
trunk/Source/WebCore/css/CSSProperty.cpp
r136080 r136142 325 325 case CSSPropertyWebkitPrintColorAdjust: 326 326 case CSSPropertyWebkitRtlOrdering: 327 case CSSPropertyWebkitRubyPosition: 327 328 case CSSPropertyWebkitTextCombine: 328 329 #if ENABLE(CSS3_TEXT) -
trunk/Source/WebCore/css/CSSPropertyNames.in
r136080 r136142 352 352 -webkit-print-color-adjust 353 353 -webkit-rtl-ordering 354 -webkit-ruby-position 354 355 -webkit-text-combine 355 356 -epub-text-combine = -webkit-text-combine -
trunk/Source/WebCore/css/CSSValueKeywords.in
r135314 r136142 872 872 horizontal-bt 873 873 874 // -webkit-ruby-position 875 after 876 before 877 874 878 // -webkit-text-emphasis-position 875 879 over -
trunk/Source/WebCore/css/StyleBuilder.cpp
r136080 r136142 2051 2051 #endif 2052 2052 setPropertyHandler(CSSPropertyWebkitRtlOrdering, ApplyPropertyDefault<Order, &RenderStyle::rtlOrdering, Order, &RenderStyle::setRTLOrdering, Order, &RenderStyle::initialRTLOrdering>::createHandler()); 2053 setPropertyHandler(CSSPropertyWebkitRubyPosition, ApplyPropertyDefault<RubyPosition, &RenderStyle::rubyPosition, RubyPosition, &RenderStyle::setRubyPosition, RubyPosition, &RenderStyle::initialRubyPosition>::createHandler()); 2053 2054 setPropertyHandler(CSSPropertyWebkitTextCombine, ApplyPropertyDefault<TextCombine, &RenderStyle::textCombine, TextCombine, &RenderStyle::setTextCombine, TextCombine, &RenderStyle::initialTextCombine>::createHandler()); 2054 2055 setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::setVisitedLinkTextEmphasisColor, &RenderStyle::color>::createHandler()); -
trunk/Source/WebCore/css/StyleResolver.cpp
r136105 r136142 3806 3806 #endif 3807 3807 case CSSPropertyWebkitRtlOrdering: 3808 case CSSPropertyWebkitRubyPosition: 3808 3809 case CSSPropertyWebkitTextCombine: 3809 3810 #if ENABLE(CSS3_TEXT) -
trunk/Source/WebCore/rendering/InlineFlowBox.cpp
r135841 r136142 671 671 // Really this is a workaround hack for the fact that ruby should have been done as line layout and not done using 672 672 // inline-block. 673 if ( !renderer()->style()->isFlippedLinesWritingMode())673 if (renderer()->style()->isFlippedLinesWritingMode() == (curr->renderer()->style()->rubyPosition() == RubyPositionAfter)) 674 674 hasAnnotationsBefore = true; 675 675 else … … 1462 1462 result = max(result, toInlineFlowBox(curr)->computeOverAnnotationAdjustment(allowedPosition)); 1463 1463 1464 if (curr->renderer()->isReplaced() && curr->renderer()->isRubyRun() ) {1464 if (curr->renderer()->isReplaced() && curr->renderer()->isRubyRun() && curr->renderer()->style()->rubyPosition() == RubyPositionBefore) { 1465 1465 RenderRubyRun* rubyRun = toRenderRubyRun(curr->renderer()); 1466 1466 RenderRubyText* rubyText = rubyRun->rubyText(); … … 1510 1510 result = max(result, toInlineFlowBox(curr)->computeUnderAnnotationAdjustment(allowedPosition)); 1511 1511 1512 if (curr->renderer()->isReplaced() && curr->renderer()->isRubyRun() && curr->renderer()->style()->rubyPosition() == RubyPositionAfter) { 1513 RenderRubyRun* rubyRun = toRenderRubyRun(curr->renderer()); 1514 RenderRubyText* rubyText = rubyRun->rubyText(); 1515 if (!rubyText) 1516 continue; 1517 1518 if (rubyRun->style()->isFlippedLinesWritingMode()) { 1519 LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (rubyText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit()); 1520 if (topOfFirstRubyTextLine >= 0) 1521 continue; 1522 topOfFirstRubyTextLine += curr->logicalTop(); 1523 result = max(result, allowedPosition - topOfFirstRubyTextLine); 1524 } else { 1525 LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logicalHeight()); 1526 if (bottomOfLastRubyTextLine <= curr->logicalHeight()) 1527 continue; 1528 bottomOfLastRubyTextLine += curr->logicalTop(); 1529 result = max(result, bottomOfLastRubyTextLine - allowedPosition); 1530 } 1531 } 1532 1512 1533 if (curr->isInlineTextBox()) { 1513 1534 RenderStyle* style = curr->renderer()->style(isFirstLineStyle()); -
trunk/Source/WebCore/rendering/RenderRubyRun.cpp
r131938 r136142 247 247 } 248 248 249 if ( !style()->isFlippedLinesWritingMode()) {249 if (style()->isFlippedLinesWritingMode() == (style()->rubyPosition() == RubyPositionAfter)) { 250 250 LayoutUnit firstLineTop = 0; 251 251 if (RenderRubyBase* rb = rubyBase()) { -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r136001 r136142 479 479 || rareInheritedData->hyphenationString != other->rareInheritedData->hyphenationString 480 480 || rareInheritedData->locale != other->rareInheritedData->locale 481 || rareInheritedData->m_rubyPosition != other->rareInheritedData->m_rubyPosition 481 482 || rareInheritedData->textEmphasisMark != other->rareInheritedData->textEmphasisMark 482 483 || rareInheritedData->textEmphasisPosition != other->rareInheritedData->textEmphasisPosition -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r136080 r136142 836 836 TextEmphasisPosition textEmphasisPosition() const { return static_cast<TextEmphasisPosition>(rareInheritedData->textEmphasisPosition); } 837 837 const AtomicString& textEmphasisMarkString() const; 838 838 839 RubyPosition rubyPosition() const { return static_cast<RubyPosition>(rareInheritedData->m_rubyPosition); } 840 839 841 // Return true if any transform related property (currently transform, transformStyle3D or perspective) 840 842 // indicates that we are transforming … … 1300 1302 void setTextEmphasisCustomMark(const AtomicString& mark) { SET_VAR(rareInheritedData, textEmphasisCustomMark, mark); } 1301 1303 void setTextEmphasisPosition(TextEmphasisPosition position) { SET_VAR(rareInheritedData, textEmphasisPosition, position); } 1304 1305 void setRubyPosition(RubyPosition position) { SET_VAR(rareInheritedData, m_rubyPosition, position); } 1302 1306 1303 1307 #if ENABLE(CSS_FILTERS) … … 1617 1621 static const AtomicString& initialTextEmphasisCustomMark() { return nullAtom; } 1618 1622 static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmphasisPositionOver; } 1623 static RubyPosition initialRubyPosition() { return RubyPositionBefore; } 1619 1624 static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; } 1620 1625 static ImageOrientationEnum initialImageOrientation() { return OriginTopLeft; } -
trunk/Source/WebCore/rendering/style/RenderStyleConstants.h
r136053 r136142 476 476 enum WrapThrough { WrapThroughWrap, WrapThroughNone }; 477 477 478 enum RubyPosition { RubyPositionBefore, RubyPositionAfter }; 479 478 480 #if ENABLE(DRAGGABLE_REGION) 479 481 enum DraggableRegionMode { DraggableRegionNone, DraggableRegionDrag, DraggableRegionNoDrag }; -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
r135788 r136142 103 103 , m_textAlignLast(RenderStyle::initialTextAlignLast()) 104 104 #endif // CSS3_TEXT 105 , m_rubyPosition(RenderStyle::initialRubyPosition()) 105 106 , hyphenationLimitBefore(-1) 106 107 , hyphenationLimitAfter(-1) … … 169 170 , m_textAlignLast(o.m_textAlignLast) 170 171 #endif // CSS3_TEXT 172 , m_rubyPosition(o.m_rubyPosition) 171 173 , hyphenationString(o.hyphenationString) 172 174 , hyphenationLimitBefore(o.hyphenationLimitBefore) … … 261 263 && m_textAlignLast == o.m_textAlignLast 262 264 #endif // CSS3_TEXT 265 && m_rubyPosition == o.m_rubyPosition 263 266 && m_lineSnap == o.m_lineSnap 264 267 #if ENABLE(CSS_VARIABLES) -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h
r135788 r136142 117 117 unsigned m_textAlignLast : 3; // ETextAlignLast 118 118 #endif // CSS3_TEXT 119 unsigned m_rubyPosition : 1; // RubyPosition 119 120 120 121 AtomicString hyphenationString;
Note:
See TracChangeset
for help on using the changeset viewer.