Diff
Modified: trunk/Source/WebCore/ChangeLog (247278 => 247279)
--- trunk/Source/WebCore/ChangeLog 2019-07-09 21:07:53 UTC (rev 247278)
+++ trunk/Source/WebCore/ChangeLog 2019-07-09 21:30:05 UTC (rev 247279)
@@ -1,3 +1,17 @@
+2019-07-09 Alex Christensen <[email protected]>
+
+ Move AutofillElements.{h,cpp} from editing/ios to editing/cocoa since they're used on macOS
+ https://bugs.webkit.org/show_bug.cgi?id=199640
+
+ Reviewed by Chris Dumez.
+
+ * SourcesCocoa.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ * editing/cocoa/AutofillElements.cpp: Copied from Source/WebCore/editing/ios/AutofillElements.cpp.
+ * editing/cocoa/AutofillElements.h: Copied from Source/WebCore/editing/ios/AutofillElements.h.
+ * editing/ios/AutofillElements.cpp: Removed.
+ * editing/ios/AutofillElements.h: Removed.
+
2019-07-09 Devin Rousso <[email protected]>
Web Inspector: Canvas: replace WTF::Vector with std::initializer_list in CallTracer to avoid dynamic allocations
Modified: trunk/Source/WebCore/SourcesCocoa.txt (247278 => 247279)
--- trunk/Source/WebCore/SourcesCocoa.txt 2019-07-09 21:07:53 UTC (rev 247278)
+++ trunk/Source/WebCore/SourcesCocoa.txt 2019-07-09 21:30:05 UTC (rev 247279)
@@ -78,6 +78,7 @@
editing/SelectionRectGatherer.cpp
editing/SmartReplaceCF.cpp
+editing/cocoa/AutofillElements.cpp
editing/cocoa/DataDetection.mm
editing/cocoa/DictionaryLookup.mm
editing/cocoa/EditorCocoa.mm
@@ -99,8 +100,6 @@
editing/mac/TextAlternativeWithRange.mm
editing/mac/TextUndoInsertionMarkupMac.mm
-editing/ios/AutofillElements.cpp
-
fileapi/FileCocoa.mm
html/shadow/ImageControlsRootElement.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (247278 => 247279)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-07-09 21:07:53 UTC (rev 247278)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2019-07-09 21:30:05 UTC (rev 247279)
@@ -1445,7 +1445,6 @@
516103AF1CADBA770016B4C7 /* IDBValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 516103AE1CADB9A30016B4C7 /* IDBValue.h */; settings = {ATTRIBUTES = (Private, ); }; };
5162C7F511F77EFB00612EFE /* SchemeRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 5162C7F311F77EFB00612EFE /* SchemeRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
5166D3CD1E8ED48F00AD62E3 /* StorageType.h in Headers */ = {isa = PBXBuildFile; fileRef = 5166D3CC1E8ED41100AD62E3 /* StorageType.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 51699EE41F608CD500D57D06 /* AutofillElements.h in Headers */ = {isa = PBXBuildFile; fileRef = 51699EE21F608CD500D57D06 /* AutofillElements.h */; settings = {ATTRIBUTES = (Private, ); }; };
516C62201950D48700337E75 /* GamepadEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 516C621D1950D48700337E75 /* GamepadEvent.cpp */; };
516C62211950D48700337E75 /* GamepadEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 516C621E1950D48700337E75 /* GamepadEvent.h */; };
516D7D701BB5F0BD00AF7C77 /* IDBConnectionToServerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5185FCBD1BB5CB770012898F /* IDBConnectionToServerDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8117,8 +8116,6 @@
51645B531B9F889B00F789CE /* IDBVersionChangeEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBVersionChangeEvent.h; sourceTree = "<group>"; };
51645B541B9F88E800F789CE /* IDBCursor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBCursor.cpp; sourceTree = "<group>"; };
5166D3CC1E8ED41100AD62E3 /* StorageType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageType.h; sourceTree = "<group>"; };
- 51699EE11F608CD500D57D06 /* AutofillElements.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AutofillElements.cpp; sourceTree = "<group>"; };
- 51699EE21F608CD500D57D06 /* AutofillElements.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AutofillElements.h; sourceTree = "<group>"; };
516BB7920CE91E6800512F79 /* JSTreeWalkerCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTreeWalkerCustom.cpp; sourceTree = "<group>"; };
516C621D1950D48700337E75 /* GamepadEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GamepadEvent.cpp; sourceTree = "<group>"; };
516C621E1950D48700337E75 /* GamepadEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GamepadEvent.h; sourceTree = "<group>"; };
@@ -8922,6 +8919,8 @@
5CB37FFD1C62D27800F20188 /* ScrollAnimatorMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollAnimatorMock.h; sourceTree = "<group>"; };
5CBC8DAA1AAA302200E1C803 /* MediaAccessibilitySoftLink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaAccessibilitySoftLink.cpp; sourceTree = "<group>"; };
5CBC8DAB1AAA302200E1C803 /* MediaAccessibilitySoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaAccessibilitySoftLink.h; sourceTree = "<group>"; };
+ 5CCC270622D53B6800964FA0 /* AutofillElements.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutofillElements.h; sourceTree = "<group>"; };
+ 5CCC270722D53B6900964FA0 /* AutofillElements.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutofillElements.cpp; sourceTree = "<group>"; };
5CDD83391E4324BB00621E83 /* RealtimeIncomingVideoSourceCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RealtimeIncomingVideoSourceCocoa.mm; sourceTree = "<group>"; };
5CDD83391E4324BB00621E92 /* RealtimeIncomingVideoSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RealtimeIncomingVideoSource.cpp; sourceTree = "<group>"; };
5CDD833A1E4324BB00621E83 /* RealtimeIncomingVideoSourceCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RealtimeIncomingVideoSourceCocoa.h; sourceTree = "<group>"; };
@@ -15606,6 +15605,7 @@
FD2DBF1312B048A300ED98C6 /* AudioToolbox.framework in Frameworks */,
1AB33DA512551E320024457A /* IOKit.framework in Frameworks */,
93F19B1608245E59001E9ABC /* _javascript_Core.framework in Frameworks */,
+ 1C022F0022CFED68006DF01B /* libcompression.tbd in Frameworks */,
93F19B1708245E59001E9ABC /* libicucore.dylib in Frameworks */,
1CFAE3230A6D6A3F0032593D /* libobjc.dylib in Frameworks */,
1C09D0591E31C6A900725F18 /* libPAL.a in Frameworks */,
@@ -15613,7 +15613,6 @@
379919B21200DE5000EA041C /* libz.dylib in Frameworks */,
A88AD52F09524B92001DD196 /* QuartzCore.framework in Frameworks */,
5FE1D292178FD1F3001AA3C3 /* Security.framework in Frameworks */,
- 1C022F0022CFED68006DF01B /* libcompression.tbd in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -18043,8 +18042,6 @@
443292C10EBA6D7300E62016 /* ios */ = {
isa = PBXGroup;
children = (
- 51699EE11F608CD500D57D06 /* AutofillElements.cpp */,
- 51699EE21F608CD500D57D06 /* AutofillElements.h */,
D0BD4F5A1408850F006839B6 /* DictationCommandIOS.cpp */,
D0BD4F5B1408850F006839B6 /* DictationCommandIOS.h */,
FED13D390CEA934600D89466 /* EditorIOS.mm */,
@@ -20787,6 +20784,8 @@
7C3E510718DF8F1200C112F7 /* cocoa */ = {
isa = PBXGroup;
children = (
+ 5CCC270722D53B6900964FA0 /* AutofillElements.cpp */,
+ 5CCC270622D53B6800964FA0 /* AutofillElements.h */,
C5227DEF1C3C6DD700F5ED54 /* DataDetection.h */,
C5227DF01C3C6DD700F5ED54 /* DataDetection.mm */,
937FF3D61A10131B008EBA31 /* DictionaryLookup.mm */,
@@ -28400,7 +28399,6 @@
A5A7AA43132F0ECC00D3A3C2 /* AutocapitalizeTypes.h in Headers */,
7C1843FE1C8B7283002EB973 /* Autofill.h in Headers */,
7C1E97281A9F9834007BF0FB /* AutoFillButtonElement.h in Headers */,
- 51699EE41F608CD500D57D06 /* AutofillElements.h in Headers */,
C9D467051E60C465008195FB /* AutoplayEvent.h in Headers */,
45830D4E1679B4F800ACF8C3 /* AutoscrollController.h in Headers */,
A8CFF04E0A154F09000A4234 /* AutoTableLayout.h in Headers */,
Copied: trunk/Source/WebCore/editing/cocoa/AutofillElements.cpp (from rev 247278, trunk/Source/WebCore/editing/ios/AutofillElements.cpp) (0 => 247279)
--- trunk/Source/WebCore/editing/cocoa/AutofillElements.cpp (rev 0)
+++ trunk/Source/WebCore/editing/cocoa/AutofillElements.cpp 2019-07-09 21:30:05 UTC (rev 247279)
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "AutofillElements.h"
+
+#include "FocusController.h"
+#include "Page.h"
+
+namespace WebCore {
+
+static inline bool isAutofillableElement(Element& node)
+{
+ if (!is<HTMLInputElement>(node))
+ return false;
+
+ auto inputElement = &downcast<HTMLInputElement>(node);
+ return inputElement->isTextField() || inputElement->isEmailField();
+}
+
+static inline RefPtr<HTMLInputElement> nextAutofillableElement(Node* startNode, FocusController& focusController)
+{
+ if (!is<Element>(startNode))
+ return nullptr;
+
+ RefPtr<Element> nextElement = downcast<Element>(startNode);
+ do {
+ nextElement = focusController.nextFocusableElement(*nextElement.get());
+ } while (nextElement && !isAutofillableElement(*nextElement.get()));
+
+ if (!nextElement)
+ return nullptr;
+
+ return &downcast<HTMLInputElement>(*nextElement);
+}
+
+static inline RefPtr<HTMLInputElement> previousAutofillableElement(Node* startNode, FocusController& focusController)
+{
+ if (!is<Element>(startNode))
+ return nullptr;
+
+ RefPtr<Element> previousElement = downcast<Element>(startNode);
+ do {
+ previousElement = focusController.previousFocusableElement(*previousElement.get());
+ } while (previousElement && !isAutofillableElement(*previousElement.get()));
+
+ if (!previousElement)
+ return nullptr;
+
+ return &downcast<HTMLInputElement>(*previousElement);
+}
+
+AutofillElements::AutofillElements(RefPtr<HTMLInputElement>&& username, RefPtr<HTMLInputElement>&& password)
+ : m_username(username)
+ , m_password(password)
+{
+}
+
+Optional<AutofillElements> AutofillElements::computeAutofillElements(Ref<HTMLInputElement> start)
+{
+ if (!start->document().page())
+ return WTF::nullopt;
+ FocusController& focusController = start->document().page()->focusController();
+ if (start->isPasswordField()) {
+ RefPtr<HTMLInputElement> previousElement = previousAutofillableElement(start.ptr(), focusController);
+ RefPtr<HTMLInputElement> nextElement = nextAutofillableElement(start.ptr(), focusController);
+ bool hasDuplicatePasswordElements = (nextElement && nextElement->isPasswordField()) || (previousElement && previousElement->isPasswordField());
+ if (hasDuplicatePasswordElements)
+ return WTF::nullopt;
+
+ if (previousElement && is<HTMLInputElement>(*previousElement)) {
+ if (previousElement->isTextField())
+ return AutofillElements(WTFMove(previousElement), WTFMove(start));
+ }
+ } else {
+ RefPtr<HTMLInputElement> nextElement = nextAutofillableElement(start.ptr(), focusController);
+ if (nextElement && is<HTMLInputElement>(*nextElement)) {
+ if (nextElement->isPasswordField()) {
+ RefPtr<HTMLInputElement> elementAfternextElement = nextAutofillableElement(nextElement.get(), focusController);
+ bool hasDuplicatePasswordElements = elementAfternextElement && elementAfternextElement->isPasswordField();
+ if (hasDuplicatePasswordElements)
+ return WTF::nullopt;
+
+ return AutofillElements(WTFMove(start), WTFMove(nextElement));
+ }
+ }
+ }
+
+ if (start->isPasswordField()) {
+ RefPtr<HTMLInputElement> previousElement = previousAutofillableElement(start.ptr(), focusController);
+ RefPtr<HTMLInputElement> nextElement = nextAutofillableElement(start.ptr(), focusController);
+ if (!previousElement && !nextElement)
+ return AutofillElements(nullptr, start.ptr());
+ }
+ return WTF::nullopt;
+}
+
+void AutofillElements::autofill(String username, String password)
+{
+ if (m_username)
+ m_username->setValueForUser(username);
+ if (m_password)
+ m_password->setValueForUser(password);
+}
+
+} // namespace WebCore
Copied: trunk/Source/WebCore/editing/cocoa/AutofillElements.h (from rev 247278, trunk/Source/WebCore/editing/ios/AutofillElements.h) (0 => 247279)
--- trunk/Source/WebCore/editing/cocoa/AutofillElements.h (rev 0)
+++ trunk/Source/WebCore/editing/cocoa/AutofillElements.h 2019-07-09 21:30:05 UTC (rev 247279)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "HTMLInputElement.h"
+
+namespace WebCore {
+
+class AutofillElements {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ WEBCORE_EXPORT static Optional<AutofillElements> computeAutofillElements(Ref<HTMLInputElement>);
+ WEBCORE_EXPORT void autofill(String, String);
+
+ const HTMLInputElement* username() const { return m_username.get(); }
+private:
+ AutofillElements(RefPtr<HTMLInputElement>&&, RefPtr<HTMLInputElement>&&);
+ RefPtr<HTMLInputElement> m_username;
+ RefPtr<HTMLInputElement> m_password;
+};
+} // namespace WebCore
Deleted: trunk/Source/WebCore/editing/ios/AutofillElements.cpp (247278 => 247279)
--- trunk/Source/WebCore/editing/ios/AutofillElements.cpp 2019-07-09 21:07:53 UTC (rev 247278)
+++ trunk/Source/WebCore/editing/ios/AutofillElements.cpp 2019-07-09 21:30:05 UTC (rev 247279)
@@ -1,128 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "AutofillElements.h"
-
-#include "FocusController.h"
-#include "Page.h"
-
-namespace WebCore {
-
-static inline bool isAutofillableElement(Element& node)
-{
- if (!is<HTMLInputElement>(node))
- return false;
-
- auto inputElement = &downcast<HTMLInputElement>(node);
- return inputElement->isTextField() || inputElement->isEmailField();
-}
-
-static inline RefPtr<HTMLInputElement> nextAutofillableElement(Node* startNode, FocusController& focusController)
-{
- if (!is<Element>(startNode))
- return nullptr;
-
- RefPtr<Element> nextElement = downcast<Element>(startNode);
- do {
- nextElement = focusController.nextFocusableElement(*nextElement.get());
- } while (nextElement && !isAutofillableElement(*nextElement.get()));
-
- if (!nextElement)
- return nullptr;
-
- return &downcast<HTMLInputElement>(*nextElement);
-}
-
-static inline RefPtr<HTMLInputElement> previousAutofillableElement(Node* startNode, FocusController& focusController)
-{
- if (!is<Element>(startNode))
- return nullptr;
-
- RefPtr<Element> previousElement = downcast<Element>(startNode);
- do {
- previousElement = focusController.previousFocusableElement(*previousElement.get());
- } while (previousElement && !isAutofillableElement(*previousElement.get()));
-
- if (!previousElement)
- return nullptr;
-
- return &downcast<HTMLInputElement>(*previousElement);
-}
-
-AutofillElements::AutofillElements(RefPtr<HTMLInputElement>&& username, RefPtr<HTMLInputElement>&& password)
- : m_username(username)
- , m_password(password)
-{
-}
-
-Optional<AutofillElements> AutofillElements::computeAutofillElements(Ref<HTMLInputElement> start)
-{
- if (!start->document().page())
- return WTF::nullopt;
- FocusController& focusController = start->document().page()->focusController();
- if (start->isPasswordField()) {
- RefPtr<HTMLInputElement> previousElement = previousAutofillableElement(start.ptr(), focusController);
- RefPtr<HTMLInputElement> nextElement = nextAutofillableElement(start.ptr(), focusController);
- bool hasDuplicatePasswordElements = (nextElement && nextElement->isPasswordField()) || (previousElement && previousElement->isPasswordField());
- if (hasDuplicatePasswordElements)
- return WTF::nullopt;
-
- if (previousElement && is<HTMLInputElement>(*previousElement)) {
- if (previousElement->isTextField())
- return AutofillElements(WTFMove(previousElement), WTFMove(start));
- }
- } else {
- RefPtr<HTMLInputElement> nextElement = nextAutofillableElement(start.ptr(), focusController);
- if (nextElement && is<HTMLInputElement>(*nextElement)) {
- if (nextElement->isPasswordField()) {
- RefPtr<HTMLInputElement> elementAfternextElement = nextAutofillableElement(nextElement.get(), focusController);
- bool hasDuplicatePasswordElements = elementAfternextElement && elementAfternextElement->isPasswordField();
- if (hasDuplicatePasswordElements)
- return WTF::nullopt;
-
- return AutofillElements(WTFMove(start), WTFMove(nextElement));
- }
- }
- }
-
- if (start->isPasswordField()) {
- RefPtr<HTMLInputElement> previousElement = previousAutofillableElement(start.ptr(), focusController);
- RefPtr<HTMLInputElement> nextElement = nextAutofillableElement(start.ptr(), focusController);
- if (!previousElement && !nextElement)
- return AutofillElements(nullptr, start.ptr());
- }
- return WTF::nullopt;
-}
-
-void AutofillElements::autofill(String username, String password)
-{
- if (m_username)
- m_username->setValueForUser(username);
- if (m_password)
- m_password->setValueForUser(password);
-}
-
-} // namespace WebCore
Deleted: trunk/Source/WebCore/editing/ios/AutofillElements.h (247278 => 247279)
--- trunk/Source/WebCore/editing/ios/AutofillElements.h 2019-07-09 21:07:53 UTC (rev 247278)
+++ trunk/Source/WebCore/editing/ios/AutofillElements.h 2019-07-09 21:30:05 UTC (rev 247279)
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "HTMLInputElement.h"
-
-namespace WebCore {
-
-class AutofillElements {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- WEBCORE_EXPORT static Optional<AutofillElements> computeAutofillElements(Ref<HTMLInputElement>);
- WEBCORE_EXPORT void autofill(String, String);
-
- const HTMLInputElement* username() const { return m_username.get(); }
-private:
- AutofillElements(RefPtr<HTMLInputElement>&&, RefPtr<HTMLInputElement>&&);
- RefPtr<HTMLInputElement> m_username;
- RefPtr<HTMLInputElement> m_password;
-};
-} // namespace WebCore