OLD | NEW |
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 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 if (isImage() || isQuote()) { | 1602 if (isImage() || isQuote()) { |
1603 RefPtr<RenderStyle> style = RenderStyle::create(); | 1603 RefPtr<RenderStyle> style = RenderStyle::create(); |
1604 style->inheritFrom(pseudoStyle.get()); | 1604 style->inheritFrom(pseudoStyle.get()); |
1605 setStyle(style.release()); | 1605 setStyle(style.release()); |
1606 return; | 1606 return; |
1607 } | 1607 } |
1608 | 1608 |
1609 setStyle(pseudoStyle); | 1609 setStyle(pseudoStyle); |
1610 } | 1610 } |
1611 | 1611 |
1612 void RenderObject::markContainingBlocksForOverflowRecalc() | 1612 // FIXME: This will be markContainingBoxesForOverflowRecalc() when we make Rende
rBoxes recomputeOverflow-capable. crbug.com/437012. |
| 1613 void RenderObject::markContainersForOverflowRecalcIfNeeded() |
1613 { | 1614 { |
1614 for (RenderBlock* container = containingBlock(); container && !container->ch
ildNeedsOverflowRecalcAfterStyleChange(); container = container->containingBlock
()) | 1615 RenderObject* object = this; |
1615 container->setChildNeedsOverflowRecalcAfterStyleChange(true); | 1616 do { |
| 1617 // Cell and row need to propagate the flag to their containing section a
nd row as their containing block is the table wrapper. |
| 1618 // This enables us to only recompute overflow the modified sections / ro
ws. |
| 1619 object = object->isTableCell() || object->isTableRow() ? object->parent(
) : object->containingBlock(); |
| 1620 if (object) |
| 1621 object->setChildNeedsOverflowRecalcAfterStyleChange(); |
| 1622 } while (object); |
1616 } | 1623 } |
1617 | 1624 |
1618 void RenderObject::setNeedsOverflowRecalcAfterStyleChange() | 1625 void RenderObject::setNeedsOverflowRecalcAfterStyleChange() |
1619 { | 1626 { |
1620 bool neededRecalc = needsOverflowRecalcAfterStyleChange(); | 1627 bool neededRecalc = needsOverflowRecalcAfterStyleChange(); |
1621 setSelfNeedsOverflowRecalcAfterStyleChange(true); | 1628 setSelfNeedsOverflowRecalcAfterStyleChange(); |
1622 if (!neededRecalc) | 1629 if (!neededRecalc) |
1623 markContainingBlocksForOverflowRecalc(); | 1630 markContainersForOverflowRecalcIfNeeded(); |
1624 } | 1631 } |
1625 | 1632 |
1626 void RenderObject::setStyle(PassRefPtr<RenderStyle> style) | 1633 void RenderObject::setStyle(PassRefPtr<RenderStyle> style) |
1627 { | 1634 { |
1628 ASSERT(style); | 1635 ASSERT(style); |
1629 | 1636 |
1630 if (m_style == style) { | 1637 if (m_style == style) { |
1631 // We need to run through adjustStyleDifference() for iframes, plugins,
and canvas so | 1638 // We need to run through adjustStyleDifference() for iframes, plugins,
and canvas so |
1632 // style sharing is disabled for them. That should ensure that we never
hit this code path. | 1639 // style sharing is disabled for them. That should ensure that we never
hit this code path. |
1633 ASSERT(!isRenderIFrame() && !isEmbeddedObject() && !isCanvas()); | 1640 ASSERT(!isRenderIFrame() && !isEmbeddedObject() && !isCanvas()); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1815 // If the object already needs layout, then setNeedsLayout won't do | 1822 // If the object already needs layout, then setNeedsLayout won't do |
1816 // any work. But if the containing block has changed, then we may need | 1823 // any work. But if the containing block has changed, then we may need |
1817 // to mark the new containing blocks for layout. The change that can | 1824 // to mark the new containing blocks for layout. The change that can |
1818 // directly affect the containing block of this object is a change to | 1825 // directly affect the containing block of this object is a change to |
1819 // the position style. | 1826 // the position style. |
1820 if (needsLayout() && oldStyle->position() != m_style->position()) | 1827 if (needsLayout() && oldStyle->position() != m_style->position()) |
1821 markContainingBlocksForLayout(); | 1828 markContainingBlocksForLayout(); |
1822 | 1829 |
1823 // Ditto. | 1830 // Ditto. |
1824 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s
tyle->position()) | 1831 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s
tyle->position()) |
1825 markContainingBlocksForOverflowRecalc(); | 1832 markContainersForOverflowRecalcIfNeeded(); |
1826 | 1833 |
1827 if (diff.needsFullLayout()) | 1834 if (diff.needsFullLayout()) |
1828 setNeedsLayoutAndPrefWidthsRecalc(); | 1835 setNeedsLayoutAndPrefWidthsRecalc(); |
1829 } else if (diff.needsPositionedMovementLayout()) | 1836 } else if (diff.needsPositionedMovementLayout()) |
1830 setNeedsPositionedMovementLayout(); | 1837 setNeedsPositionedMovementLayout(); |
1831 | 1838 |
1832 // Don't check for paint invalidation here; we need to wait until the layer
has been | 1839 // Don't check for paint invalidation here; we need to wait until the layer
has been |
1833 // updated by subclasses before we know if we have to invalidate paints (in
setStyle()). | 1840 // updated by subclasses before we know if we have to invalidate paints (in
setStyle()). |
1834 | 1841 |
1835 if (oldStyle && !areCursorsEqual(oldStyle, style())) { | 1842 if (oldStyle && !areCursorsEqual(oldStyle, style())) { |
(...skipping 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3135 { | 3142 { |
3136 if (object1) { | 3143 if (object1) { |
3137 const blink::RenderObject* root = object1; | 3144 const blink::RenderObject* root = object1; |
3138 while (root->parent()) | 3145 while (root->parent()) |
3139 root = root->parent(); | 3146 root = root->parent(); |
3140 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3147 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3141 } | 3148 } |
3142 } | 3149 } |
3143 | 3150 |
3144 #endif | 3151 #endif |
OLD | NEW |