Title: [136142] trunk
Revision
136142
Author
[email protected]
Date
2012-11-29 10:43:56 -0800 (Thu, 29 Nov 2012)

Log Message

<rdar://problem/12771885> Support ruby-position: {before, after}
https://bugs.webkit.org/show_bug.cgi?id=103569

Reviewed by Anders Carlsson.

Source/WebCore: 

Specified in <http://www.w3.org/TR/2011/WD-css3-ruby-20110630/#rubypos>, the ruby-position
property takes four values: before, after, inter-character, and inline. This change adds
support for the values before and after.

Test: fast/ruby/position-after.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Handle ruby-position.
* css/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue): Accept before and after as valid values for
ruby-position.
(WebCore::isKeywordPropertyID): Added ruby-position to the list of properties with keyword
values.
(WebCore::CSSParser::parseValue): Added ruby-position to the switch statement.
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Added mapping from RubyPosition.
(WebCore::CSSPrimitiveValue::operator RubyPosition): Added mapping from CSSPrimitiveValue.
* css/CSSProperty.cpp:
(WebCore::CSSProperty::isInheritedProperty): Added ruby-position as an inherited property.
* css/CSSPropertyNames.in: Added -webkit-ruby-position.
* css/CSSValueKeywords.in: Added after and before.
* css/StyleBuilder.cpp:
(WebCore::StyleBuilder::StyleBuilder): Added a handler for ruby-position.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty): Added ruby-position.
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::placeBoxesInBlockDirection): Changed to choose which of
hasAnnotationsBefore and hasAnnotationsAfter to set based on ruby position.
(WebCore::InlineFlowBox::computeOverAnnotationAdjustment): Changed to adjust only for
ruby positioned before the base.
(WebCore::InlineFlowBox::computeUnderAnnotationAdjustment): Added adjustment for ruby
positioned after the base.
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::layout): Account for ruby-position when positioning the ruby text
relative to the base.
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::diff): Made a ruby-position difference a layout difference.
* rendering/style/RenderStyle.h: Added rubyPosition(), setRubyPosition(), and 
initialRubyPosition().
* rendering/style/RenderStyleConstants.h: Added the RubyPosition enum.
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData): Added initialized for
m_rubyPosition. Added copying the value of this member to the copy constructor.
(WebCore::StyleRareInheritedData::operator==): Added comparison of m_rubyPosition.
* rendering/style/StyleRareInheritedData.h:
(StyleRareInheritedData): Added m_rubyPosition member variable.

LayoutTests: 

* fast/ruby/position-after.html: Added.
* platform/mac/fast/ruby/position-after-expected.png: Added.
* platform/mac/fast/ruby/position-after-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (136141 => 136142)


--- trunk/LayoutTests/ChangeLog	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/LayoutTests/ChangeLog	2012-11-29 18:43:56 UTC (rev 136142)
@@ -1,3 +1,14 @@
+2012-11-29  Dan Bernstein  <[email protected]>
+
+        <rdar://problem/12771885> Support ruby-position: {before, after}
+        https://bugs.webkit.org/show_bug.cgi?id=103569
+
+        Reviewed by Anders Carlsson.
+
+        * fast/ruby/position-after.html: Added.
+        * platform/mac/fast/ruby/position-after-expected.png: Added.
+        * platform/mac/fast/ruby/position-after-expected.txt: Added.
+
 2012-11-29  Mike West  <[email protected]>
 
         Typo in 'autofocus' sandboxing error message.

Added: trunk/LayoutTests/fast/ruby/position-after.html (0 => 136142)


