OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2004, 2008, 2010 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2008, 2010 Apple Inc. All rights reserved. |
5 * Copyright (C) 2010 Google Inc. All rights reserved. | 5 * Copyright (C) 2010 Google Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 * | 21 * |
22 */ | 22 */ |
23 | 23 |
24 #ifndef HTMLImageElement_h | 24 #ifndef HTMLImageElement_h |
25 #define HTMLImageElement_h | 25 #define HTMLImageElement_h |
26 | 26 |
27 #include "core/frame/ViewportChangeNotifier.h" | |
27 #include "core/html/HTMLElement.h" | 28 #include "core/html/HTMLElement.h" |
28 #include "core/html/HTMLImageLoader.h" | 29 #include "core/html/HTMLImageLoader.h" |
29 #include "core/html/canvas/CanvasImageSource.h" | 30 #include "core/html/canvas/CanvasImageSource.h" |
30 #include "platform/graphics/GraphicsTypes.h" | 31 #include "platform/graphics/GraphicsTypes.h" |
31 #include "wtf/WeakPtr.h" | 32 #include "wtf/WeakPtr.h" |
32 | 33 |
33 namespace WebCore { | 34 namespace WebCore { |
34 | 35 |
35 class HTMLFormElement; | 36 class HTMLFormElement; |
36 class ImageCandidate; | 37 class ImageCandidate; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 virtual const KURL& sourceURL() const OVERRIDE; | 95 virtual const KURL& sourceURL() const OVERRIDE; |
95 | 96 |
96 // public so that HTMLPictureElement can call this as well. | 97 // public so that HTMLPictureElement can call this as well. |
97 void selectSourceURL(ImageLoader::UpdateFromElementBehavior); | 98 void selectSourceURL(ImageLoader::UpdateFromElementBehavior); |
98 protected: | 99 protected: |
99 explicit HTMLImageElement(Document&, HTMLFormElement* = 0, bool createdByPar ser = false); | 100 explicit HTMLImageElement(Document&, HTMLFormElement* = 0, bool createdByPar ser = false); |
100 | 101 |
101 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; | 102 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; |
102 | 103 |
103 private: | 104 private: |
105 class ImageViewportChangeListener FINAL : public ViewportChangeListener { | |
esprehn
2014/07/14 08:39:50
Why is the mediaQuery thing not handling this dire
| |
106 public: | |
107 static PassRefPtrWillBeRawPtr<ImageViewportChangeListener> create(HTMLIm ageElement* element) | |
108 { | |
109 return adoptRefWillBeNoop(new ImageViewportChangeListener(element)); | |
110 } | |
111 | |
112 virtual void viewportChanged() OVERRIDE | |
113 { | |
114 // Re-selecting the source URL in order to pick a more fitting resou rce | |
115 // And update the image's intrinsic dimensions when the viewport cha nges. | |
116 // Picking of a better fitting resource is UA dependant, not spec re quired. | |
117 m_element->selectSourceURL(ImageLoader::UpdateForce); | |
118 } | |
119 | |
120 explicit ImageViewportChangeListener(HTMLImageElement* element) | |
121 : m_element(element) | |
122 { | |
123 ASSERT(element); | |
124 } | |
125 | |
126 void trace(Visitor* visitor) | |
sof
2014/07/14 20:38:09
This is an OVERRIDE (of ViewportChangeListener::tr
| |
127 { | |
128 visitor->trace(m_element); | |
129 } | |
130 | |
131 private: | |
132 RawPtrWillBeMember<HTMLImageElement> m_element; | |
133 }; | |
134 | |
104 virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } | 135 virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } |
105 | 136 |
106 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; | 137 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; |
107 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; | 138 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; |
108 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons t AtomicString&, MutableStylePropertySet*) OVERRIDE; | 139 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons t AtomicString&, MutableStylePropertySet*) OVERRIDE; |
109 | 140 |
110 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; | 141 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; |
111 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; | 142 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; |
112 | 143 |
113 virtual bool canStartSelection() const OVERRIDE; | 144 virtual bool canStartSelection() const OVERRIDE; |
(...skipping 20 matching lines...) Expand all Loading... | |
134 #if ENABLE(OILPAN) | 165 #if ENABLE(OILPAN) |
135 Member<HTMLFormElement> m_form; | 166 Member<HTMLFormElement> m_form; |
136 #else | 167 #else |
137 WeakPtr<HTMLFormElement> m_form; | 168 WeakPtr<HTMLFormElement> m_form; |
138 #endif | 169 #endif |
139 CompositeOperator m_compositeOperator; | 170 CompositeOperator m_compositeOperator; |
140 AtomicString m_bestFitImageURL; | 171 AtomicString m_bestFitImageURL; |
141 float m_imageDevicePixelRatio; | 172 float m_imageDevicePixelRatio; |
142 bool m_formWasSetByParser; | 173 bool m_formWasSetByParser; |
143 bool m_elementCreatedByParser; | 174 bool m_elementCreatedByParser; |
175 // Intrinsic sizing is viewport dependant if the 'w' descriptor was used for the picked resource. | |
176 bool m_intrinsicSizingViewportDependant; | |
177 // Effective size is viewport dependant if the sizes attribute's effective s ize used v* length units. | |
178 bool m_effectiveSizeViewportDependant; | |
179 RefPtrWillBeMember<ImageViewportChangeListener> m_viewportListener; | |
esprehn
2014/07/14 08:39:50
I don't think we want to make every <img> bigger l
| |
144 }; | 180 }; |
145 | 181 |
146 } //namespace | 182 } //namespace |
147 | 183 |
148 #endif | 184 #endif |
OLD | NEW |