OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 220 |
221 void registerMockedHttpURLLoadWithMimeType(const std::string& fileName, | 221 void registerMockedHttpURLLoadWithMimeType(const std::string& fileName, |
222 const std::string& mimeType) { | 222 const std::string& mimeType) { |
223 URLTestHelpers::registerMockedURLFromBaseURL( | 223 URLTestHelpers::registerMockedURLFromBaseURL( |
224 WebString::fromUTF8(m_baseURL.c_str()), | 224 WebString::fromUTF8(m_baseURL.c_str()), |
225 WebString::fromUTF8(fileName.c_str()), WebString::fromUTF8(mimeType)); | 225 WebString::fromUTF8(fileName.c_str()), WebString::fromUTF8(mimeType)); |
226 } | 226 } |
227 | 227 |
228 void applyViewportStyleOverride( | 228 void applyViewportStyleOverride( |
229 FrameTestHelpers::WebViewHelper* webViewHelper) { | 229 FrameTestHelpers::WebViewHelper* webViewHelper) { |
230 StyleSheetContents* styleSheet = | |
231 StyleSheetContents::create(CSSParserContext(UASheetMode, nullptr)); | |
232 styleSheet->parseString(loadResourceAsASCIIString("viewportAndroid.css")); | |
233 RuleSet* ruleSet = RuleSet::create(); | |
234 ruleSet->addRulesFromSheet(styleSheet, MediaQueryEvaluator("screen")); | |
235 | |
236 Document* document = | 230 Document* document = |
237 toLocalFrame(webViewHelper->webView()->page()->mainFrame())->document(); | 231 toLocalFrame(webViewHelper->webView()->page()->mainFrame())->document(); |
238 document->ensureStyleResolver() | 232 document->settings()->setViewportStyle(WebViewportStyle::Mobile); |
239 .viewportStyleResolver() | 233 ViewportStyleResolver& resolver = |
240 ->collectViewportRules(ruleSet, ViewportStyleResolver::UserAgentOrigin); | 234 document->styleEngine().ensureViewportStyleResolver(); |
241 document->ensureStyleResolver().viewportStyleResolver()->resolve(); | 235 resolver.collectViewportRulesFromUASheets(); |
| 236 resolver.resolve(); |
242 } | 237 } |
243 | 238 |
244 static void configueCompositingWebView(WebSettings* settings) { | 239 static void configueCompositingWebView(WebSettings* settings) { |
245 settings->setAcceleratedCompositingEnabled(true); | 240 settings->setAcceleratedCompositingEnabled(true); |
246 settings->setPreferCompositingToLCDTextEnabled(true); | 241 settings->setPreferCompositingToLCDTextEnabled(true); |
247 } | 242 } |
248 | 243 |
249 static void configureAndroid(WebSettings* settings) { | 244 static void configureAndroid(WebSettings* settings) { |
250 settings->setViewportMetaEnabled(true); | 245 settings->setViewportMetaEnabled(true); |
251 settings->setViewportEnabled(true); | 246 settings->setViewportEnabled(true); |
(...skipping 9945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10197 webViewHelper.webView()->handleInputEvent(endEvent); | 10192 webViewHelper.webView()->handleInputEvent(endEvent); |
10198 webViewHelper.webView()->handleInputEvent(updateEvent); | 10193 webViewHelper.webView()->handleInputEvent(updateEvent); |
10199 | 10194 |
10200 // Try a full Begin/Update/End cycle. | 10195 // Try a full Begin/Update/End cycle. |
10201 webViewHelper.webView()->handleInputEvent(beginEvent); | 10196 webViewHelper.webView()->handleInputEvent(beginEvent); |
10202 webViewHelper.webView()->handleInputEvent(updateEvent); | 10197 webViewHelper.webView()->handleInputEvent(updateEvent); |
10203 webViewHelper.webView()->handleInputEvent(endEvent); | 10198 webViewHelper.webView()->handleInputEvent(endEvent); |
10204 } | 10199 } |
10205 | 10200 |
10206 } // namespace blink | 10201 } // namespace blink |
OLD | NEW |