Changeset 181408 in webkit


Ignore:
Timestamp:
Mar 11, 2015 3:01:01 PM (9 years ago)
Author:
weinig@apple.com
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.
Location:
trunk
Files:
5 added
44 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r181404 r181408  
     12015-03-10  Sam Weinig  <sam@webkit.org>
     2
     3        Allow adding a button in input elements for auto fill related functionality
     4        <rdar://problem/19782066>
     5        https://bugs.webkit.org/show_bug.cgi?id=142564
     6
     7        Reviewed by Anders Carlsson.
     8
     9        * fast/forms/input-auto-fill-button-expected.txt: Added.
     10        * fast/forms/input-auto-fill-button.html: Added.
     11
    1122015-03-11  Ryosuke Niwa  <rniwa@webkit.org>
    213
  • trunk/Source/WebCore/CMakeLists.txt

    r181371 r181408  
    17471747    html/parser/XSSAuditorDelegate.cpp
    17481748
     1749    html/shadow/AutoFillButtonElement.cpp
    17491750    html/shadow/ContentDistributor.cpp
    17501751    html/shadow/DetailsMarkerControl.cpp
  • trunk/Source/WebCore/ChangeLog

    r181407 r181408  
     12015-03-10  Sam Weinig  <sam@webkit.org>
     2
     3        Allow adding a button in input elements for auto fill related functionality
     4        <rdar://problem/19782066>
     5        https://bugs.webkit.org/show_bug.cgi?id=142564
     6
     7        Reviewed by Anders Carlsson.
     8
     9        Test: fast/forms/input-auto-fill-button.html
     10
     11        - Adds a new button that can be shown in <input> elements - AutoFillButtonElement.
     12        - Makes the spelling of AutoFill consistent throughout WebCore and WebKit (except
     13          where not feasible due to exported API/SPI).
     14
     15        * CMakeLists.txt:
     16        * WebCore.vcxproj/WebCore.vcxproj:
     17        * WebCore.vcxproj/WebCore.vcxproj.filters:
     18        * WebCore.xcodeproj/project.pbxproj:
     19        Add new files.
     20
     21        * css/html.css:
     22        (input::-webkit-auto-fill-button):
     23        (input::-webkit-auto-fill-button:hover):
     24        (input::-webkit-auto-fill-button:active):
     25        Add default style rules for the AutoFill button based on the ones
     26        used for caps lock indicator.
     27
     28        * html/HTMLInputElement.cpp:
     29        (WebCore::HTMLInputElement::HTMLInputElement):
     30        (WebCore::HTMLInputElement::autoFillButtonElement):
     31        (WebCore::HTMLInputElement::reset):
     32        (WebCore::HTMLInputElement::setValueFromRenderer):
     33        (WebCore::HTMLInputElement::setAutoFilled):
     34        (WebCore::HTMLInputElement::setShowAutoFillButton):
     35        (WebCore::HTMLInputElement::setAutofilled): Deleted.
     36        * html/HTMLInputElement.h:
     37        (WebCore::HTMLInputElement::isAutoFilled):
     38        (WebCore::HTMLInputElement::showAutoFillButton):
     39        (WebCore::HTMLInputElement::isAutofilled): Deleted.
     40        Add new bit to represent whether the AutoFill button should be shown
     41        or not. By default it is not shown, and the client must enable it.
     42
     43        * html/InputType.cpp:
     44        (WebCore::InputType::updateAutoFillButton):
     45        * html/InputType.h:
     46        (WebCore::InputType::autoFillButtonElement):
     47        Add new virtual methods for updating and accessing the AutoFill button.
     48
     49        * html/TextFieldInputType.cpp:
     50        (WebCore::TextFieldInputType::createShadowSubtree):
     51        (WebCore::TextFieldInputType::autoFillButtonElement):
     52        (WebCore::TextFieldInputType::destroyShadowSubtree):
     53        (WebCore::TextFieldInputType::updatePlaceholderText):
     54        (WebCore::TextFieldInputType::shouldDrawAutoFillButton):
     55        (WebCore::TextFieldInputType::autoFillButtonElementWasClicked):
     56        (WebCore::TextFieldInputType::createContainer):
     57        (WebCore::TextFieldInputType::createAutoFillButton):
     58        (WebCore::TextFieldInputType::updateAutoFillButton):
     59        * html/TextFieldInputType.h:
     60        Add support for adding the AutoFill to the shadow DOM of textfields. The implementation
     61        is slightly different than for the caps lock indicator, because I didn't want to force
     62        the creation of a container for all <input> elements just in case an AutoFill button was
     63        added. Instead, if an AutoFill button is added, the container is created on the fly and
     64        the existing DOM is updated to move into it. Once a container is created, it is never
     65        removed.
     66
     67        * html/shadow/AutoFillButtonElement.cpp: Added.
     68        (WebCore::AutoFillButtonElement::create):
     69        (WebCore::AutoFillButtonElement::AutoFillButtonElement):
     70        (WebCore::AutoFillButtonElement::defaultEventHandler):
     71        * html/shadow/AutoFillButtonElement.h: Added.
     72        Add div subclass that swallows the click event and forwards it to the ChromeClient.
     73
     74        * page/ChromeClient.h:
     75        Add handleAutoFillButtonClick client function to inform WebKit that the AutoFill
     76        button was clicked.
     77
     78        * testing/Internals.cpp:
     79        (WebCore::Internals::setAutofilled):
     80        (WebCore::Internals::setShowAutoFillButton):
     81        * testing/Internals.h:
     82        * testing/Internals.idl:
     83        Expose a new internals.setShowAutoFillButton() function to allow testing
     84        of the AutoFill button from layout tests.
     85
     86        * accessibility/AccessibilityObject.cpp:
     87        (WebCore::AccessibilityObject::isValueAutofilled):
     88        * css/SelectorCheckerTestFunctions.h:
     89        (WebCore::isAutofilled):
     90        * css/StyleResolver.cpp:
     91        (WebCore::StyleResolver::canShareStyleWithControl):
     92        Update for new spelling of AutoFill.
     93
    1942015-03-11  Geoffrey Garen  <ggaren@apple.com>
    295
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r181190 r181408  
    1620916209    <ClCompile Include="..\html\parser\XSSAuditor.cpp" />
    1621016210    <ClCompile Include="..\html\parser\XSSAuditorDelegate.cpp" />
     16211    <ClCompile Include="..\html\shadow\AutoFillButtonElement.cpp" />
    1621116212    <ClCompile Include="..\html\shadow\ContentDistributor.cpp" />
    1621216213    <ClCompile Include="..\html\shadow\DetailsMarkerControl.cpp" />
     
    2097120972    <ClInclude Include="..\html\parser\XSSAuditor.h" />
    2097220973    <ClInclude Include="..\html\parser\XSSAuditorDelegate.h" />
     20974    <ClInclude Include="..\html\shadow\AutoFillButtonElement.h" />
    2097320975    <ClInclude Include="..\html\shadow\ContentDistributor.h" />
    2097420976    <ClInclude Include="..\html\shadow\DetailsMarkerControl.h" />
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

    r181190 r181408  
    41114111      <Filter>html\parser</Filter>
    41124112    </ClCompile>
     4113    <ClCompile Include="..\html\shadow\AutoFillButtonElement.cpp">
     4114      <Filter>html\shadow</Filter>
     4115    </ClCompile>
    41134116    <ClCompile Include="..\html\shadow\ContentDistributor.cpp">
    41144117      <Filter>html\shadow</Filter>
     
    1127411277    <ClInclude Include="..\html\parser\XSSAuditorDelegate.h">
    1127511278      <Filter>html\parser</Filter>
     11279    </ClInclude>
     11280    <ClInclude Include="..\html\shadow\AutoFillButtonElement.h">
     11281      <Filter>html\shadow</Filter>
    1127611282    </ClInclude>
    1127711283    <ClInclude Include="..\html\shadow\ContentDistributor.h">
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r181371 r181408  
    24742474                7AF9B20F18CFB5F400C64BEF /* JSVTTRegionList.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AF9B20B18CFB5F300C64BEF /* JSVTTRegionList.h */; };
    24752475                7BE7427381FA906FBB4F0F2C /* JSSVGGraphicsElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 950C4C02BED8936F818E2F99 /* JSSVGGraphicsElement.h */; };
     2476                7C1E97271A9F9834007BF0FB /* AutoFillButtonElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C1E97251A9F9834007BF0FB /* AutoFillButtonElement.cpp */; };
     2477                7C1E97281A9F9834007BF0FB /* AutoFillButtonElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C1E97261A9F9834007BF0FB /* AutoFillButtonElement.h */; };
    24762478                7C2BDD3D17C7F98C0038FF15 /* JSDOMGlobalObjectTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C2BDD3B17C7F98B0038FF15 /* JSDOMGlobalObjectTask.cpp */; };
    24772479                7C2BDD3E17C7F98C0038FF15 /* JSDOMGlobalObjectTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C2BDD3C17C7F98B0038FF15 /* JSDOMGlobalObjectTask.h */; };
     
    96949696                7AF9B20A18CFB5F300C64BEF /* JSVTTRegionList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSVTTRegionList.cpp; sourceTree = "<group>"; };
    96959697                7AF9B20B18CFB5F300C64BEF /* JSVTTRegionList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSVTTRegionList.h; sourceTree = "<group>"; };
     9698                7C1E97251A9F9834007BF0FB /* AutoFillButtonElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AutoFillButtonElement.cpp; sourceTree = "<group>"; };
     9699                7C1E97261A9F9834007BF0FB /* AutoFillButtonElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoFillButtonElement.h; sourceTree = "<group>"; };
    96969700                7C2BDD3B17C7F98B0038FF15 /* JSDOMGlobalObjectTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMGlobalObjectTask.cpp; sourceTree = "<group>"; };
    96979701                7C2BDD3C17C7F98B0038FF15 /* JSDOMGlobalObjectTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMGlobalObjectTask.h; sourceTree = "<group>"; };
     
    1568515689                        children = (
    1568615690                                51C4AA5118B28357007BFE9B /* mac */,
     15691                                7C1E97251A9F9834007BF0FB /* AutoFillButtonElement.cpp */,
     15692                                7C1E97261A9F9834007BF0FB /* AutoFillButtonElement.h */,
    1568715693                                57B7919F14C6A62900F202D1 /* ContentDistributor.cpp */,
    1568815694                                57B791A014C6A62900F202D1 /* ContentDistributor.h */,
     
    2619126197                                0FEA3E84191B31BF000F1B55 /* ScrollingStateOverflowScrollingNode.h in Headers */,
    2619226198                                931CBD0F161A44E900E4C874 /* ScrollingStateScrollingNode.h in Headers */,
     26199                                7C1E97281A9F9834007BF0FB /* AutoFillButtonElement.h in Headers */,
    2619326200                                0FB8890F167D30160010CDA5 /* ScrollingStateStickyNode.h in Headers */,
    2619426201                                931CBD11161A44E900E4C874 /* ScrollingStateTree.h in Headers */,
     
    2780127808                                85BA4D0E0AA688680088052D /* DOMHTMLDivElement.mm in Sources */,
    2780227809                                85BA4D100AA688680088052D /* DOMHTMLDListElement.mm in Sources */,
     27810                                7C1E97271A9F9834007BF0FB /* AutoFillButtonElement.cpp in Sources */,
    2780327811                                85BCBC140ABBA87D00381160 /* DOMHTMLDocument.mm in Sources */,
    2780427812                                85DF2EEE0AA387CB00AD64C5 /* DOMHTMLElement.mm in Sources */,
  • trunk/Source/WebCore/accessibility/AccessibilityObject.cpp

    r180621 r181408  
    20292029        return false;
    20302030   
    2031     return downcast<HTMLInputElement>(*node).isAutofilled();
     2031    return downcast<HTMLInputElement>(*node).isAutoFilled();
    20322032}
    20332033
  • trunk/Source/WebCore/bindings/objc/DOMHTML.mm

    r177559 r181408  
    183183- (BOOL)_isAutofilled
    184184{
    185     return core(self)->isAutofilled();
     185    return core(self)->isAutoFilled();
    186186}
    187187
     
    191191    // This allows WebKit to obey the -webkit-autofill pseudo style, which
    192192    // changes the background color.
    193     core(self)->setAutofilled(filled);
     193    core(self)->setAutoFilled(filled);
    194194}
    195195#endif // PLATFORM(IOS)
  • trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h

    r181197 r181408  
    4646    if (is<HTMLFormControlElement>(*element)) {
    4747        if (const HTMLInputElement* inputElement = element->toInputElement())
    48             return inputElement->isAutofilled();
     48            return inputElement->isAutoFilled();
    4949    }
    5050    return false;
  • trunk/Source/WebCore/css/StyleResolver.cpp

    r180554 r181408  
    507507        return false;
    508508
    509     if (thisInputElement->isAutofilled() != otherInputElement->isAutofilled())
     509    if (thisInputElement->isAutoFilled() != otherInputElement->isAutoFilled())
    510510        return false;
    511511    if (thisInputElement->shouldAppearChecked() != otherInputElement->shouldAppearChecked())
  • trunk/Source/WebCore/css/html.css

    r181094 r181408  
    545545}
    546546
     547input::-webkit-auto-fill-button {
     548    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>');
     549    align-self:stretch;
     550    opacity: .4;
     551    -webkit-flex: none;
     552    -webkit-user-select: none;
     553}
     554
     555input::-webkit-auto-fill-button:hover {
     556    opacity: .85;
     557}
     558
     559input::-webkit-auto-fill-button:active {
     560    opacity: 1;
     561}
     562
    547563input::-webkit-caps-lock-indicator {
    548564    -webkit-appearance: caps-lock-indicator;
  • trunk/Source/WebCore/html/HTMLInputElement.cpp

    r181358 r181408  
    110110    , m_isActivatedSubmit(false)
    111111    , m_autocomplete(Uninitialized)
    112     , m_isAutofilled(false)
     112    , m_isAutoFilled(false)
     113    , m_showAutoFillButton(false)
    113114#if ENABLE(DATALIST_ELEMENT)
    114115    , m_hasNonEmptyList(false)
     
    203204{
    204205    return m_inputType->capsLockIndicatorElement();
     206}
     207
     208HTMLElement* HTMLInputElement::autoFillButtonElement() const
     209{
     210    return m_inputType->autoFillButtonElement();
    205211}
    206212
     
    836842        setValue(String());
    837843
    838     setAutofilled(false);
     844    setAutoFilled(false);
    839845    setChecked(fastHasAttribute(checkedAttr));
    840846    m_reflectsCheckedAttribute = true;
     
    10571063    updateValidity();
    10581064
    1059     // Clear autofill flag (and yellow background) on user edit.
    1060     setAutofilled(false);
     1065    // Clear auto fill flag (and yellow background) on user edit.
     1066    setAutoFilled(false);
    10611067}
    10621068
     
    12901296}
    12911297
    1292 void HTMLInputElement::setAutofilled(bool autofilled)
    1293 {
    1294     if (autofilled == m_isAutofilled)
     1298void HTMLInputElement::setAutoFilled(bool autoFilled)
     1299{
     1300    if (autoFilled == m_isAutoFilled)
    12951301        return;
    12961302
    1297     m_isAutofilled = autofilled;
     1303    m_isAutoFilled = autoFilled;
    12981304    setNeedsStyleRecalc();
     1305}
     1306
     1307void HTMLInputElement::setShowAutoFillButton(bool showAutoFillButton)
     1308{
     1309    if (showAutoFillButton == m_showAutoFillButton)
     1310        return;
     1311
     1312    m_showAutoFillButton = showAutoFillButton;
     1313    m_inputType->updateAutoFillButton();
    12991314}
    13001315
  • trunk/Source/WebCore/html/HTMLInputElement.h

    r181169 r181408  
    152152    HTMLElement* sliderTrackElement() const;
    153153    virtual HTMLElement* placeholderElement() const override final;
     154    WEBCORE_EXPORT HTMLElement* autoFillButtonElement() const;
    154155
    155156    bool checked() const { return m_isChecked; }
     
    236237    bool multiple() const;
    237238
    238     bool isAutofilled() const { return m_isAutofilled; }
    239     WEBCORE_EXPORT void setAutofilled(bool = true);
     239    bool isAutoFilled() const { return m_isAutoFilled; }
     240    WEBCORE_EXPORT void setAutoFilled(bool = true);
     241
     242    bool showAutoFillButton() const { return m_showAutoFillButton; }
     243    WEBCORE_EXPORT void setShowAutoFillButton(bool);
    240244
    241245    FileList* files();
     
    429433    bool m_isActivatedSubmit : 1;
    430434    unsigned m_autocomplete : 2; // AutoCompleteSetting
    431     bool m_isAutofilled : 1;
     435    bool m_isAutoFilled : 1;
     436    bool m_showAutoFillButton : 1;
    432437#if ENABLE(DATALIST_ELEMENT)
    433438    bool m_hasNonEmptyList : 1;
  • trunk/Source/WebCore/html/InputType.cpp

    r180490 r181408  
    490490}
    491491
    492 void InputType::capsLockStateMayHaveChanged()
    493 {
    494 }
    495 
    496492void InputType::createShadowSubtree()
    497493{
     
    926922
    927923void InputType::requiredAttributeChanged()
     924{
     925}
     926
     927void InputType::capsLockStateMayHaveChanged()
     928{
     929}
     930
     931void InputType::updateAutoFillButton()
    928932{
    929933}
  • trunk/Source/WebCore/html/InputType.h

    r180490 r181408  
    216216    virtual void blur();
    217217
    218     virtual void capsLockStateMayHaveChanged();
    219 
    220218    // Shadow tree handling
    221219
     
    228226    virtual HTMLElement* innerSpinButtonElement() const { return nullptr; }
    229227    virtual HTMLElement* capsLockIndicatorElement() const { return nullptr; }
     228    virtual HTMLElement* autoFillButtonElement() const { return nullptr; }
    230229    virtual HTMLElement* resultsButtonElement() const { return nullptr; }
    231230    virtual HTMLElement* cancelButtonElement() const { return nullptr; }
     
    276275    virtual void readonlyAttributeChanged();
    277276    virtual void requiredAttributeChanged();
     277    virtual void capsLockStateMayHaveChanged();
     278    virtual void updateAutoFillButton();
    278279    virtual String defaultToolTip() const;
    279280
  • trunk/Source/WebCore/html/TextFieldInputType.cpp

    r180490 r181408  
    3535#include "BeforeTextInsertedEvent.h"
    3636#include "Chrome.h"
     37#include "ChromeClient.h"
    3738#include "Editor.h"
    3839#include "FormDataList.h"
     
    256257    ASSERT(!m_innerBlock);
    257258    ASSERT(!m_innerSpinButton);
     259    ASSERT(!m_capsLockIndicator);
     260    ASSERT(!m_autoFillButton);
    258261
    259262    Document& document = element().document();
     
    263266
    264267    m_innerText = TextControlInnerTextElement::create(document);
     268
    265269    if (!createsContainer) {
    266270        element().userAgentShadowRoot()->appendChild(m_innerText, IGNORE_EXCEPTION);
     
    269273    }
    270274
    271     ShadowRoot* shadowRoot = element().userAgentShadowRoot();
    272     m_container = TextControlInnerContainer::create(document);
    273     m_container->setPseudo(AtomicString("-webkit-textfield-decoration-container", AtomicString::ConstructFromLiteral));
    274     shadowRoot->appendChild(m_container, IGNORE_EXCEPTION);
    275 
    276     m_innerBlock = TextControlInnerElement::create(document);
    277     m_innerBlock->appendChild(m_innerText, IGNORE_EXCEPTION);
    278     m_container->appendChild(m_innerBlock, IGNORE_EXCEPTION);
    279 
     275    createContainer();
    280276    updatePlaceholderText();
    281277
     
    294290        m_container->appendChild(m_capsLockIndicator, IGNORE_EXCEPTION);
    295291    }
     292
     293    updateAutoFillButton();
    296294}
    297295
     
    320318{
    321319    return m_capsLockIndicator.get();
     320}
     321
     322HTMLElement* TextFieldInputType::autoFillButtonElement() const
     323{
     324    return m_autoFillButton.get();
    322325}
    323326
     
    337340    m_innerSpinButton = nullptr;
    338341    m_capsLockIndicator = nullptr;
     342    m_autoFillButton = nullptr;
    339343    m_container = nullptr;
    340344}
     
    457461        m_placeholder->setInlineStyleProperty(CSSPropertyDisplay, element().isPlaceholderVisible() ? CSSValueBlock : CSSValueNone, true);
    458462        element().userAgentShadowRoot()->insertBefore(m_placeholder, m_container ? m_container.get() : innerTextElement(), ASSERT_NO_EXCEPTION);
     463       
    459464    }
    460465    m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION);
     
    564569}
    565570
     571bool TextFieldInputType::shouldDrawAutoFillButton() const
     572{
     573    return element().showAutoFillButton();
     574}
     575
     576void TextFieldInputType::autoFillButtonElementWasClicked()
     577{
     578    Page* page = element().document().page();
     579    if (!page)
     580        return;
     581
     582    page->chrome().client().handleAutoFillButtonClick(element());
     583}
     584
     585void TextFieldInputType::createContainer()
     586{
     587    ASSERT(!m_container);
     588
     589    m_container = TextControlInnerContainer::create(element().document());
     590    m_container->setPseudo(AtomicString("-webkit-textfield-decoration-container", AtomicString::ConstructFromLiteral));
     591
     592    m_innerBlock = TextControlInnerElement::create(element().document());
     593    m_innerBlock->appendChild(m_innerText, IGNORE_EXCEPTION);
     594    m_container->appendChild(m_innerBlock, IGNORE_EXCEPTION);
     595
     596    element().userAgentShadowRoot()->appendChild(m_container, IGNORE_EXCEPTION);
     597}
     598
     599void TextFieldInputType::createAutoFillButton()
     600{
     601    ASSERT(!m_autoFillButton);
     602
     603    m_autoFillButton = AutoFillButtonElement::create(element().document(), *this);
     604    m_autoFillButton->setPseudo(AtomicString("-webkit-auto-fill-button", AtomicString::ConstructFromLiteral));
     605    m_container->appendChild(m_autoFillButton, IGNORE_EXCEPTION);
     606}
     607
     608void TextFieldInputType::updateAutoFillButton()
     609{
     610    if (shouldDrawAutoFillButton()) {
     611        if (!m_container)
     612            createContainer();
     613
     614        if (!m_autoFillButton)
     615            createAutoFillButton();
     616
     617        m_autoFillButton->setInlineStyleProperty(CSSPropertyDisplay, CSSValueBlock, true);
     618        return;
     619    }
     620   
     621    if (m_autoFillButton)
     622        m_autoFillButton->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone, true);       
     623}
     624
    566625} // namespace WebCore
  • trunk/Source/WebCore/html/TextFieldInputType.h

    r180490 r181408  
    3232#define TextFieldInputType_h
    3333
     34#include "AutoFillButtonElement.h"
    3435#include "InputType.h"
    3536#include "SpinButtonElement.h"
     
    4243// The class represents types of which UI contain text fields.
    4344// It supports not only the types for BaseTextInputType but also type=number.
    44 class TextFieldInputType : public InputType, protected SpinButtonElement::SpinButtonOwner {
     45class TextFieldInputType : public InputType, protected SpinButtonElement::SpinButtonOwner, protected AutoFillButtonElement::AutoFillButtonOwner {
    4546protected:
    4647    explicit TextFieldInputType(HTMLInputElement&);
     
    5455    virtual HTMLElement* innerSpinButtonElement() const override final;
    5556    virtual HTMLElement* capsLockIndicatorElement() const override final;
     57    virtual HTMLElement* autoFillButtonElement() const override final;
    5658
    5759protected:
     
    9799    virtual void subtreeHasChanged() override final;
    98100    virtual void capsLockStateMayHaveChanged() override final;
     101    virtual void updateAutoFillButton() override final;
    99102
    100103    // SpinButtonElement::SpinButtonOwner functions.
     
    105108    virtual void spinButtonStepUp() override final;
    106109
     110    // AutoFillButtonElement::AutoFillButtonOwner
     111    virtual void autoFillButtonElementWasClicked() override final;
     112
    107113    bool shouldHaveSpinButton() const;
    108114    bool shouldHaveCapsLockIndicator() const;
    109115    bool shouldDrawCapsLockIndicator() const;
     116    bool shouldDrawAutoFillButton() const;
     117
     118    void createContainer();
     119    void createAutoFillButton();
    110120
    111121    RefPtr<HTMLElement> m_container;
     
    115125    RefPtr<SpinButtonElement> m_innerSpinButton;
    116126    RefPtr<HTMLElement> m_capsLockIndicator;
     127    RefPtr<HTMLElement> m_autoFillButton;
    117128};
    118129
  • trunk/Source/WebCore/page/ChromeClient.h

    r180607 r181408  
    446446    virtual bool shouldDispatchFakeMouseMoveEvents() const { return true; }
    447447
     448    virtual void handleAutoFillButtonClick(HTMLInputElement&) { }
     449
    448450protected:
    449451    virtual ~ChromeClient() { }
  • trunk/Source/WebCore/testing/Internals.cpp

    r181371 r181408  
    10371037        return;
    10381038    }
    1039     inputElement->setAutofilled(enabled);
    1040 }
     1039    inputElement->setAutoFilled(enabled);
     1040}
     1041
     1042void Internals::setShowAutoFillButton(Element* element, bool show, ExceptionCode& ec)
     1043{
     1044    HTMLInputElement* inputElement = element->toInputElement();
     1045    if (!inputElement) {
     1046        ec = INVALID_ACCESS_ERR;
     1047        return;
     1048    }
     1049    inputElement->setShowAutoFillButton(show);
     1050}
     1051
    10411052
    10421053void Internals::scrollElementToRect(Element* element, long x, long y, long w, long h, ExceptionCode& ec)
  • trunk/Source/WebCore/testing/Internals.h

    r181291 r181408  
    162162    void setEditingValue(Element* inputElement, const String&, ExceptionCode&);
    163163    void setAutofilled(Element*, bool enabled, ExceptionCode&);
     164    void setShowAutoFillButton(Element*, bool enabled, ExceptionCode&);
    164165    void scrollElementToRect(Element*, long x, long y, long w, long h, ExceptionCode&);
    165166
  • trunk/Source/WebCore/testing/Internals.idl

    r181291 r181408  
    117117    [RaisesException] void setEditingValue(Element inputElement, DOMString value);
    118118    [RaisesException] void setAutofilled(Element inputElement, boolean enabled);
     119    [RaisesException] void setShowAutoFillButton(Element inputElement, boolean enabled);
    119120    [RaisesException] unsigned long countMatchesForText(DOMString text, unsigned long findOptions, DOMString markMatches);
    120121
  • trunk/Source/WebKit/mac/ChangeLog

    r181342 r181408  
     12015-03-10  Sam Weinig  <sam@webkit.org>
     2
     3        Allow adding a button in input elements for auto fill related functionality
     4        <rdar://problem/19782066>
     5        https://bugs.webkit.org/show_bug.cgi?id=142564
     6
     7        Reviewed by Anders Carlsson.
     8
     9        * DOM/WebDOMOperations.mm:
     10        (-[DOMHTMLInputElement _setAutofilled:]):
     11        Update for consistent spelling of AutoFill.
     12
    1132015-03-10  Timothy Horton  <timothy_horton@apple.com>
    214
  • trunk/Source/WebKit/mac/DOM/WebDOMOperations.mm

    r179294 r181408  
    215215- (void)_setAutofilled:(BOOL)autofilled
    216216{
    217     downcast<HTMLInputElement>(core((DOMElement *)self))->setAutofilled(autofilled);
     217    downcast<HTMLInputElement>(core((DOMElement *)self))->setAutoFilled(autofilled);
    218218}
    219219
  • trunk/Source/WebKit/win/DOMHTMLClasses.cpp

    r179770 r181408  
    13461346    ASSERT(is<HTMLInputElement>(m_element));
    13471347    HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
    1348     inputElement.setAutofilled(!!filled);
     1348    inputElement.setAutoFilled(!!filled);
    13491349    return S_OK;
    13501350}
     
    13551355    ASSERT(is<HTMLInputElement>(m_element));
    13561356    HTMLInputElement& inputElement = downcast<HTMLInputElement>(*m_element);
    1357     *result = inputElement.isAutofilled() ? TRUE : FALSE;
     1357    *result = inputElement.isAutoFilled() ? TRUE : FALSE;
    13581358    return S_OK;
    13591359}
  • trunk/Source/WebKit2/ChangeLog

    r181400 r181408  
     12015-03-10  Sam Weinig  <sam@webkit.org>
     2
     3        Allow adding a button in input elements for auto fill related functionality
     4        <rdar://problem/19782066>
     5        https://bugs.webkit.org/show_bug.cgi?id=142564
     6
     7        Reviewed by Anders Carlsson.
     8
     9        - Adds new SPI to respond to clicks on the AutoFill button (both bundle and UIProcess).
     10        - Adds new SPI to enable/disable the display of the AutoFill button on an element.
     11        - Adds new SPI to get the bounds of the AutoFill button.
     12        - Updates spelling of AutoFill to be consistent.
     13
     14        * UIProcess/API/APIUIClient.h:
     15        (API::UIClient::didClickAutoFillButton):
     16        * UIProcess/API/C/WKPage.cpp:
     17        (WKPageSetPageUIClient):
     18        * UIProcess/API/C/WKPageUIClient.h:
     19        * UIProcess/WebPageProxy.cpp:
     20        (WebKit::WebPageProxy::handleAutoFillButtonClick):
     21        * UIProcess/WebPageProxy.h:
     22        * UIProcess/WebPageProxy.messages.in:
     23        * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h:
     24        (API::InjectedBundle::PageUIClient::didClickAutoFillButton):
     25        * WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
     26        (WebKit::InjectedBundlePageUIClient::didClickAutoFillButton):
     27        * WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
     28        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     29        (WebKit::WebChromeClient::handleAutoFillButtonClick):
     30        * WebProcess/WebCoreSupport/WebChromeClient.h:
     31        * WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h:
     32        Pipe the didClickAutoFillButton to the SPI layer.
     33
     34        * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm:
     35        (-[WKWebProcessPlugInNodeHandle HTMLInputElementIsAutoFilled]):
     36        (-[WKWebProcessPlugInNodeHandle setHTMLInputElementIsAutoFilled:]):
     37        Update for new spelling of AutoFill.
     38
     39        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h:
     40        * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp:
     41        (WKBundleNodeHandleGetHTMLInputElementAutoFilled):
     42        (WKBundleNodeHandleSetHTMLInputElementAutoFilled):
     43        Added. Replaces WKBundleNodeHandleGetHTMLInputElementAutofilled/WKBundleNodeHandleSetHTMLInputElementAutofilled
     44        which are now deprecated due to inconsistent spelling of AutoFill.
     45
     46        (WKBundleNodeHandleGetHTMLInputElementAutoFillButtonEnabled):
     47        (WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabled):
     48        (WKBundleNodeHandleGetHTMLInputElementAutoFillButtonBounds):
     49        Added.
     50
     51        (WKBundleNodeHandleGetHTMLInputElementAutofilled):
     52        (WKBundleNodeHandleSetHTMLInputElementAutofilled):
     53        Deprecated.
     54
     55        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
     56        (WebKit::InjectedBundleNodeHandle::getOrCreate):
     57        (WebKit::InjectedBundleNodeHandle::create):
     58        (WebKit::InjectedBundleNodeHandle::InjectedBundleNodeHandle):
     59        (WebKit::InjectedBundleNodeHandle::~InjectedBundleNodeHandle):
     60        (WebKit::InjectedBundleNodeHandle::coreNode):
     61        (WebKit::InjectedBundleNodeHandle::document):
     62        (WebKit::InjectedBundleNodeHandle::elementBounds):
     63        (WebKit::InjectedBundleNodeHandle::renderRect):
     64        (WebKit::InjectedBundleNodeHandle::renderedImage):
     65        (WebKit::InjectedBundleNodeHandle::visibleRange):
     66        (WebKit::InjectedBundleNodeHandle::setHTMLInputElementValueForUser):
     67        (WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutoFilled):
     68        (WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutoFilled):
     69        (WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutoFillButtonEnabled):
     70        (WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutoFillButtonEnabled):
     71        (WebKit::InjectedBundleNodeHandle::htmlInputElementAutoFillButtonBounds):
     72        (WebKit::InjectedBundleNodeHandle::htmlInputElementLastChangeWasUserEdit):
     73        (WebKit::InjectedBundleNodeHandle::htmlTextAreaElementLastChangeWasUserEdit):
     74        (WebKit::InjectedBundleNodeHandle::isTextField):
     75        (WebKit::InjectedBundleNodeHandle::htmlTableCellElementCellAbove):
     76        (WebKit::InjectedBundleNodeHandle::documentFrame):
     77        (WebKit::InjectedBundleNodeHandle::htmlFrameElementContentFrame):
     78        (WebKit::InjectedBundleNodeHandle::htmlIFrameElementContentFrame):
     79        (WebKit::InjectedBundleNodeHandle::isHTMLInputElementAutofilled): Deleted.
     80        (WebKit::InjectedBundleNodeHandle::setHTMLInputElementAutofilled): Deleted.
     81        * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
     82        Fix-up InjectedBundleNodeHandle to store its underlying Node in a Ref, rather than a RefPtr.
     83        Add helpers to implement the new SPI for WKBundleNodeHandleRef.
     84
    1852015-03-11  Timothy Horton  <timothy_horton@apple.com>
    286
  • trunk/Source/WebKit2/UIProcess/API/APIUIClient.h

    r177699 r181408  
    156156    virtual void didNotHandleTapAsClick(const WebCore::IntPoint&) { }
    157157#endif
     158
     159    virtual void didClickAutoFillButton(WebKit::WebPageProxy&, API::Object*) { }
    158160};
    159161
  • trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp

    r180411 r181408  
    17451745            m_client.isPlayingAudioDidChange(toAPI(&page), m_client.base.clientInfo);
    17461746        }
     1747
     1748        virtual void didClickAutoFillButton(WebPageProxy& page, API::Object* userInfo) override
     1749        {
     1750            if (!m_client.didClickAutoFillButton)
     1751                return;
     1752
     1753            m_client.didClickAutoFillButton(toAPI(&page), toAPI(userInfo), m_client.base.clientInfo);
     1754        }
    17471755    };
    17481756
  • trunk/Source/WebKit2/UIProcess/API/C/WKPageUIClient.h

    r177747 r181408  
    9292typedef void (*WKPageIsPlayingAudioDidChangeCallback)(WKPageRef page, const void* clientInfo);
    9393typedef void (*WKPageDecidePolicyForUserMediaPermissionRequestCallback)(WKPageRef page, WKFrameRef frame, WKSecurityOriginRef origin, WKUserMediaPermissionRequestRef permissionRequest, const void* clientInfo);
    94 
    95 // Deprecated   
     94typedef void (*WKPageDidClickAutoFillButtonCallback)(WKPageRef page, WKTypeRef userData, const void *clientInfo);
     95
     96// Deprecated
    9697typedef WKPageRef (*WKPageCreateNewPageCallback_deprecatedForUseWithV0)(WKPageRef page, WKDictionaryRef features, WKEventModifiers modifiers, WKEventMouseButton mouseButton, const void *clientInfo);
    9798typedef void      (*WKPageMouseDidMoveOverElementCallback_deprecatedForUseWithV0)(WKPageRef page, WKEventModifiers modifiers, WKTypeRef userData, const void *clientInfo);
     
    446447    // Version 5.
    447448    WKPageDecidePolicyForUserMediaPermissionRequestCallback             decidePolicyForUserMediaPermissionRequest;
     449    WKPageDidClickAutoFillButtonCallback                                didClickAutoFillButton;
    448450} WKPageUIClientV5;
    449451
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r181317 r181408  
    55935593}
    55945594
     5595void WebPageProxy::handleAutoFillButtonClick(const UserData& userData)
     5596{
     5597    m_uiClient->didClickAutoFillButton(*this, m_process->transformHandlesToObjects(userData.object()).get());
     5598}
     5599
    55955600} // namespace WebKit
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r181317 r181408  
    13851385#endif
    13861386
     1387    void handleAutoFillButtonClick(const UserData&);
     1388
    13871389    PageClient& m_pageClient;
    13881390    std::unique_ptr<API::LoaderClient> m_loaderClient;
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in

    r181023 r181408  
    424424    DidPerformActionMenuHitTest(struct WebKit::ActionMenuHitTestResult result, bool forImmediateAction, WebKit::UserData userData)
    425425#endif
     426
     427    HandleAutoFillButtonClick(WebKit::UserData userData);
    426428}
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h

    r177639 r181408  
    3434
    3535namespace WebKit {
     36class InjectedBundleNodeHandle;
    3637class WebFrame;
    3738class WebPage;
     
    9091    virtual void didRecognizeLongMousePress(WebKit::WebPage*, RefPtr<API::Object>& userData) { UNUSED_PARAM(userData); }
    9192    virtual void didCancelTrackingPotentialLongMousePress(WebKit::WebPage*, RefPtr<API::Object>& userData) { UNUSED_PARAM(userData); }
     93
     94    virtual void didClickAutoFillButton(WebKit::WebPage&, WebKit::InjectedBundleNodeHandle&, RefPtr<API::Object>&) { }
    9295};
    9396
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm

    r166936 r181408  
    7171- (BOOL)HTMLInputElementIsAutoFilled
    7272{
    73     return _nodeHandle->isHTMLInputElementAutofilled();
     73    return _nodeHandle->isHTMLInputElementAutoFilled();
    7474}
    7575
    7676- (void)setHTMLInputElementIsAutoFilled:(BOOL)isAutoFilled
    7777{
    78     _nodeHandle->setHTMLInputElementAutofilled(isAutoFilled);
     78    _nodeHandle->setHTMLInputElementAutoFilled(isAutoFilled);
    7979}
    8080
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp

    r172780 r181408  
    8181}
    8282
    83 bool WKBundleNodeHandleGetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandleRef)
     83bool WKBundleNodeHandleGetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandleRef)
    8484{
    85     return toImpl(htmlInputElementHandleRef)->isHTMLInputElementAutofilled();
     85    return toImpl(htmlInputElementHandleRef)->isHTMLInputElementAutoFilled();
    8686}
    8787
    88 void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandleRef, bool filled)
     88void WKBundleNodeHandleSetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandleRef, bool filled)
    8989{
    90     toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutofilled(filled);
     90    toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutoFilled(filled);
     91}
     92
     93bool WKBundleNodeHandleGetHTMLInputElementAutoFillButtonEnabled(WKBundleNodeHandleRef htmlInputElementHandleRef)
     94{
     95    return toImpl(htmlInputElementHandleRef)->isHTMLInputElementAutoFillButtonEnabled();
     96}
     97
     98void WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabled(WKBundleNodeHandleRef htmlInputElementHandleRef, bool enabled)
     99{
     100    toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutoFillButtonEnabled(enabled);
     101}
     102
     103WKRect WKBundleNodeHandleGetHTMLInputElementAutoFillButtonBounds(WKBundleNodeHandleRef htmlInputElementHandleRef)
     104{
     105    return toAPI(toImpl(htmlInputElementHandleRef)->htmlInputElementAutoFillButtonBounds());
    91106}
    92107
     
    124139    return toAPI(frame.release().leakRef());
    125140}
     141
     142// Deprecated - use WKBundleNodeHandleGetHTMLInputElementAutoFilled(WKBundleNodeHandleRef).
     143bool WKBundleNodeHandleGetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandleRef)
     144{
     145    return toImpl(htmlInputElementHandleRef)->isHTMLInputElementAutoFilled();
     146}
     147
     148// Deprecated - use WKBundleNodeHandleSetHTMLInputElementAutoFilled(WKBundleNodeHandleRef, bool).
     149void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandleRef, bool filled)
     150{
     151    toImpl(htmlInputElementHandleRef)->setHTMLInputElementAutoFilled(filled);
     152}
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h

    r172780 r181408  
    5353/* HTMLInputElement Specific Operations */
    5454WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementValueForUser(WKBundleNodeHandleRef htmlInputElementHandle, WKStringRef value);
    55 WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandle);
    56 WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandle, bool filled);
     55WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandle);
     56WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandle, bool filled);
     57WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutoFillButtonEnabled(WKBundleNodeHandleRef htmlInputElementHandle);
     58WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutoFillButtonEnabled(WKBundleNodeHandleRef htmlInputElementHandle, bool enabled);
     59WK_EXPORT WKRect WKBundleNodeHandleGetHTMLInputElementAutoFillButtonBounds(WKBundleNodeHandleRef htmlInputElementHandle);
    5760WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementLastChangeWasUserEdit(WKBundleNodeHandleRef htmlInputElementHandle);
    5861
     
    7275WK_EXPORT WKBundleFrameRef WKBundleNodeHandleCopyHTMLIFrameElementContentFrame(WKBundleNodeHandleRef htmlIFrameElementHandle);
    7376
     77
     78/* Deprecated - use WKBundleNodeHandleGetHTMLInputElementAutoFilled(WKBundleNodeHandleRef) */
     79WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandle);
     80/* Deprecated - use WKBundleNodeHandleSetHTMLInputElementAutoFilled(WKBundleNodeHandleRef, bool) */
     81WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutofilled(WKBundleNodeHandleRef htmlInputElementHandle, bool filled);
     82
    7483#ifdef __cplusplus
    7584}
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageUIClient.h

    r177747 r181408  
    5858typedef void (*WKBundlePageDidRecognizeLongMousePressCallback)(WKBundlePageRef page, WKTypeRef* userData, const void *clientInfo);
    5959typedef void (*WKBundlePageDidCancelTrackingPotentialLongMousePressCallback)(WKBundlePageRef page, WKTypeRef* userData, const void *clientInfo);
     60typedef void (*WKBundlePageDidClickAutoFillButtonCallback)(WKBundlePageRef page, WKBundleNodeHandleRef inputElement, WKTypeRef* userData, const void *clientInfo);
    6061
    6162typedef struct WKBundlePageUIClientBase {
     
    170171    WKBundlePageDidRecognizeLongMousePressCallback                      didRecognizeLongMousePress;
    171172    WKBundlePageDidCancelTrackingPotentialLongMousePressCallback        didCancelTrackingPotentialLongMousePress;
     173
     174    WKBundlePageDidClickAutoFillButtonCallback                          didClickAutoFillButton;
    172175} WKBundlePageUIClientV3;
    173176
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp

    r174117 r181408  
    6969}
    7070
    71 PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::getOrCreate(JSContextRef, JSObjectRef object)
     71RefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::getOrCreate(JSContextRef, JSObjectRef object)
    7272{
    7373    Node* node = JSNode::toWrapped(toJS(object));
     
    7575}
    7676
    77 PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::getOrCreate(Node* node)
     77RefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::getOrCreate(Node* node)
    7878{
    7979    if (!node)
    80         return 0;
    81 
    82     DOMHandleCache::AddResult result = domHandleCache().add(node, nullptr);
     80        return nullptr;
     81
     82    return InjectedBundleNodeHandle::getOrCreate(*node);
     83}
     84
     85Ref<InjectedBundleNodeHandle> InjectedBundleNodeHandle::getOrCreate(Node& node)
     86{
     87    DOMHandleCache::AddResult result = domHandleCache().add(&node, nullptr);
    8388    if (!result.isNewEntry)
    84         return PassRefPtr<InjectedBundleNodeHandle>(result.iterator->value);
    85 
    86     RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::create(node);
    87     result.iterator->value = nodeHandle.get();
    88     return nodeHandle.release();
    89 }
    90 
    91 PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::create(Node* node)
    92 {
    93     return adoptRef(new InjectedBundleNodeHandle(node));
    94 }
    95 
    96 InjectedBundleNodeHandle::InjectedBundleNodeHandle(Node* node)
     89        return Ref<InjectedBundleNodeHandle>(*result.iterator->value);
     90
     91    Ref<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::create(node);
     92    result.iterator->value = nodeHandle.ptr();
     93    return nodeHandle;
     94}
     95
     96Ref<InjectedBundleNodeHandle> InjectedBundleNodeHandle::create(Node& node)
     97{
     98    return adoptRef(*new InjectedBundleNodeHandle(node));
     99}
     100
     101InjectedBundleNodeHandle::InjectedBundleNodeHandle(Node& node)
    97102    : m_node(node)
    98103{
     
    101106InjectedBundleNodeHandle::~InjectedBundleNodeHandle()
    102107{
    103     domHandleCache().remove(m_node.get());
    104 }
    105 
    106 Node* InjectedBundleNodeHandle::coreNode() const
    107 {
    108     return m_node.get();
    109 }
    110 
    111 PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::document()
    112 {
    113     return getOrCreate(&m_node->document());
     108    domHandleCache().remove(m_node.ptr());
     109}
     110
     111Node* InjectedBundleNodeHandle::coreNode()
     112{
     113    return m_node.ptr();
     114}
     115
     116Ref<InjectedBundleNodeHandle> InjectedBundleNodeHandle::document()
     117{
     118    return getOrCreate(m_node->document());
    114119}
    115120
     
    117122// Note: These should only be operations that are not exposed to JavaScript.
    118123
    119 IntRect InjectedBundleNodeHandle::elementBounds() const
    120 {
    121     if (!is<Element>(*m_node))
     124IntRect InjectedBundleNodeHandle::elementBounds()
     125{
     126    if (!is<Element>(m_node))
    122127        return IntRect();
    123128
    124     return downcast<Element>(*m_node).boundsInRootViewSpace();
     129    return downcast<Element>(m_node.get()).boundsInRootViewSpace();
    125130}
    126131   
    127 IntRect InjectedBundleNodeHandle::renderRect(bool* isReplaced) const
    128 {
    129     return m_node.get()->pixelSnappedRenderRect(isReplaced);
     132IntRect InjectedBundleNodeHandle::renderRect(bool* isReplaced)
     133{
     134    return m_node->pixelSnappedRenderRect(isReplaced);
    130135}
    131136
     
    167172    Frame* frame = m_node->document().frame();
    168173    if (!frame)
    169         return 0;
     174        return nullptr;
    170175
    171176    FrameView* frameView = frame->view();
    172177    if (!frameView)
    173         return 0;
     178        return nullptr;
    174179
    175180    m_node->document().updateLayout();
     
    177182    RenderObject* renderer = m_node->renderer();
    178183    if (!renderer)
    179         return 0;
     184        return nullptr;
    180185
    181186    LayoutRect topLevelRect;
    182187    IntRect paintingRect = snappedIntRect(renderer->paintingRootRect(topLevelRect));
    183188
    184     frameView->setNodeToDraw(m_node.get());
     189    frameView->setNodeToDraw(m_node.ptr());
    185190    RefPtr<WebImage> image = imageForRect(frameView, paintingRect, options);
    186191    frameView->setNodeToDraw(0);
     
    189194}
    190195
    191 PassRefPtr<InjectedBundleRangeHandle> InjectedBundleNodeHandle::visibleRange() const
    192 {
    193     VisiblePosition start = firstPositionInNode(m_node.get());
    194     VisiblePosition end = lastPositionInNode(m_node.get());
     196PassRefPtr<InjectedBundleRangeHandle> InjectedBundleNodeHandle::visibleRange()
     197{
     198    VisiblePosition start = firstPositionInNode(m_node.ptr());
     199    VisiblePosition end = lastPositionInNode(m_node.ptr());
    195200
    196201    RefPtr<Range> range = makeRange(start, end);
     
    200205void InjectedBundleNodeHandle::setHTMLInputElementValueForUser(const String& value)
    201206{
    202     if (!is<HTMLInputElement>(*m_node))
     207    if (!is<HTMLInputElement>(m_node))
    203208        return;
    204209
    205     downcast<HTMLInputElement>(*m_node).setValueForUser(value);
    206 }
    207 
    208 bool InjectedBundleNodeHandle::isHTMLInputElementAutofilled() const
    209 {
    210     if (!is<HTMLInputElement>(*m_node))
     210    downcast<HTMLInputElement>(m_node.get()).setValueForUser(value);
     211}
     212
     213bool InjectedBundleNodeHandle::isHTMLInputElementAutoFilled() const
     214{
     215    if (!is<HTMLInputElement>(m_node))
    211216        return false;
    212217   
    213     return downcast<HTMLInputElement>(*m_node).isAutofilled();
    214 }
    215 
    216 void InjectedBundleNodeHandle::setHTMLInputElementAutofilled(bool filled)
    217 {
    218     if (!is<HTMLInputElement>(*m_node))
     218    return downcast<HTMLInputElement>(m_node.get()).isAutoFilled();
     219}
     220
     221void InjectedBundleNodeHandle::setHTMLInputElementAutoFilled(bool filled)
     222{
     223    if (!is<HTMLInputElement>(m_node))
    219224        return;
    220225
    221     downcast<HTMLInputElement>(*m_node).setAutofilled(filled);
     226    downcast<HTMLInputElement>(m_node.get()).setAutoFilled(filled);
     227}
     228
     229bool InjectedBundleNodeHandle::isHTMLInputElementAutoFillButtonEnabled() const
     230{
     231    if (!is<HTMLInputElement>(m_node))
     232        return false;
     233   
     234    return downcast<HTMLInputElement>(m_node.get()).showAutoFillButton();
     235}
     236
     237void InjectedBundleNodeHandle::setHTMLInputElementAutoFillButtonEnabled(bool filled)
     238{
     239    if (!is<HTMLInputElement>(m_node))
     240        return;
     241
     242    downcast<HTMLInputElement>(m_node.get()).setShowAutoFillButton(filled);
     243}
     244
     245IntRect InjectedBundleNodeHandle::htmlInputElementAutoFillButtonBounds()
     246{
     247    if (!is<HTMLInputElement>(m_node))
     248        return IntRect();
     249
     250    auto autoFillButton = downcast<HTMLInputElement>(m_node.get()).autoFillButtonElement();
     251    if (!autoFillButton)
     252        return IntRect();
     253
     254    return autoFillButton->boundsInRootViewSpace();
    222255}
    223256
    224257bool InjectedBundleNodeHandle::htmlInputElementLastChangeWasUserEdit()
    225258{
    226     if (!is<HTMLInputElement>(*m_node))
    227         return false;
    228 
    229     return downcast<HTMLInputElement>(*m_node).lastChangeWasUserEdit();
     259    if (!is<HTMLInputElement>(m_node))
     260        return false;
     261
     262    return downcast<HTMLInputElement>(m_node.get()).lastChangeWasUserEdit();
    230263}
    231264
    232265bool InjectedBundleNodeHandle::htmlTextAreaElementLastChangeWasUserEdit()
    233266{
    234     if (!is<HTMLTextAreaElement>(*m_node))
    235         return false;
    236 
    237     return downcast<HTMLTextAreaElement>(*m_node).lastChangeWasUserEdit();
     267    if (!is<HTMLTextAreaElement>(m_node))
     268        return false;
     269
     270    return downcast<HTMLTextAreaElement>(m_node.get()).lastChangeWasUserEdit();
    238271}
    239272
    240273bool InjectedBundleNodeHandle::isTextField() const
    241274{
    242     return is<HTMLInputElement>(*m_node) && downcast<HTMLInputElement>(*m_node).isText();
     275    if (!is<HTMLInputElement>(m_node))
     276        return false;
     277
     278    return downcast<HTMLInputElement>(m_node.get()).isText();
    243279}
    244280
    245281PassRefPtr<InjectedBundleNodeHandle> InjectedBundleNodeHandle::htmlTableCellElementCellAbove()
    246282{
    247     if (!m_node->hasTagName(tdTag))
    248         return nullptr;
    249 
    250     return getOrCreate(static_cast<HTMLTableCellElement&>(*m_node).cellAbove());
     283    if (!is<HTMLTableCellElement>(m_node))
     284        return nullptr;
     285
     286    return getOrCreate(downcast<HTMLTableCellElement>(m_node.get()).cellAbove());
    251287}
    252288
     
    256292        return nullptr;
    257293
    258     Frame* frame = static_cast<Document*>(m_node.get())->frame();
     294    Frame* frame = downcast<Document>(m_node.get()).frame();
    259295    if (!frame)
    260296        return nullptr;
     
    265301PassRefPtr<WebFrame> InjectedBundleNodeHandle::htmlFrameElementContentFrame()
    266302{
    267     if (!m_node->hasTagName(frameTag))
    268         return nullptr;
    269 
    270     Frame* frame = static_cast<HTMLFrameElement*>(m_node.get())->contentFrame();
     303    if (!is<HTMLFrameElement>(m_node))
     304        return nullptr;
     305
     306    Frame* frame = downcast<HTMLFrameElement>(m_node.get()).contentFrame();
    271307    if (!frame)
    272308        return nullptr;
     
    277313PassRefPtr<WebFrame> InjectedBundleNodeHandle::htmlIFrameElementContentFrame()
    278314{
    279     if (!is<HTMLIFrameElement>(*m_node))
    280         return nullptr;
    281 
    282     Frame* frame = downcast<HTMLIFrameElement>(*m_node).contentFrame();
     315    if (!is<HTMLIFrameElement>(m_node))
     316        return nullptr;
     317
     318    Frame* frame = downcast<HTMLIFrameElement>(m_node.get()).contentFrame();
    283319    if (!frame)
    284320        return nullptr;
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h

    r172780 r181408  
    4848class InjectedBundleNodeHandle : public API::ObjectImpl<API::Object::Type::BundleNodeHandle> {
    4949public:
    50     static PassRefPtr<InjectedBundleNodeHandle> getOrCreate(JSContextRef, JSObjectRef);
    51     static PassRefPtr<InjectedBundleNodeHandle> getOrCreate(WebCore::Node*);
     50    static RefPtr<InjectedBundleNodeHandle> getOrCreate(JSContextRef, JSObjectRef);
     51    static RefPtr<InjectedBundleNodeHandle> getOrCreate(WebCore::Node*);
     52    static Ref<InjectedBundleNodeHandle> getOrCreate(WebCore::Node&);
    5253
    5354    virtual ~InjectedBundleNodeHandle();
    5455
    55     WebCore::Node* coreNode() const;
     56    WebCore::Node* coreNode();
    5657
    5758    // Convenience DOM Operations
    58     PassRefPtr<InjectedBundleNodeHandle> document();
     59    Ref<InjectedBundleNodeHandle> document();
    5960
    6061    // Additional DOM Operations
    6162    // Note: These should only be operations that are not exposed to JavaScript.
    62     WebCore::IntRect elementBounds() const;
    63     WebCore::IntRect renderRect(bool*) const;
     63    WebCore::IntRect elementBounds();
     64    WebCore::IntRect renderRect(bool*);
    6465    PassRefPtr<WebImage> renderedImage(SnapshotOptions);
    65     PassRefPtr<InjectedBundleRangeHandle> visibleRange() const;
     66    PassRefPtr<InjectedBundleRangeHandle> visibleRange();
    6667    void setHTMLInputElementValueForUser(const String&);
    67     bool isHTMLInputElementAutofilled() const;
    68     void setHTMLInputElementAutofilled(bool);
     68    bool isHTMLInputElementAutoFilled() const;
     69    void setHTMLInputElementAutoFilled(bool);
     70    bool isHTMLInputElementAutoFillButtonEnabled() const;
     71    void setHTMLInputElementAutoFillButtonEnabled(bool);
     72    WebCore::IntRect htmlInputElementAutoFillButtonBounds();
    6973    bool htmlInputElementLastChangeWasUserEdit();
    7074    bool htmlTextAreaElementLastChangeWasUserEdit();
     
    7882
    7983private:
    80     static PassRefPtr<InjectedBundleNodeHandle> create(WebCore::Node*);
    81     InjectedBundleNodeHandle(WebCore::Node*);
     84    static Ref<InjectedBundleNodeHandle> create(WebCore::Node&);
     85    InjectedBundleNodeHandle(WebCore::Node&);
    8286
    83     RefPtr<WebCore::Node> m_node;
     87    Ref<WebCore::Node> m_node;
    8488};
    8589
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp

    r177671 r181408  
    2929#include "APISecurityOrigin.h"
    3030#include "InjectedBundleHitTestResult.h"
     31#include "InjectedBundleNodeHandle.h"
    3132#include "WKAPICast.h"
    3233#include "WKBundleAPICast.h"
     
    234235}
    235236
     237void InjectedBundlePageUIClient::didClickAutoFillButton(WebPage& page, InjectedBundleNodeHandle& nodeHandle, RefPtr<API::Object>& userData)
     238{
     239    if (!m_client.didClickAutoFillButton)
     240        return;
     241
     242    WKTypeRef userDataToPass = nullptr;
     243    m_client.didClickAutoFillButton(toAPI(&page), toAPI(&nodeHandle), &userDataToPass, m_client.base.clientInfo);
     244    userData = adoptRef(toImpl(userDataToPass));
     245}
     246
    236247} // namespace WebKit
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageUIClient.h

    r177639 r181408  
    7474    void didRecognizeLongMousePress(WebPage*, RefPtr<API::Object>& userData) override;
    7575    void didCancelTrackingPotentialLongMousePress(WebPage*, RefPtr<API::Object>& userData) override;
     76
     77    void didClickAutoFillButton(WebPage&, InjectedBundleNodeHandle&, RefPtr<API::Object>& userData) override;
    7678};
    7779
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r181023 r181408  
    3131#include "DrawingArea.h"
    3232#include "InjectedBundleNavigationAction.h"
     33#include "InjectedBundleNodeHandle.h"
    3334#include "LayerTreeHost.h"
    3435#include "NavigationActionData.h"
     
    11021103}
    11031104
     1105void WebChromeClient::handleAutoFillButtonClick(HTMLInputElement& inputElement)
     1106{
     1107    RefPtr<API::Object> userData;
     1108
     1109    // Notify the bundle client.
     1110    auto nodeHandle = InjectedBundleNodeHandle::getOrCreate(inputElement);
     1111    m_page->injectedBundleUIClient().didClickAutoFillButton(*m_page, nodeHandle.get(), userData);
     1112
     1113    // Notify the UIProcess.
     1114    m_page->send(Messages::WebPageProxy::HandleAutoFillButtonClick(UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
     1115}
     1116
    11041117} // namespace WebKit
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

    r180607 r181408  
    311311    virtual bool shouldDispatchFakeMouseMoveEvents() const override;
    312312
     313    virtual void handleAutoFillButtonClick(WebCore::HTMLInputElement&) override;
     314
    313315    String m_cachedToolTip;
    314316    mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame;
  • trunk/Tools/ChangeLog

    r181405 r181408  
     12015-03-10  Sam Weinig  <sam@webkit.org>
     2
     3        Allow adding a button in input elements for auto fill related functionality
     4        <rdar://problem/19782066>
     5        https://bugs.webkit.org/show_bug.cgi?id=142564
     6
     7        Reviewed by Anders Carlsson.
     8
     9        * WebKitTestRunner/TestController.cpp:
     10        (WTR::TestController::createOtherPage):
     11        (WTR::TestController::createWebViewWithOptions):
     12        Update for new callback.
     13
    1142015-03-11  Benjamin Poulain  <bpoulain@apple.com>
    215
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r181071 r181408  
    257257        0, // isPlayingAudioDidChange
    258258        decidePolicyForUserMediaPermissionRequest,
     259        0, // didClickAutofillButton
    259260    };
    260261    WKPageSetPageUIClient(newPage, &otherPageUIClient.base);
     
    494495        0, // isPlayingAudioDidChange
    495496        decidePolicyForUserMediaPermissionRequest,
     497        0, // didClickAutofillButton
    496498    };
    497499    WKPageSetPageUIClient(m_mainWebView->page(), &pageUIClient.base);
Note: See TracChangeset for help on using the changeset viewer.