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

Side by Side Diff: Source/core/rendering/svg/RenderSVGRoot.cpp

Issue 332543002: Rename Repaint to Paint Invalidation Part 4 (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
« no previous file with comments | « Source/core/rendering/svg/RenderSVGRoot.h ('k') | Source/core/rendering/svg/RenderSVGShape.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) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. 5 * Copyright (C) 2009 Google, Inc.
6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } 163 }
164 164
165 void RenderSVGRoot::layout() 165 void RenderSVGRoot::layout()
166 { 166 {
167 ASSERT(needsLayout()); 167 ASSERT(needsLayout());
168 168
169 // Arbitrary affine transforms are incompatible with LayoutState. 169 // Arbitrary affine transforms are incompatible with LayoutState.
170 LayoutStateDisabler layoutStateDisabler(*this); 170 LayoutStateDisabler layoutStateDisabler(*this);
171 171
172 bool needsLayout = selfNeedsLayout(); 172 bool needsLayout = selfNeedsLayout();
173 LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && needsLayou t); 173 LayoutRepainter repainter(*this, checkForPaintInvalidationDuringLayout() && needsLayout);
174 174
175 LayoutSize oldSize = size(); 175 LayoutSize oldSize = size();
176 updateLogicalWidth(); 176 updateLogicalWidth();
177 updateLogicalHeight(); 177 updateLogicalHeight();
178 buildLocalToBorderBoxTransform(); 178 buildLocalToBorderBoxTransform();
179 179
180 SVGRenderSupport::layoutResourcesIfNeeded(this); 180 SVGRenderSupport::layoutResourcesIfNeeded(this);
181 181
182 SVGSVGElement* svg = toSVGSVGElement(node()); 182 SVGSVGElement* svg = toSVGSVGElement(node());
183 ASSERT(svg); 183 ASSERT(svg);
184 m_isLayoutSizeChanged = needsLayout || (svg->hasRelativeLengths() && oldSize != size()); 184 m_isLayoutSizeChanged = needsLayout || (svg->hasRelativeLengths() && oldSize != size());
185 SVGRenderSupport::layoutChildren(this, needsLayout || SVGRenderSupport::filt ersForceContainerLayout(this)); 185 SVGRenderSupport::layoutChildren(this, needsLayout || SVGRenderSupport::filt ersForceContainerLayout(this));
186 186
187 // At this point LayoutRepainter already grabbed the old bounds, 187 // At this point LayoutRepainter already grabbed the old bounds,
188 // recalculate them now so repaintAfterLayout() uses the new bounds. 188 // recalculate them now so repaintAfterLayout() uses the new bounds.
189 if (m_needsBoundariesOrTransformUpdate) { 189 if (m_needsBoundariesOrTransformUpdate) {
190 updateCachedBoundaries(); 190 updateCachedBoundaries();
191 m_needsBoundariesOrTransformUpdate = false; 191 m_needsBoundariesOrTransformUpdate = false;
192 } 192 }
193 193
194 m_overflow.clear(); 194 m_overflow.clear();
195 addVisualEffectOverflow(); 195 addVisualEffectOverflow();
196 196
197 if (!shouldApplyViewportClip()) { 197 if (!shouldApplyViewportClip()) {
198 FloatRect contentRepaintRect = repaintRectInLocalCoordinates(); 198 FloatRect contentRepaintRect = paintInvalidationRectInLocalCoordinates() ;
199 contentRepaintRect = m_localToBorderBoxTransform.mapRect(contentRepaintR ect); 199 contentRepaintRect = m_localToBorderBoxTransform.mapRect(contentRepaintR ect);
200 addVisualOverflow(enclosingLayoutRect(contentRepaintRect)); 200 addVisualOverflow(enclosingLayoutRect(contentRepaintRect));
201 } 201 }
202 202
203 updateLayerTransform(); 203 updateLayerTransform();
204 m_hasBoxDecorations = isDocumentElement() ? calculateHasBoxDecorations() : h asBoxDecorations(); 204 m_hasBoxDecorations = isDocumentElement() ? calculateHasBoxDecorations() : h asBoxDecorations();
205 invalidateBackgroundObscurationStatus(); 205 invalidateBackgroundObscurationStatus();
206 206
207 repainter.repaintAfterLayout(); 207 repainter.repaintAfterLayout();
208 clearNeedsLayout(); 208 clearNeedsLayout();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 { 347 {
348 // Slightly optimized version of m_localToParentTransform = AffineTransform: :translation(x(), y()) * m_localToBorderBoxTransform; 348 // Slightly optimized version of m_localToParentTransform = AffineTransform: :translation(x(), y()) * m_localToBorderBoxTransform;
349 m_localToParentTransform = m_localToBorderBoxTransform; 349 m_localToParentTransform = m_localToBorderBoxTransform;
350 if (x()) 350 if (x())
351 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt( x())); 351 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt( x()));
352 if (y()) 352 if (y())
353 m_localToParentTransform.setF(m_localToParentTransform.f() + roundToInt( y())); 353 m_localToParentTransform.setF(m_localToParentTransform.f() + roundToInt( y()));
354 return m_localToParentTransform; 354 return m_localToParentTransform;
355 } 355 }
356 356
357 LayoutRect RenderSVGRoot::clippedOverflowRectForRepaint(const RenderLayerModelOb ject* repaintContainer) const 357 LayoutRect RenderSVGRoot::clippedOverflowRectForPaintInvalidation(const RenderLa yerModelObject* paintInvalidationContainer) const
358 { 358 {
359 // This is an open-coded aggregate of SVGRenderSupport::clippedOverflowRectF orRepaint, 359 // This is an open-coded aggregate of SVGRenderSupport::clippedOverflowRectF orPaintInvalidation,
360 // RenderSVGRoot::computeFloatRectForRepaint and RenderReplaced::clippedOver flowRectForRepaint. 360 // RenderSVGRoot::computeFloatRectForPaintInvalidation and RenderReplaced::c lippedOverflowRectForPaintInvalidation.
361 // The reason for this is to optimize/minimize the repaint rect when the box is not "decorated" 361 // The reason for this is to optimize/minimize the repaint rect when the box is not "decorated"
362 // (does not have background/border/etc.) 362 // (does not have background/border/etc.)
363 363
364 // Return early for any cases where we don't actually paint. 364 // Return early for any cases where we don't actually paint.
365 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent ()) 365 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent ())
366 return LayoutRect(); 366 return LayoutRect();
367 367
368 // Compute the repaint rect of the content of the SVG in the border-box coor dinate space. 368 // Compute the repaint rect of the content of the SVG in the border-box coor dinate space.
369 FloatRect contentRepaintRect = repaintRectInLocalCoordinates(); 369 FloatRect contentRepaintRect = paintInvalidationRectInLocalCoordinates();
370 contentRepaintRect = m_localToBorderBoxTransform.mapRect(contentRepaintRect) ; 370 contentRepaintRect = m_localToBorderBoxTransform.mapRect(contentRepaintRect) ;
371 371
372 // Apply initial viewport clip, overflow:visible content is added to visualO verflow 372 // Apply initial viewport clip, overflow:visible content is added to visualO verflow
373 // but the most common case is that overflow is hidden, so always intersect. 373 // but the most common case is that overflow is hidden, so always intersect.
374 contentRepaintRect.intersect(pixelSnappedBorderBoxRect()); 374 contentRepaintRect.intersect(pixelSnappedBorderBoxRect());
375 375
376 LayoutRect repaintRect = enclosingLayoutRect(contentRepaintRect); 376 LayoutRect repaintRect = enclosingLayoutRect(contentRepaintRect);
377 // If the box is decorated or is overflowing, extend it to include the borde r-box and overflow. 377 // If the box is decorated or is overflowing, extend it to include the borde r-box and overflow.
378 if (m_hasBoxDecorations || hasRenderOverflow()) { 378 if (m_hasBoxDecorations || hasRenderOverflow()) {
379 // The selectionRect can project outside of the overflowRect, so take th eir union 379 // The selectionRect can project outside of the overflowRect, so take th eir union
380 // for repainting to avoid selection painting glitches. 380 // for repainting to avoid selection painting glitches.
381 LayoutRect decoratedRepaintRect = unionRect(localSelectionRect(false), v isualOverflowRect()); 381 LayoutRect decoratedRepaintRect = unionRect(localSelectionRect(false), v isualOverflowRect());
382 repaintRect.unite(decoratedRepaintRect); 382 repaintRect.unite(decoratedRepaintRect);
383 } 383 }
384 384
385 // Compute the repaint rect in the parent coordinate space. 385 // Compute the repaint rect in the parent coordinate space.
386 LayoutRect rect = enclosingIntRect(repaintRect); 386 LayoutRect rect = enclosingIntRect(repaintRect);
387 RenderReplaced::mapRectToRepaintBacking(repaintContainer, rect); 387 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer , rect);
388 return rect; 388 return rect;
389 } 389 }
390 390
391 void RenderSVGRoot::computeFloatRectForRepaint(const RenderLayerModelObject* rep aintContainer, FloatRect& repaintRect, bool fixed) const 391 void RenderSVGRoot::computeFloatRectForPaintInvalidation(const RenderLayerModelO bject* paintInvalidationContainer, FloatRect& paintInvalidationRect, bool fixed) const
392 { 392 {
393 // Apply our local transforms (except for x/y translation), then our shadow, 393 // Apply our local transforms (except for x/y translation), then our shadow,
394 // and then call RenderBox's method to handle all the normal CSS Box model b its 394 // and then call RenderBox's method to handle all the normal CSS Box model b its
395 repaintRect = m_localToBorderBoxTransform.mapRect(repaintRect); 395 paintInvalidationRect = m_localToBorderBoxTransform.mapRect(paintInvalidatio nRect);
396 396
397 // Apply initial viewport clip 397 // Apply initial viewport clip
398 if (shouldApplyViewportClip()) 398 if (shouldApplyViewportClip())
399 repaintRect.intersect(pixelSnappedBorderBoxRect()); 399 paintInvalidationRect.intersect(pixelSnappedBorderBoxRect());
400 400
401 LayoutRect rect = enclosingIntRect(repaintRect); 401 LayoutRect rect = enclosingIntRect(paintInvalidationRect);
402 RenderReplaced::mapRectToRepaintBacking(repaintContainer, rect, fixed); 402 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer , rect, fixed);
403 repaintRect = rect; 403 paintInvalidationRect = rect;
404 } 404 }
405 405
406 // This method expects local CSS box coordinates. 406 // This method expects local CSS box coordinates.
407 // Callers with local SVG viewport coordinates should first apply the localToBor derBoxTransform 407 // Callers with local SVG viewport coordinates should first apply the localToBor derBoxTransform
408 // to convert from SVG viewport coordinates to local CSS box coordinates. 408 // to convert from SVG viewport coordinates to local CSS box coordinates.
409 void RenderSVGRoot::mapLocalToContainer(const RenderLayerModelObject* repaintCon tainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed ) const 409 void RenderSVGRoot::mapLocalToContainer(const RenderLayerModelObject* repaintCon tainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed ) const
410 { 410 {
411 ASSERT(mode & ~IsFixed); // We should have no fixed content in the SVG rende ring tree. 411 ASSERT(mode & ~IsFixed); // We should have no fixed content in the SVG rende ring tree.
412 // We used to have this ASSERT here, but we removed it when enabling layer s quashing. 412 // We used to have this ASSERT here, but we removed it when enabling layer s quashing.
413 // See http://crbug.com/364901 413 // See http://crbug.com/364901
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 updateHitTestResult(result, pointInBorderBox); 458 updateHitTestResult(result, pointInBorderBox);
459 if (!result.addNodeToRectBasedTestResult(node(), request, locationIn Container, boundsRect)) 459 if (!result.addNodeToRectBasedTestResult(node(), request, locationIn Container, boundsRect))
460 return true; 460 return true;
461 } 461 }
462 } 462 }
463 463
464 return false; 464 return false;
465 } 465 }
466 466
467 } 467 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGRoot.h ('k') | Source/core/rendering/svg/RenderSVGShape.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698