| 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 URLTestHelpers::registerMockedURLLoadWithCustomResponse(toKURL(fullStrin
g.c_str()), WebString::fromUTF8(fileName.c_str()), WebString::fromUTF8(""), resp
onse); | 211 URLTestHelpers::registerMockedURLLoadWithCustomResponse(toKURL(fullStrin
g.c_str()), WebString::fromUTF8(fileName.c_str()), WebString::fromUTF8(""), resp
onse); |
| 212 } | 212 } |
| 213 | 213 |
| 214 void registerMockedHttpURLLoadWithMimeType(const std::string& fileName, cons
t std::string& mimeType) | 214 void registerMockedHttpURLLoadWithMimeType(const std::string& fileName, cons
t std::string& mimeType) |
| 215 { | 215 { |
| 216 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU
RL.c_str()), WebString::fromUTF8(fileName.c_str()), WebString::fromUTF8(mimeType
)); | 216 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU
RL.c_str()), WebString::fromUTF8(fileName.c_str()), WebString::fromUTF8(mimeType
)); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void applyViewportStyleOverride(FrameTestHelpers::WebViewHelper* webViewHelp
er) | 219 void applyViewportStyleOverride(FrameTestHelpers::WebViewHelper* webViewHelp
er) |
| 220 { | 220 { |
| 221 StyleSheetContents* styleSheet = StyleSheetContents::create(CSSParserCon
text(UASheetMode, 0)); | |
| 222 styleSheet->parseString(loadResourceAsASCIIString("viewportAndroid.css")
); | |
| 223 RuleSet* ruleSet = RuleSet::create(); | |
| 224 ruleSet->addRulesFromSheet(styleSheet, MediaQueryEvaluator("screen")); | |
| 225 | |
| 226 Document* document = toLocalFrame(webViewHelper->webViewImpl()->page()->
mainFrame())->document(); | 221 Document* document = toLocalFrame(webViewHelper->webViewImpl()->page()->
mainFrame())->document(); |
| 227 document->ensureStyleResolver().viewportStyleResolver()->collectViewport
Rules(ruleSet, ViewportStyleResolver::UserAgentOrigin); | 222 document->settings()->setViewportStyle(WebViewportStyle::Mobile); |
| 228 document->ensureStyleResolver().viewportStyleResolver()->resolve(); | 223 document->styleEngine().ensureViewportStyleResolver().collectViewportRul
esFromUASheets(); |
| 224 document->styleEngine().ensureViewportStyleResolver().resolve(); |
| 229 } | 225 } |
| 230 | 226 |
| 231 static void configueCompositingWebView(WebSettings* settings) | 227 static void configueCompositingWebView(WebSettings* settings) |
| 232 { | 228 { |
| 233 settings->setAcceleratedCompositingEnabled(true); | 229 settings->setAcceleratedCompositingEnabled(true); |
| 234 settings->setPreferCompositingToLCDTextEnabled(true); | 230 settings->setPreferCompositingToLCDTextEnabled(true); |
| 235 } | 231 } |
| 236 | 232 |
| 237 static void configureAndroid(WebSettings* settings) | 233 static void configureAndroid(WebSettings* settings) |
| 238 { | 234 { |
| (...skipping 8445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8684 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); | 8680 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); |
| 8685 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 8681 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 8686 mainFrame->executeScript(WebScriptSource("hello = 'world';")); | 8682 mainFrame->executeScript(WebScriptSource("hello = 'world';")); |
| 8687 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); | 8683 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); |
| 8688 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri
ptSource("hello")); | 8684 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri
ptSource("hello")); |
| 8689 ASSERT_TRUE(result->IsString()); | 8685 ASSERT_TRUE(result->IsString()); |
| 8690 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC
ontext()).ToLocalChecked())); | 8686 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC
ontext()).ToLocalChecked())); |
| 8691 } | 8687 } |
| 8692 | 8688 |
| 8693 } // namespace blink | 8689 } // namespace blink |
| OLD | NEW |