Title: [181408] trunk
Revision
181408
Author
wei...@apple.com
Date
2015-03-11 15:01:01 -0700 (Wed, 11 Mar 2015)

Log Message

Allow adding a button in input elements for auto fill related functionality
<rdar://problem/19782066>
https://bugs.webkit.org/show_bug.cgi?id=142564

Reviewed by Anders Carlsson.

Source/WebCore:

Test: fast/forms/input-auto-fill-button.html

- Adds a new button that can be shown in <input> elements - AutoFillButtonElement.
- Makes the spelling of AutoFill consistent throughout WebCore and WebKit (except
  where not feasible due to exported API/SPI).

* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
Add new files.

* css/html.css:
(input::-webkit-auto-fill-button):
(input::-webkit-auto-fill-button:hover):
(input::-webkit-auto-fill-button:active):
Add default style rules for the AutoFill button based on the ones
used for caps lock indicator.

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::HTMLInputElement):
(WebCore::HTMLInputElement::autoFillButtonElement):
(WebCore::HTMLInputElement::reset):
(WebCore::HTMLInputElement::setValueFromRenderer):
(WebCore::HTMLInputElement::setAutoFilled):
(WebCore::HTMLInputElement::setShowAutoFillButton):
(WebCore::HTMLInputElement::setAutofilled): Deleted.
* html/HTMLInputElement.h:
(WebCore::HTMLInputElement::isAutoFilled):
(WebCore::HTMLInputElement::showAutoFillButton):
(WebCore::HTMLInputElement::isAutofilled): Deleted.
Add new bit to represent whether the AutoFill button should be shown
or not. By default it is not shown, and the client must enable it.

* html/InputType.cpp:
(WebCore::InputType::updateAutoFillButton):
* html/InputType.h:
(WebCore::InputType::autoFillButtonElement):
Add new virtual methods for updating and accessing the AutoFill button.

* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::createShadowSubtree):
(WebCore::TextFieldInputType::autoFillButtonElement):
(WebCore::TextFieldInputType::destroyShadowSubtree):
(WebCore::TextFieldInputType::updatePlaceholderText):
(WebCore::TextFieldInputType::shouldDrawAutoFillButton):
(WebCore::TextFieldInputType::autoFillButtonElementWasClicked):
(WebCore::TextFieldInputType::createContainer):
(WebCore::TextFieldInputType::createAutoFillButton):
(WebCore::TextFieldInputType::updateAutoFillButton):
* html/TextFieldInputType.h:
Add support for adding the AutoFill to the shadow DOM of textfields. The implementation
is slightly different than for the caps lock indicator, because I didn't want to force
the creation of a container for all <input> elements just in case an AutoFill button was
added. Instead, if an AutoFill button is added, the container is created on the fly and
the existing DOM is updated to move into it. Once a container is created, it is never
removed.

* html/shadow/AutoFillButtonElement.cpp: Added.
(WebCore::AutoFillButtonElement::create):
(WebCore::AutoFillButtonElement::AutoFillButtonElement):
(WebCore::AutoFillButtonElement::defaultEventHandler):
* html/shadow/AutoFillButtonElement.h: Added.
Add div subclass that swallows the click event and forwards it to the ChromeClient.

* page/ChromeClient.h:
Add handleAutoFillButtonClick client function to inform WebKit that the AutoFill
button was clicked.

* testing/Internals.cpp:
(WebCore::Internals::setAutofilled):
(WebCore::Internals::setShowAutoFillButton):
* testing/Internals.h:
* testing/Internals.idl:
Expose a new internals.setShowAutoFillButton() function to allow testing
of the AutoFill button from layout tests.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isValueAutofilled):
* css/SelectorCheckerTestFunctions.h:
(WebCore::isAutofilled):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::canShareStyleWithControl):
Update for new spelling of AutoFill.

Source/WebKit/mac:

* DOM/WebDOMOperations.mm:
(-[DOMHTMLInputElement _setAutofilled:]):
Update for consistent spelling of AutoFill.

Source/WebKit2:

- Adds new SPI to respond to clicks on the AutoFill button (both bundle and UIProcess).
- Adds new SPI to enable/disable the display of the AutoFill button on an element.
- Adds new SPI to get the bounds of the AutoFill button.
- Updates spelling of AutoFill to be consistent.

* UIProcess/API/APIUIClient.h:
(API::UIClient::didClickAutoFillButton):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* UIProcess/API/C/WKPageUIClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleAutoFillButtonClick):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
(API::InjectedBundle::PageUIClient::didClickAutoFillButton):
* WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
(WebKit::InjectedBundlePageUIClient::didClickAutoFillButton):
* WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::handleAutoFillButtonClick):
* WebProcess/WebCoreSupport/WebChromeClient.h:
* WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h:
Pipe the didClickAutoFillButton to the SPI layer.

* WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
(-[WKWebProcessPlugInNodeHandle HTMLInputElementIsAutoFilled]):
(-[WKWebProcessPlugInNodeHandle setHTMLInputElementIsAutoFilled:]):
Update for new spelling of AutoFill.

* WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
* WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
(WKBundleNodeHandleGetHTMLInputElementAutoFilled):
(WKBundleNodeHandleSetHTMLInputElementAutoFilled):
Added. Replaces WKBundleNodeHandleGetHTMLInputElementAutofilled/WKBundleNodeHandleSetHTMLInputElementAutofilled
which are now deprecated due to inconsistent spelling of AutoFill.

(WKBundleNodeHandleGetHTMLInputElementAutoFillButtonEnabled):
(WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabled):
(WKBundleNodeHandleGetHTMLInputElementAutoFillButtonBounds):
Added.

(WKBundleNodeHandleGetHTMLInputElementAutofilled):
(WKBundleNodeHandleSetHTMLInputElementAutofilled):
Deprecated.

* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
(WebKit::InjectedBundleNodeHandle::getOrCreate):
(WebKit::InjectedBundleNodeHandle::create):
(WebKit::InjectedBundleNodeHandle::InjectedBundleNodeHandle):
(WebKit::InjectedBundleNodeHandle::~InjectedBundleNodeHandle):
(WebKit::InjectedBundleNodeHandle::coreNode):
(WebKit::InjectedBundleNodeHandle::document):
(WebKit::InjectedBundleNodeHandle::elementBounds):
(WebKit::InjectedBundleNodeHandle::renderRect):
(WebKit::InjectedBundleNodeHandle::renderedImage):
(WebKit::InjectedBundleNodeHandle::visibleRange):
(WebKit::InjectedBundleNodeHandle::setHTMLInputElementValueForUser):
(WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutoFilled):
(WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutoFilled):
(WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutoFillButtonEnabled):
(WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutoFillButtonEnabled):
(WebKit::InjectedBundleNodeHandle::htmlInputElementAutoFillButtonBounds):
(WebKit::InjectedBundleNodeHandle::htmlInputElementLastChangeWasUserEdit):
(WebKit::InjectedBundleNodeHandle::htmlTextAreaElementLastChangeWasUserEdit):
(WebKit::InjectedBundleNodeHandle::isTextField):
(WebKit::InjectedBundleNodeHandle::htmlTableCellElementCellAbove):
(WebKit::InjectedBundleNodeHandle::documentFrame):
(WebKit::InjectedBundleNodeHandle::htmlFrameElementContentFrame):
(WebKit::InjectedBundleNodeHandle::htmlIFrameElementContentFrame):
(WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutofilled): Deleted.
(WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutofilled): Deleted.
* WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
Fix-up InjectedBundleNodeHandle to store its underlying Node in a Ref, rather than a RefPtr.
Add helpers to implement the new SPI for WKBundleNodeHandleRef.

Tools:

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::createOtherPage):
(WTR::TestController::createWebViewWithOptions):
Update for new callback.

LayoutTests:

* fast/forms/input-auto-fill-button-expected.txt: Added.
* fast/forms/input-auto-fill-button.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (181407 => 181408)


--- trunk/LayoutTests/ChangeLog	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/LayoutTests/ChangeLog	2015-03-11 22:01:01 UTC (rev 181408)
@@ -1,3 +1,14 @@
+2015-03-10  Sam Weinig  <s...@webkit.org>
+
+        Allow adding a button in input elements for auto fill related functionality
+        <rdar://problem/19782066>
+        https://bugs.webkit.org/show_bug.cgi?id=142564
+
+        Reviewed by Anders Carlsson.
+
+        * fast/forms/input-auto-fill-button-expected.txt: Added.
+        * fast/forms/input-auto-fill-button.html: Added.
+
 2015-03-11  Ryosuke Niwa  <rn...@webkit.org>
 
         Calling super() in a base class results in a crash

Added: trunk/LayoutTests/fast/forms/input-auto-fill-button-expected.txt (0 => 181408)


