OLD | NEW |
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 virtual ~CanvasObserver() { } | 52 virtual ~CanvasObserver() { } |
53 | 53 |
54 virtual void canvasChanged(HTMLCanvasElement*, const FloatRect& changedRect)
= 0; | 54 virtual void canvasChanged(HTMLCanvasElement*, const FloatRect& changedRect)
= 0; |
55 virtual void canvasResized(HTMLCanvasElement*) = 0; | 55 virtual void canvasResized(HTMLCanvasElement*) = 0; |
56 virtual void canvasDestroyed(HTMLCanvasElement*) = 0; | 56 virtual void canvasDestroyed(HTMLCanvasElement*) = 0; |
57 }; | 57 }; |
58 | 58 |
59 class HTMLCanvasElement FINAL : public HTMLElement { | 59 class HTMLCanvasElement FINAL : public HTMLElement { |
60 public: | 60 public: |
61 static PassRefPtr<HTMLCanvasElement> create(Document&); | 61 static PassRefPtr<HTMLCanvasElement> create(Document&); |
62 static PassRefPtr<HTMLCanvasElement> create(const QualifiedName&, Document&)
; | |
63 virtual ~HTMLCanvasElement(); | 62 virtual ~HTMLCanvasElement(); |
64 | 63 |
65 void addObserver(CanvasObserver*); | 64 void addObserver(CanvasObserver*); |
66 void removeObserver(CanvasObserver*); | 65 void removeObserver(CanvasObserver*); |
67 | 66 |
68 // Attributes and functions exposed to script | 67 // Attributes and functions exposed to script |
69 int width() const { return size().width(); } | 68 int width() const { return size().width(); } |
70 int height() const { return size().height(); } | 69 int height() const { return size().height(); } |
71 | 70 |
72 const IntSize& size() const { return m_size; } | 71 const IntSize& size() const { return m_size; } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 122 |
124 bool hasCreatedImageBuffer() const { return m_hasCreatedImageBuffer; } | 123 bool hasCreatedImageBuffer() const { return m_hasCreatedImageBuffer; } |
125 | 124 |
126 bool shouldAccelerate(const IntSize&) const; | 125 bool shouldAccelerate(const IntSize&) const; |
127 | 126 |
128 float deviceScaleFactor() const { return m_deviceScaleFactor; } | 127 float deviceScaleFactor() const { return m_deviceScaleFactor; } |
129 | 128 |
130 InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; | 129 InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; |
131 | 130 |
132 private: | 131 private: |
133 HTMLCanvasElement(const QualifiedName&, Document&); | 132 explicit HTMLCanvasElement(Document&); |
134 | 133 |
135 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; | 134 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; |
136 virtual RenderObject* createRenderer(RenderStyle*); | 135 virtual RenderObject* createRenderer(RenderStyle*); |
137 virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } | 136 virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } |
138 | 137 |
139 void reset(); | 138 void reset(); |
140 | 139 |
141 void createImageBuffer(); | 140 void createImageBuffer(); |
142 void clearImageBuffer(); | 141 void clearImageBuffer(); |
143 | 142 |
(...skipping 29 matching lines...) Expand all Loading... |
173 | 172 |
174 mutable RefPtr<Image> m_presentedImage; | 173 mutable RefPtr<Image> m_presentedImage; |
175 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). | 174 mutable RefPtr<Image> m_copiedImage; // FIXME: This is temporary for platfor
ms that have to copy the image buffer to render (and for CSSCanvasValue). |
176 }; | 175 }; |
177 | 176 |
178 DEFINE_NODE_TYPE_CASTS(HTMLCanvasElement, hasTagName(HTMLNames::canvasTag)); | 177 DEFINE_NODE_TYPE_CASTS(HTMLCanvasElement, hasTagName(HTMLNames::canvasTag)); |
179 | 178 |
180 } //namespace | 179 } //namespace |
181 | 180 |
182 #endif | 181 #endif |
OLD | NEW |