Bug 28420 - Implement HTML5 <ruby> rendering
authorrolandsteiner@chromium.org <rolandsteiner@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Nov 2009 01:52:25 +0000 (01:52 +0000)
committerrolandsteiner@chromium.org <rolandsteiner@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 2 Nov 2009 01:52:25 +0000 (01:52 +0000)
commitb704f622bb06b149361692b3288955a67c5c22ea
tree05fbb489120a46e570ae595ea9f01f4899706487
parent6d962624122bb436146c62ad9a574af341e132c3
Bug 28420 -  Implement HTML5 <ruby> rendering
(https://bugs.webkit.org/show_bug.cgi?id=28420)

Reviewed by Dave Hyatt.

First rudimentary implementation of HTML5 ruby rendering support.

WebCore:

Following the HTML 5 spec, the box object model for a <ruby> element allows several runs of ruby
bases with their respective ruby texts looks as follows:

1 RenderRuby object, corresponding to the whole <ruby> HTML element
     1+ RenderRubyRun (anonymous)
         0 or 1 RenderRubyText - shuffled to the front in order to re-use existing block layouting
             0-n inline object(s)
         0 or 1 RenderRubyBase - contains the inline objects that make up the ruby base
             1-n inline object(s)

Note: <rp> elements are defined as having 'display:none' and thus normally are not assigned a renderer.

New layout tests will be committed in a follow-up patch under fast/ruby.

Makefiles, etc.
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.xcodeproj/project.pbxproj:

CSS
* css/html.css: Added <ruby> and <rt>

Existing render files:
* rendering/RenderBlock.cpp: make moveChild a member function moveChildTo
(WebCore::RenderBlock::moveChildTo):
(WebCore::RenderBlock::makeChildrenNonInline):
(WebCore::RenderBlock::removeChild):
* rendering/RenderBlock.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::createObject): instantiate ruby renderers based on element name
* rendering/RenderObject.h: add query methods for ruby renderers
(WebCore::RenderObject::isRuby):
(WebCore::RenderObject::isRubyBase):
(WebCore::RenderObject::isRubyRun):
(WebCore::RenderObject::isRubyText):

New ruby renderers:
* rendering/RenderRuby.cpp: Added.
(WebCore::lastRubyRun):
(WebCore::findRubyRunParent):
(WebCore::RenderRubyAsInline::RenderRubyAsInline):
(WebCore::RenderRubyAsInline::~RenderRubyAsInline):
(WebCore::RenderRubyAsInline::isChildAllowed):
(WebCore::RenderRubyAsInline::addChild):
(WebCore::RenderRubyAsInline::removeChild):
(WebCore::RenderRubyAsBlock::RenderRubyAsBlock):
(WebCore::RenderRubyAsBlock::~RenderRubyAsBlock):
(WebCore::RenderRubyAsBlock::isChildAllowed):
(WebCore::RenderRubyAsBlock::addChild):
(WebCore::RenderRubyAsBlock::removeChild):
* rendering/RenderRuby.h: Added.
(WebCore::RenderRubyAsInline::renderName):
(WebCore::RenderRubyAsInline::isRuby):
(WebCore::RenderRubyAsBlock::renderName):
(WebCore::RenderRubyAsBlock::isRuby):
* rendering/RenderRubyBase.cpp: Added.
(WebCore::RenderRubyBase::RenderRubyBase):
(WebCore::RenderRubyBase::~RenderRubyBase):
(WebCore::RenderRubyBase::isChildAllowed):
(WebCore::RenderRubyBase::splitToLeft):
(WebCore::RenderRubyBase::mergeWithRight):
* rendering/RenderRubyBase.h: Added.
(WebCore::RenderRubyBase::renderName):
(WebCore::RenderRubyBase::isRubyBase):
* rendering/RenderRubyRun.cpp: Added.
(WebCore::RenderRubyRun::RenderRubyRun):
(WebCore::RenderRubyRun::~RenderRubyRun):
(WebCore::RenderRubyRun::hasRubyText):
(WebCore::RenderRubyRun::hasRubyBase):
(WebCore::RenderRubyRun::isEmpty):
(WebCore::RenderRubyRun::rubyText):
(WebCore::RenderRubyRun::rubyBase):
(WebCore::RenderRubyRun::rubyBaseSafe):
(WebCore::RenderRubyRun::firstLineBlock):
(WebCore::RenderRubyRun::updateFirstLetter):
(WebCore::RenderRubyRun::isChildAllowed):
(WebCore::RenderRubyRun::addChild):
(WebCore::RenderRubyRun::removeChild):
(WebCore::RenderRubyRun::createRubyBase):
(WebCore::RenderRubyRun::staticCreateRubyRun):
* rendering/RenderRubyRun.h: Added.
(WebCore::RenderRubyRun::renderName):
(WebCore::RenderRubyRun::isRubyRun):
* rendering/RenderRubyText.cpp: Added.
(WebCore::RenderRubyText::RenderRubyText):
(WebCore::RenderRubyText::~RenderRubyText):
(WebCore::RenderRubyText::isChildAllowed):
* rendering/RenderRubyText.h: Added.
(WebCore::RenderRubyText::renderName):
(WebCore::RenderRubyText::isRubyText):

LayoutTests:

Further layout tests will be committed in a follow-up patch under fast/ruby.

* fast/ruby/parse-rp-expected.txt: result changed due to <rt> being rendered as block within <ruby>

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@50397 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/ruby/parse-rp-expected.txt
WebCore/ChangeLog
WebCore/GNUmakefile.am
WebCore/WebCore.gypi
WebCore/WebCore.pro
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/css/html.css
WebCore/rendering/RenderBlock.cpp
WebCore/rendering/RenderBlock.h
WebCore/rendering/RenderObject.cpp
WebCore/rendering/RenderObject.h
WebCore/rendering/RenderRuby.cpp [new file with mode: 0644]
WebCore/rendering/RenderRuby.h [new file with mode: 0644]
WebCore/rendering/RenderRubyBase.cpp [new file with mode: 0644]
WebCore/rendering/RenderRubyBase.h [new file with mode: 0644]
WebCore/rendering/RenderRubyRun.cpp [new file with mode: 0644]
WebCore/rendering/RenderRubyRun.h [new file with mode: 0644]
WebCore/rendering/RenderRubyText.cpp [new file with mode: 0644]
WebCore/rendering/RenderRubyText.h [new file with mode: 0644]