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

Side by Side Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.h

Issue 1458083002: Support fragment URLs for more kinds of SVG images (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplification wasn't simple enough Created 5 years, 1 month 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) 2006 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2006 Eric Seidel <eric@webkit.org>
3 * Copyright (C) 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2009 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 return adoptRef(new SVGImage(observer)); 49 return adoptRef(new SVGImage(observer));
50 } 50 }
51 51
52 static bool isInSVGImage(const Node*); 52 static bool isInSVGImage(const Node*);
53 53
54 LayoutBox* embeddedContentBox() const; 54 LayoutBox* embeddedContentBox() const;
55 55
56 bool isSVGImage() const override { return true; } 56 bool isSVGImage() const override { return true; }
57 bool isTextureBacked() override { return false; } 57 bool isTextureBacked() override { return false; }
58 IntSize size() const override { return m_intrinsicSize; } 58 IntSize size() const override { return m_intrinsicSize; }
59 void setURL(const KURL& url) { m_url = url; }
60 59
61 bool currentFrameHasSingleSecurityOrigin() const override; 60 bool currentFrameHasSingleSecurityOrigin() const override;
62 61
63 void startAnimation(CatchUpAnimation = CatchUp) override; 62 void startAnimation(CatchUpAnimation = CatchUp) override;
64 void stopAnimation() override; 63 void stopAnimation() override;
65 void resetAnimation() override; 64 void resetAnimation() override;
66 65
67 // Advances an animated image. This will trigger an animation update for CSS 66 // Advances an animated image. This will trigger an animation update for CSS
68 // and advance the SMIL timeline by one frame. 67 // and advance the SMIL timeline by one frame.
69 void advanceAnimationForTesting() override; 68 void advanceAnimationForTesting() override;
(...skipping 29 matching lines...) Expand all
99 98
100 // FIXME: SVGImages are underreporting decoded sizes and will be unable 99 // FIXME: SVGImages are underreporting decoded sizes and will be unable
101 // to prune because these functions are not implemented yet. 100 // to prune because these functions are not implemented yet.
102 void destroyDecodedData(bool) override { } 101 void destroyDecodedData(bool) override { }
103 102
104 // FIXME: Implement this to be less conservative. 103 // FIXME: Implement this to be less conservative.
105 bool currentFrameKnownToBeOpaque() override { return false; } 104 bool currentFrameKnownToBeOpaque() override { return false; }
106 105
107 SVGImage(ImageObserver*); 106 SVGImage(ImageObserver*);
108 void draw(SkCanvas*, const SkPaint&, const FloatRect& fromRect, const FloatR ect& toRect, RespectImageOrientationEnum, ImageClampingMode) override; 107 void draw(SkCanvas*, const SkPaint&, const FloatRect& fromRect, const FloatR ect& toRect, RespectImageOrientationEnum, ImageClampingMode) override;
109 void drawForContainer(SkCanvas*, const SkPaint&, const FloatSize, float, con st FloatRect&, const FloatRect&); 108 void drawForContainer(SkCanvas*, const SkPaint&, const FloatSize, float, con st FloatRect&, const FloatRect&, const KURL&);
110 void drawPatternForContainer(GraphicsContext*, const FloatSize, float, const FloatRect&, const FloatSize&, const FloatPoint&, 109 void drawPatternForContainer(GraphicsContext*, const FloatSize, float, const FloatRect&, const FloatSize&, const FloatPoint&,
111 SkXfermode::Mode, const FloatRect&, const IntSize& repeatSpacing); 110 SkXfermode::Mode, const FloatRect&, const IntSize& repeatSpacing, const KURL&);
111 void drawInternal(SkCanvas*, const SkPaint&, const FloatRect& fromRect, cons t FloatRect& toRect, RespectImageOrientationEnum,
112 ImageClampingMode, const KURL&);
112 113
113 OwnPtrWillBePersistent<SVGImageChromeClient> m_chromeClient; 114 OwnPtrWillBePersistent<SVGImageChromeClient> m_chromeClient;
114 OwnPtrWillBePersistent<Page> m_page; 115 OwnPtrWillBePersistent<Page> m_page;
115 IntSize m_intrinsicSize; 116 IntSize m_intrinsicSize;
116 KURL m_url;
117 }; 117 };
118 118
119 DEFINE_IMAGE_TYPE_CASTS(SVGImage); 119 DEFINE_IMAGE_TYPE_CASTS(SVGImage);
120 120
121 class ImageObserverDisabler { 121 class ImageObserverDisabler {
122 STACK_ALLOCATED(); 122 STACK_ALLOCATED();
123 WTF_MAKE_NONCOPYABLE(ImageObserverDisabler); 123 WTF_MAKE_NONCOPYABLE(ImageObserverDisabler);
124 public: 124 public:
125 ImageObserverDisabler(Image* image) 125 ImageObserverDisabler(Image* image)
126 : m_image(image) 126 : m_image(image)
127 { 127 {
128 m_observer = m_image->imageObserver(); 128 m_observer = m_image->imageObserver();
129 m_image->setImageObserver(0); 129 m_image->setImageObserver(0);
130 } 130 }
131 131
132 ~ImageObserverDisabler() 132 ~ImageObserverDisabler()
133 { 133 {
134 m_image->setImageObserver(m_observer); 134 m_image->setImageObserver(m_observer);
135 } 135 }
136 private: 136 private:
137 Image* m_image; 137 Image* m_image;
138 ImageObserver* m_observer; 138 ImageObserver* m_observer;
139 }; 139 };
140 140
141 } 141 }
142 142
143 #endif // SVGImage_h 143 #endif // SVGImage_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698