Commit 47a04dee authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Change image preview document to no-quirks mode

Quirks mode layout is slower than no-quirks. This change should
not affect the appearance of the image preview document.

Bug: 1131185
Change-Id: I79e8b523fa518ddd7a230ea7f669df63e023b9e5
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2425008
Commit-Queue: Mason Freed <masonfreed@chromium.org>
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Reviewed-by: default avatarFredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#810100}
parent 33155c5c
......@@ -197,7 +197,7 @@ function testRemoveSelf(page, pattern) {
var kDefaultPattern = /</;
if (page.includes('start')) {
pattern = pattern || /^<html><\/html>$/;
pattern = pattern || /^<\s*html[^>]*><\/html>$/;
pattern = TEST_HOST === 'synchronous' ? pattern : kDefaultPattern;
} else if (page.includes('end')) {
pattern = pattern || kDefaultPattern;
......
......@@ -208,7 +208,7 @@ ImageDocument::ImageDocument(const DocumentInit& initializer)
shrink_to_fit_mode_(GetFrame()->GetSettings()->GetViewportEnabled()
? kViewport
: kDesktop) {
SetCompatibilityMode(kQuirksMode);
SetCompatibilityMode(kNoQuirksMode);
LockCompatibilityMode();
}
......@@ -227,6 +227,8 @@ IntSize ImageDocument::ImageSize() const {
void ImageDocument::CreateDocumentStructure(
ImageResourceContent* image_content) {
auto* root_element = MakeGarbageCollected<HTMLHtmlElement>(*this);
root_element->SetInlineStyleProperty(
CSSPropertyID::kHeight, 100, CSSPrimitiveValue::UnitType::kPercentage);
AppendChild(root_element);
root_element->InsertedByParser();
......@@ -245,7 +247,7 @@ void ImageDocument::CreateDocumentStructure(
if (ShouldShrinkToFit()) {
// Display the image prominently centered in the frame.
body->setAttribute(html_names::kStyleAttr,
"margin: 0px; background: #0e0e0e;");
"margin: 0px; background: #0e0e0e; height: 100%");
// See w3c example on how to center an element:
// https://www.w3.org/Style/Examples/007/center.en.html
......@@ -267,7 +269,7 @@ void ImageDocument::CreateDocumentStructure(
ShadowRoot& shadow_root = body->EnsureUserAgentShadowRoot();
shadow_root.AppendChild(div_element_);
} else {
body->setAttribute(html_names::kStyleAttr, "margin: 0px;");
body->setAttribute(html_names::kStyleAttr, "margin: 0px; height: 100%");
}
WillInsertBody();
......
CONSOLE ERROR: Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'none'". Either the 'unsafe-inline' keyword, a hash ('sha256-H/s/dWGkGDaCkKqmo0VNeHrTgvJjinI5uvu7UmY6EB8='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.
CONSOLE ERROR: Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'none'". Either the 'unsafe-inline' keyword, a hash ('sha256-irYXJOS8dfWxS3v4lGnL1OcyQjamq/FGUi7NhXhtBOk='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.
CONSOLE ERROR: Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'none'". Either the 'unsafe-inline' keyword, a hash ('sha256-VPZ2mdsWWlqXOFgt1tAllbbJhG8t9bh6emP1o9GwJxY='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.
......
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