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

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

Issue 318803002: Rename Repaint to Paint Invalidation part 3 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 142
143 void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle& newStyl e) 143 void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle& newStyl e)
144 { 144 {
145 RenderStyle* oldStyle = style(); 145 RenderStyle* oldStyle = style();
146 if (oldStyle) { 146 if (oldStyle) {
147 // The background of the root element or the body element could propagat e up to 147 // The background of the root element or the body element could propagat e up to
148 // the canvas. Just dirty the entire canvas when our style changes subs tantially. 148 // the canvas. Just dirty the entire canvas when our style changes subs tantially.
149 if ((diff.needsRepaint() || diff.needsLayout()) && node() 149 if ((diff.needsRepaint() || diff.needsLayout()) && node()
150 && (isHTMLHtmlElement(*node()) || isHTMLBodyElement(*node()))) { 150 && (isHTMLHtmlElement(*node()) || isHTMLBodyElement(*node()))) {
151 view()->repaint(); 151 view()->paintInvalidationForWholeRenderer();
152 152
153 if (oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFi xedBackground()) 153 if (oldStyle->hasEntirelyFixedBackground() != newStyle.hasEntirelyFi xedBackground())
154 view()->compositor()->setNeedsUpdateFixedBackground(); 154 view()->compositor()->setNeedsUpdateFixedBackground();
155 } 155 }
156 156
157 // When a layout hint happens and an object's position style changes, we have to do a layout 157 // When a layout hint happens and an object's position style changes, we have to do a layout
158 // to dirty the render tree using the old position value now. 158 // to dirty the render tree using the old position value now.
159 if (diff.needsFullLayout() && parent() && oldStyle->position() != newSty le.position()) { 159 if (diff.needsFullLayout() && parent() && oldStyle->position() != newSty le.position()) {
160 markContainingBlocksForLayout(); 160 markContainingBlocksForLayout();
161 if (oldStyle->position() == StaticPosition) 161 if (oldStyle->position() == StaticPosition)
162 repaint(); 162 paintInvalidationForWholeRenderer();
163 else if (newStyle.hasOutOfFlowPosition()) 163 else if (newStyle.hasOutOfFlowPosition())
164 parent()->setChildNeedsLayout(); 164 parent()->setChildNeedsLayout();
165 if (isFloating() && !isOutOfFlowPositioned() && newStyle.hasOutOfFlo wPosition()) 165 if (isFloating() && !isOutOfFlowPositioned() && newStyle.hasOutOfFlo wPosition())
166 removeFloatingOrPositionedChildFromBlockLists(); 166 removeFloatingOrPositionedChildFromBlockLists();
167 } 167 }
168 // FIXME: This branch runs when !oldStyle, which means that layout was never called 168 // FIXME: This branch runs when !oldStyle, which means that layout was never called
169 // so what's the point in invalidating the whole view that we never painted? 169 // so what's the point in invalidating the whole view that we never painted?
170 } else if (isBody()) 170 } else if (isBody()) {
171 view()->repaint(); 171 view()->paintInvalidationForWholeRenderer();
172 }
172 173
173 RenderBoxModelObject::styleWillChange(diff, newStyle); 174 RenderBoxModelObject::styleWillChange(diff, newStyle);
174 } 175 }
175 176
176 void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle ) 177 void RenderBox::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle )
177 { 178 {
178 // Horizontal writing mode definition is updated in RenderBoxModelObject::up dateFromStyle, 179 // Horizontal writing mode definition is updated in RenderBoxModelObject::up dateFromStyle,
179 // (as part of the RenderBoxModelObject::styleDidChange call below). So, we can safely cache the horizontal 180 // (as part of the RenderBoxModelObject::styleDidChange call below). So, we can safely cache the horizontal
180 // writing mode value before style change here. 181 // writing mode value before style change here.
181 bool oldHorizontalWritingMode = isHorizontalWritingMode(); 182 bool oldHorizontalWritingMode = isHorizontalWritingMode();
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 286
286 bool boxHasOverflowClip = false; 287 bool boxHasOverflowClip = false;
287 if (!styleToUse->isOverflowVisible() && isRenderBlock() && !isViewObject) { 288 if (!styleToUse->isOverflowVisible() && isRenderBlock() && !isViewObject) {
288 // If overflow has been propagated to the viewport, it has no effect her e. 289 // If overflow has been propagated to the viewport, it has no effect her e.
289 if (node() != document().viewportDefiningElement()) { 290 if (node() != document().viewportDefiningElement()) {
290 boxHasOverflowClip = true; 291 boxHasOverflowClip = true;
291 if (!hasOverflowClip()) { 292 if (!hasOverflowClip()) {
292 // If we are getting an overflow clip, preemptively erase any ov erflowing content. 293 // If we are getting an overflow clip, preemptively erase any ov erflowing content.
293 // FIXME: This should probably consult RenderOverflow. 294 // FIXME: This should probably consult RenderOverflow.
294 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) 295 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled())
295 repaint(); 296 paintInvalidationForWholeRenderer();
296 } 297 }
297 } 298 }
298 } 299 }
299 300
300 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && (boxHasOverflowCl ip != hasOverflowClip())) { 301 if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && (boxHasOverflowCl ip != hasOverflowClip())) {
301 // FIXME: This shouldn't be required if we tracked the visual overflow 302 // FIXME: This shouldn't be required if we tracked the visual overflow
302 // generated by positioned children or self painting layers. crbug.com/3 45403 303 // generated by positioned children or self painting layers. crbug.com/3 45403
303 for (RenderObject* child = slowFirstChild(); child; child = child->nextS ibling()) 304 for (RenderObject* child = slowFirstChild(); child; child = child->nextS ibling())
304 child->setShouldDoFullPaintInvalidationIfSelfPaintingLayer(true); 305 child->setShouldDoFullPaintInvalidationIfSelfPaintingLayer(true);
305 } 306 }
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 1495
1495 void RenderBox::imageChanged(WrappedImagePtr image, const IntRect*) 1496 void RenderBox::imageChanged(WrappedImagePtr image, const IntRect*)
1496 { 1497 {
1497 if (!parent()) 1498 if (!parent())
1498 return; 1499 return;
1499 1500
1500 AllowPaintInvalidationScope scoper(frameView()); 1501 AllowPaintInvalidationScope scoper(frameView());
1501 1502
1502 if ((style()->borderImage().image() && style()->borderImage().image()->data( ) == image) || 1503 if ((style()->borderImage().image() && style()->borderImage().image()->data( ) == image) ||
1503 (style()->maskBoxImage().image() && style()->maskBoxImage().image()->dat a() == image)) { 1504 (style()->maskBoxImage().image() && style()->maskBoxImage().image()->dat a() == image)) {
1504 repaint(); 1505 paintInvalidationForWholeRenderer();
1505 return; 1506 return;
1506 } 1507 }
1507 1508
1508 ShapeValue* shapeOutsideValue = style()->shapeOutside(); 1509 ShapeValue* shapeOutsideValue = style()->shapeOutside();
1509 if (!frameView()->isInPerformLayout() && isFloating() && shapeOutsideValue & & shapeOutsideValue->image() && shapeOutsideValue->image()->data() == image) { 1510 if (!frameView()->isInPerformLayout() && isFloating() && shapeOutsideValue & & shapeOutsideValue->image() && shapeOutsideValue->image()->data() == image) {
1510 ShapeOutsideInfo::ensureInfo(*this).markShapeAsDirty(); 1511 ShapeOutsideInfo::ensureInfo(*this).markShapeAsDirty();
1511 markShapeOutsideDependentsForLayout(); 1512 markShapeOutsideDependentsForLayout();
1512 } 1513 }
1513 1514
1514 bool didFullRepaint = repaintLayerRectsForImage(image, style()->backgroundLa yers(), true); 1515 bool didFullRepaint = repaintLayerRectsForImage(image, style()->backgroundLa yers(), true);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 layerRenderer = this; 1551 layerRenderer = this;
1551 rendererRect = borderBoxRect(); 1552 rendererRect = borderBoxRect();
1552 } 1553 }
1553 } 1554 }
1554 1555
1555 BackgroundImageGeometry geometry; 1556 BackgroundImageGeometry geometry;
1556 layerRenderer->calculateBackgroundImageGeometry(0, curLayer, rendere rRect, geometry); 1557 layerRenderer->calculateBackgroundImageGeometry(0, curLayer, rendere rRect, geometry);
1557 if (geometry.hasNonLocalGeometry()) { 1558 if (geometry.hasNonLocalGeometry()) {
1558 // Rather than incur the costs of computing the paintContainer f or renderers with fixed backgrounds 1559 // Rather than incur the costs of computing the paintContainer f or renderers with fixed backgrounds
1559 // in order to get the right destRect, just repaint the entire r enderer. 1560 // in order to get the right destRect, just repaint the entire r enderer.
1560 layerRenderer->repaint(); 1561 layerRenderer->paintInvalidationForWholeRenderer();
1561 return true; 1562 return true;
1562 } 1563 }
1563 1564
1564 layerRenderer->repaintRectangle(geometry.destRect()); 1565 layerRenderer->invalidatePaintRectangle(geometry.destRect());
1565 if (geometry.destRect() == rendererRect) 1566 if (geometry.destRect() == rendererRect)
1566 return true; 1567 return true;
1567 } 1568 }
1568 } 1569 }
1569 return false; 1570 return false;
1570 } 1571 }
1571 1572
1572 void RenderBox::invalidateTreeAfterLayout(const RenderLayerModelObject& paintInv alidationContainer) 1573 void RenderBox::invalidateTreeAfterLayout(const RenderLayerModelObject& paintInv alidationContainer)
1573 { 1574 {
1574 // FIXME: Currently only using this logic for RenderBox and its ilk. Ideally , RenderBlockFlows with 1575 // FIXME: Currently only using this logic for RenderBox and its ilk. Ideally , RenderBlockFlows with
(...skipping 30 matching lines...) Expand all
1605 1606
1606 if ((onlyNeededPositionedMovementLayout() && compositingState() != PaintsInt oOwnBacking) 1607 if ((onlyNeededPositionedMovementLayout() && compositingState() != PaintsInt oOwnBacking)
1607 || (shouldDoFullPaintInvalidationIfSelfPaintingLayer() 1608 || (shouldDoFullPaintInvalidationIfSelfPaintingLayer()
1608 && hasLayer() 1609 && hasLayer()
1609 && layer()->isSelfPaintingLayer())) { 1610 && layer()->isSelfPaintingLayer())) {
1610 setShouldDoFullPaintInvalidationAfterLayout(true); 1611 setShouldDoFullPaintInvalidationAfterLayout(true);
1611 } 1612 }
1612 1613
1613 const LayoutRect& newPaintInvalidationRect = previousPaintInvalidationRect() ; 1614 const LayoutRect& newPaintInvalidationRect = previousPaintInvalidationRect() ;
1614 const LayoutPoint& newPositionFromPaintInvalidationContainer = previousPosit ionFromPaintInvalidationContainer(); 1615 const LayoutPoint& newPositionFromPaintInvalidationContainer = previousPosit ionFromPaintInvalidationContainer();
1615 bool didFullPaintInvalidation = repaintAfterLayoutIfNeeded(&newPaintInvalida tionContainer, 1616 bool didFullPaintInvalidation = invalidatePaintAfterLayoutIfNeeded(&newPaint InvalidationContainer,
1616 shouldDoFullPaintInvalidationAfterLayout(), oldPaintInvalidationRect, ol dPositionFromPaintInvalidationContainer, 1617 shouldDoFullPaintInvalidationAfterLayout(), oldPaintInvalidationRect, ol dPositionFromPaintInvalidationContainer,
1617 &newPaintInvalidationRect, &newPositionFromPaintInvalidationContainer); 1618 &newPaintInvalidationRect, &newPositionFromPaintInvalidationContainer);
1618 1619
1619 if (!didFullPaintInvalidation) 1620 if (!didFullPaintInvalidation)
1620 repaintOverflowIfNeeded(); 1621 invalidatePaintForOverflowIfNeeded();
1621 1622
1622 // Issue paint invalidations for any scrollbars if there is a scrollable are a for this renderer. 1623 // Issue paint invalidations for any scrollbars if there is a scrollable are a for this renderer.
1623 if (enclosingLayer()) { 1624 if (enclosingLayer()) {
1624 if (RenderLayerScrollableArea* area = enclosingLayer()->scrollableArea() ) { 1625 if (RenderLayerScrollableArea* area = enclosingLayer()->scrollableArea() ) {
1625 if (area->hasVerticalBarDamage()) 1626 if (area->hasVerticalBarDamage())
1626 repaintRectangle(area->verticalBarDamage()); 1627 invalidatePaintRectangle(area->verticalBarDamage());
1627 if (area->hasHorizontalBarDamage()) 1628 if (area->hasHorizontalBarDamage())
1628 repaintRectangle(area->horizontalBarDamage()); 1629 invalidatePaintRectangle(area->horizontalBarDamage());
1629 area->resetScrollbarDamage(); 1630 area->resetScrollbarDamage();
1630 } 1631 }
1631 } 1632 }
1632 1633
1633 // FIXME: LayoutState should be enabled for other paint invalidation contain ers than the RenderView. crbug.com/363834 1634 // FIXME: LayoutState should be enabled for other paint invalidation contain ers than the RenderView. crbug.com/363834
1634 if (establishesNewPaintInvalidationContainer && !isRenderView()) { 1635 if (establishesNewPaintInvalidationContainer && !isRenderView()) {
1635 LayoutStateDisabler disabler(*this); 1636 LayoutStateDisabler disabler(*this);
1636 RenderObject::invalidateTreeAfterLayout(newPaintInvalidationContainer); 1637 RenderObject::invalidateTreeAfterLayout(newPaintInvalidationContainer);
1637 } else { 1638 } else {
1638 // FIXME: This concept of a tree walking state for fast lookups should b e generalized away from 1639 // FIXME: This concept of a tree walking state for fast lookups should b e generalized away from
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 o->mapRectToRepaintBacking(repaintContainer, rect, fixed); 2118 o->mapRectToRepaintBacking(repaintContainer, rect, fixed);
2118 } 2119 }
2119 2120
2120 void RenderBox::repaintDuringLayoutIfMoved(const LayoutRect& oldRect) 2121 void RenderBox::repaintDuringLayoutIfMoved(const LayoutRect& oldRect)
2121 { 2122 {
2122 if (oldRect.location() != m_frameRect.location()) { 2123 if (oldRect.location() != m_frameRect.location()) {
2123 LayoutRect newRect = m_frameRect; 2124 LayoutRect newRect = m_frameRect;
2124 // The child moved. Invalidate the object's old and new positions. We have to do this 2125 // The child moved. Invalidate the object's old and new positions. We have to do this
2125 // since the object may not have gotten a layout. 2126 // since the object may not have gotten a layout.
2126 m_frameRect = oldRect; 2127 m_frameRect = oldRect;
2127 repaint(); 2128 paintInvalidationForWholeRenderer();
2128 repaintOverhangingFloats(true); 2129 repaintOverhangingFloats(true);
2129 m_frameRect = newRect; 2130 m_frameRect = newRect;
2130 repaint(); 2131 paintInvalidationForWholeRenderer();
2131 repaintOverhangingFloats(true); 2132 repaintOverhangingFloats(true);
2132 } 2133 }
2133 } 2134 }
2134 2135
2135 void RenderBox::repaintOverhangingFloats(bool) 2136 void RenderBox::repaintOverhangingFloats(bool)
2136 { 2137 {
2137 } 2138 }
2138 2139
2139 void RenderBox::updateLogicalWidth() 2140 void RenderBox::updateLogicalWidth()
2140 { 2141 {
(...skipping 2554 matching lines...) Expand 10 before | Expand all | Expand 10 after
4695 return 0; 4696 return 0;
4696 4697
4697 if (!layoutState && !flowThreadContainingBlock()) 4698 if (!layoutState && !flowThreadContainingBlock())
4698 return 0; 4699 return 0;
4699 4700
4700 RenderBlock* containerBlock = containingBlock(); 4701 RenderBlock* containerBlock = containingBlock();
4701 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4702 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4702 } 4703 }
4703 4704
4704 } // namespace WebCore 4705 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlockLineLayout.cpp ('k') | Source/core/rendering/RenderFileUploadControl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698