<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[180038] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/180038">180038</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2015-02-13 04:48:09 -0800 (Fri, 13 Feb 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>REGRESSION (<a href="http://trac.webkit.org/projects/webkit/changeset/176262">r176262</a>): Invalid cast in WebCore`WebCore::RootInlineBox::selectionTop
https://bugs.webkit.org/show_bug.cgi?id=138992
Reviewed by Dave Hyatt.
RenderRubyText requires the ancestor chain to be (RenderRubyAsInline | RenderRubyAsBlock) -> RenderRubyRun -> RenderRubyText.
This patch ensures that we create RenderRubyText for an <rt> element only when
the expected ancestor chain is guaranteed.
Source/WebCore:
Test: fast/ruby/crash-when-ruby-is-set-to-inline-block.html
* rendering/RenderElement.cpp:
(WebCore::RenderElement::createFor): treat inline-block <ruby> as block.
* rendering/RenderObject.h:
(WebCore::RenderObject::isRubyInline):
(WebCore::RenderObject::isRubyBlock):
(WebCore::RenderObject::isRuby): Deleted.
* rendering/RenderRuby.cpp:
(WebCore::isAnonymousRubyInlineBlock):
* rendering/RenderRuby.h: add support for is<RenderRubyAsBlock>(renderer) and for is<RenderRubyAsInline>(renderer)
The isRuby() method does not follow the is*() -> maps to one class pattern.
(WebCore::isRuby):
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::addChild):
(WebCore::RenderRubyRun::staticCreateRubyRun):
LayoutTests:
* fast/ruby/crash-when-ruby-is-set-to-inline-block-expected.txt: Added.
* fast/ruby/crash-when-ruby-is-set-to-inline-block.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderElementcpp">trunk/Source/WebCore/rendering/RenderElement.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderObjecth">trunk/Source/WebCore/rendering/RenderObject.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderRubycpp">trunk/Source/WebCore/rendering/RenderRuby.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderRubyh">trunk/Source/WebCore/rendering/RenderRuby.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderRubyRuncpp">trunk/Source/WebCore/rendering/RenderRubyRun.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastrubycrashwhenrubyissettoinlineblockexpectedtxt">trunk/LayoutTests/fast/ruby/crash-when-ruby-is-set-to-inline-block-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastrubycrashwhenrubyissettoinlineblockhtml">trunk/LayoutTests/fast/ruby/crash-when-ruby-is-set-to-inline-block.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (180037 => 180038)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-02-13 09:43:26 UTC (rev 180037)
+++ trunk/LayoutTests/ChangeLog        2015-02-13 12:48:09 UTC (rev 180038)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-02-12 Zalan Bujtas <zalan@apple.com>
+
+ REGRESSION (r176262): Invalid cast in WebCore`WebCore::RootInlineBox::selectionTop
+ https://bugs.webkit.org/show_bug.cgi?id=138992
+
+ Reviewed by Dave Hyatt.
+
+ RenderRubyText requires the ancestor chain to be (RenderRubyAsInline | RenderRubyAsBlock) -> RenderRubyRun -> RenderRubyText.
+ This patch ensures that we create RenderRubyText for an <rt> element only when
+ the expected ancestor chain is guaranteed.
+
+ * fast/ruby/crash-when-ruby-is-set-to-inline-block-expected.txt: Added.
+ * fast/ruby/crash-when-ruby-is-set-to-inline-block.html: Added.
+
</ins><span class="cx"> 2015-02-13 Csaba Osztrogonác <ossy@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, remove empty directories.
</span></span></pre></div>
<a id="trunkLayoutTestsfastrubycrashwhenrubyissettoinlineblockexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/ruby/crash-when-ruby-is-set-to-inline-block-expected.txt (0 => 180038)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/ruby/crash-when-ruby-is-set-to-inline-block-expected.txt         (rev 0)
+++ trunk/LayoutTests/fast/ruby/crash-when-ruby-is-set-to-inline-block-expected.txt        2015-02-13 12:48:09 UTC (rev 180038)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+PASS if no crash or assert in debug build.
</ins></span></pre></div>
<a id="trunkLayoutTestsfastrubycrashwhenrubyissettoinlineblockhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/ruby/crash-when-ruby-is-set-to-inline-block.html (0 => 180038)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/ruby/crash-when-ruby-is-set-to-inline-block.html         (rev 0)
+++ trunk/LayoutTests/fast/ruby/crash-when-ruby-is-set-to-inline-block.html        2015-02-13 12:48:09 UTC (rev 180038)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+<!DOCTYPE html>
+<head>
+<title>This test that when ruby is set to inline-block, we create ruby renderer.</title>
+<style>
+ruby {
+        -webkit-appearance: checkbox;
+}
+</style>
+
+<script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+</script>
+</head>
+<body>
+ <ruby><rt>PASS if no crash or assert in debug build.</rt></ruby>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (180037 => 180038)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-13 09:43:26 UTC (rev 180037)
+++ trunk/Source/WebCore/ChangeLog        2015-02-13 12:48:09 UTC (rev 180038)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2015-02-12 Zalan Bujtas <zalan@apple.com>
+
+ REGRESSION (r176262): Invalid cast in WebCore`WebCore::RootInlineBox::selectionTop
+ https://bugs.webkit.org/show_bug.cgi?id=138992
+
+ Reviewed by Dave Hyatt.
+
+ RenderRubyText requires the ancestor chain to be (RenderRubyAsInline | RenderRubyAsBlock) -> RenderRubyRun -> RenderRubyText.
+ This patch ensures that we create RenderRubyText for an <rt> element only when
+ the expected ancestor chain is guaranteed.
+
+ Test: fast/ruby/crash-when-ruby-is-set-to-inline-block.html
+
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::createFor): treat inline-block <ruby> as block.
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::isRubyInline):
+ (WebCore::RenderObject::isRubyBlock):
+ (WebCore::RenderObject::isRuby): Deleted.
+ * rendering/RenderRuby.cpp:
+ (WebCore::isAnonymousRubyInlineBlock):
+ * rendering/RenderRuby.h: add support for is<RenderRubyAsBlock>(renderer) and for is<RenderRubyAsInline>(renderer)
+ The isRuby() method does not follow the is*() -> maps to one class pattern.
+ (WebCore::isRuby):
+ * rendering/RenderRubyRun.cpp:
+ (WebCore::RenderRubyRun::addChild):
+ (WebCore::RenderRubyRun::staticCreateRubyRun):
+
</ins><span class="cx"> 2015-02-13 Csaba Osztrogonac <ossy@webkit.org>
</span><span class="cx">
</span><span class="cx"> Fix the gperf related build issue on the WinCairo bot
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (180037 => 180038)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderElement.cpp        2015-02-13 09:43:26 UTC (rev 180037)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp        2015-02-13 12:48:09 UTC (rev 180038)
</span><span class="lines">@@ -160,11 +160,11 @@
</span><span class="cx"> if (element.hasTagName(HTMLNames::rubyTag)) {
</span><span class="cx"> if (style.get().display() == INLINE)
</span><span class="cx"> return createRenderer<RenderRubyAsInline>(element, WTF::move(style));
</span><del>- if (style.get().display() == BLOCK)
</del><ins>+ if (style.get().display() == BLOCK || style.get().display() == INLINE_BLOCK)
</ins><span class="cx"> return createRenderer<RenderRubyAsBlock>(element, WTF::move(style));
</span><span class="cx"> }
</span><del>- // treat <rt> as ruby text ONLY if it still has its default treatment of block
- if (element.hasTagName(HTMLNames::rtTag) && style.get().display() == BLOCK)
</del><ins>+ // treat <rt> as ruby text ONLY if the parent is ruby.
+ if (element.hasTagName(HTMLNames::rtTag) && element.parentElement() && isRuby(element.parentElement()->renderer()))
</ins><span class="cx"> return createRenderer<RenderRubyText>(element, WTF::move(style));
</span><span class="cx"> switch (style.get().display()) {
</span><span class="cx"> case NONE:
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderObject.h (180037 => 180038)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderObject.h        2015-02-13 09:43:26 UTC (rev 180037)
+++ trunk/Source/WebCore/rendering/RenderObject.h        2015-02-13 12:48:09 UTC (rev 180038)
</span><span class="lines">@@ -323,7 +323,8 @@
</span><span class="cx"> virtual bool isRenderNamedFlowFragment() const { return false; }
</span><span class="cx"> virtual bool isReplica() const { return false; }
</span><span class="cx">
</span><del>- virtual bool isRuby() const { return false; }
</del><ins>+ virtual bool isRubyInline() const { return false; }
+ virtual bool isRubyBlock() const { return false; }
</ins><span class="cx"> virtual bool isRubyBase() const { return false; }
</span><span class="cx"> virtual bool isRubyRun() const { return false; }
</span><span class="cx"> virtual bool isRubyText() const { return false; }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderRubycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderRuby.cpp (180037 => 180038)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderRuby.cpp        2015-02-13 09:43:26 UTC (rev 180037)
+++ trunk/Source/WebCore/rendering/RenderRuby.cpp        2015-02-13 12:48:09 UTC (rev 180038)
</span><span class="lines">@@ -45,13 +45,13 @@
</span><span class="cx"> static inline bool isAnonymousRubyInlineBlock(const RenderObject* object)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(!object
</span><del>- || !object->parent()->isRuby()
</del><ins>+ || !isRuby(object->parent())
</ins><span class="cx"> || is<RenderRubyRun>(*object)
</span><span class="cx"> || (object->isInline() && (object->isBeforeContent() || object->isAfterContent()))
</span><span class="cx"> || (object->isAnonymous() && is<RenderBlock>(*object) && object->style().display() == INLINE_BLOCK));
</span><span class="cx">
</span><span class="cx"> return object
</span><del>- && object->parent()->isRuby()
</del><ins>+ && isRuby(object->parent())
</ins><span class="cx"> && is<RenderBlock>(*object)
</span><span class="cx"> && !is<RenderRubyRun>(*object);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderRubyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderRuby.h (180037 => 180038)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderRuby.h        2015-02-13 09:43:26 UTC (rev 180037)
+++ trunk/Source/WebCore/rendering/RenderRuby.h        2015-02-13 12:48:09 UTC (rev 180038)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx"> virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- virtual bool isRuby() const override { return true; }
</del><ins>+ virtual bool isRubyInline() const override final { return true; }
</ins><span class="cx"> virtual const char* renderName() const override { return "RenderRuby (inline)"; }
</span><span class="cx"> virtual bool createsAnonymousWrapper() const override { return true; }
</span><span class="cx"> };
</span><span class="lines">@@ -83,12 +83,18 @@
</span><span class="cx"> virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- virtual bool isRuby() const override { return true; }
</del><ins>+ virtual bool isRubyBlock() const override final { return true; }
</ins><span class="cx"> virtual const char* renderName() const override { return "RenderRuby (block)"; }
</span><span class="cx"> virtual bool createsAnonymousWrapper() const override { return true; }
</span><span class="cx"> virtual void removeLeftoverAnonymousBlock(RenderBlock*) override { ASSERT_NOT_REACHED(); }
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+
+inline bool isRuby(const RenderObject* renderer) { return (renderer && (is<RenderRubyAsInline>(renderer) || is<RenderRubyAsBlock>(renderer))); }
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><ins>+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderRubyAsInline, isRubyInline())
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderRubyAsBlock, isRubyBlock())
+
</ins><span class="cx"> #endif // RenderRuby_h
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderRubyRuncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderRubyRun.cpp (180037 => 180038)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderRubyRun.cpp        2015-02-13 09:43:26 UTC (rev 180037)
+++ trunk/Source/WebCore/rendering/RenderRubyRun.cpp        2015-02-13 12:48:09 UTC (rev 180038)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx">
</span><span class="cx"> #include "RenderRubyRun.h"
</span><span class="cx">
</span><ins>+#include "RenderRuby.h"
</ins><span class="cx"> #include "RenderRubyBase.h"
</span><span class="cx"> #include "RenderRubyText.h"
</span><span class="cx"> #include "RenderText.h"
</span><span class="lines">@@ -130,7 +131,7 @@
</span><span class="cx"> // the old text goes into a new run that is inserted as next sibling.
</span><span class="cx"> ASSERT(beforeChild->parent() == this);
</span><span class="cx"> RenderElement* ruby = parent();
</span><del>- ASSERT(ruby->isRuby());
</del><ins>+ ASSERT(isRuby(ruby));
</ins><span class="cx"> RenderBlock* newRun = staticCreateRubyRun(ruby);
</span><span class="cx"> ruby->addChild(newRun, nextSibling());
</span><span class="cx"> // Add the new ruby text and move the old one to the new run
</span><span class="lines">@@ -211,7 +212,7 @@
</span><span class="cx">
</span><span class="cx"> RenderRubyRun* RenderRubyRun::staticCreateRubyRun(const RenderObject* parentRuby)
</span><span class="cx"> {
</span><del>- ASSERT(parentRuby && parentRuby->isRuby());
</del><ins>+ ASSERT(isRuby(parentRuby));
</ins><span class="cx"> auto renderer = new RenderRubyRun(parentRuby->document(), RenderStyle::createAnonymousStyleWithDisplay(&parentRuby->style(), INLINE_BLOCK));
</span><span class="cx"> renderer->initializeStyle();
</span><span class="cx"> return renderer;
</span></span></pre>
</div>
</div>
</body>
</html>