Diff
Modified: trunk/LayoutTests/ChangeLog (283078 => 283079)
--- trunk/LayoutTests/ChangeLog 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/LayoutTests/ChangeLog 2021-09-25 13:53:27 UTC (rev 283079)
@@ -1,3 +1,26 @@
+2021-09-23 Tim Nguyen <[email protected]>
+
+ Make inert nodes invisible to hit testing
+ https://bugs.webkit.org/show_bug.cgi?id=229330
+
+ Reviewed by Antti Koivisto.
+
+ Test: LayoutTests/imported/w3c/web-platform-tests/inert/inert-inlines.tentative.html
+
+ This adds an internal inherited effectiveInert style property in RenderStyle and starts using it for hit testing checks.
+ Invalidation is done through style invalidation.
+
+ Skipped and removed test expectations for inert event retargeting tests that should soon become irrelevant per
+ this CSSWG discussion:
+ https://logs.csswg.org/irc.w3.org/css/2021-09-08/#e1431357
+ https://lists.w3.org/Archives/Public/www-style/2021Sep/0004.html
+
+ Pending WPT PR to remove inert event retargeting tests: https://github.com/web-platform-tests/wpt/pull/30866
+
+ * TestExpectations:
+ * platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-retargeting-iframe.tentative-expected.txt: Removed.
+ * platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-retargeting.tentative-expected.txt: Removed.
+
2021-09-25 Joanmarie Diggs <[email protected]>
AX: aria-expanded is no longer supported on quite a few roles in ARIA 1.2
Modified: trunk/LayoutTests/TestExpectations (283078 => 283079)
--- trunk/LayoutTests/TestExpectations 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/LayoutTests/TestExpectations 2021-09-25 13:53:27 UTC (rev 283079)
@@ -5375,3 +5375,7 @@
webkit.org/b/230004 imported/w3c/web-platform-tests/css/css-pseudo/selection-overlay-and-spelling-001.html [ ImageOnlyFailure ]
webkit.org/b/230004 imported/w3c/web-platform-tests/css/css-pseudo/selection-paint-image.html [ ImageOnlyFailure ]
webkit.org/b/230004 imported/w3c/web-platform-tests/css/css-pseudo/selection-textarea-011.html [ ImageOnlyFailure ]
+
+# Awaiting official CSSWG resolution making these tests irrelevant: https://lists.w3.org/Archives/Public/www-style/2021Sep/0004.html
+imported/w3c/web-platform-tests/inert/inert-retargeting.tentative.html [ Skip ]
+imported/w3c/web-platform-tests/inert/inert-retargeting-iframe.tentative.html [ Skip ]
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (283078 => 283079)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-09-25 13:53:27 UTC (rev 283079)
@@ -1,3 +1,26 @@
+2021-09-23 Tim Nguyen <[email protected]>
+
+ Make inert nodes invisible to hit testing
+ https://bugs.webkit.org/show_bug.cgi?id=229330
+
+ Reviewed by Antti Koivisto.
+
+ Test: LayoutTests/imported/w3c/web-platform-tests/inert/inert-inlines.tentative.html
+
+ This adds an internal inherited effectiveInert style property in RenderStyle and starts using it for hit testing checks.
+ Invalidation is done through style invalidation.
+
+ Skipped and removed test expectations for inert event retargeting tests that should soon become irrelevant per
+ this CSSWG discussion:
+ https://logs.csswg.org/irc.w3.org/css/2021-09-08/#e1431357
+ https://lists.w3.org/Archives/Public/www-style/2021Sep/0004.html
+
+ Pending WPT PR to remove inert event retargeting tests: https://github.com/web-platform-tests/wpt/pull/30866
+
+ * web-platform-tests/inert/inert-inlines.tentative-expected.txt:
+ * web-platform-tests/inert/inert-retargeting-iframe.tentative-expected.txt: Removed.
+ * web-platform-tests/inert/inert-retargeting.tentative-expected.txt: Removed.
+
2021-09-25 Myles C. Maxfield <[email protected]>
Update WPT font-palette tests from upstream
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/inert/inert-inlines.tentative-expected.txt (283078 => 283079)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/inert/inert-inlines.tentative-expected.txt 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/inert/inert-inlines.tentative-expected.txt 2021-09-25 13:53:27 UTC (rev 283079)
@@ -2,5 +2,5 @@
Click me
Click me
-FAIL Tests that inert inlines do not receive mouse events. To test manually, click on all the "Click me"s. The test fails if you see red. assert_false: no event should be fired on a expected false got true
+PASS Tests that inert inlines do not receive mouse events. To test manually, click on all the "Click me"s. The test fails if you see red.
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/inert/inert-retargeting-iframe.tentative-expected.txt (283078 => 283079)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/inert/inert-retargeting-iframe.tentative-expected.txt 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/inert/inert-retargeting-iframe.tentative-expected.txt 2021-09-25 13:53:27 UTC (rev 283079)
@@ -1,47 +0,0 @@
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-Click on "Inert button".
-
-The blue square ("Non-inert ancestor container") should turn green.
-The yellow, semi-transparent square ("Non-inert, displaced container") should not turn red.
-"Non-inert button" should not turn red.
-(The full test suite checks a range of events.)
-
-Non-inert ancestor container
- Non-inert, displaced ancestor
-Inert container
-foreground
-
-Harness Error (FAIL), message = Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-
-PASS elementsFromPoint returns inert element
-FAIL Tests that any mouse event on a non-inert element is correctly targeted to that element promise_test: Unhandled rejection with value: "did not get auxclick on foreground"
-FAIL Tests that any mouse event on an inert element is targeted to the nearest non-inert ancestor at the same coordinates promise_test: Unhandled rejection with value: "did not get mouseover on ancestorContainer"
-PASS Tests that any pointer event on a non-inert element is correctly targeted to that element
-FAIL Tests that any pointer event on an inert element is targeted to the nearest non-inert ancestor at the same coordinates promise_test: Unhandled rejection with value: "did not get pointerover on ancestorContainer"
-
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/inert/inert-retargeting.tentative-expected.txt (283078 => 283079)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/inert/inert-retargeting.tentative-expected.txt 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/inert/inert-retargeting.tentative-expected.txt 2021-09-25 13:53:27 UTC (rev 283079)
@@ -1,47 +0,0 @@
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-CONSOLE MESSAGE: Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-Click on "foreground".
-
-The blue square ("Non-inert ancestor container") should turn green.
-The yellow, semi-transparent square ("Non-inert, displaced container") should not turn red.
-"Non-inert button" should not turn red.
-(The full test suite checks a range of events.)
-
-Non-inert ancestor container
-backgroundNon-inert, displaced ancestor
-Inert container
-foreground
-
-Harness Error (FAIL), message = Error: assert_equals: expected Element node <fieldset id="ancestorContainer">
- <legend>Non-inert a... but got Element node <button id="foreground" class="clicked">foreground</button>
-
-PASS elementsFromPoint returns inert element
-FAIL Tests that any mouse event on a non-inert element is correctly targeted to that element promise_test: Unhandled rejection with value: "did not get auxclick on foreground"
-FAIL Tests that any mouse event on an inert element is targeted to the nearest non-inert ancestor at the same coordinates promise_test: Unhandled rejection with value: "did not get mouseover on ancestorContainer"
-PASS Tests that any pointer event on a non-inert element is correctly targeted to that element
-FAIL Tests that any pointer event on an inert element is targeted to the nearest non-inert ancestor at the same coordinates promise_test: Unhandled rejection with value: "did not get pointerover on ancestorContainer"
-
Deleted: trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-retargeting-iframe.tentative-expected.txt (283078 => 283079)
--- trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-retargeting-iframe.tentative-expected.txt 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-retargeting-iframe.tentative-expected.txt 2021-09-25 13:53:27 UTC (rev 283079)
@@ -1,18 +0,0 @@
-Click on "Inert button".
-
-The blue square ("Non-inert ancestor container") should turn green.
-The yellow, semi-transparent square ("Non-inert, displaced container") should not turn red.
-"Non-inert button" should not turn red.
-(The full test suite checks a range of events.)
-
-Non-inert ancestor container
- Non-inert, displaced ancestor
-Inert container
-foreground
-
-PASS elementsFromPoint returns inert element
-FAIL Tests that any mouse event on a non-inert element is correctly targeted to that element promise_test: Unhandled rejection with value: "did not get mouseover on foreground"
-FAIL Tests that any mouse event on an inert element is targeted to the nearest non-inert ancestor at the same coordinates promise_test: Unhandled rejection with value: "did not get mouseover on ancestorContainer"
-FAIL Tests that any pointer event on a non-inert element is correctly targeted to that element promise_test: Unhandled rejection with value: "did not get pointerover on foreground"
-FAIL Tests that any pointer event on an inert element is targeted to the nearest non-inert ancestor at the same coordinates promise_test: Unhandled rejection with value: "did not get pointerover on ancestorContainer"
-
Deleted: trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-retargeting.tentative-expected.txt (283078 => 283079)
--- trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-retargeting.tentative-expected.txt 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/inert/inert-retargeting.tentative-expected.txt 2021-09-25 13:53:27 UTC (rev 283079)
@@ -1,18 +0,0 @@
-Click on "foreground".
-
-The blue square ("Non-inert ancestor container") should turn green.
-The yellow, semi-transparent square ("Non-inert, displaced container") should not turn red.
-"Non-inert button" should not turn red.
-(The full test suite checks a range of events.)
-
-Non-inert ancestor container
-backgroundNon-inert, displaced ancestor
-Inert container
-foreground
-
-PASS elementsFromPoint returns inert element
-FAIL Tests that any mouse event on a non-inert element is correctly targeted to that element promise_test: Unhandled rejection with value: "did not get mouseover on foreground"
-FAIL Tests that any mouse event on an inert element is targeted to the nearest non-inert ancestor at the same coordinates promise_test: Unhandled rejection with value: "did not get mouseover on ancestorContainer"
-FAIL Tests that any pointer event on a non-inert element is correctly targeted to that element promise_test: Unhandled rejection with value: "did not get pointerover on foreground"
-FAIL Tests that any pointer event on an inert element is targeted to the nearest non-inert ancestor at the same coordinates promise_test: Unhandled rejection with value: "did not get pointerover on ancestorContainer"
-
Modified: trunk/Source/WebCore/ChangeLog (283078 => 283079)
--- trunk/Source/WebCore/ChangeLog 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/Source/WebCore/ChangeLog 2021-09-25 13:53:27 UTC (rev 283079)
@@ -1,3 +1,45 @@
+2021-09-23 Tim Nguyen <[email protected]>
+
+ Make inert nodes invisible to hit testing
+ https://bugs.webkit.org/show_bug.cgi?id=229330
+
+ Reviewed by Antti Koivisto.
+
+ Test: LayoutTests/imported/w3c/web-platform-tests/inert/inert-inlines.tentative.html
+
+ This adds an internal inherited effectiveInert style property in RenderStyle and starts using it for hit testing checks.
+ Invalidation is done through style invalidation.
+
+ Skipped and removed test expectations for inert event retargeting tests that should soon become irrelevant per
+ this CSSWG discussion:
+ https://logs.csswg.org/irc.w3.org/css/2021-09-08/#e1431357
+ https://lists.w3.org/Archives/Public/www-style/2021Sep/0004.html
+
+ Pending WPT PR to remove inert event retargeting tests: https://github.com/web-platform-tests/wpt/pull/30866
+
+ * dom/Element.cpp:
+ (WebCore::Element::addToTopLayer):
+ (WebCore::Element::removeFromTopLayer):
+ * html/HTMLElement.cpp:
+ (WebCore::HTMLElement::parseAttribute):
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::styleWillChange):
+ * rendering/RenderElement.h:
+ (WebCore::RenderElement::visibleToHitTesting const):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::layerStyleChanged):
+ * rendering/style/RenderStyle.h:
+ (WebCore::RenderStyle::effectiveInert const):
+ (WebCore::RenderStyle::setEffectiveInert):
+ * rendering/style/StyleRareInheritedData.cpp:
+ (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+ (WebCore::StyleRareInheritedData::operator== const):
+ * rendering/style/StyleRareInheritedData.h:
+ * style/StyleAdjuster.cpp:
+ (WebCore::Style::Adjuster::adjust const):
+ * style/StyleSharingResolver.cpp:
+ (WebCore::Style::SharingResolver::canShareStyleWithElement const):
+
2021-09-25 Joanmarie Diggs <[email protected]>
AX: aria-expanded is no longer supported on quite a few roles in ARIA 1.2
Modified: trunk/Source/WebCore/dom/Element.cpp (283078 => 283079)
--- trunk/Source/WebCore/dom/Element.cpp 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/Source/WebCore/dom/Element.cpp 2021-09-25 13:53:27 UTC (rev 283079)
@@ -60,6 +60,7 @@
#include "GetAnimationsOptions.h"
#include "HTMLBodyElement.h"
#include "HTMLCanvasElement.h"
+#include "HTMLDialogElement.h"
#include "HTMLDocument.h"
#include "HTMLHtmlElement.h"
#include "HTMLLabelElement.h"
@@ -3373,7 +3374,10 @@
document().addTopLayerElement(*this);
setNodeFlag(NodeFlag::IsInTopLayer);
+ // Invalidate inert state
invalidateStyleInternal();
+ if (document().documentElement())
+ document().documentElement()->invalidateStyleInternal();
if (auto* layer = renderLayerForElement(*this))
layer->establishesTopLayerDidChange();
@@ -3390,7 +3394,12 @@
document().removeTopLayerElement(*this);
clearNodeFlag(NodeFlag::IsInTopLayer);
+ // Invalidate inert state
invalidateStyleInternal();
+ if (document().documentElement())
+ document().documentElement()->invalidateStyleInternal();
+ if (auto* modalElement = document().activeModalDialog())
+ modalElement->invalidateStyleInternal();
if (auto* layer = renderLayerForElement(*this))
layer->establishesTopLayerDidChange();
Modified: trunk/Source/WebCore/html/HTMLElement.cpp (283078 => 283079)
--- trunk/Source/WebCore/html/HTMLElement.cpp 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/Source/WebCore/html/HTMLElement.cpp 2021-09-25 13:53:27 UTC (rev 283079)
@@ -483,6 +483,9 @@
return;
}
+ if (document().settings().inertAttributeEnabled() && name == inertAttr)
+ invalidateStyleInternal();
+
if (name == inputmodeAttr) {
auto& document = this->document();
if (this == document.focusedElement()) {
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (283078 => 283079)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2021-09-25 13:53:27 UTC (rev 283079)
@@ -853,6 +853,8 @@
}
auto needsInvalidateEventRegion = [&] {
+ if (m_style.effectiveInert() != newStyle.effectiveInert())
+ return true;
if (m_style.pointerEvents() != newStyle.pointerEvents())
return true;
#if ENABLE(TOUCH_ACTION_REGIONS)
Modified: trunk/Source/WebCore/rendering/RenderElement.h (283078 => 283079)
--- trunk/Source/WebCore/rendering/RenderElement.h 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/Source/WebCore/rendering/RenderElement.h 2021-09-25 13:53:27 UTC (rev 283079)
@@ -156,6 +156,9 @@
bool visibleToHitTesting(std::optional<HitTestRequest> hitTestRequest = std::nullopt) const
{
+ if (style().effectiveInert())
+ return false;
+
if (style().visibility() != Visibility::Visible)
return false;
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (283078 => 283079)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2021-09-25 13:53:27 UTC (rev 283079)
@@ -1725,7 +1725,8 @@
if (diff >= StyleDifference::RecompositeLayer) {
if (layer.isComposited()) {
- if (is<RenderWidget>(layer.renderer()) || (oldStyle && oldStyle->pointerEvents() != newStyle.pointerEvents())) {
+ bool hitTestingStateChanged = oldStyle && (oldStyle->pointerEvents() != newStyle.pointerEvents() || oldStyle->effectiveInert() != newStyle.effectiveInert());
+ if (is<RenderWidget>(layer.renderer()) || hitTestingStateChanged) {
// For RenderWidgets this is necessary to get iframe layers hooked up in response to scheduleInvalidateStyleAndLayerComposition().
layer.setNeedsCompositingConfigurationUpdate();
}
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (283078 => 283079)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2021-09-25 13:53:27 UTC (rev 283079)
@@ -743,6 +743,8 @@
OptionSet<TouchAction> effectiveTouchActions() const { return m_rareInheritedData->effectiveTouchActions; }
OptionSet<EventListenerRegionType> eventListenerRegionTypes() const { return m_rareInheritedData->eventListenerRegionTypes; }
+ bool effectiveInert() const { return m_rareInheritedData->effectiveInert; }
+
const LengthBox& scrollMargin() const;
const Length& scrollMarginTop() const;
const Length& scrollMarginBottom() const;
@@ -1304,6 +1306,9 @@
void setEffectiveTouchActions(OptionSet<TouchAction> touchActions) { SET_VAR(m_rareInheritedData, effectiveTouchActions, touchActions); }
void setEventListenerRegionTypes(OptionSet<EventListenerRegionType> eventListenerTypes) { SET_VAR(m_rareInheritedData, eventListenerRegionTypes, eventListenerTypes); }
+ // internal property
+ void setEffectiveInert(bool effectiveInert) { SET_VAR(m_rareInheritedData, effectiveInert, effectiveInert); }
+
void setScrollMarginTop(Length&&);
void setScrollMarginBottom(Length&&);
void setScrollMarginLeft(Length&&);
Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (283078 => 283079)
--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp 2021-09-25 13:53:27 UTC (rev 283079)
@@ -135,6 +135,7 @@
, mathStyle(static_cast<unsigned>(RenderStyle::initialMathStyle()))
, hasAutoCaretColor(true)
, hasVisitedLinkAutoCaretColor(true)
+ , effectiveInert(false)
, isInSubtreeWithBlendMode(false)
, effectiveTouchActions(RenderStyle::initialTouchActions())
, strokeWidth(RenderStyle::initialStrokeWidth())
@@ -232,6 +233,7 @@
, mathStyle(o.mathStyle)
, hasAutoCaretColor(o.hasAutoCaretColor)
, hasVisitedLinkAutoCaretColor(o.hasVisitedLinkAutoCaretColor)
+ , effectiveInert(o.effectiveInert)
, isInSubtreeWithBlendMode(o.isInSubtreeWithBlendMode)
, effectiveTouchActions(o.effectiveTouchActions)
, eventListenerRegionTypes(o.eventListenerRegionTypes)
@@ -359,6 +361,7 @@
&& isInSubtreeWithBlendMode == o.isInSubtreeWithBlendMode
&& effectiveTouchActions == o.effectiveTouchActions
&& eventListenerRegionTypes == o.eventListenerRegionTypes
+ && effectiveInert == o.effectiveInert
&& strokeWidth == o.strokeWidth
&& strokeColor == o.strokeColor
&& visitedLinkStrokeColor == o.visitedLinkStrokeColor
Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h (283078 => 283079)
--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h 2021-09-25 13:53:27 UTC (rev 283079)
@@ -161,6 +161,7 @@
unsigned hasAutoCaretColor : 1;
unsigned hasVisitedLinkAutoCaretColor : 1;
+ unsigned effectiveInert : 1;
unsigned isInSubtreeWithBlendMode : 1;
OptionSet<TouchAction> effectiveTouchActions;
Modified: trunk/Source/WebCore/style/StyleAdjuster.cpp (283078 => 283079)
--- trunk/Source/WebCore/style/StyleAdjuster.cpp 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/Source/WebCore/style/StyleAdjuster.cpp 2021-09-25 13:53:27 UTC (rev 283079)
@@ -36,6 +36,7 @@
#include "Element.h"
#include "EventNames.h"
#include "FrameView.h"
+#include "HTMLDialogElement.h"
#include "HTMLDivElement.h"
#include "HTMLInputElement.h"
#include "HTMLMarqueeElement.h"
@@ -520,6 +521,24 @@
style.setEffectiveTouchActions(computeEffectiveTouchActions(style, m_parentStyle.effectiveTouchActions()));
+ // Counterparts in Element::addToTopLayer/removeFromTopLayer & SharingResolver::canShareStyleWithElement need to match!
+ auto hasInertAttribute = [this] (const Element* element) -> bool {
+ return m_document.settings().inertAttributeEnabled() && is<HTMLElement>(element) && element->hasAttribute(HTMLNames::inertAttr);
+ };
+ auto isInertSubtreeRoot = [this, hasInertAttribute] (const Element* element) -> bool {
+ if (m_document.activeModalDialog() && element == m_document.documentElement())
+ return true;
+ if (hasInertAttribute(element))
+ return true;
+ return false;
+ };
+ if (isInertSubtreeRoot(m_element))
+ style.setEffectiveInert(true);
+
+ // Make sure the active dialog is interactable when the whole document is blocked by the modal dialog
+ if (m_element == m_document.activeModalDialog() && !hasInertAttribute(m_element))
+ style.setEffectiveInert(false);
+
if (m_element)
style.setEventListenerRegionTypes(computeEventListenerRegionTypes(*m_element, m_parentStyle.eventListenerRegionTypes()));
Modified: trunk/Source/WebCore/style/StyleSharingResolver.cpp (283078 => 283079)
--- trunk/Source/WebCore/style/StyleSharingResolver.cpp 2021-09-25 08:07:19 UTC (rev 283078)
+++ trunk/Source/WebCore/style/StyleSharingResolver.cpp 2021-09-25 13:53:27 UTC (rev 283079)
@@ -28,6 +28,7 @@
#include "ElementRuleCollector.h"
#include "FullscreenManager.h"
+#include "HTMLDialogElement.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "NodeRenderStyle.h"
@@ -278,6 +279,8 @@
if (candidateElement.elementData() != element.elementData()) {
if (candidateElement.attributeWithoutSynchronization(HTMLNames::readonlyAttr) != element.attributeWithoutSynchronization(HTMLNames::readonlyAttr))
return false;
+ if (m_document.settings().inertAttributeEnabled() && candidateElement.attributeWithoutSynchronization(HTMLNames::inertAttr) != element.attributeWithoutSynchronization(HTMLNames::inertAttr))
+ return false;
if (candidateElement.isSVGElement()) {
if (candidateElement.getAttribute(HTMLNames::typeAttr) != element.getAttribute(HTMLNames::typeAttr))
return false;
@@ -307,6 +310,9 @@
return false;
#endif
+ if (&candidateElement == m_document.activeModalDialog() || &element == m_document.activeModalDialog())
+ return false;
+
#if ENABLE(FULLSCREEN_API)
if (&candidateElement == m_document.fullscreenManager().currentFullscreenElement() || &element == m_document.fullscreenManager().currentFullscreenElement())
return false;