--- trunk/LayoutTests/fast/forms/input-auto-fill-button-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/input-auto-fill-button-expected.txt	2015-03-11 22:01:01 UTC (rev 181408)
@@ -0,0 +1,41 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 503x18
+          text run at (0,0) width 503: "This tests that the AutoFill button renders. It can only be tested in the test tool."
+      RenderBlock {DIV} at (0,34) size 784x23
+        RenderTextControl {INPUT} at (2,2) size 137x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (3,3) size 131x13
+            RenderBlock {DIV} at (0,0) size 115x13
+        RenderText {#text} at (140,2) size 5x18
+          text run at (140,2) width 5: " "
+        RenderTextControl {INPUT} at (146,2) size 137x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (3,3) size 131x13
+            RenderBlock {DIV} at (0,0) size 115x13
+        RenderText {#text} at (284,2) size 5x18
+          text run at (284,2) width 5: " "
+        RenderTextControl {INPUT} at (290,2) size 138x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (3,3) size 131x13
+            RenderBlock {DIV} at (0,0) size 115x13
+        RenderTextControl {INPUT} at (431,2) size 137x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (3,3) size 131x13
+            RenderBlock {DIV} at (0,0) size 115x13
+layer at (13,47) size 114x13
+  RenderBlock {DIV} at (0,0) size 115x13
+layer at (157,47) size 114x13
+  RenderBlock {DIV} at (0,0) size 115x13
+layer at (302,47) size 114x13
+  RenderBlock {DIV} at (0,0) size 115x13
+layer at (442,47) size 114x13
+  RenderBlock {DIV} at (0,0) size 115x13
+layer at (127,47) size 16x13
+  RenderImage {DIV} at (114,0) size 17x13
+layer at (272,47) size 16x13
+  RenderImage {DIV} at (114,0) size 17x13
+layer at (416,47) size 16x13
+  RenderImage {DIV} at (114,0) size 17x13
+layer at (556,47) size 16x13
+  RenderImage {DIV} at (114,0) size 17x13

Added: trunk/LayoutTests/fast/forms/input-auto-fill-button.html (0 => 181408)


--- trunk/LayoutTests/fast/forms/input-auto-fill-button.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/input-auto-fill-button.html	2015-03-11 22:01:01 UTC (rev 181408)
@@ -0,0 +1,22 @@
+<p>This tests that the AutoFill button renders. It can only be tested in the test tool.</p>
+<div id='container'>
+    <input type='text'>
+    <input type='password'>
+</div>
+<script>
+
+if (window.internals) {
+    var inputs = document.querySelectorAll("input");
+    for (var i = 0; i < inputs.length; ++i)
+        window.internals.setShowAutoFillButton(inputs[i], true);
+
+    var dynamicInput = document.createElement("input");
+    window.internals.setShowAutoFillButton(dynamicInput, true);
+    document.querySelector("#container").appendChild(dynamicInput);
+
+    var dynamicInput2 = document.createElement("input");
+    window.internals.setShowAutoFillButton(dynamicInput2, true);
+    document.querySelector("#container").appendChild(dynamicInput2);
+    dynamicInput2.setAttribute("type", "password");
+}
+</script>

Added: trunk/LayoutTests/platform/mac-mavericks/fast/forms/input-auto-fill-button.txt (0 => 181408)


--- trunk/LayoutTests/platform/mac-mavericks/fast/forms/input-auto-fill-button.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-mavericks/fast/forms/input-auto-fill-button.txt	2015-03-11 22:01:01 UTC (rev 181408)
@@ -0,0 +1,41 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {P} at (0,0) size 784x18
+        RenderText {#text} at (0,0) size 503x18
+          text run at (0,0) width 503: "This tests that the AutoFill button renders. It can only be tested in the test tool."
+      RenderBlock {DIV} at (0,34) size 784x23
+        RenderTextControl {INPUT} at (2,2) size 146x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (3,3) size 140x13
+            RenderBlock {DIV} at (0,0) size 124x13
+        RenderText {#text} at (149,2) size 5x18
+          text run at (149,2) width 5: " "
+        RenderTextControl {INPUT} at (155,2) size 146x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (3,3) size 140x13
+            RenderBlock {DIV} at (0,0) size 124x13
+        RenderText {#text} at (302,2) size 5x18
+          text run at (302,2) width 5: " "
+        RenderTextControl {INPUT} at (308,2) size 146x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (3,3) size 140x13
+            RenderBlock {DIV} at (0,0) size 124x13
+        RenderTextControl {INPUT} at (457,2) size 146x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (3,3) size 140x13
+            RenderBlock {DIV} at (0,0) size 124x13
+layer at (13,47) size 123x13
+  RenderBlock {DIV} at (0,0) size 124x13
+layer at (166,47) size 123x13
+  RenderBlock {DIV} at (0,0) size 124x13
+layer at (319,47) size 123x13
+  RenderBlock {DIV} at (0,0) size 124x13
+layer at (468,47) size 123x13
+  RenderBlock {DIV} at (0,0) size 124x13
+layer at (136,47) size 16x13
+  RenderImage {DIV} at (123,0) size 17x13
+layer at (289,47) size 16x13
+  RenderImage {DIV} at (123,0) size 17x13
+layer at (442,47) size 16x13
+  RenderImage {DIV} at (123,0) size 17x13
+layer at (592,47) size 16x13
+  RenderImage {DIV} at (123,0) size 17x13

Modified: trunk/Source/WebCore/CMakeLists.txt (181407 => 181408)


--- trunk/Source/WebCore/CMakeLists.txt	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/CMakeLists.txt	2015-03-11 22:01:01 UTC (rev 181408)
@@ -1746,6 +1746,7 @@
     html/parser/XSSAuditor.cpp
     html/parser/XSSAuditorDelegate.cpp
 
+    html/shadow/AutoFillButtonElement.cpp
     html/shadow/ContentDistributor.cpp
     html/shadow/DetailsMarkerControl.cpp
     html/shadow/InsertionPoint.cpp

Modified: trunk/Source/WebCore/ChangeLog (181407 => 181408)


--- trunk/Source/WebCore/ChangeLog	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/ChangeLog	2015-03-11 22:01:01 UTC (rev 181408)
@@ -1,3 +1,96 @@
+2015-03-10  Sam Weinig  <s...@webkit.org>
+
+        Allow adding a button in input elements for auto fill related functionality
+        <rdar://problem/19782066>
+        https://bugs.webkit.org/show_bug.cgi?id=142564
+
+        Reviewed by Anders Carlsson.
+
+        Test: fast/forms/input-auto-fill-button.html
+
+        - Adds a new button that can be shown in <input> elements - AutoFillButtonElement.
+        - Makes the spelling of AutoFill consistent throughout WebCore and WebKit (except
+          where not feasible due to exported API/SPI).
+
+        * CMakeLists.txt:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        Add new files.
+
+        * css/html.css:
+        (input::-webkit-auto-fill-button):
+        (input::-webkit-auto-fill-button:hover):
+        (input::-webkit-auto-fill-button:active):
+        Add default style rules for the AutoFill button based on the ones
+        used for caps lock indicator.
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::HTMLInputElement):
+        (WebCore::HTMLInputElement::autoFillButtonElement):
+        (WebCore::HTMLInputElement::reset):
+        (WebCore::HTMLInputElement::setValueFromRenderer):
+        (WebCore::HTMLInputElement::setAutoFilled):
+        (WebCore::HTMLInputElement::setShowAutoFillButton):
+        (WebCore::HTMLInputElement::setAutofilled): Deleted.
+        * html/HTMLInputElement.h:
+        (WebCore::HTMLInputElement::isAutoFilled):
+        (WebCore::HTMLInputElement::showAutoFillButton):
+        (WebCore::HTMLInputElement::isAutofilled): Deleted.
+        Add new bit to represent whether the AutoFill button should be shown
+        or not. By default it is not shown, and the client must enable it.
+
+        * html/InputType.cpp:
+        (WebCore::InputType::updateAutoFillButton):
+        * html/InputType.h:
+        (WebCore::InputType::autoFillButtonElement):
+        Add new virtual methods for updating and accessing the AutoFill button.
+
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::createShadowSubtree):
+        (WebCore::TextFieldInputType::autoFillButtonElement):
+        (WebCore::TextFieldInputType::destroyShadowSubtree):
+        (WebCore::TextFieldInputType::updatePlaceholderText):
+        (WebCore::TextFieldInputType::shouldDrawAutoFillButton):
+        (WebCore::TextFieldInputType::autoFillButtonElementWasClicked):
+        (WebCore::TextFieldInputType::createContainer):
+        (WebCore::TextFieldInputType::createAutoFillButton):
+        (WebCore::TextFieldInputType::updateAutoFillButton):
+        * html/TextFieldInputType.h:
+        Add support for adding the AutoFill to the shadow DOM of textfields. The implementation
+        is slightly different than for the caps lock indicator, because I didn't want to force
+        the creation of a container for all <input> elements just in case an AutoFill button was
+        added. Instead, if an AutoFill button is added, the container is created on the fly and
+        the existing DOM is updated to move into it. Once a container is created, it is never
+        removed.
+
+        * html/shadow/AutoFillButtonElement.cpp: Added.
+        (WebCore::AutoFillButtonElement::create):
+        (WebCore::AutoFillButtonElement::AutoFillButtonElement):
+        (WebCore::AutoFillButtonElement::defaultEventHandler):
+        * html/shadow/AutoFillButtonElement.h: Added.
+        Add div subclass that swallows the click event and forwards it to the ChromeClient.
+
+        * page/ChromeClient.h:
+        Add handleAutoFillButtonClick client function to inform WebKit that the AutoFill
+        button was clicked.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::setAutofilled):
+        (WebCore::Internals::setShowAutoFillButton):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+        Expose a new internals.setShowAutoFillButton() function to allow testing
+        of the AutoFill button from layout tests.
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::isValueAutofilled):
+        * css/SelectorCheckerTestFunctions.h:
+        (WebCore::isAutofilled):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::canShareStyleWithControl):
+        Update for new spelling of AutoFill.
+
 2015-03-11  Geoffrey Garen  <gga...@apple.com>
 
         Refactored the JSC::Heap extra cost API for clarity and to make some known bugs more obvious

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (181407 => 181408)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-03-11 22:01:01 UTC (rev 181408)
@@ -16208,6 +16208,7 @@
     <ClCompile Include="..\html\parser\TextDocumentParser.cpp" />
     <ClCompile Include="..\html\parser\XSSAuditor.cpp" />
     <ClCompile Include="..\html\parser\XSSAuditorDelegate.cpp" />
+    <ClCompile Include="..\html\shadow\AutoFillButtonElement.cpp" />
     <ClCompile Include="..\html\shadow\ContentDistributor.cpp" />
     <ClCompile Include="..\html\shadow\DetailsMarkerControl.cpp" />
     <ClCompile Include="..\html\shadow\InsertionPoint.cpp" />
@@ -20970,6 +20971,7 @@
     <ClInclude Include="..\html\parser\TextDocumentParser.h" />
     <ClInclude Include="..\html\parser\XSSAuditor.h" />
     <ClInclude Include="..\html\parser\XSSAuditorDelegate.h" />
+    <ClInclude Include="..\html\shadow\AutoFillButtonElement.h" />
     <ClInclude Include="..\html\shadow\ContentDistributor.h" />
     <ClInclude Include="..\html\shadow\DetailsMarkerControl.h" />
     <ClInclude Include="..\html\shadow\InsertionPoint.h" />

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (181407 => 181408)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2015-03-11 22:01:01 UTC (rev 181408)
@@ -4110,6 +4110,9 @@
     <ClCompile Include="..\html\parser\XSSAuditorDelegate.cpp">
       <Filter>html\parser</Filter>
     </ClCompile>
+    <ClCompile Include="..\html\shadow\AutoFillButtonElement.cpp">
+      <Filter>html\shadow</Filter>
+    </ClCompile>
     <ClCompile Include="..\html\shadow\ContentDistributor.cpp">
       <Filter>html\shadow</Filter>
     </ClCompile>
@@ -11274,6 +11277,9 @@
     <ClInclude Include="..\html\parser\XSSAuditorDelegate.h">
       <Filter>html\parser</Filter>
     </ClInclude>
+    <ClInclude Include="..\html\shadow\AutoFillButtonElement.h">
+      <Filter>html\shadow</Filter>
+    </ClInclude>
     <ClInclude Include="..\html\shadow\ContentDistributor.h">
       <Filter>html\shadow</Filter>
     </ClInclude>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (181407 => 181408)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-03-11 22:01:01 UTC (rev 181408)
@@ -2473,6 +2473,8 @@
 		7AF9B20E18CFB5F400C64BEF /* JSVTTRegionList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AF9B20A18CFB5F300C64BEF /* JSVTTRegionList.cpp */; };
 		7AF9B20F18CFB5F400C64BEF /* JSVTTRegionList.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AF9B20B18CFB5F300C64BEF /* JSVTTRegionList.h */; };
 		7BE7427381FA906FBB4F0F2C /* JSSVGGraphicsElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 950C4C02BED8936F818E2F99 /* JSSVGGraphicsElement.h */; };
