Commit b5311b2a authored by noyau's avatar noyau Committed by Commit bot

Fix style on iOS for distilled content.

On iOS the resource load can't be highjacked to be replaced by local
content: Inlining the necessary resources and fixing the CSS so the page
actually scrolls on iOS.

BUG=None

Review URL: https://codereview.chromium.org/1008993007

Cr-Commit-Position: refs/heads/master@{#322138}
parent 43cdf67d
......@@ -79,6 +79,7 @@ html {
line-height: 1.4;
text-rendering: optimizeLegibility;
overflow-x: hidden;
-webkit-overflow-scrolling: touch;
}
/* Classes for light, dark and sepia themes.
......
......@@ -9,7 +9,7 @@ found in the LICENSE file.
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<title>$1</title>
<link rel="stylesheet" href="/$2">
$2
<link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
</head>
<body dir="$9" class="$4">
......@@ -78,5 +78,5 @@ found in the LICENSE file.
<a href="$7">$8</a>
</div>
</body>
<script src="/$3"></script>
$3
</html>
......@@ -113,8 +113,21 @@ std::string ReplaceHtmlTemplateValues(
IDR_DOM_DISTILLER_VIEWER_HTML);
std::vector<std::string> substitutions;
substitutions.push_back(title); // $1
substitutions.push_back(kViewerCssPath); // $2
substitutions.push_back(kViewerJsPath); // $3
std::ostringstream css;
std::ostringstream script;
#if defined(OS_IOS)
// On iOS the content is inlined as there is no API to detect those requests
// and return the local data once a page is loaded.
css << "<style>" << viewer::GetCss() << "</style>";
script << "<script>\n" << viewer::GetJavaScript() << "\n</script>";
#else
css << "<link rel=\"stylesheet\" href=\"/" << kViewerCssPath << "\">";
script << "<script src=\"" << kViewerJsPath << "\"></script>";
#endif // defined(OS_IOS)
substitutions.push_back(css.str()); // $2
substitutions.push_back(script.str()); // $3
substitutions.push_back(GetThemeCssClass(theme) + " " +
GetFontCssClass(font_family)); // $4
substitutions.push_back(content); // $5
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment