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

Side by Side Diff: sky/engine/core/rendering/RenderBox.cpp

Issue 729693003: First step at getting rid of anonymous blocks and continuations. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address review comments Created 6 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 | « sky/engine/core/rendering/RenderBlockFlow.cpp ('k') | sky/engine/core/rendering/RenderObject.h » ('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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 3455 matching lines...) Expand 10 before | Expand all | Expand 10 after
3466 return adjustedPositionRelativeToOffsetParent(location()).y(); 3466 return adjustedPositionRelativeToOffsetParent(location()).y();
3467 } 3467 }
3468 3468
3469 bool RenderBox::hasRelativeLogicalHeight() const 3469 bool RenderBox::hasRelativeLogicalHeight() const
3470 { 3470 {
3471 return style()->logicalHeight().isPercent() 3471 return style()->logicalHeight().isPercent()
3472 || style()->logicalMinHeight().isPercent() 3472 || style()->logicalMinHeight().isPercent()
3473 || style()->logicalMaxHeight().isPercent(); 3473 || style()->logicalMaxHeight().isPercent();
3474 } 3474 }
3475 3475
3476 static void markBoxForRelayoutAfterSplit(RenderBox* box)
3477 {
3478 box->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation();
3479 }
3480
3481 RenderObject* RenderBox::splitAnonymousBoxesAroundChild(RenderObject* beforeChil d)
3482 {
3483 bool didSplitParentAnonymousBoxes = false;
3484
3485 while (beforeChild->parent() != this) {
3486 RenderBox* boxToSplit = toRenderBox(beforeChild->parent());
3487 if (boxToSplit->slowFirstChild() != beforeChild && boxToSplit->isAnonymo us()) {
3488 didSplitParentAnonymousBoxes = true;
3489
3490 // We have to split the parent box into two boxes and move children
3491 // from |beforeChild| to end into the new post box.
3492 RenderBox* postBox = boxToSplit->createAnonymousBoxWithSameTypeAs(th is);
3493 postBox->setChildrenInline(boxToSplit->childrenInline());
3494 RenderBox* parentBox = toRenderBox(boxToSplit->parent());
3495 // We need to invalidate the |parentBox| before inserting the new no de
3496 // so that the table paint invalidation logic knows the structure is dirty.
3497 // See for example RenderTableCell:clippedOverflowRectForPaintInvali dation.
3498 markBoxForRelayoutAfterSplit(parentBox);
3499 parentBox->virtualChildren()->insertChildNode(parentBox, postBox, bo xToSplit->nextSibling());
3500 boxToSplit->moveChildrenTo(postBox, beforeChild, 0, true);
3501
3502 markBoxForRelayoutAfterSplit(boxToSplit);
3503 markBoxForRelayoutAfterSplit(postBox);
3504
3505 beforeChild = postBox;
3506 } else
3507 beforeChild = boxToSplit;
3508 }
3509
3510 if (didSplitParentAnonymousBoxes)
3511 markBoxForRelayoutAfterSplit(this);
3512
3513 ASSERT(beforeChild->parent() == this);
3514 return beforeChild;
3515 }
3516
3517 void RenderBox::savePreviousBorderBoxSizeIfNeeded() 3476 void RenderBox::savePreviousBorderBoxSizeIfNeeded()
3518 { 3477 {
3519 // If m_rareData is already created, always save. 3478 // If m_rareData is already created, always save.
3520 if (!m_rareData) { 3479 if (!m_rareData) {
3521 LayoutSize paintInvalidationSize = previousPaintInvalidationRect().size( ); 3480 LayoutSize paintInvalidationSize = previousPaintInvalidationRect().size( );
3522 3481
3523 // Don't save old border box size if the paint rect is empty because we' ll 3482 // Don't save old border box size if the paint rect is empty because we' ll
3524 // full invalidate once the paint rect becomes non-empty. 3483 // full invalidate once the paint rect becomes non-empty.
3525 if (paintInvalidationSize.isEmpty()) 3484 if (paintInvalidationSize.isEmpty())
3526 return; 3485 return;
(...skipping 25 matching lines...) Expand all
3552 3511
3553 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) 3512 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style)
3554 { 3513 {
3555 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor); 3514 backgroundColor = style.colorIncludingFallback(CSSPropertyBackgroundColor);
3556 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); 3515 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage();
3557 ASSERT(hasBackground == style.hasBackground()); 3516 ASSERT(hasBackground == style.hasBackground());
3558 hasBorder = style.hasBorder(); 3517 hasBorder = style.hasBorder();
3559 } 3518 }
3560 3519
3561 } // namespace blink 3520 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBlockFlow.cpp ('k') | sky/engine/core/rendering/RenderObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698