+		7C1E97271A9F9834007BF0FB /* AutoFillButtonElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C1E97251A9F9834007BF0FB /* AutoFillButtonElement.cpp */; };
+		7C1E97281A9F9834007BF0FB /* AutoFillButtonElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C1E97261A9F9834007BF0FB /* AutoFillButtonElement.h */; };
 		7C2BDD3D17C7F98C0038FF15 /* JSDOMGlobalObjectTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C2BDD3B17C7F98B0038FF15 /* JSDOMGlobalObjectTask.cpp */; };
 		7C2BDD3E17C7F98C0038FF15 /* JSDOMGlobalObjectTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C2BDD3C17C7F98B0038FF15 /* JSDOMGlobalObjectTask.h */; };
 		7C3B79711908757B00B47A2D /* UserMessageHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3B796F1908757B00B47A2D /* UserMessageHandler.cpp */; };
@@ -9693,6 +9695,8 @@
 		7AF9B20918CFB5F200C64BEF /* JSVTTRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVTTRegion.h; sourceTree = "<group>"; };
 		7AF9B20A18CFB5F300C64BEF /* JSVTTRegionList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSVTTRegionList.cpp; sourceTree = "<group>"; };
 		7AF9B20B18CFB5F300C64BEF /* JSVTTRegionList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVTTRegionList.h; sourceTree = "<group>"; };
+		7C1E97251A9F9834007BF0FB /* AutoFillButtonElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutoFillButtonElement.cpp; sourceTree = "<group>"; };
+		7C1E97261A9F9834007BF0FB /* AutoFillButtonElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoFillButtonElement.h; sourceTree = "<group>"; };
 		7C2BDD3B17C7F98B0038FF15 /* JSDOMGlobalObjectTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMGlobalObjectTask.cpp; sourceTree = "<group>"; };
 		7C2BDD3C17C7F98B0038FF15 /* JSDOMGlobalObjectTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMGlobalObjectTask.h; sourceTree = "<group>"; };
 		7C3B796F1908757B00B47A2D /* UserMessageHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMessageHandler.cpp; sourceTree = "<group>"; };
@@ -15684,6 +15688,8 @@
 			isa = PBXGroup;
 			children = (
 				51C4AA5118B28357007BFE9B /* mac */,
+				7C1E97251A9F9834007BF0FB /* AutoFillButtonElement.cpp */,
+				7C1E97261A9F9834007BF0FB /* AutoFillButtonElement.h */,
 				57B7919F14C6A62900F202D1 /* ContentDistributor.cpp */,
 				57B791A014C6A62900F202D1 /* ContentDistributor.h */,
 				A7C9ABF61357A3BF00F5503F /* DetailsMarkerControl.cpp */,
@@ -26190,6 +26196,7 @@
 				931CBD0D161A44E900E4C874 /* ScrollingStateNode.h in Headers */,
 				0FEA3E84191B31BF000F1B55 /* ScrollingStateOverflowScrollingNode.h in Headers */,
 				931CBD0F161A44E900E4C874 /* ScrollingStateScrollingNode.h in Headers */,
+				7C1E97281A9F9834007BF0FB /* AutoFillButtonElement.h in Headers */,
 				0FB8890F167D30160010CDA5 /* ScrollingStateStickyNode.h in Headers */,
 				931CBD11161A44E900E4C874 /* ScrollingStateTree.h in Headers */,
 				1AF62F2614DAFEA10041556C /* ScrollingThread.h in Headers */,
@@ -27800,6 +27807,7 @@
 				85BA4D0C0AA688680088052D /* DOMHTMLDirectoryElement.mm in Sources */,
 				85BA4D0E0AA688680088052D /* DOMHTMLDivElement.mm in Sources */,
 				85BA4D100AA688680088052D /* DOMHTMLDListElement.mm in Sources */,
+				7C1E97271A9F9834007BF0FB /* AutoFillButtonElement.cpp in Sources */,
 				85BCBC140ABBA87D00381160 /* DOMHTMLDocument.mm in Sources */,
 				85DF2EEE0AA387CB00AD64C5 /* DOMHTMLElement.mm in Sources */,
 				85C050BB0AD84F5E005532E7 /* DOMHTMLEmbedElement.mm in Sources */,

Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (181407 => 181408)


--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp	2015-03-11 22:01:01 UTC (rev 181408)
@@ -2028,7 +2028,7 @@
     if (!node || !is<HTMLInputElement>(*node))
         return false;
     
-    return downcast<HTMLInputElement>(*node).isAutofilled();
+    return downcast<HTMLInputElement>(*node).isAutoFilled();
 }
 
 const AtomicString& AccessibilityObject::placeholderValue() const

Modified: trunk/Source/WebCore/bindings/objc/DOMHTML.mm (181407 => 181408)


--- trunk/Source/WebCore/bindings/objc/DOMHTML.mm	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/bindings/objc/DOMHTML.mm	2015-03-11 22:01:01 UTC (rev 181408)
@@ -182,7 +182,7 @@
 #if PLATFORM(IOS)
 - (BOOL)_isAutofilled
 {
-    return core(self)->isAutofilled();
+    return core(self)->isAutoFilled();
 }
 
 - (void)_setAutofilled:(BOOL)filled
@@ -190,7 +190,7 @@
     // This notifies the input element that the content has been autofilled
     // This allows WebKit to obey the -webkit-autofill pseudo style, which
     // changes the background color.
-    core(self)->setAutofilled(filled);
+    core(self)->setAutoFilled(filled);
 }
 #endif // PLATFORM(IOS)
 

Modified: trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h (181407 => 181408)


--- trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h	2015-03-11 22:01:01 UTC (rev 181408)
@@ -45,7 +45,7 @@
 {
     if (is<HTMLFormControlElement>(*element)) {
         if (const HTMLInputElement* inputElement = element->toInputElement())
-            return inputElement->isAutofilled();
+            return inputElement->isAutoFilled();
     }
     return false;
 }

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (181407 => 181408)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2015-03-11 22:01:01 UTC (rev 181408)
@@ -506,7 +506,7 @@
     if (!thisInputElement || !otherInputElement)
         return false;
 
-    if (thisInputElement->isAutofilled() != otherInputElement->isAutofilled())
+    if (thisInputElement->isAutoFilled() != otherInputElement->isAutoFilled())
         return false;
     if (thisInputElement->shouldAppearChecked() != otherInputElement->shouldAppearChecked())
         return false;

Modified: trunk/Source/WebCore/css/html.css (181407 => 181408)


--- trunk/Source/WebCore/css/html.css	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/css/html.css	2015-03-11 22:01:01 UTC (rev 181408)
@@ -544,6 +544,22 @@
     -webkit-user-select: none;
 }
 
+input::-webkit-auto-fill-button {
+    content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="black" d="M12,0H4C1.8,0,0,1.8,0,4v8c0,2.2,1.8,4,4,4h8c2.2,0,4-1.8,4-4V4C16,1.8,14.2,0,12,0z M9.6,7.1l0,1.2l-1,1L9.4,10l-0.7,0.7 l0.7,0.7l-0.7,0.7l0.7,0.7l-1.2,1.2c-0.2,0.2-0.3,0.2-0.5,0l-1-1l0-6C5.7,6.6,5.1,5.6,5.1,4.5c0-1.6,1.3-3,3-3c1.7,0,3,1.3,3,3 C11.1,5.6,10.5,6.6,9.6,7.1z"/><circle fill="black" cx="8.1" cy="3.6" r="1"/></svg>');
+    align-self:stretch;
+    opacity: .4;
+    -webkit-flex: none;
+    -webkit-user-select: none;
+}
+
+input::-webkit-auto-fill-button:hover {
+    opacity: .85;
+}
+
+input::-webkit-auto-fill-button:active {
+    opacity: 1;
+}
+
 input::-webkit-caps-lock-indicator {
     -webkit-appearance: caps-lock-indicator;
     content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="17" height="17"><path fill="black" fill-opacity="0.4" d="M12.5 0.5A 4 4 0 0 1 16.5 4.5L 16.5 12.5A 4 4 0 0 1 12.5 16.5L 4.5 16.5A 4 4 0 0 1 0.5 12.5L 0.5 4.5A 4 4 0 0 1 4.5 0.5L 12.5 0.5M 8.5 2L 4 7L 6.25 7L 6.25 10.25L 10.75 10.25L 10.75 7L 13 7L 8.5 2M 10.75 12L 6.25 12L 6.25 14.25L 10.75 14.25L 10.75 12"/></svg>');

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (181407 => 181408)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2015-03-11 22:01:01 UTC (rev 181408)
@@ -109,7 +109,8 @@
     , m_hasType(false)
     , m_isActivatedSubmit(false)
     , m_autocomplete(Uninitialized)
-    , m_isAutofilled(false)
+    , m_isAutoFilled(false)
+    , m_showAutoFillButton(false)
 #if ENABLE(DATALIST_ELEMENT)
     , m_hasNonEmptyList(false)
 #endif
@@ -204,6 +205,11 @@
     return m_inputType->capsLockIndicatorElement();
 }
 
+HTMLElement* HTMLInputElement::autoFillButtonElement() const
+{
+    return m_inputType->autoFillButtonElement();
+}
+
 HTMLElement* HTMLInputElement::resultsButtonElement() const
 {
     return m_inputType->resultsButtonElement();
@@ -835,7 +841,7 @@
     if (m_inputType->storesValueSeparateFromAttribute())
         setValue(String());
 
-    setAutofilled(false);
+    setAutoFilled(false);
     setChecked(fastHasAttribute(checkedAttr));
     m_reflectsCheckedAttribute = true;
 }
@@ -1056,8 +1062,8 @@
 
     updateValidity();
 
-    // Clear autofill flag (and yellow background) on user edit.
-    setAutofilled(false);
+    // Clear auto fill flag (and yellow background) on user edit.
+    setAutoFilled(false);
 }
 
 void HTMLInputElement::willDispatchEvent(Event& event, InputElementClickState& state)
@@ -1289,15 +1295,24 @@
     return document().completeURL(fastGetAttribute(srcAttr));
 }
 
-void HTMLInputElement::setAutofilled(bool autofilled)
+void HTMLInputElement::setAutoFilled(bool autoFilled)
 {
-    if (autofilled == m_isAutofilled)
+    if (autoFilled == m_isAutoFilled)
         return;
 
-    m_isAutofilled = autofilled;
+    m_isAutoFilled = autoFilled;
     setNeedsStyleRecalc();
 }
 
