OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. | 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. |
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
10 * | 10 * |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "core/CSSPropertyNames.h" | 39 #include "core/CSSPropertyNames.h" |
40 #include "core/css/CSSFontSelector.h" | 40 #include "core/css/CSSFontSelector.h" |
41 #include "core/css/StylePropertySet.h" | 41 #include "core/css/StylePropertySet.h" |
42 #include "core/css/parser/CSSParser.h" | 42 #include "core/css/parser/CSSParser.h" |
43 #include "core/css/resolver/StyleResolver.h" | 43 #include "core/css/resolver/StyleResolver.h" |
44 #include "core/dom/ExceptionCode.h" | 44 #include "core/dom/ExceptionCode.h" |
45 #include "core/dom/StyleEngine.h" | 45 #include "core/dom/StyleEngine.h" |
46 #include "core/events/Event.h" | 46 #include "core/events/Event.h" |
47 #include "core/fetch/ImageResource.h" | 47 #include "core/fetch/ImageResource.h" |
48 #include "core/frame/ImageBitmap.h" | 48 #include "core/frame/ImageBitmap.h" |
| 49 #include "core/frame/Settings.h" |
49 #include "core/html/HTMLCanvasElement.h" | 50 #include "core/html/HTMLCanvasElement.h" |
50 #include "core/html/HTMLImageElement.h" | 51 #include "core/html/HTMLImageElement.h" |
51 #include "core/html/HTMLMediaElement.h" | 52 #include "core/html/HTMLMediaElement.h" |
52 #include "core/html/HTMLVideoElement.h" | 53 #include "core/html/HTMLVideoElement.h" |
53 #include "core/html/ImageData.h" | 54 #include "core/html/ImageData.h" |
54 #include "core/html/TextMetrics.h" | 55 #include "core/html/TextMetrics.h" |
55 #include "core/html/canvas/CanvasGradient.h" | 56 #include "core/html/canvas/CanvasGradient.h" |
56 #include "core/html/canvas/CanvasPattern.h" | 57 #include "core/html/canvas/CanvasPattern.h" |
57 #include "core/html/canvas/CanvasStyle.h" | 58 #include "core/html/canvas/CanvasStyle.h" |
58 #include "core/html/canvas/Path2D.h" | 59 #include "core/html/canvas/Path2D.h" |
(...skipping 21 matching lines...) Expand all Loading... |
80 static const char ltr[] = "ltr"; | 81 static const char ltr[] = "ltr"; |
81 static const double TryRestoreContextInterval = 0.5; | 82 static const double TryRestoreContextInterval = 0.5; |
82 static const unsigned MaxTryRestoreContextAttempts = 4; | 83 static const unsigned MaxTryRestoreContextAttempts = 4; |
83 static const unsigned FetchedFontsCacheLimit = 50; | 84 static const unsigned FetchedFontsCacheLimit = 50; |
84 | 85 |
85 static bool contextLostRestoredEventsEnabled() | 86 static bool contextLostRestoredEventsEnabled() |
86 { | 87 { |
87 return RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled(); | 88 return RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled(); |
88 } | 89 } |
89 | 90 |
90 CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, co
nst Canvas2DContextAttributes* attrs, bool usesCSSCompatibilityParseMode) | 91 CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, co
nst Canvas2DContextAttributes* attrs, Document& document) |
91 : CanvasRenderingContext(canvas) | 92 : CanvasRenderingContext(canvas) |
92 , m_usesCSSCompatibilityParseMode(usesCSSCompatibilityParseMode) | 93 , m_usesCSSCompatibilityParseMode(document.inQuirksMode()) |
| 94 , m_clipAntialiasing(GraphicsContext::NotAntiAliased) |
93 , m_hasAlpha(!attrs || attrs->alpha()) | 95 , m_hasAlpha(!attrs || attrs->alpha()) |
94 , m_isContextLost(false) | 96 , m_isContextLost(false) |
95 , m_contextRestorable(true) | 97 , m_contextRestorable(true) |
96 , m_storageMode(!attrs ? PersistentStorage : attrs->parsedStorage()) | 98 , m_storageMode(!attrs ? PersistentStorage : attrs->parsedStorage()) |
97 , m_tryRestoreContextAttemptCount(0) | 99 , m_tryRestoreContextAttemptCount(0) |
98 , m_dispatchContextLostEventTimer(this, &CanvasRenderingContext2D::dispatchC
ontextLostEvent) | 100 , m_dispatchContextLostEventTimer(this, &CanvasRenderingContext2D::dispatchC
ontextLostEvent) |
99 , m_dispatchContextRestoredEventTimer(this, &CanvasRenderingContext2D::dispa
tchContextRestoredEvent) | 101 , m_dispatchContextRestoredEventTimer(this, &CanvasRenderingContext2D::dispa
tchContextRestoredEvent) |
100 , m_tryRestoreContextEventTimer(this, &CanvasRenderingContext2D::tryRestoreC
ontextEvent) | 102 , m_tryRestoreContextEventTimer(this, &CanvasRenderingContext2D::tryRestoreC
ontextEvent) |
101 { | 103 { |
| 104 if (document.settings() && document.settings()->antialiasedClips2dCanvasEnab
led()) |
| 105 m_clipAntialiasing = GraphicsContext::AntiAliased; |
102 m_stateStack.append(adoptPtrWillBeNoop(new State())); | 106 m_stateStack.append(adoptPtrWillBeNoop(new State())); |
103 } | 107 } |
104 | 108 |
105 void CanvasRenderingContext2D::unwindStateStack() | 109 void CanvasRenderingContext2D::unwindStateStack() |
106 { | 110 { |
107 if (size_t stackSize = m_stateStack.size()) { | 111 if (size_t stackSize = m_stateStack.size()) { |
108 if (GraphicsContext* context = canvas()->existingDrawingContext()) { | 112 if (GraphicsContext* context = canvas()->existingDrawingContext()) { |
109 while (--stackSize) | 113 while (--stackSize) |
110 context->restore(); | 114 context->restore(); |
111 } | 115 } |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 { | 1110 { |
1107 GraphicsContext* c = drawingContext(); | 1111 GraphicsContext* c = drawingContext(); |
1108 if (!c) { | 1112 if (!c) { |
1109 return; | 1113 return; |
1110 } | 1114 } |
1111 if (!state().m_invertibleCTM) { | 1115 if (!state().m_invertibleCTM) { |
1112 return; | 1116 return; |
1113 } | 1117 } |
1114 | 1118 |
1115 realizeSaves(c); | 1119 realizeSaves(c); |
1116 c->canvasClip(path, parseWinding(windingRuleString)); | 1120 c->canvasClip(path, parseWinding(windingRuleString), m_clipAntialiasing); |
1117 modifiableState().m_hasClip = true; | 1121 modifiableState().m_hasClip = true; |
1118 } | 1122 } |
1119 | 1123 |
1120 void CanvasRenderingContext2D::clip(const String& windingRuleString) | 1124 void CanvasRenderingContext2D::clip(const String& windingRuleString) |
1121 { | 1125 { |
1122 clipInternal(m_path, windingRuleString); | 1126 clipInternal(m_path, windingRuleString); |
1123 } | 1127 } |
1124 | 1128 |
1125 void CanvasRenderingContext2D::clip(Path2D* domPath, const String& windingRuleSt
ring) | 1129 void CanvasRenderingContext2D::clip(Path2D* domPath, const String& windingRuleSt
ring) |
1126 { | 1130 { |
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2463 | 2467 |
2464 unsigned CanvasRenderingContext2D::hitRegionsCount() const | 2468 unsigned CanvasRenderingContext2D::hitRegionsCount() const |
2465 { | 2469 { |
2466 if (m_hitRegionManager) | 2470 if (m_hitRegionManager) |
2467 return m_hitRegionManager->getHitRegionsCount(); | 2471 return m_hitRegionManager->getHitRegionsCount(); |
2468 | 2472 |
2469 return 0; | 2473 return 0; |
2470 } | 2474 } |
2471 | 2475 |
2472 } // namespace blink | 2476 } // namespace blink |
OLD | NEW |