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

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

Issue 265703012: Separate repaint and layout requirements of StyleDifference (Step 4) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 7 months 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 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 1903
1904 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff, unsign ed contextSensitiveProperties) const 1904 StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff, unsign ed contextSensitiveProperties) const
1905 { 1905 {
1906 // FIXME: The calls to hasDirectReasonsForCompositing are using state that m ay not be up to date. 1906 // FIXME: The calls to hasDirectReasonsForCompositing are using state that m ay not be up to date.
1907 DisableCompositingQueryAsserts disabler; 1907 DisableCompositingQueryAsserts disabler;
1908 1908
1909 if (contextSensitiveProperties & ContextSensitivePropertyTransform && isSVG( )) 1909 if (contextSensitiveProperties & ContextSensitivePropertyTransform && isSVG( ))
1910 diff.setNeedsFullLayout(); 1910 diff.setNeedsFullLayout();
1911 1911
1912 // If transform changed, and the layer does not paint into its own separate backing, then we need to repaint. 1912 // If transform changed, and the layer does not paint into its own separate backing, then we need to repaint.
1913 if (contextSensitiveProperties & ContextSensitivePropertyTransform && !diff .needsLayout()) { 1913 if (contextSensitiveProperties & ContextSensitivePropertyTransform) {
1914 // Text nodes share style with their parents but transforms don't apply to them, 1914 // Text nodes share style with their parents but transforms don't apply to them,
1915 // hence the !isText() check. 1915 // hence the !isText() check.
1916 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer( )->hasDirectReasonsForCompositing())) 1916 if (!isText() && (!hasLayer() || !toRenderLayerModelObject(this)->layer( )->hasDirectReasonsForCompositing()))
1917 diff.setNeedsRepaintLayer(); 1917 diff.setNeedsRepaintLayer();
1918 else 1918 else
1919 diff.setNeedsRecompositeLayer(); 1919 diff.setNeedsRecompositeLayer();
1920 } 1920 }
1921 1921
1922 // If opacity or zIndex changed, and the layer does not paint into its own s eparate backing, then we need to repaint (also 1922 // If opacity or zIndex changed, and the layer does not paint into its own s eparate backing, then we need to repaint (also
1923 // ignoring text nodes) 1923 // ignoring text nodes)
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2050 // in the future as we move renderer changes out of layout and into style ch anges. 2050 // in the future as we move renderer changes out of layout and into style ch anges.
2051 if (doesNotNeedLayout) 2051 if (doesNotNeedLayout)
2052 return; 2052 return;
2053 2053
2054 // Now that the layer (if any) has been updated, we need to adjust the diff again, 2054 // Now that the layer (if any) has been updated, we need to adjust the diff again,
2055 // check whether we should layout now, and decide if we need to repaint. 2055 // check whether we should layout now, and decide if we need to repaint.
2056 StyleDifference updatedDiff = adjustStyleDifference(diff, contextSensitivePr operties); 2056 StyleDifference updatedDiff = adjustStyleDifference(diff, contextSensitivePr operties);
2057 2057
2058 if (!diff.needsFullLayout()) { 2058 if (!diff.needsFullLayout()) {
2059 if (updatedDiff.needsFullLayout()) 2059 if (updatedDiff.needsFullLayout())
2060 setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); 2060 setNeedsLayoutAndPrefWidthsRecalc();
2061 else if (updatedDiff.needsPositionedMovementLayout()) 2061 else if (updatedDiff.needsPositionedMovementLayout())
2062 setNeedsPositionedMovementLayout(); 2062 setNeedsPositionedMovementLayout();
2063 } 2063 }
2064 2064
2065 if (contextSensitiveProperties & ContextSensitivePropertyTransform && !needs Layout()) { 2065 if (contextSensitiveProperties & ContextSensitivePropertyTransform && !needs Layout()) {
2066 if (RenderBlock* container = containingBlock()) 2066 if (RenderBlock* container = containingBlock())
2067 container->setNeedsOverflowRecalcAfterStyleChange(); 2067 container->setNeedsOverflowRecalcAfterStyleChange();
2068 if (isBox()) 2068 if (isBox())
2069 toRenderBox(this)->updateLayerTransform(); 2069 toRenderBox(this)->updateLayerTransform();
2070 } 2070 }
2071 2071
2072 // FIXME: The !needsFullLayout() check is temporary to keep the original Sty leDifference 2072 if (updatedDiff.needsRepaint()) {
2073 // behavior that we did't repaint here on StyleDifferenceLayout. 2073 // Repaint with the new style, e.g., for example if we go from not havin g
2074 // In the next steps we will not always repaint on selfNeedsLayout(), and sh ould force 2074 // an outline to having an outline.
2075 // repaint here if needsRepaint is set. 2075 if (needsLayout())
2076 if (updatedDiff.needsRepaint() && !updatedDiff.needsFullLayout()) { 2076 setShouldDoFullRepaintAfterLayout(true);
2077 // Do a repaint with the new style now, e.g., for example if we go from 2077 else
2078 // not having an outline to having an outline. 2078 repaint();
2079 repaint();
2080 } 2079 }
2081 } 2080 }
2082 2081
2083 static inline bool rendererHasBackground(const RenderObject* renderer) 2082 static inline bool rendererHasBackground(const RenderObject* renderer)
2084 { 2083 {
2085 return renderer && renderer->hasBackground(); 2084 return renderer && renderer->hasBackground();
2086 } 2085 }
2087 2086
2088 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle) 2087 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle& newS tyle)
2089 { 2088 {
(...skipping 16 matching lines...) Expand all
2106 if (newStyle.visibility() == VISIBLE) { 2105 if (newStyle.visibility() == VISIBLE) {
2107 layer->setHasVisibleContent(); 2106 layer->setHasVisibleContent();
2108 } else if (layer->hasVisibleContent() && (this == layer->rendere r() || layer->renderer()->style()->visibility() != VISIBLE)) { 2107 } else if (layer->hasVisibleContent() && (this == layer->rendere r() || layer->renderer()->style()->visibility() != VISIBLE)) {
2109 layer->dirtyVisibleContentStatus(); 2108 layer->dirtyVisibleContentStatus();
2110 if (diff.needsLayout()) 2109 if (diff.needsLayout())
2111 repaint(); 2110 repaint();
2112 } 2111 }
2113 } 2112 }
2114 } 2113 }
2115 2114
2116 // FIXME: The !needsFullLayout() check is temporary to keep the original StyleDifference 2115 if (m_parent && diff.needsRepaintObject()) {
2117 // behavior that we did't repaint here on StyleDifferenceLayout. 2116 if (diff.needsLayout() || needsLayout())
2118 // In the next steps we will not always repaint on selfNeedsLayout(), an d should force 2117 setShouldDoFullRepaintAfterLayout(true);
2119 // repaint here if needsRepaintObject is set. 2118 else
2120 if (m_parent && diff.needsRepaintObject() && !diff.needsFullLayout()) 2119 repaint();
2121 repaint(); 2120 }
2122 2121
2123 if (isFloating() && (m_style->floating() != newStyle.floating())) 2122 if (isFloating() && (m_style->floating() != newStyle.floating()))
2124 // For changes in float styles, we need to conceivably remove oursel ves 2123 // For changes in float styles, we need to conceivably remove oursel ves
2125 // from the floating objects list. 2124 // from the floating objects list.
2126 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); 2125 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists();
2127 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle.pos ition())) 2126 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle.pos ition()))
2128 // For changes in positioning styles, we need to conceivably remove ourselves 2127 // For changes in positioning styles, we need to conceivably remove ourselves
2129 // from the positioned objects list. 2128 // from the positioned objects list.
2130 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); 2129 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists();
2131 2130
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
2218 // directly affect the containing block of this object is a change to 2217 // directly affect the containing block of this object is a change to
2219 // the position style. 2218 // the position style.
2220 if (needsLayout() && oldStyle->position() != m_style->position()) 2219 if (needsLayout() && oldStyle->position() != m_style->position())
2221 markContainingBlocksForLayout(); 2220 markContainingBlocksForLayout();
2222 2221
2223 // Ditto. 2222 // Ditto.
2224 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s tyle->position()) 2223 if (needsOverflowRecalcAfterStyleChange() && oldStyle->position() != m_s tyle->position())
2225 markContainingBlocksForOverflowRecalc(); 2224 markContainingBlocksForOverflowRecalc();
2226 2225
2227 if (diff.needsFullLayout()) 2226 if (diff.needsFullLayout())
2228 setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); 2227 setNeedsLayoutAndPrefWidthsRecalc();
2229 } else if (diff.needsPositionedMovementLayout()) 2228 } else if (diff.needsPositionedMovementLayout())
2230 setNeedsPositionedMovementLayout(); 2229 setNeedsPositionedMovementLayout();
2231 2230
2232 // Don't check for repaint here; we need to wait until the layer has been 2231 // Don't check for repaint here; we need to wait until the layer has been
2233 // updated by subclasses before we know if we have to repaint (in setStyle() ). 2232 // updated by subclasses before we know if we have to repaint (in setStyle() ).
2234 2233
2235 if (oldStyle && !areCursorsEqual(oldStyle, style())) { 2234 if (oldStyle && !areCursorsEqual(oldStyle, style())) {
2236 if (LocalFrame* frame = this->frame()) 2235 if (LocalFrame* frame = this->frame())
2237 frame->eventHandler().scheduleCursorUpdate(); 2236 frame->eventHandler().scheduleCursorUpdate();
2238 } 2237 }
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
3461 { 3460 {
3462 if (object1) { 3461 if (object1) {
3463 const WebCore::RenderObject* root = object1; 3462 const WebCore::RenderObject* root = object1;
3464 while (root->parent()) 3463 while (root->parent())
3465 root = root->parent(); 3464 root = root->parent();
3466 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3465 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3467 } 3466 }
3468 } 3467 }
3469 3468
3470 #endif 3469 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698