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

Side by Side Diff: Source/core/css/FontFace.cpp

Issue 373423002: Split Dictionary's get and convert into DictionaryHelper. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed LICENSE and windows build Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/css/FontFace.h" 32 #include "core/css/FontFace.h"
33 33
34 #include "bindings/core/v8/Dictionary.h" 34 #include "bindings/core/v8/Dictionary.h"
35 #include "bindings/core/v8/DictionaryHelper.h"
35 #include "bindings/core/v8/ExceptionState.h" 36 #include "bindings/core/v8/ExceptionState.h"
36 #include "bindings/core/v8/ScriptPromiseResolver.h" 37 #include "bindings/core/v8/ScriptPromiseResolver.h"
37 #include "bindings/core/v8/ScriptState.h" 38 #include "bindings/core/v8/ScriptState.h"
38 #include "core/CSSValueKeywords.h" 39 #include "core/CSSValueKeywords.h"
39 #include "core/css/BinaryDataFontFaceSource.h" 40 #include "core/css/BinaryDataFontFaceSource.h"
40 #include "core/css/CSSFontFace.h" 41 #include "core/css/CSSFontFace.h"
41 #include "core/css/CSSFontFaceSrcValue.h" 42 #include "core/css/CSSFontFaceSrcValue.h"
42 #include "core/css/CSSFontSelector.h" 43 #include "core/css/CSSFontSelector.h"
43 #include "core/css/CSSPrimitiveValue.h" 44 #include "core/css/CSSPrimitiveValue.h"
44 #include "core/css/CSSUnicodeRangeValue.h" 45 #include "core/css/CSSUnicodeRangeValue.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return parsedStyle->getPropertyCSSValue(propertyID); 104 return parsedStyle->getPropertyCSSValue(propertyID);
104 } 105 }
105 106
106 static bool initFontFace(FontFace* fontFace, ExecutionContext* context, const At omicString& family, const Dictionary& descriptors, ExceptionState& exceptionStat e) 107 static bool initFontFace(FontFace* fontFace, ExecutionContext* context, const At omicString& family, const Dictionary& descriptors, ExceptionState& exceptionStat e)
107 { 108 {
108 fontFace->setFamily(context, family, exceptionState); 109 fontFace->setFamily(context, family, exceptionState);
109 if (exceptionState.hadException()) 110 if (exceptionState.hadException())
110 return false; 111 return false;
111 112
112 String value; 113 String value;
113 if (descriptors.get("style", value)) { 114 if (DictionaryHelper::get(descriptors, "style", value)) {
114 fontFace->setStyle(context, value, exceptionState); 115 fontFace->setStyle(context, value, exceptionState);
115 if (exceptionState.hadException()) 116 if (exceptionState.hadException())
116 return false; 117 return false;
117 } 118 }
118 if (descriptors.get("weight", value)) { 119 if (DictionaryHelper::get(descriptors, "weight", value)) {
119 fontFace->setWeight(context, value, exceptionState); 120 fontFace->setWeight(context, value, exceptionState);
120 if (exceptionState.hadException()) 121 if (exceptionState.hadException())
121 return false; 122 return false;
122 } 123 }
123 if (descriptors.get("stretch", value)) { 124 if (DictionaryHelper::get(descriptors, "stretch", value)) {
124 fontFace->setStretch(context, value, exceptionState); 125 fontFace->setStretch(context, value, exceptionState);
125 if (exceptionState.hadException()) 126 if (exceptionState.hadException())
126 return false; 127 return false;
127 } 128 }
128 if (descriptors.get("unicodeRange", value)) { 129 if (DictionaryHelper::get(descriptors, "unicodeRange", value)) {
129 fontFace->setUnicodeRange(context, value, exceptionState); 130 fontFace->setUnicodeRange(context, value, exceptionState);
130 if (exceptionState.hadException()) 131 if (exceptionState.hadException())
131 return false; 132 return false;
132 } 133 }
133 if (descriptors.get("variant", value)) { 134 if (DictionaryHelper::get(descriptors, "variant", value)) {
134 fontFace->setVariant(context, value, exceptionState); 135 fontFace->setVariant(context, value, exceptionState);
135 if (exceptionState.hadException()) 136 if (exceptionState.hadException())
136 return false; 137 return false;
137 } 138 }
138 if (descriptors.get("featureSettings", value)) { 139 if (DictionaryHelper::get(descriptors, "featureSettings", value)) {
139 fontFace->setFeatureSettings(context, value, exceptionState); 140 fontFace->setFeatureSettings(context, value, exceptionState);
140 if (exceptionState.hadException()) 141 if (exceptionState.hadException())
141 return false; 142 return false;
142 } 143 }
143 return true; 144 return true;
144 } 145 }
145 146
146 PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, con st AtomicString& family, const String& source, const Dictionary& descriptors, Ex ceptionState& exceptionState) 147 PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, con st AtomicString& family, const String& source, const Dictionary& descriptors, Ex ceptionState& exceptionState)
147 { 148 {
148 RefPtrWillBeRawPtr<CSSValue> src = parseCSSValue(toDocument(context), source , CSSPropertySrc); 149 RefPtrWillBeRawPtr<CSSValue> src = parseCSSValue(toDocument(context), source , CSSPropertySrc);
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 visitor->trace(m_cssFontFace); 631 visitor->trace(m_cssFontFace);
631 visitor->trace(m_callbacks); 632 visitor->trace(m_callbacks);
632 } 633 }
633 634
634 bool FontFace::hadBlankText() const 635 bool FontFace::hadBlankText() const
635 { 636 {
636 return m_cssFontFace->hadBlankText(); 637 return m_cssFontFace->hadBlankText();
637 } 638 }
638 639
639 } // namespace WebCore 640 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698