OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv
ed. |
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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 float shadowBlur() const; | 106 float shadowBlur() const; |
107 void setShadowBlur(float); | 107 void setShadowBlur(float); |
108 | 108 |
109 String shadowColor() const; | 109 String shadowColor() const; |
110 void setShadowColor(const String&); | 110 void setShadowColor(const String&); |
111 | 111 |
112 float globalAlpha() const; | 112 float globalAlpha() const; |
113 void setGlobalAlpha(float); | 113 void setGlobalAlpha(float); |
114 | 114 |
| 115 bool isContextLost() const; |
| 116 |
115 String globalCompositeOperation() const; | 117 String globalCompositeOperation() const; |
116 void setGlobalCompositeOperation(const String&); | 118 void setGlobalCompositeOperation(const String&); |
117 | 119 |
118 void save() { ++m_stateStack.last()->m_unrealizedSaveCount; } | 120 void save() { ++m_stateStack.last()->m_unrealizedSaveCount; } |
119 void restore(); | 121 void restore(); |
120 | 122 |
121 PassRefPtr<SVGMatrixTearOff> currentTransform() const | 123 PassRefPtr<SVGMatrixTearOff> currentTransform() const |
122 { | 124 { |
123 return SVGMatrixTearOff::create(state().m_transform); | 125 return SVGMatrixTearOff::create(state().m_transform); |
124 } | 126 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 LineJoin getLineJoin() const { return state().m_lineJoin; } | 222 LineJoin getLineJoin() const { return state().m_lineJoin; } |
221 | 223 |
222 bool imageSmoothingEnabled() const; | 224 bool imageSmoothingEnabled() const; |
223 void setImageSmoothingEnabled(bool); | 225 void setImageSmoothingEnabled(bool); |
224 | 226 |
225 PassRefPtr<Canvas2DContextAttributes> getContextAttributes() const; | 227 PassRefPtr<Canvas2DContextAttributes> getContextAttributes() const; |
226 | 228 |
227 void drawFocusIfNeeded(Element*); | 229 void drawFocusIfNeeded(Element*); |
228 bool drawCustomFocusRing(Element*); | 230 bool drawCustomFocusRing(Element*); |
229 | 231 |
| 232 void loseContext(); |
| 233 void restoreContext(); |
| 234 |
230 private: | 235 private: |
231 class State FINAL : public CSSFontSelectorClient { | 236 class State FINAL : public CSSFontSelectorClient { |
232 public: | 237 public: |
233 State(); | 238 State(); |
234 virtual ~State(); | 239 virtual ~State(); |
235 | 240 |
236 State(const State&); | 241 State(const State&); |
237 State& operator=(const State&); | 242 State& operator=(const State&); |
238 | 243 |
239 // CSSFontSelectorClient implementation | 244 // CSSFontSelectorClient implementation |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes
* attrs, bool usesCSSCompatibilityParseMode); | 280 CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes
* attrs, bool usesCSSCompatibilityParseMode); |
276 | 281 |
277 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return *m
_stateStack.last(); } | 282 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return *m
_stateStack.last(); } |
278 const State& state() const { return *m_stateStack.last(); } | 283 const State& state() const { return *m_stateStack.last(); } |
279 | 284 |
280 void applyLineDash() const; | 285 void applyLineDash() const; |
281 void setShadow(const FloatSize& offset, float blur, RGBA32 color); | 286 void setShadow(const FloatSize& offset, float blur, RGBA32 color); |
282 void applyShadow(); | 287 void applyShadow(); |
283 bool shouldDrawShadows() const; | 288 bool shouldDrawShadows() const; |
284 | 289 |
| 290 void dispatchContextLostEvent(Timer<CanvasRenderingContext2D>*); |
| 291 void dispatchContextRestoredEvent(Timer<CanvasRenderingContext2D>*); |
| 292 void tryRestoreContextEvent(Timer<CanvasRenderingContext2D>*); |
| 293 |
285 bool computeDirtyRect(const FloatRect& localBounds, FloatRect*); | 294 bool computeDirtyRect(const FloatRect& localBounds, FloatRect*); |
286 bool computeDirtyRect(const FloatRect& localBounds, const FloatRect& transfo
rmedClipBounds, FloatRect*); | 295 bool computeDirtyRect(const FloatRect& localBounds, const FloatRect& transfo
rmedClipBounds, FloatRect*); |
287 void didDraw(const FloatRect&); | 296 void didDraw(const FloatRect&); |
288 | 297 |
289 GraphicsContext* drawingContext() const; | 298 GraphicsContext* drawingContext() const; |
290 | 299 |
291 void unwindStateStack(); | 300 void unwindStateStack(); |
292 void realizeSaves(); | 301 void realizeSaves(); |
293 | 302 |
294 void applyStrokePattern(); | 303 void applyStrokePattern(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 336 |
328 virtual bool isTransformInvertible() const OVERRIDE { return state().m_inver
tibleCTM; } | 337 virtual bool isTransformInvertible() const OVERRIDE { return state().m_inver
tibleCTM; } |
329 | 338 |
330 virtual blink::WebLayer* platformLayer() const OVERRIDE; | 339 virtual blink::WebLayer* platformLayer() const OVERRIDE; |
331 | 340 |
332 // FIXME: Oilpan: Make this a vector of embedded State objects rather than p
ointers | 341 // FIXME: Oilpan: Make this a vector of embedded State objects rather than p
ointers |
333 // once we support having vectors with objects using a vtable in oilpan. | 342 // once we support having vectors with objects using a vtable in oilpan. |
334 WillBePersistentHeapVector<OwnPtrWillBeMember<State> > m_stateStack; | 343 WillBePersistentHeapVector<OwnPtrWillBeMember<State> > m_stateStack; |
335 bool m_usesCSSCompatibilityParseMode; | 344 bool m_usesCSSCompatibilityParseMode; |
336 bool m_hasAlpha; | 345 bool m_hasAlpha; |
| 346 bool m_isContextLost; |
| 347 bool m_contextRestorable; |
| 348 Canvas2DContextStorage m_storageMode; |
337 MutableStylePropertyMap m_fetchedFonts; | 349 MutableStylePropertyMap m_fetchedFonts; |
| 350 unsigned m_tryRestoreContextAttemptCount; |
| 351 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; |
| 352 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; |
| 353 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; |
338 }; | 354 }; |
339 | 355 |
340 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); | 356 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); |
341 | 357 |
342 } // namespace WebCore | 358 } // namespace WebCore |
343 | 359 |
344 #endif | 360 #endif |
OLD | NEW |