<rdar://problem/12771885> Support ruby-position: {before, after}
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Dec 2012 22:16:11 +0000 (22:16 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Dec 2012 22:16:11 +0000 (22:16 +0000)
commit81d7dfcef40e8c84eaf2decacb8fbc0270dc8045
tree931cc5e2c87b7ffc260e0be8c112efa909589c66
parentd7f72e335343b46b3d0d2c92685a3ae50eac8a3d
<rdar://problem/12771885> Support ruby-position: {before, after}
https://bugs.webkit.org/show_bug.cgi?id=103569

Patch by Dan Bernstein <mitz@apple.com> on 2012-12-11
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-expected.png: Added.
* fast/ruby/position-after-expected.txt: Added.
* fast/ruby/position-after.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137359 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/ruby/position-after-expected.png [new file with mode: 0644]
LayoutTests/fast/ruby/position-after-expected.txt [new file with mode: 0644]
LayoutTests/fast/ruby/position-after.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSProperty.cpp
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/StyleBuilder.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/RenderRubyRun.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/RenderStyleConstants.h
Source/WebCore/rendering/style/StyleRareInheritedData.cpp
Source/WebCore/rendering/style/StyleRareInheritedData.h