--- trunk/LayoutTests/fast/ruby/position-after.html	                        (rev 0)
+++ trunk/LayoutTests/fast/ruby/position-after.html	2012-11-29 18:43:56 UTC (rev 136142)
@@ -0,0 +1,47 @@
+<style>
+    div.container {
+        -webkit-logical-width: 8em;
+        font: 20px ahem;
+        -webkit-font-smoothing: none;
+        outline: thin dashed lightblue;
+        -webkit-ruby-position: after;
+        margin: 8px 0;
+    }
+
+    span.emphasis {
+        -webkit-text-emphasis-style: "w";
+        -webkit-text-emphasis-color: purple;
+    }
+
+    ruby {
+        color: blue;
+    }
+
+    rt {
+        color: orange;
+    }
+</style>
+<div style="float: left;">
+    <div class="container">
+        xxxxx xx <ruby>xxxx<rt>yyy</rt></ruby> xxx xxx xxxx
+        <ruby>xxxxx<rt>y<br>y</rt></ruby> <span class="emphasis">xx</span>
+        xxx xxxx
+    </div>
+    <div class="container" style="-webkit-writing-mode: vertical-lr;">
+        xxxxx xx <ruby>xxxx<rt>yyy</rt></ruby> xxx xxx xxxx
+        <ruby>xxxxx<rt>y<br>y</rt></ruby> <span class="emphasis">xx</span>
+        xxx xxxx
+    </div>
+</div>
+<div style="float: left; margin-left: 8px;">
+    <div class="container" style="-webkit-writing-mode: horizontal-bt;">
+        xxxxx xx <ruby>xxxx<rt>yyy</rt></ruby> xxx xxx xxxx
+        <ruby>xxxxx<rt>y<br>y</rt></ruby> <span class="emphasis">xx</span>
+        xxx xxxx
+    </div>
+    <div class="container" style="-webkit-writing-mode: vertical-rl;">
+        xxxxx xx <ruby>xxxx<rt>yyy</rt></ruby> xxx xxx xxxx
+        <ruby>xxxxx<rt>y<br>y</rt></ruby> <span class="emphasis">xx</span>
+        xxx xxxx
+    </div>
+</div>

Added: trunk/LayoutTests/platform/mac/fast/ruby/position-after-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/fast/ruby/position-after-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/fast/ruby/position-after-expected.txt (0 => 136142)


