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

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

Issue 379073002: Revert of Divorce PaintInvalidationState from LayoutState (https://codereview.chromium.org/36083300… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Correct revert order Created 6 years, 5 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/RenderSVGText.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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 return resolveLengthAttributeForSVG(svg->intrinsicHeight(), style()->eff ectiveZoom(), containingBlock()->availableLogicalHeight(IncludeMarginBorderPaddi ng).toFloat()); 156 return resolveLengthAttributeForSVG(svg->intrinsicHeight(), style()->eff ectiveZoom(), containingBlock()->availableLogicalHeight(IncludeMarginBorderPaddi ng).toFloat());
157 157
158 // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SV G. 158 // SVG embedded via SVGImage (background-image/border-image/etc) / Inline SV G.
159 return RenderReplaced::computeReplacedLogicalHeight(); 159 return RenderReplaced::computeReplacedLogicalHeight();
160 } 160 }
161 161
162 void RenderSVGRoot::layout() 162 void RenderSVGRoot::layout()
163 { 163 {
164 ASSERT(needsLayout()); 164 ASSERT(needsLayout());
165 165
166 // Arbitrary affine transforms are incompatible with LayoutState.
167 ForceHorriblySlowRectMapping slowRectMapping(*this);
168
166 bool needsLayout = selfNeedsLayout(); 169 bool needsLayout = selfNeedsLayout();
167 170
168 LayoutSize oldSize = size(); 171 LayoutSize oldSize = size();
169 updateLogicalWidth(); 172 updateLogicalWidth();
170 updateLogicalHeight(); 173 updateLogicalHeight();
171 buildLocalToBorderBoxTransform(); 174 buildLocalToBorderBoxTransform();
172 175
173 SVGRenderSupport::layoutResourcesIfNeeded(this); 176 SVGRenderSupport::layoutResourcesIfNeeded(this);
174 177
175 SVGSVGElement* svg = toSVGSVGElement(node()); 178 SVGSVGElement* svg = toSVGSVGElement(node());
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 { 340 {
338 // Slightly optimized version of m_localToParentTransform = AffineTransform: :translation(x(), y()) * m_localToBorderBoxTransform; 341 // Slightly optimized version of m_localToParentTransform = AffineTransform: :translation(x(), y()) * m_localToBorderBoxTransform;
339 m_localToParentTransform = m_localToBorderBoxTransform; 342 m_localToParentTransform = m_localToBorderBoxTransform;
340 if (x()) 343 if (x())
341 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt( x())); 344 m_localToParentTransform.setE(m_localToParentTransform.e() + roundToInt( x()));
342 if (y()) 345 if (y())
343 m_localToParentTransform.setF(m_localToParentTransform.f() + roundToInt( y())); 346 m_localToParentTransform.setF(m_localToParentTransform.f() + roundToInt( y()));
344 return m_localToParentTransform; 347 return m_localToParentTransform;
345 } 348 }
346 349
347 LayoutRect RenderSVGRoot::clippedOverflowRectForPaintInvalidation(const RenderLa yerModelObject* paintInvalidationContainer, const PaintInvalidationState* paintI nvalidationState) const 350 LayoutRect RenderSVGRoot::clippedOverflowRectForPaintInvalidation(const RenderLa yerModelObject* paintInvalidationContainer) const
348 { 351 {
349 // This is an open-coded aggregate of SVGRenderSupport::clippedOverflowRectF orPaintInvalidation, 352 // This is an open-coded aggregate of SVGRenderSupport::clippedOverflowRectF orPaintInvalidation,
350 // RenderSVGRoot::computeFloatRectForPaintInvalidation and RenderReplaced::c lippedOverflowRectForPaintInvalidation. 353 // RenderSVGRoot::computeFloatRectForPaintInvalidation and RenderReplaced::c lippedOverflowRectForPaintInvalidation.
351 // The reason for this is to optimize/minimize the repaint rect when the box is not "decorated" 354 // The reason for this is to optimize/minimize the repaint rect when the box is not "decorated"
352 // (does not have background/border/etc.) 355 // (does not have background/border/etc.)
353 356
354 // Return early for any cases where we don't actually paint. 357 // Return early for any cases where we don't actually paint.
355 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent ()) 358 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent ())
356 return LayoutRect(); 359 return LayoutRect();
357 360
358 // Compute the repaint rect of the content of the SVG in the border-box coor dinate space. 361 // Compute the repaint rect of the content of the SVG in the border-box coor dinate space.
359 FloatRect contentRepaintRect = paintInvalidationRectInLocalCoordinates(); 362 FloatRect contentRepaintRect = paintInvalidationRectInLocalCoordinates();
360 contentRepaintRect = m_localToBorderBoxTransform.mapRect(contentRepaintRect) ; 363 contentRepaintRect = m_localToBorderBoxTransform.mapRect(contentRepaintRect) ;
361 364
362 // Apply initial viewport clip, overflow:visible content is added to visualO verflow 365 // Apply initial viewport clip, overflow:visible content is added to visualO verflow
363 // but the most common case is that overflow is hidden, so always intersect. 366 // but the most common case is that overflow is hidden, so always intersect.
364 contentRepaintRect.intersect(pixelSnappedBorderBoxRect()); 367 contentRepaintRect.intersect(pixelSnappedBorderBoxRect());
365 368
366 LayoutRect repaintRect = enclosingLayoutRect(contentRepaintRect); 369 LayoutRect repaintRect = enclosingLayoutRect(contentRepaintRect);
367 // If the box is decorated or is overflowing, extend it to include the borde r-box and overflow. 370 // If the box is decorated or is overflowing, extend it to include the borde r-box and overflow.
368 if (m_hasBoxDecorationBackground || hasRenderOverflow()) { 371 if (m_hasBoxDecorationBackground || hasRenderOverflow()) {
369 // The selectionRect can project outside of the overflowRect, so take th eir union 372 // The selectionRect can project outside of the overflowRect, so take th eir union
370 // for repainting to avoid selection painting glitches. 373 // for repainting to avoid selection painting glitches.
371 LayoutRect decoratedRepaintRect = unionRect(localSelectionRect(false), v isualOverflowRect()); 374 LayoutRect decoratedRepaintRect = unionRect(localSelectionRect(false), v isualOverflowRect());
372 repaintRect.unite(decoratedRepaintRect); 375 repaintRect.unite(decoratedRepaintRect);
373 } 376 }
374 377
375 // Compute the repaint rect in the parent coordinate space. 378 // Compute the repaint rect in the parent coordinate space.
376 LayoutRect rect = enclosingIntRect(repaintRect); 379 LayoutRect rect = enclosingIntRect(repaintRect);
377 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer , rect, paintInvalidationState); 380 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer , rect);
378 return rect; 381 return rect;
379 } 382 }
380 383
381 void RenderSVGRoot::computeFloatRectForPaintInvalidation(const RenderLayerModelO bject* paintInvalidationContainer, FloatRect& paintInvalidationRect, bool fixed, const PaintInvalidationState* paintInvalidationState) const 384 void RenderSVGRoot::computeFloatRectForPaintInvalidation(const RenderLayerModelO bject* paintInvalidationContainer, FloatRect& paintInvalidationRect, bool fixed) const
382 { 385 {
383 // Apply our local transforms (except for x/y translation), then our shadow, 386 // Apply our local transforms (except for x/y translation), then our shadow,
384 // and then call RenderBox's method to handle all the normal CSS Box model b its 387 // and then call RenderBox's method to handle all the normal CSS Box model b its
385 paintInvalidationRect = m_localToBorderBoxTransform.mapRect(paintInvalidatio nRect); 388 paintInvalidationRect = m_localToBorderBoxTransform.mapRect(paintInvalidatio nRect);
386 389
387 // Apply initial viewport clip 390 // Apply initial viewport clip
388 if (shouldApplyViewportClip()) 391 if (shouldApplyViewportClip())
389 paintInvalidationRect.intersect(pixelSnappedBorderBoxRect()); 392 paintInvalidationRect.intersect(pixelSnappedBorderBoxRect());
390 393
391 LayoutRect rect = enclosingIntRect(paintInvalidationRect); 394 LayoutRect rect = enclosingIntRect(paintInvalidationRect);
392 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer , rect, fixed, paintInvalidationState); 395 RenderReplaced::mapRectToPaintInvalidationBacking(paintInvalidationContainer , rect, fixed);
393 paintInvalidationRect = rect; 396 paintInvalidationRect = rect;
394 } 397 }
395 398
396 // This method expects local CSS box coordinates. 399 // This method expects local CSS box coordinates.
397 // Callers with local SVG viewport coordinates should first apply the localToBor derBoxTransform 400 // Callers with local SVG viewport coordinates should first apply the localToBor derBoxTransform
398 // to convert from SVG viewport coordinates to local CSS box coordinates. 401 // to convert from SVG viewport coordinates to local CSS box coordinates.
399 void RenderSVGRoot::mapLocalToContainer(const RenderLayerModelObject* repaintCon tainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed , const PaintInvalidationState* paintInvalidationState) const 402 void RenderSVGRoot::mapLocalToContainer(const RenderLayerModelObject* repaintCon tainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed ) const
400 { 403 {
401 ASSERT(mode & ~IsFixed); // We should have no fixed content in the SVG rende ring tree. 404 ASSERT(mode & ~IsFixed); // We should have no fixed content in the SVG rende ring tree.
402 // We used to have this ASSERT here, but we removed it when enabling layer s quashing. 405 // We used to have this ASSERT here, but we removed it when enabling layer s quashing.
403 // See http://crbug.com/364901 406 // See http://crbug.com/364901
404 // ASSERT(mode & UseTransforms); // mapping a point through SVG w/o respecti ng trasnforms is useless. 407 // ASSERT(mode & UseTransforms); // mapping a point through SVG w/o respecti ng trasnforms is useless.
405 408
406 RenderReplaced::mapLocalToContainer(repaintContainer, transformState, mode | ApplyContainerFlip, wasFixed, paintInvalidationState); 409 RenderReplaced::mapLocalToContainer(repaintContainer, transformState, mode | ApplyContainerFlip, wasFixed);
407 } 410 }
408 411
409 const RenderObject* RenderSVGRoot::pushMappingToContainer(const RenderLayerModel Object* ancestorToStopAt, RenderGeometryMap& geometryMap) const 412 const RenderObject* RenderSVGRoot::pushMappingToContainer(const RenderLayerModel Object* ancestorToStopAt, RenderGeometryMap& geometryMap) const
410 { 413 {
411 return RenderReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap) ; 414 return RenderReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap) ;
412 } 415 }
413 416
414 void RenderSVGRoot::updateCachedBoundaries() 417 void RenderSVGRoot::updateCachedBoundaries()
415 { 418 {
416 SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m _objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBox); 419 SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m _objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBox);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 updateHitTestResult(result, pointInBorderBox); 451 updateHitTestResult(result, pointInBorderBox);
449 if (!result.addNodeToRectBasedTestResult(node(), request, locationIn Container, boundsRect)) 452 if (!result.addNodeToRectBasedTestResult(node(), request, locationIn Container, boundsRect))
450 return true; 453 return true;
451 } 454 }
452 } 455 }
453 456
454 return false; 457 return false;
455 } 458 }
456 459
457 } 460 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGRoot.h ('k') | Source/core/rendering/svg/RenderSVGText.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698