| 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. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 DEFINE_WRAPPERTYPEINFO(); | 43 DEFINE_WRAPPERTYPEINFO(); |
| 44 public: | 44 public: |
| 45 class ViewportChangeListener; | 45 class ViewportChangeListener; |
| 46 | 46 |
| 47 static PassRefPtrWillBeRawPtr<HTMLImageElement> create(Document&); | 47 static PassRefPtrWillBeRawPtr<HTMLImageElement> create(Document&); |
| 48 static PassRefPtrWillBeRawPtr<HTMLImageElement> create(Document&, HTMLFormEl
ement*, bool createdByParser); | 48 static PassRefPtrWillBeRawPtr<HTMLImageElement> create(Document&, HTMLFormEl
ement*, bool createdByParser); |
| 49 static PassRefPtrWillBeRawPtr<HTMLImageElement> createForJSConstructor(Docum
ent&); | 49 static PassRefPtrWillBeRawPtr<HTMLImageElement> createForJSConstructor(Docum
ent&); |
| 50 static PassRefPtrWillBeRawPtr<HTMLImageElement> createForJSConstructor(Docum
ent&, int width); | 50 static PassRefPtrWillBeRawPtr<HTMLImageElement> createForJSConstructor(Docum
ent&, int width); |
| 51 static PassRefPtrWillBeRawPtr<HTMLImageElement> createForJSConstructor(Docum
ent&, int width, int height); | 51 static PassRefPtrWillBeRawPtr<HTMLImageElement> createForJSConstructor(Docum
ent&, int width, int height); |
| 52 | 52 |
| 53 virtual ~HTMLImageElement(); | 53 ~HTMLImageElement() override; |
| 54 DECLARE_VIRTUAL_TRACE(); | 54 DECLARE_VIRTUAL_TRACE(); |
| 55 | 55 |
| 56 int width(bool ignorePendingStylesheets = false); | 56 int width(bool ignorePendingStylesheets = false); |
| 57 int height(bool ignorePendingStylesheets = false); | 57 int height(bool ignorePendingStylesheets = false); |
| 58 | 58 |
| 59 int naturalWidth() const; | 59 int naturalWidth() const; |
| 60 int naturalHeight() const; | 60 int naturalHeight() const; |
| 61 const String& currentSrc() const; | 61 const String& currentSrc() const; |
| 62 | 62 |
| 63 bool isServerMap() const; | 63 bool isServerMap() const; |
| 64 | 64 |
| 65 virtual String altText() const override final; | 65 String altText() const final; |
| 66 | 66 |
| 67 ImageResource* cachedImage() const { return imageLoader().image(); } | 67 ImageResource* cachedImage() const { return imageLoader().image(); } |
| 68 void setImageResource(ImageResource* i) { imageLoader().setImage(i); }; | 68 void setImageResource(ImageResource* i) { imageLoader().setImage(i); }; |
| 69 | 69 |
| 70 void setLoadingImageDocument() { imageLoader().setLoadingImageDocument(); } | 70 void setLoadingImageDocument() { imageLoader().setLoadingImageDocument(); } |
| 71 | 71 |
| 72 void setHeight(int); | 72 void setHeight(int); |
| 73 | 73 |
| 74 KURL src() const; | 74 KURL src() const; |
| 75 void setSrc(const String&); | 75 void setSrc(const String&); |
| 76 | 76 |
| 77 void setWidth(int); | 77 void setWidth(int); |
| 78 | 78 |
| 79 int x() const; | 79 int x() const; |
| 80 int y() const; | 80 int y() const; |
| 81 | 81 |
| 82 bool complete() const; | 82 bool complete() const; |
| 83 | 83 |
| 84 bool hasPendingActivity() const { return imageLoader().hasPendingActivity();
} | 84 bool hasPendingActivity() const { return imageLoader().hasPendingActivity();
} |
| 85 | 85 |
| 86 virtual bool canContainRangeEndPoint() const override { return false; } | 86 bool canContainRangeEndPoint() const override { return false; } |
| 87 | 87 |
| 88 void addClient(ImageLoaderClient* client) { imageLoader().addClient(client);
} | 88 void addClient(ImageLoaderClient* client) { imageLoader().addClient(client);
} |
| 89 void removeClient(ImageLoaderClient* client) { imageLoader().removeClient(cl
ient); } | 89 void removeClient(ImageLoaderClient* client) { imageLoader().removeClient(cl
ient); } |
| 90 | 90 |
| 91 virtual const AtomicString imageSourceURL() const override; | 91 const AtomicString imageSourceURL() const override; |
| 92 | 92 |
| 93 virtual HTMLFormElement* formOwner() const override; | 93 HTMLFormElement* formOwner() const override; |
| 94 void formRemovedFromTree(const Node& formRoot); | 94 void formRemovedFromTree(const Node& formRoot); |
| 95 virtual void ensureFallbackContent(); | 95 virtual void ensureFallbackContent(); |
| 96 virtual void ensurePrimaryContent(); | 96 virtual void ensurePrimaryContent(); |
| 97 | 97 |
| 98 // CanvasImageSource implementation | 98 // CanvasImageSource implementation |
| 99 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceIma
geStatus*) const override; | 99 PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceImageStatus
*) const override; |
| 100 virtual bool wouldTaintOrigin(SecurityOrigin*) const override; | 100 bool wouldTaintOrigin(SecurityOrigin*) const override; |
| 101 virtual FloatSize elementSize() const override; | 101 FloatSize elementSize() const override; |
| 102 virtual FloatSize defaultDestinationSize() const override; | 102 FloatSize defaultDestinationSize() const override; |
| 103 virtual const KURL& sourceURL() const override; | 103 const KURL& sourceURL() const override; |
| 104 virtual bool isOpaque() const override; | 104 bool isOpaque() const override; |
| 105 | 105 |
| 106 // public so that HTMLPictureElement can call this as well. | 106 // public so that HTMLPictureElement can call this as well. |
| 107 void selectSourceURL(ImageLoader::UpdateFromElementBehavior); | 107 void selectSourceURL(ImageLoader::UpdateFromElementBehavior); |
| 108 void reattachFallbackContent(); | 108 void reattachFallbackContent(); |
| 109 void setUseFallbackContent(); | 109 void setUseFallbackContent(); |
| 110 void setIsFallbackImage() { m_isFallbackImage = true; } | 110 void setIsFallbackImage() { m_isFallbackImage = true; } |
| 111 | 111 |
| 112 FetchRequest::ResourceWidth resourceWidth(); | 112 FetchRequest::ResourceWidth resourceWidth(); |
| 113 float sourceSize(Element&); | 113 float sourceSize(Element&); |
| 114 | 114 |
| 115 void forceReload() const; | 115 void forceReload() const; |
| 116 | 116 |
| 117 protected: | 117 protected: |
| 118 explicit HTMLImageElement(Document&, HTMLFormElement* = 0, bool createdByPar
ser = false); | 118 explicit HTMLImageElement(Document&, HTMLFormElement* = 0, bool createdByPar
ser = false); |
| 119 | 119 |
| 120 virtual void didMoveToNewDocument(Document& oldDocument) override; | 120 void didMoveToNewDocument(Document& oldDocument) override; |
| 121 virtual bool useFallbackContent() const { return m_useFallbackContent; } | 121 virtual bool useFallbackContent() const { return m_useFallbackContent; } |
| 122 | 122 |
| 123 virtual void didAddUserAgentShadowRoot(ShadowRoot&) override; | 123 void didAddUserAgentShadowRoot(ShadowRoot&) override; |
| 124 virtual PassRefPtr<ComputedStyle> customStyleForLayoutObject() override; | 124 PassRefPtr<ComputedStyle> customStyleForLayoutObject() override; |
| 125 private: | 125 private: |
| 126 virtual bool areAuthorShadowsAllowed() const override { return false; } | 126 bool areAuthorShadowsAllowed() const override { return false; } |
| 127 | 127 |
| 128 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr
ide; | 128 void parseAttribute(const QualifiedName&, const AtomicString&) override; |
| 129 virtual bool isPresentationAttribute(const QualifiedName&) const override; | 129 bool isPresentationAttribute(const QualifiedName&) const override; |
| 130 virtual void collectStyleForPresentationAttribute(const QualifiedName&, cons
t AtomicString&, MutableStylePropertySet*) override; | 130 void collectStyleForPresentationAttribute(const QualifiedName&, const Atomic
String&, MutableStylePropertySet*) override; |
| 131 | 131 |
| 132 virtual void attach(const AttachContext& = AttachContext()) override; | 132 void attach(const AttachContext& = AttachContext()) override; |
| 133 virtual LayoutObject* createLayoutObject(const ComputedStyle&) override; | 133 LayoutObject* createLayoutObject(const ComputedStyle&) override; |
| 134 | 134 |
| 135 virtual bool canStartSelection() const override { return false; } | 135 bool canStartSelection() const override { return false; } |
| 136 | 136 |
| 137 virtual bool isURLAttribute(const Attribute&) const override; | 137 bool isURLAttribute(const Attribute&) const override; |
| 138 virtual bool hasLegalLinkAttribute(const QualifiedName&) const override; | 138 bool hasLegalLinkAttribute(const QualifiedName&) const override; |
| 139 virtual const QualifiedName& subResourceAttributeName() const override; | 139 const QualifiedName& subResourceAttributeName() const override; |
| 140 | 140 |
| 141 virtual bool draggable() const override; | 141 bool draggable() const override; |
| 142 | 142 |
| 143 virtual InsertionNotificationRequest insertedInto(ContainerNode*) override; | 143 InsertionNotificationRequest insertedInto(ContainerNode*) override; |
| 144 virtual void removedFrom(ContainerNode*) override; | 144 void removedFrom(ContainerNode*) override; |
| 145 virtual bool shouldRegisterAsNamedItem() const override { return true; } | 145 bool shouldRegisterAsNamedItem() const override { return true; } |
| 146 virtual bool shouldRegisterAsExtraNamedItem() const override { return true;
} | 146 bool shouldRegisterAsExtraNamedItem() const override { return true; } |
| 147 virtual bool isInteractiveContent() const override; | 147 bool isInteractiveContent() const override; |
| 148 virtual Image* imageContents() override; | 148 Image* imageContents() override; |
| 149 | 149 |
| 150 void resetFormOwner(); | 150 void resetFormOwner(); |
| 151 ImageCandidate findBestFitImageFromPictureParent(); | 151 ImageCandidate findBestFitImageFromPictureParent(); |
| 152 void setBestFitURLAndDPRFromImageCandidate(const ImageCandidate&); | 152 void setBestFitURLAndDPRFromImageCandidate(const ImageCandidate&); |
| 153 HTMLImageLoader& imageLoader() const { return *m_imageLoader; } | 153 HTMLImageLoader& imageLoader() const { return *m_imageLoader; } |
| 154 void notifyViewportChanged(); | 154 void notifyViewportChanged(); |
| 155 void createMediaQueryListIfDoesNotExist(); | 155 void createMediaQueryListIfDoesNotExist(); |
| 156 | 156 |
| 157 OwnPtrWillBeMember<HTMLImageLoader> m_imageLoader; | 157 OwnPtrWillBeMember<HTMLImageLoader> m_imageLoader; |
| 158 RefPtrWillBeMember<ViewportChangeListener> m_listener; | 158 RefPtrWillBeMember<ViewportChangeListener> m_listener; |
| 159 #if ENABLE(OILPAN) | 159 #if ENABLE(OILPAN) |
| 160 Member<HTMLFormElement> m_form; | 160 Member<HTMLFormElement> m_form; |
| 161 #else | 161 #else |
| 162 WeakPtr<HTMLFormElement> m_form; | 162 WeakPtr<HTMLFormElement> m_form; |
| 163 #endif | 163 #endif |
| 164 AtomicString m_bestFitImageURL; | 164 AtomicString m_bestFitImageURL; |
| 165 float m_imageDevicePixelRatio; | 165 float m_imageDevicePixelRatio; |
| 166 unsigned m_formWasSetByParser : 1; | 166 unsigned m_formWasSetByParser : 1; |
| 167 unsigned m_elementCreatedByParser : 1; | 167 unsigned m_elementCreatedByParser : 1; |
| 168 // Intrinsic sizing is viewport dependant if the 'w' descriptor was used for
the picked resource. | 168 // Intrinsic sizing is viewport dependant if the 'w' descriptor was used for
the picked resource. |
| 169 unsigned m_intrinsicSizingViewportDependant : 1; | 169 unsigned m_intrinsicSizingViewportDependant : 1; |
| 170 unsigned m_useFallbackContent : 1; | 170 unsigned m_useFallbackContent : 1; |
| 171 unsigned m_isFallbackImage : 1; | 171 unsigned m_isFallbackImage : 1; |
| 172 }; | 172 }; |
| 173 | 173 |
| 174 } // namespace blink | 174 } // namespace blink |
| 175 | 175 |
| 176 #endif // HTMLImageElement_h | 176 #endif // HTMLImageElement_h |
| OLD | NEW |