RESOLVED FIXED Bug 82693
Fix some problems of text field decoration
https://bugs.webkit.org/show_bug.cgi?id=82693
Summary Fix some problems of text field decoration
Kent Tamura
Reported 2012-03-29 23:15:17 PDT
Fix some problems of text field decoration
Attachments
Patch (6.36 KB, patch)
2012-03-29 23:25 PDT, Kent Tamura
no flags
Patch 2 (7.49 KB, patch)
2012-03-29 23:49 PDT, Kent Tamura
no flags
Patch 3 (7.11 KB, patch)
2012-03-30 02:27 PDT, Kent Tamura
dglazkov: review+
Kent Tamura
Comment 1 2012-03-29 23:25:38 PDT
Gustavo Noronha (kov)
Comment 2 2012-03-29 23:32:43 PDT
Kent Tamura
Comment 3 2012-03-29 23:49:26 PDT
Created attachment 134734 [details] Patch 2 Fix GTK build
Hajime Morrita
Comment 4 2012-03-30 00:07:27 PDT
Comment on attachment 134729 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=134729&action=review Actually, this raises an interesting question: What should we do if decorator-like shadow want to react visual change? I remember we discussed this a bit before. But I don't think we reached any solid conclusion. I want to see what will actually happen in didDetach(). > Source/WebCore/ChangeLog:11 > + change the state of detaching element. This patch change the callback to s/change/changes > Source/WebCore/html/shadow/TextFieldDecorationElement.cpp:73 > + ShadowRoot* newRoot = 0; It looks we could have a function to create a necessary shadow root. > Source/WebCore/html/shadow/TextFieldDecorationElement.cpp:80 > + newRoot->removeChild(newRoot->firstChild()); removeChildren()? > Source/WebCore/html/shadow/TextFieldDecorationElement.cpp:161 > + m_textFieldDecorator->didDetach(hostInput()); hostInput() could be null (or assertion could fail inside it) if we use timer here. since the host <input> could be blew out. I hope this to be called from something like tree mutation event.
Kent Tamura
Comment 5 2012-03-30 00:43:48 PDT
Comment on attachment 134729 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=134729&action=review > I want to see what will actually happen in didDetach(). I guess a typical task in didDetach() will be to close a popup UI corresponding to the specified input element. Changing the input state in didDetach() is not expected, but it is possible. >> Source/WebCore/html/shadow/TextFieldDecorationElement.cpp:161 >> + m_textFieldDecorator->didDetach(hostInput()); > > hostInput() could be null (or assertion could fail inside it) if we use timer here. > since the host <input> could be blew out. > I hope this to be called from something like tree mutation event. Oh, you're right. We can avoid this issue by keeping RefPtr<HTMLInputElement>. But it would make the code dirtier.
Kent Tamura
Comment 6 2012-03-30 01:54:19 PDT
(In reply to comment #5) > > hostInput() could be null (or assertion could fail inside it) if we use timer here. > > since the host <input> could be blew out. > > I hope this to be called from something like tree mutation event. > > Oh, you're right. > We can avoid this issue by keeping RefPtr<HTMLInputElement>. But it would make the code dirtier. I realized using a timer was really a bad idea. RefPtr<HTMLInputElement> doesn't work because ContainerNode::removeAllChildren() apply 'delete' operator to child nodes. I don't change the code for willDetach(), and add a warning comment.
Kent Tamura
Comment 7 2012-03-30 02:27:37 PDT
Dimitri Glazkov (Google)
Comment 8 2012-03-30 09:00:59 PDT
Comment on attachment 134752 [details] Patch 3 View in context: https://bugs.webkit.org/attachment.cgi?id=134752&action=review > Source/WebCore/GNUmakefile.list.am:2480 > + Source/WebCore/html/shadow/HTMLShaodwElement.h \ Typo. > Source/WebCore/html/InputType.cpp:396 > root->removeAllChildren(); > + root->appendChild(HTMLShadowElement::create(shadowTag, element()->document())); Since you are the first consumer of this, I am trying to learn lessons here. It seems like we need ability to just "disable" a shadow DOM subtree in a tree stack. This way, you don't need to keep removing and re-adding DOM elements. > Source/WebCore/html/shadow/TextFieldDecorationElement.cpp:91 > + getDecorationRootAndDecoratedRoot(input, decorationRoot, existingRoot); Interesting approach. It's seems we need a way to reference specific shadow DOM subtrees from the shadowTree(), like getElementById. > Source/WebCore/html/shadow/TextFieldDecorationElement.h:57 > + // This function is called just before detaching the decoration. It must not > + // call functions which updating state of the specified HTMLInputElement > + // object. I am still not happy about needing to articulate this in comments. The best kind of articulation is by design.
Kent Tamura
Comment 9 2012-04-01 21:39:19 PDT
(In reply to comment #8) > > Source/WebCore/html/InputType.cpp:396 > > root->removeAllChildren(); > > + root->appendChild(HTMLShadowElement::create(shadowTag, element()->document())); > > Since you are the first consumer of this, I am trying to learn lessons here. It seems like we need ability to just "disable" a shadow DOM subtree in a tree stack. This way, you don't need to keep removing and re-adding DOM elements. I think supporting ShadowRoot removal is the best way because of the following. > > Source/WebCore/html/shadow/TextFieldDecorationElement.cpp:91 > > + getDecorationRootAndDecoratedRoot(input, decorationRoot, existingRoot); > > Interesting approach. It's seems we need a way to reference specific shadow DOM subtrees from the shadowTree(), like getElementById. In this case, what we want is the youngest effective (not just <shadow> child) ShadowRoot. If we supported ShadowRoot removal, it would be the youngest ShadowRoot. It's simple. If we introduced "disabled" state or something, we would need to iterate over the ShadowRoots eventually. > > Source/WebCore/html/shadow/TextFieldDecorationElement.h:57 > > + // This function is called just before detaching the decoration. It must not > > + // call functions which updating state of the specified HTMLInputElement > > + // object. > > I am still not happy about needing to articulate this in comments. The best kind of articulation is by design. Yeah, I understand. However I have no good idea to resolve this by design.
Kent Tamura
Comment 10 2012-04-01 22:08:18 PDT
Note You need to log in before you can comment on or make changes to this bug.