WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
82698
ShadowRoot.selection should return the selection whose range is in a shadow tree.
https://bugs.webkit.org/show_bug.cgi?id=82698
Summary
ShadowRoot.selection should return the selection whose range is in a shadow t...
Shinya Kawanaka
Reported
2012-03-29 23:47:35 PDT
After fixing
Bug 82429
, ShadowRoot should return selection whose range is really in a shadow tree.
Attachments
WIP
(23.83 KB, patch)
2012-05-09 21:59 PDT
,
Shinya Kawanaka
no flags
Details
Formatted Diff
Diff
Patch
(80.61 KB, patch)
2012-05-13 22:32 PDT
,
Shinya Kawanaka
no flags
Details
Formatted Diff
Diff
Patch
(80.83 KB, patch)
2012-05-13 22:35 PDT
,
Shinya Kawanaka
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ec2-cr-linux-03
(755.98 KB, application/zip)
2012-05-13 23:06 PDT
,
WebKit Review Bot
no flags
Details
Patch
(87.56 KB, patch)
2012-05-13 23:29 PDT
,
Shinya Kawanaka
no flags
Details
Formatted Diff
Diff
Patch
(89.05 KB, patch)
2012-05-14 01:08 PDT
,
Shinya Kawanaka
no flags
Details
Formatted Diff
Diff
Patch
(119.40 KB, patch)
2012-05-15 02:21 PDT
,
Shinya Kawanaka
no flags
Details
Formatted Diff
Diff
Patch
(33.21 KB, patch)
2012-05-16 00:16 PDT
,
Shinya Kawanaka
no flags
Details
Formatted Diff
Diff
Patch
(33.42 KB, patch)
2012-05-16 00:17 PDT
,
Shinya Kawanaka
no flags
Details
Formatted Diff
Diff
Patch for landing
(33.34 KB, patch)
2012-05-16 01:35 PDT
,
Shinya Kawanaka
no flags
Details
Formatted Diff
Diff
Show Obsolete
(8)
View All
Add attachment
proposed patch, testcase, etc.
Shinya Kawanaka
Comment 1
2012-05-09 21:59:39 PDT
Created
attachment 141085
[details]
WIP
WebKit Review Bot
Comment 2
2012-05-09 22:02:18 PDT
Attachment 141085
[details]
did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/edit..." exit_code: 1 Source/WebCore/dom/TreeScope.cpp:31: Alphabetical sorting problem. [build/include_order] [4] Total errors found: 1 in 16 files If any of these errors are false positives, please file a bug against check-webkit-style.
Build Bot
Comment 3
2012-05-09 22:20:43 PDT
Comment on
attachment 141085
[details]
WIP
Attachment 141085
[details]
did not pass mac-ews (mac): Output:
http://queues.webkit.org/results/12648758
Build Bot
Comment 4
2012-05-09 22:25:25 PDT
Comment on
attachment 141085
[details]
WIP
Attachment 141085
[details]
did not pass win-ews (win): Output:
http://queues.webkit.org/results/12644941
Early Warning System Bot
Comment 5
2012-05-09 22:29:32 PDT
Comment on
attachment 141085
[details]
WIP
Attachment 141085
[details]
did not pass qt-wk2-ews (qt): Output:
http://queues.webkit.org/results/12653803
Early Warning System Bot
Comment 6
2012-05-09 22:36:47 PDT
Comment on
attachment 141085
[details]
WIP
Attachment 141085
[details]
did not pass qt-ews (qt): Output:
http://queues.webkit.org/results/12649928
Gyuyoung Kim
Comment 7
2012-05-09 22:56:42 PDT
Comment on
attachment 141085
[details]
WIP
Attachment 141085
[details]
did not pass efl-ews (efl): Output:
http://queues.webkit.org/results/12648764
Build Bot
Comment 8
2012-05-09 23:21:50 PDT
Comment on
attachment 141085
[details]
WIP
Attachment 141085
[details]
did not pass mac-ews (mac): Output:
http://queues.webkit.org/results/12656882
Gustavo Noronha (kov)
Comment 9
2012-05-10 00:16:24 PDT
Comment on
attachment 141085
[details]
WIP
Attachment 141085
[details]
did not pass gtk-ews (gtk): Output:
http://queues.webkit.org/results/12649944
Shinya Kawanaka
Comment 10
2012-05-13 22:32:53 PDT
Created
attachment 141639
[details]
Patch
Shinya Kawanaka
Comment 11
2012-05-13 22:35:50 PDT
Created
attachment 141640
[details]
Patch
WebKit Review Bot
Comment 12
2012-05-13 23:06:08 PDT
Comment on
attachment 141640
[details]
Patch
Attachment 141640
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/12659014
New failing tests: fast/dom/shadow/selection-in-shadow.html
WebKit Review Bot
Comment 13
2012-05-13 23:06:13 PDT
Created
attachment 141645
[details]
Archive of layout-test-results from ec2-cr-linux-03 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-03 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Shinya Kawanaka
Comment 14
2012-05-13 23:16:00 PDT
Ah, old selection tests are failing... It should be deprecated or something...
Shinya Kawanaka
Comment 15
2012-05-13 23:29:30 PDT
Created
attachment 141646
[details]
Patch
Hajime Morrita
Comment 16
2012-05-14 00:30:54 PDT
Comment on
attachment 141646
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=141646&action=review
Could you test for following? - ShadowRoot of orphan(out-of-document) node
> LayoutTests/ChangeLog:26 > +
Duplicated entry.
Shinya Kawanaka
Comment 17
2012-05-14 00:42:22 PDT
(In reply to
comment #16
)
> (From update of
attachment 141646
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=141646&action=review
> > Could you test for following? > - ShadowRoot of orphan(out-of-document) node
sure. wait a moment...
> > > LayoutTests/ChangeLog:26 > > + > > Duplicated entry.
Oops...
Shinya Kawanaka
Comment 18
2012-05-14 01:08:03 PDT
Created
attachment 141662
[details]
Patch
Ryosuke Niwa
Comment 19
2012-05-14 23:19:55 PDT
Comment on
attachment 141662
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=141662&action=review
> Source/WebCore/dom/TreeScope.cpp:145 > + if (this != rootNode()->document()) > + return rootNode()->document()->getSelection();
Why are you making this change? You should at least explain why you're making this change in the change log.
> Source/WebCore/dom/TreeScopeAdjuster.cpp:47 > - do { > + while (node) { > if (node->treeScope() == treeScope()) > return node; > if (!node->isInShadowTree()) > return 0; > - } while ((node = node->shadowAncestorNode())); > + node = node->shadowAncestorNode(); > + }
Why are you re-writing this do-while loop to a while loop? Again, this needs to be explained somewhere.
> Source/WebCore/page/DOMSelection.cpp:503 > +Node* DOMSelection::adjustedNode(const Position& position) const
I would call it shadowAdjustedNode so that I know with respect to what it is adjusted.
> Source/WebCore/page/DOMSelection.cpp:509 > + Node* adjustedNode = TreeScopeAdjuster(m_treeScope).ancestorInThisScope(containerNode);
Why do we need a class for this? All these proliferations of tiny classes is going to increase our build time. It should have been much better if this was just a function in TreeScope, VisibleSelection, or even in htmlediting.
> LayoutTests/editing/shadow/selection-of-shadowroot-expected.txt:4 > +PASS divs[0] is selection.anchorNode.parentNode > +PASS anchorTreeScopeRoot is internals.treeScopeRootNode(selection.focusNode) > +PASS anchorTreeScopeRoot is internals.treeScopeRootNode(selection.baseNode) > +PASS anchorTreeScopeRoot is internals.treeScopeRootNode(selection.extentNode)
These outputs don't tell me what this test is testing. Ideal test outputs makes what and why we're asserting self-evident.
Shinya Kawanaka
Comment 20
2012-05-14 23:38:38 PDT
Comment on
attachment 141662
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=141662&action=review
>> Source/WebCore/dom/TreeScope.cpp:145 >> + return rootNode()->document()->getSelection(); > > Why are you making this change? You should at least explain why you're making this change in the change log.
This was because I would like to use the same instance of DOMSelection for document and shadow root. I'll comment it just before this in next patch.
>> Source/WebCore/dom/TreeScopeAdjuster.cpp:47 >> + } > > Why are you re-writing this do-while loop to a while loop? > Again, this needs to be explained somewhere.
This is because node can be null.
>> Source/WebCore/page/DOMSelection.cpp:509 >> + Node* adjustedNode = TreeScopeAdjuster(m_treeScope).ancestorInThisScope(containerNode); > > Why do we need a class for this? All these proliferations of tiny classes is going to increase our build time. > It should have been much better if this was just a function in TreeScope, VisibleSelection, or even in htmlediting.
Hmm... Actually I was proposed to create this class by morrita. But I'm OK to remove it. Let's do in another patch in that case...
>> LayoutTests/editing/shadow/selection-of-shadowroot-expected.txt:4 >> +PASS anchorTreeScopeRoot is internals.treeScopeRootNode(selection.extentNode) > > These outputs don't tell me what this test is testing. > Ideal test outputs makes what and why we're asserting self-evident.
OK. Thanks for mentioning this. I'll update the output to be comprehensive.
Shinya Kawanaka
Comment 21
2012-05-14 23:40:10 PDT
Comment on
attachment 141662
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=141662&action=review
>>> Source/WebCore/dom/TreeScope.cpp:145 >>> + return rootNode()->document()->getSelection(); >> >> Why are you making this change? You should at least explain why you're making this change in the change log. > > This was because I would like to use the same instance of DOMSelection for document and shadow root. > I'll comment it just before this in next patch.
Let me discard the previous comment... I'll comment it in ChangeLog.
Shinya Kawanaka
Comment 22
2012-05-15 02:21:31 PDT
Created
attachment 141899
[details]
Patch
WebKit Review Bot
Comment 23
2012-05-15 02:29:47 PDT
Comment on
attachment 141899
[details]
Patch
Attachment 141899
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/12706250
Ryosuke Niwa
Comment 24
2012-05-15 03:01:14 PDT
Comment on
attachment 141899
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=141899&action=review
> Source/WebCore/page/DOMSelection.cpp:532 > + return position.offsetInContainerNode();
This is going to assert when position is not of the type PositionIsOffsetInAnchor. You should call computeOffsetInContainerNode() instead.
> LayoutTests/editing/shadow/selection-of-orphan-shadowroot-expected.txt:1 > +Nodes of the selection for orphan shadow root should return null.
Nit: for an orphan shadow root.
> LayoutTests/editing/shadow/selection-of-shadowroot-expected.txt:14 > +Dragging from divs[0] to divs[2]
I still don't understand what divs[0] and divs[2] mean, and what output I should be expecting. Also, all outputs on the right of PASS appear to be identical for each test case.
Shinya Kawanaka
Comment 25
2012-05-16 00:16:13 PDT
Created
attachment 142169
[details]
Patch
Shinya Kawanaka
Comment 26
2012-05-16 00:17:17 PDT
Created
attachment 142171
[details]
Patch
Shinya Kawanaka
Comment 27
2012-05-16 00:19:37 PDT
Thanks for reviewing! (In reply to
comment #24
)
> (From update of
attachment 141899
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=141899&action=review
> > > Source/WebCore/page/DOMSelection.cpp:532 > > + return position.offsetInContainerNode(); > > This is going to assert when position is not of the type PositionIsOffsetInAnchor. You should call computeOffsetInContainerNode() instead. > > > LayoutTests/editing/shadow/selection-of-orphan-shadowroot-expected.txt:1 > > +Nodes of the selection for orphan shadow root should return null. > > Nit: for an orphan shadow root. > > > LayoutTests/editing/shadow/selection-of-shadowroot-expected.txt:14 > > +Dragging from divs[0] to divs[2] > > I still don't understand what divs[0] and divs[2] mean, and what output I should be expecting. > Also, all outputs on the right of PASS appear to be identical for each test case.
Hmm... I've updated the patch to reduce the test and added a few description. I think this is much more understandable than before... But if you don't think so, could you suggest an advice to make it more comprehensive?
Ryosuke Niwa
Comment 28
2012-05-16 00:28:46 PDT
Comment on
attachment 142171
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=142171&action=review
> Source/WebCore/ChangeLog:25 > + (WebCore::TreeScope::getSelection): > + When shadow DOM feature is not enabled, we want to use the same instance of DOMSelection > + among Document and ShadowRoot.
We normally start description immediately after: followed by a single space, and we don't indent descriptions by two-spaces.
> Source/WebCore/ChangeLog:29 > + Since node could be null, I've added a node check code.
Ditto.
> Source/WebCore/ChangeLog:43 > + Gets the corresponding node in the m_treeScope from the Position.
Ditto.
> Source/WebCore/ChangeLog:46 > + Gets the corresponding node offset in the m_treeScope from the Position.
Ditto.
Shinya Kawanaka
Comment 29
2012-05-16 01:31:27 PDT
(In reply to
comment #28
)
> (From update of
attachment 142171
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=142171&action=review
> > > Source/WebCore/ChangeLog:25 > > + (WebCore::TreeScope::getSelection): > > + When shadow DOM feature is not enabled, we want to use the same instance of DOMSelection > > + among Document and ShadowRoot. > > We normally start description immediately after: followed by a single space, and we don't indent descriptions by two-spaces. > > > Source/WebCore/ChangeLog:29 > > + Since node could be null, I've added a node check code. > > Ditto. > > > Source/WebCore/ChangeLog:43 > > + Gets the corresponding node in the m_treeScope from the Position. > > Ditto. > > > Source/WebCore/ChangeLog:46 > > + Gets the corresponding node offset in the m_treeScope from the Position. > > Ditto.
Thanks for mentioning this... I didn't know that rule!
Shinya Kawanaka
Comment 30
2012-05-16 01:35:22 PDT
Created
attachment 142193
[details]
Patch for landing
Shinya Kawanaka
Comment 31
2012-05-16 01:47:11 PDT
After the bots become green, I'll land this patch.
Shinya Kawanaka
Comment 32
2012-05-16 02:16:45 PDT
(In reply to
comment #31
)
> After the bots become green, I'll land this patch.
Since cr-linux was tested by me, it should be OK to land now...
Shinya Kawanaka
Comment 33
2012-05-16 03:07:43 PDT
Committed
r117249
: <
http://trac.webkit.org/changeset/117249
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug