OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 settings->setMockScrollbarsEnabled(m_originalMockScrollbarsEnabled); | 95 settings->setMockScrollbarsEnabled(m_originalMockScrollbarsEnabled); |
96 RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(m_langAttr
ibuteAwareFormControlUIEnabled); | 96 RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(m_langAttr
ibuteAwareFormControlUIEnabled); |
97 settings->setImagesEnabled(m_imagesEnabled); | 97 settings->setImagesEnabled(m_imagesEnabled); |
98 settings->setShouldDisplaySubtitles(m_shouldDisplaySubtitles); | 98 settings->setShouldDisplaySubtitles(m_shouldDisplaySubtitles); |
99 settings->setShouldDisplayCaptions(m_shouldDisplayCaptions); | 99 settings->setShouldDisplayCaptions(m_shouldDisplayCaptions); |
100 settings->setShouldDisplayTextDescriptions(m_shouldDisplayTextDescriptions); | 100 settings->setShouldDisplayTextDescriptions(m_shouldDisplayTextDescriptions); |
101 settings->setDefaultVideoPosterURL(m_defaultVideoPosterURL); | 101 settings->setDefaultVideoPosterURL(m_defaultVideoPosterURL); |
102 settings->setCompositorDrivenAcceleratedScrollingEnabled(m_originalComposito
rDrivenAcceleratedScrollEnabled); | 102 settings->setCompositorDrivenAcceleratedScrollingEnabled(m_originalComposito
rDrivenAcceleratedScrollEnabled); |
103 settings->setLayerSquashingEnabled(m_originalLayerSquashingEnabled); | 103 settings->setLayerSquashingEnabled(m_originalLayerSquashingEnabled); |
104 settings->setPasswordGenerationDecorationEnabled(m_originalPasswordGeneratio
nDecorationEnabled); | 104 settings->setPasswordGenerationDecorationEnabled(m_originalPasswordGeneratio
nDecorationEnabled); |
105 settings->resetFontFamilies(); | 105 settings->genericFontFamilySettings().reset(); |
106 } | 106 } |
107 | 107 |
108 // We can't use RefCountedSupplement because that would try to make InternalSett
ings RefCounted | 108 // We can't use RefCountedSupplement because that would try to make InternalSett
ings RefCounted |
109 // and InternalSettings is already RefCounted via its base class, InternalSettin
gsGenerated. | 109 // and InternalSettings is already RefCounted via its base class, InternalSettin
gsGenerated. |
110 // Instead, we manually make InternalSettings supplement Page. | 110 // Instead, we manually make InternalSettings supplement Page. |
111 class InternalSettingsWrapper : public Supplement<Page> { | 111 class InternalSettingsWrapper : public Supplement<Page> { |
112 public: | 112 public: |
113 explicit InternalSettingsWrapper(Page* page) | 113 explicit InternalSettingsWrapper(Page* page) |
114 : m_internalSettings(InternalSettings::create(page)) { } | 114 : m_internalSettings(InternalSettings::create(page)) { } |
115 virtual ~InternalSettingsWrapper() { m_internalSettings->hostDestroyed(); } | 115 virtual ~InternalSettingsWrapper() { m_internalSettings->hostDestroyed(); } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 209 } |
210 | 210 |
211 // FIXME: This is a temporary flag and should be removed once squashing is | 211 // FIXME: This is a temporary flag and should be removed once squashing is |
212 // ready (crbug.com/261605). | 212 // ready (crbug.com/261605). |
213 void InternalSettings::setLayerSquashingEnabled(bool enabled, ExceptionState& ex
ceptionState) | 213 void InternalSettings::setLayerSquashingEnabled(bool enabled, ExceptionState& ex
ceptionState) |
214 { | 214 { |
215 InternalSettingsGuardForSettings(); | 215 InternalSettingsGuardForSettings(); |
216 settings()->setLayerSquashingEnabled(enabled); | 216 settings()->setLayerSquashingEnabled(enabled); |
217 } | 217 } |
218 | 218 |
219 typedef void (Settings::*SetFontFamilyFunction)(const AtomicString&, UScriptCode
); | |
220 static void setFontFamily(Settings* settings, const String& family, const String
& script, SetFontFamilyFunction setter) | |
221 { | |
222 UScriptCode code = scriptNameToCode(script); | |
223 if (code != USCRIPT_INVALID_CODE) | |
224 (settings->*setter)(family, code); | |
225 } | |
226 | |
227 void InternalSettings::setStandardFontFamily(const String& family, const String&
script, ExceptionState& exceptionState) | 219 void InternalSettings::setStandardFontFamily(const String& family, const String&
script, ExceptionState& exceptionState) |
228 { | 220 { |
229 InternalSettingsGuardForSettings(); | 221 InternalSettingsGuardForSettings(); |
230 setFontFamily(settings(), family, script, &Settings::setStandardFontFamily); | 222 UScriptCode code = scriptNameToCode(script); |
| 223 if (code == USCRIPT_INVALID_CODE) |
| 224 return; |
| 225 settings()->genericFontFamilySettings().setStandard(family, code); |
| 226 m_page->setNeedsRecalcStyleInAllFrames(); |
231 } | 227 } |
232 | 228 |
233 void InternalSettings::setSerifFontFamily(const String& family, const String& sc
ript, ExceptionState& exceptionState) | 229 void InternalSettings::setSerifFontFamily(const String& family, const String& sc
ript, ExceptionState& exceptionState) |
234 { | 230 { |
235 InternalSettingsGuardForSettings(); | 231 InternalSettingsGuardForSettings(); |
236 setFontFamily(settings(), family, script, &Settings::setSerifFontFamily); | 232 UScriptCode code = scriptNameToCode(script); |
| 233 if (code == USCRIPT_INVALID_CODE) |
| 234 return; |
| 235 settings()->genericFontFamilySettings().setSerif(family, code); |
| 236 m_page->setNeedsRecalcStyleInAllFrames(); |
237 } | 237 } |
238 | 238 |
239 void InternalSettings::setSansSerifFontFamily(const String& family, const String
& script, ExceptionState& exceptionState) | 239 void InternalSettings::setSansSerifFontFamily(const String& family, const String
& script, ExceptionState& exceptionState) |
240 { | 240 { |
241 InternalSettingsGuardForSettings(); | 241 InternalSettingsGuardForSettings(); |
242 setFontFamily(settings(), family, script, &Settings::setSansSerifFontFamily)
; | 242 UScriptCode code = scriptNameToCode(script); |
| 243 if (code == USCRIPT_INVALID_CODE) |
| 244 return; |
| 245 settings()->genericFontFamilySettings().setSansSerif(family, code); |
| 246 m_page->setNeedsRecalcStyleInAllFrames(); |
243 } | 247 } |
244 | 248 |
245 void InternalSettings::setFixedFontFamily(const String& family, const String& sc
ript, ExceptionState& exceptionState) | 249 void InternalSettings::setFixedFontFamily(const String& family, const String& sc
ript, ExceptionState& exceptionState) |
246 { | 250 { |
247 InternalSettingsGuardForSettings(); | 251 InternalSettingsGuardForSettings(); |
248 setFontFamily(settings(), family, script, &Settings::setFixedFontFamily); | 252 UScriptCode code = scriptNameToCode(script); |
| 253 if (code == USCRIPT_INVALID_CODE) |
| 254 return; |
| 255 settings()->genericFontFamilySettings().setFixed(family, code); |
| 256 m_page->setNeedsRecalcStyleInAllFrames(); |
249 } | 257 } |
250 | 258 |
251 void InternalSettings::setCursiveFontFamily(const String& family, const String&
script, ExceptionState& exceptionState) | 259 void InternalSettings::setCursiveFontFamily(const String& family, const String&
script, ExceptionState& exceptionState) |
252 { | 260 { |
253 InternalSettingsGuardForSettings(); | 261 InternalSettingsGuardForSettings(); |
254 setFontFamily(settings(), family, script, &Settings::setCursiveFontFamily); | 262 UScriptCode code = scriptNameToCode(script); |
| 263 if (code == USCRIPT_INVALID_CODE) |
| 264 return; |
| 265 settings()->genericFontFamilySettings().setCursive(family, code); |
| 266 m_page->setNeedsRecalcStyleInAllFrames(); |
255 } | 267 } |
256 | 268 |
257 void InternalSettings::setFantasyFontFamily(const String& family, const String&
script, ExceptionState& exceptionState) | 269 void InternalSettings::setFantasyFontFamily(const String& family, const String&
script, ExceptionState& exceptionState) |
258 { | 270 { |
259 InternalSettingsGuardForSettings(); | 271 InternalSettingsGuardForSettings(); |
260 setFontFamily(settings(), family, script, &Settings::setFantasyFontFamily); | 272 UScriptCode code = scriptNameToCode(script); |
| 273 if (code == USCRIPT_INVALID_CODE) |
| 274 return; |
| 275 settings()->genericFontFamilySettings().setFantasy(family, code); |
| 276 m_page->setNeedsRecalcStyleInAllFrames(); |
261 } | 277 } |
262 | 278 |
263 void InternalSettings::setPictographFontFamily(const String& family, const Strin
g& script, ExceptionState& exceptionState) | 279 void InternalSettings::setPictographFontFamily(const String& family, const Strin
g& script, ExceptionState& exceptionState) |
264 { | 280 { |
265 InternalSettingsGuardForSettings(); | 281 InternalSettingsGuardForSettings(); |
266 setFontFamily(settings(), family, script, &Settings::setPictographFontFamily
); | 282 UScriptCode code = scriptNameToCode(script); |
| 283 if (code == USCRIPT_INVALID_CODE) |
| 284 return; |
| 285 settings()->genericFontFamilySettings().setPictograph(family, code); |
| 286 m_page->setNeedsRecalcStyleInAllFrames(); |
267 } | 287 } |
268 | 288 |
269 void InternalSettings::setTextAutosizingEnabled(bool enabled, ExceptionState& ex
ceptionState) | 289 void InternalSettings::setTextAutosizingEnabled(bool enabled, ExceptionState& ex
ceptionState) |
270 { | 290 { |
271 InternalSettingsGuardForSettings(); | 291 InternalSettingsGuardForSettings(); |
272 settings()->setTextAutosizingEnabled(enabled); | 292 settings()->setTextAutosizingEnabled(enabled); |
273 } | 293 } |
274 | 294 |
275 void InternalSettings::setTextAutosizingWindowSizeOverride(int width, int height
, ExceptionState& exceptionState) | 295 void InternalSettings::setTextAutosizingWindowSizeOverride(int width, int height
, ExceptionState& exceptionState) |
276 { | 296 { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 settings()->setDefaultVideoPosterURL(url); | 347 settings()->setDefaultVideoPosterURL(url); |
328 } | 348 } |
329 | 349 |
330 void InternalSettings::setPasswordGenerationDecorationEnabled(bool enabled, Exce
ptionState& exceptionState) | 350 void InternalSettings::setPasswordGenerationDecorationEnabled(bool enabled, Exce
ptionState& exceptionState) |
331 { | 351 { |
332 InternalSettingsGuardForSettings(); | 352 InternalSettingsGuardForSettings(); |
333 settings()->setPasswordGenerationDecorationEnabled(enabled); | 353 settings()->setPasswordGenerationDecorationEnabled(enabled); |
334 } | 354 } |
335 | 355 |
336 } | 356 } |
OLD | NEW |