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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 static const char ltr[] = "ltr"; | 83 static const char ltr[] = "ltr"; |
84 static const double TryRestoreContextInterval = 0.5; | 84 static const double TryRestoreContextInterval = 0.5; |
85 static const unsigned MaxTryRestoreContextAttempts = 4; | 85 static const unsigned MaxTryRestoreContextAttempts = 4; |
86 static const unsigned FetchedFontsCacheLimit = 50; | 86 static const unsigned FetchedFontsCacheLimit = 50; |
87 | 87 |
88 static bool contextLostRestoredEventsEnabled() | 88 static bool contextLostRestoredEventsEnabled() |
89 { | 89 { |
90 return RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled(); | 90 return RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled(); |
91 } | 91 } |
92 | 92 |
93 CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, co
nst Canvas2DContextAttributes* attrs, Document& document) | 93 CanvasRenderingContext2D::CanvasRenderingContext2D(HTMLCanvasElement* canvas, co
nst CanvasContextCreationAttributes& attrs, Document& document) |
94 : CanvasRenderingContext(canvas) | 94 : CanvasRenderingContext(canvas) |
95 , m_usesCSSCompatibilityParseMode(document.inQuirksMode()) | 95 , m_usesCSSCompatibilityParseMode(document.inQuirksMode()) |
96 , m_clipAntialiasing(NotAntiAliased) | 96 , m_clipAntialiasing(NotAntiAliased) |
97 , m_hasAlpha(!attrs || attrs->alpha()) | 97 , m_hasAlpha(attrs.alpha()) |
98 , m_isContextLost(false) | 98 , m_isContextLost(false) |
99 , m_contextRestorable(true) | 99 , m_contextRestorable(true) |
100 , m_storageMode(!attrs ? PersistentStorage : attrs->parsedStorage()) | |
101 , m_tryRestoreContextAttemptCount(0) | 100 , m_tryRestoreContextAttemptCount(0) |
102 , m_dispatchContextLostEventTimer(this, &CanvasRenderingContext2D::dispatchC
ontextLostEvent) | 101 , m_dispatchContextLostEventTimer(this, &CanvasRenderingContext2D::dispatchC
ontextLostEvent) |
103 , m_dispatchContextRestoredEventTimer(this, &CanvasRenderingContext2D::dispa
tchContextRestoredEvent) | 102 , m_dispatchContextRestoredEventTimer(this, &CanvasRenderingContext2D::dispa
tchContextRestoredEvent) |
104 , m_tryRestoreContextEventTimer(this, &CanvasRenderingContext2D::tryRestoreC
ontextEvent) | 103 , m_tryRestoreContextEventTimer(this, &CanvasRenderingContext2D::tryRestoreC
ontextEvent) |
105 { | 104 { |
106 if (document.settings() && document.settings()->antialiasedClips2dCanvasEnab
led()) | 105 if (document.settings() && document.settings()->antialiasedClips2dCanvasEnab
led()) |
107 m_clipAntialiasing = AntiAliased; | 106 m_clipAntialiasing = AntiAliased; |
108 m_stateStack.append(adoptPtrWillBeNoop(new State())); | 107 m_stateStack.append(adoptPtrWillBeNoop(new State())); |
109 } | 108 } |
110 | 109 |
(...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2220 if (enabled == state().m_imageSmoothingEnabled) | 2219 if (enabled == state().m_imageSmoothingEnabled) |
2221 return; | 2220 return; |
2222 | 2221 |
2223 GraphicsContext* c = drawingContext(); | 2222 GraphicsContext* c = drawingContext(); |
2224 realizeSaves(c); | 2223 realizeSaves(c); |
2225 modifiableState().m_imageSmoothingEnabled = enabled; | 2224 modifiableState().m_imageSmoothingEnabled = enabled; |
2226 if (c) | 2225 if (c) |
2227 c->setImageInterpolationQuality(enabled ? CanvasDefaultInterpolationQual
ity : InterpolationNone); | 2226 c->setImageInterpolationQuality(enabled ? CanvasDefaultInterpolationQual
ity : InterpolationNone); |
2228 } | 2227 } |
2229 | 2228 |
2230 PassRefPtrWillBeRawPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getC
ontextAttributes() const | 2229 void CanvasRenderingContext2D::getContextAttributes(Canvas2DContextAttributes& a
ttrs) const |
2231 { | 2230 { |
2232 RefPtrWillBeRawPtr<Canvas2DContextAttributes> attributes = Canvas2DContextAt
tributes::create(); | 2231 attrs.setAlpha(m_hasAlpha); |
2233 attributes->setAlpha(m_hasAlpha); | |
2234 return attributes.release(); | |
2235 } | 2232 } |
2236 | 2233 |
2237 void CanvasRenderingContext2D::drawFocusIfNeeded(Element* element) | 2234 void CanvasRenderingContext2D::drawFocusIfNeeded(Element* element) |
2238 { | 2235 { |
2239 drawFocusIfNeededInternal(m_path, element); | 2236 drawFocusIfNeededInternal(m_path, element); |
2240 } | 2237 } |
2241 | 2238 |
2242 void CanvasRenderingContext2D::drawFocusIfNeeded(Path2D* path2d, Element* elemen
t) | 2239 void CanvasRenderingContext2D::drawFocusIfNeeded(Path2D* path2d, Element* elemen
t) |
2243 { | 2240 { |
2244 drawFocusIfNeededInternal(path2d->path(), element); | 2241 drawFocusIfNeededInternal(path2d->path(), element); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2360 | 2357 |
2361 unsigned CanvasRenderingContext2D::hitRegionsCount() const | 2358 unsigned CanvasRenderingContext2D::hitRegionsCount() const |
2362 { | 2359 { |
2363 if (m_hitRegionManager) | 2360 if (m_hitRegionManager) |
2364 return m_hitRegionManager->getHitRegionsCount(); | 2361 return m_hitRegionManager->getHitRegionsCount(); |
2365 | 2362 |
2366 return 0; | 2363 return 0; |
2367 } | 2364 } |
2368 | 2365 |
2369 } // namespace blink | 2366 } // namespace blink |
OLD | NEW |