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

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

Issue 8437038: Merge 98010 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/912/
Patch Set: Created 9 years, 1 month 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') | no next file » | 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, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 if (AXObjectCache::accessibilityEnabled()) 279 if (AXObjectCache::accessibilityEnabled())
280 owner->document()->axObjectCache()->childrenChanged(owner); 280 owner->document()->axObjectCache()->childrenChanged(owner);
281 } 281 }
282 282
283 static RenderObject* findBeforeAfterParent(RenderObject* object) 283 static RenderObject* findBeforeAfterParent(RenderObject* object)
284 { 284 {
285 // Only table parts need to search for the :before or :after parent 285 // Only table parts need to search for the :before or :after parent
286 if (!(object->isTable() || object->isTableSection() || object->isTableRow()) ) 286 if (!(object->isTable() || object->isTableSection() || object->isTableRow()) )
287 return object; 287 return object;
288 288
289 // If there is a :first-letter style applied on the :before or :after conten t,
290 // then we want the parent of the first-letter block
289 RenderObject* beforeAfterParent = object; 291 RenderObject* beforeAfterParent = object;
290 while (beforeAfterParent && !(beforeAfterParent->isText() || beforeAfterPare nt->isImage())) 292 while (beforeAfterParent && !(beforeAfterParent->isText() || beforeAfterPare nt->isImage())
293 && (beforeAfterParent->style()->styleType() != FIRST_LETTER))
291 beforeAfterParent = beforeAfterParent->firstChild(); 294 beforeAfterParent = beforeAfterParent->firstChild();
295
292 return beforeAfterParent ? beforeAfterParent->parent() : 0; 296 return beforeAfterParent ? beforeAfterParent->parent() : 0;
293 } 297 }
294 298
295 RenderObject* RenderObjectChildList::beforePseudoElementRenderer(const RenderObj ect* owner) const 299 RenderObject* RenderObjectChildList::beforePseudoElementRenderer(const RenderObj ect* owner) const
296 { 300 {
297 // An anonymous (generated) inline run-in that has PseudoId BEFORE must come from a grandparent. 301 // An anonymous (generated) inline run-in that has PseudoId BEFORE must come from a grandparent.
298 // Therefore we should skip these generated run-ins when checking our immedi ate children. 302 // Therefore we should skip these generated run-ins when checking our immedi ate children.
299 // If we don't find our :before child immediately, then we should check if w e own a 303 // If we don't find our :before child immediately, then we should check if w e own a
300 // generated inline run-in in the next level of children. 304 // generated inline run-in in the next level of children.
301 RenderObject* first = const_cast<RenderObject*>(owner); 305 RenderObject* first = const_cast<RenderObject*>(owner);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 // Images get an empty style that inherits from the pseudo. 446 // Images get an empty style that inherits from the pseudo.
443 RefPtr<RenderStyle> style = RenderStyle::create(); 447 RefPtr<RenderStyle> style = RenderStyle::create();
444 style->inheritFrom(pseudoElementStyle); 448 style->inheritFrom(pseudoElementStyle);
445 genChild->setStyle(style.release()); 449 genChild->setStyle(style.release());
446 } else { 450 } else {
447 // RenderListItem may insert a list marker here. We do not n eed to care about this case. 451 // RenderListItem may insert a list marker here. We do not n eed to care about this case.
448 // Otherwise, genChild must be a first-letter container. upd ateFirstLetter() will take care of it. 452 // Otherwise, genChild must be a first-letter container. upd ateFirstLetter() will take care of it.
449 ASSERT(genChild->isListMarker() || genChild->style()->styleT ype() == FIRST_LETTER); 453 ASSERT(genChild->isListMarker() || genChild->style()->styleT ype() == FIRST_LETTER);
450 } 454 }
451 } 455 }
452
453 // Update style on the remaining text fragment after the first-lette r.
454 if (beforeAfterParent->style()->styleType() == FIRST_LETTER) {
455 if (RenderObject* nextSibling = beforeAfterParent->nextSibling() ) {
456 if (nextSibling->isText() && nextSibling->style()->styleType () == child->style()->styleType())
457 nextSibling->setStyle(pseudoElementStyle);
458 }
459 }
460 } 456 }
461 return; // We've updated the generated content. That's all we needed to do. 457 return; // We've updated the generated content. That's all we needed to do.
462 } 458 }
463 459
464 RenderObject* insertBefore = (type == BEFORE) ? owner->virtualChildren()->fi rstChild() : 0; 460 RenderObject* insertBefore = (type == BEFORE) ? owner->virtualChildren()->fi rstChild() : 0;
465 if (insertBefore && insertBefore->isAnonymousBlock() && insertBefore->childr enInline() && !insertBefore->isEmpty()) { 461 if (insertBefore && insertBefore->isAnonymousBlock() && insertBefore->childr enInline() && !insertBefore->isEmpty()) {
466 // We are going to add the "before" element. We have to check whether th e "insertBefore" element 462 // We are going to add the "before" element. We have to check whether th e "insertBefore" element
467 // is an anonymous block with inline children. If it is, then we should insert the "before" element 463 // is an anonymous block with inline children. If it is, then we should insert the "before" element
468 // before the first inline child of the anonymous block, otherwise we wi ll end up with the "before" 464 // before the first inline child of the anonymous block, otherwise we wi ll end up with the "before"
469 // element in a different block. We do this only when the anonymous bloc k has children, otherwise 465 // element in a different block. We do this only when the anonymous bloc k has children, otherwise
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 } 521 }
526 if (generatedContentContainer->isChildAllowed(renderer, pseudoElemen tStyle)) 522 if (generatedContentContainer->isChildAllowed(renderer, pseudoElemen tStyle))
527 generatedContentContainer->addChild(renderer); 523 generatedContentContainer->addChild(renderer);
528 else 524 else
529 renderer->destroy(); 525 renderer->destroy();
530 } 526 }
531 } 527 }
532 } 528 }
533 529
534 } // namespace WebCore 530 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/RenderBlock.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698