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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 String globalCompositeOperation() const; | 115 String globalCompositeOperation() const; |
116 void setGlobalCompositeOperation(const String&); | 116 void setGlobalCompositeOperation(const String&); |
117 | 117 |
118 void save() { ++m_stateStack.last().m_unrealizedSaveCount; } | 118 void save() { ++m_stateStack.last()->m_unrealizedSaveCount; } |
119 void restore(); | 119 void restore(); |
120 | 120 |
121 PassRefPtr<SVGMatrixTearOff> currentTransform() const | 121 PassRefPtr<SVGMatrixTearOff> currentTransform() const |
122 { | 122 { |
123 return SVGMatrixTearOff::create(state().m_transform); | 123 return SVGMatrixTearOff::create(state().m_transform); |
124 } | 124 } |
125 void setCurrentTransform(PassRefPtr<SVGMatrixTearOff>, ExceptionState&); | 125 void setCurrentTransform(PassRefPtr<SVGMatrixTearOff>, ExceptionState&); |
126 | 126 |
127 void scale(float sx, float sy); | 127 void scale(float sx, float sy); |
128 void rotate(float angleInRadians); | 128 void rotate(float angleInRadians); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 227 |
228 bool imageSmoothingEnabled() const; | 228 bool imageSmoothingEnabled() const; |
229 void setImageSmoothingEnabled(bool); | 229 void setImageSmoothingEnabled(bool); |
230 | 230 |
231 PassRefPtr<Canvas2DContextAttributes> getContextAttributes() const; | 231 PassRefPtr<Canvas2DContextAttributes> getContextAttributes() const; |
232 | 232 |
233 void drawFocusIfNeeded(Element*); | 233 void drawFocusIfNeeded(Element*); |
234 bool drawCustomFocusRing(Element*); | 234 bool drawCustomFocusRing(Element*); |
235 | 235 |
236 private: | 236 private: |
237 struct State FINAL : CSSFontSelectorClient { | 237 class State FINAL : public CSSFontSelectorClient { |
| 238 public: |
238 State(); | 239 State(); |
239 virtual ~State(); | 240 virtual ~State(); |
240 | 241 |
241 State(const State&); | 242 State(const State&); |
242 State& operator=(const State&); | 243 State& operator=(const State&); |
243 | 244 |
244 // CSSFontSelectorClient implementation | 245 // CSSFontSelectorClient implementation |
245 virtual void fontsNeedUpdate(CSSFontSelector*) OVERRIDE; | 246 virtual void fontsNeedUpdate(CSSFontSelector*) OVERRIDE; |
246 | 247 |
| 248 virtual void trace(Visitor*) OVERRIDE { } |
| 249 |
247 unsigned m_unrealizedSaveCount; | 250 unsigned m_unrealizedSaveCount; |
248 | 251 |
249 String m_unparsedStrokeColor; | 252 String m_unparsedStrokeColor; |
250 String m_unparsedFillColor; | 253 String m_unparsedFillColor; |
251 RefPtr<CanvasStyle> m_strokeStyle; | 254 RefPtr<CanvasStyle> m_strokeStyle; |
252 RefPtr<CanvasStyle> m_fillStyle; | 255 RefPtr<CanvasStyle> m_fillStyle; |
253 float m_lineWidth; | 256 float m_lineWidth; |
254 LineCap m_lineCap; | 257 LineCap m_lineCap; |
255 LineJoin m_lineJoin; | 258 LineJoin m_lineJoin; |
256 float m_miterLimit; | 259 float m_miterLimit; |
(...skipping 13 matching lines...) Expand all Loading... |
270 TextAlign m_textAlign; | 273 TextAlign m_textAlign; |
271 TextBaseline m_textBaseline; | 274 TextBaseline m_textBaseline; |
272 | 275 |
273 String m_unparsedFont; | 276 String m_unparsedFont; |
274 Font m_font; | 277 Font m_font; |
275 bool m_realizedFont; | 278 bool m_realizedFont; |
276 }; | 279 }; |
277 | 280 |
278 CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes
* attrs, bool usesCSSCompatibilityParseMode); | 281 CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes
* attrs, bool usesCSSCompatibilityParseMode); |
279 | 282 |
280 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return m_
stateStack.last(); } | 283 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return *m
_stateStack.last(); } |
281 const State& state() const { return m_stateStack.last(); } | 284 const State& state() const { return *m_stateStack.last(); } |
282 | 285 |
283 void applyLineDash() const; | 286 void applyLineDash() const; |
284 void setShadow(const FloatSize& offset, float blur, RGBA32 color); | 287 void setShadow(const FloatSize& offset, float blur, RGBA32 color); |
285 void applyShadow(); | 288 void applyShadow(); |
286 bool shouldDrawShadows() const; | 289 bool shouldDrawShadows() const; |
287 | 290 |
288 bool computeDirtyRect(const FloatRect& localBounds, FloatRect*); | 291 bool computeDirtyRect(const FloatRect& localBounds, FloatRect*); |
289 bool computeDirtyRect(const FloatRect& localBounds, const FloatRect& transfo
rmedClipBounds, FloatRect*); | 292 bool computeDirtyRect(const FloatRect& localBounds, const FloatRect& transfo
rmedClipBounds, FloatRect*); |
290 void didDraw(const FloatRect&); | 293 void didDraw(const FloatRect&); |
291 | 294 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 void drawFocusRing(const Path&); | 328 void drawFocusRing(const Path&); |
326 | 329 |
327 virtual bool is2d() const OVERRIDE { return true; } | 330 virtual bool is2d() const OVERRIDE { return true; } |
328 virtual bool isAccelerated() const OVERRIDE; | 331 virtual bool isAccelerated() const OVERRIDE; |
329 virtual bool hasAlpha() const OVERRIDE { return m_hasAlpha; } | 332 virtual bool hasAlpha() const OVERRIDE { return m_hasAlpha; } |
330 | 333 |
331 virtual bool isTransformInvertible() const OVERRIDE { return state().m_inver
tibleCTM; } | 334 virtual bool isTransformInvertible() const OVERRIDE { return state().m_inver
tibleCTM; } |
332 | 335 |
333 virtual blink::WebLayer* platformLayer() const OVERRIDE; | 336 virtual blink::WebLayer* platformLayer() const OVERRIDE; |
334 | 337 |
335 Vector<State, 1> m_stateStack; | 338 // FIXME: Oilpan: Make this a vector of embedded State objects rather than p
ointers |
| 339 // once we support having vectors with objects using a vtable in oilpan. |
| 340 WillBePersistentHeapVector<OwnPtrWillBeMember<State> > m_stateStack; |
336 bool m_usesCSSCompatibilityParseMode; | 341 bool m_usesCSSCompatibilityParseMode; |
337 bool m_hasAlpha; | 342 bool m_hasAlpha; |
338 MutableStylePropertyMap m_fetchedFonts; | 343 MutableStylePropertyMap m_fetchedFonts; |
339 }; | 344 }; |
340 | 345 |
341 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); | 346 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); |
342 | 347 |
343 } // namespace WebCore | 348 } // namespace WebCore |
344 | 349 |
345 #endif | 350 #endif |
OLD | NEW |