Diff
Modified: trunk/LayoutTests/ChangeLog (281929 => 281930)
--- trunk/LayoutTests/ChangeLog 2021-09-02 16:37:30 UTC (rev 281929)
+++ trunk/LayoutTests/ChangeLog 2021-09-02 16:39:48 UTC (rev 281930)
@@ -1,3 +1,12 @@
+2021-09-02 Tim Nguyen <[email protected]>
+
+ Add more inert checks for selection-related functionality
+ https://bugs.webkit.org/show_bug.cgi?id=229728
+
+ Reviewed by Antti Koivisto.
+
+ * TestExpectations:
+
2021-09-02 Ayumi Kojima <[email protected]>
[ iOS ] SHOULD NEVER BE REACHED ./Modules/mediastream/MediaStreamTrack.cpp(294) : WebCore::DoubleRange WebCore::capabilityDoubleRange(const WebCore::CapabilityValueOrRange &).
Modified: trunk/LayoutTests/TestExpectations (281929 => 281930)
--- trunk/LayoutTests/TestExpectations 2021-09-02 16:37:30 UTC (rev 281929)
+++ trunk/LayoutTests/TestExpectations 2021-09-02 16:39:48 UTC (rev 281930)
@@ -2399,9 +2399,6 @@
webkit.org/b/84796 imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-containing-block.html [ ImageOnlyFailure ]
webkit.org/b/84796 imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/top-layer-stacking.html [ ImageOnlyFailure ]
-# inert subtrees
-webkit.org/b/110952 imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-dialog-element/inert-node-is-not-highlighted.html [ ImageOnlyFailure ]
-
# Assertion failure in MessagePort::contextDestroyed, usually attributed to later tests
webkit.org/b/94458 http/tests/security/MessagePort/event-listener-context.html [ Skip ]
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (281929 => 281930)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-09-02 16:37:30 UTC (rev 281929)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-09-02 16:39:48 UTC (rev 281930)
@@ -1,3 +1,12 @@
+2021-09-02 Tim Nguyen <[email protected]>
+
+ Add more inert checks for selection-related functionality
+ https://bugs.webkit.org/show_bug.cgi?id=229728
+
+ Reviewed by Antti Koivisto.
+
+ * web-platform-tests/inert/inert-node-is-unselectable.tentative-expected.txt:
+
2021-09-02 Antti Koivisto <[email protected]>
[CSS Cascade Layers] Support layer argument in @import rules
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/inert/inert-node-is-unselectable.tentative-expected.txt (281929 => 281930)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/inert/inert-node-is-unselectable.tentative-expected.txt 2021-09-02 16:37:30 UTC (rev 281929)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/inert/inert-node-is-unselectable.tentative-expected.txt 2021-09-02 16:39:48 UTC (rev 281930)
@@ -1,5 +1,5 @@
Here is a text node you can't select.
I'm selectable.
-FAIL Inert nodes cannot be selected. assert_equals: expected "I'm selectable." but got "Here is a text node you can't select.\nI'm selectable."
+PASS Inert nodes cannot be selected.
Modified: trunk/Source/WebCore/ChangeLog (281929 => 281930)
--- trunk/Source/WebCore/ChangeLog 2021-09-02 16:37:30 UTC (rev 281929)
+++ trunk/Source/WebCore/ChangeLog 2021-09-02 16:39:48 UTC (rev 281930)
@@ -1,3 +1,25 @@
+2021-09-02 Tim Nguyen <[email protected]>
+
+ Add more inert checks for selection-related functionality
+ https://bugs.webkit.org/show_bug.cgi?id=229728
+
+ Reviewed by Antti Koivisto.
+
+ Test: LayoutTests/imported/w3c/web-platform-tests/inert/inert-node-is-unselectable.tentative.html
+
+ * dom/Position.cpp:
+ (WebCore::Position::nodeIsInertOrUserSelectNone):
+ (WebCore::Position::isCandidate const):
+ (WebCore::Position::nodeIsUserSelectNone): Deleted.
+ (WebCore::Position::nodeIsUserSelectAll):
+ * dom/Position.h:
+ * dom/PositionIterator.cpp:
+ (WebCore::PositionIterator::isCandidate const):
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::updateSelectionForMouseDownDispatchingSelectStart):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::collectSelectionGeometriesInternal):
+
2021-09-02 Antti Koivisto <[email protected]>
[CSS Cascade Layers] Support layer argument in @import rules
Modified: trunk/Source/WebCore/dom/Node.h (281929 => 281930)
--- trunk/Source/WebCore/dom/Node.h 2021-09-02 16:37:30 UTC (rev 281929)
+++ trunk/Source/WebCore/dom/Node.h 2021-09-02 16:39:48 UTC (rev 281930)
@@ -529,7 +529,7 @@
// https://github.com/WICG/inert/blob/master/README.md
// This can't be in Element because text nodes must be recognized as
// inert to prevent text selection.
- bool isInert() const;
+ WEBCORE_EXPORT bool isInert() const;
protected:
enum class NodeFlag : uint32_t {
Modified: trunk/Source/WebCore/dom/Position.cpp (281929 => 281930)
--- trunk/Source/WebCore/dom/Position.cpp 2021-09-02 16:37:30 UTC (rev 281929)
+++ trunk/Source/WebCore/dom/Position.cpp 2021-09-02 16:39:48 UTC (rev 281930)
@@ -935,14 +935,20 @@
return false;
}
-bool Position::nodeIsUserSelectNone(Node* node)
+bool Position::nodeIsInertOrUserSelectNone(Node* node)
{
- return node && node->renderer() && node->renderer()->style().userSelect() == UserSelect::None;
+ if (!node)
+ return false;
+ if (node->isInert())
+ return true;
+ return node->renderer() && node->renderer()->style().userSelect() == UserSelect::None;
}
bool Position::nodeIsUserSelectAll(const Node* node)
{
- return node && node->renderer() && node->renderer()->style().userSelect() == UserSelect::All;
+ if (!node || node->isInert())
+ return false;
+ return node->renderer() && node->renderer()->style().userSelect() == UserSelect::All;
}
Node* Position::rootUserSelectAllForNode(Node* node)
@@ -982,16 +988,16 @@
if (renderer->isBR()) {
// FIXME: The condition should be m_anchorType == PositionIsBeforeAnchor, but for now we still need to support legacy positions.
- return !m_offset && m_anchorType != PositionIsAfterAnchor && !nodeIsUserSelectNone(deprecatedNode()->parentNode());
+ return !m_offset && m_anchorType != PositionIsAfterAnchor && !nodeIsInertOrUserSelectNone(deprecatedNode()->parentNode());
}
if (is<RenderText>(*renderer))
- return !nodeIsUserSelectNone(deprecatedNode()) && downcast<RenderText>(*renderer).containsCaretOffset(m_offset);
+ return !nodeIsInertOrUserSelectNone(deprecatedNode()) && downcast<RenderText>(*renderer).containsCaretOffset(m_offset);
if (positionBeforeOrAfterNodeIsCandidate(*deprecatedNode())) {
return ((atFirstEditingPositionForNode() && m_anchorType == PositionIsBeforeAnchor)
|| (atLastEditingPositionForNode() && m_anchorType == PositionIsAfterAnchor))
- && !nodeIsUserSelectNone(deprecatedNode()->parentNode());
+ && !nodeIsInertOrUserSelectNone(deprecatedNode()->parentNode());
}
if (is<HTMLHtmlElement>(*m_anchorNode))
@@ -1001,13 +1007,13 @@
auto& block = downcast<RenderBlock>(*renderer);
if (block.logicalHeight() || is<HTMLBodyElement>(*m_anchorNode) || m_anchorNode->isRootEditableElement()) {
if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(block))
- return atFirstEditingPositionForNode() && !Position::nodeIsUserSelectNone(deprecatedNode());
- return m_anchorNode->hasEditableStyle() && !Position::nodeIsUserSelectNone(deprecatedNode()) && atEditingBoundary();
+ return atFirstEditingPositionForNode() && !Position::nodeIsInertOrUserSelectNone(deprecatedNode());
+ return m_anchorNode->hasEditableStyle() && !Position::nodeIsInertOrUserSelectNone(deprecatedNode()) && atEditingBoundary();
}
return false;
}
- return m_anchorNode->hasEditableStyle() && !Position::nodeIsUserSelectNone(deprecatedNode()) && atEditingBoundary();
+ return m_anchorNode->hasEditableStyle() && !Position::nodeIsInertOrUserSelectNone(deprecatedNode()) && atEditingBoundary();
}
bool Position::isRenderedCharacter() const
Modified: trunk/Source/WebCore/dom/Position.h (281929 => 281930)
--- trunk/Source/WebCore/dom/Position.h 2021-09-02 16:37:30 UTC (rev 281929)
+++ trunk/Source/WebCore/dom/Position.h 2021-09-02 16:39:48 UTC (rev 281930)
@@ -179,7 +179,7 @@
static unsigned positionCountBetweenPositions(const Position&, const Position&);
static bool hasRenderedNonAnonymousDescendantsWithHeight(const RenderElement&);
- static bool nodeIsUserSelectNone(Node*);
+ static bool nodeIsInertOrUserSelectNone(Node*);
static bool nodeIsUserSelectAll(const Node*);
static Node* rootUserSelectAllForNode(Node*);
Modified: trunk/Source/WebCore/dom/PositionIterator.cpp (281929 => 281930)
--- trunk/Source/WebCore/dom/PositionIterator.cpp 2021-09-02 16:37:30 UTC (rev 281929)
+++ trunk/Source/WebCore/dom/PositionIterator.cpp 2021-09-02 16:39:48 UTC (rev 281930)
@@ -162,10 +162,10 @@
return Position(*this).isCandidate();
if (is<RenderText>(*renderer))
- return !Position::nodeIsUserSelectNone(m_anchorNode) && downcast<RenderText>(*renderer).containsCaretOffset(m_offsetInAnchor);
+ return !Position::nodeIsInertOrUserSelectNone(m_anchorNode) && downcast<RenderText>(*renderer).containsCaretOffset(m_offsetInAnchor);
if (positionBeforeOrAfterNodeIsCandidate(*m_anchorNode))
- return (atStartOfNode() || atEndOfNode()) && !Position::nodeIsUserSelectNone(m_anchorNode->parentNode());
+ return (atStartOfNode() || atEndOfNode()) && !Position::nodeIsInertOrUserSelectNone(m_anchorNode->parentNode());
if (is<HTMLHtmlElement>(*m_anchorNode))
return false;
@@ -174,13 +174,13 @@
auto& block = downcast<RenderBlock>(*renderer);
if (block.logicalHeight() || is<HTMLBodyElement>(*m_anchorNode) || m_anchorNode->isRootEditableElement()) {
if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(block))
- return atStartOfNode() && !Position::nodeIsUserSelectNone(m_anchorNode);
- return m_anchorNode->hasEditableStyle() && !Position::nodeIsUserSelectNone(m_anchorNode) && Position(*this).atEditingBoundary();
+ return atStartOfNode() && !Position::nodeIsInertOrUserSelectNone(m_anchorNode);
+ return m_anchorNode->hasEditableStyle() && !Position::nodeIsInertOrUserSelectNone(m_anchorNode) && Position(*this).atEditingBoundary();
}
return false;
}
- return m_anchorNode->hasEditableStyle() && !Position::nodeIsUserSelectNone(m_anchorNode) && Position(*this).atEditingBoundary();
+ return m_anchorNode->hasEditableStyle() && !Position::nodeIsInertOrUserSelectNone(m_anchorNode) && Position(*this).atEditingBoundary();
}
} // namespace WebCore
Modified: trunk/Source/WebCore/page/EventHandler.cpp (281929 => 281930)
--- trunk/Source/WebCore/page/EventHandler.cpp 2021-09-02 16:37:30 UTC (rev 281929)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2021-09-02 16:39:48 UTC (rev 281930)
@@ -465,7 +465,7 @@
bool EventHandler::updateSelectionForMouseDownDispatchingSelectStart(Node* targetNode, const VisibleSelection& selection, TextGranularity granularity)
{
- if (Position::nodeIsUserSelectNone(targetNode))
+ if (Position::nodeIsInertOrUserSelectNone(targetNode))
return false;
if (!dispatchSelectStart(targetNode)) {
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (281929 => 281930)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2021-09-02 16:37:30 UTC (rev 281929)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2021-09-02 16:39:48 UTC (rev 281930)
@@ -2175,7 +2175,7 @@
for (auto& node : intersectingNodesWithDeprecatedZeroOffsetStartQuirk(range)) {
auto renderer = node.renderer();
// Only ask leaf render objects for their line box rects.
- if (renderer && !renderer->firstChildSlow() && renderer->style().userSelect() != UserSelect::None) {
+ if (renderer && !renderer->firstChildSlow() && renderer->style().userSelect() != UserSelect::None && !node.isInert()) {
bool isStartNode = renderer->node() == range.start.container.ptr();
bool isEndNode = renderer->node() == range.end.container.ptr();
if (hasFlippedWritingMode != renderer->style().isFlippedBlocksWritingMode())
Modified: trunk/Source/WebKit/ChangeLog (281929 => 281930)
--- trunk/Source/WebKit/ChangeLog 2021-09-02 16:37:30 UTC (rev 281929)
+++ trunk/Source/WebKit/ChangeLog 2021-09-02 16:39:48 UTC (rev 281930)
@@ -1,3 +1,13 @@
+2021-09-02 Tim Nguyen <[email protected]>
+
+ Add more inert checks for selection-related functionality
+ https://bugs.webkit.org/show_bug.cgi?id=229728
+
+ Reviewed by Antti Koivisto.
+
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::selectionPositionInformation):
+
2021-09-01 Alex Christensen <[email protected]>
Move PCM::Store ownership from WebResourceLoadStatisticsStore to PrivateClickMeasurementManager
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (281929 => 281930)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2021-09-02 16:37:30 UTC (rev 281929)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2021-09-02 16:39:48 UTC (rev 281930)
@@ -2884,7 +2884,7 @@
if (attachment.file())
info.url = ""
} else {
- info.isSelectable = renderer->style().userSelect() != UserSelect::None;
+ info.isSelectable = renderer->style().userSelect() != UserSelect::None && !hitNode->isInert();
// We don't want to select blocks that are larger than 97% of the visible area of the document.
// FIXME: Is this heuristic still needed, now that block selection has been removed?
if (info.isSelectable && !hitNode->isTextNode())