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

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

Issue 1174393003: Unify content transformation calculations for SVG clip paths (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 6 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) 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 19 matching lines...) Expand all
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 virtual ~LayoutSVGResourceClipper();
34 34
35 virtual const char* name() const override { return "LayoutSVGResourceClipper "; } 35 virtual const char* name() const override { return "LayoutSVGResourceClipper "; }
36 36
37 virtual void removeAllClientsFromCache(bool markForInvalidation = true) over ride; 37 virtual void removeAllClientsFromCache(bool markForInvalidation = true) over ride;
38 virtual void removeClientFromCache(LayoutObject*, bool markForInvalidation = true) override; 38 virtual void removeClientFromCache(LayoutObject*, bool markForInvalidation = true) override;
39 39
40 AffineTransform calculateContentTransformation(const LayoutObject*, const Fl oatRect& targetBoundingBox);
41
40 FloatRect resourceBoundingBox(const LayoutObject*); 42 FloatRect resourceBoundingBox(const LayoutObject*);
41 43
42 static const LayoutSVGResourceType s_resourceType = ClipperResourceType; 44 static const LayoutSVGResourceType s_resourceType = ClipperResourceType;
43 virtual LayoutSVGResourceType resourceType() const override { return s_resou rceType; } 45 virtual LayoutSVGResourceType resourceType() const override { return s_resou rceType; }
44 46
45 bool hitTestClipContent(const FloatRect&, const FloatPoint&); 47 bool hitTestClipContent(const FloatRect&, const FloatPoint&);
46 48
47 SVGUnitTypes::SVGUnitType clipPathUnits() const { return toSVGClipPathElemen t(element())->clipPathUnits()->currentValue()->enumValue(); } 49 SVGUnitTypes::SVGUnitType clipPathUnits() const { return toSVGClipPathElemen t(element())->clipPathUnits()->currentValue()->enumValue(); }
48 50
49 bool tryPathOnlyClipping(const LayoutObject&, GraphicsContext*, const Affine Transform&, const FloatRect&); 51 bool tryPathOnlyClipping(const LayoutObject&, GraphicsContext*, const Affine Transform& contentTransformation);
50 PassRefPtr<const SkPicture> createContentPicture(AffineTransform&, const Flo atRect&, GraphicsContext*); 52 PassRefPtr<const SkPicture> createContentPicture(const AffineTransform& cont entTransformation, GraphicsContext*);
51 53
52 bool hasCycle() { return m_inClipExpansion; } 54 bool hasCycle() { return m_inClipExpansion; }
53 void beginClipExpansion() { ASSERT(!m_inClipExpansion); m_inClipExpansion = true; } 55 void beginClipExpansion() { ASSERT(!m_inClipExpansion); m_inClipExpansion = true; }
54 void endClipExpansion() { ASSERT(m_inClipExpansion); m_inClipExpansion = fal se; } 56 void endClipExpansion() { ASSERT(m_inClipExpansion); m_inClipExpansion = fal se; }
55 private: 57 private:
56 void calculateClipContentPaintInvalidationRect(); 58 void calculateClipContentPaintInvalidationRect(const LayoutObject*);
57 59
58 RefPtr<const SkPicture> m_clipContentPicture; 60 RefPtr<const SkPicture> m_clipContentPicture;
59 FloatRect m_clipBoundaries; 61 FloatRect m_clipBoundaries;
60 62
61 // Reference cycle detection. 63 // Reference cycle detection.
62 bool m_inClipExpansion; 64 bool m_inClipExpansion;
63 }; 65 };
64 66
65 DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(LayoutSVGResourceClipper, ClipperResourceT ype); 67 DEFINE_LAYOUT_SVG_RESOURCE_TYPE_CASTS(LayoutSVGResourceClipper, ClipperResourceT ype);
66 68
67 } 69 }
68 70
69 #endif 71 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698