WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
56324
EventHandler calls shouldChangeSelection needlessly
https://bugs.webkit.org/show_bug.cgi?id=56324
Summary
EventHandler calls shouldChangeSelection needlessly
Ryosuke Niwa
Reported
2011-03-14 12:46:45 PDT
Currently, EventHandler::updateSelectionForMouseDrag calls shouldChangeSelection regardless of whether current selection is different from new selection or not. We should not call shouldChangeSelection when no change is needed.
Attachments
fixes the bug
(30.89 KB, patch)
2011-03-14 17:37 PDT
,
Ryosuke Niwa
darin
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2011-03-14 17:37:52 PDT
Created
attachment 85746
[details]
fixes the bug
Darin Adler
Comment 2
2011-03-14 17:51:44 PDT
Comment on
attachment 85746
[details]
fixes the bug View in context:
https://bugs.webkit.org/attachment.cgi?id=85746&action=review
> Source/WebCore/page/EventHandler.cpp:662 > - if (m_frame->selection()->shouldChangeSelection(newSelection)) { > - m_frame->selection()->setIsDirectional(false); > - m_frame->selection()->setSelection(newSelection, m_frame->selection()->granularity(), MakeNonDirectionalSelection); > - } > + setNonDirectionalSelectionIfNeeded(m_frame->selection(), newSelection, m_frame->selection()->granularity());
What does the setIsDirectional(false) work in the new code?
Ryosuke Niwa
Comment 3
2011-03-14 17:54:02 PDT
(In reply to
comment #2
)
> (From update of
attachment 85746
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=85746&action=review
> > > Source/WebCore/page/EventHandler.cpp:662 > > - if (m_frame->selection()->shouldChangeSelection(newSelection)) { > > - m_frame->selection()->setIsDirectional(false); > > - m_frame->selection()->setSelection(newSelection, m_frame->selection()->granularity(), MakeNonDirectionalSelection); > > - } > > + setNonDirectionalSelectionIfNeeded(m_frame->selection(), newSelection, m_frame->selection()->granularity()); > > What does the setIsDirectional(false) work in the new code?
The first thing SelectionController::setSelection does is to call setIsDirectional(directionalityPolicy == MakeDirectionalSelection) so call to setIsDirectional here was completely redundant.
Ryosuke Niwa
Comment 4
2011-03-14 17:56:33 PDT
Having said that, there's a behavioral change that after this patch WebKit won't change previously directional selection to non-directional in EventHandler but that's rarely an issue because I don't think users nor scripts can make such changes.
Ryosuke Niwa
Comment 5
2011-03-14 17:57:25 PDT
(In reply to
comment #4
)
>that's rarely
should read "that shouldn't be"
Ryosuke Niwa
Comment 6
2011-03-14 19:07:26 PDT
Committed
r81095
: <
http://trac.webkit.org/changeset/81095
>
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