|
|
DescriptionMake Editor::findEventTargetFrom() to align Clipboard API specification
This patch changes |Editor::findEventTargetFrom()| to return focused element if
selection start is not editable to align Clipboard API specification[1] for
improving interoperability.
[1] https://w3c.github.io/clipboard-apis/#to-fire-a-clipboard-event
BUG=690104
TEST=webkit_unittests --gtest_filter=ClipboardEventFlowTest.*
Review-Url: https://codereview.chromium.org/2685723005
Cr-Commit-Position: refs/heads/master@{#451716}
Committed: https://chromium.googlesource.com/chromium/src/+/7afbab0f7619c89aa7a5896024d1628a59cc0ef1
Patch Set 1 #Patch Set 2 : clipboard event target set to focused/active when selection not editable #
Total comments: 6
Patch Set 3 : Make Editor::findEventTargetFrom() to align Clipboard API specification #
Total comments: 9
Patch Set 4 : Make Editor::findEventTargetFrom() to align Clipboard API specification #
Total comments: 4
Patch Set 5 : Make Editor::findEventTargetFrom() to align Clipboard API specification #
Total comments: 4
Patch Set 6 : Make Editor::findEventTargetFrom() to align Clipboard API specification #Patch Set 7 : Make Editor::findEventTargetFrom() to align Clipboard API specification #
Messages
Total messages: 62 (40 generated)
Description was changed from ========== issue-690104 evaluating clipboard event target acording to w3c specification BUG=690104 ========== to ========== issue-690104 evaluating clipboard event target acording to w3c specification BUG=690104 ==========
mwrobel@opera.com changed reviewers: + ojan@chromium.org, yosin@chromium.org, yutak@chromium.org
Could you add a test case for this? We don't need to have "issue-690104" in summary line and please describe what change you make code. Thanks!
I wil try to provide test case once: https://bugs.chromium.org/p/chromium/issues/detail?id=691532&q=mwrobel%40oper... is on board
On 2017/02/13 at 14:59:07, mwrobel wrote: > I wil try to provide test case once: > https://bugs.chromium.org/p/chromium/issues/detail?id=691532&q=mwrobel%40oper... > > is on board Please add |CORE_EXPORT| to |HTMLButtonElement| class declaration. webkit_unittests referes |HTMLButtonElement| from blink_core.{dll,so}
@yosin test case added
Could you explain what change you did in this patch? Also, we don't need to have "issue-690104" in summary line. Example: Make Editor::findEventTargetFrom() to align Clipboard API specification This patch changes |Editor::findEventTargetFrom()| to return focused element if selection start is not editable to align Clipboard API specification[1] for improving interoperability. [1] https://w3c.github.io/clipboard-apis/#to-fire-a-clipboard-event BUG=690104 TEST=webkit_unittests --gtest_filter=ClipboardEventFlowTest.* https://codereview.chromium.org/2685723005/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp (right): https://codereview.chromium.org/2685723005/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:47: void setElementTextAndSelectIt(Element& element, nit: We may want to have a blank line. https://codereview.chromium.org/2685723005/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:53: selection = createVisibleSelection( You don't need to use |VisibleSelection| here. You can use FrameSelection::setSelection(const SelectionInDOMTree&) here. https://codereview.chromium.org/2685723005/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:69: using namespace testing; Please avoid to import all identifiers from namespace[1]: Excerpt: You may not use a using-directive to make all names from a namespace available. // Forbidden -- This pollutes the namespace. using namespace foo; [1] https://google.github.io/styleguide/cppguide.html#Namespaces
Description was changed from ========== issue-690104 evaluating clipboard event target acording to w3c specification BUG=690104 ========== to ========== Make Editor::findEventTargetFrom() to align Clipboard API specification This patch changes |Editor::findEventTargetFrom()| to return focused element if selection start is not editable to align Clipboard API specification[1] for improving interoperability. [1] https://w3c.github.io/clipboard-apis/#to-fire-a-clipboard-event ==========
Description was changed from ========== Make Editor::findEventTargetFrom() to align Clipboard API specification This patch changes |Editor::findEventTargetFrom()| to return focused element if selection start is not editable to align Clipboard API specification[1] for improving interoperability. [1] https://w3c.github.io/clipboard-apis/#to-fire-a-clipboard-event ========== to ========== Make Editor::findEventTargetFrom() to align Clipboard API specification This patch changes |Editor::findEventTargetFrom()| to return focused element if selection start is not editable to align Clipboard API specification[1] for improving interoperability. [1] https://w3c.github.io/clipboard-apis/#to-fire-a-clipboard-event BUG=690104 TEST=webkit_unittests --gtest_filter=ClipboardEventFlowTest.* ==========
On 2017/02/15 01:30:49, yosin_UTC9 wrote: > Could you explain what change you did in this patch? > Also, we don't need to have "issue-690104" in summary line. > > Example: > > Make Editor::findEventTargetFrom() to align Clipboard API specification > > This patch changes |Editor::findEventTargetFrom()| to return focused element if > selection start is not editable to align Clipboard API specification[1] for > improving interoperability. > > [1] https://w3c.github.io/clipboard-apis/#to-fire-a-clipboard-event > > BUG=690104 > TEST=webkit_unittests --gtest_filter=ClipboardEventFlowTest.* > > https://codereview.chromium.org/2685723005/diff/20001/third_party/WebKit/Sour... > File third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp (right): > > https://codereview.chromium.org/2685723005/diff/20001/third_party/WebKit/Sour... > third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:47: void > setElementTextAndSelectIt(Element& element, > nit: We may want to have a blank line. > > https://codereview.chromium.org/2685723005/diff/20001/third_party/WebKit/Sour... > third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:53: selection > = createVisibleSelection( > You don't need to use |VisibleSelection| here. > You can use FrameSelection::setSelection(const SelectionInDOMTree&) here. > > https://codereview.chromium.org/2685723005/diff/20001/third_party/WebKit/Sour... > third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:69: using > namespace testing; > Please avoid to import all identifiers from namespace[1]: > > Excerpt: > You may not use a using-directive to make all names from a namespace available. > > // Forbidden -- This pollutes the namespace. > using namespace foo; > > > > [1] https://google.github.io/styleguide/cppguide.html#Namespaces @yosin thanks for hints ;). All remarks corrected
https://codereview.chromium.org/2685723005/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp (right): https://codereview.chromium.org/2685723005/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:59: element.layoutObject()->mutableStyle()->setUserModify( Accessing layout object is layering violation. Please set "contenteditable" attribute. https://codereview.chromium.org/2685723005/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:96: EXPECT_EQ(selectionEditable, We don't need to verify this. Other test verifies FrameSelection::setSelection() https://codereview.chromium.org/2685723005/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:101: EXPECT_CALL(*eventListenerInstalledOnFocusedElement, handleEvent(_, _)) Could you move EXPEC_CALL's L111. Events are fired by document.execCommand(). https://codereview.chromium.org/2685723005/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:109: EXPECT_NE(frame().settings(), nullptr); No need to check this. We'll get SEGV if |!frame().settings()|.
https://codereview.chromium.org/2685723005/diff/20001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp (right): https://codereview.chromium.org/2685723005/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:47: void setElementTextAndSelectIt(Element& element, On 2017/02/15 01:30:49, yosin_UTC9 wrote: > nit: We may want to have a blank line. Done. https://codereview.chromium.org/2685723005/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:53: selection = createVisibleSelection( On 2017/02/15 01:30:49, yosin_UTC9 wrote: > You don't need to use |VisibleSelection| here. > You can use FrameSelection::setSelection(const SelectionInDOMTree&) here. Done. https://codereview.chromium.org/2685723005/diff/20001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:69: using namespace testing; On 2017/02/15 01:30:49, yosin_UTC9 wrote: > Please avoid to import all identifiers from namespace[1]: > > Excerpt: > You may not use a using-directive to make all names from a namespace available. > > // Forbidden -- This pollutes the namespace. > using namespace foo; > > > > [1] https://google.github.io/styleguide/cppguide.html#Namespaces Done. https://codereview.chromium.org/2685723005/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp (right): https://codereview.chromium.org/2685723005/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:59: element.layoutObject()->mutableStyle()->setUserModify( On 2017/02/15 10:13:58, yosin_UTC9 wrote: > Accessing layout object is layering violation. Please set "contenteditable" > attribute. Done. https://codereview.chromium.org/2685723005/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:96: EXPECT_EQ(selectionEditable, On 2017/02/15 10:13:58, yosin_UTC9 wrote: > We don't need to verify this. Other test verifies FrameSelection::setSelection() I wanted to 'show' that test preconditions are met (if they wouldn't then the whole test doesn't make sense) p.s. the same thing goes with expectation on focusableElement if you still think one (or maybe both?) expectations are not required then please let me know https://codereview.chromium.org/2685723005/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:101: EXPECT_CALL(*eventListenerInstalledOnFocusedElement, handleEvent(_, _)) On 2017/02/15 10:13:58, yosin_UTC9 wrote: > Could you move EXPEC_CALL's L111. Events are fired by document.execCommand(). Done. https://codereview.chromium.org/2685723005/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:109: EXPECT_NE(frame().settings(), nullptr); On 2017/02/15 10:13:58, yosin_UTC9 wrote: > No need to check this. We'll get SEGV if |!frame().settings()|. will do (the same goes with setting flag in paste* tests. I will make a change there to)
https://codereview.chromium.org/2685723005/diff/40001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp (right): https://codereview.chromium.org/2685723005/diff/40001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:96: EXPECT_EQ(selectionEditable, On 2017/02/15 at 10:51:58, mwrobel wrote: > On 2017/02/15 10:13:58, yosin_UTC9 wrote: > > We don't need to verify this. Other test verifies FrameSelection::setSelection() > > I wanted to 'show' that test preconditions are met (if they wouldn't then the whole test doesn't make sense) > p.s. > the same thing goes with expectation on focusableElement > > if you still think one (or maybe both?) expectations are not required then please let me know I still think precondition checking is not required. If precondition breaks, it is test bug. In this test, if test doesn't change editaiblity, one of two tests is failed. If we really want to check precondition, we need to check shape DOM tree, style of DOM nodes, dimension of DOM nodes, etc. https://codereview.chromium.org/2685723005/diff/60001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp (right): https://codereview.chromium.org/2685723005/diff/60001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:56: .extend(Position(&element, text.size())) nit: s/text.size()/1/ It seems |element| has only one child node. Or .collapse(Position(element.firstChild(), 0) .extend(Position(element.firstChild(), text.size() https://codereview.chromium.org/2685723005/diff/60001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:95: // double check test preconditions I think we don't need to check preconditions. If these preconditions break, following assertion will be failed too.
The CQ bit was checked by mwrobel@opera.com
The CQ bit was unchecked by mwrobel@opera.com
https://codereview.chromium.org/2685723005/diff/60001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp (right): https://codereview.chromium.org/2685723005/diff/60001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:56: .extend(Position(&element, text.size())) On 2017/02/16 10:53:39, yosin_UTC9 wrote: > nit: s/text.size()/1/ > > It seems |element| has only one child node. > > > Or > .collapse(Position(element.firstChild(), 0) > .extend(Position(element.firstChild(), text.size() done (I didn't get your main idea so I used proposal from "Or" part ;)) https://codereview.chromium.org/2685723005/diff/60001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:95: // double check test preconditions On 2017/02/16 10:53:39, yosin_UTC9 wrote: > I think we don't need to check preconditions. > If these preconditions break, following assertion will be failed too. Done.
yosin@chromium.org changed reviewers: + tkent@chromium.org
lgtm +tkent@ for HTMLButtonElement.h changes.
lgtm https://codereview.chromium.org/2685723005/diff/80001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp (right): https://codereview.chromium.org/2685723005/diff/80001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:1: // Copyright 2016 The Chromium Authors. All rights reserved. 2016 -> 2017 https://codereview.chromium.org/2685723005/diff/80001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:18: This blank line is unnecessary.
https://codereview.chromium.org/2685723005/diff/80001/third_party/WebKit/Sour... File third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp (right): https://codereview.chromium.org/2685723005/diff/80001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:1: // Copyright 2016 The Chromium Authors. All rights reserved. On 2017/02/17 04:55:18, tkent wrote: > 2016 -> 2017 Done. https://codereview.chromium.org/2685723005/diff/80001/third_party/WebKit/Sour... third_party/WebKit/Source/core/editing/ClipboardEventFlowTest.cpp:18: On 2017/02/17 04:55:18, tkent wrote: > This blank line is unnecessary. Done.
The CQ bit was checked by mwrobel@opera.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: The author mwrobel@opera.com has not signed Google Contributor License Agreement. Please visit https://cla.developers.google.com to sign and manage CLA.
this is my first patch. Could you please run tests (and generally integrate it)?
The CQ bit was checked by tkent@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: The author mwrobel@opera.com has not signed Google Contributor License Agreement. Please visit https://cla.developers.google.com to sign and manage CLA.
The CQ bit was checked by sigbjornf@opera.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: The author mwrobel@opera.com has not signed Google Contributor License Agreement. Please visit https://cla.developers.google.com to sign and manage CLA.
The CQ bit was checked by sigbjornf@opera.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: The author mwrobel@opera.com has not signed Google Contributor License Agreement. Please visit https://cla.developers.google.com to sign and manage CLA.
CQ balks at https://codereview.chromium.org/2685723005/#msg30 . mwrobel@opera.com should be covered by the *@opera.com entry in //AUTHORS afaict. ?
The CQ bit was checked by sigbjornf@opera.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
On 2017/02/17 09:52:59, sof wrote: > CQ balks at https://codereview.chromium.org/2685723005/#msg30 . > mailto:mwrobel@opera.com should be covered by the mailto:*@opera.com entry in //AUTHORS > afaict. ? Handled; had to add mwrobel@ to a separate Opera list.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: win_chromium_x64_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_...)
@yosin please double check additional change (I had to change single webkit test) since when selection is not editable event target is expected to be on active element and when there is no active element (like in changed test exapmle) in body.
The CQ bit was checked by mwrobel@opera.com to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: ios-simulator on master.tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios-simulator/bui...)
The CQ bit was checked by mwrobel@opera.com
The patchset sent to the CQ was uploaded after l-g-t-m from tkent@chromium.org, yosin@chromium.org Link to the patchset: https://codereview.chromium.org/2685723005/#ps120001 (title: "Make Editor::findEventTargetFrom() to align Clipboard API specification")
The CQ bit was unchecked by mwrobel@opera.com
The CQ bit was checked by mwrobel@opera.com
The patchset sent to the CQ was uploaded after l-g-t-m from tkent@chromium.org, yosin@chromium.org Link to the patchset: https://codereview.chromium.org/2685723005/#ps120001 (title: "Make Editor::findEventTargetFrom() to align Clipboard API specification")
The CQ bit was unchecked by mwrobel@opera.com
The CQ bit was checked by mwrobel@opera.com
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
CQ is committing da patch. Bot data: {"patchset_id": 120001, "attempt_start_ts": 1487665877175940, "parent_rev": "2f16bd68bd7e191db66f96d2c761017902074d91", "commit_rev": "7afbab0f7619c89aa7a5896024d1628a59cc0ef1"}
Message was sent while issue was closed.
Description was changed from ========== Make Editor::findEventTargetFrom() to align Clipboard API specification This patch changes |Editor::findEventTargetFrom()| to return focused element if selection start is not editable to align Clipboard API specification[1] for improving interoperability. [1] https://w3c.github.io/clipboard-apis/#to-fire-a-clipboard-event BUG=690104 TEST=webkit_unittests --gtest_filter=ClipboardEventFlowTest.* ========== to ========== Make Editor::findEventTargetFrom() to align Clipboard API specification This patch changes |Editor::findEventTargetFrom()| to return focused element if selection start is not editable to align Clipboard API specification[1] for improving interoperability. [1] https://w3c.github.io/clipboard-apis/#to-fire-a-clipboard-event BUG=690104 TEST=webkit_unittests --gtest_filter=ClipboardEventFlowTest.* Review-Url: https://codereview.chromium.org/2685723005 Cr-Commit-Position: refs/heads/master@{#451716} Committed: https://chromium.googlesource.com/chromium/src/+/7afbab0f7619c89aa7a5896024d1... ==========
Message was sent while issue was closed.
Committed patchset #7 (id:120001) as https://chromium.googlesource.com/chromium/src/+/7afbab0f7619c89aa7a5896024d1...
Message was sent while issue was closed.
On 2017/02/21 at 09:35:25, commit-bot wrote: > Committed patchset #7 (id:120001) as https://chromium.googlesource.com/chromium/src/+/7afbab0f7619c89aa7a5896024d1... lgtm Thanks for fixing!
Message was sent while issue was closed.
A revert of this CL (patchset #7 id:120001) has been created in https://codereview.chromium.org/2745813002/ by luoe@chromium.org. The reason for reverting is: Changing this functionality improved spec conformance, but introduced regressions where text that used to be copied is no longer copied: crbug.com/695568 crbug.com/700163 A proposal to change the spec was made here: https://github.com/w3c/clipboard-apis/issues/40. |