| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 #include "wtf/MathExtras.h" | 72 #include "wtf/MathExtras.h" |
| 73 #include "wtf/OwnPtr.h" | 73 #include "wtf/OwnPtr.h" |
| 74 #include "wtf/text/StringBuilder.h" | 74 #include "wtf/text/StringBuilder.h" |
| 75 | 75 |
| 76 namespace blink { | 76 namespace blink { |
| 77 | 77 |
| 78 static const int defaultFontSize = 10; | 78 static const int defaultFontSize = 10; |
| 79 static const char defaultFontFamily[] = "sans-serif"; | 79 static const char defaultFontFamily[] = "sans-serif"; |
| 80 static const char defaultFont[] = "10px sans-serif"; | 80 static const char defaultFont[] = "10px sans-serif"; |
| 81 static const char inherit[] = "inherit"; | 81 static const char inherit[] = "inherit"; |
| 82 static const char initial[] = "initial"; | |
| 83 static const char rtl[] = "rtl"; | 82 static const char rtl[] = "rtl"; |
| 84 static const char ltr[] = "ltr"; | 83 static const char ltr[] = "ltr"; |
| 85 static const double TryRestoreContextInterval = 0.5; | 84 static const double TryRestoreContextInterval = 0.5; |
| 86 static const unsigned MaxTryRestoreContextAttempts = 4; | 85 static const unsigned MaxTryRestoreContextAttempts = 4; |
| 87 static const unsigned FetchedFontsCacheLimit = 50; | 86 static const unsigned FetchedFontsCacheLimit = 50; |
| 88 static const float cDeviceScaleFactor = 1.0f; // Canvas is device independent | 87 static const float cDeviceScaleFactor = 1.0f; // Canvas is device independent |
| 89 | 88 |
| 90 static bool contextLostRestoredEventsEnabled() | 89 static bool contextLostRestoredEventsEnabled() |
| 91 { | 90 { |
| 92 return RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled(); | 91 return RuntimeEnabledFeatures::experimentalCanvasFeaturesEnabled(); |
| (...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1675 m_fetchedFontsLRUList.remove(newFont); | 1674 m_fetchedFontsLRUList.remove(newFont); |
| 1676 } else { | 1675 } else { |
| 1677 parsedStyle = MutableStylePropertySet::create(); | 1676 parsedStyle = MutableStylePropertySet::create(); |
| 1678 CSSParser::parseValue(parsedStyle.get(), CSSPropertyFont, newFont, true,
HTMLStandardMode, 0); | 1677 CSSParser::parseValue(parsedStyle.get(), CSSPropertyFont, newFont, true,
HTMLStandardMode, 0); |
| 1679 if (m_fetchedFonts.size() >= FetchedFontsCacheLimit) { | 1678 if (m_fetchedFonts.size() >= FetchedFontsCacheLimit) { |
| 1680 m_fetchedFonts.remove(m_fetchedFontsLRUList.first()); | 1679 m_fetchedFonts.remove(m_fetchedFontsLRUList.first()); |
| 1681 m_fetchedFontsLRUList.removeFirst(); | 1680 m_fetchedFontsLRUList.removeFirst(); |
| 1682 } | 1681 } |
| 1683 if (parsedStyle->isEmpty()) | 1682 if (parsedStyle->isEmpty()) |
| 1684 return; | 1683 return; |
| 1685 String fontValue = parsedStyle->getPropertyValue(CSSPropertyFont); | |
| 1686 // According to http://lists.w3.org/Archives/Public/public-html/2009Jul/
0947.html, | 1684 // According to http://lists.w3.org/Archives/Public/public-html/2009Jul/
0947.html, |
| 1687 // the "inherit" and "initial" values must be ignored. | 1685 // the "inherit" and "initial" values must be ignored. |
| 1688 if (fontValue == inherit || fontValue == initial) | 1686 RefPtrWillBeRawPtr<CSSValue> fontValue = parsedStyle->getPropertyCSSValu
e(CSSPropertyFontSize); |
| 1687 if (fontValue && (fontValue->isInitialValue() || fontValue->isInheritedV
alue())) |
| 1689 return; | 1688 return; |
| 1690 m_fetchedFonts.add(newFont, parsedStyle); | 1689 m_fetchedFonts.add(newFont, parsedStyle); |
| 1691 } | 1690 } |
| 1692 m_fetchedFontsLRUList.add(newFont); | 1691 m_fetchedFontsLRUList.add(newFont); |
| 1693 | 1692 |
| 1694 // The parse succeeded. | 1693 // The parse succeeded. |
| 1695 String newFontSafeCopy(newFont); // Create a string copy since newFont can b
e deleted inside realizeSaves. | 1694 String newFontSafeCopy(newFont); // Create a string copy since newFont can b
e deleted inside realizeSaves. |
| 1696 modifiableState().setUnparsedFont(newFontSafeCopy); | 1695 modifiableState().setUnparsedFont(newFontSafeCopy); |
| 1697 | 1696 |
| 1698 // Map the <canvas> font into the text style. If the font uses keywords like
larger/smaller, these will work | 1697 // Map the <canvas> font into the text style. If the font uses keywords like
larger/smaller, these will work |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2235 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) | 2234 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) |
| 2236 return; | 2235 return; |
| 2237 if (alpha < 0xFF) | 2236 if (alpha < 0xFF) |
| 2238 return; | 2237 return; |
| 2239 } | 2238 } |
| 2240 | 2239 |
| 2241 canvas()->buffer()->willOverwriteCanvas(); | 2240 canvas()->buffer()->willOverwriteCanvas(); |
| 2242 } | 2241 } |
| 2243 | 2242 |
| 2244 } // namespace blink | 2243 } // namespace blink |
| OLD | NEW |