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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGModelObject.cpp

Issue 2208463003: First step of PaintInvalidator implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2009, Google Inc. All rights reserved. 2 * Copyright (c) 2009, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "core/layout/svg/LayoutSVGModelObject.h" 31 #include "core/layout/svg/LayoutSVGModelObject.h"
32 32
33 #include "core/layout/LayoutView.h" 33 #include "core/layout/LayoutView.h"
34 #include "core/layout/svg/LayoutSVGContainer.h" 34 #include "core/layout/svg/LayoutSVGContainer.h"
35 #include "core/layout/svg/LayoutSVGRoot.h" 35 #include "core/layout/svg/LayoutSVGRoot.h"
36 #include "core/layout/svg/SVGLayoutSupport.h" 36 #include "core/layout/svg/SVGLayoutSupport.h"
37 #include "core/layout/svg/SVGResourcesCache.h" 37 #include "core/layout/svg/SVGResourcesCache.h"
38 #include "core/paint/PaintLayer.h" 38 #include "core/paint/PaintLayer.h"
39 #include "core/paint/SVGModelObjectPaintInvalidator.h"
39 #include "core/svg/SVGGraphicsElement.h" 40 #include "core/svg/SVGGraphicsElement.h"
40 41
41 namespace blink { 42 namespace blink {
42 43
43 LayoutSVGModelObject::LayoutSVGModelObject(SVGElement* node) 44 LayoutSVGModelObject::LayoutSVGModelObject(SVGElement* node)
44 : LayoutObject(node) 45 : LayoutObject(node)
45 { 46 {
46 } 47 }
47 48
48 bool LayoutSVGModelObject::isChildAllowed(LayoutObject* child, const ComputedSty le&) const 49 bool LayoutSVGModelObject::isChildAllowed(LayoutObject* child, const ComputedSty le&) const
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 { 82 {
82 quads.append(localToAbsoluteQuad(strokeBoundingBox())); 83 quads.append(localToAbsoluteQuad(strokeBoundingBox()));
83 } 84 }
84 85
85 void LayoutSVGModelObject::willBeDestroyed() 86 void LayoutSVGModelObject::willBeDestroyed()
86 { 87 {
87 SVGResourcesCache::clientDestroyed(this); 88 SVGResourcesCache::clientDestroyed(this);
88 LayoutObject::willBeDestroyed(); 89 LayoutObject::willBeDestroyed();
89 } 90 }
90 91
91 PaintInvalidationReason LayoutSVGModelObject::getPaintInvalidationReason(const P aintInvalidationState& paintInvalidationState, 92 PaintInvalidationReason LayoutSVGModelObject::invalidatePaintIfNeeded(const Pain tInvalidatorContext& context) const
92 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec t& newBounds, const LayoutPoint& newLocation) const
93 { 93 {
94 PaintInvalidationReason invalidationReason = LayoutObject::getPaintInvalidat ionReason(paintInvalidationState, oldBounds, oldLocation, newBounds, newLocation ); 94 return SVGModelObjectPaintInvalidator(*this, context).invalidatePaintIfNeede d();
95
96 // Disable incremental invalidation for SVG objects to prevent under-
97 // invalidation. Unlike boxes, it is non-trivial (and rare) for SVG objects
98 // to be able to be incrementally invalidated (e.g., on height changes).
99 if (invalidationReason == PaintInvalidationIncremental)
100 return PaintInvalidationFull;
101
102 return invalidationReason;
103 } 95 }
104 96
105 void LayoutSVGModelObject::computeLayerHitTestRects(LayerHitTestRects& rects) co nst 97 void LayoutSVGModelObject::computeLayerHitTestRects(LayerHitTestRects& rects) co nst
106 { 98 {
107 // Using just the rect for the SVGRoot is good enough for now. 99 // Using just the rect for the SVGRoot is good enough for now.
108 SVGLayoutSupport::findTreeRootObject(this)->computeLayerHitTestRects(rects); 100 SVGLayoutSupport::findTreeRootObject(this)->computeLayerHitTestRects(rects);
109 } 101 }
110 102
111 void LayoutSVGModelObject::addLayerHitTestRects(LayerHitTestRects&, const PaintL ayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerR ect) const 103 void LayoutSVGModelObject::addLayerHitTestRects(LayerHitTestRects&, const PaintL ayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerR ect) const
112 { 104 {
(...skipping 25 matching lines...) Expand all
138 } 130 }
139 131
140 // The SVG addOutlineRects() method adds rects in local coordinates so the defau lt absoluteElementBoundingBoxRect() 132 // The SVG addOutlineRects() method adds rects in local coordinates so the defau lt absoluteElementBoundingBoxRect()
141 // returns incorrect values for SVG objects. Overriding this method provides acc ess to the absolute bounds. 133 // returns incorrect values for SVG objects. Overriding this method provides acc ess to the absolute bounds.
142 IntRect LayoutSVGModelObject::absoluteElementBoundingBoxRect() const 134 IntRect LayoutSVGModelObject::absoluteElementBoundingBoxRect() const
143 { 135 {
144 return localToAbsoluteQuad(FloatQuad(paintInvalidationRectInLocalSVGCoordina tes())).enclosingBoundingBox(); 136 return localToAbsoluteQuad(FloatQuad(paintInvalidationRectInLocalSVGCoordina tes())).enclosingBoundingBox();
145 } 137 }
146 138
147 } // namespace blink 139 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698