[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
rolandsteiner at chromium.org
rolandsteiner at chromium.org
Wed Dec 22 14:33:39 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 131f35880ad287b722f4b506672fc9447341afd1
Author: rolandsteiner at chromium.org <rolandsteiner at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Oct 13 07:25:57 2010 +0000
2010-10-07 Roland Steiner <rolandsteiner at chromium.org>
Reviewed by Davit Hyatt.
Bug 41040 - :before/:after content should not become part of a ruby base
https://bugs.webkit.org/show_bug.cgi?id=41040
Also related to:
https://bugs.webkit.org/show_bug.cgi?id=40895.
https://bugs.webkit.org/show_bug.cgi?id=43722.
Layout tests: verify that generated content is outside of the ruby base.
Also, tests shouldn't crash.
* fast/ruby/after-doesnt-crash-expected.txt:
* fast/ruby/after-doesnt-crash.html: Added.
* fast/ruby/before-doesnt-crash.html:
* fast/ruby/ruby-beforeafter.html: Added.
* platform/gtk/Skipped:
* platform/mac/fast/ruby/ruby-beforeafter-expected.checksum: Added.
* platform/mac/fast/ruby/ruby-beforeafter-expected.png: Added.
* platform/mac/fast/ruby/ruby-beforeafter-expected.txt: Added.
* platform/qt/Skipped:
Explicitly handle :before and :after content in the default way.
Test: fast/ruby/ruby-beforeafter.html
fast/ruby/after-doesnt-crash.html
* rendering/RenderObject.h:
(WebCore::RenderObject::isBeforeContent):
* rendering/RenderRuby.cpp:
(WebCore::lastRubyRun):
(WebCore::RenderRubyAsInline::addChild):
(WebCore::RenderRubyAsInline::removeChild):
(WebCore::RenderRubyAsBlock::addChild):
(WebCore::RenderRubyAsBlock::removeChild):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69642 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 4ffde60..ae90849 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,27 @@
+2010-10-12 Roland Steiner <rolandsteiner at chromium.org>
+
+ Reviewed by Davit Hyatt.
+
+ Bug 41040 - :before/:after content should not become part of a ruby base
+ https://bugs.webkit.org/show_bug.cgi?id=41040
+
+ Also related to:
+ https://bugs.webkit.org/show_bug.cgi?id=40895.
+ https://bugs.webkit.org/show_bug.cgi?id=43722.
+
+ Layout tests: verify that generated content is outside of the ruby base.
+ Also, tests shouldn't crash.
+
+ * fast/ruby/after-doesnt-crash-expected.txt:
+ * fast/ruby/after-doesnt-crash.html: Added.
+ * fast/ruby/before-doesnt-crash.html:
+ * fast/ruby/ruby-beforeafter.html: Added.
+ * platform/gtk/Skipped:
+ * platform/mac/fast/ruby/ruby-beforeafter-expected.checksum: Added.
+ * platform/mac/fast/ruby/ruby-beforeafter-expected.png: Added.
+ * platform/mac/fast/ruby/ruby-beforeafter-expected.txt: Added.
+ * platform/qt/Skipped:
+
2010-10-12 Sheriff Bot <webkit.review.bot at gmail.com>
Unreviewed, rolling out r69639.
diff --git a/LayoutTests/fast/ruby/after-doesnt-crash-expected.txt b/LayoutTests/fast/ruby/after-doesnt-crash-expected.txt
new file mode 100644
index 0000000..ed33177
--- /dev/null
+++ b/LayoutTests/fast/ruby/after-doesnt-crash-expected.txt
@@ -0,0 +1,2 @@
+
+This test passes if it doesn't crash.
diff --git a/LayoutTests/fast/ruby/after-doesnt-crash.html b/LayoutTests/fast/ruby/after-doesnt-crash.html
new file mode 100644
index 0000000..1eaf04f
--- /dev/null
+++ b/LayoutTests/fast/ruby/after-doesnt-crash.html
@@ -0,0 +1,22 @@
+<html>
+ <head>
+ <style>
+ :after {
+ content: ""
+ }
+ </style>
+ </head>
+ <body onload="document.linkColor=0;">
+ <ruby>
+ <rt></rt>
+ </ruby>
+ <ruby style="float: left">
+ <rt></rt>
+ </ruby>
+ <script>
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+ </script>
+ This test passes if it doesn't crash.
+ </body>
+</html>
diff --git a/LayoutTests/fast/ruby/before-doesnt-crash-expected.txt b/LayoutTests/fast/ruby/before-doesnt-crash-expected.txt
index 3b0bc20..a502732 100644
--- a/LayoutTests/fast/ruby/before-doesnt-crash-expected.txt
+++ b/LayoutTests/fast/ruby/before-doesnt-crash-expected.txt
@@ -1,2 +1,3 @@
- This test passes if it doesn't crash.
+
+This test passes if it doesn't crash.
diff --git a/LayoutTests/fast/ruby/before-doesnt-crash.html b/LayoutTests/fast/ruby/before-doesnt-crash.html
index c93af26..bdbeb2b 100644
--- a/LayoutTests/fast/ruby/before-doesnt-crash.html
+++ b/LayoutTests/fast/ruby/before-doesnt-crash.html
@@ -1,15 +1,18 @@
<html>
<head>
<style>
- :before{
- content:""
- };
+ :before {
+ content: ""
+ }
</style>
</head>
<body onload="document.linkColor=0;">
<ruby>
<rt></rt>
</ruby>
+ <ruby style="float: left">
+ <rt></rt>
+ </ruby>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
diff --git a/LayoutTests/fast/ruby/ruby-beforeafter.html b/LayoutTests/fast/ruby/ruby-beforeafter.html
new file mode 100644
index 0000000..28b8180
--- /dev/null
+++ b/LayoutTests/fast/ruby/ruby-beforeafter.html
@@ -0,0 +1,20 @@
+<html>
+<head>
+ <style type="text/css">
+ <!--
+ .b:before {
+ content: '[before]';
+ }
+ .a:after {
+ content: '[after]';
+ }
+ -->
+ </style>
+</head>
+<body>
+<p>Tests that CSS-generated :before or :after content doesn't intrude into ruby bases.</p>
+</p>Foo <ruby class="b">b<rt>long text</rt></ruby> Bar<br></p>
+</p>Foo <ruby class="a">b<rt>long text</rt></ruby> Bar<br></p>
+</p>Foo <ruby class="b a">b<rt>long text</rt></ruby> Bar<br></p>
+</body>
+</html>
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 5b47fee..ee5a275 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -5087,6 +5087,7 @@ fast/dom/Window/slow-unload-handler-only-frame-is-stopped.html
http/tests/globalhistory
# Ruby tests
+fast/ruby/ruby-beforeafter.html
fast/ruby/ruby-empty-rt.html
fast/ruby/ruby-inline-table.html
fast/ruby/ruby-length.html
diff --git a/LayoutTests/platform/mac/fast/ruby/ruby-beforeafter-expected.checksum b/LayoutTests/platform/mac/fast/ruby/ruby-beforeafter-expected.checksum
new file mode 100644
index 0000000..491165e
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/ruby/ruby-beforeafter-expected.checksum
@@ -0,0 +1 @@
+0835f68d2734bf0871883fc0fc71de26
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/ruby/ruby-beforeafter-expected.png b/LayoutTests/platform/mac/fast/ruby/ruby-beforeafter-expected.png
new file mode 100644
index 0000000..0d8cda5
Binary files /dev/null and b/LayoutTests/platform/mac/fast/ruby/ruby-beforeafter-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/ruby/ruby-beforeafter-expected.txt b/LayoutTests/platform/mac/fast/ruby/ruby-beforeafter-expected.txt
new file mode 100644
index 0000000..8affb34
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/ruby/ruby-beforeafter-expected.txt
@@ -0,0 +1,68 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x576
+ RenderBlock {P} at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 509x18
+ text run at (0,0) width 509: "Tests that CSS-generated :before or :after content doesn't intrude into ruby bases."
+ RenderBlock {P} at (0,34) size 784x0
+ RenderBlock (anonymous) at (0,34) size 784x31
+ RenderText {#text} at (0,13) size 29x18
+ text run at (0,13) width 29: "Foo "
+ RenderRuby (inline) {RUBY} at (0,0) size 86x18
+ RenderInline (generated) at (0,0) size 50x18
+ RenderText at (29,13) size 50x18
+ text run at (29,13) width 50: "[before]"
+ RenderRubyRun (anonymous) at (79,0) size 36x31
+ RenderRubyText {RT} at (0,0) size 36x13
+ RenderText {#text} at (0,0) size 36x13
+ text run at (0,0) width 36: "long text"
+ RenderRubyBase (anonymous) at (0,13) size 36x18
+ RenderText {#text} at (14,0) size 8x18
+ text run at (14,0) width 8: "b"
+ RenderText {#text} at (115,13) size 27x18
+ text run at (115,13) width 27: " Bar"
+ RenderBR {BR} at (142,27) size 0x0
+ RenderBlock {P} at (0,81) size 784x0
+ RenderBlock {P} at (0,81) size 784x0
+ RenderBlock (anonymous) at (0,81) size 784x31
+ RenderText {#text} at (0,13) size 29x18
+ text run at (0,13) width 29: "Foo "
+ RenderRuby (inline) {RUBY} at (0,0) size 74x18
+ RenderRubyRun (anonymous) at (29,0) size 36x31
+ RenderRubyText {RT} at (0,0) size 36x13
+ RenderText {#text} at (0,0) size 36x13
+ text run at (0,0) width 36: "long text"
+ RenderRubyBase (anonymous) at (0,13) size 36x18
+ RenderText {#text} at (14,0) size 8x18
+ text run at (14,0) width 8: "b"
+ RenderInline (generated) at (0,0) size 38x18
+ RenderText at (65,13) size 38x18
+ text run at (65,13) width 38: "[after]"
+ RenderText {#text} at (103,13) size 27x18
+ text run at (103,13) width 27: " Bar"
+ RenderBR {BR} at (130,27) size 0x0
+ RenderBlock {P} at (0,128) size 784x0
+ RenderBlock {P} at (0,128) size 784x0
+ RenderBlock (anonymous) at (0,128) size 784x31
+ RenderText {#text} at (0,13) size 29x18
+ text run at (0,13) width 29: "Foo "
+ RenderRuby (inline) {RUBY} at (0,0) size 124x18
+ RenderInline (generated) at (0,0) size 50x18
+ RenderText at (29,13) size 50x18
+ text run at (29,13) width 50: "[before]"
+ RenderRubyRun (anonymous) at (79,0) size 36x31
+ RenderRubyText {RT} at (0,0) size 36x13
+ RenderText {#text} at (0,0) size 36x13
+ text run at (0,0) width 36: "long text"
+ RenderRubyBase (anonymous) at (0,13) size 36x18
+ RenderText {#text} at (14,0) size 8x18
+ text run at (14,0) width 8: "b"
+ RenderInline (generated) at (0,0) size 38x18
+ RenderText at (115,13) size 38x18
+ text run at (115,13) width 38: "[after]"
+ RenderText {#text} at (153,13) size 27x18
+ text run at (153,13) width 27: " Bar"
+ RenderBR {BR} at (180,27) size 0x0
+ RenderBlock {P} at (0,175) size 784x0
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index 623d63d..7b5a42f 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -780,6 +780,7 @@ fast/images/icon-0colors.html
fast/images/icon-decoding.html
# ------- missing ruby annotation support for japanese fonts
+fast/ruby/ruby-beforeafter.html
fast/ruby/ruby-empty-rt.html
fast/ruby/ruby-length.html
fast/ruby/ruby-run-break.html
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ff92e3d..79ebec1 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2010-10-12 Roland Steiner <rolandsteiner at chromium.org>
+
+ Reviewed by David Hyatt.
+
+ Bug 41040 - :before/:after content should not become part of a ruby base
+ https://bugs.webkit.org/show_bug.cgi?id=41040
+
+ Also related to:
+ https://bugs.webkit.org/show_bug.cgi?id=40895.
+ https://bugs.webkit.org/show_bug.cgi?id=43722.
+
+ Explicitly handle :before and :after content in the default way.
+
+ Test: fast/ruby/ruby-beforeafter.html
+ fast/ruby/after-doesnt-crash.html
+
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::isBeforeContent):
+ * rendering/RenderRuby.cpp:
+ (WebCore::lastRubyRun):
+ (WebCore::RenderRubyAsInline::addChild):
+ (WebCore::RenderRubyAsInline::removeChild):
+ (WebCore::RenderRubyAsBlock::addChild):
+ (WebCore::RenderRubyAsBlock::removeChild):
+
2010-10-12 Sheriff Bot <webkit.review.bot at gmail.com>
Unreviewed, rolling out r69639.
diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h
index 90dba85..5b30177 100644
--- a/WebCore/rendering/RenderObject.h
+++ b/WebCore/rendering/RenderObject.h
@@ -291,7 +291,9 @@ public:
bool isHTMLMarquee() const;
+ inline bool isBeforeContent() const;
inline bool isAfterContent() const;
+ static inline bool isBeforeContent(const RenderObject* obj) { return obj && obj->isBeforeContent(); }
static inline bool isAfterContent(const RenderObject* obj) { return obj && obj->isAfterContent(); }
bool childrenInline() const { return m_childrenInline; }
@@ -861,6 +863,16 @@ inline bool RenderObject::documentBeingDestroyed() const
return !document()->renderer();
}
+inline bool RenderObject::isBeforeContent() const
+{
+ if (style()->styleType() != BEFORE)
+ return false;
+ // Text nodes don't have their own styles, so ignore the style on a text node.
+ if (isText() && !isBR())
+ return false;
+ return true;
+}
+
inline bool RenderObject::isAfterContent() const
{
if (style()->styleType() != AFTER)
diff --git a/WebCore/rendering/RenderRuby.cpp b/WebCore/rendering/RenderRuby.cpp
index 2f543d5..7e19a79 100644
--- a/WebCore/rendering/RenderRuby.cpp
+++ b/WebCore/rendering/RenderRuby.cpp
@@ -44,8 +44,8 @@ static RenderRubyRun* lastRubyRun(const RenderObject* ruby)
RenderObject* child = ruby->lastChild();
if (child && ruby->isAfterContent(child))
child = child->previousSibling();
- ASSERT(!child || child->isRubyRun());
- return static_cast<RenderRubyRun*>(child);
+ ASSERT(!child || child->isRubyRun() || child->isBeforeContent());
+ return child && child->isRubyRun() ? static_cast<RenderRubyRun*>(child) : 0;
}
static inline RenderRubyRun* findRubyRunParent(RenderObject* child)
@@ -75,15 +75,25 @@ bool RenderRubyAsInline::isChildAllowed(RenderObject* child, RenderStyle*) const
void RenderRubyAsInline::addChild(RenderObject* child, RenderObject* beforeChild)
{
- // Note: ':after' content is handled implicitly below
+ // Insert :before and :after content outside of ruby runs.
+ if (child->isBeforeContent() || child->isAfterContent()) {
+ RenderInline::addChild(child, beforeChild);
+ return;
+ }
+ // If the child is a ruby run, just add it normally.
if (child->isRubyRun()) {
RenderInline::addChild(child, beforeChild);
return;
}
- if (beforeChild && !isAfterContent(beforeChild) && !beforeChild->isRubyRun()) {
- if (RenderRubyRun* run = findRubyRunParent(beforeChild)) {
+ if (beforeChild && !isAfterContent(beforeChild)) {
+ // insert child into run
+ ASSERT(!beforeChild->isRubyRun());
+ RenderObject* run = beforeChild;
+ while (run && !run->isRubyRun())
+ run = run->parent();
+ if (run) {
run->addChild(child, beforeChild);
return;
}
@@ -104,15 +114,15 @@ void RenderRubyAsInline::addChild(RenderObject* child, RenderObject* beforeChild
void RenderRubyAsInline::removeChild(RenderObject* child)
{
- // If the child's parent is *this, i.e. a ruby run or ':after' content,
+ // If the child's parent is *this (a ruby run or :before or :after content),
// just use the normal remove method.
- if (child->parent() == this) {
- ASSERT(child->isRubyRun() || child->isAfterContent());
+ if (child->isRubyRun() || child->isBeforeContent() || child->isAfterContent()) {
RenderInline::removeChild(child);
return;
}
- // Find the containing run
+ // Otherwise find the containing run and remove it from there.
+ ASSERT(child->parent() != this);
RenderRubyRun* run = findRubyRunParent(child);
ASSERT(run);
run->removeChild(child);
@@ -139,9 +149,13 @@ bool RenderRubyAsBlock::isChildAllowed(RenderObject* child, RenderStyle*) const
void RenderRubyAsBlock::addChild(RenderObject* child, RenderObject* beforeChild)
{
- // Note: ':after' content is handled implicitely below
+ // Insert :before and :after content outside of ruby runs.
+ if (child->isBeforeContent() || child->isAfterContent()) {
+ RenderBlock::addChild(child, beforeChild);
+ return;
+ }
- // if child is a ruby run, just add it normally
+ // If the child is a ruby run, just add it normally.
if (child->isRubyRun()) {
RenderBlock::addChild(child, beforeChild);
return;
@@ -157,7 +171,7 @@ void RenderRubyAsBlock::addChild(RenderObject* child, RenderObject* beforeChild)
run->addChild(child, beforeChild);
return;
}
- ASSERT(false); // beforeChild should always have a run as parent!
+ ASSERT_NOT_REACHED(); // beforeChild should always have a run as parent!
// Emergency fallback: fall through and just append.
}
@@ -174,14 +188,15 @@ void RenderRubyAsBlock::addChild(RenderObject* child, RenderObject* beforeChild)
void RenderRubyAsBlock::removeChild(RenderObject* child)
{
- // If the child's parent is *this, just use the normal remove method.
- if (child->parent() == this) {
- // This should happen only during destruction of the whole ruby element, though.
+ // If the child's parent is *this (a ruby run or :before or :after content),
+ // just use the normal remove method.
+ if (child->isRubyRun() || child->isBeforeContent() || child->isAfterContent()) {
RenderBlock::removeChild(child);
return;
}
- // Find the containing run
+ // Otherwise find the containing run and remove it from there.
+ ASSERT(child->parent() != this);
RenderRubyRun* run = findRubyRunParent(child);
ASSERT(run);
run->removeChild(child);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list