haikuwebkit/LayoutTests/fast/ruby/bopomofo-rl.html

11 lines
979 B
HTML
Raw Permalink Normal View History

Implement rudimentary Bopomofo Ruby support (ruby-position:inter-character) https://bugs.webkit.org/show_bug.cgi?id=136137 <rdar://problem/12567545> Reviewed by Sam Weinig. Source/WebCore: Added fast/ruby/bopomofo.html and fast/ruby/bopomofo-rl.html. * css/CSSParser.cpp: (WebCore::isValidKeywordPropertyAndValue): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator RubyPosition): * css/CSSPropertyNames.in: * css/CSSValueKeywords.in: Add support for the new inter-character value for ruby-position and also add support for a new font-size keyword, -webkit-ruby-text, that is used to set a smart initial font size based off the type of ruby being presented. * css/DeprecatedStyleBuilder.cpp: (WebCore::ApplyPropertyFontSize::determineRubyTextSizeMultiplier): (WebCore::ApplyPropertyFontSize::applyValue): Determine the Ruby text size multiplier when -webkit-ruby-text is specified as the font size. For ruby-position of before/after, we use 50% of the parent font size. For inter-character ruby, we default to 25% instead. If inter-character Ruby is nested, we assume it's to display tone marks, and we use 100% to ensure the tone mark is the same size and does not get smaller. * css/StyleResolver.cpp: (WebCore::StyleResolver::adjustStyleForInterCharacterRuby): (WebCore::StyleResolver::applyMatchedProperties): * css/StyleResolver.h: ruby-position is now the highest priority CSS property, and it is resolved before all other properties to ensure that its value can be checked when determining a smart default font size. adjustStyleForInterCharacterRuby is a new function called to auto-adjust inter-character ruby text to be vertical writing mode when encountered inside horizontal documents. * css/html.css: (ruby > rt): Change the font-size from 50% to -webkit-ruby-text to allow us to customize it as needed depending on what kind of Ruby we want to show. * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::layout): * rendering/RenderRubyRun.h: Add layout code to properly position vertical ruby text relative to a horizontal base. * rendering/style/RenderStyleConstants.h: Add the new inter-character constant for ruby-position. * rendering/style/StyleRareInheritedData.h: Increase the number of storage bits for RubyPosition from 1 to 2 now that we support 3 values. LayoutTests: * fast/ruby/bopomofo-rl.html: Added. * fast/ruby/bopomofo.html: Added. * platform/mac/fast/ruby/bopomofo-expected.png: Added. * platform/mac/fast/ruby/bopomofo-expected.txt: Added. * platform/mac/fast/ruby/bopomofo-rl-expected.png: Added. * platform/mac/fast/ruby/bopomofo-rl-expected.txt: Added. Canonical link: https://commits.webkit.org/153993@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-08-22 18:18:54 +00:00
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<style>
ruby { -webkit-ruby-position: inter-character; }
</style>
</head>
<body style="line-height:1.5;margin-right:20px;font-family:'serif'; -webkit-writing-mode:vertical-rl">
Implement rudimentary Bopomofo Ruby support (ruby-position:inter-character) https://bugs.webkit.org/show_bug.cgi?id=136137 <rdar://problem/12567545> Reviewed by Sam Weinig. Source/WebCore: Added fast/ruby/bopomofo.html and fast/ruby/bopomofo-rl.html. * css/CSSParser.cpp: (WebCore::isValidKeywordPropertyAndValue): * css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator RubyPosition): * css/CSSPropertyNames.in: * css/CSSValueKeywords.in: Add support for the new inter-character value for ruby-position and also add support for a new font-size keyword, -webkit-ruby-text, that is used to set a smart initial font size based off the type of ruby being presented. * css/DeprecatedStyleBuilder.cpp: (WebCore::ApplyPropertyFontSize::determineRubyTextSizeMultiplier): (WebCore::ApplyPropertyFontSize::applyValue): Determine the Ruby text size multiplier when -webkit-ruby-text is specified as the font size. For ruby-position of before/after, we use 50% of the parent font size. For inter-character ruby, we default to 25% instead. If inter-character Ruby is nested, we assume it's to display tone marks, and we use 100% to ensure the tone mark is the same size and does not get smaller. * css/StyleResolver.cpp: (WebCore::StyleResolver::adjustStyleForInterCharacterRuby): (WebCore::StyleResolver::applyMatchedProperties): * css/StyleResolver.h: ruby-position is now the highest priority CSS property, and it is resolved before all other properties to ensure that its value can be checked when determining a smart default font size. adjustStyleForInterCharacterRuby is a new function called to auto-adjust inter-character ruby text to be vertical writing mode when encountered inside horizontal documents. * css/html.css: (ruby > rt): Change the font-size from 50% to -webkit-ruby-text to allow us to customize it as needed depending on what kind of Ruby we want to show. * rendering/RenderRubyRun.cpp: (WebCore::RenderRubyRun::layout): * rendering/RenderRubyRun.h: Add layout code to properly position vertical ruby text relative to a horizontal base. * rendering/style/RenderStyleConstants.h: Add the new inter-character constant for ruby-position. * rendering/style/StyleRareInheritedData.h: Increase the number of storage bits for RubyPosition from 1 to 2 now that we support 3 values. LayoutTests: * fast/ruby/bopomofo-rl.html: Added. * fast/ruby/bopomofo.html: Added. * platform/mac/fast/ruby/bopomofo-expected.png: Added. * platform/mac/fast/ruby/bopomofo-expected.txt: Added. * platform/mac/fast/ruby/bopomofo-rl-expected.png: Added. * platform/mac/fast/ruby/bopomofo-rl-expected.txt: Added. Canonical link: https://commits.webkit.org/153993@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-08-22 18:18:54 +00:00
<ruby style="font-size:32px"><rp></rp><rt><ruby><rt class="tone">ˋ</rt></ruby></rt><rp></rp><rp></rp><rt><ruby>ㄕㄤ<rt class="tone">ˋ</rt></ruby></rt><rp></rp><rp></rp><rt><ruby><rt class="tone">ˊ</rt></ruby></rt><rp></rp><rp></rp><rt><ruby>ㄋㄢ<rt class="tone">ˊ</rt></ruby></rt><rp></rp><rp></rp><rt><ruby><rt class="tone">ˋ</rt></ruby></rt><rp></rp><rp></rp><rt>ㄓˇ</rt><rp></rp><rp></rp><rt><ruby>ㄆㄚ<rt class="tone">ˋ</rt></ruby></rt><rp></rp><rp></rp><rt><ruby>ㄧㄡ<rt class="tone">ˇ</rt></ruby></rt><rp></rp><rp></rp><rt>ㄒㄧㄣ</rt><rp></rp><rp></rp><rt><ruby>ㄖㄣ<rt class="tone">ˊ</rt></ruby></rt><rp></rp></ruby>