- Revision
- 290564
- Author
- [email protected]
- Date
- 2022-02-27 08:38:27 -0800 (Sun, 27 Feb 2022)
Log Message
Force -webkit-user-modify used style to readonly for inert nodes
https://bugs.webkit.org/show_bug.cgi?id=237244
Reviewed by Darin Adler.
This disallows programmatic edition of contenteditable inert nodes. Edition via user-input is
already prevented by forcing pointer-events style to none.
We create a seperate effectiveUserModify, similar to effectiveUserSelect/effectivePointerEvents,
to avoid changing the computed style.
This behaviour also matches Blink & Gecko.
LayoutTests/imported/w3c:
* web-platform-tests/inert/inert-and-contenteditable.tentative-expected.txt:
Source/WebCore:
Test: imported/w3c/web-platform-tests/inert/inert-and-contenteditable.tentative.html
* dom/Node.cpp:
(WebCore::computeEditabilityFromComputedStyle):
* editing/ApplyBlockElementCommand.cpp:
(WebCore::ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded):
* editing/ReplaceSelectionCommand.cpp:
(WebCore::ReplaceSelectionCommand::doApply):
* rendering/EventRegion.cpp:
(WebCore::EventRegion::unite):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::styleWillChange):
* rendering/style/RenderStyle.h:
(WebCore::RenderStyle::effectiveUserModify const):
* style/StyleTreeResolver.cpp:
(WebCore::Style::TreeResolver::resolveElement):
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (290563 => 290564)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-27 16:33:02 UTC (rev 290563)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2022-02-27 16:38:27 UTC (rev 290564)
@@ -1,3 +1,20 @@
+2022-02-27 Tim Nguyen <[email protected]>
+
+ Force -webkit-user-modify used style to readonly for inert nodes
+ https://bugs.webkit.org/show_bug.cgi?id=237244
+
+ Reviewed by Darin Adler.
+
+ This disallows programmatic edition of contenteditable inert nodes. Edition via user-input is
+ already prevented by forcing pointer-events style to none.
+
+ We create a seperate effectiveUserModify, similar to effectiveUserSelect/effectivePointerEvents,
+ to avoid changing the computed style.
+
+ This behaviour also matches Blink & Gecko.
+
+ * web-platform-tests/inert/inert-and-contenteditable.tentative-expected.txt:
+
2022-02-27 Antoine Quint <[email protected]>
[css-animations] implicit keyframes should be inserted after explicit keyframes with the same offset
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/inert/inert-and-contenteditable.tentative-expected.txt (290563 => 290564)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/inert/inert-and-contenteditable.tentative-expected.txt 2022-02-27 16:33:02 UTC (rev 290563)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/inert/inert-and-contenteditable.tentative-expected.txt 2022-02-27 16:38:27 UTC (rev 290564)
@@ -1,11 +1,10 @@
-FAIL execCommand should return the same value assert_equals: [false,true,false,false] at index 1 expected false but got true
-FAIL The resulting textContent should be the same value assert_equals: ["{target}","{}","{target}","{target}"] at index 1 expected "{target}" but got "{}"
+PASS execCommand should return the same value
+PASS The resulting textContent should be the same value
{
target
}
-{}
{
target
@@ -14,3 +13,7 @@
target
}
+{
+target
+
+}
Modified: trunk/Source/WebCore/ChangeLog (290563 => 290564)
--- trunk/Source/WebCore/ChangeLog 2022-02-27 16:33:02 UTC (rev 290563)
+++ trunk/Source/WebCore/ChangeLog 2022-02-27 16:38:27 UTC (rev 290564)
@@ -1,3 +1,35 @@
+2022-02-27 Tim Nguyen <[email protected]>
+
+ Force -webkit-user-modify used style to readonly for inert nodes
+ https://bugs.webkit.org/show_bug.cgi?id=237244
+
+ Reviewed by Darin Adler.
+
+ This disallows programmatic edition of contenteditable inert nodes. Edition via user-input is
+ already prevented by forcing pointer-events style to none.
+
+ We create a seperate effectiveUserModify, similar to effectiveUserSelect/effectivePointerEvents,
+ to avoid changing the computed style.
+
+ This behaviour also matches Blink & Gecko.
+
+ Test: imported/w3c/web-platform-tests/inert/inert-and-contenteditable.tentative.html
+
+ * dom/Node.cpp:
+ (WebCore::computeEditabilityFromComputedStyle):
+ * editing/ApplyBlockElementCommand.cpp:
+ (WebCore::ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded):
+ * editing/ReplaceSelectionCommand.cpp:
+ (WebCore::ReplaceSelectionCommand::doApply):
+ * rendering/EventRegion.cpp:
+ (WebCore::EventRegion::unite):
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::styleWillChange):
+ * rendering/style/RenderStyle.h:
+ (WebCore::RenderStyle::effectiveUserModify const):
+ * style/StyleTreeResolver.cpp:
+ (WebCore::Style::TreeResolver::resolveElement):
+
2022-02-27 Dean Jackson <[email protected]>
Loading a USDZ url as the main resource renders as garbage
Modified: trunk/Source/WebCore/dom/Node.cpp (290563 => 290564)
--- trunk/Source/WebCore/dom/Node.cpp 2022-02-27 16:33:02 UTC (rev 290563)
+++ trunk/Source/WebCore/dom/Node.cpp 2022-02-27 16:38:27 UTC (rev 290564)
@@ -770,7 +770,7 @@
if (pageIsEditable == PageIsEditable::Yes)
return Node::Editability::CanEditRichly;
- switch (style->userModify()) {
+ switch (style->effectiveUserModify()) {
case UserModify::ReadOnly:
return Node::Editability::ReadOnly;
case UserModify::ReadWrite:
Modified: trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp (290563 => 290564)
--- trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp 2022-02-27 16:33:02 UTC (rev 290563)
+++ trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp 2022-02-27 16:38:27 UTC (rev 290564)
@@ -238,7 +238,7 @@
unsigned endOffset = end.offsetInContainerNode();
bool preservesNewLine = endStyle->preserveNewline();
bool collapseWhiteSpace = endStyle->collapseWhiteSpace();
- auto userModify = endStyle->userModify();
+ auto userModify = endStyle->effectiveUserModify();
endStyle = nullptr;
if (preservesNewLine && start == end && endOffset < end.containerNode()->length()) {
Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (290563 => 290564)
--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp 2022-02-27 16:33:02 UTC (rev 290563)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp 2022-02-27 16:38:27 UTC (rev 290564)
@@ -1121,8 +1121,8 @@
return;
// We can skip matching the style if the selection is plain text.
- if ((selection.start().deprecatedNode()->renderer() && selection.start().deprecatedNode()->renderer()->style().userModify() == UserModify::ReadWritePlaintextOnly)
- && (selection.end().deprecatedNode()->renderer() && selection.end().deprecatedNode()->renderer()->style().userModify() == UserModify::ReadWritePlaintextOnly))
+ if ((selection.start().deprecatedNode()->renderer() && selection.start().deprecatedNode()->renderer()->style().effectiveUserModify() == UserModify::ReadWritePlaintextOnly)
+ && (selection.end().deprecatedNode()->renderer() && selection.end().deprecatedNode()->renderer()->style().effectiveUserModify() == UserModify::ReadWritePlaintextOnly))
m_matchStyle = false;
if (m_matchStyle) {
Modified: trunk/Source/WebCore/rendering/EventRegion.cpp (290563 => 290564)
--- trunk/Source/WebCore/rendering/EventRegion.cpp 2022-02-27 16:33:02 UTC (rev 290563)
+++ trunk/Source/WebCore/rendering/EventRegion.cpp 2022-02-27 16:38:27 UTC (rev 290564)
@@ -132,7 +132,7 @@
#endif
#if ENABLE(EDITABLE_REGION)
- if (m_editableRegion && (overrideUserModifyIsEditable || style.userModify() != UserModify::ReadOnly)) {
+ if (m_editableRegion && (overrideUserModifyIsEditable || style.effectiveUserModify() != UserModify::ReadOnly)) {
m_editableRegion->unite(region);
LOG_WITH_STREAM(EventRegions, stream << " uniting editable region");
}
Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (290563 => 290564)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2022-02-27 16:33:02 UTC (rev 290563)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2022-02-27 16:38:27 UTC (rev 290564)
@@ -853,8 +853,8 @@
if (m_style.eventListenerRegionTypes() != newStyle.eventListenerRegionTypes())
return true;
#if ENABLE(EDITABLE_REGION)
- bool wasEditable = m_style.userModify() != UserModify::ReadOnly;
- bool isEditable = newStyle.userModify() != UserModify::ReadOnly;
+ bool wasEditable = m_style.effectiveUserModify() != UserModify::ReadOnly;
+ bool isEditable = newStyle.effectiveUserModify() != UserModify::ReadOnly;
if (wasEditable != isEditable)
return page().shouldBuildEditableRegion();
#endif
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (290563 => 290564)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2022-02-27 16:33:02 UTC (rev 290563)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2022-02-27 16:38:27 UTC (rev 290564)
@@ -614,6 +614,7 @@
int marqueeLoopCount() const { return m_rareNonInheritedData->marquee->loops; }
MarqueeBehavior marqueeBehavior() const { return static_cast<MarqueeBehavior>(m_rareNonInheritedData->marquee->behavior); }
MarqueeDirection marqueeDirection() const { return static_cast<MarqueeDirection>(m_rareNonInheritedData->marquee->direction); }
+ UserModify effectiveUserModify() const { return effectiveInert() ? UserModify::ReadOnly : userModify(); }
UserModify userModify() const { return static_cast<UserModify>(m_rareInheritedData->userModify); }
UserDrag userDrag() const { return static_cast<UserDrag>(m_rareNonInheritedData->userDrag); }
UserSelect effectiveUserSelect() const { return effectiveInert() ? UserSelect::None : userSelect(); }
Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (290563 => 290564)
--- trunk/Source/WebCore/style/StyleTreeResolver.cpp 2022-02-27 16:33:02 UTC (rev 290563)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp 2022-02-27 16:38:27 UTC (rev 290564)
@@ -265,7 +265,7 @@
m_document.setMayHaveElementsWithNonAutoTouchAction();
#endif
#if ENABLE(EDITABLE_REGION)
- if (update.style->userModify() != UserModify::ReadOnly)
+ if (update.style->effectiveUserModify() != UserModify::ReadOnly)
m_document.setMayHaveEditableElements();
#endif