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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 public: | 51 public: |
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*)
; | 62 static PassRefPtr<HTMLCanvasElement> create(const QualifiedName&, Document&)
; |
63 virtual ~HTMLCanvasElement(); | 63 virtual ~HTMLCanvasElement(); |
64 | 64 |
65 void addObserver(CanvasObserver*); | 65 void addObserver(CanvasObserver*); |
66 void removeObserver(CanvasObserver*); | 66 void removeObserver(CanvasObserver*); |
67 | 67 |
68 // Attributes and functions exposed to script | 68 // Attributes and functions exposed to script |
69 int width() const { return size().width(); } | 69 int width() const { return size().width(); } |
70 int height() const { return size().height(); } | 70 int height() const { return size().height(); } |
71 | 71 |
72 const IntSize& size() const { return m_size; } | 72 const IntSize& size() const { return m_size; } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 bool hasCreatedImageBuffer() const { return m_hasCreatedImageBuffer; } | 129 bool hasCreatedImageBuffer() const { return m_hasCreatedImageBuffer; } |
130 | 130 |
131 bool shouldAccelerate(const IntSize&) const; | 131 bool shouldAccelerate(const IntSize&) const; |
132 | 132 |
133 float deviceScaleFactor() const { return m_deviceScaleFactor; } | 133 float deviceScaleFactor() const { return m_deviceScaleFactor; } |
134 | 134 |
135 InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; | 135 InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; |
136 | 136 |
137 private: | 137 private: |
138 HTMLCanvasElement(const QualifiedName&, Document*); | 138 HTMLCanvasElement(const QualifiedName&, Document&); |
139 | 139 |
140 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; | 140 virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERR
IDE; |
141 virtual RenderObject* createRenderer(RenderStyle*); | 141 virtual RenderObject* createRenderer(RenderStyle*); |
142 virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } | 142 virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } |
143 | 143 |
144 void reset(); | 144 void reset(); |
145 | 145 |
146 void createImageBuffer(); | 146 void createImageBuffer(); |
147 void clearImageBuffer(); | 147 void clearImageBuffer(); |
148 | 148 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 181 |
182 inline HTMLCanvasElement* toHTMLCanvasElement(Node* node) | 182 inline HTMLCanvasElement* toHTMLCanvasElement(Node* node) |
183 { | 183 { |
184 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::canvas
Tag)); | 184 ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(HTMLNames::canvas
Tag)); |
185 return static_cast<HTMLCanvasElement*>(node); | 185 return static_cast<HTMLCanvasElement*>(node); |
186 } | 186 } |
187 | 187 |
188 } //namespace | 188 } //namespace |
189 | 189 |
190 #endif | 190 #endif |
OLD | NEW |