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

Side by Side Diff: sky/engine/core/html/HTMLCanvasElement.h

Issue 714953002: Remove DocumentVisibilityObserver (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « sky/engine/core/dom/DocumentTest.cpp ('k') | sky/engine/core/html/HTMLCanvasElement.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) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 class CanvasObserver { 60 class CanvasObserver {
61 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(CanvasObserver); 61 DECLARE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_BE_REMOVED(CanvasObserver);
62 public: 62 public:
63 virtual void canvasChanged(HTMLCanvasElement*, const FloatRect& changedRect) = 0; 63 virtual void canvasChanged(HTMLCanvasElement*, const FloatRect& changedRect) = 0;
64 virtual void canvasResized(HTMLCanvasElement*) = 0; 64 virtual void canvasResized(HTMLCanvasElement*) = 0;
65 #if !ENABLE(OILPAN) 65 #if !ENABLE(OILPAN)
66 virtual void canvasDestroyed(HTMLCanvasElement*) = 0; 66 virtual void canvasDestroyed(HTMLCanvasElement*) = 0;
67 #endif 67 #endif
68 }; 68 };
69 69
70 class HTMLCanvasElement final : public HTMLElement, public DocumentVisibilityObs erver, public CanvasImageSource, public ImageBufferClient { 70 class HTMLCanvasElement final : public HTMLElement, public CanvasImageSource, pu blic ImageBufferClient {
71 DEFINE_WRAPPERTYPEINFO(); 71 DEFINE_WRAPPERTYPEINFO();
72 public: 72 public:
73 DECLARE_NODE_FACTORY(HTMLCanvasElement); 73 DECLARE_NODE_FACTORY(HTMLCanvasElement);
74 virtual ~HTMLCanvasElement(); 74 virtual ~HTMLCanvasElement();
75 75
76 void addObserver(CanvasObserver*); 76 void addObserver(CanvasObserver*);
77 void removeObserver(CanvasObserver*); 77 void removeObserver(CanvasObserver*);
78 78
79 // Attributes and functions exposed to script 79 // Attributes and functions exposed to script
80 int width() const { return size().width(); } 80 int width() const { return size().width(); }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 bool is3D() const; 128 bool is3D() const;
129 129
130 bool hasImageBuffer() const { return m_imageBuffer; } 130 bool hasImageBuffer() const { return m_imageBuffer; }
131 bool hasValidImageBuffer() const; 131 bool hasValidImageBuffer() const;
132 void discardImageBuffer(); 132 void discardImageBuffer();
133 133
134 bool shouldAccelerate(const IntSize&) const; 134 bool shouldAccelerate(const IntSize&) const;
135 135
136 virtual const AtomicString imageSourceURL() const override; 136 virtual const AtomicString imageSourceURL() const override;
137 137
138 // DocumentVisibilityObserver implementation
139 virtual void didChangeVisibilityState(PageVisibilityState) override;
140
141 // CanvasImageSource implementation 138 // CanvasImageSource implementation
142 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceIma geStatus*) const override; 139 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceIma geStatus*) const override;
143 virtual FloatSize sourceSize() const override; 140 virtual FloatSize sourceSize() const override;
144 141
145 // ImageBufferClient implementation 142 // ImageBufferClient implementation
146 virtual void notifySurfaceInvalid() override; 143 virtual void notifySurfaceInvalid() override;
147 virtual bool isDirty() override { return !m_dirtyRect.isEmpty(); } 144 virtual bool isDirty() override { return !m_dirtyRect.isEmpty(); }
148 virtual void didFinalizeFrame() override; 145 virtual void didFinalizeFrame() override;
149 146
150 protected:
151 virtual void didMoveToNewDocument(Document& oldDocument) override;
152
153 private: 147 private:
154 explicit HTMLCanvasElement(Document&); 148 explicit HTMLCanvasElement(Document&);
155 149
156 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr ide; 150 virtual void parseAttribute(const QualifiedName&, const AtomicString&) overr ide;
157 virtual RenderObject* createRenderer(RenderStyle*) override; 151 virtual RenderObject* createRenderer(RenderStyle*) override;
158 152
159 void finalizeFrameMicrotask(); 153 void finalizeFrameMicrotask();
160 154
161 void reset(); 155 void reset();
162 156
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 OwnPtr<ImageBuffer> m_imageBuffer; 189 OwnPtr<ImageBuffer> m_imageBuffer;
196 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver; 190 mutable OwnPtr<GraphicsContextStateSaver> m_contextStateSaver;
197 191
198 mutable RefPtr<Image> m_presentedImage; 192 mutable RefPtr<Image> m_presentedImage;
199 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue). 193 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor ms that have to copy the image buffer to render (and for CSSCanvasValue).
200 }; 194 };
201 195
202 } // namespace blink 196 } // namespace blink
203 197
204 #endif // HTMLCanvasElement_h 198 #endif // HTMLCanvasElement_h
OLDNEW
« no previous file with comments | « sky/engine/core/dom/DocumentTest.cpp ('k') | sky/engine/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698