Commit 5fe83660 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

Disable position:sticky in FIELDSETs

Currently it seems to result in invalid sticky state.

Bug: 1128479, 1146925
Change-Id: I62f7b5519e2851d6d804be5937a8bded0a7985f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2525468
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Auto-Submit: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825786}
parent b558d1f9
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "third_party/blink/renderer/core/dom/container_node.h" #include "third_party/blink/renderer/core/dom/container_node.h"
#include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/element.h" #include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/flat_tree_traversal.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h" #include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/dom/shadow_root.h" #include "third_party/blink/renderer/core/dom/shadow_root.h"
#include "third_party/blink/renderer/core/frame/event_handler_registry.h" #include "third_party/blink/renderer/core/frame/event_handler_registry.h"
...@@ -43,6 +44,7 @@ ...@@ -43,6 +44,7 @@
#include "third_party/blink/renderer/core/frame/local_frame_view.h" #include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/settings.h" #include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/frame/web_feature.h" #include "third_party/blink/renderer/core/frame/web_feature.h"
#include "third_party/blink/renderer/core/html/forms/html_field_set_element.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h" #include "third_party/blink/renderer/core/html/forms/html_input_element.h"
#include "third_party/blink/renderer/core/html/forms/html_text_area_element.h" #include "third_party/blink/renderer/core/html/forms/html_text_area_element.h"
#include "third_party/blink/renderer/core/html/html_iframe_element.h" #include "third_party/blink/renderer/core/html/html_iframe_element.h"
...@@ -686,6 +688,20 @@ void StyleAdjuster::AdjustComputedStyle(StyleResolverState& state, ...@@ -686,6 +688,20 @@ void StyleAdjuster::AdjustComputedStyle(StyleResolverState& state,
AdjustStyleForDisplay(style, layout_parent_style, element, AdjustStyleForDisplay(style, layout_parent_style, element,
element ? &element->GetDocument() : nullptr); element ? &element->GetDocument() : nullptr);
// TOOD(crbug.com/1146925): Sticky content in a scrollable FIELDSET triggers
// a DHCECK failure in |StickyPositionScrollingConstraints::
// AncestorContainingBlockOffset()|. We disable it until the root cause is
// fixed.
if (style.GetPosition() == EPosition::kSticky && element) {
for (const Node& ancestor : FlatTreeTraversal::AncestorsOf(*element)) {
if (const auto* fieldset = DynamicTo<HTMLFieldSetElement>(ancestor)) {
if (!fieldset->ComputedStyleRef().IsOverflowVisibleAlongBothAxes())
style.SetPosition(EPosition::kStatic);
break;
}
}
}
// If this is a child of a LayoutNGCustom, we need the name of the parent // If this is a child of a LayoutNGCustom, we need the name of the parent
// layout function for invalidation purposes. // layout function for invalidation purposes.
if (layout_parent_style.IsDisplayLayoutCustomBox()) { if (layout_parent_style.IsDisplayLayoutCustomBox()) {
......
<!DOCTYPE html>
<link rel="help" href="http://crbug.com/1146872">
<body>
<fieldset><span><span></span></span></fieldset>
<div id="host"><span></span></div>
<script>
const host = document.querySelector('#host');
const shadowRoot = host.attachShadow({mode: 'closed'});
const fieldset = shadowRoot.appendChild(document.createElement('fieldset'));
fieldset.setAttribute('style', 'overflow: scroll');
fieldset.innerHTML = '<slot></slot>';
</script>
<style>
*:not(fieldset, div) {
position: sticky;
bottom: 72pc;
}
fieldset {
overflow: visible scroll;
}
</style>
</body>
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