OLD | NEW |
---|---|
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 { | 48 { |
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_concreteObjectSize; } |
59 | 59 |
60 bool currentFrameHasSingleSecurityOrigin() const override; | 60 bool currentFrameHasSingleSecurityOrigin() const override; |
61 | 61 |
62 void startAnimation(CatchUpAnimation = CatchUp) override; | 62 void startAnimation(CatchUpAnimation = CatchUp) override; |
63 void stopAnimation() override; | 63 void stopAnimation() override; |
64 void resetAnimation() override; | 64 void resetAnimation() override; |
65 | 65 |
66 // 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 |
67 // and advance the SMIL timeline by one frame. | 67 // and advance the SMIL timeline by one frame. |
68 void advanceAnimationForTesting() override; | 68 void advanceAnimationForTesting() override; |
(...skipping 14 matching lines...) Expand all Loading... | |
83 | 83 |
84 private: | 84 private: |
85 friend class AXLayoutObject; | 85 friend class AXLayoutObject; |
86 friend class SVGImageChromeClient; | 86 friend class SVGImageChromeClient; |
87 friend class SVGImageForContainer; | 87 friend class SVGImageForContainer; |
88 | 88 |
89 ~SVGImage() override; | 89 ~SVGImage() override; |
90 | 90 |
91 String filenameExtension() const override; | 91 String filenameExtension() const override; |
92 | 92 |
93 FloatSize calculateConcreteObjectSize(const FloatSize&) const; | |
pdr.
2016/02/23 04:42:28
Is this FloatSize parameter needed? Can you just r
davve
2016/02/23 08:34:37
I agree is looks a bit silly now, but it's used in
| |
93 IntSize containerSize() const; | 94 IntSize containerSize() const; |
94 bool usesContainerSize() const override { return true; } | 95 bool usesContainerSize() const override { return true; } |
95 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHei ght, FloatSize& intrinsicRatio) override; | 96 void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intrinsicHei ght, FloatSize& intrinsicRatio) override; |
96 | 97 |
97 bool dataChanged(bool allDataReceived) override; | 98 bool dataChanged(bool allDataReceived) override; |
98 | 99 |
99 // FIXME: SVGImages are underreporting decoded sizes and will be unable | 100 // FIXME: SVGImages are underreporting decoded sizes and will be unable |
100 // to prune because these functions are not implemented yet. | 101 // to prune because these functions are not implemented yet. |
101 void destroyDecodedData(bool) override { } | 102 void destroyDecodedData(bool) override { } |
102 | 103 |
103 // FIXME: Implement this to be less conservative. | 104 // FIXME: Implement this to be less conservative. |
104 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override { return false; } | 105 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override { return false; } |
105 | 106 |
106 SVGImage(ImageObserver*); | 107 SVGImage(ImageObserver*); |
107 void draw(SkCanvas*, const SkPaint&, const FloatRect& fromRect, const FloatR ect& toRect, RespectImageOrientationEnum, ImageClampingMode) override; | 108 void draw(SkCanvas*, const SkPaint&, const FloatRect& fromRect, const FloatR ect& toRect, RespectImageOrientationEnum, ImageClampingMode) override; |
108 void drawForContainer(SkCanvas*, const SkPaint&, const FloatSize, float, con st FloatRect&, const FloatRect&, const KURL&); | 109 void drawForContainer(SkCanvas*, const SkPaint&, const FloatSize, float, con st FloatRect&, const FloatRect&, const KURL&); |
109 void drawPatternForContainer(GraphicsContext&, const FloatSize, float, const FloatRect&, const FloatSize&, const FloatPoint&, | 110 void drawPatternForContainer(GraphicsContext&, const FloatSize, float, const FloatRect&, const FloatSize&, const FloatPoint&, |
110 SkXfermode::Mode, const FloatRect&, const FloatSize& repeatSpacing, cons t KURL&); | 111 SkXfermode::Mode, const FloatRect&, const FloatSize& repeatSpacing, cons t KURL&); |
111 PassRefPtr<SkImage> imageForCurrentFrameForContainer(const KURL&); | 112 PassRefPtr<SkImage> imageForCurrentFrameForContainer(const KURL&); |
112 void drawInternal(SkCanvas*, const SkPaint&, const FloatRect& fromRect, cons t FloatRect& toRect, RespectImageOrientationEnum, | 113 void drawInternal(SkCanvas*, const SkPaint&, const FloatRect& fromRect, cons t FloatRect& toRect, RespectImageOrientationEnum, |
113 ImageClampingMode, const KURL&); | 114 ImageClampingMode, const KURL&); |
114 | 115 |
115 OwnPtrWillBePersistent<SVGImageChromeClient> m_chromeClient; | 116 OwnPtrWillBePersistent<SVGImageChromeClient> m_chromeClient; |
116 OwnPtrWillBePersistent<Page> m_page; | 117 OwnPtrWillBePersistent<Page> m_page; |
117 IntSize m_intrinsicSize; | 118 IntSize m_concreteObjectSize; |
pdr.
2016/02/23 04:42:28
Can you add a comment here describing what the con
davve
2016/02/23 08:34:37
I copy a snippet from the spec and provide a link.
| |
118 }; | 119 }; |
119 | 120 |
120 DEFINE_IMAGE_TYPE_CASTS(SVGImage); | 121 DEFINE_IMAGE_TYPE_CASTS(SVGImage); |
121 | 122 |
122 class ImageObserverDisabler { | 123 class ImageObserverDisabler { |
123 STACK_ALLOCATED(); | 124 STACK_ALLOCATED(); |
124 WTF_MAKE_NONCOPYABLE(ImageObserverDisabler); | 125 WTF_MAKE_NONCOPYABLE(ImageObserverDisabler); |
125 public: | 126 public: |
126 ImageObserverDisabler(Image* image) | 127 ImageObserverDisabler(Image* image) |
127 : m_image(image) | 128 : m_image(image) |
128 { | 129 { |
129 m_observer = m_image->imageObserver(); | 130 m_observer = m_image->imageObserver(); |
130 m_image->setImageObserver(0); | 131 m_image->setImageObserver(0); |
131 } | 132 } |
132 | 133 |
133 ~ImageObserverDisabler() | 134 ~ImageObserverDisabler() |
134 { | 135 { |
135 m_image->setImageObserver(m_observer); | 136 m_image->setImageObserver(m_observer); |
136 } | 137 } |
137 private: | 138 private: |
138 Image* m_image; | 139 Image* m_image; |
139 RawPtrWillBeMember<ImageObserver> m_observer; | 140 RawPtrWillBeMember<ImageObserver> m_observer; |
140 }; | 141 }; |
141 | 142 |
142 } // namespace blink | 143 } // namespace blink |
143 | 144 |
144 #endif // SVGImage_h | 145 #endif // SVGImage_h |
OLD | NEW |