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

Side by Side Diff: Source/core/layout/svg/LayoutSVGResourceClipper.cpp

Issue 908243002: Move rendering/svg/RenderSVGResource* to layout/svg. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
5 * Copyright (C) 2011 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2011 Dirk Schulze <krit@webkit.org>
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
11 * 11 *
12 * This library is distributed in the hope that it will be useful, 12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details. 15 * Library General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Library General Public License 17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to 18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA. 20 * Boston, MA 02110-1301, USA.
21 */ 21 */
22 22
23 #include "config.h" 23 #include "config.h"
24 #include "core/rendering/svg/RenderSVGResourceClipper.h" 24 #include "core/layout/svg/LayoutSVGResourceClipper.h"
25 25
26 #include "core/SVGNames.h" 26 #include "core/SVGNames.h"
27 #include "core/dom/ElementTraversal.h" 27 #include "core/dom/ElementTraversal.h"
28 #include "core/layout/HitTestResult.h" 28 #include "core/layout/HitTestResult.h"
29 #include "core/layout/PaintInfo.h" 29 #include "core/layout/PaintInfo.h"
30 #include "core/layout/svg/SVGLayoutSupport.h" 30 #include "core/layout/svg/SVGLayoutSupport.h"
31 #include "core/layout/svg/SVGResources.h" 31 #include "core/layout/svg/SVGResources.h"
32 #include "core/layout/svg/SVGResourcesCache.h" 32 #include "core/layout/svg/SVGResourcesCache.h"
33 #include "core/svg/SVGUseElement.h" 33 #include "core/svg/SVGUseElement.h"
34 #include "platform/RuntimeEnabledFeatures.h" 34 #include "platform/RuntimeEnabledFeatures.h"
35 #include "platform/graphics/GraphicsContextStateSaver.h" 35 #include "platform/graphics/GraphicsContextStateSaver.h"
36 #include "platform/graphics/paint/ClipPathDisplayItem.h" 36 #include "platform/graphics/paint/ClipPathDisplayItem.h"
37 #include "platform/graphics/paint/DisplayItemList.h" 37 #include "platform/graphics/paint/DisplayItemList.h"
38 #include "third_party/skia/include/core/SkPicture.h" 38 #include "third_party/skia/include/core/SkPicture.h"
39 #include "wtf/TemporaryChange.h" 39 #include "wtf/TemporaryChange.h"
40 40
41 namespace blink { 41 namespace blink {
42 42
43 RenderSVGResourceClipper::RenderSVGResourceClipper(SVGClipPathElement* node) 43 LayoutSVGResourceClipper::LayoutSVGResourceClipper(SVGClipPathElement* node)
44 : RenderSVGResourceContainer(node) 44 : LayoutSVGResourceContainer(node)
45 , m_inClipExpansion(false) 45 , m_inClipExpansion(false)
46 { 46 {
47 } 47 }
48 48
49 RenderSVGResourceClipper::~RenderSVGResourceClipper() 49 LayoutSVGResourceClipper::~LayoutSVGResourceClipper()
50 { 50 {
51 } 51 }
52 52
53 void RenderSVGResourceClipper::removeAllClientsFromCache(bool markForInvalidatio n) 53 void LayoutSVGResourceClipper::removeAllClientsFromCache(bool markForInvalidatio n)
54 { 54 {
55 m_clipContentPicture.clear(); 55 m_clipContentPicture.clear();
56 m_clipBoundaries = FloatRect(); 56 m_clipBoundaries = FloatRect();
57 markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInval idation : ParentOnlyInvalidation); 57 markAllClientsForInvalidation(markForInvalidation ? LayoutAndBoundariesInval idation : ParentOnlyInvalidation);
58 } 58 }
59 59
60 void RenderSVGResourceClipper::removeClientFromCache(LayoutObject* client, bool markForInvalidation) 60 void LayoutSVGResourceClipper::removeClientFromCache(LayoutObject* client, bool markForInvalidation)
61 { 61 {
62 ASSERT(client); 62 ASSERT(client);
63 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati on : ParentOnlyInvalidation); 63 markClientForInvalidation(client, markForInvalidation ? BoundariesInvalidati on : ParentOnlyInvalidation);
64 } 64 }
65 65
66 bool RenderSVGResourceClipper::applyStatefulResource(LayoutObject* object, Graph icsContext*& context, ClipperState& clipperState) 66 bool LayoutSVGResourceClipper::applyStatefulResource(LayoutObject* object, Graph icsContext*& context, ClipperState& clipperState)
67 { 67 {
68 ASSERT(object); 68 ASSERT(object);
69 ASSERT(context); 69 ASSERT(context);
70 70
71 clearInvalidationMask(); 71 clearInvalidationMask();
72 72
73 return applyClippingToContext(object, object->objectBoundingBox(), object->p aintInvalidationRectInLocalCoordinates(), context, clipperState); 73 return applyClippingToContext(object, object->objectBoundingBox(), object->p aintInvalidationRectInLocalCoordinates(), context, clipperState);
74 } 74 }
75 75
76 bool RenderSVGResourceClipper::tryPathOnlyClipping(DisplayItemClient client, Gra phicsContext* context, 76 bool LayoutSVGResourceClipper::tryPathOnlyClipping(DisplayItemClient client, Gra phicsContext* context,
77 const AffineTransform& animatedLocalTransform, const FloatRect& objectBoundi ngBox) { 77 const AffineTransform& animatedLocalTransform, const FloatRect& objectBoundi ngBox) {
78 // If the current clip-path gets clipped itself, we have to fallback to mask ing. 78 // If the current clip-path gets clipped itself, we have to fallback to mask ing.
79 if (!style()->svgStyle().clipperResource().isEmpty()) 79 if (!style()->svgStyle().clipperResource().isEmpty())
80 return false; 80 return false;
81 WindRule clipRule = RULE_NONZERO; 81 WindRule clipRule = RULE_NONZERO;
82 Path clipPath = Path(); 82 Path clipPath = Path();
83 83
84 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) { 84 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) {
85 LayoutObject* renderer = childElement->renderer(); 85 LayoutObject* renderer = childElement->renderer();
86 if (!renderer) 86 if (!renderer)
87 continue; 87 continue;
88 // Only shapes or paths are supported for direct clipping. We need to fa llback to masking for texts. 88 // Only shapes or paths are supported for direct clipping. We need to fa llback to masking for texts.
89 if (renderer->isSVGText()) 89 if (renderer->isSVGText())
90 return false; 90 return false;
91 if (!childElement->isSVGGraphicsElement()) 91 if (!childElement->isSVGGraphicsElement())
92 continue; 92 continue;
93 SVGGraphicsElement* styled = toSVGGraphicsElement(childElement); 93 SVGGraphicsElement* styled = toSVGGraphicsElement(childElement);
94 const LayoutStyle* style = renderer->style(); 94 const LayoutStyle* style = renderer->style();
95 if (!style || style->display() == NONE || style->visibility() != VISIBLE ) 95 if (!style || style->display() == NONE || style->visibility() != VISIBLE )
96 continue; 96 continue;
97 const SVGLayoutStyle& svgStyle = style->svgStyle(); 97 const SVGLayoutStyle& svgStyle = style->svgStyle();
98 // Current shape in clip-path gets clipped too. Fallback to masking. 98 // Current shape in clip-path gets clipped too. Fallback to masking.
99 if (!svgStyle.clipperResource().isEmpty()) 99 if (!svgStyle.clipperResource().isEmpty())
100 return false; 100 return false;
101 101
102 if (clipPath.isEmpty()) { 102 if (clipPath.isEmpty()) {
103 // First clip shape. 103 // First clip shape.
104 styled->toClipPath(clipPath); 104 styled->toClipPath(clipPath);
105 clipRule = svgStyle.clipRule(); 105 clipRule = svgStyle.clipRule();
106 clipPath.setWindRule(clipRule); 106 clipPath.setWindRule(clipRule);
(...skipping 29 matching lines...) Expand all
136 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { 136 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
137 context->displayItemList()->add(BeginClipPathDisplayItem::create(client, clipPath, clipRule)); 137 context->displayItemList()->add(BeginClipPathDisplayItem::create(client, clipPath, clipRule));
138 } else { 138 } else {
139 BeginClipPathDisplayItem clipPathDisplayItem(client, clipPath, clipRule) ; 139 BeginClipPathDisplayItem clipPathDisplayItem(client, clipPath, clipRule) ;
140 clipPathDisplayItem.replay(context); 140 clipPathDisplayItem.replay(context);
141 } 141 }
142 142
143 return true; 143 return true;
144 } 144 }
145 145
146 bool RenderSVGResourceClipper::applyClippingToContext(LayoutObject* target, cons t FloatRect& targetBoundingBox, 146 bool LayoutSVGResourceClipper::applyClippingToContext(LayoutObject* target, cons t FloatRect& targetBoundingBox,
147 const FloatRect& paintInvalidationRect, GraphicsContext* context, ClipperSta te& clipperState) 147 const FloatRect& paintInvalidationRect, GraphicsContext* context, ClipperSta te& clipperState)
148 { 148 {
149 ASSERT(target); 149 ASSERT(target);
150 ASSERT(context); 150 ASSERT(context);
151 ASSERT(clipperState == ClipperNotApplied); 151 ASSERT(clipperState == ClipperNotApplied);
152 ASSERT_WITH_SECURITY_IMPLICATION(!needsLayout()); 152 ASSERT_WITH_SECURITY_IMPLICATION(!needsLayout());
153 153
154 if (paintInvalidationRect.isEmpty() || m_inClipExpansion) 154 if (paintInvalidationRect.isEmpty() || m_inClipExpansion)
155 return false; 155 return false;
156 TemporaryChange<bool> inClipExpansionChange(m_inClipExpansion, true); 156 TemporaryChange<bool> inClipExpansionChange(m_inClipExpansion, true);
(...skipping 17 matching lines...) Expand all
174 clipperState = ClipperAppliedMask; 174 clipperState = ClipperAppliedMask;
175 175
176 // Mask layer start 176 // Mask layer start
177 context->beginTransparencyLayer(1, &paintInvalidationRect); 177 context->beginTransparencyLayer(1, &paintInvalidationRect);
178 { 178 {
179 GraphicsContextStateSaver maskContentSaver(*context); 179 GraphicsContextStateSaver maskContentSaver(*context);
180 context->concatCTM(animatedLocalTransform); 180 context->concatCTM(animatedLocalTransform);
181 181
182 // clipPath can also be clipped by another clipPath. 182 // clipPath can also be clipped by another clipPath.
183 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObj ect(this); 183 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObj ect(this);
184 RenderSVGResourceClipper* clipPathClipper = resources ? resources->clipp er() : 0; 184 LayoutSVGResourceClipper* clipPathClipper = resources ? resources->clipp er() : 0;
185 ClipperState clipPathClipperState = ClipperNotApplied; 185 ClipperState clipPathClipperState = ClipperNotApplied;
186 if (clipPathClipper && !clipPathClipper->applyClippingToContext(this, ta rgetBoundingBox, paintInvalidationRect, context, clipPathClipperState)) { 186 if (clipPathClipper && !clipPathClipper->applyClippingToContext(this, ta rgetBoundingBox, paintInvalidationRect, context, clipPathClipperState)) {
187 // FIXME: Awkward state micro-management. Ideally, GraphicsContextSt ateSaver should 187 // FIXME: Awkward state micro-management. Ideally, GraphicsContextSt ateSaver should
188 // a) pop saveLayers also 188 // a) pop saveLayers also
189 // b) pop multiple states if needed (similarly to SkCanvas::restor eToCount()) 189 // b) pop multiple states if needed (similarly to SkCanvas::restor eToCount())
190 // Then we should be able to replace this mess with a single, top-le vel GCSS. 190 // Then we should be able to replace this mess with a single, top-le vel GCSS.
191 maskContentSaver.restore(); 191 maskContentSaver.restore();
192 context->endLayer(); 192 context->endLayer();
193 return false; 193 return false;
194 } 194 }
195 195
196 drawClipMaskContent(context, targetBoundingBox); 196 drawClipMaskContent(context, targetBoundingBox);
197 197
198 if (clipPathClipper) 198 if (clipPathClipper)
199 clipPathClipper->postApplyStatefulResource(this, context, clipPathCl ipperState); 199 clipPathClipper->postApplyStatefulResource(this, context, clipPathCl ipperState);
200 } 200 }
201 201
202 // Masked content layer start. 202 // Masked content layer start.
203 context->beginLayer(1, SkXfermode::kSrcIn_Mode, &paintInvalidationRect); 203 context->beginLayer(1, SkXfermode::kSrcIn_Mode, &paintInvalidationRect);
204 204
205 return true; 205 return true;
206 } 206 }
207 207
208 void RenderSVGResourceClipper::postApplyStatefulResource(LayoutObject* target, G raphicsContext*& context, ClipperState& clipperState) 208 void LayoutSVGResourceClipper::postApplyStatefulResource(LayoutObject* target, G raphicsContext*& context, ClipperState& clipperState)
209 { 209 {
210 switch (clipperState) { 210 switch (clipperState) {
211 case ClipperAppliedPath: 211 case ClipperAppliedPath:
212 // Path-only clipping, no layers to restore but we need to emit an end t o the clip path display item. 212 // Path-only clipping, no layers to restore but we need to emit an end t o the clip path display item.
213 { 213 {
214 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { 214 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) {
215 context->displayItemList()->add(EndClipPathDisplayItem::create(t arget->displayItemClient())); 215 context->displayItemList()->add(EndClipPathDisplayItem::create(t arget->displayItemClient()));
216 } else { 216 } else {
217 EndClipPathDisplayItem endClipPathDisplayItem(target->displayIte mClient()); 217 EndClipPathDisplayItem endClipPathDisplayItem(target->displayIte mClient());
218 endClipPathDisplayItem.replay(context); 218 endClipPathDisplayItem.replay(context);
219 } 219 }
220 } 220 }
221 break; 221 break;
222 case ClipperAppliedMask: 222 case ClipperAppliedMask:
223 // Transfer content layer -> mask layer (SrcIn) 223 // Transfer content layer -> mask layer (SrcIn)
224 context->endLayer(); 224 context->endLayer();
225 // Transfer mask layer -> bg layer (SrcOver) 225 // Transfer mask layer -> bg layer (SrcOver)
226 context->endLayer(); 226 context->endLayer();
227 break; 227 break;
228 default: 228 default:
229 ASSERT_NOT_REACHED(); 229 ASSERT_NOT_REACHED();
230 } 230 }
231 } 231 }
232 232
233 void RenderSVGResourceClipper::drawClipMaskContent(GraphicsContext* context, con st FloatRect& targetBoundingBox) 233 void LayoutSVGResourceClipper::drawClipMaskContent(GraphicsContext* context, con st FloatRect& targetBoundingBox)
234 { 234 {
235 ASSERT(context); 235 ASSERT(context);
236 236
237 AffineTransform contentTransformation; 237 AffineTransform contentTransformation;
238 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { 238 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
239 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox .y()); 239 contentTransformation.translate(targetBoundingBox.x(), targetBoundingBox .y());
240 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB oundingBox.height()); 240 contentTransformation.scaleNonUniform(targetBoundingBox.width(), targetB oundingBox.height());
241 context->concatCTM(contentTransformation); 241 context->concatCTM(contentTransformation);
242 } 242 }
243 243
244 if (!m_clipContentPicture) { 244 if (!m_clipContentPicture) {
245 SubtreeContentTransformScope contentTransformScope(contentTransformation ); 245 SubtreeContentTransformScope contentTransformScope(contentTransformation );
246 createPicture(context); 246 createPicture(context);
247 } 247 }
248 248
249 context->drawPicture(m_clipContentPicture.get()); 249 context->drawPicture(m_clipContentPicture.get());
250 } 250 }
251 251
252 void RenderSVGResourceClipper::createPicture(GraphicsContext* context) 252 void LayoutSVGResourceClipper::createPicture(GraphicsContext* context)
253 { 253 {
254 ASSERT(context); 254 ASSERT(context);
255 ASSERT(frame()); 255 ASSERT(frame());
256 256
257 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat es) to avoid the intersection 257 // Using strokeBoundingBox (instead of paintInvalidationRectInLocalCoordinat es) to avoid the intersection
258 // with local clips/mask, which may yield incorrect results when mixing obje ctBoundingBox and 258 // with local clips/mask, which may yield incorrect results when mixing obje ctBoundingBox and
259 // userSpaceOnUse units (http://crbug.com/294900). 259 // userSpaceOnUse units (http://crbug.com/294900).
260 FloatRect bounds = strokeBoundingBox(); 260 FloatRect bounds = strokeBoundingBox();
261 context->beginRecording(bounds); 261 context->beginRecording(bounds);
262 262
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 // - masker/filter not applied when rendering the children 294 // - masker/filter not applied when rendering the children
295 // - fill is set to the initial fill paint server (solid, black) 295 // - fill is set to the initial fill paint server (solid, black)
296 // - stroke is set to the initial stroke paint server (none) 296 // - stroke is set to the initial stroke paint server (none)
297 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForegro und, PaintBehaviorRenderingClipPathAsMask); 297 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForegro und, PaintBehaviorRenderingClipPathAsMask);
298 renderer->paint(info, IntPoint()); 298 renderer->paint(info, IntPoint());
299 } 299 }
300 300
301 m_clipContentPicture = context->endRecording(); 301 m_clipContentPicture = context->endRecording();
302 } 302 }
303 303
304 void RenderSVGResourceClipper::calculateClipContentPaintInvalidationRect() 304 void LayoutSVGResourceClipper::calculateClipContentPaintInvalidationRect()
305 { 305 {
306 // This is a rough heuristic to appraise the clip size and doesn't consider clip on clip. 306 // This is a rough heuristic to appraise the clip size and doesn't consider clip on clip.
307 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) { 307 for (SVGElement* childElement = Traversal<SVGElement>::firstChild(*element() ); childElement; childElement = Traversal<SVGElement>::nextSibling(*childElement )) {
308 LayoutObject* renderer = childElement->renderer(); 308 LayoutObject* renderer = childElement->renderer();
309 if (!renderer) 309 if (!renderer)
310 continue; 310 continue;
311 if (!renderer->isSVGShape() && !renderer->isSVGText() && !isSVGUseElemen t(*childElement)) 311 if (!renderer->isSVGShape() && !renderer->isSVGText() && !isSVGUseElemen t(*childElement))
312 continue; 312 continue;
313 const LayoutStyle* style = renderer->style(); 313 const LayoutStyle* style = renderer->style();
314 if (!style || style->display() == NONE || style->visibility() != VISIBLE ) 314 if (!style || style->display() == NONE || style->visibility() != VISIBLE )
315 continue; 315 continue;
316 m_clipBoundaries.unite(renderer->localToParentTransform().mapRect(render er->paintInvalidationRectInLocalCoordinates())); 316 m_clipBoundaries.unite(renderer->localToParentTransform().mapRect(render er->paintInvalidationRectInLocalCoordinates()));
317 } 317 }
318 m_clipBoundaries = toSVGClipPathElement(element())->calculateAnimatedLocalTr ansform().mapRect(m_clipBoundaries); 318 m_clipBoundaries = toSVGClipPathElement(element())->calculateAnimatedLocalTr ansform().mapRect(m_clipBoundaries);
319 } 319 }
320 320
321 bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin gBox, const FloatPoint& nodeAtPoint) 321 bool LayoutSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin gBox, const FloatPoint& nodeAtPoint)
322 { 322 {
323 FloatPoint point = nodeAtPoint; 323 FloatPoint point = nodeAtPoint;
324 if (!SVGLayoutSupport::pointInClippingArea(this, point)) 324 if (!SVGLayoutSupport::pointInClippingArea(this, point))
325 return false; 325 return false;
326 326
327 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { 327 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
328 AffineTransform transform; 328 AffineTransform transform;
329 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); 329 transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
330 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight()); 330 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight());
331 point = transform.inverse().mapPoint(point); 331 point = transform.inverse().mapPoint(point);
(...skipping 13 matching lines...) Expand all
345 continue; 345 continue;
346 IntPoint hitPoint; 346 IntPoint hitPoint;
347 HitTestResult result(hitPoint); 347 HitTestResult result(hitPoint);
348 if (renderer->nodeAtFloatPoint(HitTestRequest(HitTestRequest::SVGClipCon tent), result, point, HitTestForeground)) 348 if (renderer->nodeAtFloatPoint(HitTestRequest(HitTestRequest::SVGClipCon tent), result, point, HitTestForeground))
349 return true; 349 return true;
350 } 350 }
351 351
352 return false; 352 return false;
353 } 353 }
354 354
355 FloatRect RenderSVGResourceClipper::resourceBoundingBox(const LayoutObject* obje ct) 355 FloatRect LayoutSVGResourceClipper::resourceBoundingBox(const LayoutObject* obje ct)
356 { 356 {
357 // Resource was not layouted yet. Give back the boundingBox of the object. 357 // Resource was not layouted yet. Give back the boundingBox of the object.
358 if (selfNeedsLayout()) 358 if (selfNeedsLayout())
359 return object->objectBoundingBox(); 359 return object->objectBoundingBox();
360 360
361 if (m_clipBoundaries.isEmpty()) 361 if (m_clipBoundaries.isEmpty())
362 calculateClipContentPaintInvalidationRect(); 362 calculateClipContentPaintInvalidationRect();
363 363
364 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) { 364 if (clipPathUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
365 FloatRect objectBoundingBox = object->objectBoundingBox(); 365 FloatRect objectBoundingBox = object->objectBoundingBox();
366 AffineTransform transform; 366 AffineTransform transform;
367 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); 367 transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
368 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight()); 368 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight());
369 return transform.mapRect(m_clipBoundaries); 369 return transform.mapRect(m_clipBoundaries);
370 } 370 }
371 371
372 return m_clipBoundaries; 372 return m_clipBoundaries;
373 } 373 }
374 374
375 } 375 }
OLDNEW
« no previous file with comments | « Source/core/layout/svg/LayoutSVGResourceClipper.h ('k') | Source/core/layout/svg/LayoutSVGResourceContainer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698