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

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

Issue 10447080: Merge 117865 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 6 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/RenderObject.h ('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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 style->inheritFrom(pseudoElementStyle); 390 style->inheritFrom(pseudoElementStyle);
391 genChild->setStyle(style.release()); 391 genChild->setStyle(style.release());
392 } else { 392 } else {
393 // RenderListItem may insert a list marker here. We do not need to c are about this case. 393 // RenderListItem may insert a list marker here. We do not need to c are about this case.
394 // Otherwise, genChild must be a first-letter container. updateFirst Letter() will take care of it. 394 // Otherwise, genChild must be a first-letter container. updateFirst Letter() will take care of it.
395 ASSERT(genChild->isListMarker() || genChild->style()->styleType() == FIRST_LETTER); 395 ASSERT(genChild->isListMarker() || genChild->style()->styleType() == FIRST_LETTER);
396 } 396 }
397 } 397 }
398 } 398 }
399 399
400 static RenderObject* createRenderForBeforeAfterContent(RenderObject* owner, cons t ContentData* content, RenderStyle* pseudoElementStyle) 400 static RenderObject* createRendererForBeforeAfterContent(RenderObject* owner, co nst ContentData* content, RenderStyle* pseudoElementStyle)
401 { 401 {
402 RenderObject* renderer = 0; 402 RenderObject* renderer = 0;
403 switch (content->type()) { 403 switch (content->type()) {
404 case CONTENT_NONE: 404 case CONTENT_NONE:
405 break; 405 break;
406 case CONTENT_TEXT: 406 case CONTENT_TEXT:
407 renderer = new (owner->renderArena()) RenderTextFragment(owner->document () /* anonymous object */, static_cast<const TextContentData*>(content)->text(). impl()); 407 renderer = new (owner->renderArena()) RenderTextFragment(owner->document () /* anonymous object */, static_cast<const TextContentData*>(content)->text(). impl());
408 renderer->setStyle(pseudoElementStyle); 408 renderer->setStyle(pseudoElementStyle);
409 break; 409 break;
410 case CONTENT_OBJECT: { 410 case CONTENT_OBJECT: {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 RenderObject* insertBefore = (type == BEFORE) ? owner->virtualChildren()->fi rstChild() : 0; 507 RenderObject* insertBefore = (type == BEFORE) ? owner->virtualChildren()->fi rstChild() : 0;
508 if (insertBefore && insertBefore->isAnonymousBlock() && insertBefore->childr enInline() && !insertBefore->isEmpty()) { 508 if (insertBefore && insertBefore->isAnonymousBlock() && insertBefore->childr enInline() && !insertBefore->isEmpty()) {
509 // We are going to add the "before" element. We have to check whether th e "insertBefore" element 509 // We are going to add the "before" element. We have to check whether th e "insertBefore" element
510 // is an anonymous block with inline children. If it is, then we should insert the "before" element 510 // is an anonymous block with inline children. If it is, then we should insert the "before" element
511 // before the first inline child of the anonymous block, otherwise we wi ll end up with the "before" 511 // before the first inline child of the anonymous block, otherwise we wi ll end up with the "before"
512 // element in a different block. We do this only when the anonymous bloc k has children, otherwise 512 // element in a different block. We do this only when the anonymous bloc k has children, otherwise
513 // we end up with the before element in a wrong block. 513 // we end up with the before element in a wrong block.
514 insertBefore = insertBefore->firstChild(); 514 insertBefore = insertBefore->firstChild();
515 } 515 }
516 516
517 // Nothing goes before the intruded run-in, not even generated content.
518 if (insertBefore && insertBefore->isRunIn() && owner->isRenderBlock()
519 && toRenderBlock(owner)->runInIsPlacedIntoSiblingBlock(insertBefore))
520 insertBefore = insertBefore->nextSibling();
521
517 // Generated content consists of a single container that houses multiple chi ldren (specified 522 // Generated content consists of a single container that houses multiple chi ldren (specified
518 // by the content property). This generated content container gets the pseu do-element style set on it. 523 // by the content property). This generated content container gets the pseu do-element style set on it.
519 RenderObject* generatedContentContainer = 0; 524 RenderObject* generatedContentContainer = 0;
520 525
521 // Walk our list of generated content and create render objects for each. 526 // Walk our list of generated content and create render objects for each.
522 for (const ContentData* content = pseudoElementStyle->contentData(); content ; content = content->next()) { 527 for (const ContentData* content = pseudoElementStyle->contentData(); content ; content = content->next()) {
523 RenderObject* renderer = createRenderForBeforeAfterContent(owner, conte nt, pseudoElementStyle); 528 RenderObject* renderer = createRendererForBeforeAfterContent(owner, con tent, pseudoElementStyle);
524 529
525 if (renderer) { 530 if (renderer) {
526 if (!generatedContentContainer) { 531 if (!generatedContentContainer) {
527 // Make a generated box that might be any display type now that we are able to drill down into children 532 // Make a generated box that might be any display type now that we are able to drill down into children
528 // to find the original content properly. 533 // to find the original content properly.
529 generatedContentContainer = RenderObject::createObject(owner->do cument(), pseudoElementStyle); 534 generatedContentContainer = RenderObject::createObject(owner->do cument(), pseudoElementStyle);
530 ASSERT(styledObject->node()); // The styled object cannot be ano nymous or else it could not have ':before' or ':after' pseudo elements. 535 ASSERT(styledObject->node()); // The styled object cannot be ano nymous or else it could not have ':before' or ':after' pseudo elements.
531 generatedContentContainer->setNode(styledObject->node()); // Thi s allows access to the generatingNode. 536 generatedContentContainer->setNode(styledObject->node()); // Thi s allows access to the generatingNode.
532 generatedContentContainer->setStyle(pseudoElementStyle); 537 generatedContentContainer->setStyle(pseudoElementStyle);
533 if (!owner->isChildAllowed(generatedContentContainer, pseudoElem entStyle)) { 538 if (!owner->isChildAllowed(generatedContentContainer, pseudoElem entStyle)) {
(...skipping 11 matching lines...) Expand all
545 owner->addChildIgnoringContinuation(generatedContentContaine r, 0); 550 owner->addChildIgnoringContinuation(generatedContentContaine r, 0);
546 else 551 else
547 owner->addChild(generatedContentContainer, insertBefore); 552 owner->addChild(generatedContentContainer, insertBefore);
548 } 553 }
549 if (generatedContentContainer->isChildAllowed(renderer, pseudoElemen tStyle)) 554 if (generatedContentContainer->isChildAllowed(renderer, pseudoElemen tStyle))
550 generatedContentContainer->addChild(renderer); 555 generatedContentContainer->addChild(renderer);
551 else 556 else
552 renderer->destroy(); 557 renderer->destroy();
553 } 558 }
554 } 559 }
560
561 if (!generatedContentContainer)
562 return;
563
564 // Handle placement of run-ins. We do the run-in placement at the end since generatedContentContainer can get destroyed.
565 RenderObject* generatedContentContainerImmediateParent = generatedContentCon tainer->parent();
566 if (generatedContentContainerImmediateParent->isRenderBlock())
567 toRenderBlock(generatedContentContainerImmediateParent)->placeRunInIfNee ded(generatedContentContainer, PlaceGeneratedRunIn);
555 } 568 }
556 569
557 } // namespace WebCore 570 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/rendering/RenderObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698