Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1166)

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2D.h

Issue 468483003: Implement canvas2d direction attribute (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Supporting the case of save/restore Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 = -1,
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 explicit State(Direction = DirectionInherit);
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;
254 263
255 virtual void trace(Visitor*) OVERRIDE; 264 virtual void trace(Visitor*) OVERRIDE;
256 265
(...skipping 15 matching lines...) Expand all
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer; 378 Timer<CanvasRenderingContext2D> m_dispatchContextLostEventTimer;
369 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer; 379 Timer<CanvasRenderingContext2D> m_dispatchContextRestoredEventTimer;
370 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer; 380 Timer<CanvasRenderingContext2D> m_tryRestoreContextEventTimer;
371 }; 381 };
372 382
373 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d()); 383 DEFINE_TYPE_CASTS(CanvasRenderingContext2D, CanvasRenderingContext, context, con text->is2d(), context.is2d());
374 384
375 } // namespace blink 385 } // namespace blink
376 386
377 #endif 387 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698