Changeset 225879 in webkit
- Timestamp:
- Dec 13, 2017 4:29:31 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 14 added
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r225872 r225879 1 2017-12-13 Daniel Bates <dabates@apple.com> 2 3 Add more auto fill button types 4 https://bugs.webkit.org/show_bug.cgi?id=180651 5 <rdar://problem/35891125> 6 And 7 <rdar://problem/35977943> 8 9 Reviewed by Brent Fulgham. 10 11 * fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button-expected.html: Added. 12 * fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button.html: Added. 13 * fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button-expected.html: Added. 14 * fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button.html: Added. 15 * fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons-expected.html: Added. 16 * fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html: Added. 17 * fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons-expected.html: Added. 18 * fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html: Added. 19 * fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button.html: Added. 20 * fast/forms/auto-fill-button/input-strong-password-auto-fill-button.html: Added. 21 * platform/ios/fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button-expected.txt: Added. 22 * platform/ios/fast/forms/auto-fill-button/input-strong-password-auto-fill-button-expected.txt: Added. 23 * platform/mac/fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button-expected.txt: Added. 24 * platform/mac/fast/forms/auto-fill-button/input-strong-password-auto-fill-button-expected.txt: Added. 25 1 26 2017-12-13 Zalan Bujtas <zalan@apple.com> 2 27 -
trunk/Source/WebCore/ChangeLog
r225878 r225879 1 2017-12-13 Daniel Bates <dabates@apple.com> 2 3 Add more auto fill button types 4 https://bugs.webkit.org/show_bug.cgi?id=180651 5 <rdar://problem/35891125> 6 And 7 <rdar://problem/35977943> 8 9 Reviewed by Brent Fulgham. 10 11 Tests: fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button.html 12 fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button.html 13 fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html 14 fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html 15 fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button.html 16 fast/forms/auto-fill-button/input-strong-password-auto-fill-button.html 17 18 * English.lproj/Localizable.strings: 19 * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: 20 (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): Add strings for new auto fill button types. 21 22 * css/CSSSelector.cpp: 23 (WebCore::CSSSelector::selectorText const): 24 * css/CSSSelector.h: 25 * css/SelectorChecker.cpp: 26 (WebCore::SelectorChecker::checkOne const): 27 * css/SelectorCheckerTestFunctions.h: 28 (WebCore::isAutofilledStrongPassword): 29 * css/SelectorPseudoClassAndCompatibilityElementMap.in: 30 * css/html.css: 31 (input::-webkit-strong-password-auto-fill-button): 32 (input:-webkit-autofill-strong-password): 33 (input:-webkit-autofill, input:-webkit-autofill-strong-password): 34 (input:-webkit-autofill): Deleted. 35 * cssjit/SelectorCompiler.cpp: 36 (WebCore::SelectorCompiler::addPseudoClassType): 37 Add new CSS pseudo class and CSS styles. 38 39 * html/HTMLInputElement.cpp: 40 (WebCore::HTMLInputElement::reset): Hide the auto fill button when the form is reset. This is also called 41 whenever we suspend the page to put it into the page cache. 42 (WebCore::HTMLInputElement::setShowAutoFillButton): Modified to update the editability of the inner text element 43 and invalidate styles for the subtree as the editability may have changed depending on the auto fill button type. 44 45 (WebCore::autoFillStrongPasswordMaskImage): 46 (WebCore::HTMLInputElement::createInnerTextStyle): 47 (WebCore::HTMLInputElement::createInnerTextStyle const): Deleted. 48 Adjust the look of the inner text field. This function is not const because we may need to resolve style to 49 generate a mask image. 50 51 * html/HTMLInputElement.h: 52 (WebCore::HTMLInputElement::autoFillButtonType const): Fix style nit; use a C++ style cast while I am in 53 this area. 54 (WebCore::HTMLInputElement::hasAutoFillStrongPasswordButton const): Added. 55 56 * html/HTMLTextAreaElement.cpp: 57 (WebCore::HTMLTextAreaElement::createInnerTextStyle): 58 (WebCore::HTMLTextAreaElement::createInnerTextStyle const): Deleted. 59 Made this non-const because HTMLInputElement::createInnerTextStyle() needs to be non-const. See above. 60 61 * html/HTMLTextAreaElement.h: 62 * html/HTMLTextFormControlElement.cpp: 63 (WebCore::HTMLTextFormControlElement::isInnerTextElementEditable const): 64 (WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability): 65 Extract out the query to determine if the inner text element is editable into a virtual function isInnerTextElementEditable() 66 and have updateInnerTextElementEditability() make use of it. By default a field is considered editable if it is not disabled 67 or read-only. We override updateInnerTextElementEditability() in HTMLInputElement to also consider the auto fill button type. 68 69 * html/HTMLTextFormControlElement.h: 70 * html/TextFieldInputType.cpp: 71 (WebCore::autoFillButtonTypeToAccessibilityLabel): 72 (WebCore::autoFillButtonTypeToAutoFillButtonText): 73 (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName): 74 (WebCore::isAutoFillButtonTypeChanged): 75 (WebCore::TextFieldInputType::createAutoFillButton): 76 (WebCore::TextFieldInputType::updateAutoFillButton): 77 Support having text for the auto fill button. 78 79 * platform/LocalizedStrings.cpp: 80 (WebCore::AXAutoFillStrongPasswordLabel): 81 (WebCore::AXAutoFillStrongConfirmationPasswordLabel): 82 (WebCore::autoFillStrongPasswordLabel): 83 * platform/LocalizedStrings.h: 84 Add localized strings. 85 86 * rendering/RenderTextControlSingleLine.h: Disallow scrolling depending on the auto fill button type. 87 88 * testing/Internals.cpp: 89 (WebCore::toAutoFillButtonType): 90 * testing/Internals.h: 91 * testing/Internals.idl: 92 Add support for testing. 93 1 94 2017-12-13 Ryosuke Niwa <rniwa@webkit.org> 2 95 -
trunk/Source/WebCore/English.lproj/Localizable.strings
r225223 r225879 1255 1255 /* Alternative presentation button subtitle. */ 1256 1256 "alternative presentation button subtitle" = "alternative presentation button subtitle"; 1257 1258 /* Label for strong password. */ 1259 "strong password" = "strong password"; 1260 1261 /* Label for the auto fill strong password button inside a text field. */ 1262 "strong password auto fill" = "strong password auto fill"; 1263 1264 /* Label for the auto fill strong confirmation password button inside a text field. */ 1265 "strong confirmation password auto fill" = "strong confirmation password auto fill"; -
trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm
r225511 r225879 3085 3085 case AutoFillButtonType::Contacts: 3086 3086 return @"contacts"; 3087 case AutoFillButtonType::StrongConfirmationPassword: 3088 return @"strong confirmation password"; 3089 case AutoFillButtonType::StrongPassword: 3090 return @"strong password"; 3087 3091 } 3088 3092 } -
trunk/Source/WebCore/css/CSSSelector.cpp
r223728 r225879 435 435 str.appendLiteral(":-webkit-autofill"); 436 436 break; 437 case CSSSelector::PseudoClassAutofillStrongPassword: 438 str.appendLiteral(":-webkit-autofill-strong-password"); 439 break; 437 440 case CSSSelector::PseudoClassDrag: 438 441 str.appendLiteral(":-webkit-drag"); -
trunk/Source/WebCore/css/CSSSelector.h
r221788 r225879 108 108 PseudoClassAnyLinkDeprecated, 109 109 PseudoClassAutofill, 110 PseudoClassAutofillStrongPassword, 110 111 PseudoClassHover, 111 112 PseudoClassDrag, -
trunk/Source/WebCore/css/SelectorChecker.cpp
r221788 r225879 943 943 case CSSSelector::PseudoClassAutofill: 944 944 return isAutofilled(element); 945 case CSSSelector::PseudoClassAutofillStrongPassword: 946 return isAutofilledStrongPassword(element); 945 947 case CSSSelector::PseudoClassAnyLink: 946 948 case CSSSelector::PseudoClassAnyLinkDeprecated: -
trunk/Source/WebCore/css/SelectorCheckerTestFunctions.h
r208668 r225879 46 46 } 47 47 48 ALWAYS_INLINE bool isAutofilledStrongPassword(const Element& element) 49 { 50 return is<HTMLInputElement>(element) && downcast<HTMLInputElement>(element).isAutoFilled() && downcast<HTMLInputElement>(element).hasAutoFillStrongPasswordButton(); 51 } 52 48 53 ALWAYS_INLINE bool matchesDefaultPseudoClass(const Element& element) 49 54 { -
trunk/Source/WebCore/css/SelectorPseudoClassAndCompatibilityElementMap.in
r209670 r225879 3 3 -webkit-any-link, PseudoClassAnyLinkDeprecated, PseudoElementUnknown 4 4 -webkit-autofill 5 -webkit-autofill-strong-password 5 6 -webkit-drag 6 7 -webkit-full-page-media -
trunk/Source/WebCore/css/html.css
r217418 r225879 543 543 } 544 544 545 input::-webkit-strong-password-auto-fill-button { 546 flex: none !important; 547 font-family: -apple-system !important; 548 -webkit-text-security: none !important; 549 -webkit-user-select: none !important; 550 pointer-events: none !important; 551 text-align: right !important; 552 color: black !important; 553 padding-left: 6px !important; 554 } 555 545 556 input::-webkit-credentials-auto-fill-button { 546 557 -webkit-mask-image: -webkit-image-set(url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAMCAYAAAC9QufkAAAAAXNSR0IB2cksfwAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAACXBIWXMAAAsTAAALEwEAmpwYAAADyWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS40LjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iCiAgICAgICAgICAgIHhtbG5zOnRpZmY9Imh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R+YAGBMNhcFJVgETU8+xqIXCVXNtxm9cdJyU58VVhUKe/khwB+55XaeYqDC/zdoUtbzWFDPj7fQCLFjB+Vf4xaA2SvkK65iumLvwJNLkOFL79xJXfQhwlQTjsnu61r+2fEs/b4ZbzrEPMzEAAAAASUVORK5CYII=") 2x); … … 647 658 } 648 659 649 input:-webkit-autofill { 660 input:-webkit-autofill-strong-password { 661 -webkit-text-security: none !important; 662 -webkit-user-select: none !important; 663 cursor: default !important; 664 font-family: monospace; 665 } 666 667 input:-webkit-autofill, input:-webkit-autofill-strong-password { 650 668 #if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS 651 669 background-color: #F7EC87 !important; -
trunk/Source/WebCore/cssjit/SelectorCompiler.cpp
r225837 r225879 532 532 case CSSSelector::PseudoClassAutofill: 533 533 fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr(isAutofilled)); 534 return FunctionType::SimpleSelectorChecker; 535 case CSSSelector::PseudoClassAutofillStrongPassword: 536 fragment.unoptimizedPseudoClasses.append(JSC::FunctionPtr(isAutofilledStrongPassword)); 534 537 return FunctionType::SimpleSelectorChecker; 535 538 case CSSSelector::PseudoClassChecked: -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r225878 r225879 32 32 #include "AXObjectCache.h" 33 33 #include "BeforeTextInsertedEvent.h" 34 #include "CSSGradientValue.h" 34 35 #include "CSSPropertyNames.h" 36 #include "CSSValuePool.h" 35 37 #include "DateTimeChooser.h" 36 38 #include "Document.h" … … 918 920 919 921 setAutoFilled(false); 922 setShowAutoFillButton(AutoFillButtonType::None); 920 923 setChecked(hasAttributeWithoutSynchronization(checkedAttr)); 921 924 m_reflectsCheckedAttribute = true; … … 1376 1379 m_autoFillButtonType = static_cast<uint8_t>(autoFillButtonType); 1377 1380 m_inputType->updateAutoFillButton(); 1381 updateInnerTextElementEditability(); 1382 invalidateStyleForSubtree(); 1378 1383 } 1379 1384 … … 2040 2045 } 2041 2046 2042 RenderStyle HTMLInputElement::createInnerTextStyle(const RenderStyle& style) const 2047 static Ref<CSSLinearGradientValue> autoFillStrongPasswordMaskImage() 2048 { 2049 CSSGradientColorStop firstStop; 2050 firstStop.m_color = CSSValuePool::singleton().createColorValue(Color::black); 2051 firstStop.m_position = CSSValuePool::singleton().createValue(3, CSSPrimitiveValue::UnitType::CSS_EMS); 2052 2053 CSSGradientColorStop secondStop; 2054 secondStop.m_color = CSSValuePool::singleton().createColorValue(Color::transparent); 2055 secondStop.m_position = CSSValuePool::singleton().createValue(7, CSSPrimitiveValue::UnitType::CSS_EMS); 2056 2057 auto gradient = CSSLinearGradientValue::create(CSSGradientRepeat::NonRepeating, CSSGradientType::CSSLinearGradient); 2058 gradient->setAngle(CSSValuePool::singleton().createValue(90, CSSPrimitiveValue::UnitType::CSS_DEG)); 2059 gradient->addStop(firstStop); 2060 gradient->addStop(secondStop); 2061 return gradient; 2062 } 2063 2064 RenderStyle HTMLInputElement::createInnerTextStyle(const RenderStyle& style) 2043 2065 { 2044 2066 auto textBlockStyle = RenderStyle::create(); … … 2052 2074 textBlockStyle.setTextOverflow(shouldTruncateText(style) ? TextOverflowEllipsis : TextOverflowClip); 2053 2075 2076 textBlockStyle.setDisplay(BLOCK); 2077 2078 if (hasAutoFillStrongPasswordButton()) { 2079 textBlockStyle.setColor({ 0.0f, 0.0f, 0.0f, 0.6f }); 2080 textBlockStyle.setTextOverflow(TextOverflowClip); 2081 textBlockStyle.setMaskImage(styleResolver().styleImage(autoFillStrongPasswordMaskImage())); 2082 // A stacking context is needed for the mask. 2083 if (textBlockStyle.hasAutoZIndex()) 2084 textBlockStyle.setZIndex(0); 2085 } 2086 2054 2087 // Do not allow line-height to be smaller than our default. 2055 2088 if (textBlockStyle.fontMetrics().lineSpacing() > style.computedLineHeight()) 2056 2089 textBlockStyle.setLineHeight(RenderStyle::initialLineHeight()); 2057 2058 textBlockStyle.setDisplay(BLOCK);2059 2090 2060 2091 return textBlockStyle; -
trunk/Source/WebCore/html/HTMLInputElement.h
r225837 r225879 136 136 137 137 RefPtr<TextControlInnerTextElement> innerTextElement() const final; 138 RenderStyle createInnerTextStyle(const RenderStyle&) constoverride;138 RenderStyle createInnerTextStyle(const RenderStyle&) override; 139 139 140 140 HTMLElement* innerBlockElement() const; … … 245 245 WEBCORE_EXPORT void setAutoFilled(bool = true); 246 246 247 AutoFillButtonType autoFillButtonType() const { return (AutoFillButtonType)m_autoFillButtonType; }247 AutoFillButtonType autoFillButtonType() const { return static_cast<AutoFillButtonType>(m_autoFillButtonType); } 248 248 WEBCORE_EXPORT void setShowAutoFillButton(AutoFillButtonType); 249 250 bool hasAutoFillStrongPasswordButton() const { return autoFillButtonType() == AutoFillButtonType::StrongPassword || autoFillButtonType() == AutoFillButtonType::StrongConfirmationPassword; } 249 251 250 252 bool isAutoFillAvailable() const { return m_isAutoFillAvailable; } … … 371 373 void updateFocusAppearance(SelectionRestorationMode, SelectionRevealMode) final; 372 374 bool shouldUseInputMethod() final; 375 376 bool isInnerTextElementEditable() const final { return !hasAutoFillStrongPasswordButton() && HTMLTextFormControlElement::isInnerTextElementEditable(); } 373 377 374 378 bool canTriggerImplicitSubmission() const final { return isTextField(); } … … 459 463 unsigned m_autocomplete : 2; // AutoCompleteSetting 460 464 bool m_isAutoFilled : 1; 461 unsigned m_autoFillButtonType : 2; // AutoFillButtonType;465 unsigned m_autoFillButtonType : 3; // AutoFillButtonType; 462 466 bool m_isAutoFillAvailable : 1; 463 467 #if ENABLE(DATALIST_ELEMENT) -
trunk/Source/WebCore/html/HTMLTextAreaElement.cpp
r225499 r225879 547 547 } 548 548 549 RenderStyle HTMLTextAreaElement::createInnerTextStyle(const RenderStyle& style) const549 RenderStyle HTMLTextAreaElement::createInnerTextStyle(const RenderStyle& style) 550 550 { 551 551 auto textBlockStyle = RenderStyle::create(); -
trunk/Source/WebCore/html/HTMLTextAreaElement.h
r225837 r225879 55 55 56 56 RefPtr<TextControlInnerTextElement> innerTextElement() const final; 57 RenderStyle createInnerTextStyle(const RenderStyle&) constfinal;57 RenderStyle createInnerTextStyle(const RenderStyle&) final; 58 58 void copyNonAttributePropertiesFromElement(const Element&) final; 59 59 -
trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp
r225855 r225879 512 512 } 513 513 514 bool HTMLTextFormControlElement::isInnerTextElementEditable() const 515 { 516 return !isDisabledOrReadOnly(); 517 } 518 514 519 void HTMLTextFormControlElement::updateInnerTextElementEditability() 515 520 { 516 if (auto innerText = innerTextElement()) 517 innerText->setAttributeWithoutSynchronization(contenteditableAttr, isDisabledOrReadOnly() ? "false" : "plaintext-only"); 521 if (auto innerText = innerTextElement()) { 522 auto value = isInnerTextElementEditable() ? AtomicString { "plaintext-only", AtomicString::ConstructFromLiteral } : AtomicString { "false", AtomicString::ConstructFromLiteral }; 523 innerText->setAttributeWithoutSynchronization(contenteditableAttr, value); 524 } 518 525 } 519 526 -
trunk/Source/WebCore/html/HTMLTextFormControlElement.h
r225837 r225879 34 34 class VisiblePosition; 35 35 36 enum class AutoFillButtonType : uint8_t { None, Credentials, Contacts };36 enum class AutoFillButtonType : uint8_t { None, Credentials, Contacts, StrongConfirmationPassword, StrongPassword }; 37 37 enum TextFieldSelectionDirection { SelectionHasNoDirection, SelectionHasForwardDirection, SelectionHasBackwardDirection }; 38 38 enum TextFieldEventBehavior { DispatchNoEvent, DispatchChangeEvent, DispatchInputAndChangeEvent }; … … 83 83 84 84 virtual RefPtr<TextControlInnerTextElement> innerTextElement() const = 0; 85 virtual RenderStyle createInnerTextStyle(const RenderStyle&) const= 0;85 virtual RenderStyle createInnerTextStyle(const RenderStyle&) = 0; 86 86 87 87 void selectionChanged(bool shouldFireSelectEvent); … … 107 107 void disabledStateChanged() override; 108 108 void readOnlyAttributeChanged() override; 109 virtual bool isInnerTextElementEditable() const; 109 110 void updateInnerTextElementEditability(); 110 111 -
trunk/Source/WebCore/html/TextFieldInputType.cpp
r224260 r225879 407 407 case AutoFillButtonType::Credentials: 408 408 return AXAutoFillCredentialsLabel(); 409 default: 409 case AutoFillButtonType::StrongConfirmationPassword: 410 return AXAutoFillStrongConfirmationPasswordLabel(); 411 case AutoFillButtonType::StrongPassword: 412 return AXAutoFillStrongPasswordLabel(); 410 413 case AutoFillButtonType::None: 411 414 ASSERT_NOT_REACHED(); 412 return String(); 413 } 414 } 415 416 static AtomicString autoFillButtonTypeToAutoFillButtonPseudoClassName(AutoFillButtonType autoFillButtonType) 417 { 418 AtomicString pseudoClassName; 415 return { }; 416 } 417 } 418 419 static String autoFillButtonTypeToAutoFillButtonText(AutoFillButtonType autoFillButtonType) 420 { 419 421 switch (autoFillButtonType) { 420 422 case AutoFillButtonType::Contacts: 421 pseudoClassName = AtomicString("-webkit-contacts-auto-fill-button", AtomicString::ConstructFromLiteral);422 break;423 423 case AutoFillButtonType::Credentials: 424 pseudoClassName = AtomicString("-webkit-credentials-auto-fill-button", AtomicString::ConstructFromLiteral); 425 break; 424 case AutoFillButtonType::StrongConfirmationPassword: 425 return emptyString(); 426 case AutoFillButtonType::StrongPassword: 427 return autoFillStrongPasswordLabel(); 426 428 case AutoFillButtonType::None: 427 429 ASSERT_NOT_REACHED(); 428 break; 429 } 430 431 return pseudoClassName; 430 return { }; 431 } 432 } 433 434 static AtomicString autoFillButtonTypeToAutoFillButtonPseudoClassName(AutoFillButtonType autoFillButtonType) 435 { 436 switch (autoFillButtonType) { 437 case AutoFillButtonType::Contacts: 438 return { "-webkit-contacts-auto-fill-button", AtomicString::ConstructFromLiteral }; 439 case AutoFillButtonType::Credentials: 440 return { "-webkit-credentials-auto-fill-button", AtomicString::ConstructFromLiteral }; 441 case AutoFillButtonType::StrongConfirmationPassword: 442 return { "-webkit-strong-confirmation-password-auto-fill-button", AtomicString::ConstructFromLiteral }; 443 case AutoFillButtonType::StrongPassword: 444 return { "-webkit-strong-password-auto-fill-button", AtomicString::ConstructFromLiteral }; 445 case AutoFillButtonType::None: 446 ASSERT_NOT_REACHED(); 447 return emptyAtom(); 448 } 432 449 } 433 450 … … 436 453 if (attribute == "-webkit-contacts-auto-fill-button" && autoFillButtonType != AutoFillButtonType::Contacts) 437 454 return true; 438 439 455 if (attribute == "-webkit-credentials-auto-fill-button" && autoFillButtonType != AutoFillButtonType::Credentials) 440 456 return true; 441 457 if (attribute == "-webkit-strong-confirmation-password-auto-fill-button" && autoFillButtonType != AutoFillButtonType::StrongConfirmationPassword) 458 return true; 459 if (attribute == "-webkit-strong-password-auto-fill-button" && autoFillButtonType != AutoFillButtonType::StrongPassword) 460 return true; 442 461 return false; 443 462 } … … 664 683 m_autoFillButton->setAttributeWithoutSynchronization(roleAttr, AtomicString("button", AtomicString::ConstructFromLiteral)); 665 684 m_autoFillButton->setAttributeWithoutSynchronization(aria_labelAttr, autoFillButtonTypeToAccessibilityLabel(autoFillButtonType)); 685 m_autoFillButton->setTextContent(autoFillButtonTypeToAutoFillButtonText(autoFillButtonType)); 666 686 m_container->appendChild(*m_autoFillButton); 667 687 } … … 673 693 createContainer(); 674 694 695 AutoFillButtonType autoFillButtonType = element().autoFillButtonType(); 675 696 if (!m_autoFillButton) 676 createAutoFillButton( element().autoFillButtonType());697 createAutoFillButton(autoFillButtonType); 677 698 678 699 const AtomicString& attribute = m_autoFillButton->attributeWithoutSynchronization(pseudoAttr); 679 bool shouldUpdateAutoFillButtonType = isAutoFillButtonTypeChanged(attribute, element().autoFillButtonType());700 bool shouldUpdateAutoFillButtonType = isAutoFillButtonTypeChanged(attribute, autoFillButtonType); 680 701 if (shouldUpdateAutoFillButtonType) { 681 m_autoFillButton->setPseudo(autoFillButtonTypeToAutoFillButtonPseudoClassName(element().autoFillButtonType())); 682 m_autoFillButton->setAttributeWithoutSynchronization(aria_labelAttr, autoFillButtonTypeToAccessibilityLabel(element().autoFillButtonType())); 702 m_autoFillButton->setPseudo(autoFillButtonTypeToAutoFillButtonPseudoClassName(autoFillButtonType)); 703 m_autoFillButton->setAttributeWithoutSynchronization(aria_labelAttr, autoFillButtonTypeToAccessibilityLabel(autoFillButtonType)); 704 m_autoFillButton->setTextContent(autoFillButtonTypeToAutoFillButtonText(autoFillButtonType)); 683 705 } 684 706 m_autoFillButton->setInlineStyleProperty(CSSPropertyDisplay, CSSValueBlock, true); -
trunk/Source/WebCore/platform/LocalizedStrings.cpp
r225223 r225879 639 639 { 640 640 return WEB_UI_STRING("alternative presentation button subtitle", "Subtitle text for alternative presentation button"); 641 } 642 643 String AXAutoFillStrongPasswordLabel() 644 { 645 return WEB_UI_STRING("strong password auto fill", "Label for the strong password auto fill button inside a text field."); 646 } 647 648 String AXAutoFillStrongConfirmationPasswordLabel() 649 { 650 return WEB_UI_STRING("strong confirmation password auto fill", "Label for the strong confirmation password auto fill button inside a text field."); 651 } 652 653 String autoFillStrongPasswordLabel() 654 { 655 return WEB_UI_STRING("strong password", "Label for strong password."); 641 656 } 642 657 -
trunk/Source/WebCore/platform/LocalizedStrings.h
r225223 r225879 216 216 String AXAutoFillCredentialsLabel(); 217 217 String AXAutoFillContactsLabel(); 218 String AXAutoFillStrongPasswordLabel(); 219 String AXAutoFillStrongConfirmationPasswordLabel(); 220 String autoFillStrongPasswordLabel(); 218 221 219 222 String missingPluginText(); -
trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h
r224537 r225879 96 96 bool hasLineIfEmpty() const override { return true; } 97 97 bool isTextControlInnerBlock() const override { return true; } 98 bool canBeProgramaticallyScrolled() const override { return true; } 98 bool canBeProgramaticallyScrolled() const override 99 { 100 auto* shadowHost = element()->shadowHost(); 101 if (is<HTMLInputElement>(shadowHost)) 102 return !downcast<HTMLInputElement>(*shadowHost).hasAutoFillStrongPasswordButton(); 103 return true; 104 } 99 105 }; 100 106 -
trunk/Source/WebCore/testing/Internals.cpp
r225707 r225879 1664 1664 case Internals::AutoFillButtonType::Contacts: 1665 1665 return AutoFillButtonType::Contacts; 1666 case Internals::AutoFillButtonType::StrongPassword: 1667 return AutoFillButtonType::StrongPassword; 1668 case Internals::AutoFillButtonType::StrongConfirmationPassword: 1669 return AutoFillButtonType::StrongConfirmationPassword; 1666 1670 } 1667 1671 ASSERT_NOT_REACHED(); -
trunk/Source/WebCore/testing/Internals.h
r225707 r225879 235 235 void setEditingValue(HTMLInputElement&, const String&); 236 236 void setAutofilled(HTMLInputElement&, bool enabled); 237 enum class AutoFillButtonType { None, Contacts, Credentials };237 enum class AutoFillButtonType { None, Contacts, Credentials, StrongPassword, StrongConfirmationPassword }; 238 238 void setShowAutoFillButton(HTMLInputElement&, AutoFillButtonType); 239 239 ExceptionOr<void> scrollElementToRect(Element&, int x, int y, int w, int h); -
trunk/Source/WebCore/testing/Internals.idl
r225707 r225879 62 62 "None", 63 63 "Contacts", 64 "Credentials" 64 "Credentials", 65 "StrongPassword", 66 "StrongConfirmationPassword" 65 67 }; 66 68 -
trunk/Source/WebKit/ChangeLog
r225877 r225879 1 2017-12-13 Daniel Bates <dabates@apple.com> 2 3 Add more auto fill button types 4 https://bugs.webkit.org/show_bug.cgi?id=180651 5 <rdar://problem/35891125> 6 And 7 <rdar://problem/35977943> 8 9 Reviewed by Brent Fulgham. 10 11 Adds enumerators for the new auto fill button types. 12 13 * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm: 14 (toAutoFillButtonType): 15 * WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h: 16 * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: 17 (toAutoFillButtonType): 18 * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h: 19 1 20 2017-12-13 Matt Lewis <jlewis3@apple.com> 2 21 -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandle.mm
r225833 r225879 136 136 case _WKAutoFillButtonTypeCredentials: 137 137 return WebCore::AutoFillButtonType::Credentials; 138 case _WKAutoFillButtonTypeStrongConfirmationPassword: 139 return WebCore::AutoFillButtonType::StrongConfirmationPassword; 140 case _WKAutoFillButtonTypeStrongPassword: 141 return WebCore::AutoFillButtonType::StrongPassword; 138 142 } 139 143 ASSERT_NOT_REACHED(); -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInNodeHandlePrivate.h
r225833 r225879 32 32 _WKAutoFillButtonTypeCredentials, 33 33 _WKAutoFillButtonTypeContacts, 34 _WKAutoFillButtonTypeStrongConfirmationPassword, 35 _WKAutoFillButtonTypeStrongPassword, 34 36 } WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 35 37 -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
r222013 r225879 47 47 case kWKAutoFillButtonTypeCredentials: 48 48 return WebCore::AutoFillButtonType::Credentials; 49 case kWKAutoFillButtonTypeStrongConfirmationPassword: 50 return WebCore::AutoFillButtonType::StrongConfirmationPassword; 51 case kWKAutoFillButtonTypeStrongPassword: 52 return WebCore::AutoFillButtonType::StrongPassword; 49 53 } 50 54 ASSERT_NOT_REACHED(); -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h
r222013 r225879 39 39 kWKAutoFillButtonTypeNone, 40 40 kWKAutoFillButtonTypeCredentials, 41 kWKAutoFillButtonTypeContacts 41 kWKAutoFillButtonTypeContacts, 42 kWKAutoFillButtonTypeStrongPassword, 43 kWKAutoFillButtonTypeStrongConfirmationPassword, 42 44 }; 43 45 typedef uint8_t WKAutoFillButtonType;
Note: See TracChangeset
for help on using the changeset viewer.