diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/WebCore/rendering/RenderRuby.cpp | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/WebCore/rendering/RenderRuby.cpp')
-rw-r--r-- | Source/WebCore/rendering/RenderRuby.cpp | 67 |
1 files changed, 25 insertions, 42 deletions
diff --git a/Source/WebCore/rendering/RenderRuby.cpp b/Source/WebCore/rendering/RenderRuby.cpp index d833d3411..f0344ca6a 100644 --- a/Source/WebCore/rendering/RenderRuby.cpp +++ b/Source/WebCore/rendering/RenderRuby.cpp @@ -45,55 +45,43 @@ namespace WebCore { static inline bool isAnonymousRubyInlineBlock(const RenderObject* object) { ASSERT(!object - || !isRuby(object->parent()) - || is<RenderRubyRun>(*object) + || !object->parent()->isRuby() + || object->isRubyRun() || (object->isInline() && (object->isBeforeContent() || object->isAfterContent())) - || (object->isAnonymous() && is<RenderBlock>(*object) && object->style().display() == INLINE_BLOCK)); + || (object->isAnonymous() && object->isRenderBlock() && object->style().display() == INLINE_BLOCK)); return object - && isRuby(object->parent()) - && is<RenderBlock>(*object) - && !is<RenderRubyRun>(*object); + && object->parent()->isRuby() + && object->isRenderBlock() + && !object->isRubyRun(); } static inline bool isRubyBeforeBlock(const RenderObject* object) { return isAnonymousRubyInlineBlock(object) && !object->previousSibling() - && downcast<RenderBlock>(*object).firstChild() - && downcast<RenderBlock>(*object).firstChild()->style().styleType() == BEFORE; + && object->firstChildSlow() + && object->firstChildSlow()->style().styleType() == BEFORE; } static inline bool isRubyAfterBlock(const RenderObject* object) { return isAnonymousRubyInlineBlock(object) && !object->nextSibling() - && downcast<RenderBlock>(*object).firstChild() - && downcast<RenderBlock>(*object).firstChild()->style().styleType() == AFTER; + && object->firstChildSlow() + && object->firstChildSlow()->style().styleType() == AFTER; } -#ifndef ASSERT_DISABLED -static inline bool isRubyChildForNormalRemoval(const RenderObject& object) -{ - return object.isRubyRun() - || object.isBeforeContent() - || object.isAfterContent() - || object.isRenderMultiColumnFlowThread() - || object.isRenderMultiColumnSet() - || isAnonymousRubyInlineBlock(&object); -} -#endif - static inline RenderBlock* rubyBeforeBlock(const RenderElement* ruby) { RenderObject* child = ruby->firstChild(); - return isRubyBeforeBlock(child) ? downcast<RenderBlock>(child) : nullptr; + return isRubyBeforeBlock(child) ? toRenderBlock(child) : 0; } static inline RenderBlock* rubyAfterBlock(const RenderElement* ruby) { RenderObject* child = ruby->lastChild(); - return isRubyAfterBlock(child) ? downcast<RenderBlock>(child) : nullptr; + return isRubyAfterBlock(child) ? toRenderBlock(child) : 0; } static RenderBlock* createAnonymousRubyInlineBlock(RenderObject& ruby) @@ -106,13 +94,10 @@ static RenderBlock* createAnonymousRubyInlineBlock(RenderObject& ruby) static RenderRubyRun* lastRubyRun(const RenderElement* ruby) { RenderObject* child = ruby->lastChild(); - if (child && !is<RenderRubyRun>(*child)) + if (child && !child->isRubyRun()) child = child->previousSibling(); - if (!is<RenderRubyRun>(child)) { - ASSERT(!child || child->isBeforeContent() || child == rubyBeforeBlock(ruby)); - return nullptr; - } - return downcast<RenderRubyRun>(child); + ASSERT(!child || child->isRubyRun() || child->isBeforeContent() || child == rubyBeforeBlock(ruby)); + return child && child->isRubyRun() ? toRenderRubyRun(child) : 0; } static inline RenderRubyRun& findRubyRunParent(RenderObject& child) @@ -122,8 +107,8 @@ static inline RenderRubyRun& findRubyRunParent(RenderObject& child) //=== ruby as inline object === -RenderRubyAsInline::RenderRubyAsInline(Element& element, Ref<RenderStyle>&& style) - : RenderInline(element, WTFMove(style)) +RenderRubyAsInline::RenderRubyAsInline(Element& element, PassRef<RenderStyle> style) + : RenderInline(element, std::move(style)) { } @@ -207,9 +192,7 @@ void RenderRubyAsInline::removeChild(RenderObject& child) // If the child's parent is *this (must be a ruby run or generated content or anonymous block), // just use the normal remove method. if (child.parent() == this) { -#ifndef ASSERT_DISABLED - ASSERT(isRubyChildForNormalRemoval(child)); -#endif + ASSERT(child.isRubyRun() || child.isBeforeContent() || child.isAfterContent() || isAnonymousRubyInlineBlock(&child)); RenderInline::removeChild(child); return; } @@ -223,13 +206,14 @@ void RenderRubyAsInline::removeChild(RenderObject& child) } // Otherwise find the containing run and remove it from there. - findRubyRunParent(child).removeChild(child); + RenderRubyRun& run = findRubyRunParent(child); + run.removeChild(child); } //=== ruby as block object === -RenderRubyAsBlock::RenderRubyAsBlock(Element& element, Ref<RenderStyle>&& style) - : RenderBlockFlow(element, WTFMove(style)) +RenderRubyAsBlock::RenderRubyAsBlock(Element& element, PassRef<RenderStyle> style) + : RenderBlockFlow(element, std::move(style)) { } @@ -313,9 +297,7 @@ void RenderRubyAsBlock::removeChild(RenderObject& child) // If the child's parent is *this (must be a ruby run or generated content or anonymous block), // just use the normal remove method. if (child.parent() == this) { -#ifndef ASSERT_DISABLED - ASSERT(isRubyChildForNormalRemoval(child)); -#endif + ASSERT(child.isRubyRun() || child.isBeforeContent() || child.isAfterContent() || isAnonymousRubyInlineBlock(&child)); RenderBlockFlow::removeChild(child); return; } @@ -329,7 +311,8 @@ void RenderRubyAsBlock::removeChild(RenderObject& child) } // Otherwise find the containing run and remove it from there. - findRubyRunParent(child).removeChild(child); + RenderRubyRun& run = findRubyRunParent(child); + run.removeChild(child); } } // namespace WebCore |