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

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

Issue 1219493005: Cleanups to viewport-handling and image invalidation in LayoutSVGImage (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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) 2006 Alexander Kellett <lypanov@kde.org> 2 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2007 Rob Buis <buis@kde.org>
5 * Copyright (C) 2009 Google, Inc. 5 * Copyright (C) 2009 Google, Inc.
6 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> 6 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 20 matching lines...) Expand all
31 namespace blink { 31 namespace blink {
32 32
33 class LayoutImageResource; 33 class LayoutImageResource;
34 class SVGImageElement; 34 class SVGImageElement;
35 35
36 class LayoutSVGImage final : public LayoutSVGModelObject { 36 class LayoutSVGImage final : public LayoutSVGModelObject {
37 public: 37 public:
38 explicit LayoutSVGImage(SVGImageElement*); 38 explicit LayoutSVGImage(SVGImageElement*);
39 virtual ~LayoutSVGImage(); 39 virtual ~LayoutSVGImage();
40 40
41 bool updateImageViewport();
42 virtual void setNeedsBoundariesUpdate() override { m_needsBoundariesUpdate = true; } 41 virtual void setNeedsBoundariesUpdate() override { m_needsBoundariesUpdate = true; }
43 virtual void setNeedsTransformUpdate() override { m_needsTransformUpdate = t rue; } 42 virtual void setNeedsTransformUpdate() override { m_needsTransformUpdate = t rue; }
44 43
45 LayoutImageResource* imageResource() { return m_imageResource.get(); } 44 LayoutImageResource* imageResource() { return m_imageResource.get(); }
46 45
47 virtual const AffineTransform& localToParentTransform() const override { ret urn m_localTransform; } 46 virtual const AffineTransform& localToParentTransform() const override { ret urn m_localTransform; }
48 RefPtr<const SkPicture>& bufferedForeground() { return m_bufferedForeground; } 47 RefPtr<const SkPicture>& bufferedForeground() { return m_bufferedForeground; }
49 48
50 virtual FloatRect objectBoundingBox() const override { return m_objectBoundi ngBox; } 49 virtual FloatRect objectBoundingBox() const override { return m_objectBoundi ngBox; }
51 virtual bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectSVGImage || LayoutSVGModelObject::isOfType(type); } 50 virtual bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectSVGImage || LayoutSVGModelObject::isOfType(type); }
52 51
53 virtual const char* name() const override { return "LayoutSVGImage"; } 52 virtual const char* name() const override { return "LayoutSVGImage"; }
54 53
55 protected: 54 protected:
56 virtual void willBeDestroyed() override; 55 virtual void willBeDestroyed() override;
57 56
58 private: 57 private:
59 virtual FloatRect strokeBoundingBox() const override { return m_objectBoundi ngBox; } 58 virtual FloatRect strokeBoundingBox() const override { return m_objectBoundi ngBox; }
60 59
61 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& addit ionalOffset) const override; 60 virtual void addFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& addit ionalOffset) const override;
62 61
63 virtual void imageChanged(WrappedImagePtr, const IntRect* = nullptr) overrid e; 62 virtual void imageChanged(WrappedImagePtr, const IntRect* = nullptr) overrid e;
64 63
65 virtual void layout() override; 64 virtual void layout() override;
66 virtual void paint(const PaintInfo&, const LayoutPoint&) override; 65 virtual void paint(const PaintInfo&, const LayoutPoint&) override;
67 66
67 void updateBoundingBox();
68 void updateImageContainerSize();
68 FloatSize computeImageViewportSize(ImageResource&) const; 69 FloatSize computeImageViewportSize(ImageResource&) const;
69 70
70 virtual bool nodeAtFloatPoint(HitTestResult&, const FloatPoint& pointInParen t, HitTestAction) override; 71 virtual bool nodeAtFloatPoint(HitTestResult&, const FloatPoint& pointInParen t, HitTestAction) override;
71 72
72 virtual AffineTransform localTransform() const override { return m_localTran sform; } 73 virtual AffineTransform localTransform() const override { return m_localTran sform; }
73 74
74 bool m_needsBoundariesUpdate : 1; 75 bool m_needsBoundariesUpdate : 1;
75 bool m_needsTransformUpdate : 1; 76 bool m_needsTransformUpdate : 1;
76 AffineTransform m_localTransform; 77 AffineTransform m_localTransform;
77 FloatRect m_objectBoundingBox; 78 FloatRect m_objectBoundingBox;
78 OwnPtr<LayoutImageResource> m_imageResource; 79 OwnPtr<LayoutImageResource> m_imageResource;
79 80
80 RefPtr<const SkPicture> m_bufferedForeground; 81 RefPtr<const SkPicture> m_bufferedForeground;
81 }; 82 };
82 83
83 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGImage, isSVGImage()); 84 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutSVGImage, isSVGImage());
84 85
85 } // namespace blink 86 } // namespace blink
86 87
87 #endif // LayoutSVGImage_h 88 #endif // LayoutSVGImage_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/layout/svg/LayoutSVGImage.cpp » ('j') | Source/core/layout/svg/LayoutSVGImage.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698