Chromium Code Reviews| 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: public ViewportChangeListener { | |
|
haraken
2014/07/11 06:10:21
Add FINAL.
| |
| 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 ImageViewportChangeListener(HTMLImageElement* element) | |
|
haraken
2014/07/11 06:10:21
Add explicit.
| |
| 121 : m_element(element) | |
| 122 { | |
| 123 ASSERT(element); | |
| 124 } | |
| 125 | |
| 126 private: | |
| 127 HTMLImageElement* m_element; | |
|
haraken
2014/07/11 06:10:21
I guess this should be RawPtrWillBeMember<HTMLImag
| |
| 128 }; | |
| 129 | |
| 104 virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } | 130 virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } |
| 105 | 131 |
| 106 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; | 132 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; |
| 107 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; | 133 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; |
| 108 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons t AtomicString&, MutableStylePropertySet*) OVERRIDE; | 134 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons t AtomicString&, MutableStylePropertySet*) OVERRIDE; |
| 109 | 135 |
| 110 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; | 136 virtual void attach(const AttachContext& = AttachContext()) OVERRIDE; |
| 111 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; | 137 virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; |
| 112 | 138 |
| 113 virtual bool canStartSelection() const OVERRIDE; | 139 virtual bool canStartSelection() const OVERRIDE; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 134 #if ENABLE(OILPAN) | 160 #if ENABLE(OILPAN) |
| 135 Member<HTMLFormElement> m_form; | 161 Member<HTMLFormElement> m_form; |
| 136 #else | 162 #else |
| 137 WeakPtr<HTMLFormElement> m_form; | 163 WeakPtr<HTMLFormElement> m_form; |
| 138 #endif | 164 #endif |
| 139 CompositeOperator m_compositeOperator; | 165 CompositeOperator m_compositeOperator; |
| 140 AtomicString m_bestFitImageURL; | 166 AtomicString m_bestFitImageURL; |
| 141 float m_imageDevicePixelRatio; | 167 float m_imageDevicePixelRatio; |
| 142 bool m_formWasSetByParser; | 168 bool m_formWasSetByParser; |
| 143 bool m_elementCreatedByParser; | 169 bool m_elementCreatedByParser; |
| 170 // Intrinsic sizing is viewport dependant if the 'w' descriptor was used for the picked resource. | |
| 171 bool m_intrinsicSizingViewportDependant; | |
| 172 // Effective size is viewport dependant if the sizes attribute's effective s ize used v* length units. | |
| 173 bool m_effectiveSizeViewportDependant; | |
| 174 RefPtrWillBeMember<ImageViewportChangeListener> m_viewportListener; | |
| 144 }; | 175 }; |
| 145 | 176 |
| 146 } //namespace | 177 } //namespace |
| 147 | 178 |
| 148 #endif | 179 #endif |
| OLD | NEW |