OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> | 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> |
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@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. All rights reserved. | 5 * Copyright (C) 2009 Google, Inc. All rights reserved. |
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 11 matching lines...) Expand all Loading... |
22 * Boston, MA 02110-1301, USA. | 22 * Boston, MA 02110-1301, USA. |
23 */ | 23 */ |
24 | 24 |
25 #include "config.h" | 25 #include "config.h" |
26 #include "core/layout/svg/SVGLayoutSupport.h" | 26 #include "core/layout/svg/SVGLayoutSupport.h" |
27 | 27 |
28 #include "core/frame/FrameHost.h" | 28 #include "core/frame/FrameHost.h" |
29 #include "core/layout/Layer.h" | 29 #include "core/layout/Layer.h" |
30 #include "core/layout/PaintInfo.h" | 30 #include "core/layout/PaintInfo.h" |
31 #include "core/layout/SubtreeLayoutScope.h" | 31 #include "core/layout/SubtreeLayoutScope.h" |
| 32 #include "core/layout/svg/LayoutSVGResourceClipper.h" |
| 33 #include "core/layout/svg/LayoutSVGResourceFilter.h" |
| 34 #include "core/layout/svg/LayoutSVGResourceMasker.h" |
32 #include "core/layout/svg/SVGResources.h" | 35 #include "core/layout/svg/SVGResources.h" |
33 #include "core/layout/svg/SVGResourcesCache.h" | 36 #include "core/layout/svg/SVGResourcesCache.h" |
34 #include "core/rendering/RenderGeometryMap.h" | 37 #include "core/rendering/RenderGeometryMap.h" |
35 #include "core/rendering/svg/RenderSVGInlineText.h" | 38 #include "core/rendering/svg/RenderSVGInlineText.h" |
36 #include "core/rendering/svg/RenderSVGResourceClipper.h" | |
37 #include "core/rendering/svg/RenderSVGResourceFilter.h" | |
38 #include "core/rendering/svg/RenderSVGResourceMasker.h" | |
39 #include "core/rendering/svg/RenderSVGRoot.h" | 39 #include "core/rendering/svg/RenderSVGRoot.h" |
40 #include "core/rendering/svg/RenderSVGShape.h" | 40 #include "core/rendering/svg/RenderSVGShape.h" |
41 #include "core/rendering/svg/RenderSVGText.h" | 41 #include "core/rendering/svg/RenderSVGText.h" |
42 #include "core/rendering/svg/RenderSVGViewportContainer.h" | 42 #include "core/rendering/svg/RenderSVGViewportContainer.h" |
43 #include "core/svg/SVGElement.h" | 43 #include "core/svg/SVGElement.h" |
44 #include "platform/geometry/TransformState.h" | 44 #include "platform/geometry/TransformState.h" |
45 | 45 |
46 namespace blink { | 46 namespace blink { |
47 | 47 |
48 static inline LayoutRect enclosingIntRectIfNotEmpty(const FloatRect& rect) | 48 static inline LayoutRect enclosingIntRectIfNotEmpty(const FloatRect& rect) |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } | 293 } |
294 | 294 |
295 void SVGLayoutSupport::intersectPaintInvalidationRectWithResources(const LayoutO
bject* renderer, FloatRect& paintInvalidationRect) | 295 void SVGLayoutSupport::intersectPaintInvalidationRectWithResources(const LayoutO
bject* renderer, FloatRect& paintInvalidationRect) |
296 { | 296 { |
297 ASSERT(renderer); | 297 ASSERT(renderer); |
298 | 298 |
299 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(
renderer); | 299 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(
renderer); |
300 if (!resources) | 300 if (!resources) |
301 return; | 301 return; |
302 | 302 |
303 if (RenderSVGResourceFilter* filter = resources->filter()) | 303 if (LayoutSVGResourceFilter* filter = resources->filter()) |
304 paintInvalidationRect = filter->resourceBoundingBox(renderer); | 304 paintInvalidationRect = filter->resourceBoundingBox(renderer); |
305 | 305 |
306 if (RenderSVGResourceClipper* clipper = resources->clipper()) | 306 if (LayoutSVGResourceClipper* clipper = resources->clipper()) |
307 paintInvalidationRect.intersect(clipper->resourceBoundingBox(renderer)); | 307 paintInvalidationRect.intersect(clipper->resourceBoundingBox(renderer)); |
308 | 308 |
309 if (RenderSVGResourceMasker* masker = resources->masker()) | 309 if (LayoutSVGResourceMasker* masker = resources->masker()) |
310 paintInvalidationRect.intersect(masker->resourceBoundingBox(renderer)); | 310 paintInvalidationRect.intersect(masker->resourceBoundingBox(renderer)); |
311 } | 311 } |
312 | 312 |
313 bool SVGLayoutSupport::filtersForceContainerLayout(LayoutObject* object) | 313 bool SVGLayoutSupport::filtersForceContainerLayout(LayoutObject* object) |
314 { | 314 { |
315 // If any of this container's children need to be laid out, and a filter is
applied | 315 // If any of this container's children need to be laid out, and a filter is
applied |
316 // to the container, we need to issue paint invalidations the entire contain
er. | 316 // to the container, we need to issue paint invalidations the entire contain
er. |
317 if (!object->normalChildNeedsLayout()) | 317 if (!object->normalChildNeedsLayout()) |
318 return false; | 318 return false; |
319 | 319 |
320 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(
object); | 320 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(
object); |
321 if (!resources || !resources->filter()) | 321 if (!resources || !resources->filter()) |
322 return false; | 322 return false; |
323 | 323 |
324 return true; | 324 return true; |
325 } | 325 } |
326 | 326 |
327 bool SVGLayoutSupport::pointInClippingArea(LayoutObject* object, const FloatPoin
t& point) | 327 bool SVGLayoutSupport::pointInClippingArea(LayoutObject* object, const FloatPoin
t& point) |
328 { | 328 { |
329 ASSERT(object); | 329 ASSERT(object); |
330 | 330 |
331 // We just take clippers into account to determine if a point is on the node
. The Specification may | 331 // We just take clippers into account to determine if a point is on the node
. The Specification may |
332 // change later and we also need to check maskers. | 332 // change later and we also need to check maskers. |
333 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(
object); | 333 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObject(
object); |
334 if (!resources) | 334 if (!resources) |
335 return true; | 335 return true; |
336 | 336 |
337 if (RenderSVGResourceClipper* clipper = resources->clipper()) | 337 if (LayoutSVGResourceClipper* clipper = resources->clipper()) |
338 return clipper->hitTestClipContent(object->objectBoundingBox(), point); | 338 return clipper->hitTestClipContent(object->objectBoundingBox(), point); |
339 | 339 |
340 return true; | 340 return true; |
341 } | 341 } |
342 | 342 |
343 bool SVGLayoutSupport::transformToUserSpaceAndCheckClipping(LayoutObject* object
, const AffineTransform& localTransform, const FloatPoint& pointInParent, FloatP
oint& localPoint) | 343 bool SVGLayoutSupport::transformToUserSpaceAndCheckClipping(LayoutObject* object
, const AffineTransform& localTransform, const FloatPoint& pointInParent, FloatP
oint& localPoint) |
344 { | 344 { |
345 if (!localTransform.isInvertible()) | 345 if (!localTransform.isInvertible()) |
346 return false; | 346 return false; |
347 localPoint = localTransform.inverse().mapPoint(pointInParent); | 347 localPoint = localTransform.inverse().mapPoint(pointInParent); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 DashArray dashArray; | 389 DashArray dashArray; |
390 if (!dashes->isEmpty()) { | 390 if (!dashes->isEmpty()) { |
391 SVGLengthList::ConstIterator it = dashes->begin(); | 391 SVGLengthList::ConstIterator it = dashes->begin(); |
392 SVGLengthList::ConstIterator itEnd = dashes->end(); | 392 SVGLengthList::ConstIterator itEnd = dashes->end(); |
393 for (; it != itEnd; ++it) | 393 for (; it != itEnd; ++it) |
394 dashArray.append(it->value(lengthContext)); | 394 dashArray.append(it->value(lengthContext)); |
395 } | 395 } |
396 strokeData.setLineDash(dashArray, svgStyle.strokeDashOffset()->value(lengthC
ontext)); | 396 strokeData.setLineDash(dashArray, svgStyle.strokeDashOffset()->value(lengthC
ontext)); |
397 } | 397 } |
398 | 398 |
399 bool SVGLayoutSupport::updateGraphicsContext(const PaintInfo& paintInfo, Graphic
sContextStateSaver& stateSaver, const LayoutStyle& style, LayoutObject& renderer
, RenderSVGResourceMode resourceMode, const AffineTransform* additionalPaintServ
erTransform) | 399 bool SVGLayoutSupport::updateGraphicsContext(const PaintInfo& paintInfo, Graphic
sContextStateSaver& stateSaver, const LayoutStyle& style, LayoutObject& renderer
, LayoutSVGResourceMode resourceMode, const AffineTransform* additionalPaintServ
erTransform) |
400 { | 400 { |
401 ASSERT(paintInfo.context == stateSaver.context()); | 401 ASSERT(paintInfo.context == stateSaver.context()); |
402 | 402 |
403 GraphicsContext& context = *paintInfo.context; | 403 GraphicsContext& context = *paintInfo.context; |
404 if (paintInfo.isRenderingClipPathAsMaskImage()) { | 404 if (paintInfo.isRenderingClipPathAsMaskImage()) { |
405 if (resourceMode == ApplyToStrokeMode) | 405 if (resourceMode == ApplyToStrokeMode) |
406 return false; | 406 return false; |
407 context.setFillColor(SVGLayoutStyle::initialFillPaintColor()); | 407 context.setFillColor(SVGLayoutStyle::initialFillPaintColor()); |
408 return true; | 408 return true; |
409 } | 409 } |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 | 510 |
511 layer = layer->parent(); | 511 layer = layer->parent(); |
512 } | 512 } |
513 | 513 |
514 ctm.scale(deviceScaleFactor); | 514 ctm.scale(deviceScaleFactor); |
515 | 515 |
516 return narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(),
2)) / 2)); | 516 return narrowPrecisionToFloat(sqrt((pow(ctm.xScale(), 2) + pow(ctm.yScale(),
2)) / 2)); |
517 } | 517 } |
518 | 518 |
519 } | 519 } |
OLD | NEW |