OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 { | 89 { |
90 } | 90 } |
91 | 91 |
92 DEFINE_NODE_FACTORY(HTMLCanvasElement) | 92 DEFINE_NODE_FACTORY(HTMLCanvasElement) |
93 | 93 |
94 HTMLCanvasElement::~HTMLCanvasElement() | 94 HTMLCanvasElement::~HTMLCanvasElement() |
95 { | 95 { |
96 resetDirtyRect(); | 96 resetDirtyRect(); |
97 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_external lyAllocatedMemory); | 97 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(-m_external lyAllocatedMemory); |
98 #if !ENABLE(OILPAN) | 98 #if !ENABLE(OILPAN) |
99 HashSet<RawPtr<CanvasObserver> >::iterator end = m_observers.end(); | 99 for (const auto& canvasObserver : m_observers) |
Mike West
2014/10/20 18:12:44
When the type is trivial to type, please use the a
| |
100 for (HashSet<RawPtr<CanvasObserver> >::iterator it = m_observers.begin(); it != end; ++it) | 100 canvasObserver->canvasDestroyed(this); |
101 (*it)->canvasDestroyed(this); | |
102 // Ensure these go away before the ImageBuffer. | 101 // Ensure these go away before the ImageBuffer. |
103 m_contextStateSaver.clear(); | 102 m_contextStateSaver.clear(); |
104 m_context.clear(); | 103 m_context.clear(); |
105 #endif | 104 #endif |
106 } | 105 } |
107 | 106 |
108 void HTMLCanvasElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) | 107 void HTMLCanvasElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) |
109 { | 108 { |
110 if (name == widthAttr || name == heightAttr) | 109 if (name == widthAttr || name == heightAttr) |
111 reset(); | 110 reset(); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 ASSERT(m_dirtyRect.isEmpty()); | 243 ASSERT(m_dirtyRect.isEmpty()); |
245 } | 244 } |
246 | 245 |
247 void HTMLCanvasElement::willProcessTask() | 246 void HTMLCanvasElement::willProcessTask() |
248 { | 247 { |
249 ASSERT_NOT_REACHED(); | 248 ASSERT_NOT_REACHED(); |
250 } | 249 } |
251 | 250 |
252 void HTMLCanvasElement::notifyObserversCanvasChanged(const FloatRect& rect) | 251 void HTMLCanvasElement::notifyObserversCanvasChanged(const FloatRect& rect) |
253 { | 252 { |
254 WillBeHeapHashSet<RawPtrWillBeWeakMember<CanvasObserver> >::iterator end = m _observers.end(); | 253 for (const auto& canvasObserver : m_observers) |
255 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<CanvasObserver> >::iterator it = m_observers.begin(); it != end; ++it) | 254 canvasObserver->canvasChanged(this, rect); |
256 (*it)->canvasChanged(this, rect); | |
257 } | 255 } |
258 | 256 |
259 void HTMLCanvasElement::reset() | 257 void HTMLCanvasElement::reset() |
260 { | 258 { |
261 if (m_ignoreReset) | 259 if (m_ignoreReset) |
262 return; | 260 return; |
263 | 261 |
264 resetDirtyRect(); | 262 resetDirtyRect(); |
265 | 263 |
266 bool ok; | 264 bool ok; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
304 if (oldSize != size()) { | 302 if (oldSize != size()) { |
305 toRenderHTMLCanvas(renderer)->canvasSizeChanged(); | 303 toRenderHTMLCanvas(renderer)->canvasSizeChanged(); |
306 if (renderBox() && renderBox()->hasAcceleratedCompositing()) | 304 if (renderBox() && renderBox()->hasAcceleratedCompositing()) |
307 renderBox()->contentChanged(CanvasChanged); | 305 renderBox()->contentChanged(CanvasChanged); |
308 } | 306 } |
309 if (hadImageBuffer) | 307 if (hadImageBuffer) |
310 renderer->setShouldDoFullPaintInvalidation(); | 308 renderer->setShouldDoFullPaintInvalidation(); |
311 } | 309 } |
312 } | 310 } |
313 | 311 |
314 WillBeHeapHashSet<RawPtrWillBeWeakMember<CanvasObserver> >::iterator end = m _observers.end(); | 312 for (const auto& canvasObserver : m_observers) |
315 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<CanvasObserver> >::iterator it = m_observers.begin(); it != end; ++it) | 313 canvasObserver->canvasResized(this); |
316 (*it)->canvasResized(this); | |
317 } | 314 } |
318 | 315 |
319 bool HTMLCanvasElement::paintsIntoCanvasBuffer() const | 316 bool HTMLCanvasElement::paintsIntoCanvasBuffer() const |
320 { | 317 { |
321 ASSERT(m_context); | 318 ASSERT(m_context); |
322 | 319 |
323 if (!m_context->isAccelerated()) | 320 if (!m_context->isAccelerated()) |
324 return true; | 321 return true; |
325 | 322 |
326 if (renderBox() && renderBox()->hasAcceleratedCompositing()) | 323 if (renderBox() && renderBox()->hasAcceleratedCompositing()) |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
757 { | 754 { |
758 return !originClean(); | 755 return !originClean(); |
759 } | 756 } |
760 | 757 |
761 FloatSize HTMLCanvasElement::sourceSize() const | 758 FloatSize HTMLCanvasElement::sourceSize() const |
762 { | 759 { |
763 return FloatSize(width(), height()); | 760 return FloatSize(width(), height()); |
764 } | 761 } |
765 | 762 |
766 } | 763 } |
OLD | NEW |