--- trunk/LayoutTests/platform/mac/fast/ruby/position-after-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/ruby/position-after-expected.txt	2012-11-29 18:43:56 UTC (rev 136142)
@@ -0,0 +1,135 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock (floating) {DIV} at (0,0) size 160x324
+        RenderBlock {DIV} at (0,8) size 160x140
+          RenderText {#text} at (0,0) size 160x20
+            text run at (0,0) width 160: "xxxxx xx"
+          RenderRuby (inline) {RUBY} at (0,0) size 80x20 [color=#0000FF]
+            RenderRubyRun (anonymous) at (0,20) size 80x20
+              RenderRubyText {RT} at (0,20) size 80x10 [color=#FFA500]
+                RenderText {#text} at (25,0) size 30x10
+                  text run at (25,0) width 30: "yyy"
+              RenderRubyBase (anonymous) at (0,0) size 80x20
+                RenderText {#text} at (0,0) size 80x20
+                  text run at (0,0) width 80: "xxxx"
+          RenderText {#text} at (80,20) size 160x50
+            text run at (80,20) width 80: " xxx"
+            text run at (0,50) width 160: "xxx xxxx"
+          RenderRuby (inline) {RUBY} at (0,0) size 100x20 [color=#0000FF]
+            RenderRubyRun (anonymous) at (0,80) size 100x20
+              RenderRubyText {RT} at (0,20) size 100x20 [color=#FFA500]
+                RenderText {#text} at (45,0) size 10x10
+                  text run at (45,0) width 10: "y"
+                RenderBR {BR} at (55,8) size 0x0
+                RenderText {#text} at (45,10) size 10x10
+                  text run at (45,10) width 10: "y"
+              RenderRubyBase (anonymous) at (0,0) size 100x20
+                RenderText {#text} at (0,0) size 100x20
+                  text run at (0,0) width 100: "xxxxx"
+          RenderText {#text} at (100,80) size 20x20
+            text run at (100,80) width 20: " "
+          RenderInline {SPAN} at (0,0) size 40x20
+            RenderText {#text} at (120,80) size 40x20
+              text run at (120,80) width 40: "xx"
+          RenderText {#text} at (0,120) size 160x20
+            text run at (0,120) width 160: "xxx xxxx"
+        RenderBlock {DIV} at (0,156) size 140x160
+          RenderText {#text} at (0,0) size 20x160
+            text run at (0,0) width 160: "xxxxx xx"
+          RenderRuby (inline) {RUBY} at (0,0) size 20x80 [color=#0000FF]
+            RenderRubyRun (anonymous) at (30,0) size 20x80
+              RenderRubyText {RT} at (-10,0) size 10x80 [color=#FFA500]
+                RenderText {#text} at (0,25) size 10x30
+                  text run at (0,25) width 30: "yyy"
+              RenderRubyBase (anonymous) at (0,0) size 20x80
+                RenderText {#text} at (0,0) size 20x80
+                  text run at (0,0) width 80: "xxxx"
+          RenderText {#text} at (30,80) size 40x160
+            text run at (30,80) width 80: " xxx"
+            text run at (50,0) width 160: "xxx xxxx"
+          RenderRuby (inline) {RUBY} at (0,0) size 20x100 [color=#0000FF]
+            RenderRubyRun (anonymous) at (90,0) size 20x100
+              RenderRubyText {RT} at (-20,0) size 20x100 [color=#FFA500]
+                RenderText {#text} at (0,45) size 10x10
+                  text run at (0,45) width 10: "y"
+                RenderBR {BR} at (2,55) size 0x0
+                RenderText {#text} at (10,45) size 10x10
+                  text run at (10,45) width 10: "y"
+              RenderRubyBase (anonymous) at (0,0) size 20x100
+                RenderText {#text} at (0,0) size 20x100
+                  text run at (0,0) width 100: "xxxxx"
+          RenderText {#text} at (90,100) size 20x20
+            text run at (90,100) width 20: " "
+          RenderInline {SPAN} at (0,0) size 20x40
+            RenderText {#text} at (90,120) size 20x40
+              text run at (90,120) width 40: "xx"
+          RenderText {#text} at (120,0) size 20x160
+            text run at (120,0) width 160: "xxx xxxx"
+      RenderBlock (floating) {DIV} at (168,0) size 160x324
+        RenderBlock {DIV} at (0,8) size 160x140
+          RenderText {#text} at (0,0) size 160x20
+            text run at (0,0) width 160: "xxxxx xx"
+          RenderRuby (inline) {RUBY} at (0,0) size 80x20 [color=#0000FF]
+            RenderRubyRun (anonymous) at (0,30) size 80x20
+              RenderRubyText {RT} at (0,-10) size 80x10 [color=#FFA500]
+                RenderText {#text} at (25,0) size 30x10
+                  text run at (25,0) width 30: "yyy"
+              RenderRubyBase (anonymous) at (0,0) size 80x20
+                RenderText {#text} at (0,0) size 80x20
+                  text run at (0,0) width 80: "xxxx"
+          RenderText {#text} at (80,30) size 160x40
+            text run at (80,30) width 80: " xxx"
+            text run at (0,50) width 160: "xxx xxxx"
+          RenderRuby (inline) {RUBY} at (0,0) size 100x20 [color=#0000FF]
+            RenderRubyRun (anonymous) at (0,90) size 100x20
+              RenderRubyText {RT} at (0,-20) size 100x20 [color=#FFA500]
+                RenderText {#text} at (45,0) size 10x10
+                  text run at (45,0) width 10: "y"
+                RenderBR {BR} at (55,2) size 0x0
+                RenderText {#text} at (45,10) size 10x10
+                  text run at (45,10) width 10: "y"
+              RenderRubyBase (anonymous) at (0,0) size 100x20
+                RenderText {#text} at (0,0) size 100x20
+                  text run at (0,0) width 100: "xxxxx"
+          RenderText {#text} at (100,90) size 20x20
+            text run at (100,90) width 20: " "
+          RenderInline {SPAN} at (0,0) size 40x20
+            RenderText {#text} at (120,90) size 40x20
+              text run at (120,90) width 40: "xx"
+          RenderText {#text} at (0,120) size 160x20
+            text run at (0,120) width 160: "xxx xxxx"
+        RenderBlock {DIV} at (0,156) size 140x160
+          RenderText {#text} at (0,0) size 20x160
+            text run at (0,0) width 160: "xxxxx xx"
+          RenderRuby (inline) {RUBY} at (0,0) size 20x80 [color=#0000FF]
+            RenderRubyRun (anonymous) at (20,0) size 20x80
+              RenderRubyText {RT} at (20,0) size 10x80 [color=#FFA500]
+                RenderText {#text} at (0,25) size 10x30
+                  text run at (0,25) width 30: "yyy"
+              RenderRubyBase (anonymous) at (0,0) size 20x80
+                RenderText {#text} at (0,0) size 20x80
+                  text run at (0,0) width 80: "xxxx"
+          RenderText {#text} at (20,80) size 50x160
+            text run at (20,80) width 80: " xxx"
+            text run at (50,0) width 160: "xxx xxxx"
+          RenderRuby (inline) {RUBY} at (0,0) size 20x100 [color=#0000FF]
+            RenderRubyRun (anonymous) at (80,0) size 20x100
+              RenderRubyText {RT} at (20,0) size 20x100 [color=#FFA500]
+                RenderText {#text} at (0,45) size 10x10
+                  text run at (0,45) width 10: "y"
+                RenderBR {BR} at (8,55) size 0x0
+                RenderText {#text} at (10,45) size 10x10
+                  text run at (10,45) width 10: "y"
+              RenderRubyBase (anonymous) at (0,0) size 20x100
+                RenderText {#text} at (0,0) size 20x100
+                  text run at (0,0) width 100: "xxxxx"
+          RenderText {#text} at (80,100) size 20x20
+            text run at (80,100) width 20: " "
+          RenderInline {SPAN} at (0,0) size 20x40
+            RenderText {#text} at (80,120) size 20x40
+              text run at (80,120) width 40: "xx"
+          RenderText {#text} at (120,0) size 20x160
+            text run at (120,0) width 160: "xxx xxxx"

Modified: trunk/Source/WebCore/ChangeLog (136141 => 136142)


--- trunk/Source/WebCore/ChangeLog	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/Source/WebCore/ChangeLog	2012-11-29 18:43:56 UTC (rev 136142)
@@ -1,3 +1,57 @@
+2012-11-29  Dan Bernstein  <[email protected]>
+
+        <rdar://problem/12771885> Support ruby-position: {before, after}
+        https://bugs.webkit.org/show_bug.cgi?id=103569
+
+        Reviewed by Anders Carlsson.
+
+        Specified in <http://www.w3.org/TR/2011/WD-css3-ruby-20110630/#rubypos>, the ruby-position
+        property takes four values: before, after, inter-character, and inline. This change adds
+        support for the values before and after.
+
+        Test: fast/ruby/position-after.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Handle ruby-position.
+        * css/CSSParser.cpp:
+        (WebCore::isValidKeywordPropertyAndValue): Accept before and after as valid values for
+        ruby-position.
+        (WebCore::isKeywordPropertyID): Added ruby-position to the list of properties with keyword
+        values.
+        (WebCore::CSSParser::parseValue): Added ruby-position to the switch statement.
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): Added mapping from RubyPosition.
+        (WebCore::CSSPrimitiveValue::operator RubyPosition): Added mapping from CSSPrimitiveValue.
+        * css/CSSProperty.cpp:
+        (WebCore::CSSProperty::isInheritedProperty): Added ruby-position as an inherited property.
+        * css/CSSPropertyNames.in: Added -webkit-ruby-position.
+        * css/CSSValueKeywords.in: Added after and before.
+        * css/StyleBuilder.cpp:
+        (WebCore::StyleBuilder::StyleBuilder): Added a handler for ruby-position.
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::applyProperty): Added ruby-position.
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::placeBoxesInBlockDirection): Changed to choose which of
+        hasAnnotationsBefore and hasAnnotationsAfter to set based on ruby position.
+        (WebCore::InlineFlowBox::computeOverAnnotationAdjustment): Changed to adjust only for
+        ruby positioned before the base.
+        (WebCore::InlineFlowBox::computeUnderAnnotationAdjustment): Added adjustment for ruby
+        positioned after the base.
+        * rendering/RenderRubyRun.cpp:
+        (WebCore::RenderRubyRun::layout): Account for ruby-position when positioning the ruby text
+        relative to the base.
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::diff): Made a ruby-position difference a layout difference.
+        * rendering/style/RenderStyle.h: Added rubyPosition(), setRubyPosition(), and 
+        initialRubyPosition().
+        * rendering/style/RenderStyleConstants.h: Added the RubyPosition enum.
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::StyleRareInheritedData): Added initialized for
+        m_rubyPosition. Added copying the value of this member to the copy constructor.
+        (WebCore::StyleRareInheritedData::operator==): Added comparison of m_rubyPosition.
+        * rendering/style/StyleRareInheritedData.h:
+        (StyleRareInheritedData): Added m_rubyPosition member variable.
+
 2012-11-29  Tiancheng Jiang  <[email protected]>
 
         [BlackBerry] Update BB10 form theme.

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (136141 => 136142)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2012-11-29 18:43:56 UTC (rev 136142)
@@ -2025,6 +2025,8 @@
             return cssValuePool().createValue(style->position());
         case CSSPropertyRight:
             return getPositionOffsetValue(style.get(), CSSPropertyRight, m_node->document()->renderView());
+        case CSSPropertyWebkitRubyPosition:
+            return cssValuePool().createValue(style->rubyPosition());
         case CSSPropertyTableLayout:
             return cssValuePool().createValue(style->tableLayout());
         case CSSPropertyTextAlign:

Modified: trunk/Source/WebCore/css/CSSParser.cpp (136141 => 136142)


--- trunk/Source/WebCore/css/CSSParser.cpp	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/Source/WebCore/css/CSSParser.cpp	2012-11-29 18:43:56 UTC (rev 136142)
@@ -890,6 +890,12 @@
         if (valueID == CSSValueLogical || valueID == CSSValueVisual)
             return true;
         break;
+
+    case CSSPropertyWebkitRubyPosition:
+        if (valueID == CSSValueBefore || valueID == CSSValueAfter)
+            return true;
+        break;
+
 #if ENABLE(CSS3_TEXT)
     case CSSPropertyWebkitTextAlignLast:
         // auto | start | end | left | right | center | justify
@@ -1057,6 +1063,7 @@
     case CSSPropertyWebkitRegionOverflow:
 #endif
     case CSSPropertyWebkitRtlOrdering:
+    case CSSPropertyWebkitRubyPosition:
 #if ENABLE(CSS3_TEXT)
     case CSSPropertyWebkitTextAlignLast:
 #endif // CSS3_TEXT
@@ -2873,6 +2880,7 @@
     case CSSPropertyWebkitRegionOverflow:
 #endif
     case CSSPropertyWebkitRtlOrdering:
+    case CSSPropertyWebkitRubyPosition:
 #if ENABLE(CSS3_TEXT)
     case CSSPropertyWebkitTextAlignLast:
 #endif // CSS3_TEXT

Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (136141 => 136142)


--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h	2012-11-29 18:43:56 UTC (rev 136142)
@@ -2811,6 +2811,33 @@
     return TextCombineNone;
 }
 
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(RubyPosition position)
+    : CSSValue(PrimitiveClass)
+{
+    m_primitiveUnitType = CSS_IDENT;
+    switch (position) {
+    case RubyPositionBefore:
+        m_value.ident = CSSValueBefore;
+        break;
+    case RubyPositionAfter:
+        m_value.ident = CSSValueAfter;
+        break;
+    }
+}
+
+template<> inline CSSPrimitiveValue::operator RubyPosition() const
+{
+    switch (m_value.ident) {
+    case CSSValueBefore:
+        return RubyPositionBefore;
+    case CSSValueAfter:
+        return RubyPositionAfter;
+    }
+
+    ASSERT_NOT_REACHED();
+    return RubyPositionBefore;
+}
+
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextEmphasisPosition position)
     : CSSValue(PrimitiveClass)
 {

Modified: trunk/Source/WebCore/css/CSSProperty.cpp (136141 => 136142)


--- trunk/Source/WebCore/css/CSSProperty.cpp	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/Source/WebCore/css/CSSProperty.cpp	2012-11-29 18:43:56 UTC (rev 136142)
@@ -324,6 +324,7 @@
 #endif
     case CSSPropertyWebkitPrintColorAdjust:
     case CSSPropertyWebkitRtlOrdering:
+    case CSSPropertyWebkitRubyPosition:
     case CSSPropertyWebkitTextCombine:
 #if ENABLE(CSS3_TEXT)
     case CSSPropertyWebkitTextDecorationLine:

Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (136141 => 136142)


--- trunk/Source/WebCore/css/CSSPropertyNames.in	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in	2012-11-29 18:43:56 UTC (rev 136142)
@@ -351,6 +351,7 @@
 -webkit-perspective-origin-y
 -webkit-print-color-adjust
 -webkit-rtl-ordering
+-webkit-ruby-position
 -webkit-text-combine
 -epub-text-combine = -webkit-text-combine
 #if defined(ENABLE_CSS3_TEXT) && ENABLE_CSS3_TEXT

Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (136141 => 136142)


--- trunk/Source/WebCore/css/CSSValueKeywords.in	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in	2012-11-29 18:43:56 UTC (rev 136142)
@@ -871,6 +871,10 @@
 vertical-lr
 horizontal-bt
 
+// -webkit-ruby-position
+after
+before
+
 // -webkit-text-emphasis-position
 over
 under

Modified: trunk/Source/WebCore/css/StyleBuilder.cpp (136141 => 136142)


--- trunk/Source/WebCore/css/StyleBuilder.cpp	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/Source/WebCore/css/StyleBuilder.cpp	2012-11-29 18:43:56 UTC (rev 136142)
@@ -2050,6 +2050,7 @@
     setPropertyHandler(CSSPropertyWebkitRegionOverflow, ApplyPropertyDefault<RegionOverflow, &RenderStyle::regionOverflow, RegionOverflow, &RenderStyle::setRegionOverflow, RegionOverflow, &RenderStyle::initialRegionOverflow>::createHandler());
 #endif
     setPropertyHandler(CSSPropertyWebkitRtlOrdering, ApplyPropertyDefault<Order, &RenderStyle::rtlOrdering, Order, &RenderStyle::setRTLOrdering, Order, &RenderStyle::initialRTLOrdering>::createHandler());
+    setPropertyHandler(CSSPropertyWebkitRubyPosition, ApplyPropertyDefault<RubyPosition, &RenderStyle::rubyPosition, RubyPosition, &RenderStyle::setRubyPosition, RubyPosition, &RenderStyle::initialRubyPosition>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextCombine, ApplyPropertyDefault<TextCombine, &RenderStyle::textCombine, TextCombine, &RenderStyle::setTextCombine, TextCombine, &RenderStyle::initialTextCombine>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextEmphasisColor, ApplyPropertyColor<NoInheritFromParent, &RenderStyle::textEmphasisColor, &RenderStyle::setTextEmphasisColor, &RenderStyle::setVisitedLinkTextEmphasisColor, &RenderStyle::color>::createHandler());
     setPropertyHandler(CSSPropertyWebkitTextEmphasisPosition, ApplyPropertyDefault<TextEmphasisPosition, &RenderStyle::textEmphasisPosition, TextEmphasisPosition, &RenderStyle::setTextEmphasisPosition, TextEmphasisPosition, &RenderStyle::initialTextEmphasisPosition>::createHandler());

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (136141 => 136142)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2012-11-29 18:43:56 UTC (rev 136142)
@@ -3805,6 +3805,7 @@
     case CSSPropertyWebkitRegionOverflow:
 #endif
     case CSSPropertyWebkitRtlOrdering:
+    case CSSPropertyWebkitRubyPosition:
     case CSSPropertyWebkitTextCombine:
 #if ENABLE(CSS3_TEXT)
     case CSSPropertyWebkitTextDecorationLine:

Modified: trunk/Source/WebCore/rendering/InlineFlowBox.cpp (136141 => 136142)


--- trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/Source/WebCore/rendering/InlineFlowBox.cpp	2012-11-29 18:43:56 UTC (rev 136142)
@@ -670,7 +670,7 @@
                 // Treat the leading on the first and last lines of ruby runs as not being part of the overall lineTop/lineBottom.
                 // Really this is a workaround hack for the fact that ruby should have been done as line layout and not done using
                 // inline-block.
-                if (!renderer()->style()->isFlippedLinesWritingMode())
+                if (renderer()->style()->isFlippedLinesWritingMode() == (curr->renderer()->style()->rubyPosition() == RubyPositionAfter))
                     hasAnnotationsBefore = true;
                 else
                     hasAnnotationsAfter = true;
@@ -1461,7 +1461,7 @@
         if (curr->isInlineFlowBox())
             result = max(result, toInlineFlowBox(curr)->computeOverAnnotationAdjustment(allowedPosition));
         
-        if (curr->renderer()->isReplaced() && curr->renderer()->isRubyRun()) {
+        if (curr->renderer()->isReplaced() && curr->renderer()->isRubyRun() && curr->renderer()->style()->rubyPosition() == RubyPositionBefore) {
             RenderRubyRun* rubyRun = toRenderRubyRun(curr->renderer());
             RenderRubyText* rubyText = rubyRun->rubyText();
             if (!rubyText)
@@ -1509,6 +1509,27 @@
         if (curr->isInlineFlowBox())
             result = max(result, toInlineFlowBox(curr)->computeUnderAnnotationAdjustment(allowedPosition));
 
+        if (curr->renderer()->isReplaced() && curr->renderer()->isRubyRun() && curr->renderer()->style()->rubyPosition() == RubyPositionAfter) {
+            RenderRubyRun* rubyRun = toRenderRubyRun(curr->renderer());
+            RenderRubyText* rubyText = rubyRun->rubyText();
+            if (!rubyText)
+                continue;
+
+            if (rubyRun->style()->isFlippedLinesWritingMode()) {
+                LayoutUnit topOfFirstRubyTextLine = rubyText->logicalTop() + (rubyText->firstRootBox() ? rubyText->firstRootBox()->lineTop() : LayoutUnit());
+                if (topOfFirstRubyTextLine >= 0)
+                    continue;
+                topOfFirstRubyTextLine += curr->logicalTop();
+                result = max(result, allowedPosition - topOfFirstRubyTextLine);
+            } else {
+                LayoutUnit bottomOfLastRubyTextLine = rubyText->logicalTop() + (rubyText->lastRootBox() ? rubyText->lastRootBox()->lineBottom() : rubyText->logicalHeight());
+                if (bottomOfLastRubyTextLine <= curr->logicalHeight())
+                    continue;
+                bottomOfLastRubyTextLine += curr->logicalTop();
+                result = max(result, bottomOfLastRubyTextLine - allowedPosition);
+            }
+        }
+
         if (curr->isInlineTextBox()) {
             RenderStyle* style = curr->renderer()->style(isFirstLineStyle());
             if (style->textEmphasisMark() != TextEmphasisMarkNone && style->textEmphasisPosition() == TextEmphasisPositionUnder) {

Modified: trunk/Source/WebCore/rendering/RenderRubyRun.cpp (136141 => 136142)


--- trunk/Source/WebCore/rendering/RenderRubyRun.cpp	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/Source/WebCore/rendering/RenderRubyRun.cpp	2012-11-29 18:43:56 UTC (rev 136142)
@@ -246,7 +246,7 @@
         lastLineRubyTextBottom = rootBox->logicalBottomLayoutOverflow();
     }
 
-    if (!style()->isFlippedLinesWritingMode()) {
+    if (style()->isFlippedLinesWritingMode() == (style()->rubyPosition() == RubyPositionAfter)) {
         LayoutUnit firstLineTop = 0;
         if (RenderRubyBase* rb = rubyBase()) {
             RootInlineBox* rootBox = rb->firstRootBox();

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (136141 => 136142)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2012-11-29 18:43:56 UTC (rev 136142)
@@ -478,6 +478,7 @@
             || rareInheritedData->hyphenationLimitAfter != other->rareInheritedData->hyphenationLimitAfter
             || rareInheritedData->hyphenationString != other->rareInheritedData->hyphenationString
             || rareInheritedData->locale != other->rareInheritedData->locale
+            || rareInheritedData->m_rubyPosition != other->rareInheritedData->m_rubyPosition
             || rareInheritedData->textEmphasisMark != other->rareInheritedData->textEmphasisMark
             || rareInheritedData->textEmphasisPosition != other->rareInheritedData->textEmphasisPosition
             || rareInheritedData->textEmphasisCustomMark != other->rareInheritedData->textEmphasisCustomMark

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (136141 => 136142)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2012-11-29 18:43:56 UTC (rev 136142)
@@ -835,7 +835,9 @@
     const AtomicString& textEmphasisCustomMark() const { return rareInheritedData->textEmphasisCustomMark; }
     TextEmphasisPosition textEmphasisPosition() const { return static_cast<TextEmphasisPosition>(rareInheritedData->textEmphasisPosition); }
     const AtomicString& textEmphasisMarkString() const;
-    
+
+    RubyPosition rubyPosition() const { return static_cast<RubyPosition>(rareInheritedData->m_rubyPosition); }
+
     // Return true if any transform related property (currently transform, transformStyle3D or perspective) 
     // indicates that we are transforming
     bool hasTransformRelatedProperty() const { return hasTransform() || preserves3D() || hasPerspective(); }
@@ -1300,6 +1302,8 @@
     void setTextEmphasisCustomMark(const AtomicString& mark) { SET_VAR(rareInheritedData, textEmphasisCustomMark, mark); }
     void setTextEmphasisPosition(TextEmphasisPosition position) { SET_VAR(rareInheritedData, textEmphasisPosition, position); }
 
+    void setRubyPosition(RubyPosition position) { SET_VAR(rareInheritedData, m_rubyPosition, position); }
+
 #if ENABLE(CSS_FILTERS)
     void setFilter(const FilterOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_filter, m_operations, ops); }
 #endif
@@ -1616,6 +1620,7 @@
     static TextEmphasisMark initialTextEmphasisMark() { return TextEmphasisMarkNone; }
     static const AtomicString& initialTextEmphasisCustomMark() { return nullAtom; }
     static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmphasisPositionOver; }
+    static RubyPosition initialRubyPosition() { return RubyPositionBefore; }
     static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; }
     static ImageOrientationEnum initialImageOrientation() { return OriginTopLeft; }
     static EImageRendering initialImageRendering() { return ImageRenderingAuto; }

Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (136141 => 136142)


--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h	2012-11-29 18:43:56 UTC (rev 136142)
@@ -475,6 +475,8 @@
 
 enum WrapThrough { WrapThroughWrap, WrapThroughNone };
 
+enum RubyPosition { RubyPositionBefore, RubyPositionAfter };
+
 #if ENABLE(DRAGGABLE_REGION)
 enum DraggableRegionMode { DraggableRegionNone, DraggableRegionDrag, DraggableRegionNoDrag };
 #endif

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (136141 => 136142)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2012-11-29 18:43:56 UTC (rev 136142)
@@ -102,6 +102,7 @@
 #if ENABLE(CSS3_TEXT)
     , m_textAlignLast(RenderStyle::initialTextAlignLast())
 #endif // CSS3_TEXT
+    , m_rubyPosition(RenderStyle::initialRubyPosition())
     , hyphenationLimitBefore(-1)
     , hyphenationLimitAfter(-1)
     , hyphenationLimitLines(-1)
@@ -168,6 +169,7 @@
 #if ENABLE(CSS3_TEXT)
     , m_textAlignLast(o.m_textAlignLast)
 #endif // CSS3_TEXT
+    , m_rubyPosition(o.m_rubyPosition)
     , hyphenationString(o.hyphenationString)
     , hyphenationLimitBefore(o.hyphenationLimitBefore)
     , hyphenationLimitAfter(o.hyphenationLimitAfter)
@@ -260,6 +262,7 @@
 #if ENABLE(CSS3_TEXT)
         && m_textAlignLast == o.m_textAlignLast
 #endif // CSS3_TEXT
+        && m_rubyPosition == o.m_rubyPosition
         && m_lineSnap == o.m_lineSnap
 #if ENABLE(CSS_VARIABLES)
         && m_variables == o.m_variables

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h (136141 => 136142)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h	2012-11-29 18:22:30 UTC (rev 136141)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h	2012-11-29 18:43:56 UTC (rev 136142)
@@ -116,6 +116,7 @@
 #if ENABLE(CSS3_TEXT)
     unsigned m_textAlignLast : 3; // ETextAlignLast
 #endif // CSS3_TEXT
+    unsigned m_rubyPosition : 1; // RubyPosition
 
     AtomicString hyphenationString;
     short hyphenationLimitBefore;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to