Changeset 201942 in webkit
- Timestamp:
- Jun 10, 2016 3:00:23 PM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r201941 r201942 1 2016-06-09 Ryosuke Niwa <rniwa@webkit.org> 2 3 Add SPI to disable spellchecking on auto-fillable text fields 4 https://bugs.webkit.org/show_bug.cgi?id=158611 5 6 Reviewed by Anders Carlsson. 7 8 Added a boolean flag m_isSpellCheckingEnabled to HTMLInputElement. This flag defaults to true, and can be set 9 to false by WebKit2 C API. 10 11 * editing/Editor.cpp: 12 (WebCore::Editor::isSpellCheckingEnabledFor): Fixed a bug that we were calling isSpellCheckingEnabled on 13 the div inside an input element's shadow tree instead of the input element itself. 14 * html/HTMLInputElement.cpp: 15 (WebCore::HTMLInputElement::HTMLInputElement): Initialize m_spellcheckEnabled to true (it's a bit field). 16 (WebCore::HTMLInputElement::isSpellCheckingEnabled): Added. Return false if m_spellcheckEnabled is false. 17 * html/HTMLInputElement.h: 18 (WebCore::HTMLInputElement::setSpellcheckEnabled): Added. 19 1 20 2016-06-10 Alex Christensen <achristensen@webkit.org> 2 21 -
trunk/Source/WebCore/editing/Editor.cpp
r201490 r201942 2373 2373 if (!node) 2374 2374 return false; 2375 const Element* focusedElement = is<Element>(*node) ? downcast<Element>(node) : node->parentElement();2376 if (! focusedElement)2375 Element* element = is<Element>(*node) ? downcast<Element>(node) : node->parentElement(); 2376 if (!element) 2377 2377 return false; 2378 return focusedElement->isSpellCheckingEnabled(); 2378 if (element->isInUserAgentShadowTree()) { 2379 if (HTMLTextFormControlElement* textControl = enclosingTextFormControl(firstPositionInOrBeforeNode(element))) 2380 return textControl->isSpellCheckingEnabled(); 2381 } 2382 return element->isSpellCheckingEnabled(); 2379 2383 } 2380 2384 -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r201659 r201942 118 118 , m_hasTouchEventHandler(false) 119 119 #endif 120 , m_isSpellCheckingEnabled(true) 120 121 // m_inputType is lazily created when constructed by the parser to avoid constructing unnecessarily a text inputType and 121 122 // its shadow subtree, just to destroy them when the |type| attribute gets set by the parser to something else than 'text'. … … 422 423 { 423 424 return m_inputType->shouldUseInputMethod(); 425 } 426 427 bool HTMLInputElement::isSpellCheckingEnabled() const 428 { 429 return m_isSpellCheckingEnabled && HTMLTextFormControlElement::isSpellCheckingEnabled(); 424 430 } 425 431 -
trunk/Source/WebCore/html/HTMLInputElement.h
r201739 r201942 308 308 void endEditing(); 309 309 310 void setSpellcheckEnabled(bool enabled) { m_isSpellCheckingEnabled = enabled; } 311 310 312 static Vector<FileChooserFileInfo> filesFromFileInputFormControlState(const FormControlState&); 311 313 … … 349 351 void updateFocusAppearance(SelectionRestorationMode, SelectionRevealMode) final; 350 352 bool shouldUseInputMethod() final; 353 bool isSpellCheckingEnabled() const final; 351 354 352 355 bool isTextFormControl() const final { return isTextField(); } … … 449 452 bool m_hasTouchEventHandler : 1; 450 453 #endif 454 bool m_isSpellCheckingEnabled : 1; 451 455 std::unique_ptr<InputType> m_inputType; 452 456 // The ImageLoader must be owned by this element because the loader code assumes -
trunk/Source/WebKit2/ChangeLog
r201941 r201942 1 2016-06-09 Ryosuke Niwa <rniwa@webkit.org> 2 3 Add SPI to disable spellchecking on auto-fillable text fields 4 https://bugs.webkit.org/show_bug.cgi?id=158611 5 6 Reviewed by Anders Carlsson. 7 8 Added WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled to disable spellchecking on a text field. 9 10 This is used by WebKit2 client which desires to disable spellchecking and notably autocorrection on 11 login forms, etc... where such feature would interfere with user's actions. 12 13 * WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp: 14 (WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled): Added. 15 * WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h: 16 * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp: 17 (WebKit::InjectedBundleNodeHandle::setHTMLInputElementSpellcheckEnabled): Added. 18 * WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h: 19 1 20 2016-06-10 Alex Christensen <achristensen@webkit.org> 2 21 -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp
r195685 r201942 96 96 } 97 97 98 void WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled(WKBundleNodeHandleRef htmlInputElementHandleRef, bool enabled) 99 { 100 toImpl(htmlInputElementHandleRef)->setHTMLInputElementSpellcheckEnabled(enabled); 101 } 102 98 103 bool WKBundleNodeHandleGetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandleRef) 99 104 { -
trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h
r195685 r201942 60 60 /* HTMLInputElement Specific Operations */ 61 61 WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementValueForUser(WKBundleNodeHandleRef htmlInputElementHandle, WKStringRef value); 62 WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled(WKBundleNodeHandleRef htmlInputElementHandle, bool enabled); 62 63 WK_EXPORT bool WKBundleNodeHandleGetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandle); 63 64 WK_EXPORT void WKBundleNodeHandleSetHTMLInputElementAutoFilled(WKBundleNodeHandleRef htmlInputElementHandle, bool filled); -
trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp
r195685 r201942 211 211 } 212 212 213 void InjectedBundleNodeHandle::setHTMLInputElementSpellcheckEnabled(bool enabled) 214 { 215 if (!is<HTMLInputElement>(m_node)) 216 return; 217 218 downcast<HTMLInputElement>(m_node.get()).setSpellcheckEnabled(enabled); 219 } 220 213 221 bool InjectedBundleNodeHandle::isHTMLInputElementAutoFilled() const 214 222 { -
trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h
r195685 r201942 67 67 PassRefPtr<InjectedBundleRangeHandle> visibleRange(); 68 68 void setHTMLInputElementValueForUser(const String&); 69 void setHTMLInputElementSpellcheckEnabled(bool); 69 70 bool isHTMLInputElementAutoFilled() const; 70 71 void setHTMLInputElementAutoFilled(bool);
Note: See TracChangeset
for help on using the changeset viewer.