Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2352)

Side by Side Diff: Source/core/html/HTMLImageElement.h

Issue 181693006: Refactoring source image usage in CanvasRenderingContext2D (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: applied last corrections Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLCanvasElement.idl ('k') | Source/core/html/HTMLImageElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/html/HTMLElement.h" 27 #include "core/html/HTMLElement.h"
28 #include "core/html/HTMLImageLoader.h" 28 #include "core/html/HTMLImageLoader.h"
29 #include "core/html/canvas/CanvasImageSource.h"
29 #include "platform/graphics/GraphicsTypes.h" 30 #include "platform/graphics/GraphicsTypes.h"
30 #include "wtf/WeakPtr.h" 31 #include "wtf/WeakPtr.h"
31 32
32 namespace WebCore { 33 namespace WebCore {
33 34
34 class HTMLFormElement; 35 class HTMLFormElement;
35 36
36 class HTMLImageElement FINAL : public HTMLElement { 37 class HTMLImageElement FINAL : public HTMLElement, public CanvasImageSource {
37 public: 38 public:
38 static PassRefPtr<HTMLImageElement> create(Document&); 39 static PassRefPtr<HTMLImageElement> create(Document&);
39 static PassRefPtr<HTMLImageElement> create(Document&, HTMLFormElement*); 40 static PassRefPtr<HTMLImageElement> create(Document&, HTMLFormElement*);
40 static PassRefPtr<HTMLImageElement> createForJSConstructor(Document&, int wi dth, int height); 41 static PassRefPtr<HTMLImageElement> createForJSConstructor(Document&, int wi dth, int height);
41 42
42 virtual ~HTMLImageElement(); 43 virtual ~HTMLImageElement();
43 44
44 int width(bool ignorePendingStylesheets = false); 45 int width(bool ignorePendingStylesheets = false);
45 int height(bool ignorePendingStylesheets = false); 46 int height(bool ignorePendingStylesheets = false);
46 47
(...skipping 30 matching lines...) Expand all
77 virtual bool canContainRangeEndPoint() const OVERRIDE { return false; } 78 virtual bool canContainRangeEndPoint() const OVERRIDE { return false; }
78 79
79 void addClient(ImageLoaderClient* client) { m_imageLoader.addClient(client); } 80 void addClient(ImageLoaderClient* client) { m_imageLoader.addClient(client); }
80 void removeClient(ImageLoaderClient* client) { m_imageLoader.removeClient(cl ient); } 81 void removeClient(ImageLoaderClient* client) { m_imageLoader.removeClient(cl ient); }
81 82
82 virtual const AtomicString imageSourceURL() const OVERRIDE; 83 virtual const AtomicString imageSourceURL() const OVERRIDE;
83 84
84 virtual HTMLFormElement* formOwner() const OVERRIDE; 85 virtual HTMLFormElement* formOwner() const OVERRIDE;
85 void formRemovedFromTree(const Node& formRoot); 86 void formRemovedFromTree(const Node& formRoot);
86 87
88 // CanvasImageSourceImplementations
89 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceIma geStatus*) const;
90 virtual bool wouldTaintOrigin(SecurityOrigin*) const OVERRIDE;
91 virtual FloatSize sourceSize() const OVERRIDE;
92 virtual FloatSize defaultDestinationSize() const OVERRIDE;
93
87 protected: 94 protected:
88 explicit HTMLImageElement(Document&, HTMLFormElement* = 0); 95 explicit HTMLImageElement(Document&, HTMLFormElement* = 0);
89 96
90 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; 97 virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE;
91 98
92 private: 99 private:
93 virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } 100 virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; }
94 101
95 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE; 102 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR IDE;
96 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE; 103 virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
(...skipping 22 matching lines...) Expand all
119 WeakPtr<HTMLFormElement> m_form; 126 WeakPtr<HTMLFormElement> m_form;
120 CompositeOperator m_compositeOperator; 127 CompositeOperator m_compositeOperator;
121 AtomicString m_bestFitImageURL; 128 AtomicString m_bestFitImageURL;
122 float m_imageDevicePixelRatio; 129 float m_imageDevicePixelRatio;
123 bool m_formWasSetByParser; 130 bool m_formWasSetByParser;
124 }; 131 };
125 132
126 } //namespace 133 } //namespace
127 134
128 #endif 135 #endif
OLDNEW
« no previous file with comments | « Source/core/html/HTMLCanvasElement.idl ('k') | Source/core/html/HTMLImageElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698