Title: [291623] trunk
- Revision
- 291623
- Author
- commit-qu...@webkit.org
- Date
- 2022-03-22 09:01:26 -0700 (Tue, 22 Mar 2022)
Log Message
It should be possible to copy text out of "AutoFilledAndViewable" password fields
https://bugs.webkit.org/show_bug.cgi?id=238160
Patch by Ricky Mondello <rmonde...@apple.com> on 2022-03-22
Reviewed by Geoffrey Garen.
Source/WebCore:
* editing/Editor.cpp:
(WebCore::Editor::canCopy const): Allow copy in AutoFilledAndViewable password fields.
* editing/VisibleSelection.cpp:
(WebCore::VisibleSelection::isInAutoFilledAndViewableField const): Added.
* editing/VisibleSelection.h: Declare member function.
LayoutTests:
* fast/forms/input-autofilled-and-viewable.html: Test copying.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (291622 => 291623)
--- trunk/LayoutTests/ChangeLog 2022-03-22 15:45:59 UTC (rev 291622)
+++ trunk/LayoutTests/ChangeLog 2022-03-22 16:01:26 UTC (rev 291623)
@@ -1,3 +1,12 @@
+2022-03-22 Ricky Mondello <rmonde...@apple.com>
+
+ It should be possible to copy text out of "AutoFilledAndViewable" password fields
+ https://bugs.webkit.org/show_bug.cgi?id=238160
+
+ Reviewed by Geoffrey Garen.
+
+ * fast/forms/input-autofilled-and-viewable.html: Test copying.
+
2022-03-22 Jer Noble <jer.no...@apple.com>
Fetching a Blob URL with an unbounded Range header do not generate a Content-Range response header
Modified: trunk/LayoutTests/fast/forms/input-autofilled-and-viewable.html (291622 => 291623)
--- trunk/LayoutTests/fast/forms/input-autofilled-and-viewable.html 2022-03-22 15:45:59 UTC (rev 291622)
+++ trunk/LayoutTests/fast/forms/input-autofilled-and-viewable.html 2022-03-22 16:01:26 UTC (rev 291623)
@@ -31,6 +31,13 @@
tf.focus();
document.execCommand("SelectAll");
+
+ var couldCopy = document.execCommand("Copy");
+ if (!couldCopy) {
+ testFailed('Could not copy text from "AutoFilledAndViewable" field.');
+ return;
+ }
+
document.execCommand("Delete");
// Colors should be restored.
Modified: trunk/Source/WebCore/ChangeLog (291622 => 291623)
--- trunk/Source/WebCore/ChangeLog 2022-03-22 15:45:59 UTC (rev 291622)
+++ trunk/Source/WebCore/ChangeLog 2022-03-22 16:01:26 UTC (rev 291623)
@@ -1,3 +1,16 @@
+2022-03-22 Ricky Mondello <rmonde...@apple.com>
+
+ It should be possible to copy text out of "AutoFilledAndViewable" password fields
+ https://bugs.webkit.org/show_bug.cgi?id=238160
+
+ Reviewed by Geoffrey Garen.
+
+ * editing/Editor.cpp:
+ (WebCore::Editor::canCopy const): Allow copy in AutoFilledAndViewable password fields.
+ * editing/VisibleSelection.cpp:
+ (WebCore::VisibleSelection::isInAutoFilledAndViewableField const): Added.
+ * editing/VisibleSelection.h: Declare member function.
+
2022-03-22 Jer Noble <jer.no...@apple.com>
Fetching a Blob URL with an unbounded Range header do not generate a Content-Range response header
Modified: trunk/Source/WebCore/editing/Editor.cpp (291622 => 291623)
--- trunk/Source/WebCore/editing/Editor.cpp 2022-03-22 15:45:59 UTC (rev 291622)
+++ trunk/Source/WebCore/editing/Editor.cpp 2022-03-22 16:01:26 UTC (rev 291623)
@@ -507,7 +507,7 @@
if (imageElementFromImageDocument(document()))
return true;
const VisibleSelection& selection = m_document.selection().selection();
- return selection.isRange() && !selection.isInPasswordField();
+ return selection.isRange() && (!selection.isInPasswordField() || selection.isInAutoFilledAndViewableField());
}
bool Editor::canPaste() const
Modified: trunk/Source/WebCore/editing/VisibleSelection.cpp (291622 => 291623)
--- trunk/Source/WebCore/editing/VisibleSelection.cpp 2022-03-22 15:45:59 UTC (rev 291622)
+++ trunk/Source/WebCore/editing/VisibleSelection.cpp 2022-03-22 16:01:26 UTC (rev 291623)
@@ -683,6 +683,13 @@
return is<HTMLInputElement>(textControl) && downcast<HTMLInputElement>(*textControl).isPasswordField();
}
+bool VisibleSelection::isInAutoFilledAndViewableField() const
+{
+ if (auto* input = dynamicDowncast<HTMLInputElement>(enclosingTextFormControl(start())))
+ return input->isAutoFilledAndViewable();
+ return false;
+}
+
#if ENABLE(TREE_DEBUGGING)
void VisibleSelection::debugPosition() const
Modified: trunk/Source/WebCore/editing/VisibleSelection.h (291622 => 291623)
--- trunk/Source/WebCore/editing/VisibleSelection.h 2022-03-22 15:45:59 UTC (rev 291622)
+++ trunk/Source/WebCore/editing/VisibleSelection.h 2022-03-22 16:01:26 UTC (rev 291623)
@@ -117,7 +117,8 @@
Node* nonBoundaryShadowTreeRootNode() const;
WEBCORE_EXPORT bool isInPasswordField() const;
-
+ WEBCORE_EXPORT bool isInAutoFilledAndViewableField() const;
+
WEBCORE_EXPORT static Position adjustPositionForEnd(const Position& currentPosition, Node* startContainerNode);
WEBCORE_EXPORT static Position adjustPositionForStart(const Position& currentPosition, Node* startContainerNode);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes