Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: Source/WebCore/rendering/RenderRuby.cpp

Issue 11856005: Merge 138850 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/WebCore/rendering/RenderBlock.cpp ('k') | Source/WebCore/rendering/RenderTable.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 ASSERT_NOT_REACHED(); // beforeChild should always have a run as parent! 177 ASSERT_NOT_REACHED(); // beforeChild should always have a run as parent!
178 // Emergency fallback: fall through and just append. 178 // Emergency fallback: fall through and just append.
179 } 179 }
180 180
181 // If the new child would be appended, try to add the child to the previous run 181 // If the new child would be appended, try to add the child to the previous run
182 // if possible, or create a new run otherwise. 182 // if possible, or create a new run otherwise.
183 // (The RenderRubyRun object will handle the details) 183 // (The RenderRubyRun object will handle the details)
184 RenderRubyRun* lastRun = lastRubyRun(this); 184 RenderRubyRun* lastRun = lastRubyRun(this);
185 if (!lastRun || lastRun->hasRubyText()) { 185 if (!lastRun || lastRun->hasRubyText()) {
186 lastRun = RenderRubyRun::staticCreateRubyRun(this); 186 lastRun = RenderRubyRun::staticCreateRubyRun(this);
187 RenderInline::addChild(lastRun); 187 RenderInline::addChild(lastRun, beforeChild);
188 } 188 }
189 lastRun->addChild(child); 189 lastRun->addChild(child);
190 } 190 }
191 191
192 void RenderRubyAsInline::removeChild(RenderObject* child) 192 void RenderRubyAsInline::removeChild(RenderObject* child)
193 { 193 {
194 // If the child's parent is *this (must be a ruby run or generated content o r anonymous block), 194 // If the child's parent is *this (must be a ruby run or generated content o r anonymous block),
195 // just use the normal remove method. 195 // just use the normal remove method.
196 if (child->parent() == this) { 196 if (child->parent() == this) {
197 ASSERT(child->isRubyRun() || child->isBeforeContent() || child->isAfterC ontent() || isAnonymousRubyInlineBlock(child)); 197 ASSERT(child->isRubyRun() || child->isBeforeContent() || child->isAfterC ontent() || isAnonymousRubyInlineBlock(child));
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 ASSERT_NOT_REACHED(); // beforeChild should always have a run as parent! 284 ASSERT_NOT_REACHED(); // beforeChild should always have a run as parent!
285 // Emergency fallback: fall through and just append. 285 // Emergency fallback: fall through and just append.
286 } 286 }
287 287
288 // If the new child would be appended, try to add the child to the previous run 288 // If the new child would be appended, try to add the child to the previous run
289 // if possible, or create a new run otherwise. 289 // if possible, or create a new run otherwise.
290 // (The RenderRubyRun object will handle the details) 290 // (The RenderRubyRun object will handle the details)
291 RenderRubyRun* lastRun = lastRubyRun(this); 291 RenderRubyRun* lastRun = lastRubyRun(this);
292 if (!lastRun || lastRun->hasRubyText()) { 292 if (!lastRun || lastRun->hasRubyText()) {
293 lastRun = RenderRubyRun::staticCreateRubyRun(this); 293 lastRun = RenderRubyRun::staticCreateRubyRun(this);
294 RenderBlock::addChild(lastRun); 294 RenderBlock::addChild(lastRun, beforeChild);
295 } 295 }
296 lastRun->addChild(child); 296 lastRun->addChild(child);
297 } 297 }
298 298
299 void RenderRubyAsBlock::removeChild(RenderObject* child) 299 void RenderRubyAsBlock::removeChild(RenderObject* child)
300 { 300 {
301 // If the child's parent is *this (must be a ruby run or generated content o r anonymous block), 301 // If the child's parent is *this (must be a ruby run or generated content o r anonymous block),
302 // just use the normal remove method. 302 // just use the normal remove method.
303 if (child->parent() == this) { 303 if (child->parent() == this) {
304 ASSERT(child->isRubyRun() || child->isBeforeContent() || child->isAfterC ontent() || isAnonymousRubyInlineBlock(child)); 304 ASSERT(child->isRubyRun() || child->isBeforeContent() || child->isAfterC ontent() || isAnonymousRubyInlineBlock(child));
305 RenderBlock::removeChild(child); 305 RenderBlock::removeChild(child);
306 return; 306 return;
307 } 307 }
308 // If the child's parent is an anoymous block (must be generated :before/:af ter content) 308 // If the child's parent is an anoymous block (must be generated :before/:af ter content)
309 // just use the block's remove method. 309 // just use the block's remove method.
310 if (isAnonymousRubyInlineBlock(child->parent())) { 310 if (isAnonymousRubyInlineBlock(child->parent())) {
311 ASSERT(child->isBeforeContent() || child->isAfterContent()); 311 ASSERT(child->isBeforeContent() || child->isAfterContent());
312 child->parent()->removeChild(child); 312 child->parent()->removeChild(child);
313 removeChild(child->parent()); 313 removeChild(child->parent());
314 return; 314 return;
315 } 315 }
316 316
317 // Otherwise find the containing run and remove it from there. 317 // Otherwise find the containing run and remove it from there.
318 RenderRubyRun* run = findRubyRunParent(child); 318 RenderRubyRun* run = findRubyRunParent(child);
319 ASSERT(run); 319 ASSERT(run);
320 run->removeChild(child); 320 run->removeChild(child);
321 } 321 }
322 322
323 } // namespace WebCore 323 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/RenderBlock.cpp ('k') | Source/WebCore/rendering/RenderTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698