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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "wtf/HashMap.h" | 42 #include "wtf/HashMap.h" |
43 #include "wtf/Vector.h" | 43 #include "wtf/Vector.h" |
44 #include "wtf/text/WTFString.h" | 44 #include "wtf/text/WTFString.h" |
45 | 45 |
46 namespace blink { class WebLayer; } | 46 namespace blink { class WebLayer; } |
47 | 47 |
48 namespace WebCore { | 48 namespace WebCore { |
49 | 49 |
50 class CanvasImageSource; | 50 class CanvasImageSource; |
51 class CanvasGradient; | 51 class CanvasGradient; |
| 52 class CanvasHitRegion; |
| 53 class CanvasHitRegionManager; |
52 class CanvasPattern; | 54 class CanvasPattern; |
53 class CanvasStyle; | 55 class CanvasStyle; |
54 class Path2D; | 56 struct DecodedHitRegionOptions; |
55 class Element; | 57 class Element; |
56 class ExceptionState; | 58 class ExceptionState; |
57 class FloatRect; | 59 class FloatRect; |
58 class GraphicsContext; | 60 class GraphicsContext; |
59 class HTMLCanvasElement; | 61 class HTMLCanvasElement; |
60 class HTMLImageElement; | 62 class HTMLImageElement; |
61 class HTMLVideoElement; | 63 class HTMLVideoElement; |
62 class ImageBitmap; | 64 class ImageBitmap; |
63 class ImageData; | 65 class ImageData; |
| 66 class Path2D; |
64 class TextMetrics; | 67 class TextMetrics; |
65 | 68 |
66 typedef WillBeHeapHashMap<String, RefPtrWillBeMember<MutableStylePropertySet> >
MutableStylePropertyMap; | 69 typedef WillBeHeapHashMap<String, RefPtrWillBeMember<MutableStylePropertySet> >
MutableStylePropertyMap; |
67 | 70 |
68 class CanvasRenderingContext2D FINAL: public CanvasRenderingContext, public Scri
ptWrappable, public CanvasPathMethods { | 71 class CanvasRenderingContext2D FINAL: public CanvasRenderingContext, public Scri
ptWrappable, public CanvasPathMethods { |
69 public: | 72 public: |
70 static PassOwnPtrWillBeRawPtr<CanvasRenderingContext2D> create(HTMLCanvasEle
ment* canvas, const Canvas2DContextAttributes* attrs, bool usesCSSCompatibilityP
arseMode) | 73 static PassOwnPtrWillBeRawPtr<CanvasRenderingContext2D> create(HTMLCanvasEle
ment* canvas, const Canvas2DContextAttributes* attrs, bool usesCSSCompatibilityP
arseMode) |
71 { | 74 { |
72 return adoptPtrWillBeNoop(new CanvasRenderingContext2D(canvas, attrs, us
esCSSCompatibilityParseMode)); | 75 return adoptPtrWillBeNoop(new CanvasRenderingContext2D(canvas, attrs, us
esCSSCompatibilityParseMode)); |
73 } | 76 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 PassRefPtr<TextMetrics> measureText(const String& text); | 220 PassRefPtr<TextMetrics> measureText(const String& text); |
218 | 221 |
219 LineCap getLineCap() const { return state().m_lineCap; } | 222 LineCap getLineCap() const { return state().m_lineCap; } |
220 LineJoin getLineJoin() const { return state().m_lineJoin; } | 223 LineJoin getLineJoin() const { return state().m_lineJoin; } |
221 | 224 |
222 bool imageSmoothingEnabled() const; | 225 bool imageSmoothingEnabled() const; |
223 void setImageSmoothingEnabled(bool); | 226 void setImageSmoothingEnabled(bool); |
224 | 227 |
225 PassRefPtr<Canvas2DContextAttributes> getContextAttributes() const; | 228 PassRefPtr<Canvas2DContextAttributes> getContextAttributes() const; |
226 | 229 |
| 230 void addHitRegion(ExceptionState&); |
| 231 void addHitRegion(const Dictionary& options, ExceptionState&); |
| 232 void removeHitRegion(const String& id); |
| 233 CanvasHitRegion* hitRegionAtPoint(const LayoutPoint&); |
| 234 |
227 void drawFocusIfNeeded(Element*); | 235 void drawFocusIfNeeded(Element*); |
228 void drawFocusIfNeeded(Path2D*, Element*); | 236 void drawFocusIfNeeded(Path2D*, Element*); |
229 bool drawCustomFocusRing(Element*); | 237 bool drawCustomFocusRing(Element*); |
230 | 238 |
231 void loseContext(); | 239 void loseContext(); |
232 void restoreContext(); | 240 void restoreContext(); |
233 | 241 |
234 virtual void trace(Visitor*) OVERRIDE; | 242 virtual void trace(Visitor*) OVERRIDE; |
235 | 243 |
236 private: | 244 private: |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 | 331 |
324 void clearCanvas(); | 332 void clearCanvas(); |
325 bool rectContainsTransformedRect(const FloatRect&, const FloatRect&) const; | 333 bool rectContainsTransformedRect(const FloatRect&, const FloatRect&) const; |
326 | 334 |
327 void inflateStrokeRect(FloatRect&) const; | 335 void inflateStrokeRect(FloatRect&) const; |
328 | 336 |
329 template<class T> void fullCanvasCompositedFill(const T&); | 337 template<class T> void fullCanvasCompositedFill(const T&); |
330 template<class T> void fullCanvasCompositedStroke(const T&); | 338 template<class T> void fullCanvasCompositedStroke(const T&); |
331 template<class T> void fullCanvasCompositedDrawImage(T*, const FloatRect&, c
onst FloatRect&, CompositeOperator); | 339 template<class T> void fullCanvasCompositedDrawImage(T*, const FloatRect&, c
onst FloatRect&, CompositeOperator); |
332 | 340 |
| 341 void addHitRegionInternal(const DecodedHitRegionOptions&, ExceptionState&); |
| 342 |
333 void drawFocusIfNeededInternal(const Path&, Element*); | 343 void drawFocusIfNeededInternal(const Path&, Element*); |
334 bool focusRingCallIsValid(const Path&, Element*); | 344 bool focusRingCallIsValid(const Path&, Element*); |
335 void updateFocusRingAccessibility(const Path&, Element*); | 345 void updateFocusRingAccessibility(const Path&, Element*); |
336 void drawFocusRing(const Path&); | 346 void drawFocusRing(const Path&); |
337 | 347 |
338 virtual bool is2d() const OVERRIDE { return true; } | 348 virtual bool is2d() const OVERRIDE { return true; } |
339 virtual bool isAccelerated() const OVERRIDE; | 349 virtual bool isAccelerated() const OVERRIDE; |
340 virtual bool hasAlpha() const OVERRIDE { return m_hasAlpha; } | 350 virtual bool hasAlpha() const OVERRIDE { return m_hasAlpha; } |
341 | 351 |
342 virtual bool isTransformInvertible() const OVERRIDE { return state().m_inver
tibleCTM; } | 352 virtual bool isTransformInvertible() const OVERRIDE { return state().m_inver
tibleCTM; } |
343 | 353 |
344 virtual blink::WebLayer* platformLayer() const OVERRIDE; | 354 virtual blink::WebLayer* platformLayer() const OVERRIDE; |
345 | 355 |
346 WillBeHeapVector<OwnPtrWillBeMember<State> > m_stateStack; | 356 WillBeHeapVector<OwnPtrWillBeMember<State> > m_stateStack; |
| 357 OwnPtrWillBeMember<CanvasHitRegionManager> m_hitRegionManager; |
347 bool m_usesCSSCompatibilityParseMode; | 358 bool m_usesCSSCompatibilityParseMode; |
348 bool m_hasAlpha; | 359 bool m_hasAlpha; |
349 bool m_isContextLost; | 360 bool m_isContextLost; |
350 bool m_contextRestorable; | 361 bool m_contextRestorable; |
351 Canvas2DContextStorage m_storageMode; | 362 Canvas2DContextStorage m_storageMode; |
352 MutableStylePropertyMap m_fetchedFonts; | 363 MutableStylePropertyMap m_fetchedFonts; |
353 unsigned m_tryRestoreContextAttemptCount; | 364 unsigned m_tryRestoreContextAttemptCount; |
354 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; | 365 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; |
355 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; | 366 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; |
356 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; | 367 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; |
357 }; | 368 }; |
358 | 369 |
359 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); | 370 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); |
360 | 371 |
361 } // namespace WebCore | 372 } // namespace WebCore |
362 | 373 |
363 #endif | 374 #endif |
OLD | NEW |