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 struct State FINAL : CSSFontSelectorClient { |
haraken
2014/03/25 13:19:30
Nit: I would change this struct to a class. It loo
wibling-chromium
2014/03/25 13:27:17
Done.
| |
238 State(); | 238 State(); |
239 virtual ~State(); | 239 virtual ~State(); |
240 | 240 |
241 State(const State&); | 241 State(const State&); |
242 State& operator=(const State&); | 242 State& operator=(const State&); |
243 | 243 |
244 // CSSFontSelectorClient implementation | 244 // CSSFontSelectorClient implementation |
245 virtual void fontsNeedUpdate(CSSFontSelector*) OVERRIDE; | 245 virtual void fontsNeedUpdate(CSSFontSelector*) OVERRIDE; |
246 | 246 |
247 unsigned m_unrealizedSaveCount; | 247 unsigned m_unrealizedSaveCount; |
(...skipping 11 matching lines...) Expand all Loading... | |
259 RGBA32 m_shadowColor; | 259 RGBA32 m_shadowColor; |
260 float m_globalAlpha; | 260 float m_globalAlpha; |
261 CompositeOperator m_globalComposite; | 261 CompositeOperator m_globalComposite; |
262 blink::WebBlendMode m_globalBlend; | 262 blink::WebBlendMode m_globalBlend; |
263 AffineTransform m_transform; | 263 AffineTransform m_transform; |
264 bool m_invertibleCTM; | 264 bool m_invertibleCTM; |
265 Vector<float> m_lineDash; | 265 Vector<float> m_lineDash; |
266 float m_lineDashOffset; | 266 float m_lineDashOffset; |
267 bool m_imageSmoothingEnabled; | 267 bool m_imageSmoothingEnabled; |
268 | 268 |
269 virtual void trace(Visitor*) OVERRIDE { } | |
270 | |
269 // Text state. | 271 // Text state. |
270 TextAlign m_textAlign; | 272 TextAlign m_textAlign; |
271 TextBaseline m_textBaseline; | 273 TextBaseline m_textBaseline; |
272 | 274 |
273 String m_unparsedFont; | 275 String m_unparsedFont; |
274 Font m_font; | 276 Font m_font; |
275 bool m_realizedFont; | 277 bool m_realizedFont; |
276 }; | 278 }; |
277 | 279 |
278 CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes * attrs, bool usesCSSCompatibilityParseMode); | 280 CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes * attrs, bool usesCSSCompatibilityParseMode); |
279 | 281 |
280 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return m_ stateStack.last(); } | 282 State& modifiableState() { ASSERT(!state().m_unrealizedSaveCount); return *m _stateStack.last(); } |
281 const State& state() const { return m_stateStack.last(); } | 283 const State& state() const { return *m_stateStack.last(); } |
282 | 284 |
283 void applyLineDash() const; | 285 void applyLineDash() const; |
284 void setShadow(const FloatSize& offset, float blur, RGBA32 color); | 286 void setShadow(const FloatSize& offset, float blur, RGBA32 color); |
285 void applyShadow(); | 287 void applyShadow(); |
286 bool shouldDrawShadows() const; | 288 bool shouldDrawShadows() const; |
287 | 289 |
288 bool computeDirtyRect(const FloatRect& localBounds, FloatRect*); | 290 bool computeDirtyRect(const FloatRect& localBounds, FloatRect*); |
289 bool computeDirtyRect(const FloatRect& localBounds, const FloatRect& transfo rmedClipBounds, FloatRect*); | 291 bool computeDirtyRect(const FloatRect& localBounds, const FloatRect& transfo rmedClipBounds, FloatRect*); |
290 void didDraw(const FloatRect&); | 292 void didDraw(const FloatRect&); |
291 | 293 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 void drawFocusRing(const Path&); | 327 void drawFocusRing(const Path&); |
326 | 328 |
327 virtual bool is2d() const OVERRIDE { return true; } | 329 virtual bool is2d() const OVERRIDE { return true; } |
328 virtual bool isAccelerated() const OVERRIDE; | 330 virtual bool isAccelerated() const OVERRIDE; |
329 virtual bool hasAlpha() const OVERRIDE { return m_hasAlpha; } | 331 virtual bool hasAlpha() const OVERRIDE { return m_hasAlpha; } |
330 | 332 |
331 virtual bool isTransformInvertible() const OVERRIDE { return state().m_inver tibleCTM; } | 333 virtual bool isTransformInvertible() const OVERRIDE { return state().m_inver tibleCTM; } |
332 | 334 |
333 virtual blink::WebLayer* platformLayer() const OVERRIDE; | 335 virtual blink::WebLayer* platformLayer() const OVERRIDE; |
334 | 336 |
335 Vector<State, 1> m_stateStack; | 337 // FIXME: Oilpan: Make this a vector of embedded State objects rather than p ointers |
338 // once we support having vectors with objects using a vtable in oilpan. | |
339 WillBePersistentHeapVector<OwnPtrWillBeMember<State> > m_stateStack; | |
336 bool m_usesCSSCompatibilityParseMode; | 340 bool m_usesCSSCompatibilityParseMode; |
337 bool m_hasAlpha; | 341 bool m_hasAlpha; |
338 MutableStylePropertyMap m_fetchedFonts; | 342 MutableStylePropertyMap m_fetchedFonts; |
339 }; | 343 }; |
340 | 344 |
341 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d()); | 345 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d()); |
342 | 346 |
343 } // namespace WebCore | 347 } // namespace WebCore |
344 | 348 |
345 #endif | 349 #endif |
OLD | NEW |