+void HTMLInputElement::setShowAutoFillButton(bool showAutoFillButton)
+{
+    if (showAutoFillButton == m_showAutoFillButton)
+        return;
+
+    m_showAutoFillButton = showAutoFillButton;
+    m_inputType->updateAutoFillButton();
+}
+
 FileList* HTMLInputElement::files()
 {
     return m_inputType->files();

Modified: trunk/Source/WebCore/html/HTMLInputElement.h (181407 => 181408)


--- trunk/Source/WebCore/html/HTMLInputElement.h	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/html/HTMLInputElement.h	2015-03-11 22:01:01 UTC (rev 181408)
@@ -151,6 +151,7 @@
     HTMLElement* sliderThumbElement() const;
     HTMLElement* sliderTrackElement() const;
     virtual HTMLElement* placeholderElement() const override final;
+    WEBCORE_EXPORT HTMLElement* autoFillButtonElement() const;
 
     bool checked() const { return m_isChecked; }
     void setChecked(bool, TextFieldEventBehavior = DispatchNoEvent);
@@ -235,9 +236,12 @@
 
     bool multiple() const;
 
-    bool isAutofilled() const { return m_isAutofilled; }
-    WEBCORE_EXPORT void setAutofilled(bool = true);
+    bool isAutoFilled() const { return m_isAutoFilled; }
+    WEBCORE_EXPORT void setAutoFilled(bool = true);
 
+    bool showAutoFillButton() const { return m_showAutoFillButton; }
+    WEBCORE_EXPORT void setShowAutoFillButton(bool);
+
     FileList* files();
     void setFiles(PassRefPtr<FileList>);
 
@@ -428,7 +432,8 @@
     bool m_hasType : 1;
     bool m_isActivatedSubmit : 1;
     unsigned m_autocomplete : 2; // AutoCompleteSetting
-    bool m_isAutofilled : 1;
+    bool m_isAutoFilled : 1;
+    bool m_showAutoFillButton : 1;
 #if ENABLE(DATALIST_ELEMENT)
     bool m_hasNonEmptyList : 1;
 #endif

Modified: trunk/Source/WebCore/html/InputType.cpp (181407 => 181408)


--- trunk/Source/WebCore/html/InputType.cpp	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/html/InputType.cpp	2015-03-11 22:01:01 UTC (rev 181408)
@@ -489,10 +489,6 @@
     element().defaultBlur();
 }
 
-void InputType::capsLockStateMayHaveChanged()
-{
-}
-
 void InputType::createShadowSubtree()
 {
 }
@@ -928,6 +924,14 @@
 {
 }
 
+void InputType::capsLockStateMayHaveChanged()
+{
+}
+
+void InputType::updateAutoFillButton()
+{
+}
+
 void InputType::subtreeHasChanged()
 {
     ASSERT_NOT_REACHED();

Modified: trunk/Source/WebCore/html/InputType.h (181407 => 181408)


--- trunk/Source/WebCore/html/InputType.h	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/html/InputType.h	2015-03-11 22:01:01 UTC (rev 181408)
@@ -215,8 +215,6 @@
 
     virtual void blur();
 
-    virtual void capsLockStateMayHaveChanged();
-
     // Shadow tree handling
 
     virtual void createShadowSubtree();
@@ -227,6 +225,7 @@
     virtual TextControlInnerTextElement* innerTextElement() const { return nullptr; }
     virtual HTMLElement* innerSpinButtonElement() const { return nullptr; }
     virtual HTMLElement* capsLockIndicatorElement() const { return nullptr; }
+    virtual HTMLElement* autoFillButtonElement() const { return nullptr; }
     virtual HTMLElement* resultsButtonElement() const { return nullptr; }
     virtual HTMLElement* cancelButtonElement() const { return nullptr; }
     virtual HTMLElement* sliderThumbElement() const { return nullptr; }
@@ -275,6 +274,8 @@
     virtual void disabledAttributeChanged();
     virtual void readonlyAttributeChanged();
     virtual void requiredAttributeChanged();
+    virtual void capsLockStateMayHaveChanged();
+    virtual void updateAutoFillButton();
     virtual String defaultToolTip() const;
 
 #if ENABLE(DATALIST_ELEMENT)

Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (181407 => 181408)


--- trunk/Source/WebCore/html/TextFieldInputType.cpp	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp	2015-03-11 22:01:01 UTC (rev 181408)
@@ -34,6 +34,7 @@
 
 #include "BeforeTextInsertedEvent.h"
 #include "Chrome.h"
+#include "ChromeClient.h"
 #include "Editor.h"
 #include "FormDataList.h"
 #include "Frame.h"
@@ -255,6 +256,8 @@
     ASSERT(!m_innerText);
     ASSERT(!m_innerBlock);
     ASSERT(!m_innerSpinButton);
+    ASSERT(!m_capsLockIndicator);
+    ASSERT(!m_autoFillButton);
 
     Document& document = element().document();
     bool shouldHaveSpinButton = this->shouldHaveSpinButton();
@@ -262,21 +265,14 @@
     bool createsContainer = shouldHaveSpinButton || shouldHaveCapsLockIndicator || needsContainer();
 
     m_innerText = TextControlInnerTextElement::create(document);
+
     if (!createsContainer) {
         element().userAgentShadowRoot()->appendChild(m_innerText, IGNORE_EXCEPTION);
         updatePlaceholderText();
         return;
     }
 
-    ShadowRoot* shadowRoot = element().userAgentShadowRoot();
-    m_container = TextControlInnerContainer::create(document);
-    m_container->setPseudo(AtomicString("-webkit-textfield-decoration-container", AtomicString::ConstructFromLiteral));
-    shadowRoot->appendChild(m_container, IGNORE_EXCEPTION);
-
-    m_innerBlock = TextControlInnerElement::create(document);
-    m_innerBlock->appendChild(m_innerText, IGNORE_EXCEPTION);
-    m_container->appendChild(m_innerBlock, IGNORE_EXCEPTION);
-
+    createContainer();
     updatePlaceholderText();
 
     if (shouldHaveSpinButton) {
@@ -293,6 +289,8 @@
 
         m_container->appendChild(m_capsLockIndicator, IGNORE_EXCEPTION);
     }
+
+    updateAutoFillButton();
 }
 
 HTMLElement* TextFieldInputType::containerElement() const
@@ -321,6 +319,11 @@
     return m_capsLockIndicator.get();
 }
 
+HTMLElement* TextFieldInputType::autoFillButtonElement() const
+{
+    return m_autoFillButton.get();
+}
+
 HTMLElement* TextFieldInputType::placeholderElement() const
 {
     return m_placeholder.get();
@@ -336,6 +339,7 @@
         m_innerSpinButton->removeSpinButtonOwner();
     m_innerSpinButton = nullptr;
     m_capsLockIndicator = nullptr;
+    m_autoFillButton = nullptr;
     m_container = nullptr;
 }
 
@@ -456,6 +460,7 @@
         m_placeholder->setPseudo(AtomicString("-webkit-input-placeholder", AtomicString::ConstructFromLiteral));
         m_placeholder->setInlineStyleProperty(CSSPropertyDisplay, element().isPlaceholderVisible() ? CSSValueBlock : CSSValueNone, true);
         element().userAgentShadowRoot()->insertBefore(m_placeholder, m_container ? m_container.get() : innerTextElement(), ASSERT_NO_EXCEPTION);
+        
     }
     m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION);
 }
@@ -563,4 +568,58 @@
     m_capsLockIndicator->setInlineStyleProperty(CSSPropertyDisplay, shouldDrawCapsLockIndicator ? CSSValueBlock : CSSValueNone, true);
 }
 
+bool TextFieldInputType::shouldDrawAutoFillButton() const
+{
+    return element().showAutoFillButton();
+}
+
+void TextFieldInputType::autoFillButtonElementWasClicked()
+{
+    Page* page = element().document().page();
+    if (!page)
+        return;
+
+    page->chrome().client().handleAutoFillButtonClick(element());
+}
+
+void TextFieldInputType::createContainer()
+{
+    ASSERT(!m_container);
+
+    m_container = TextControlInnerContainer::create(element().document());
+    m_container->setPseudo(AtomicString("-webkit-textfield-decoration-container", AtomicString::ConstructFromLiteral));
+
+    m_innerBlock = TextControlInnerElement::create(element().document());
+    m_innerBlock->appendChild(m_innerText, IGNORE_EXCEPTION);
+    m_container->appendChild(m_innerBlock, IGNORE_EXCEPTION);
+
+    element().userAgentShadowRoot()->appendChild(m_container, IGNORE_EXCEPTION);
+}
+
+void TextFieldInputType::createAutoFillButton()
+{
+    ASSERT(!m_autoFillButton);
+
+    m_autoFillButton = AutoFillButtonElement::create(element().document(), *this);
+    m_autoFillButton->setPseudo(AtomicString("-webkit-auto-fill-button", AtomicString::ConstructFromLiteral));
+    m_container->appendChild(m_autoFillButton, IGNORE_EXCEPTION);
+}
+
+void TextFieldInputType::updateAutoFillButton()
+{
+    if (shouldDrawAutoFillButton()) {
+        if (!m_container)
+            createContainer();
+
+        if (!m_autoFillButton)
+            createAutoFillButton();
+
+        m_autoFillButton->setInlineStyleProperty(CSSPropertyDisplay, CSSValueBlock, true);
+        return;
+    }
+    
+    if (m_autoFillButton)
+        m_autoFillButton->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone, true);        
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/TextFieldInputType.h (181407 => 181408)


--- trunk/Source/WebCore/html/TextFieldInputType.h	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/html/TextFieldInputType.h	2015-03-11 22:01:01 UTC (rev 181408)
@@ -31,6 +31,7 @@
 #ifndef TextFieldInputType_h
 #define TextFieldInputType_h
 
+#include "AutoFillButtonElement.h"
 #include "InputType.h"
 #include "SpinButtonElement.h"
 
@@ -41,7 +42,7 @@
 
 // The class represents types of which UI contain text fields.
 // It supports not only the types for BaseTextInputType but also type=number.
