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

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

Issue 21042009: [SVG2] Merge SVGStyledElement into SVGElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 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
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.
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 // - fill-opacity/stroke-opacity/opacity set to 1 219 // - fill-opacity/stroke-opacity/opacity set to 1
220 // - masker/filter not applied when rendering the children 220 // - masker/filter not applied when rendering the children
221 // - fill is set to the initial fill paint server (solid, black) 221 // - fill is set to the initial fill paint server (solid, black)
222 // - stroke is set to the initial stroke paint server (none) 222 // - stroke is set to the initial stroke paint server (none)
223 PaintBehavior oldBehavior = frame()->view()->paintBehavior(); 223 PaintBehavior oldBehavior = frame()->view()->paintBehavior();
224 frame()->view()->setPaintBehavior(oldBehavior | PaintBehaviorRenderingSVGMas k); 224 frame()->view()->setPaintBehavior(oldBehavior | PaintBehaviorRenderingSVGMas k);
225 225
226 // Draw all clipPath children into a global mask. 226 // Draw all clipPath children into a global mask.
227 for (Node* childNode = node()->firstChild(); childNode; childNode = childNod e->nextSibling()) { 227 for (Node* childNode = node()->firstChild(); childNode; childNode = childNod e->nextSibling()) {
228 RenderObject* renderer = childNode->renderer(); 228 RenderObject* renderer = childNode->renderer();
229 if (!childNode->isSVGElement() || !toSVGElement(childNode)->isSVGStyledE lement() || !renderer) 229 if (!childNode->isSVGElement() || !renderer)
230 continue; 230 continue;
231 if (renderer->needsLayout()) { 231 if (renderer->needsLayout()) {
232 frame()->view()->setPaintBehavior(oldBehavior); 232 frame()->view()->setPaintBehavior(oldBehavior);
233 return false; 233 return false;
234 } 234 }
235 RenderStyle* style = renderer->style(); 235 RenderStyle* style = renderer->style();
236 if (!style || style->display() == NONE || style->visibility() != VISIBLE ) 236 if (!style || style->display() == NONE || style->visibility() != VISIBLE )
237 continue; 237 continue;
238 238
239 WindRule newClipRule = style->svgStyle()->clipRule(); 239 WindRule newClipRule = style->svgStyle()->clipRule();
(...skipping 21 matching lines...) Expand all
261 261
262 frame()->view()->setPaintBehavior(oldBehavior); 262 frame()->view()->setPaintBehavior(oldBehavior);
263 return true; 263 return true;
264 } 264 }
265 265
266 void RenderSVGResourceClipper::calculateClipContentRepaintRect() 266 void RenderSVGResourceClipper::calculateClipContentRepaintRect()
267 { 267 {
268 // This is a rough heuristic to appraise the clip size and doesn't consider clip on clip. 268 // This is a rough heuristic to appraise the clip size and doesn't consider clip on clip.
269 for (Node* childNode = node()->firstChild(); childNode; childNode = childNod e->nextSibling()) { 269 for (Node* childNode = node()->firstChild(); childNode; childNode = childNod e->nextSibling()) {
270 RenderObject* renderer = childNode->renderer(); 270 RenderObject* renderer = childNode->renderer();
271 if (!childNode->isSVGElement() || !toSVGElement(childNode)->isSVGStyledE lement() || !renderer) 271 if (!childNode->isSVGElement() || !renderer)
272 continue; 272 continue;
273 if (!renderer->isSVGShape() && !renderer->isSVGText() && !childNode->has TagName(SVGNames::useTag)) 273 if (!renderer->isSVGShape() && !renderer->isSVGText() && !childNode->has TagName(SVGNames::useTag))
274 continue; 274 continue;
275 RenderStyle* style = renderer->style(); 275 RenderStyle* style = renderer->style();
276 if (!style || style->display() == NONE || style->visibility() != VISIBLE ) 276 if (!style || style->display() == NONE || style->visibility() != VISIBLE )
277 continue; 277 continue;
278 m_clipBoundaries.unite(renderer->localToParentTransform().mapRect(render er->repaintRectInLocalCoordinates())); 278 m_clipBoundaries.unite(renderer->localToParentTransform().mapRect(render er->repaintRectInLocalCoordinates()));
279 } 279 }
280 m_clipBoundaries = static_cast<SVGClipPathElement*>(node())->animatedLocalTr ansform().mapRect(m_clipBoundaries); 280 m_clipBoundaries = static_cast<SVGClipPathElement*>(node())->animatedLocalTr ansform().mapRect(m_clipBoundaries);
281 } 281 }
282 282
283 bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin gBox, const FloatPoint& nodeAtPoint) 283 bool RenderSVGResourceClipper::hitTestClipContent(const FloatRect& objectBoundin gBox, const FloatPoint& nodeAtPoint)
284 { 284 {
285 FloatPoint point = nodeAtPoint; 285 FloatPoint point = nodeAtPoint;
286 if (!SVGRenderSupport::pointInClippingArea(this, point)) 286 if (!SVGRenderSupport::pointInClippingArea(this, point))
287 return false; 287 return false;
288 288
289 SVGClipPathElement* clipPathElement = static_cast<SVGClipPathElement*>(node( )); 289 SVGClipPathElement* clipPathElement = static_cast<SVGClipPathElement*>(node( ));
290 if (clipPathElement->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_T YPE_OBJECTBOUNDINGBOX) { 290 if (clipPathElement->clipPathUnitsCurrentValue() == SVGUnitTypes::SVG_UNIT_T YPE_OBJECTBOUNDINGBOX) {
291 AffineTransform transform; 291 AffineTransform transform;
292 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); 292 transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
293 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight()); 293 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight());
294 point = transform.inverse().mapPoint(point); 294 point = transform.inverse().mapPoint(point);
295 } 295 }
296 296
297 point = clipPathElement->animatedLocalTransform().inverse().mapPoint(point); 297 point = clipPathElement->animatedLocalTransform().inverse().mapPoint(point);
298 298
299 for (Node* childNode = node()->firstChild(); childNode; childNode = childNod e->nextSibling()) { 299 for (Node* childNode = node()->firstChild(); childNode; childNode = childNod e->nextSibling()) {
300 RenderObject* renderer = childNode->renderer(); 300 RenderObject* renderer = childNode->renderer();
301 if (!childNode->isSVGElement() || !toSVGElement(childNode)->isSVGStyledE lement() || !renderer) 301 if (!childNode->isSVGElement() || !renderer)
302 continue; 302 continue;
303 if (!renderer->isSVGShape() && !renderer->isSVGText() && !childNode->has TagName(SVGNames::useTag)) 303 if (!renderer->isSVGShape() && !renderer->isSVGText() && !childNode->has TagName(SVGNames::useTag))
304 continue; 304 continue;
305 IntPoint hitPoint; 305 IntPoint hitPoint;
306 HitTestResult result(hitPoint); 306 HitTestResult result(hitPoint);
307 if (renderer->nodeAtFloatPoint(HitTestRequest(HitTestRequest::SVGClipCon tent | HitTestRequest::DisallowShadowContent), result, point, HitTestForeground) ) 307 if (renderer->nodeAtFloatPoint(HitTestRequest(HitTestRequest::SVGClipCon tent | HitTestRequest::DisallowShadowContent), result, point, HitTestForeground) )
308 return true; 308 return true;
309 } 309 }
310 310
311 return false; 311 return false;
(...skipping 13 matching lines...) Expand all
325 AffineTransform transform; 325 AffineTransform transform;
326 transform.translate(objectBoundingBox.x(), objectBoundingBox.y()); 326 transform.translate(objectBoundingBox.x(), objectBoundingBox.y());
327 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight()); 327 transform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.h eight());
328 return transform.mapRect(m_clipBoundaries); 328 return transform.mapRect(m_clipBoundaries);
329 } 329 }
330 330
331 return m_clipBoundaries; 331 return m_clipBoundaries;
332 } 332 }
333 333
334 } 334 }
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGModelObject.cpp ('k') | Source/core/rendering/svg/RenderSVGResourceContainer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698