| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "core/layout/svg/LayoutSVGResourceContainer.h" | 23 #include "core/layout/svg/LayoutSVGResourceContainer.h" |
| 24 #include "core/svg/SVGClipPathElement.h" | 24 #include "core/svg/SVGClipPathElement.h" |
| 25 | 25 |
| 26 class SkPicture; | 26 class SkPicture; |
| 27 | 27 |
| 28 namespace blink { | 28 namespace blink { |
| 29 | 29 |
| 30 class LayoutSVGResourceClipper final : public LayoutSVGResourceContainer { | 30 class LayoutSVGResourceClipper final : public LayoutSVGResourceContainer { |
| 31 public: | 31 public: |
| 32 explicit LayoutSVGResourceClipper(SVGClipPathElement*); | 32 explicit LayoutSVGResourceClipper(SVGClipPathElement*); |
| 33 virtual ~LayoutSVGResourceClipper(); | 33 ~LayoutSVGResourceClipper() override; |
| 34 | 34 |
| 35 virtual const char* name() const override { return "LayoutSVGResourceClipper
"; } | 35 const char* name() const override { return "LayoutSVGResourceClipper"; } |
| 36 | 36 |
| 37 virtual void removeAllClientsFromCache(bool markForInvalidation = true) over
ride; | 37 void removeAllClientsFromCache(bool markForInvalidation = true) override; |
| 38 virtual void removeClientFromCache(LayoutObject*, bool markForInvalidation =
true) override; | 38 void removeClientFromCache(LayoutObject*, bool markForInvalidation = true) o
verride; |
| 39 | 39 |
| 40 FloatRect resourceBoundingBox(const LayoutObject*); | 40 FloatRect resourceBoundingBox(const LayoutObject*); |
| 41 | 41 |
| 42 static const LayoutSVGResourceType s_resourceType = ClipperResourceType; | 42 static const LayoutSVGResourceType s_resourceType = ClipperResourceType; |
| 43 virtual LayoutSVGResourceType resourceType() const override { return s_resou
rceType; } | 43 LayoutSVGResourceType resourceType() const override { return s_resourceType;
} |
| 44 | 44 |
| 45 bool hitTestClipContent(const FloatRect&, const FloatPoint&); | 45 bool hitTestClipContent(const FloatRect&, const FloatPoint&); |
| 46 | 46 |
| 47 SVGUnitTypes::SVGUnitType clipPathUnits() const { return toSVGClipPathElemen
t(element())->clipPathUnits()->currentValue()->enumValue(); } | 47 SVGUnitTypes::SVGUnitType clipPathUnits() const { return toSVGClipPathElemen
t(element())->clipPathUnits()->currentValue()->enumValue(); } |
| 48 | 48 |
| 49 bool tryPathOnlyClipping(const LayoutObject&, GraphicsContext*, const Affine
Transform&, const FloatRect&); | 49 bool tryPathOnlyClipping(const LayoutObject&, GraphicsContext*, const Affine
Transform&, const FloatRect&); |
| 50 PassRefPtr<const SkPicture> createContentPicture(AffineTransform&, const Flo
atRect&, GraphicsContext*); | 50 PassRefPtr<const SkPicture> createContentPicture(AffineTransform&, const Flo
atRect&, GraphicsContext*); |
| 51 | 51 |
| 52 bool hasCycle() { return m_inClipExpansion; } | 52 bool hasCycle() { return m_inClipExpansion; } |
| 53 void beginClipExpansion() { ASSERT(!m_inClipExpansion); m_inClipExpansion =
true; } | 53 void beginClipExpansion() { ASSERT(!m_inClipExpansion); m_inClipExpansion =
true; } |
| 54 void endClipExpansion() { ASSERT(m_inClipExpansion); m_inClipExpansion = fal
se; } | 54 void endClipExpansion() { ASSERT(m_inClipExpansion); m_inClipExpansion = fal
se; } |
| 55 private: | 55 private: |
| 56 void calculateClipContentPaintInvalidationRect(); | 56 void calculateClipContentPaintInvalidationRect(); |
| 57 | 57 |
| 58 RefPtr<const SkPicture> m_clipContentPicture; | 58 RefPtr<const SkPicture> m_clipContentPicture; |
| 59 FloatRect m_clipBoundaries; | 59 FloatRect m_clipBoundaries; |
| 60 | 60 |
| 61 // Reference cycle detection. | 61 // Reference cycle detection. |
| 62 bool m_inClipExpansion; | 62 bool m_inClipExpansion; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(LayoutSVGResourceClipper, ClipperResourceT
ype); | 65 DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(LayoutSVGResourceClipper, ClipperResourceT
ype); |
| 66 | 66 |
| 67 } | 67 } |
| 68 | 68 |
| 69 #endif | 69 #endif |
| OLD | NEW |