-class TextFieldInputType : public InputType, protected SpinButtonElement::SpinButtonOwner {
+class TextFieldInputType : public InputType, protected SpinButtonElement::SpinButtonOwner, protected AutoFillButtonElement::AutoFillButtonOwner {
 protected:
     explicit TextFieldInputType(HTMLInputElement&);
     virtual ~TextFieldInputType();
@@ -53,6 +54,7 @@
     virtual TextControlInnerTextElement* innerTextElement() const override final;
     virtual HTMLElement* innerSpinButtonElement() const override final;
     virtual HTMLElement* capsLockIndicatorElement() const override final;
+    virtual HTMLElement* autoFillButtonElement() const override final;
 
 protected:
     virtual bool needsContainer() const;
@@ -96,6 +98,7 @@
     virtual bool appendFormData(FormDataList&, bool multipart) const override final;
     virtual void subtreeHasChanged() override final;
     virtual void capsLockStateMayHaveChanged() override final;
+    virtual void updateAutoFillButton() override final;
 
     // SpinButtonElement::SpinButtonOwner functions.
     virtual void focusAndSelectSpinButtonOwner() override final;
@@ -104,16 +107,24 @@
     virtual void spinButtonStepDown() override final;
     virtual void spinButtonStepUp() override final;
 
+    // AutoFillButtonElement::AutoFillButtonOwner
+    virtual void autoFillButtonElementWasClicked() override final;
+
     bool shouldHaveSpinButton() const;
     bool shouldHaveCapsLockIndicator() const;
     bool shouldDrawCapsLockIndicator() const;
+    bool shouldDrawAutoFillButton() const;
 
+    void createContainer();
+    void createAutoFillButton();
+
     RefPtr<HTMLElement> m_container;
     RefPtr<HTMLElement> m_innerBlock;
     RefPtr<TextControlInnerTextElement> m_innerText;
     RefPtr<HTMLElement> m_placeholder;
     RefPtr<SpinButtonElement> m_innerSpinButton;
     RefPtr<HTMLElement> m_capsLockIndicator;
+    RefPtr<HTMLElement> m_autoFillButton;
 };
 
 } // namespace WebCore

Added: trunk/Source/WebCore/html/shadow/AutoFillButtonElement.cpp (0 => 181408)


--- trunk/Source/WebCore/html/shadow/AutoFillButtonElement.cpp	                        (rev 0)
+++ trunk/Source/WebCore/html/shadow/AutoFillButtonElement.cpp	2015-03-11 22:01:01 UTC (rev 181408)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2015 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 "AutoFillButtonElement.h"
+
+#include "Event.h"
+#include "EventNames.h"
+#include "HTMLNames.h"
+#include "MouseEvent.h"
+#include "TextFieldInputType.h"
+
+namespace WebCore {
+
+using namespace HTMLNames;
+
+Ref<AutoFillButtonElement> AutoFillButtonElement::create(Document& document, AutoFillButtonOwner& owner)
+{
+    return adoptRef(*new AutoFillButtonElement(document, owner));
+}
+
+AutoFillButtonElement::AutoFillButtonElement(Document& document, AutoFillButtonOwner& owner)
+    : HTMLDivElement(divTag, document)
+    , m_owner(owner)
+{
+}
+
+void AutoFillButtonElement::defaultEventHandler(Event* event)
+{
+    if (!is<MouseEvent>(*event)) {
+        if (!event->defaultHandled())
+            HTMLDivElement::defaultEventHandler(event);
+        return;
+    }
+
+    MouseEvent& mouseEvent = downcast<MouseEvent>(*event);
+
+    if (mouseEvent.type() == eventNames().clickEvent) {
+        m_owner.autoFillButtonElementWasClicked();
+        event->setDefaultHandled();
+    }
+
+    if (!event->defaultHandled())
+        HTMLDivElement::defaultEventHandler(event);
+}
+
+} // namespace WebCore

Added: trunk/Source/WebCore/html/shadow/AutoFillButtonElement.h (0 => 181408)


--- trunk/Source/WebCore/html/shadow/AutoFillButtonElement.h	                        (rev 0)
+++ trunk/Source/WebCore/html/shadow/AutoFillButtonElement.h	2015-03-11 22:01:01 UTC (rev 181408)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015 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.
+ */
+
+#ifndef AutoFillButtonElement_h
+#define AutoFillButtonElement_h
+
+#include "HTMLDivElement.h"
+
+namespace WebCore {
+
+class TextFieldInputType;
+
+class AutoFillButtonElement final : public HTMLDivElement {
+public:
+    class AutoFillButtonOwner {
+    public:
+        virtual ~AutoFillButtonOwner() { }
+        virtual void autoFillButtonElementWasClicked() = 0;
+    };
+
+    static Ref<AutoFillButtonElement> create(Document&, AutoFillButtonOwner&);
+
+private:
+    explicit AutoFillButtonElement(Document&, AutoFillButtonOwner&);
+
+    virtual void defaultEventHandler(Event*) override;
+
+    AutoFillButtonOwner& m_owner;
+};
+
+} // namespace WebCore
+
+#endif // AutoFillButtonElement_h

Modified: trunk/Source/WebCore/page/ChromeClient.h (181407 => 181408)


--- trunk/Source/WebCore/page/ChromeClient.h	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/page/ChromeClient.h	2015-03-11 22:01:01 UTC (rev 181408)
@@ -445,6 +445,8 @@
 
     virtual bool shouldDispatchFakeMouseMoveEvents() const { return true; }
 
+    virtual void handleAutoFillButtonClick(HTMLInputElement&) { }
+
 protected:
     virtual ~ChromeClient() { }
 };

Modified: trunk/Source/WebCore/testing/Internals.cpp (181407 => 181408)


--- trunk/Source/WebCore/testing/Internals.cpp	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/testing/Internals.cpp	2015-03-11 22:01:01 UTC (rev 181408)
@@ -1036,9 +1036,20 @@
         ec = INVALID_ACCESS_ERR;
         return;
     }
-    inputElement->setAutofilled(enabled);
+    inputElement->setAutoFilled(enabled);
 }
 
+void Internals::setShowAutoFillButton(Element* element, bool show, ExceptionCode& ec)
+{
+    HTMLInputElement* inputElement = element->toInputElement();
+    if (!inputElement) {
+        ec = INVALID_ACCESS_ERR;
+        return;
+    }
+    inputElement->setShowAutoFillButton(show);
+}
+
+
 void Internals::scrollElementToRect(Element* element, long x, long y, long w, long h, ExceptionCode& ec)
 {
     if (!element || !element->document().view()) {

Modified: trunk/Source/WebCore/testing/Internals.h (181407 => 181408)


--- trunk/Source/WebCore/testing/Internals.h	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/testing/Internals.h	2015-03-11 22:01:01 UTC (rev 181408)
@@ -161,6 +161,7 @@
     bool elementShouldAutoComplete(Element* inputElement, ExceptionCode&);
     void setEditingValue(Element* inputElement, const String&, ExceptionCode&);
     void setAutofilled(Element*, bool enabled, ExceptionCode&);
+    void setShowAutoFillButton(Element*, bool enabled, ExceptionCode&);
     void scrollElementToRect(Element*, long x, long y, long w, long h, ExceptionCode&);
 
     void paintControlTints(ExceptionCode&);

Modified: trunk/Source/WebCore/testing/Internals.idl (181407 => 181408)


--- trunk/Source/WebCore/testing/Internals.idl	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebCore/testing/Internals.idl	2015-03-11 22:01:01 UTC (rev 181408)
@@ -116,6 +116,7 @@
     [RaisesException] boolean elementShouldAutoComplete(Element inputElement);
     [RaisesException] void setEditingValue(Element inputElement, DOMString value);
     [RaisesException] void setAutofilled(Element inputElement, boolean enabled);
+    [RaisesException] void setShowAutoFillButton(Element inputElement, boolean enabled);
     [RaisesException] unsigned long countMatchesForText(DOMString text, unsigned long findOptions, DOMString markMatches);
 
     [RaisesException] void paintControlTints();

Modified: trunk/Source/WebKit/mac/ChangeLog (181407 => 181408)


--- trunk/Source/WebKit/mac/ChangeLog	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit/mac/ChangeLog	2015-03-11 22:01:01 UTC (rev 181408)
@@ -1,3 +1,15 @@
+2015-03-10  Sam Weinig  <s...@webkit.org>
+
+        Allow adding a button in input elements for auto fill related functionality
+        <rdar://problem/19782066>
+        https://bugs.webkit.org/show_bug.cgi?id=142564
+
+        Reviewed by Anders Carlsson.
+
+        * DOM/WebDOMOperations.mm:
+        (-[DOMHTMLInputElement _setAutofilled:]):
+        Update for consistent spelling of AutoFill.
+
 2015-03-10  Timothy Horton  <timothy_hor...@apple.com>
 
         Fix the build

Modified: trunk/Source/WebKit/mac/DOM/WebDOMOperations.mm (181407 => 181408)


--- trunk/Source/WebKit/mac/DOM/WebDOMOperations.mm	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit/mac/DOM/WebDOMOperations.mm	2015-03-11 22:01:01 UTC (rev 181408)
@@ -214,7 +214,7 @@
 
 - (void)_setAutofilled:(BOOL)autofilled
 {
-    downcast<HTMLInputElement>(core((DOMElement *)self))->setAutofilled(autofilled);
+    downcast<HTMLInputElement>(core((DOMElement *)self))->setAutoFilled(autofilled);
 }
 
 @end

Modified: trunk/Source/WebKit/win/DOMHTMLClasses.cpp (181407 => 181408)


--- trunk/Source/WebKit/win/DOMHTMLClasses.cpp	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit/win/DOMHTMLClasses.cpp	2015-03-11 22:01:01 UTC (rev 181408)
@@ -1345,7 +1345,7 @@
 {
     ASSERT(is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
-    inputElement.setAutofilled(!!filled);
+    inputElement.setAutoFilled(!!filled);
     return S_OK;
 }
 
@@ -1354,7 +1354,7 @@
 {
     ASSERT(is<HTMLInputElement>(m_element));
     HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
-    *result = inputElement.isAutofilled() ? TRUE : FALSE;
+    *result = inputElement.isAutoFilled() ? TRUE : FALSE;
     return S_OK;
 }
 

Modified: trunk/Source/WebKit2/ChangeLog (181407 => 181408)


--- trunk/Source/WebKit2/ChangeLog	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/ChangeLog	2015-03-11 22:01:01 UTC (rev 181408)
@@ -1,3 +1,87 @@
+2015-03-10  Sam Weinig  <s...@webkit.org>
+
+        Allow adding a button in input elements for auto fill related functionality
+        <rdar://problem/19782066>
+        https://bugs.webkit.org/show_bug.cgi?id=142564
+
+        Reviewed by Anders Carlsson.
+
+        - Adds new SPI to respond to clicks on the AutoFill button (both bundle and UIProcess).
+        - Adds new SPI to enable/disable the display of the AutoFill button on an element.
+        - Adds new SPI to get the bounds of the AutoFill button.
+        - Updates spelling of AutoFill to be consistent.
+
+        * UIProcess/API/APIUIClient.h:
+        (API::UIClient::didClickAutoFillButton):
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageSetPageUIClient):
+        * UIProcess/API/C/WKPageUIClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::handleAutoFillButtonClick):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
+        (API::InjectedBundle::PageUIClient::didClickAutoFillButton):
+        * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
+        (WebKit::InjectedBundlePageUIClient::didClickAutoFillButton):
+        * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::handleAutoFillButtonClick):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        * WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h:
+        Pipe the didClickAutoFillButton to the SPI layer.
+
+        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
+        (-[WKWebProcessPlugInNodeHandle HTMLInputElementIsAutoFilled]):
+        (-[WKWebProcessPlugInNodeHandle setHTMLInputElementIsAutoFilled:]):
+        Update for new spelling of AutoFill.
+
+        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
+        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
+        (WKBundleNodeHandleGetHTMLInputElementAutoFilled):
+        (WKBundleNodeHandleSetHTMLInputElementAutoFilled):
+        Added. Replaces WKBundleNodeHandleGetHTMLInputElementAutofilled/WKBundleNodeHandleSetHTMLInputElementAutofilled
+        which are now deprecated due to inconsistent spelling of AutoFill.
+
+        (WKBundleNodeHandleGetHTMLInputElementAutoFillButtonEnabled):
+        (WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabled):
+        (WKBundleNodeHandleGetHTMLInputElementAutoFillButtonBounds):
+        Added.
+
+        (WKBundleNodeHandleGetHTMLInputElementAutofilled):
+        (WKBundleNodeHandleSetHTMLInputElementAutofilled):
+        Deprecated.
+
+        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
+        (WebKit::InjectedBundleNodeHandle::getOrCreate):
+        (WebKit::InjectedBundleNodeHandle::create):
+        (WebKit::InjectedBundleNodeHandle::InjectedBundleNodeHandle):
+        (WebKit::InjectedBundleNodeHandle::~InjectedBundleNodeHandle):
+        (WebKit::InjectedBundleNodeHandle::coreNode):
+        (WebKit::InjectedBundleNodeHandle::document):
+        (WebKit::InjectedBundleNodeHandle::elementBounds):
+        (WebKit::InjectedBundleNodeHandle::renderRect):
+        (WebKit::InjectedBundleNodeHandle::renderedImage):
+        (WebKit::InjectedBundleNodeHandle::visibleRange):
+        (WebKit::InjectedBundleNodeHandle::setHTMLInputElementValueForUser):
+        (WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutoFilled):
+        (WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutoFilled):
+        (WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutoFillButtonEnabled):
+        (WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutoFillButtonEnabled):
+        (WebKit::InjectedBundleNodeHandle::htmlInputElementAutoFillButtonBounds):
+        (WebKit::InjectedBundleNodeHandle::htmlInputElementLastChangeWasUserEdit):
+        (WebKit::InjectedBundleNodeHandle::htmlTextAreaElementLastChangeWasUserEdit):
+        (WebKit::InjectedBundleNodeHandle::isTextField):
+        (WebKit::InjectedBundleNodeHandle::htmlTableCellElementCellAbove):
+        (WebKit::InjectedBundleNodeHandle::documentFrame):
+        (WebKit::InjectedBundleNodeHandle::htmlFrameElementContentFrame):
+        (WebKit::InjectedBundleNodeHandle::htmlIFrameElementContentFrame):
+        (WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutofilled): Deleted.
+        (WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutofilled): Deleted.
+        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
+        Fix-up InjectedBundleNodeHandle to store its underlying Node in a Ref, rather than a RefPtr.
+        Add helpers to implement the new SPI for WKBundleNodeHandleRef.
+
 2015-03-11  Timothy Horton  <timothy_hor...@apple.com>
 
         Make it possible to zoom on pages that claim to lay out to device size and then fail to do so

