Commit 62f8d5f0 authored by Nick Burris's avatar Nick Burris Committed by Commit Bot

Enable Scroll To Text by default

Enables scroll to text by default for M81. Note we plan to launch via
Finch for M80.

Intent to ship with LGTMs:
https://groups.google.com/a/chromium.org/d/msg/blink-dev/zlLSxQ9BA8Y/t-_3pAiSAwAJ

This patch also updates web platform test expectations:
- scroll-to-text-fragment.html now passes; it just needed an extra rAF
  for the fallback to element anchor behavior.
- scroll-to-text-fragment-security.html has two expected failures, as
  they need to be updated to test cross-origin navigations. I'll make
  this change in a follow-up patch to close bug 1042311.

Bug: 919204
Change-Id: Ic2d563934cd9406fb335904a94c390bba789e0b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1838701Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Commit-Queue: Nick Burris <nburris@chromium.org>
Cr-Commit-Position: refs/heads/master@{#732592}
parent 31bff13f
...@@ -212,7 +212,7 @@ const base::Feature kStorageAccessAPI{"StorageAccessAPI", ...@@ -212,7 +212,7 @@ const base::Feature kStorageAccessAPI{"StorageAccessAPI",
// Enable text snippets in URL fragments. https://crbug.com/919204. // Enable text snippets in URL fragments. https://crbug.com/919204.
const base::Feature kTextFragmentAnchor{"TextFragmentAnchor", const base::Feature kTextFragmentAnchor{"TextFragmentAnchor",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_ENABLED_BY_DEFAULT};
// Enables the site isolated Wasm code cache that is keyed on the resource URL // Enables the site isolated Wasm code cache that is keyed on the resource URL
// and the origin lock of the renderer that is requesting the resource. When // and the origin lock of the renderer that is requesting the resource. When
......
...@@ -1628,7 +1628,7 @@ ...@@ -1628,7 +1628,7 @@
{ {
name: "TextFragmentIdentifiers", name: "TextFragmentIdentifiers",
origin_trial_feature_name: "TextFragmentIdentifiers", origin_trial_feature_name: "TextFragmentIdentifiers",
status: "experimental", status: "stable",
}, },
{ {
name: "TimerThrottlingForBackgroundTabs", name: "TimerThrottlingForBackgroundTabs",
......
...@@ -5957,13 +5957,6 @@ crbug.com/997669 [ Win ] http/tests/devtools/search/sources-search-scope-in-file ...@@ -5957,13 +5957,6 @@ crbug.com/997669 [ Win ] http/tests/devtools/search/sources-search-scope-in-file
crbug.com/997669 [ Win ] http/tests/devtools/search/sources-search-scope.js [ Pass Crash ] crbug.com/997669 [ Win ] http/tests/devtools/search/sources-search-scope.js [ Pass Crash ]
crbug.com/626703 external/wpt/css/css-paint-api/custom-property-animation-on-main-thread.https.html [ Pass Failure ] crbug.com/626703 external/wpt/css/css-paint-api/custom-property-animation-on-main-thread.https.html [ Pass Failure ]
# Pending enabling scroll to text feature
crbug.com/919204 external/wpt/scroll-to-text-fragment/scroll-to-text-fragment.html [ Skip ]
crbug.com/919204 external/wpt/scroll-to-text-fragment/scroll-to-text-fragment-same-doc.html [ Skip ]
crbug.com/919204 external/wpt/scroll-to-text-fragment/scroll-to-text-fragment-api.html [ Skip ]
crbug.com/919204 external/wpt/scroll-to-text-fragment/scroll-to-text-fragment-security.html [ Skip ]
crbug.com/919204 wpt_internal/display-lock/css-render-subtree/text-fragment-navigation-activates.html [ Skip ]
crbug.com/999209 virtual/lazyload-image/http/tests/lazyload/style-dimension.html [ Timeout ] crbug.com/999209 virtual/lazyload-image/http/tests/lazyload/style-dimension.html [ Timeout ]
crbug.com/1015130 external/wpt/largest-contentful-paint/first-paint-equals-lcp-text.html [ Failure Pass ] crbug.com/1015130 external/wpt/largest-contentful-paint/first-paint-equals-lcp-text.html [ Failure Pass ]
......
This is a testharness.js-based test.
PASS Test that a text fragment directive requires a user activation (user_activation=true).
PASS Test that a text fragment directive requires a user activation (user_activation=false).
PASS Test that a text fragment directive is not activated when there is a window opener (noopener=true).
FAIL Test that a text fragment directive is not activated when there is a window opener (noopener=false). assert_equals: Expected window.open() with opener to not activate text fragment directive. expected "top" but got "text"
FAIL Test that a text fragment directive is not activated within an iframe. assert_equals: Expected iframe navigation to not activate text fragment directive. expected "top" but got "text"
Harness: the test ran to completion.
...@@ -48,6 +48,14 @@ function checkScroll() { ...@@ -48,6 +48,14 @@ function checkScroll() {
let key = (new URL(document.location)).searchParams.get("key"); let key = (new URL(document.location)).searchParams.get("key");
stashResults(key, results); stashResults(key, results);
} }
// Ensure two animation frames on load to test the fallback to element anchor,
// which gets queued for the next frame if the text fragment is not found.
window.onload = function() {
window.requestAnimationFrame(function() {
window.requestAnimationFrame(checkScroll);
})
}
</script> </script>
<style> <style>
.scroll-section { .scroll-section {
...@@ -64,7 +72,7 @@ function checkScroll() { ...@@ -64,7 +72,7 @@ function checkScroll() {
display: none; display: none;
} }
</style> </style>
<body onload="window.requestAnimationFrame(checkScroll)"> <body>
<div id="element" class="scroll-section">Element</div> <div id="element" class="scroll-section">Element</div>
<p id="text" class="scroll-section">This is a test page !$'()*+./:;=?@_~ &,- &#x30cd;&#x30b3;</p> <p id="text" class="scroll-section">This is a test page !$'()*+./:;=?@_~ &,- &#x30cd;&#x30b3;</p>
<p id="more-text" class="scroll-section">More test page text</p> <p id="more-text" class="scroll-section">More test page text</p>
......
...@@ -8,6 +8,7 @@ PASS history.scrollRestoration == "LEFTOVER" is false ...@@ -8,6 +8,7 @@ PASS history.scrollRestoration == "LEFTOVER" is false
PASS history.state == "LEFTOVER" is false PASS history.state == "LEFTOVER" is false
PASS location.ancestorOrigins == "LEFTOVER" is false PASS location.ancestorOrigins == "LEFTOVER" is false
PASS location.assign == "LEFTOVER" is false PASS location.assign == "LEFTOVER" is false
PASS location.fragmentDirective == "LEFTOVER" is false
PASS location.hash == "LEFTOVER" is false PASS location.hash == "LEFTOVER" is false
PASS location.host == "LEFTOVER" is false PASS location.host == "LEFTOVER" is false
PASS location.hostname == "LEFTOVER" is false PASS location.hostname == "LEFTOVER" is false
......
...@@ -8,6 +8,7 @@ PASS history.scrollRestoration == "LEFTOVER" is false ...@@ -8,6 +8,7 @@ PASS history.scrollRestoration == "LEFTOVER" is false
PASS history.state == "LEFTOVER" is false PASS history.state == "LEFTOVER" is false
PASS location.ancestorOrigins == "LEFTOVER" is false PASS location.ancestorOrigins == "LEFTOVER" is false
PASS location.assign == "LEFTOVER" is false PASS location.assign == "LEFTOVER" is false
PASS location.fragmentDirective == "LEFTOVER" is false
PASS location.hash == "LEFTOVER" is false PASS location.hash == "LEFTOVER" is false
PASS location.host == "LEFTOVER" is false PASS location.host == "LEFTOVER" is false
PASS location.hostname == "LEFTOVER" is false PASS location.hostname == "LEFTOVER" is false
......
...@@ -1913,6 +1913,9 @@ interface FormDataEvent : Event ...@@ -1913,6 +1913,9 @@ interface FormDataEvent : Event
attribute @@toStringTag attribute @@toStringTag
getter formData getter formData
method constructor method constructor
interface FragmentDirective
attribute @@toStringTag
method constructor
interface GainNode : AudioNode interface GainNode : AudioNode
attribute @@toStringTag attribute @@toStringTag
getter gain getter gain
...@@ -3891,6 +3894,7 @@ interface LinearAccelerationSensor : Accelerometer ...@@ -3891,6 +3894,7 @@ interface LinearAccelerationSensor : Accelerometer
method constructor method constructor
interface Location interface Location
attribute @@toStringTag attribute @@toStringTag
getter fragmentDirective
method constructor method constructor
interface Lock interface Lock
attribute @@toStringTag attribute @@toStringTag
......
...@@ -2521,6 +2521,9 @@ interface FormDataEvent : Event ...@@ -2521,6 +2521,9 @@ interface FormDataEvent : Event
attribute @@toStringTag attribute @@toStringTag
getter formData getter formData
method constructor method constructor
interface FragmentDirective
attribute @@toStringTag
method constructor
interface GainNode : AudioNode interface GainNode : AudioNode
attribute @@toStringTag attribute @@toStringTag
getter gain getter gain
...@@ -4669,6 +4672,7 @@ interface LinearAccelerationSensor : Accelerometer ...@@ -4669,6 +4672,7 @@ interface LinearAccelerationSensor : Accelerometer
method constructor method constructor
interface Location interface Location
attribute @@toStringTag attribute @@toStringTag
getter fragmentDirective
method constructor method constructor
interface Lock interface Lock
attribute @@toStringTag attribute @@toStringTag
......
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