Commit 573bcd01 authored by Joey Arhar's avatar Joey Arhar Committed by Commit Bot

Beforematch and hidden-matchable origin trial

Bug: 1117589
Change-Id: Id2e0e344553189018324ebfe30418419944400c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363434
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Reviewed-by: default avatarvmpstr <vmpstr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799910}
parent bfd2cd56
......@@ -5987,17 +5987,14 @@ const CSSValue* ContentVisibility::ParseSingleValue(
CSSParserTokenRange& range,
const CSSParserContext& context,
const CSSParserLocalContext&) const {
auto id = range.Peek().Id();
if (id == CSSValueID::kHiddenMatchable &&
!RuntimeEnabledFeatures::CSSContentVisibilityHiddenMatchableEnabled()) {
if (range.Peek().Id() == CSSValueID::kHiddenMatchable &&
!RuntimeEnabledFeatures::CSSContentVisibilityHiddenMatchableEnabled(
context.GetExecutionContext())) {
return nullptr;
}
if (!css_parsing_utils::IdentMatches<CSSValueID::kVisible, CSSValueID::kAuto,
CSSValueID::kHidden,
CSSValueID::kHiddenMatchable>(id)) {
return nullptr;
}
return css_parsing_utils::ConsumeIdent(range);
return css_parsing_utils::ConsumeIdent<CSSValueID::kVisible,
CSSValueID::kAuto, CSSValueID::kHidden,
CSSValueID::kHiddenMatchable>(range);
}
const CSSValue* TabSize::ParseSingleValue(CSSParserTokenRange& range,
......
......@@ -828,7 +828,8 @@ void TextFinder::FireBeforematchEvent(
return;
}
if (RuntimeEnabledFeatures::BeforeMatchEventEnabled()) {
if (RuntimeEnabledFeatures::BeforeMatchEventEnabled(
GetFrame()->GetDocument()->GetExecutionContext())) {
Element* beforematch_element = GetBeforematchElement(*context->range);
// Note that we don't check the `range.EndPosition()` since we just activate
// the beginning of the range. In find-in-page cases, the end position is
......
......@@ -11,6 +11,7 @@
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/svg/svg_svg_element.h"
#include "third_party/blink/renderer/platform/bindings/script_forbidden_scope.h"
......@@ -89,9 +90,11 @@ ElementFragmentAnchor* ElementFragmentAnchor::TryCreate(const KURL& url,
if (!should_scroll)
return nullptr;
if (RuntimeEnabledFeatures::BeforeMatchEventEnabled())
if (RuntimeEnabledFeatures::BeforeMatchEventEnabled(
frame.GetDocument()->GetExecutionContext())) {
anchor_node->DispatchEvent(
*Event::CreateBubble(event_type_names::kBeforematch));
}
return MakeGarbageCollected<ElementFragmentAnchor>(*anchor_node, frame);
}
......
......@@ -485,9 +485,11 @@ void TextFragmentAnchor::ApplyTargetToCommonAncestor(
}
void TextFragmentAnchor::FireBeforeMatchEvent(Element* element) {
if (RuntimeEnabledFeatures::BeforeMatchEventEnabled())
if (RuntimeEnabledFeatures::BeforeMatchEventEnabled(
frame_->GetDocument()->GetExecutionContext())) {
element->DispatchEvent(
*Event::CreateBubble(event_type_names::kBeforematch));
}
beforematch_state_ = kFiredEvent;
}
......
......@@ -248,6 +248,7 @@
{
// https://github.com/WICG/display-locking/blob/master/explainer-beforematch.md
name: "BeforeMatchEvent",
origin_trial_feature_name: "BeforeMatchEvent",
status: "experimental",
},
{
......@@ -433,6 +434,7 @@
// by a different flag.
// https://wicg.github.io/display-locking/
name: "CSSContentVisibilityHiddenMatchable",
origin_trial_feature_name: "BeforeMatchEvent",
status: "experimental"
},
{
......
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