Modified: trunk/Source/WebKit2/UIProcess/API/APIUIClient.h (181407 => 181408)


--- trunk/Source/WebKit2/UIProcess/API/APIUIClient.h	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/UIProcess/API/APIUIClient.h	2015-03-11 22:01:01 UTC (rev 181408)
@@ -155,6 +155,8 @@
     virtual RetainPtr<NSArray> actionsForElement(_WKActivatedElementInfo *, RetainPtr<NSArray> defaultActions) { return WTF::move(defaultActions); }
     virtual void didNotHandleTapAsClick(const WebCore::IntPoint&) { }
 #endif
+
+    virtual void didClickAutoFillButton(WebKit::WebPageProxy&, API::Object*) { }
 };
 
 } // namespace API

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (181407 => 181408)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2015-03-11 22:01:01 UTC (rev 181408)
@@ -1744,6 +1744,14 @@
 
             m_client.isPlayingAudioDidChange(toAPI(&page), m_client.base.clientInfo);
         }
+
+        virtual void didClickAutoFillButton(WebPageProxy& page, API::Object* userInfo) override
+        {
+            if (!m_client.didClickAutoFillButton)
+                return;
+
+            m_client.didClickAutoFillButton(toAPI(&page), toAPI(userInfo), m_client.base.clientInfo);
+        }
     };
 
     toImpl(pageRef)->setUIClient(std::make_unique<UIClient>(wkClient));

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h (181407 => 181408)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h	2015-03-11 22:01:01 UTC (rev 181408)
@@ -91,8 +91,9 @@
 typedef void (*WKPageDidCancelTrackingPotentialLongMousePressCallback)(WKPageRef page, WKTypeRef userData, const void *clientInfo);
 typedef void (*WKPageIsPlayingAudioDidChangeCallback)(WKPageRef page, const void* clientInfo);
 typedef void (*WKPageDecidePolicyForUserMediaPermissionRequestCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKUserMediaPermissionRequestRef permissionRequest, const void* clientInfo);
+typedef void (*WKPageDidClickAutoFillButtonCallback)(WKPageRef page, WKTypeRef userData, const void *clientInfo);
 
-// Deprecated    
+// Deprecated
 typedef WKPageRef (*WKPageCreateNewPageCallback_deprecatedForUseWithV0)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
 typedef void      (*WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0)(WKPageRef page, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo);
 typedef void (*WKPageMissingPluginButtonClickedCallback_deprecatedForUseWithV0)(WKPageRef page, WKStringRef mimeType, WKStringRef url, WKStringRef pluginsPageURL, const void* clientInfo);
@@ -445,6 +446,7 @@
 
     // Version 5.
     WKPageDecidePolicyForUserMediaPermissionRequestCallback             decidePolicyForUserMediaPermissionRequest;
+    WKPageDidClickAutoFillButtonCallback                                didClickAutoFillButton;
 } WKPageUIClientV5;
 
 enum { kWKPageUIClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 2 };

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (181407 => 181408)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2015-03-11 22:01:01 UTC (rev 181408)
@@ -5592,4 +5592,9 @@
     m_process->send(Messages::WebPage::SetShouldDispatchFakeMouseMoveEvents(shouldDispatchFakeMouseMoveEvents), m_pageID);
 }
 
+void WebPageProxy::handleAutoFillButtonClick(const UserData& userData)
+{
+    m_uiClient->didClickAutoFillButton(*this, m_process->transformHandlesToObjects(userData.object()).get());
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (181407 => 181408)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2015-03-11 22:01:01 UTC (rev 181408)
@@ -1384,6 +1384,8 @@
     void didPerformActionMenuHitTest(const ActionMenuHitTestResult&, bool forImmediateAction, const UserData&);
 #endif
 
+    void handleAutoFillButtonClick(const UserData&);
+
     PageClient& m_pageClient;
     std::unique_ptr<API::LoaderClient> m_loaderClient;
     std::unique_ptr<API::PolicyClient> m_policyClient;

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (181407 => 181408)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2015-03-11 22:01:01 UTC (rev 181408)
@@ -423,4 +423,6 @@
 #if PLATFORM(MAC)
     DidPerformActionMenuHitTest(struct WebKit::ActionMenuHitTestResult result, bool forImmediateAction, WebKit::UserData userData)
 #endif
+
+    HandleAutoFillButtonClick(WebKit::UserData userData);
 }

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h (181407 => 181408)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h	2015-03-11 22:01:01 UTC (rev 181408)
@@ -33,6 +33,7 @@
 }
 
 namespace WebKit {
+class InjectedBundleNodeHandle;
 class WebFrame;
 class WebPage;
 }
@@ -89,6 +90,8 @@
     virtual void didBeginTrackingPotentialLongMousePress(WebKit::WebPage*, const WebCore::IntPoint&, const WebCore::HitTestResult&, RefPtr<API::Object>& userData) { UNUSED_PARAM(userData); }
     virtual void didRecognizeLongMousePress(WebKit::WebPage*, RefPtr<API::Object>& userData) { UNUSED_PARAM(userData); }
     virtual void didCancelTrackingPotentialLongMousePress(WebKit::WebPage*, RefPtr<API::Object>& userData) { UNUSED_PARAM(userData); }
+
+    virtual void didClickAutoFillButton(WebKit::WebPage&, WebKit::InjectedBundleNodeHandle&, RefPtr<API::Object>&) { }
 };
 
 } // namespace InjectedBundle

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm (181407 => 181408)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm	2015-03-11 22:01:01 UTC (rev 181408)
@@ -70,12 +70,12 @@
 
 - (BOOL)HTMLInputElementIsAutoFilled
 {
-    return _nodeHandle->isHTMLInputElementAutofilled();
+    return _nodeHandle->isHTMLInputElementAutoFilled();
 }
 
 - (void)setHTMLInputElementIsAutoFilled:(BOOL)isAutoFilled
 {
-    _nodeHandle->setHTMLInputElementAutofilled(isAutoFilled);
+    _nodeHandle->setHTMLInputElementAutoFilled(isAutoFilled);
 }
 
 - (BOOL)HTMLInputElementIsUserEdited

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp (181407 => 181408)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp	2015-03-11 22:01:01 UTC (rev 181408)
@@ -80,16 +80,31 @@
     toImpl(htmlInputElementHandleRef)->setHTMLInputElementValueForUser(toWTFString(valueRef));
 }
 
-bool WKBundleNodeHandleGetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandleRef)
+bool WKBundleNodeHandleGetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandleRef)
 {
-    return toImpl(htmlInputElementHandleRef)->isHTMLInputElementAutofilled();
+    return toImpl(htmlInputElementHandleRef)->isHTMLInputElementAutoFilled();
 }
 
-void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandleRef, bool filled)
+void WKBundleNodeHandleSetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandleRef, bool filled)
 {
-    toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutofilled(filled);
+    toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutoFilled(filled);
 }
 
+bool WKBundleNodeHandleGetHTMLInputElementAutoFillButtonEnabled(WKBundleNodeHandleRef htmlInputElementHandleRef)
+{
+    return toImpl(htmlInputElementHandleRef)->isHTMLInputElementAutoFillButtonEnabled();
+}
+
+void WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabled(WKBundleNodeHandleRef htmlInputElementHandleRef, bool enabled)
+{
+    toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutoFillButtonEnabled(enabled);
+}
+
+WKRect WKBundleNodeHandleGetHTMLInputElementAutoFillButtonBounds(WKBundleNodeHandleRef htmlInputElementHandleRef)
+{
+    return toAPI(toImpl(htmlInputElementHandleRef)->htmlInputElementAutoFillButtonBounds());
+}
+
 bool WKBundleNodeHandleGetHTMLInputElementLastChangeWasUserEdit(WKBundleNodeHandleRef htmlInputElementHandleRef)
 {
     return toImpl(htmlInputElementHandleRef)->htmlInputElementLastChangeWasUserEdit();
@@ -123,3 +138,15 @@
     RefPtr<WebFrame> frame = toImpl(htmlIFrameElementHandleRef)->htmlIFrameElementContentFrame();
     return toAPI(frame.release().leakRef());
 }
