OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "CSSCanvasValue.h" | 27 #include "CSSCanvasValue.h" |
28 | 28 |
29 #include "ImageBuffer.h" | 29 #include "ImageBuffer.h" |
30 #include "RenderObject.h" | 30 #include "RenderObject.h" |
31 | 31 |
32 namespace WebCore { | 32 namespace WebCore { |
33 | 33 |
34 CSSCanvasValue::~CSSCanvasValue() | 34 CSSCanvasValue::~CSSCanvasValue() |
35 { | 35 { |
36 if (m_element) | 36 if (m_element) |
37 m_element->setObserver(0); | 37 m_element->removeObserver(this); |
38 } | 38 } |
39 | 39 |
40 String CSSCanvasValue::cssText() const | 40 String CSSCanvasValue::cssText() const |
41 { | 41 { |
42 String result = "-webkit-canvas("; | 42 String result = "-webkit-canvas("; |
43 result += m_name + ")"; | 43 result += m_name + ")"; |
44 return result; | 44 return result; |
45 } | 45 } |
46 | 46 |
47 void CSSCanvasValue::canvasChanged(HTMLCanvasElement*, const FloatRect& changedR
ect) | 47 void CSSCanvasValue::canvasChanged(HTMLCanvasElement*, const FloatRect& changedR
ect) |
(...skipping 24 matching lines...) Expand all Loading... |
72 return IntSize(elt->width(), elt->height()); | 72 return IntSize(elt->width(), elt->height()); |
73 return IntSize(); | 73 return IntSize(); |
74 } | 74 } |
75 | 75 |
76 HTMLCanvasElement* CSSCanvasValue::element(Document* document) | 76 HTMLCanvasElement* CSSCanvasValue::element(Document* document) |
77 { | 77 { |
78 if (!m_element) { | 78 if (!m_element) { |
79 m_element = document->getCSSCanvasElement(m_name); | 79 m_element = document->getCSSCanvasElement(m_name); |
80 if (!m_element) | 80 if (!m_element) |
81 return 0; | 81 return 0; |
82 m_element->setObserver(this); | 82 m_element->addObserver(this); |
83 } | 83 } |
84 return m_element; | 84 return m_element; |
85 } | 85 } |
86 | 86 |
87 Image* CSSCanvasValue::image(RenderObject* renderer, const IntSize& /*size*/) | 87 Image* CSSCanvasValue::image(RenderObject* renderer, const IntSize& /*size*/) |
88 { | 88 { |
89 ASSERT(m_clients.contains(renderer)); | 89 ASSERT(m_clients.contains(renderer)); |
90 HTMLCanvasElement* elt = element(renderer->document()); | 90 HTMLCanvasElement* elt = element(renderer->document()); |
91 if (!elt || !elt->buffer()) | 91 if (!elt || !elt->buffer()) |
92 return 0; | 92 return 0; |
93 return elt->copiedImage(); | 93 return elt->copiedImage(); |
94 } | 94 } |
95 | 95 |
96 } // namespace WebCore | 96 } // namespace WebCore |
OLD | NEW |