Commit 874c6cdd authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Set unrecognized values of "scrolling" attribute to kAuto

Prior to this CL, unrecognized values of the "scrolling" attribute
would leave the prior value unchanged. That behavior is counter
to the spec [1], and is also confusing to developers, as it
introduces state to the "scrolling" attribute. This CL fixes
that.

[1] https://html.spec.whatwg.org/multipage/rendering.html#the-page

Fixed: 1057454
Change-Id: Ib6b4cd4c6952fe580003dc2577c72db2fe622fae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2083595
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746151}
parent 59742ff9
......@@ -134,13 +134,18 @@ void HTMLFrameElementBase::ParseAttribute(
} else if (name == html_names::kMarginheightAttr) {
SetMarginHeight(value.ToInt());
} else if (name == html_names::kScrollingAttr) {
// Auto and yes both simply mean "allow scrolling." No means "don't allow
// scrolling."
if (EqualIgnoringASCIICase(value, "auto") ||
DeprecatedEqualIgnoringCase(value, "yes"))
SetScrollbarMode(mojom::blink::ScrollbarMode::kAuto);
else if (EqualIgnoringASCIICase(value, "no"))
// https://html.spec.whatwg.org/multipage/rendering.html#the-page:
// If [the scrolling] attribute's value is an ASCII
// case-insensitive match for the string "off", "noscroll", or "no", then
// the user agent is expected to prevent any scrollbars from being shown for
// the viewport of the Document's browsing context, regardless of the
// 'overflow' property that applies to that viewport.
if (EqualIgnoringASCIICase(value, "off") ||
EqualIgnoringASCIICase(value, "noscroll") ||
EqualIgnoringASCIICase(value, "no"))
SetScrollbarMode(mojom::blink::ScrollbarMode::kAlwaysOff);
else
SetScrollbarMode(mojom::blink::ScrollbarMode::kAuto);
} else if (name == html_names::kOnbeforeunloadAttr) {
// FIXME: should <frame> elements have beforeunload handlers?
SetAttributeEventListener(
......
<!DOCTYPE html>
<title>iframe and the scrolling attributes</title>
<link rel="author" title="Mason Freed" href="mailto:masonfreed@chromium.org">
<p>These two iframes should *both* render with scrollbars:</p>
<iframe style="height: 100px; width: 100px;" scrolling="unknown"
srcdoc="<div style='height: 200px; width: 200px; background: linear-gradient(135deg, red, blue);'></div>"></iframe>
<iframe style="height: 100px; width: 100px;" scrolling="unknown"
srcdoc="<div style='height: 200px; width: 200px; background: linear-gradient(135deg, red, blue);'></div>"></iframe>
<!DOCTYPE html>
<title>iframe and the scrolling attributes</title>
<link rel="author" title="Mason Freed" href="mailto:masonfreed@chromium.org">
<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-page">
<link rel="match" href="iframe-scrolling-attribute-ref.html">
<p>These two iframes should *both* render with scrollbars:</p>
<iframe style="height: 100px; width: 100px;" scrolling="unknown"
srcdoc="<div style='height: 200px; width: 200px; background: linear-gradient(135deg, red, blue);'></div>"></iframe>
<iframe style="height: 100px; width: 100px;" scrolling="unknown"
srcdoc="<div style='height: 200px; width: 200px; background: linear-gradient(135deg, red, blue);'></div>"></iframe>
<script>
var iframe = document.getElementsByTagName("iframe")[1];
// Setting scrolling=no and then back to scrolling=unknown
// should result in a final value of auto.
iframe.setAttribute("scrolling", "no");
iframe.setAttribute("scrolling", "unknown");
</script>
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