Bug 25536

Summary: WebKit needs to expose an Element::spellcheck attribute to javascript
Product: WebKit Reporter: Eric Seidel (no email) <eric>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: morrita, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
URL: http://www.whatwg.org/specs/web-apps/current-work/#attr-spellcheck
Bug Depends on: 14552    
Bug Blocks: 48411    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch tkent: review+

Eric Seidel (no email)
Reported 2009-05-03 23:49:11 PDT
WebKit needs to expose an Element::spellcheck attribute to javascript Per HTML5: http://www.whatwg.org/specs/web-apps/current-work/#attr-spellcheck
Attachments
Patch (16.14 KB, patch)
2010-10-27 04:06 PDT, Hajime Morrita
no flags
Patch (18.34 KB, patch)
2010-10-28 00:48 PDT, Hajime Morrita
no flags
Patch (18.33 KB, patch)
2010-10-28 01:26 PDT, Hajime Morrita
no flags
Patch (22.96 KB, patch)
2010-10-28 02:41 PDT, Hajime Morrita
tkent: review+
Hajime Morrita
Comment 1 2010-10-27 04:06:43 PDT
Hajime Morrita
Comment 2 2010-10-27 04:13:29 PDT
Dynamic spellcheck behavior change is not implemented at the patch. It is filed separately on Bug 48411.
Kent Tamura
Comment 3 2010-10-27 05:24:14 PDT
Comment on attachment 72002 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=72002&action=review > LayoutTests/editing/spelling/script-tests/spelling-attribute-change.js:25 > + shouldBe("layoutTestController.hasSpellingMarker(6, 2)", enabled ? "true" : "false"); Some ports has no hasSpellingMarker() implementation, right? We need to skip the test on them. > WebCore/html/HTMLElement.cpp:735 > + setAttribute(HTMLNames::spellcheckAttr, enable ? "true" : "false"); Need no HTMLNames::.
Sam Weinig
Comment 4 2010-10-27 10:03:09 PDT
Comment on attachment 72002 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=72002&action=review > WebCore/html/HTMLElement.idl:65 > + attribute boolean spellcheck; This should probably use the [Reflect] extended attribute which would mean you don't need the implementation of spellcheck/setSpellcheck in HTMLElement.h/cpp
Hajime Morrita
Comment 5 2010-10-28 00:48:29 PDT
Hajime Morrita
Comment 6 2010-10-28 01:26:47 PDT
Hajime Morrita
Comment 7 2010-10-28 01:29:58 PDT
Hi, Kent-san, Sam, thank you for taking a look! I updated the patch. > > LayoutTests/editing/spelling/script-tests/spelling-attribute-change.js:25 > > + shouldBe("layoutTestController.hasSpellingMarker(6, 2)", enabled ? "true" : "false"); > > Some ports has no hasSpellingMarker() implementation, right? We need to skip the test on them. Yes, only Mac, windows and chromium-mac support spellchecking. Added skip entries for other ports. > > > WebCore/html/HTMLElement.cpp:735 > > + setAttribute(HTMLNames::spellcheckAttr, enable ? "true" : "false"); > > Need no HTMLNames::. Removed. > > WebCore/html/HTMLElement.idl:65 > > + attribute boolean spellcheck; > > This should probably use the [Reflect] extended attribute which would mean you don't need the implementation of spellcheck/setSpellcheck in HTMLElement.h/cpp Oh, I didn't notice this. Thank you pointing this out. In this case, I'd use explicit implementation because spellcheck has nontrivial semantics like inheritance.
Kent Tamura
Comment 8 2010-10-28 01:42:11 PDT
Comment on attachment 72158 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=72158&action=review > LayoutTests/fast/dom/HTMLElement/script-tests/spellcheck.js:50 > +testFor("false", false, "false", true, "true"); Need more tests for other initialAttribute variations such as "TRUE" "FALSE", "", "foobar", "1", "0", ...
Hajime Morrita
Comment 9 2010-10-28 02:41:12 PDT
Hajime Morrita
Comment 10 2010-10-28 02:42:22 PDT
Hi, thank you for another review! > Need more tests for other initialAttribute variations such as "TRUE" "FALSE", "", "foobar", "1", "0", ... Agreed and added more test cases.
Kent Tamura
Comment 11 2010-10-28 02:45:39 PDT
Comment on attachment 72164 [details] Patch ok
Hajime Morrita
Comment 12 2010-10-28 03:42:18 PDT
Sam Weinig
Comment 13 2010-11-02 04:12:40 PDT
> > This should probably use the [Reflect] extended attribute which would mean you don't need the implementation of spellcheck/setSpellcheck in HTMLElement.h/cpp > Oh, I didn't notice this. Thank you pointing this out. > In this case, I'd use explicit implementation > because spellcheck has nontrivial semantics like inheritance. I don't understand what you mean here. Can you explain what you mean by this?
Hajime Morrita
Comment 14 2010-11-04 01:56:07 PDT
> I don't understand what you mean here. Can you explain what you mean by this? In my understanding, @spellcheck properety returns the spellcheck availability of the element, instead of attribute value itself. For example, Given: <div spellcheck="true"> <div id="target">foo</div> </div> with: var target = document.getElementById("target"); In this case, target.spellcheck returns true. With [Reflect], this would return false because a missing attribute turns into false. (... is right? I'm not sure if I understand [Reflect] behavior precisely.)
Sam Weinig
Comment 15 2010-11-04 08:13:28 PDT
(In reply to comment #14) > > I don't understand what you mean here. Can you explain what you mean by this? > > In my understanding, @spellcheck properety returns the spellcheck availability of the element, > instead of attribute value itself. > > For example, Given: > <div spellcheck="true"> > <div id="target">foo</div> > </div> > > with: > var target = document.getElementById("target"); > > In this case, target.spellcheck returns true. > With [Reflect], this would return false because a missing attribute turns into false. > (... is right? I'm not sure if I understand [Reflect] behavior precisely.) I see, thanks for the info.
Note You need to log in before you can comment on or make changes to this bug.