+
+// Deprecated - use WKBundleNodeHandleGetHTMLInputElementAutoFilled(WKBundleNodeHandleRef).
+bool WKBundleNodeHandleGetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandleRef)
+{
+    return toImpl(htmlInputElementHandleRef)->isHTMLInputElementAutoFilled();
+}
+
+// Deprecated - use WKBundleNodeHandleSetHTMLInputElementAutoFilled(WKBundleNodeHandleRef, bool).
+void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandleRef, bool filled)
+{
+    toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutoFilled(filled);
+}

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h (181407 => 181408)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h	2015-03-11 22:01:01 UTC (rev 181408)
@@ -52,8 +52,11 @@
 
 /* HTMLInputElement Specific Operations */
 WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementValueForUser(WKBundleNodeHandleRef htmlInputElementHandle, WKStringRef value);
-WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandle);
-WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandle, bool filled);
+WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandle);
+WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandle, bool filled);
+WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutoFillButtonEnabled(WKBundleNodeHandleRef htmlInputElementHandle);
+WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabled(WKBundleNodeHandleRef htmlInputElementHandle, bool enabled);
+WK_EXPORT WKRect WKBundleNodeHandleGetHTMLInputElementAutoFillButtonBounds(WKBundleNodeHandleRef htmlInputElementHandle);
 WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementLastChangeWasUserEdit(WKBundleNodeHandleRef htmlInputElementHandle);
 
 /* HTMLTextAreaElement Specific Operations */
@@ -71,6 +74,12 @@
 /* HTMLIFrameElement Specific Operations */
 WK_EXPORT WKBundleFrameRef WKBundleNodeHandleCopyHTMLIFrameElementContentFrame(WKBundleNodeHandleRef htmlIFrameElementHandle);
 
+
+/* Deprecated - use WKBundleNodeHandleGetHTMLInputElementAutoFilled(WKBundleNodeHandleRef) */
+WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandle);
+/* Deprecated - use WKBundleNodeHandleSetHTMLInputElementAutoFilled(WKBundleNodeHandleRef, bool) */
+WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandle, bool filled);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h (181407 => 181408)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h	2015-03-11 22:01:01 UTC (rev 181408)
@@ -57,6 +57,7 @@
 typedef void (*WKBundlePageDidBeginTrackingPotentialLongMousePressCallback)(WKBundlePageRef page, WKPoint mouseDownPosition, WKBundleHitTestResultRef hitTestResult, WKTypeRef* userData, const void *clientInfo);
 typedef void (*WKBundlePageDidRecognizeLongMousePressCallback)(WKBundlePageRef page, WKTypeRef* userData, const void *clientInfo);
 typedef void (*WKBundlePageDidCancelTrackingPotentialLongMousePressCallback)(WKBundlePageRef page, WKTypeRef* userData, const void *clientInfo);
+typedef void (*WKBundlePageDidClickAutoFillButtonCallback)(WKBundlePageRef page, WKBundleNodeHandleRef inputElement, WKTypeRef* userData, const void *clientInfo);
 
 typedef struct WKBundlePageUIClientBase {
     int                                                                 version;
@@ -169,6 +170,8 @@
     WKBundlePageDidBeginTrackingPotentialLongMousePressCallback         didBeginTrackingPotentialLongMousePress;
     WKBundlePageDidRecognizeLongMousePressCallback                      didRecognizeLongMousePress;
     WKBundlePageDidCancelTrackingPotentialLongMousePressCallback        didCancelTrackingPotentialLongMousePress;
+
+    WKBundlePageDidClickAutoFillButtonCallback                          didClickAutoFillButton;
 } WKBundlePageUIClientV3;
 
 enum { kWKBundlePageUIClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 2 };

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp (181407 => 181408)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp	2015-03-11 22:01:01 UTC (rev 181408)
@@ -68,65 +68,70 @@
     return cache;
 }
 
-PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::getOrCreate(JSContextRef, JSObjectRef object)
+RefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::getOrCreate(JSContextRef, JSObjectRef object)
 {
     Node* node = JSNode::toWrapped(toJS(object));
     return getOrCreate(node);
 }
 
-PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::getOrCreate(Node* node)
+RefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::getOrCreate(Node* node)
 {
     if (!node)
-        return 0;
+        return nullptr;
 
-    DOMHandleCache::AddResult result = domHandleCache().add(node, nullptr);
+    return InjectedBundleNodeHandle::getOrCreate(*node);
+}
+
+Ref<InjectedBundleNodeHandle> InjectedBundleNodeHandle::getOrCreate(Node& node)
+{
+    DOMHandleCache::AddResult result = domHandleCache().add(&node, nullptr);
     if (!result.isNewEntry)
-        return PassRefPtr<InjectedBundleNodeHandle>(result.iterator->value);
+        return Ref<InjectedBundleNodeHandle>(*result.iterator->value);
 
-    RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::create(node);
-    result.iterator->value = nodeHandle.get();
-    return nodeHandle.release();
+    Ref<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::create(node);
+    result.iterator->value = nodeHandle.ptr();
+    return nodeHandle;
 }
 
-PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::create(Node* node)
+Ref<InjectedBundleNodeHandle> InjectedBundleNodeHandle::create(Node& node)
 {
-    return adoptRef(new InjectedBundleNodeHandle(node));
+    return adoptRef(*new InjectedBundleNodeHandle(node));
 }
 
-InjectedBundleNodeHandle::InjectedBundleNodeHandle(Node* node)
+InjectedBundleNodeHandle::InjectedBundleNodeHandle(Node& node)
     : m_node(node)
 {
 }
 
 InjectedBundleNodeHandle::~InjectedBundleNodeHandle()
 {
-    domHandleCache().remove(m_node.get());
+    domHandleCache().remove(m_node.ptr());
 }
 
-Node* InjectedBundleNodeHandle::coreNode() const
+Node* InjectedBundleNodeHandle::coreNode()
 {
-    return m_node.get();
+    return m_node.ptr();
 }
 
-PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::document()
+Ref<InjectedBundleNodeHandle> InjectedBundleNodeHandle::document()
 {
-    return getOrCreate(&m_node->document());
+    return getOrCreate(m_node->document());
 }
 
 // Additional DOM Operations
 // Note: These should only be operations that are not exposed to _javascript_.
 
-IntRect InjectedBundleNodeHandle::elementBounds() const
+IntRect InjectedBundleNodeHandle::elementBounds()
 {
-    if (!is<Element>(*m_node))
+    if (!is<Element>(m_node))
         return IntRect();
 
-    return downcast<Element>(*m_node).boundsInRootViewSpace();
+    return downcast<Element>(m_node.get()).boundsInRootViewSpace();
 }
     
-IntRect InjectedBundleNodeHandle::renderRect(bool* isReplaced) const
+IntRect InjectedBundleNodeHandle::renderRect(bool* isReplaced)
 {
-    return m_node.get()->pixelSnappedRenderRect(isReplaced);
+    return m_node->pixelSnappedRenderRect(isReplaced);
 }
 
 static PassRefPtr<WebImage> imageForRect(FrameView* frameView, const IntRect& rect, SnapshotOptions options)
@@ -166,32 +171,32 @@
 {
     Frame* frame = m_node->document().frame();
     if (!frame)
-        return 0;
+        return nullptr;
 
     FrameView* frameView = frame->view();
     if (!frameView)
-        return 0;
+        return nullptr;
 
     m_node->document().updateLayout();
 
     RenderObject* renderer = m_node->renderer();
     if (!renderer)
-        return 0;
+        return nullptr;
 
     LayoutRect topLevelRect;
     IntRect paintingRect = snappedIntRect(renderer->paintingRootRect(topLevelRect));
 
-    frameView->setNodeToDraw(m_node.get());
+    frameView->setNodeToDraw(m_node.ptr());
     RefPtr<WebImage> image = imageForRect(frameView, paintingRect, options);
     frameView->setNodeToDraw(0);
 
     return image.release();
 }
 
