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

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

Powered by Google App Engine
This is Rietveld 408576698