| Index: Source/core/rendering/RenderObject.cpp
|
| diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
|
| index 63346d4f89457c81cfbbebc152ad939841139841..91a0a7f823764ddbe58f363ed3d2b1c72b013926 100644
|
| --- a/Source/core/rendering/RenderObject.cpp
|
| +++ b/Source/core/rendering/RenderObject.cpp
|
| @@ -1850,57 +1850,59 @@ void RenderObject::handleDynamicFloatPositionChange()
|
| }
|
| }
|
|
|
| -StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff, unsigned contextSensitiveProperties) const
|
| +StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff) const
|
| {
|
| // FIXME: The calls to hasDirectReasonsForCompositing are using state that may not be up to date.
|
| DisableCompositingQueryAsserts disabler;
|
|
|
| - if (contextSensitiveProperties & ContextSensitivePropertyTransform && isSVG())
|
| - diff = StyleDifferenceLayout;
|
| + if (diff.transformChanged() && isSVG())
|
| + diff.setNeedsFullLayout();
|
|
|
| // If transform changed, and the layer does not paint into its own separate backing, then we need to repaint.
|
| - if (contextSensitiveProperties & ContextSensitivePropertyTransform && diff <= StyleDifferenceRepaintLayer) {
|
| + if (diff.transformChanged() && !diff.needsLayout()) {
|
| // Text nodes share style with their parents but transforms don't apply to them,
|
| // hence the !isText() check.
|
| if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer()->hasDirectReasonsForCompositing()))
|
| - diff = StyleDifferenceRepaintLayer;
|
| - else if (diff < StyleDifferenceRecompositeLayer)
|
| - diff = StyleDifferenceRecompositeLayer;
|
| + diff.setNeedsRepaintLayer();
|
| + else
|
| + diff.setNeedsRecompositeLayer();
|
| }
|
|
|
| // If opacity or filters changed, and the layer does not paint into its own separate backing, then we need to repaint (also
|
| // ignoring text nodes)
|
| - if (contextSensitiveProperties & ContextSensitivePropertyOpacity && diff <= StyleDifferenceRepaintLayer) {
|
| + if (diff.opacityChanged() && !diff.needsLayout()) {
|
| if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer()->hasDirectReasonsForCompositing()))
|
| - diff = StyleDifferenceRepaintLayer;
|
| - else if (diff < StyleDifferenceRecompositeLayer)
|
| - diff = StyleDifferenceRecompositeLayer;
|
| + diff.setNeedsRepaintLayer();
|
| + else
|
| + diff.setNeedsRecompositeLayer();
|
| }
|
|
|
| - if ((contextSensitiveProperties & ContextSensitivePropertyFilter) && hasLayer() && diff <= StyleDifferenceRepaintLayer) {
|
| + if (diff.filterChanged() && hasLayer() && !diff.needsLayout()) {
|
| RenderLayer* layer = toRenderLayerModelObject(this)->layer();
|
| if (!layer->hasDirectReasonsForCompositing() || layer->paintsWithFilters())
|
| - diff = StyleDifferenceRepaintLayer;
|
| - else if (diff < StyleDifferenceRecompositeLayer)
|
| - diff = StyleDifferenceRecompositeLayer;
|
| + diff.setNeedsRepaintLayer();
|
| + else
|
| + diff.setNeedsRecompositeLayer();
|
| }
|
|
|
| - if ((contextSensitiveProperties & ContextSensitivePropertyTextOrColor) && diff < StyleDifferenceRepaint
|
| + if (diff.textOrColorChanged() && !diff.needsRepaint() && !diff.needsLayout()
|
| && hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor())
|
| - diff = StyleDifferenceRepaint;
|
| + diff.setNeedsRepaintObject();
|
|
|
| // The answer to layerTypeRequired() for plugins, iframes, and canvas can change without the actual
|
| // style changing, since it depends on whether we decide to composite these elements. When the
|
| // layer status of one of these elements changes, we need to force a layout.
|
| - if (diff == StyleDifferenceEqual && style() && isLayerModelObject()) {
|
| + if (diff.hasNoChange() && style() && isLayerModelObject()) {
|
| bool requiresLayer = toRenderLayerModelObject(this)->layerTypeRequired() != NoLayer;
|
| if (hasLayer() != requiresLayer)
|
| - diff = StyleDifferenceLayout;
|
| + diff.setNeedsFullLayout();
|
| }
|
|
|
| // If we have no layer(), just treat a RepaintLayer hint as a normal Repaint.
|
| - if (diff == StyleDifferenceRepaintLayer && !hasLayer())
|
| - diff = StyleDifferenceRepaint;
|
| + if (diff.needsRepaintLayer() && !hasLayer()) {
|
| + diff.resetNeedsRepaint();
|
| + diff.setNeedsRepaintObject();
|
| + }
|
|
|
| return diff;
|
| }
|
| @@ -1964,12 +1966,11 @@ void RenderObject::setStyle(PassRefPtr<RenderStyle> style)
|
| return;
|
| }
|
|
|
| - StyleDifference diff = StyleDifferenceEqual;
|
| - unsigned contextSensitiveProperties = ContextSensitivePropertyNone;
|
| + StyleDifference diff;
|
| if (m_style)
|
| - diff = m_style->visualInvalidationDiff(*style, contextSensitiveProperties);
|
| + diff = m_style->visualInvalidationDiff(*style);
|
|
|
| - diff = adjustStyleDifference(diff, contextSensitiveProperties);
|
| + diff = adjustStyleDifference(diff);
|
|
|
| styleWillChange(diff, *style);
|
|
|
| @@ -1997,23 +1998,23 @@ void RenderObject::setStyle(PassRefPtr<RenderStyle> style)
|
|
|
| // Now that the layer (if any) has been updated, we need to adjust the diff again,
|
| // check whether we should layout now, and decide if we need to repaint.
|
| - StyleDifference updatedDiff = adjustStyleDifference(diff, contextSensitiveProperties);
|
| + StyleDifference updatedDiff = adjustStyleDifference(diff);
|
|
|
| - if (diff <= StyleDifferenceLayoutPositionedMovementOnly) {
|
| - if (updatedDiff == StyleDifferenceLayout)
|
| + if (!diff.needsFullLayout()) {
|
| + if (updatedDiff.needsFullLayout())
|
| setNeedsLayoutAndPrefWidthsRecalc();
|
| - else if (updatedDiff == StyleDifferenceLayoutPositionedMovementOnly)
|
| + else if (updatedDiff.needsPositionedMovementLayoutOnly())
|
| setNeedsPositionedMovementLayout();
|
| }
|
|
|
| - if (contextSensitiveProperties & ContextSensitivePropertyTransform && !needsLayout()) {
|
| + if (diff.transformChanged() && !needsLayout()) {
|
| if (RenderBlock* container = containingBlock())
|
| container->setNeedsOverflowRecalcAfterStyleChange();
|
| if (isBox())
|
| toRenderBox(this)->updateLayerTransform();
|
| }
|
|
|
| - if (updatedDiff == StyleDifferenceRepaint || updatedDiff == StyleDifferenceRepaintLayer) {
|
| + if (updatedDiff.needsRepaint()) {
|
| // Do a repaint with the new style now, e.g., for example if we go from
|
| // not having an outline to having an outline.
|
| repaint();
|
| @@ -2047,13 +2048,13 @@ void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS
|
| layer->setHasVisibleContent();
|
| } else if (layer->hasVisibleContent() && (this == layer->renderer() || layer->renderer()->style()->visibility() != VISIBLE)) {
|
| layer->dirtyVisibleContentStatus();
|
| - if (diff > StyleDifferenceRepaintLayer)
|
| + if (diff.needsLayout())
|
| repaint();
|
| }
|
| }
|
| }
|
|
|
| - if (m_parent && diff == StyleDifferenceRepaint)
|
| + if (m_parent && diff.needsRepaintObjectOnly())
|
| repaint();
|
| if (isFloating() && (m_style->floating() != newStyle.floating()))
|
| // For changes in float styles, we need to conceivably remove ourselves
|
| @@ -2070,12 +2071,13 @@ void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS
|
|
|
| // Clearing these bits is required to avoid leaving stale renderers.
|
| // FIXME: We shouldn't need that hack if our logic was totally correct.
|
| - if (diff == StyleDifferenceLayout || diff == StyleDifferenceLayoutPositionedMovementOnly) {
|
| + if (diff.needsFullLayout() || diff.needsPositionedMovementLayoutOnly()) {
|
| setFloating(false);
|
| clearPositionedState();
|
| }
|
| - } else
|
| + } else {
|
| s_affectsParentBlock = false;
|
| + }
|
|
|
| if (view()->frameView()) {
|
| bool shouldBlitOnFixedBackgroundImage = false;
|
| @@ -2143,7 +2145,7 @@ void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle* oldSt
|
| if (!m_parent)
|
| return;
|
|
|
| - if (diff == StyleDifferenceLayout) {
|
| + if (diff.needsFullLayout()) {
|
| RenderCounter::rendererStyleChanged(*this, oldStyle, m_style.get());
|
|
|
| // If the object already needs layout, then setNeedsLayout won't do
|
| @@ -2158,10 +2160,10 @@ void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle* oldSt
|
| if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_style->position())
|
| markContainingBlocksForOverflowRecalc();
|
|
|
| - if (diff == StyleDifferenceLayout)
|
| - setNeedsLayoutAndPrefWidthsRecalc();
|
| - } else if (diff == StyleDifferenceLayoutPositionedMovementOnly)
|
| + setNeedsLayoutAndPrefWidthsRecalc();
|
| + } else if (diff.needsPositionedMovementLayoutOnly()) {
|
| setNeedsPositionedMovementLayout();
|
| + }
|
|
|
| // Don't check for repaint here; we need to wait until the layer has been
|
| // updated by subclasses before we know if we have to repaint (in setStyle()).
|
|
|