WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
142453
<attachment> shouldn't use "user-select: all"
https://bugs.webkit.org/show_bug.cgi?id=142453
Summary
<attachment> shouldn't use "user-select: all"
Tim Horton
Reported
2015-03-08 00:44:59 PST
<attachment> shouldn't use "user-select: all"
Attachments
Patch
(35.24 KB, patch)
2015-03-08 00:45 PST
,
Tim Horton
darin
: review+
buildbot
: commit-queue-
Details
Formatted Diff
Diff
Archive of layout-test-results from ews101 for mac-mavericks
(571.40 KB, application/zip)
2015-03-08 01:50 PST
,
Build Bot
no flags
Details
Archive of layout-test-results from ews107 for mac-mavericks-wk2
(718.90 KB, application/zip)
2015-03-08 01:55 PST
,
Build Bot
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Tim Horton
Comment 1
2015-03-08 00:45:23 PST
Created
attachment 248184
[details]
Patch
Radar WebKit Bug Importer
Comment 2
2015-03-08 00:46:08 PST
<
rdar://problem/20085435
>
Build Bot
Comment 3
2015-03-08 01:50:43 PST
Comment on
attachment 248184
[details]
Patch
Attachment 248184
[details]
did not pass mac-ews (mac): Output:
http://webkit-queues.appspot.com/results/4673194791272448
New failing tests: fast/attachment/attachment-select-on-click-inside-user-select-all.html fast/attachment/attachment-select-on-click.html
Build Bot
Comment 4
2015-03-08 01:50:46 PST
Created
attachment 248185
[details]
Archive of layout-test-results from ews101 for mac-mavericks The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-mavericks Platform: Mac OS X 10.9.5
Build Bot
Comment 5
2015-03-08 01:55:21 PST
Comment on
attachment 248184
[details]
Patch
Attachment 248184
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
http://webkit-queues.appspot.com/results/6024353921630208
New failing tests: fast/attachment/attachment-select-on-click-inside-user-select-all.html fast/attachment/attachment-select-on-click.html
Build Bot
Comment 6
2015-03-08 01:55:24 PST
Created
attachment 248186
[details]
Archive of layout-test-results from ews107 for mac-mavericks-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-mavericks-wk2 Platform: Mac OS X 10.9.5
Darin Adler
Comment 7
2015-03-08 10:55:30 PDT
Comment on
attachment 248184
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=248184&action=review
Tests are failing on bot. Please don’t land until that’s resolved, of course.
> Source/WebCore/page/EventHandler.cpp:525 > +static VisibleSelection expandSelectionToRespectSelectOnMouseDown(Node* targetNode, const VisibleSelection& selection)
This function should take a reference, not a pointer, for targetNode. It unconditionally dereferences targetNode so it won’t work on null. The name of this seems slightly too specific. Before it was specifically “user select all”, not it’s specifically “select on mouse down”, but really the function respects both. Is there wording that is brief, clear, and encompasses both? Or is “select on mouse down” already ambiguous in just the right way to encompass both?
> Source/WebCore/page/EventHandler.cpp:529 > + if (targetNode->shouldSelectOnMouseDown()) > + nodeToSelect = targetNode;
It’s wasteful to do this work when the USERSELECT_ALL paragraph might just overwrite this without ever looking at nodeToSelect. Worth rearranging so that’s not done.
> Source/WebCore/page/EventHandler.cpp:536 > Node* rootUserSelectAll = Position::rootUserSelectAllForNode(targetNode); > - if (!rootUserSelectAll) > + if (!rootUserSelectAll && !nodeToSelect) > return selection; > + if (rootUserSelectAll) > + nodeToSelect = rootUserSelectAll;
When USERSELECT_ALL is enabled, this function returns the passed-in selection if it’s passed a node that returns false for shouldSelectOnMouseDown. But when it’s not, it instead returns a VisibleSelection of null. We should not have that kind of subtle difference in behavior. I suggest structuring the code so the early exit is: if (!nodeToSelect) return selection; And it’s unconditional. The USERSELECT_ALL paragraph would be only: if (Node* rootUserSelectAll = Position::rootUserSelectAllForNode(&targetNode)) nodeToSelect = rootUserSelectAll; I think the function might read more clearly if we broke out another small function that decides which node should be selected, just to separate the selection machinery from the decision making more clearly and give more opportunities to use return in a more straightforward way.
Tim Horton
Comment 8
2015-03-09 08:45:32 PDT
(In reply to
comment #7
)
> Comment on
attachment 248184
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=248184&action=review
> > Tests are failing on bot. Please don’t land until that’s resolved, of course. > > > Source/WebCore/page/EventHandler.cpp:525 > > +static VisibleSelection expandSelectionToRespectSelectOnMouseDown(Node* targetNode, const VisibleSelection& selection) > > This function should take a reference, not a pointer, for targetNode. It > unconditionally dereferences targetNode so it won’t work on null. > > The name of this seems slightly too specific. Before it was specifically > “user select all”, not it’s specifically “select on mouse down”, but really > the function respects both. Is there wording that is brief, clear, and > encompasses both? Or is “select on mouse down” already ambiguous in just the > right way to encompass both?
Yeah, I don't know what to do with the name. I was trying to be sufficiently vague that that name might work, but it certainly isn't great.
> > Source/WebCore/page/EventHandler.cpp:529 > > + if (targetNode->shouldSelectOnMouseDown()) > > + nodeToSelect = targetNode; > > It’s wasteful to do this work when the USERSELECT_ALL paragraph might just > overwrite this without ever looking at nodeToSelect. Worth rearranging so > that’s not done.
Quite right.
> > Source/WebCore/page/EventHandler.cpp:536 > > Node* rootUserSelectAll = Position::rootUserSelectAllForNode(targetNode); > > - if (!rootUserSelectAll) > > + if (!rootUserSelectAll && !nodeToSelect) > > return selection; > > + if (rootUserSelectAll) > > + nodeToSelect = rootUserSelectAll; > > When USERSELECT_ALL is enabled, this function returns the passed-in > selection if it’s passed a node that returns false for > shouldSelectOnMouseDown. But when it’s not, it instead returns a > VisibleSelection of null. We should not have that kind of subtle difference > in behavior. I suggest structuring the code so the early exit is: > > if (!nodeToSelect) > return selection; > > And it’s unconditional. The USERSELECT_ALL paragraph would be only: > > if (Node* rootUserSelectAll = > Position::rootUserSelectAllForNode(&targetNode)) > nodeToSelect = rootUserSelectAll; > > I think the function might read more clearly if we broke out another small > function that decides which node should be selected, just to separate the > selection machinery from the decision making more clearly and give more > opportunities to use return in a more straightforward way.
Yes! OK, that sounds good. I wasn't happy with the somewhat convoluted logic of this function, but wasn't sure how to make it better. That sounds like a good plan.
Tim Horton
Comment 9
2015-03-11 17:34:10 PDT
http://trac.webkit.org/changeset/181418
Tim Horton
Comment 10
2015-03-11 17:38:50 PDT
And
http://trac.webkit.org/changeset/181420
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