-PassRefPtr<InjectedBundleRangeHandle> InjectedBundleNodeHandle::visibleRange() const
+PassRefPtr<InjectedBundleRangeHandle> InjectedBundleNodeHandle::visibleRange()
 {
-    VisiblePosition start = firstPositionInNode(m_node.get());
-    VisiblePosition end = lastPositionInNode(m_node.get());
+    VisiblePosition start = firstPositionInNode(m_node.ptr());
+    VisiblePosition end = lastPositionInNode(m_node.ptr());
 
     RefPtr<Range> range = makeRange(start, end);
     return InjectedBundleRangeHandle::getOrCreate(range.get());
@@ -199,55 +204,86 @@
 
 void InjectedBundleNodeHandle::setHTMLInputElementValueForUser(const String& value)
 {
-    if (!is<HTMLInputElement>(*m_node))
+    if (!is<HTMLInputElement>(m_node))
         return;
 
-    downcast<HTMLInputElement>(*m_node).setValueForUser(value);
+    downcast<HTMLInputElement>(m_node.get()).setValueForUser(value);
 }
 
-bool InjectedBundleNodeHandle::isHTMLInputElementAutofilled() const
+bool InjectedBundleNodeHandle::isHTMLInputElementAutoFilled() const
 {
-    if (!is<HTMLInputElement>(*m_node))
+    if (!is<HTMLInputElement>(m_node))
         return false;
     
-    return downcast<HTMLInputElement>(*m_node).isAutofilled();
+    return downcast<HTMLInputElement>(m_node.get()).isAutoFilled();
 }
 
-void InjectedBundleNodeHandle::setHTMLInputElementAutofilled(bool filled)
+void InjectedBundleNodeHandle::setHTMLInputElementAutoFilled(bool filled)
 {
-    if (!is<HTMLInputElement>(*m_node))
+    if (!is<HTMLInputElement>(m_node))
         return;
 
-    downcast<HTMLInputElement>(*m_node).setAutofilled(filled);
+    downcast<HTMLInputElement>(m_node.get()).setAutoFilled(filled);
 }
 
+bool InjectedBundleNodeHandle::isHTMLInputElementAutoFillButtonEnabled() const
+{
+    if (!is<HTMLInputElement>(m_node))
+        return false;
+    
+    return downcast<HTMLInputElement>(m_node.get()).showAutoFillButton();
+}
+
+void InjectedBundleNodeHandle::setHTMLInputElementAutoFillButtonEnabled(bool filled)
+{
+    if (!is<HTMLInputElement>(m_node))
+        return;
+
+    downcast<HTMLInputElement>(m_node.get()).setShowAutoFillButton(filled);
+}
+
+IntRect InjectedBundleNodeHandle::htmlInputElementAutoFillButtonBounds()
+{
+    if (!is<HTMLInputElement>(m_node))
+        return IntRect();
+
+    auto autoFillButton = downcast<HTMLInputElement>(m_node.get()).autoFillButtonElement();
+    if (!autoFillButton)
+        return IntRect();
+
+    return autoFillButton->boundsInRootViewSpace();
+}
+
 bool InjectedBundleNodeHandle::htmlInputElementLastChangeWasUserEdit()
 {
-    if (!is<HTMLInputElement>(*m_node))
+    if (!is<HTMLInputElement>(m_node))
         return false;
 
-    return downcast<HTMLInputElement>(*m_node).lastChangeWasUserEdit();
+    return downcast<HTMLInputElement>(m_node.get()).lastChangeWasUserEdit();
 }
 
 bool InjectedBundleNodeHandle::htmlTextAreaElementLastChangeWasUserEdit()
 {
-    if (!is<HTMLTextAreaElement>(*m_node))
+    if (!is<HTMLTextAreaElement>(m_node))
         return false;
 
-    return downcast<HTMLTextAreaElement>(*m_node).lastChangeWasUserEdit();
+    return downcast<HTMLTextAreaElement>(m_node.get()).lastChangeWasUserEdit();
 }
 
 bool InjectedBundleNodeHandle::isTextField() const
 {
-    return is<HTMLInputElement>(*m_node) && downcast<HTMLInputElement>(*m_node).isText();
+    if (!is<HTMLInputElement>(m_node))
+        return false;
+
+    return downcast<HTMLInputElement>(m_node.get()).isText();
 }
 
 PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::htmlTableCellElementCellAbove()
 {
-    if (!m_node->hasTagName(tdTag))
+    if (!is<HTMLTableCellElement>(m_node))
         return nullptr;
 
-    return getOrCreate(static_cast<HTMLTableCellElement&>(*m_node).cellAbove());
+    return getOrCreate(downcast<HTMLTableCellElement>(m_node.get()).cellAbove());
 }
 
 PassRefPtr<WebFrame> InjectedBundleNodeHandle::documentFrame()
@@ -255,7 +291,7 @@
     if (!m_node->isDocumentNode())
         return nullptr;
 
-    Frame* frame = static_cast<Document*>(m_node.get())->frame();
+    Frame* frame = downcast<Document>(m_node.get()).frame();
     if (!frame)
         return nullptr;
 
@@ -264,10 +300,10 @@
 
 PassRefPtr<WebFrame> InjectedBundleNodeHandle::htmlFrameElementContentFrame()
 {
-    if (!m_node->hasTagName(frameTag))
+    if (!is<HTMLFrameElement>(m_node))
         return nullptr;
 
-    Frame* frame = static_cast<HTMLFrameElement*>(m_node.get())->contentFrame();
+    Frame* frame = downcast<HTMLFrameElement>(m_node.get()).contentFrame();
     if (!frame)
         return nullptr;
 
@@ -276,10 +312,10 @@
 
 PassRefPtr<WebFrame> InjectedBundleNodeHandle::htmlIFrameElementContentFrame()
 {
-    if (!is<HTMLIFrameElement>(*m_node))
+    if (!is<HTMLIFrameElement>(m_node))
         return nullptr;
 
-    Frame* frame = downcast<HTMLIFrameElement>(*m_node).contentFrame();
+    Frame* frame = downcast<HTMLIFrameElement>(m_node.get()).contentFrame();
     if (!frame)
         return nullptr;
 

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h (181407 => 181408)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h	2015-03-11 22:01:01 UTC (rev 181408)
@@ -47,25 +47,29 @@
 
 class InjectedBundleNodeHandle : public API::ObjectImpl<API::Object::Type::BundleNodeHandle> {
 public:
-    static PassRefPtr<InjectedBundleNodeHandle> getOrCreate(JSContextRef, JSObjectRef);
-    static PassRefPtr<InjectedBundleNodeHandle> getOrCreate(WebCore::Node*);
+    static RefPtr<InjectedBundleNodeHandle> getOrCreate(JSContextRef, JSObjectRef);
+    static RefPtr<InjectedBundleNodeHandle> getOrCreate(WebCore::Node*);
+    static Ref<InjectedBundleNodeHandle> getOrCreate(WebCore::Node&);
 
     virtual ~InjectedBundleNodeHandle();
 
-    WebCore::Node* coreNode() const;
+    WebCore::Node* coreNode();
 
     // Convenience DOM Operations
-    PassRefPtr<InjectedBundleNodeHandle> document();
+    Ref<InjectedBundleNodeHandle> document();
 
     // Additional DOM Operations
     // Note: These should only be operations that are not exposed to _javascript_.
-    WebCore::IntRect elementBounds() const;
-    WebCore::IntRect renderRect(bool*) const;
+    WebCore::IntRect elementBounds();
+    WebCore::IntRect renderRect(bool*);
     PassRefPtr<WebImage> renderedImage(SnapshotOptions);
-    PassRefPtr<InjectedBundleRangeHandle> visibleRange() const;
+    PassRefPtr<InjectedBundleRangeHandle> visibleRange();
     void setHTMLInputElementValueForUser(const String&);
-    bool isHTMLInputElementAutofilled() const;
-    void setHTMLInputElementAutofilled(bool);
+    bool isHTMLInputElementAutoFilled() const;
+    void setHTMLInputElementAutoFilled(bool);
+    bool isHTMLInputElementAutoFillButtonEnabled() const;
+    void setHTMLInputElementAutoFillButtonEnabled(bool);
+    WebCore::IntRect htmlInputElementAutoFillButtonBounds();
     bool htmlInputElementLastChangeWasUserEdit();
     bool htmlTextAreaElementLastChangeWasUserEdit();
     bool isTextField() const;
@@ -77,10 +81,10 @@
     PassRefPtr<WebFrame> htmlIFrameElementContentFrame();
 
 private:
-    static PassRefPtr<InjectedBundleNodeHandle> create(WebCore::Node*);
-    InjectedBundleNodeHandle(WebCore::Node*);
+    static Ref<InjectedBundleNodeHandle> create(WebCore::Node&);
+    InjectedBundleNodeHandle(WebCore::Node&);
 
-    RefPtr<WebCore::Node> m_node;
+    Ref<WebCore::Node> m_node;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp (181407 => 181408)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp	2015-03-11 22:01:01 UTC (rev 181408)
@@ -28,6 +28,7 @@
 
 #include "APISecurityOrigin.h"
 #include "InjectedBundleHitTestResult.h"
+#include "InjectedBundleNodeHandle.h"
 #include "WKAPICast.h"
 #include "WKBundleAPICast.h"
 #include "WebFrame.h"
@@ -233,4 +234,14 @@
     userData = adoptRef(toImpl(userDataToPass));
 }
 
+void InjectedBundlePageUIClient::didClickAutoFillButton(WebPage& page, InjectedBundleNodeHandle& nodeHandle, RefPtr<API::Object>& userData)
+{
+    if (!m_client.didClickAutoFillButton)
+        return;
+
+    WKTypeRef userDataToPass = nullptr;
+    m_client.didClickAutoFillButton(toAPI(&page), toAPI(&nodeHandle), &userDataToPass, m_client.base.clientInfo);
+    userData = adoptRef(toImpl(userDataToPass));
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h (181407 => 181408)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h	2015-03-11 22:01:01 UTC (rev 181408)
@@ -73,6 +73,8 @@
     void didBeginTrackingPotentialLongMousePress(WebPage*, const WebCore::IntPoint&, const WebCore::HitTestResult&, RefPtr<API::Object>& userData) override;
     void didRecognizeLongMousePress(WebPage*, RefPtr<API::Object>& userData) override;
     void didCancelTrackingPotentialLongMousePress(WebPage*, RefPtr<API::Object>& userData) override;
+
+    void didClickAutoFillButton(WebPage&, InjectedBundleNodeHandle&, RefPtr<API::Object>& userData) override;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (181407 => 181408)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp	2015-03-11 22:01:01 UTC (rev 181408)
@@ -30,6 +30,7 @@
 #include "APISecurityOrigin.h"
 #include "DrawingArea.h"
 #include "InjectedBundleNavigationAction.h"
+#include "InjectedBundleNodeHandle.h"
 #include "LayerTreeHost.h"
 #include "NavigationActionData.h"
 #include "PageBanner.h"
@@ -1101,4 +1102,16 @@
     return m_page->shouldDispatchFakeMouseMoveEvents();
 }
 
+void WebChromeClient::handleAutoFillButtonClick(HTMLInputElement& inputElement)
+{
+    RefPtr<API::Object> userData;
+
+    // Notify the bundle client.
+    auto nodeHandle = InjectedBundleNodeHandle::getOrCreate(inputElement);
+    m_page->injectedBundleUIClient().didClickAutoFillButton(*m_page, nodeHandle.get(), userData);
+
+    // Notify the UIProcess.
+    m_page->send(Messages::WebPageProxy::HandleAutoFillButtonClick(UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (181407 => 181408)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h	2015-03-11 22:01:01 UTC (rev 181408)
@@ -310,6 +310,8 @@
 
     virtual bool shouldDispatchFakeMouseMoveEvents() const override;
 
+    virtual void handleAutoFillButtonClick(WebCore::HTMLInputElement&) override;
+
     String m_cachedToolTip;
     mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame;
     mutable bool m_cachedMainFrameHasHorizontalScrollbar;

Modified: trunk/Tools/ChangeLog (181407 => 181408)


--- trunk/Tools/ChangeLog	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Tools/ChangeLog	2015-03-11 22:01:01 UTC (rev 181408)
@@ -1,3 +1,16 @@
+2015-03-10  Sam Weinig  <s...@webkit.org>
+
+        Allow adding a button in input elements for auto fill related functionality
+        <rdar://problem/19782066>
+        https://bugs.webkit.org/show_bug.cgi?id=142564
+
+        Reviewed by Anders Carlsson.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::createOtherPage):
+        (WTR::TestController::createWebViewWithOptions):
+        Update for new callback.
+
 2015-03-11  Benjamin Poulain  <bpoul...@apple.com>
 
         Add basic support for BOL and EOL assertions to the URL Filter parser

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (181407 => 181408)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2015-03-11 21:29:57 UTC (rev 181407)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2015-03-11 22:01:01 UTC (rev 181408)
@@ -256,6 +256,7 @@
         0, // didCancelTrackingPotentialLongMousePress
         0, // isPlayingAudioDidChange
         decidePolicyForUserMediaPermissionRequest,
+        0, // didClickAutofillButton
     };
     WKPageSetPageUIClient(newPage, &otherPageUIClient.base);
     
@@ -493,6 +494,7 @@
         0, // didCancelTrackingPotentialLongMousePress
         0, // isPlayingAudioDidChange
         decidePolicyForUserMediaPermissionRequest,
+        0, // didClickAutofillButton
     };
     WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient.base);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to