Chromium Code Reviews| Index: Source/core/html/HTMLImageElement.h |
| diff --git a/Source/core/html/HTMLImageElement.h b/Source/core/html/HTMLImageElement.h |
| index 4d1f09a54e4d72c9a0d4de6537b4e07194009800..5c92dc8deb1135688aae58961f956a9a0e7cef9b 100644 |
| --- a/Source/core/html/HTMLImageElement.h |
| +++ b/Source/core/html/HTMLImageElement.h |
| @@ -24,6 +24,7 @@ |
| #ifndef HTMLImageElement_h |
| #define HTMLImageElement_h |
| +#include "core/frame/ViewportChangeNotifier.h" |
| #include "core/html/HTMLElement.h" |
| #include "core/html/HTMLImageLoader.h" |
| #include "core/html/canvas/CanvasImageSource.h" |
| @@ -101,6 +102,36 @@ protected: |
| virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; |
| private: |
| + class ImageViewportChangeListener FINAL : public ViewportChangeListener { |
|
esprehn
2014/07/14 08:39:50
Why is the mediaQuery thing not handling this dire
|
| + public: |
| + static PassRefPtrWillBeRawPtr<ImageViewportChangeListener> create(HTMLImageElement* element) |
| + { |
| + return adoptRefWillBeNoop(new ImageViewportChangeListener(element)); |
| + } |
| + |
| + virtual void viewportChanged() OVERRIDE |
| + { |
| + // Re-selecting the source URL in order to pick a more fitting resource |
| + // And update the image's intrinsic dimensions when the viewport changes. |
| + // Picking of a better fitting resource is UA dependant, not spec required. |
| + m_element->selectSourceURL(ImageLoader::UpdateForce); |
| + } |
| + |
| + explicit ImageViewportChangeListener(HTMLImageElement* element) |
| + : m_element(element) |
| + { |
| + ASSERT(element); |
| + } |
| + |
| + void trace(Visitor* visitor) |
|
sof
2014/07/14 20:38:09
This is an OVERRIDE (of ViewportChangeListener::tr
|
| + { |
| + visitor->trace(m_element); |
| + } |
| + |
| + private: |
| + RawPtrWillBeMember<HTMLImageElement> m_element; |
| + }; |
| + |
| virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } |
| virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; |
| @@ -141,6 +172,11 @@ private: |
| float m_imageDevicePixelRatio; |
| bool m_formWasSetByParser; |
| bool m_elementCreatedByParser; |
| + // Intrinsic sizing is viewport dependant if the 'w' descriptor was used for the picked resource. |
| + bool m_intrinsicSizingViewportDependant; |
| + // Effective size is viewport dependant if the sizes attribute's effective size used v* length units. |
| + bool m_effectiveSizeViewportDependant; |
| + RefPtrWillBeMember<ImageViewportChangeListener> m_viewportListener; |
|
esprehn
2014/07/14 08:39:50
I don't think we want to make every <img> bigger l
|
| }; |
| } //namespace |