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

Side by Side Diff: Source/core/rendering/RenderObject.cpp

Issue 744493002: Let RenderTable reach table cells needing overflow recalc (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Avoid O(rows*cols) Created 6 years 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 | Annotate | Revision Log
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) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 if (isImage() || isQuote()) { 1607 if (isImage() || isQuote()) {
1608 RefPtr<RenderStyle> style = RenderStyle::create(); 1608 RefPtr<RenderStyle> style = RenderStyle::create();
1609 style->inheritFrom(pseudoStyle.get()); 1609 style->inheritFrom(pseudoStyle.get());
1610 setStyle(style.release()); 1610 setStyle(style.release());
1611 return; 1611 return;
1612 } 1612 }
1613 1613
1614 setStyle(pseudoStyle); 1614 setStyle(pseudoStyle);
1615 } 1615 }
1616 1616
1617 void RenderObject::markContainingBlocksForOverflowRecalc() 1617 static RenderObject* containerForOverflowRecalc(const RenderObject* object)
1618 { 1618 {
1619 for (RenderBlock* container = containingBlock(); container && !container->ch ildNeedsOverflowRecalcAfterStyleChange(); container = container->containingBlock ()) 1619 // For table parts, we let the parent (e.g. RenderTableRow for RenderTableCe ll)
1620 container->setChildNeedsOverflowRecalcAfterStyleChange(true); 1620 // handle the childNeedsOverflowRecalcAfterStyleChange flag, because
1621 // RenderBlock::recalcChildOverflowAfterStyleChange() may not reach the tabl e parts.
1622 return object->isTablePart() ? object->parent() : object->containingBlock();
1623 }
Julien - ping for review 2014/11/25 18:33:10 :( Wouldn't container() work without needing this
Xianzhu 2014/11/25 20:17:12 This seems not the best because we'll set the flag
1624
1625 void RenderObject::markContainersForOverflowRecalc()
Julien - ping for review 2014/11/25 18:33:10 If you put container in the name, I would have exp
1626 {
1627 for (RenderObject* container = containerForOverflowRecalc(this); container & & !container->childNeedsOverflowRecalcAfterStyleChange(); container = containerF orOverflowRecalc(container))
1628 container->setChildNeedsOverflowRecalcAfterStyleChange();
1621 } 1629 }
1622 1630
1623 void RenderObject::setNeedsOverflowRecalcAfterStyleChange() 1631 void RenderObject::setNeedsOverflowRecalcAfterStyleChange()
1624 { 1632 {
1625 bool neededRecalc = needsOverflowRecalcAfterStyleChange(); 1633 bool neededRecalc = needsOverflowRecalcAfterStyleChange();
1626 setSelfNeedsOverflowRecalcAfterStyleChange(true); 1634 setSelfNeedsOverflowRecalcAfterStyleChange();
1627 if (!neededRecalc) 1635 if (!neededRecalc)
1628 markContainingBlocksForOverflowRecalc(); 1636 markContainersForOverflowRecalc();
1629 } 1637 }
1630 1638
1631 void RenderObject::setStyle(PassRefPtr<RenderStyle> style) 1639 void RenderObject::setStyle(PassRefPtr<RenderStyle> style)
1632 { 1640 {
1633 ASSERT(style); 1641 ASSERT(style);
1634 1642
1635 if (m_style == style) { 1643 if (m_style == style) {
1636 // We need to run through adjustStyleDifference() for iframes, plugins, and canvas so 1644 // We need to run through adjustStyleDifference() for iframes, plugins, and canvas so
1637 // style sharing is disabled for them. That should ensure that we never hit this code path. 1645 // style sharing is disabled for them. That should ensure that we never hit this code path.
1638 ASSERT(!isRenderIFrame() && !isEmbeddedObject() && !isCanvas()); 1646 ASSERT(!isRenderIFrame() && !isEmbeddedObject() && !isCanvas());
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 // If the object already needs layout, then setNeedsLayout won't do 1828 // If the object already needs layout, then setNeedsLayout won't do
1821 // any work. But if the containing block has changed, then we may need 1829 // any work. But if the containing block has changed, then we may need
1822 // to mark the new containing blocks for layout. The change that can 1830 // to mark the new containing blocks for layout. The change that can
1823 // directly affect the containing block of this object is a change to 1831 // directly affect the containing block of this object is a change to
1824 // the position style. 1832 // the position style.
1825 if (needsLayout() && oldStyle->position() != m_style->position()) 1833 if (needsLayout() && oldStyle->position() != m_style->position())
1826 markContainingBlocksForLayout(); 1834 markContainingBlocksForLayout();
1827 1835
1828 // Ditto. 1836 // Ditto.
1829 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s tyle->position()) 1837 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s tyle->position())
1830 markContainingBlocksForOverflowRecalc(); 1838 markContainersForOverflowRecalc();
1831 1839
1832 if (diff.needsFullLayout()) 1840 if (diff.needsFullLayout())
1833 setNeedsLayoutAndPrefWidthsRecalc(); 1841 setNeedsLayoutAndPrefWidthsRecalc();
1834 } else if (diff.needsPositionedMovementLayout()) 1842 } else if (diff.needsPositionedMovementLayout())
1835 setNeedsPositionedMovementLayout(); 1843 setNeedsPositionedMovementLayout();
1836 1844
1837 // Don't check for paint invalidation here; we need to wait until the layer has been 1845 // Don't check for paint invalidation here; we need to wait until the layer has been
1838 // updated by subclasses before we know if we have to invalidate paints (in setStyle()). 1846 // updated by subclasses before we know if we have to invalidate paints (in setStyle()).
1839 1847
1840 if (oldStyle && !areCursorsEqual(oldStyle, style())) { 1848 if (oldStyle && !areCursorsEqual(oldStyle, style())) {
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after
3140 { 3148 {
3141 if (object1) { 3149 if (object1) {
3142 const blink::RenderObject* root = object1; 3150 const blink::RenderObject* root = object1;
3143 while (root->parent()) 3151 while (root->parent())
3144 root = root->parent(); 3152 root = root->parent();
3145 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3153 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3146 } 3154 }
3147 } 3155 }
3148 3156
3149 #endif 3157 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698