Changeset 69642 in webkit
- Timestamp:
- Oct 13, 2010 12:25:57 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 8 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r69640 r69642 1 2010-10-12 Roland Steiner <rolandsteiner@chromium.org> 2 3 Reviewed by Davit Hyatt. 4 5 Bug 41040 - :before/:after content should not become part of a ruby base 6 https://bugs.webkit.org/show_bug.cgi?id=41040 7 8 Also related to: 9 https://bugs.webkit.org/show_bug.cgi?id=40895. 10 https://bugs.webkit.org/show_bug.cgi?id=43722. 11 12 Layout tests: verify that generated content is outside of the ruby base. 13 Also, tests shouldn't crash. 14 15 * fast/ruby/after-doesnt-crash-expected.txt: 16 * fast/ruby/after-doesnt-crash.html: Added. 17 * fast/ruby/before-doesnt-crash.html: 18 * fast/ruby/ruby-beforeafter.html: Added. 19 * platform/gtk/Skipped: 20 * platform/mac/fast/ruby/ruby-beforeafter-expected.checksum: Added. 21 * platform/mac/fast/ruby/ruby-beforeafter-expected.png: Added. 22 * platform/mac/fast/ruby/ruby-beforeafter-expected.txt: Added. 23 * platform/qt/Skipped: 24 1 25 2010-10-12 Sheriff Bot <webkit.review.bot@gmail.com> 2 26 -
trunk/LayoutTests/fast/ruby/after-doesnt-crash.html
r69641 r69642 2 2 <head> 3 3 <style> 4 : before{5 content: ""6 } ;4 :after { 5 content: "" 6 } 7 7 </style> 8 8 </head> 9 9 <body onload="document.linkColor=0;"> 10 10 <ruby> 11 <rt></rt> 12 </ruby> 13 <ruby style="float: left"> 11 14 <rt></rt> 12 15 </ruby> -
trunk/LayoutTests/fast/ruby/before-doesnt-crash-expected.txt
r66371 r69642 1 1 2 This test passes if it doesn't crash. 2 3 This test passes if it doesn't crash. -
trunk/LayoutTests/fast/ruby/before-doesnt-crash.html
r66371 r69642 2 2 <head> 3 3 <style> 4 :before {5 content: ""6 } ;4 :before { 5 content: "" 6 } 7 7 </style> 8 8 </head> 9 9 <body onload="document.linkColor=0;"> 10 10 <ruby> 11 <rt></rt> 12 </ruby> 13 <ruby style="float: left"> 11 14 <rt></rt> 12 15 </ruby> -
trunk/LayoutTests/platform/gtk/Skipped
r69620 r69642 5088 5088 5089 5089 # Ruby tests 5090 fast/ruby/ruby-beforeafter.html 5090 5091 fast/ruby/ruby-empty-rt.html 5091 5092 fast/ruby/ruby-inline-table.html -
trunk/LayoutTests/platform/qt/Skipped
r69597 r69642 781 781 782 782 # ------- missing ruby annotation support for japanese fonts 783 fast/ruby/ruby-beforeafter.html 783 784 fast/ruby/ruby-empty-rt.html 784 785 fast/ruby/ruby-length.html -
trunk/WebCore/ChangeLog
r69640 r69642 1 2010-10-12 Roland Steiner <rolandsteiner@chromium.org> 2 3 Reviewed by David Hyatt. 4 5 Bug 41040 - :before/:after content should not become part of a ruby base 6 https://bugs.webkit.org/show_bug.cgi?id=41040 7 8 Also related to: 9 https://bugs.webkit.org/show_bug.cgi?id=40895. 10 https://bugs.webkit.org/show_bug.cgi?id=43722. 11 12 Explicitly handle :before and :after content in the default way. 13 14 Test: fast/ruby/ruby-beforeafter.html 15 fast/ruby/after-doesnt-crash.html 16 17 * rendering/RenderObject.h: 18 (WebCore::RenderObject::isBeforeContent): 19 * rendering/RenderRuby.cpp: 20 (WebCore::lastRubyRun): 21 (WebCore::RenderRubyAsInline::addChild): 22 (WebCore::RenderRubyAsInline::removeChild): 23 (WebCore::RenderRubyAsBlock::addChild): 24 (WebCore::RenderRubyAsBlock::removeChild): 25 1 26 2010-10-12 Sheriff Bot <webkit.review.bot@gmail.com> 2 27 -
trunk/WebCore/rendering/RenderObject.h
r69279 r69642 292 292 bool isHTMLMarquee() const; 293 293 294 inline bool isBeforeContent() const; 294 295 inline bool isAfterContent() const; 296 static inline bool isBeforeContent(const RenderObject* obj) { return obj && obj->isBeforeContent(); } 295 297 static inline bool isAfterContent(const RenderObject* obj) { return obj && obj->isAfterContent(); } 296 298 … … 862 864 } 863 865 866 inline bool RenderObject::isBeforeContent() const 867 { 868 if (style()->styleType() != BEFORE) 869 return false; 870 // Text nodes don't have their own styles, so ignore the style on a text node. 871 if (isText() && !isBR()) 872 return false; 873 return true; 874 } 875 864 876 inline bool RenderObject::isAfterContent() const 865 877 { -
trunk/WebCore/rendering/RenderRuby.cpp
r66371 r69642 45 45 if (child && ruby->isAfterContent(child)) 46 46 child = child->previousSibling(); 47 ASSERT(!child || child->isRubyRun() );48 return static_cast<RenderRubyRun*>(child);47 ASSERT(!child || child->isRubyRun() || child->isBeforeContent()); 48 return child && child->isRubyRun() ? static_cast<RenderRubyRun*>(child) : 0; 49 49 } 50 50 … … 76 76 void RenderRubyAsInline::addChild(RenderObject* child, RenderObject* beforeChild) 77 77 { 78 // Note: ':after' content is handled implicitly below 79 78 // Insert :before and :after content outside of ruby runs. 79 if (child->isBeforeContent() || child->isAfterContent()) { 80 RenderInline::addChild(child, beforeChild); 81 return; 82 } 83 84 // If the child is a ruby run, just add it normally. 80 85 if (child->isRubyRun()) { 81 86 RenderInline::addChild(child, beforeChild); 82 return;83 }84 85 if (beforeChild && !isAfterContent(beforeChild) && !beforeChild->isRubyRun()) {86 if (RenderRubyRun* run = findRubyRunParent(beforeChild)) {87 run->addChild(child, beforeChild);88 return;89 }90 ASSERT_NOT_REACHED(); // beforeChild should always have a run as parent!91 // Emergency fallback: fall through and just append.92 }93 94 // If the new child would be appended, try to add the child to the previous run95 // if possible, or create a new run otherwise.96 // (The RenderRubyRun object will handle the details)97 RenderRubyRun* lastRun = lastRubyRun(this);98 if (!lastRun || lastRun->hasRubyText()) {99 lastRun = RenderRubyRun::staticCreateRubyRun(this);100 RenderInline::addChild(lastRun);101 }102 lastRun->addChild(child);103 }104 105 void RenderRubyAsInline::removeChild(RenderObject* child)106 {107 // If the child's parent is *this, i.e. a ruby run or ':after' content,108 // just use the normal remove method.109 if (child->parent() == this) {110 ASSERT(child->isRubyRun() || child->isAfterContent());111 RenderInline::removeChild(child);112 return;113 }114 115 // Find the containing run116 RenderRubyRun* run = findRubyRunParent(child);117 ASSERT(run);118 run->removeChild(child);119 }120 121 122 //=== ruby as block object ===123 124 RenderRubyAsBlock::RenderRubyAsBlock(Node* node)125 : RenderBlock(node)126 {127 }128 129 RenderRubyAsBlock::~RenderRubyAsBlock()130 {131 }132 133 bool RenderRubyAsBlock::isChildAllowed(RenderObject* child, RenderStyle*) const134 {135 return child->isRubyText()136 || child->isRubyRun()137 || child->isInline();138 }139 140 void RenderRubyAsBlock::addChild(RenderObject* child, RenderObject* beforeChild)141 {142 // Note: ':after' content is handled implicitely below143 144 // if child is a ruby run, just add it normally145 if (child->isRubyRun()) {146 RenderBlock::addChild(child, beforeChild);147 87 return; 148 88 } … … 158 98 return; 159 99 } 160 ASSERT(false); // beforeChild should always have a run as parent! 100 ASSERT_NOT_REACHED(); // beforeChild should always have a run as parent! 101 // Emergency fallback: fall through and just append. 102 } 103 104 // If the new child would be appended, try to add the child to the previous run 105 // if possible, or create a new run otherwise. 106 // (The RenderRubyRun object will handle the details) 107 RenderRubyRun* lastRun = lastRubyRun(this); 108 if (!lastRun || lastRun->hasRubyText()) { 109 lastRun = RenderRubyRun::staticCreateRubyRun(this); 110 RenderInline::addChild(lastRun); 111 } 112 lastRun->addChild(child); 113 } 114 115 void RenderRubyAsInline::removeChild(RenderObject* child) 116 { 117 // If the child's parent is *this (a ruby run or :before or :after content), 118 // just use the normal remove method. 119 if (child->isRubyRun() || child->isBeforeContent() || child->isAfterContent()) { 120 RenderInline::removeChild(child); 121 return; 122 } 123 124 // Otherwise find the containing run and remove it from there. 125 ASSERT(child->parent() != this); 126 RenderRubyRun* run = findRubyRunParent(child); 127 ASSERT(run); 128 run->removeChild(child); 129 } 130 131 132 //=== ruby as block object === 133 134 RenderRubyAsBlock::RenderRubyAsBlock(Node* node) 135 : RenderBlock(node) 136 { 137 } 138 139 RenderRubyAsBlock::~RenderRubyAsBlock() 140 { 141 } 142 143 bool RenderRubyAsBlock::isChildAllowed(RenderObject* child, RenderStyle*) const 144 { 145 return child->isRubyText() 146 || child->isRubyRun() 147 || child->isInline(); 148 } 149 150 void RenderRubyAsBlock::addChild(RenderObject* child, RenderObject* beforeChild) 151 { 152 // Insert :before and :after content outside of ruby runs. 153 if (child->isBeforeContent() || child->isAfterContent()) { 154 RenderBlock::addChild(child, beforeChild); 155 return; 156 } 157 158 // If the child is a ruby run, just add it normally. 159 if (child->isRubyRun()) { 160 RenderBlock::addChild(child, beforeChild); 161 return; 162 } 163 164 if (beforeChild && !isAfterContent(beforeChild)) { 165 // insert child into run 166 ASSERT(!beforeChild->isRubyRun()); 167 RenderObject* run = beforeChild; 168 while (run && !run->isRubyRun()) 169 run = run->parent(); 170 if (run) { 171 run->addChild(child, beforeChild); 172 return; 173 } 174 ASSERT_NOT_REACHED(); // beforeChild should always have a run as parent! 161 175 // Emergency fallback: fall through and just append. 162 176 } … … 175 189 void RenderRubyAsBlock::removeChild(RenderObject* child) 176 190 { 177 // If the child's parent is *this , just use the normal remove method.178 if (child->parent() == this) {179 // This should happen only during destruction of the whole ruby element, though.191 // If the child's parent is *this (a ruby run or :before or :after content), 192 // just use the normal remove method. 193 if (child->isRubyRun() || child->isBeforeContent() || child->isAfterContent()) { 180 194 RenderBlock::removeChild(child); 181 195 return; 182 196 } 183 197 184 // Find the containing run 198 // Otherwise find the containing run and remove it from there. 199 ASSERT(child->parent() != this); 185 200 RenderRubyRun* run = findRubyRunParent(child); 186 201 ASSERT(run);
Note: See TracChangeset
for help on using the changeset viewer.