Chromium Code Reviews| Index: Source/core/rendering/RenderObject.cpp |
| diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp |
| index 29e977f63c085cfb8145e8923a247e5e41b7918f..e7c523f599e2f1735dc5159d54780de018ca7faa 100644 |
| --- a/Source/core/rendering/RenderObject.cpp |
| +++ b/Source/core/rendering/RenderObject.cpp |
| @@ -1797,24 +1797,16 @@ void RenderObject::handleDynamicFloatPositionChange() |
| StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff, unsigned contextSensitiveProperties) const |
| { |
| - // If transform changed, and the layer does not paint into its own separate backing, then we need to do a layout. |
| - // FIXME: The comment above is what the code does, but it is technically not following spec. This means we will |
| - // not to layout for 3d transforms, but we should be invoking a simplified relayout. Is it possible we are avoiding |
| - // doing this for some performance reason at this time? |
| - if (contextSensitiveProperties & ContextSensitivePropertyTransform) { |
| + if (contextSensitiveProperties & ContextSensitivePropertyTransform && isSVG()) |
| + diff = StyleDifferenceLayout; |
|
esprehn
2014/04/10 23:46:14
Why the special case for SVG?
trchen
2014/04/11 22:04:55
Because SVG is special. They do rely on layout to
|
| + |
| + // If transform changed, and the layer does not paint into its own separate backing, then we need to repaint. |
| + if (contextSensitiveProperties & ContextSensitivePropertyTransform && diff <= StyleDifferenceRepaintLayer) { |
| // Text nodes share style with their parents but transforms don't apply to them, |
| // hence the !isText() check. |
| - // FIXME: when transforms are taken into account for overflow, we will need to do a layout. |
| - if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer()->hasDirectReasonsForCompositing())) { |
| - // We need to set at least SimplifiedLayout, but if PositionedMovementOnly is already set |
| - // then we actually need SimplifiedLayoutAndPositionedMovement. |
| - if (!hasLayer()) |
| - diff = StyleDifferenceLayout; // FIXME: Do this for now since SimplifiedLayout cannot handle updating floating objects lists. |
| - else if (diff < StyleDifferenceLayoutPositionedMovementOnly) |
| - diff = StyleDifferenceSimplifiedLayout; |
| - else if (diff < StyleDifferenceSimplifiedLayout) |
| - diff = StyleDifferenceSimplifiedLayoutAndPositionedMovement; |
| - } else if (diff < StyleDifferenceRecompositeLayer) |
| + if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer()->hasDirectReasonsForCompositing())) |
| + diff = StyleDifferenceRepaintLayer; |
| + else if (diff < StyleDifferenceRecompositeLayer) |
| diff = StyleDifferenceRecompositeLayer; |
| } |
| @@ -1892,6 +1884,18 @@ inline bool RenderObject::shouldRepaintForStyleDifference(StyleDifference diff) |
| return diff == StyleDifferenceRepaint || (diff == StyleDifferenceRepaintIfTextOrColorChange && hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor()); |
| } |
| +void RenderObject::markContainingBlocksForOverflowRecalc() |
| +{ |
| + for (RenderBlock* container = containingBlock(); container && !container->childNeedsOverflowRecalcAfterStyleChange(); container = container->containingBlock()) |
| + container->setChildNeedsOverflowRecalcAfterStyleChange(true); |
| +} |
| + |
| +void RenderObject::setNeedsOverflowRecalcAfterStyleChange() |
| +{ |
| + setSelfNeedsOverflowRecalcAfterStyleChange(true); |
| + markContainingBlocksForOverflowRecalc(); |
| +} |
| + |
| void RenderObject::setStyle(PassRefPtr<RenderStyle> style) |
| { |
| if (m_style == style) { |
| @@ -1941,11 +1945,13 @@ void RenderObject::setStyle(PassRefPtr<RenderStyle> style) |
| setNeedsLayoutAndPrefWidthsRecalc(); |
| else if (updatedDiff == StyleDifferenceLayoutPositionedMovementOnly) |
| setNeedsPositionedMovementLayout(); |
| - else if (updatedDiff == StyleDifferenceSimplifiedLayoutAndPositionedMovement) { |
| - setNeedsPositionedMovementLayout(); |
| - setNeedsSimplifiedNormalFlowLayout(); |
| - } else if (updatedDiff == StyleDifferenceSimplifiedLayout) |
| - setNeedsSimplifiedNormalFlowLayout(); |
| + } |
| + |
| + if (contextSensitiveProperties & ContextSensitivePropertyTransform && !needsLayout()) { |
| + if (RenderBlock* container = containingBlock()) |
| + container->setNeedsOverflowRecalcAfterStyleChange(); |
| + if (isBox()) |
| + toRenderBox(this)->updateLayerTransform(); |
| } |
| if (updatedDiff == StyleDifferenceRepaintLayer || shouldRepaintForStyleDifference(updatedDiff)) { |
| @@ -2080,7 +2086,7 @@ void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle* oldSt |
| if (!m_parent) |
| return; |
| - if (diff == StyleDifferenceLayout || diff == StyleDifferenceSimplifiedLayout) { |
| + if (diff == StyleDifferenceLayout) { |
| RenderCounter::rendererStyleChanged(*this, oldStyle, m_style.get()); |
| // If the object already needs layout, then setNeedsLayout won't do |
| @@ -2091,13 +2097,14 @@ void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle* oldSt |
| if (needsLayout() && oldStyle->position() != m_style->position()) |
| markContainingBlocksForLayout(); |
| + // Ditto. |
| + if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_style->position()) { |
| + if (RenderBlock* container = containingBlock()) |
| + container->markContainingBlocksForOverflowRecalc(); |
|
esprehn
2014/04/10 23:46:14
This doesn't look right, you want to call markCont
trchen
2014/04/11 22:04:55
Done.
|
| + } |
| + |
| if (diff == StyleDifferenceLayout) |
| setNeedsLayoutAndPrefWidthsRecalc(); |
| - else |
| - setNeedsSimplifiedNormalFlowLayout(); |
| - } else if (diff == StyleDifferenceSimplifiedLayoutAndPositionedMovement) { |
| - setNeedsPositionedMovementLayout(); |
| - setNeedsSimplifiedNormalFlowLayout(); |
| } else if (diff == StyleDifferenceLayoutPositionedMovementOnly) |
| setNeedsPositionedMovementLayout(); |