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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 String font() const; | 205 String font() const; |
206 void setFont(const String&); | 206 void setFont(const String&); |
207 | 207 |
208 String textAlign() const; | 208 String textAlign() const; |
209 void setTextAlign(const String&); | 209 void setTextAlign(const String&); |
210 | 210 |
211 String textBaseline() const; | 211 String textBaseline() const; |
212 void setTextBaseline(const String&); | 212 void setTextBaseline(const String&); |
213 | 213 |
| 214 String direction() const; |
| 215 void setDirection(const String&); |
| 216 |
214 void fillText(const String& text, float x, float y); | 217 void fillText(const String& text, float x, float y); |
215 void fillText(const String& text, float x, float y, float maxWidth); | 218 void fillText(const String& text, float x, float y, float maxWidth); |
216 void strokeText(const String& text, float x, float y); | 219 void strokeText(const String& text, float x, float y); |
217 void strokeText(const String& text, float x, float y, float maxWidth); | 220 void strokeText(const String& text, float x, float y, float maxWidth); |
218 PassRefPtrWillBeRawPtr<TextMetrics> measureText(const String& text); | 221 PassRefPtrWillBeRawPtr<TextMetrics> measureText(const String& text); |
219 | 222 |
220 LineCap getLineCap() const { return state().m_lineCap; } | 223 LineCap getLineCap() const { return state().m_lineCap; } |
221 LineJoin getLineJoin() const { return state().m_lineJoin; } | 224 LineJoin getLineJoin() const { return state().m_lineJoin; } |
222 | 225 |
223 bool imageSmoothingEnabled() const; | 226 bool imageSmoothingEnabled() const; |
(...skipping 10 matching lines...) Expand all Loading... |
234 void clearHitRegions(); | 237 void clearHitRegions(); |
235 HitRegion* hitRegionAtPoint(const LayoutPoint&); | 238 HitRegion* hitRegionAtPoint(const LayoutPoint&); |
236 unsigned hitRegionsCount() const; | 239 unsigned hitRegionsCount() const; |
237 | 240 |
238 void loseContext(); | 241 void loseContext(); |
239 void restoreContext(); | 242 void restoreContext(); |
240 | 243 |
241 virtual void trace(Visitor*) OVERRIDE; | 244 virtual void trace(Visitor*) OVERRIDE; |
242 | 245 |
243 private: | 246 private: |
| 247 enum Direction { |
| 248 DirectionInherit, |
| 249 DirectionRTL, |
| 250 DirectionLTR |
| 251 }; |
| 252 |
244 class State FINAL : public CSSFontSelectorClient { | 253 class State FINAL : public CSSFontSelectorClient { |
245 public: | 254 public: |
246 State(); | 255 State(); |
247 virtual ~State(); | 256 virtual ~State(); |
248 | 257 |
249 State(const State&); | 258 State(const State&); |
250 State& operator=(const State&); | 259 State& operator=(const State&); |
251 | 260 |
252 // CSSFontSelectorClient implementation | 261 // CSSFontSelectorClient implementation |
253 virtual void fontsNeedUpdate(CSSFontSelector*) OVERRIDE; | 262 virtual void fontsNeedUpdate(CSSFontSelector*) OVERRIDE; |
(...skipping 18 matching lines...) Expand all Loading... |
272 blink::WebBlendMode m_globalBlend; | 281 blink::WebBlendMode m_globalBlend; |
273 AffineTransform m_transform; | 282 AffineTransform m_transform; |
274 bool m_invertibleCTM; | 283 bool m_invertibleCTM; |
275 Vector<float> m_lineDash; | 284 Vector<float> m_lineDash; |
276 float m_lineDashOffset; | 285 float m_lineDashOffset; |
277 bool m_imageSmoothingEnabled; | 286 bool m_imageSmoothingEnabled; |
278 | 287 |
279 // Text state. | 288 // Text state. |
280 TextAlign m_textAlign; | 289 TextAlign m_textAlign; |
281 TextBaseline m_textBaseline; | 290 TextBaseline m_textBaseline; |
| 291 Direction m_direction; |
282 | 292 |
283 String m_unparsedFont; | 293 String m_unparsedFont; |
284 Font m_font; | 294 Font m_font; |
285 bool m_realizedFont; | 295 bool m_realizedFont; |
286 | 296 |
287 bool m_hasClip; | 297 bool m_hasClip; |
288 }; | 298 }; |
289 | 299 |
290 CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes
* attrs, bool usesCSSCompatibilityParseMode); | 300 CanvasRenderingContext2D(HTMLCanvasElement*, const Canvas2DContextAttributes
* attrs, bool usesCSSCompatibilityParseMode); |
291 | 301 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 358 |
349 void validateStateStack(); | 359 void validateStateStack(); |
350 | 360 |
351 virtual bool is2d() const OVERRIDE { return true; } | 361 virtual bool is2d() const OVERRIDE { return true; } |
352 virtual bool isAccelerated() const OVERRIDE; | 362 virtual bool isAccelerated() const OVERRIDE; |
353 virtual bool hasAlpha() const OVERRIDE { return m_hasAlpha; } | 363 virtual bool hasAlpha() const OVERRIDE { return m_hasAlpha; } |
354 | 364 |
355 virtual bool isTransformInvertible() const OVERRIDE { return state().m_inver
tibleCTM; } | 365 virtual bool isTransformInvertible() const OVERRIDE { return state().m_inver
tibleCTM; } |
356 | 366 |
357 virtual blink::WebLayer* platformLayer() const OVERRIDE; | 367 virtual blink::WebLayer* platformLayer() const OVERRIDE; |
| 368 TextDirection toTextDirection(Direction, RenderStyle** computedStyle = nullp
tr) const; |
358 | 369 |
359 WillBeHeapVector<OwnPtrWillBeMember<State> > m_stateStack; | 370 WillBeHeapVector<OwnPtrWillBeMember<State> > m_stateStack; |
360 OwnPtrWillBeMember<HitRegionManager> m_hitRegionManager; | 371 OwnPtrWillBeMember<HitRegionManager> m_hitRegionManager; |
361 bool m_usesCSSCompatibilityParseMode; | 372 bool m_usesCSSCompatibilityParseMode; |
362 bool m_hasAlpha; | 373 bool m_hasAlpha; |
363 bool m_isContextLost; | 374 bool m_isContextLost; |
364 bool m_contextRestorable; | 375 bool m_contextRestorable; |
365 Canvas2DContextStorage m_storageMode; | 376 Canvas2DContextStorage m_storageMode; |
366 MutableStylePropertyMap m_fetchedFonts; | 377 MutableStylePropertyMap m_fetchedFonts; |
367 unsigned m_tryRestoreContextAttemptCount; | 378 unsigned m_tryRestoreContextAttemptCount; |
368 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; | 379 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; |
369 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; | 380 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; |
370 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; | 381 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; |
371 }; | 382 }; |
372 | 383 |
373 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); | 384 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con
text->is2d(), context.is2d()); |
374 | 385 |
375 } // namespace blink | 386 } // namespace blink |
376 | 387 |
377 #endif | 388 #endif |
OLD | NEW |