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

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

Issue 463883003: Rename repaint to paintInvalidation in core/rendering/svg. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 if (m_needsBoundariesOrTransformUpdate) { 186 if (m_needsBoundariesOrTransformUpdate) {
187 updateCachedBoundaries(); 187 updateCachedBoundaries();
188 m_needsBoundariesOrTransformUpdate = false; 188 m_needsBoundariesOrTransformUpdate = false;
189 } 189 }
190 190
191 m_overflow.clear(); 191 m_overflow.clear();
192 addVisualEffectOverflow(); 192 addVisualEffectOverflow();
193 193
194 if (!shouldApplyViewportClip()) { 194 if (!shouldApplyViewportClip()) {
195 FloatRect contentRepaintRect = paintInvalidationRectInLocalCoordinates() ; 195 FloatRect contentPaintInvalidationRect = paintInvalidationRectInLocalCoo rdinates();
196 contentRepaintRect = m_localToBorderBoxTransform.mapRect(contentRepaintR ect); 196 contentPaintInvalidationRect = m_localToBorderBoxTransform.mapRect(conte ntPaintInvalidationRect);
197 addVisualOverflow(enclosingLayoutRect(contentRepaintRect)); 197 addVisualOverflow(enclosingLayoutRect(contentPaintInvalidationRect));
198 } 198 }
199 199
200 updateLayerTransformAfterLayout(); 200 updateLayerTransformAfterLayout();
201 m_hasBoxDecorationBackground = isDocumentElement() ? calculateHasBoxDecorati ons() : hasBoxDecorationBackground(); 201 m_hasBoxDecorationBackground = isDocumentElement() ? calculateHasBoxDecorati ons() : hasBoxDecorationBackground();
202 invalidateBackgroundObscurationStatus(); 202 invalidateBackgroundObscurationStatus();
203 203
204 clearNeedsLayout(); 204 clearNeedsLayout();
205 } 205 }
206 206
207 bool RenderSVGRoot::shouldApplyViewportClip() const 207 bool RenderSVGRoot::shouldApplyViewportClip() const
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt( x())); 343 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt( x()));
344 if (y()) 344 if (y())
345 m_localToParentTransform.setF(m_localToParentTransform.f() + roundToInt( y())); 345 m_localToParentTransform.setF(m_localToParentTransform.f() + roundToInt( y()));
346 return m_localToParentTransform; 346 return m_localToParentTransform;
347 } 347 }
348 348
349 LayoutRect RenderSVGRoot::clippedOverflowRectForPaintInvalidation(const RenderLa yerModelObject* paintInvalidationContainer, const PaintInvalidationState* paintI nvalidationState) const 349 LayoutRect RenderSVGRoot::clippedOverflowRectForPaintInvalidation(const RenderLa yerModelObject* paintInvalidationContainer, const PaintInvalidationState* paintI nvalidationState) const
350 { 350 {
351 // This is an open-coded aggregate of SVGRenderSupport::clippedOverflowRectF orPaintInvalidation, 351 // This is an open-coded aggregate of SVGRenderSupport::clippedOverflowRectF orPaintInvalidation,
352 // RenderSVGRoot::computeFloatRectForPaintInvalidation and RenderReplaced::c lippedOverflowRectForPaintInvalidation. 352 // RenderSVGRoot::computeFloatRectForPaintInvalidation and RenderReplaced::c lippedOverflowRectForPaintInvalidation.
353 // The reason for this is to optimize/minimize the repaint rect when the box is not "decorated" 353 // The reason for this is to optimize/minimize the paint invalidation rect w hen the box is not "decorated"
354 // (does not have background/border/etc.) 354 // (does not have background/border/etc.)
355 355
356 // Return early for any cases where we don't actually paint. 356 // Return early for any cases where we don't actually paint.
357 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent ()) 357 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent ())
358 return LayoutRect(); 358 return LayoutRect();
359 359
360 // Compute the repaint rect of the content of the SVG in the border-box coor dinate space. 360 // Compute the paint invalidation rect of the content of the SVG in the bord er-box coordinate space.
361 FloatRect contentRepaintRect = paintInvalidationRectInLocalCoordinates(); 361 FloatRect contentPaintInvalidationRect = paintInvalidationRectInLocalCoordin ates();
362 contentRepaintRect = m_localToBorderBoxTransform.mapRect(contentRepaintRect) ; 362 contentPaintInvalidationRect = m_localToBorderBoxTransform.mapRect(contentPa intInvalidationRect);
363 363
364 // Apply initial viewport clip, overflow:visible content is added to visualO verflow 364 // Apply initial viewport clip, overflow:visible content is added to visualO verflow
365 // but the most common case is that overflow is hidden, so always intersect. 365 // but the most common case is that overflow is hidden, so always intersect.
366 contentRepaintRect.intersect(pixelSnappedBorderBoxRect()); 366 contentPaintInvalidationRect.intersect(pixelSnappedBorderBoxRect());
367 367
368 LayoutRect repaintRect = enclosingLayoutRect(contentRepaintRect); 368 LayoutRect paintInvalidationRect = enclosingLayoutRect(contentPaintInvalidat ionRect);
369 // If the box is decorated or is overflowing, extend it to include the borde r-box and overflow. 369 // If the box is decorated or is overflowing, extend it to include the borde r-box and overflow.
370 if (m_hasBoxDecorationBackground || hasRenderOverflow()) { 370 if (m_hasBoxDecorationBackground || hasRenderOverflow()) {
371 // The selectionRect can project outside of the overflowRect, so take th eir union 371 // The selectionRect can project outside of the overflowRect, so take th eir union
372 // for repainting to avoid selection painting glitches. 372 // for paint invalidation to avoid selection painting glitches.
373 LayoutRect decoratedRepaintRect = unionRect(localSelectionRect(false), v isualOverflowRect()); 373 LayoutRect decoratedPaintInvalidationRect = unionRect(localSelectionRect (false), visualOverflowRect());
374 repaintRect.unite(decoratedRepaintRect); 374 paintInvalidationRect.unite(decoratedPaintInvalidationRect);
375 } 375 }
376 376
377 // Compute the repaint rect in the parent coordinate space. 377 // Compute the paint invalidation rect in the parent coordinate space.
378 LayoutRect rect = enclosingIntRect(repaintRect); 378 LayoutRect rect = enclosingIntRect(paintInvalidationRect);
379 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer , rect, paintInvalidationState); 379 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer , rect, paintInvalidationState);
380 return rect; 380 return rect;
381 } 381 }
382 382
383 void RenderSVGRoot::computeFloatRectForPaintInvalidation(const RenderLayerModelO bject* paintInvalidationContainer, FloatRect& paintInvalidationRect, bool fixed, const PaintInvalidationState* paintInvalidationState) const 383 void RenderSVGRoot::computeFloatRectForPaintInvalidation(const RenderLayerModelO bject* paintInvalidationContainer, FloatRect& paintInvalidationRect, bool fixed, const PaintInvalidationState* paintInvalidationState) const
384 { 384 {
385 // Apply our local transforms (except for x/y translation), then our shadow, 385 // Apply our local transforms (except for x/y translation), then our shadow,
386 // and then call RenderBox's method to handle all the normal CSS Box model b its 386 // and then call RenderBox's method to handle all the normal CSS Box model b its
387 paintInvalidationRect = m_localToBorderBoxTransform.mapRect(paintInvalidatio nRect); 387 paintInvalidationRect = m_localToBorderBoxTransform.mapRect(paintInvalidatio nRect);
388 388
389 // Apply initial viewport clip 389 // Apply initial viewport clip
390 if (shouldApplyViewportClip()) 390 if (shouldApplyViewportClip())
391 paintInvalidationRect.intersect(pixelSnappedBorderBoxRect()); 391 paintInvalidationRect.intersect(pixelSnappedBorderBoxRect());
392 392
393 LayoutRect rect = enclosingIntRect(paintInvalidationRect); 393 LayoutRect rect = enclosingIntRect(paintInvalidationRect);
394 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer , rect, fixed, paintInvalidationState); 394 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer , rect, fixed, paintInvalidationState);
395 paintInvalidationRect = rect; 395 paintInvalidationRect = rect;
396 } 396 }
397 397
398 // This method expects local CSS box coordinates. 398 // This method expects local CSS box coordinates.
399 // Callers with local SVG viewport coordinates should first apply the localToBor derBoxTransform 399 // Callers with local SVG viewport coordinates should first apply the localToBor derBoxTransform
400 // to convert from SVG viewport coordinates to local CSS box coordinates. 400 // to convert from SVG viewport coordinates to local CSS box coordinates.
401 void RenderSVGRoot::mapLocalToContainer(const RenderLayerModelObject* repaintCon tainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed , const PaintInvalidationState* paintInvalidationState) const 401 void RenderSVGRoot::mapLocalToContainer(const RenderLayerModelObject* paintInval idationContainer, TransformState& transformState, MapCoordinatesFlags mode, bool * wasFixed, const PaintInvalidationState* paintInvalidationState) const
402 { 402 {
403 ASSERT(mode & ~IsFixed); // We should have no fixed content in the SVG rende ring tree. 403 ASSERT(mode & ~IsFixed); // We should have no fixed content in the SVG rende ring tree.
404 // We used to have this ASSERT here, but we removed it when enabling layer s quashing. 404 // We used to have this ASSERT here, but we removed it when enabling layer s quashing.
405 // See http://crbug.com/364901 405 // See http://crbug.com/364901
406 // ASSERT(mode & UseTransforms); // mapping a point through SVG w/o respecti ng trasnforms is useless. 406 // ASSERT(mode & UseTransforms); // mapping a point through SVG w/o respecti ng trasnforms is useless.
407 407
408 RenderReplaced::mapLocalToContainer(repaintContainer, transformState, mode | ApplyContainerFlip, wasFixed, paintInvalidationState); 408 RenderReplaced::mapLocalToContainer(paintInvalidationContainer, transformSta te, mode | ApplyContainerFlip, wasFixed, paintInvalidationState);
409 } 409 }
410 410
411 const RenderObject* RenderSVGRoot::pushMappingToContainer(const RenderLayerModel Object* ancestorToStopAt, RenderGeometryMap& geometryMap) const 411 const RenderObject* RenderSVGRoot::pushMappingToContainer(const RenderLayerModel Object* ancestorToStopAt, RenderGeometryMap& geometryMap) const
412 { 412 {
413 return RenderReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap) ; 413 return RenderReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap) ;
414 } 414 }
415 415
416 void RenderSVGRoot::updateCachedBoundaries() 416 void RenderSVGRoot::updateCachedBoundaries()
417 { 417 {
418 SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m _objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBox); 418 SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m _objectBoundingBoxValid, m_strokeBoundingBox, m_paintInvalidationBoundingBox);
419 SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingB ox); 419 SVGRenderSupport::intersectPaintInvalidationRectWithResources(this, m_paintI nvalidationBoundingBox);
420 } 420 }
421 421
422 bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated Offset, HitTestAction hitTestAction) 422 bool RenderSVGRoot::nodeAtPoint(const HitTestRequest& request, HitTestResult& re sult, const HitTestLocation& locationInContainer, const LayoutPoint& accumulated Offset, HitTestAction hitTestAction)
423 { 423 {
424 LayoutPoint pointInParent = locationInContainer.point() - toLayoutSize(accum ulatedOffset); 424 LayoutPoint pointInParent = locationInContainer.point() - toLayoutSize(accum ulatedOffset);
425 LayoutPoint pointInBorderBox = pointInParent - toLayoutSize(location()); 425 LayoutPoint pointInBorderBox = pointInParent - toLayoutSize(location());
426 426
427 // Only test SVG content if the point is in our content box, or in case we 427 // Only test SVG content if the point is in our content box, or in case we
428 // don't clip to the viewport, the visual overflow rect. 428 // don't clip to the viewport, the visual overflow rect.
429 // FIXME: This should be an intersection when rect-based hit tests are suppo rted by nodeAtFloatPoint. 429 // FIXME: This should be an intersection when rect-based hit tests are suppo rted by nodeAtFloatPoint.
(...skipping 24 matching lines...) Expand all
454 updateHitTestResult(result, pointInBorderBox); 454 updateHitTestResult(result, pointInBorderBox);
455 if (!result.addNodeToRectBasedTestResult(node(), request, locationIn Container, boundsRect)) 455 if (!result.addNodeToRectBasedTestResult(node(), request, locationIn Container, boundsRect))
456 return true; 456 return true;
457 } 457 }
458 } 458 }
459 459
460 return false; 460 return false;
461 } 461 }
462 462
463 } 463 }
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