| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
| 3 * | |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions are | |
| 6 * met: | |
| 7 * | |
| 8 * * Redistributions of source code must retain the above copyright | |
| 9 * notice, this list of conditions and the following disclaimer. | |
| 10 * * Redistributions in binary form must reproduce the above | |
| 11 * copyright notice, this list of conditions and the following disclaimer | |
| 12 * in the documentation and/or other materials provided with the | |
| 13 * distribution. | |
| 14 * * Neither the name of Google Inc. nor the names of its | |
| 15 * contributors may be used to endorse or promote products derived from | |
| 16 * this software without specific prior written permission. | |
| 17 * | |
| 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 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. | |
| 29 */ | |
| 30 | |
| 31 #include "sky/engine/web/WebSettingsImpl.h" | |
| 32 | |
| 33 #include "sky/engine/core/frame/Settings.h" | |
| 34 #include "sky/engine/platform/graphics/DeferredImageDecoder.h" | |
| 35 | |
| 36 #include "sky/engine/public/platform/WebString.h" | |
| 37 #include "sky/engine/public/platform/WebURL.h" | |
| 38 | |
| 39 namespace blink { | |
| 40 | |
| 41 WebSettingsImpl::WebSettingsImpl(Settings* settings) | |
| 42 : m_settings(settings) | |
| 43 , m_showPaintRects(false) | |
| 44 , m_renderVSyncNotificationEnabled(false) | |
| 45 , m_deferredImageDecodingEnabled(false) | |
| 46 , m_supportDeprecatedTargetDensityDPI(false) | |
| 47 , m_shrinksViewportContentToFit(false) | |
| 48 , m_mainFrameResizesAreOrientationChanges(false) | |
| 49 { | |
| 50 ASSERT(settings); | |
| 51 } | |
| 52 | |
| 53 void WebSettingsImpl::setStandardFontFamily(const WebString& font, UScriptCode s
cript) | |
| 54 { | |
| 55 if (m_settings->genericFontFamilySettings().updateStandard(font, script)) | |
| 56 m_settings->notifyGenericFontFamilyChange(); | |
| 57 } | |
| 58 | |
| 59 void WebSettingsImpl::setFixedFontFamily(const WebString& font, UScriptCode scri
pt) | |
| 60 { | |
| 61 if (m_settings->genericFontFamilySettings().updateFixed(font, script)) | |
| 62 m_settings->notifyGenericFontFamilyChange(); | |
| 63 } | |
| 64 | |
| 65 void WebSettingsImpl::setForceZeroLayoutHeight(bool enabled) | |
| 66 { | |
| 67 m_settings->setForceZeroLayoutHeight(enabled); | |
| 68 } | |
| 69 | |
| 70 void WebSettingsImpl::setSerifFontFamily(const WebString& font, UScriptCode scri
pt) | |
| 71 { | |
| 72 if (m_settings->genericFontFamilySettings().updateSerif(font, script)) | |
| 73 m_settings->notifyGenericFontFamilyChange(); | |
| 74 } | |
| 75 | |
| 76 void WebSettingsImpl::setSansSerifFontFamily(const WebString& font, UScriptCode
script) | |
| 77 { | |
| 78 if (m_settings->genericFontFamilySettings().updateSansSerif(font, script)) | |
| 79 m_settings->notifyGenericFontFamilyChange(); | |
| 80 } | |
| 81 | |
| 82 void WebSettingsImpl::setCursiveFontFamily(const WebString& font, UScriptCode sc
ript) | |
| 83 { | |
| 84 if (m_settings->genericFontFamilySettings().updateCursive(font, script)) | |
| 85 m_settings->notifyGenericFontFamilyChange(); | |
| 86 } | |
| 87 | |
| 88 void WebSettingsImpl::setFantasyFontFamily(const WebString& font, UScriptCode sc
ript) | |
| 89 { | |
| 90 if (m_settings->genericFontFamilySettings().updateFantasy(font, script)) | |
| 91 m_settings->notifyGenericFontFamilyChange(); | |
| 92 } | |
| 93 | |
| 94 void WebSettingsImpl::setPictographFontFamily(const WebString& font, UScriptCode
script) | |
| 95 { | |
| 96 if (m_settings->genericFontFamilySettings().updatePictograph(font, script)) | |
| 97 m_settings->notifyGenericFontFamilyChange(); | |
| 98 } | |
| 99 | |
| 100 void WebSettingsImpl::setDefaultFontSize(int size) | |
| 101 { | |
| 102 m_settings->setDefaultFontSize(size); | |
| 103 } | |
| 104 | |
| 105 void WebSettingsImpl::setDefaultFixedFontSize(int size) | |
| 106 { | |
| 107 m_settings->setDefaultFixedFontSize(size); | |
| 108 } | |
| 109 | |
| 110 void WebSettingsImpl::setDefaultVideoPosterURL(const WebString& url) | |
| 111 { | |
| 112 m_settings->setDefaultVideoPosterURL(url); | |
| 113 } | |
| 114 | |
| 115 void WebSettingsImpl::setDeviceSupportsTouch(bool deviceSupportsTouch) | |
| 116 { | |
| 117 m_settings->setDeviceSupportsTouch(deviceSupportsTouch); | |
| 118 | |
| 119 // FIXME: Until the embedder is converted to using the new APIs, set them | |
| 120 // here to keep the media queries working unchanged. | |
| 121 if (deviceSupportsTouch) { | |
| 122 m_settings->setPrimaryPointerType(blink::PointerTypeCoarse); | |
| 123 m_settings->setPrimaryHoverType(blink::HoverTypeOnDemand); | |
| 124 } else { | |
| 125 m_settings->setPrimaryPointerType(blink::PointerTypeNone); | |
| 126 m_settings->setPrimaryHoverType(blink::HoverTypeNone); | |
| 127 } | |
| 128 } | |
| 129 | |
| 130 void WebSettingsImpl::setDeviceSupportsMouse(bool deviceSupportsMouse) | |
| 131 { | |
| 132 m_settings->setDeviceSupportsMouse(deviceSupportsMouse); | |
| 133 } | |
| 134 | |
| 135 void WebSettingsImpl::setDefaultTextEncodingName(const WebString& encoding) | |
| 136 { | |
| 137 m_settings->setDefaultTextEncodingName((String)encoding); | |
| 138 } | |
| 139 | |
| 140 void WebSettingsImpl::setSupportDeprecatedTargetDensityDPI(bool supportDeprecate
dTargetDensityDPI) | |
| 141 { | |
| 142 m_supportDeprecatedTargetDensityDPI = supportDeprecatedTargetDensityDPI; | |
| 143 } | |
| 144 | |
| 145 void WebSettingsImpl::setLoadsImagesAutomatically(bool loadsImagesAutomatically) | |
| 146 { | |
| 147 m_settings->setLoadsImagesAutomatically(loadsImagesAutomatically); | |
| 148 } | |
| 149 | |
| 150 void WebSettingsImpl::setImagesEnabled(bool enabled) | |
| 151 { | |
| 152 m_settings->setImagesEnabled(enabled); | |
| 153 } | |
| 154 | |
| 155 void WebSettingsImpl::setLoadWithOverviewMode(bool enabled) | |
| 156 { | |
| 157 m_settings->setLoadWithOverviewMode(enabled); | |
| 158 } | |
| 159 | |
| 160 void WebSettingsImpl::setAvailablePointerTypes(int pointers) | |
| 161 { | |
| 162 m_settings->setAvailablePointerTypes(pointers); | |
| 163 } | |
| 164 | |
| 165 void WebSettingsImpl::setPrimaryPointerType(PointerType pointer) | |
| 166 { | |
| 167 m_settings->setPrimaryPointerType(static_cast<blink::PointerType>(pointer)); | |
| 168 } | |
| 169 | |
| 170 void WebSettingsImpl::setAvailableHoverTypes(int types) | |
| 171 { | |
| 172 m_settings->setAvailableHoverTypes(types); | |
| 173 } | |
| 174 | |
| 175 void WebSettingsImpl::setPrimaryHoverType(HoverType type) | |
| 176 { | |
| 177 m_settings->setPrimaryHoverType(static_cast<blink::HoverType>(type)); | |
| 178 } | |
| 179 | |
| 180 void WebSettingsImpl::setDOMPasteAllowed(bool enabled) | |
| 181 { | |
| 182 m_settings->setDOMPasteAllowed(enabled); | |
| 183 } | |
| 184 | |
| 185 void WebSettingsImpl::setShrinksViewportContentToFit(bool shrinkViewportContent) | |
| 186 { | |
| 187 m_shrinksViewportContentToFit = shrinkViewportContent; | |
| 188 } | |
| 189 | |
| 190 void WebSettingsImpl::setUseWideViewport(bool useWideViewport) | |
| 191 { | |
| 192 m_settings->setUseWideViewport(useWideViewport); | |
| 193 } | |
| 194 | |
| 195 void WebSettingsImpl::setDownloadableBinaryFontsEnabled(bool enabled) | |
| 196 { | |
| 197 m_settings->setDownloadableBinaryFontsEnabled(enabled); | |
| 198 } | |
| 199 | |
| 200 void WebSettingsImpl::setJavaScriptCanAccessClipboard(bool enabled) | |
| 201 { | |
| 202 m_settings->setJavaScriptCanAccessClipboard(enabled); | |
| 203 } | |
| 204 | |
| 205 void WebSettingsImpl::setMainFrameClipsContent(bool enabled) | |
| 206 { | |
| 207 m_settings->setMainFrameClipsContent(enabled); | |
| 208 } | |
| 209 | |
| 210 void WebSettingsImpl::setTouchEditingEnabled(bool enabled) | |
| 211 { | |
| 212 m_settings->setTouchEditingEnabled(enabled); | |
| 213 } | |
| 214 | |
| 215 void WebSettingsImpl::setExperimentalWebGLEnabled(bool enabled) | |
| 216 { | |
| 217 m_settings->setWebGLEnabled(enabled); | |
| 218 } | |
| 219 | |
| 220 void WebSettingsImpl::setOpenGLMultisamplingEnabled(bool enabled) | |
| 221 { | |
| 222 m_settings->setOpenGLMultisamplingEnabled(enabled); | |
| 223 } | |
| 224 | |
| 225 void WebSettingsImpl::setRenderVSyncNotificationEnabled(bool enabled) | |
| 226 { | |
| 227 m_renderVSyncNotificationEnabled = enabled; | |
| 228 } | |
| 229 | |
| 230 void WebSettingsImpl::setWebGLErrorsToConsoleEnabled(bool enabled) | |
| 231 { | |
| 232 m_settings->setWebGLErrorsToConsoleEnabled(enabled); | |
| 233 } | |
| 234 | |
| 235 void WebSettingsImpl::setShowPaintRects(bool show) | |
| 236 { | |
| 237 m_showPaintRects = show; | |
| 238 } | |
| 239 | |
| 240 void WebSettingsImpl::setMockGestureTapHighlightsEnabled(bool enabled) | |
| 241 { | |
| 242 m_settings->setMockGestureTapHighlightsEnabled(enabled); | |
| 243 } | |
| 244 | |
| 245 void WebSettingsImpl::setAccelerated2dCanvasEnabled(bool enabled) | |
| 246 { | |
| 247 m_settings->setAccelerated2dCanvasEnabled(enabled); | |
| 248 } | |
| 249 | |
| 250 void WebSettingsImpl::setAccelerated2dCanvasMSAASampleCount(int count) | |
| 251 { | |
| 252 m_settings->setAccelerated2dCanvasMSAASampleCount(count); | |
| 253 } | |
| 254 | |
| 255 void WebSettingsImpl::setAntialiased2dCanvasEnabled(bool enabled) | |
| 256 { | |
| 257 m_settings->setAntialiased2dCanvasEnabled(enabled); | |
| 258 } | |
| 259 | |
| 260 void WebSettingsImpl::setContainerCullingEnabled(bool enabled) | |
| 261 { | |
| 262 m_settings->setContainerCullingEnabled(enabled); | |
| 263 } | |
| 264 | |
| 265 void WebSettingsImpl::setDeferredImageDecodingEnabled(bool enabled) | |
| 266 { | |
| 267 DeferredImageDecoder::setEnabled(enabled); | |
| 268 m_deferredImageDecodingEnabled = enabled; | |
| 269 } | |
| 270 | |
| 271 void WebSettingsImpl::setMinimumAccelerated2dCanvasSize(int numPixels) | |
| 272 { | |
| 273 m_settings->setMinimumAccelerated2dCanvasSize(numPixels); | |
| 274 } | |
| 275 | |
| 276 void WebSettingsImpl::setAsynchronousSpellCheckingEnabled(bool enabled) | |
| 277 { | |
| 278 m_settings->setAsynchronousSpellCheckingEnabled(enabled); | |
| 279 } | |
| 280 | |
| 281 void WebSettingsImpl::setUnifiedTextCheckerEnabled(bool enabled) | |
| 282 { | |
| 283 m_settings->setUnifiedTextCheckerEnabled(enabled); | |
| 284 } | |
| 285 | |
| 286 void WebSettingsImpl::setPerTilePaintingEnabled(bool enabled) | |
| 287 { | |
| 288 m_perTilePaintingEnabled = enabled; | |
| 289 } | |
| 290 | |
| 291 void WebSettingsImpl::setShouldClearDocumentBackground(bool enabled) | |
| 292 { | |
| 293 m_settings->setShouldClearDocumentBackground(enabled); | |
| 294 } | |
| 295 | |
| 296 int WebSettingsImpl::availablePointerTypes() const | |
| 297 { | |
| 298 return m_settings->availablePointerTypes(); | |
| 299 } | |
| 300 | |
| 301 WebSettings::PointerType WebSettingsImpl::primaryPointerType() const | |
| 302 { | |
| 303 return static_cast<PointerType>(m_settings->primaryPointerType()); | |
| 304 } | |
| 305 | |
| 306 int WebSettingsImpl::availableHoverTypes() const | |
| 307 { | |
| 308 return m_settings->availableHoverTypes(); | |
| 309 } | |
| 310 | |
| 311 WebSettings::HoverType WebSettingsImpl::primaryHoverType() const | |
| 312 { | |
| 313 return static_cast<HoverType>(m_settings->primaryHoverType()); | |
| 314 } | |
| 315 | |
| 316 bool WebSettingsImpl::mockGestureTapHighlightsEnabled() const | |
| 317 { | |
| 318 return m_settings->mockGestureTapHighlightsEnabled(); | |
| 319 } | |
| 320 | |
| 321 bool WebSettingsImpl::mainFrameResizesAreOrientationChanges() const | |
| 322 { | |
| 323 return m_mainFrameResizesAreOrientationChanges; | |
| 324 } | |
| 325 | |
| 326 bool WebSettingsImpl::shrinksViewportContentToFit() const | |
| 327 { | |
| 328 return m_shrinksViewportContentToFit; | |
| 329 } | |
| 330 | |
| 331 void WebSettingsImpl::setShouldRespectImageOrientation(bool enabled) | |
| 332 { | |
| 333 m_settings->setShouldRespectImageOrientation(enabled); | |
| 334 } | |
| 335 | |
| 336 void WebSettingsImpl::setMediaControlsOverlayPlayButtonEnabled(bool enabled) | |
| 337 { | |
| 338 } | |
| 339 | |
| 340 void WebSettingsImpl::setSelectionIncludesAltImageText(bool enabled) | |
| 341 { | |
| 342 m_settings->setSelectionIncludesAltImageText(enabled); | |
| 343 } | |
| 344 | |
| 345 void WebSettingsImpl::setSmartInsertDeleteEnabled(bool enabled) | |
| 346 { | |
| 347 m_settings->setSmartInsertDeleteEnabled(enabled); | |
| 348 } | |
| 349 | |
| 350 void WebSettingsImpl::setMainFrameResizesAreOrientationChanges(bool enabled) | |
| 351 { | |
| 352 m_mainFrameResizesAreOrientationChanges = enabled; | |
| 353 } | |
| 354 | |
| 355 } // namespace blink | |
| OLD | NEW |