WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
122687
Extract an iterator/resolver class from calculateAdjustedNodes
https://bugs.webkit.org/show_bug.cgi?id=122687
Summary
Extract an iterator/resolver class from calculateAdjustedNodes
Ryosuke Niwa
Reported
2013-10-11 20:01:13 PDT
Right now, we traverse through the DOM tree three times to figure a mouse event. 1. To create EventContexts for each node 2. To set relatedTarget on each context we've created 3. Actually firing events through We reduce this to at most two traversals. In this bug, I'm going to extract EventRelatedNodeResolver class, a stageful iterator class, that lets us update the relatedTarget as we walk up the tree. Using this class, the current calculateAdjustedNodes can be reimplemented as: static size_t calculateAdjustedNodes(Node* relatedNode, const EventPath& eventPath, Vector<RefPtr<Node>>& adjustedNodes) { EventRelatedNodeResolver it(*relatedNode); size_t eventPathSize = eventPath.size(); for (size_t i = 0; i < eventPathSize; i++) adjustedNodes.append(it.moveToParentOrShadowHost(*eventPath.contextAt(i).node())); return eventPathSize; } This allows us to compute the related targets of event contexts as we create them.
Attachments
Cleanup
(9.29 KB, patch)
2013-10-11 20:07 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Patch for landing
(9.63 KB, patch)
2013-10-11 20:24 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Fixed EFL build
(9.63 KB, patch)
2013-10-11 20:33 PDT
,
Ryosuke Niwa
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2013-10-11 20:07:52 PDT
Created
attachment 214046
[details]
Cleanup
Darin Adler
Comment 2
2013-10-11 20:12:02 PDT
Comment on
attachment 214046
[details]
Cleanup View in context:
https://bugs.webkit.org/attachment.cgi?id=214046&action=review
Surprised that so much if this in terms of nodes rather than elements.
> Source/WebCore/dom/EventContext.h:98 > + enum TouchListType { > + Touches, > + TargetTouches, > + ChangedTouches, > + };
I think this would read nicely on one line.
> Source/WebCore/dom/EventContext.h:100 > + TouchList* touchList(TouchListType type)
Why a pointer instead of a reference for the return value?
> Source/WebCore/dom/EventContext.h:111 > + return 0;
nullptr
> Source/WebCore/dom/EventDispatcher.cpp:114 > + , m_relatedNodeInCurrentTreeScope(0) > + , m_currentTreeScope(0)
nullptr
> Source/WebCore/dom/EventDispatcher.cpp:115 > + { }
When the rest of the definition is vertical, I prefer that this be vertical too: { }
> Source/WebCore/dom/EventDispatcher.cpp:117 > + Node* moveToParentOrShadowHost(Node& newTarget)
Does the return value really need to be a pointer?
> Source/WebCore/dom/EventDispatcher.cpp:413 > + EventRelatedNodeResolver it(*touch.target()->toNode());
I suggest the name resolver rather than it.
> Source/WebCore/dom/EventDispatcher.cpp:436 > + EventRelatedNodeResolver it(*relatedNode);
I suggest calling this resolver rather than it.
EFL EWS Bot
Comment 3
2013-10-11 20:12:15 PDT
Comment on
attachment 214046
[details]
Cleanup
Attachment 214046
[details]
did not pass efl-ews (efl): Output:
http://webkit-queues.appspot.com/results/3953292
Ryosuke Niwa
Comment 4
2013-10-11 20:24:07 PDT
Created
attachment 214047
[details]
Patch for landing
EFL EWS Bot
Comment 5
2013-10-11 20:29:18 PDT
Comment on
attachment 214047
[details]
Patch for landing
Attachment 214047
[details]
did not pass efl-ews (efl): Output:
http://webkit-queues.appspot.com/results/3951268
EFL EWS Bot
Comment 6
2013-10-11 20:30:53 PDT
Comment on
attachment 214047
[details]
Patch for landing
Attachment 214047
[details]
did not pass efl-wk2-ews (efl-wk2): Output:
http://webkit-queues.appspot.com/results/3766348
Ryosuke Niwa
Comment 7
2013-10-11 20:33:32 PDT
Created
attachment 214048
[details]
Fixed EFL build
WebKit Commit Bot
Comment 8
2013-10-11 21:51:13 PDT
Comment on
attachment 214048
[details]
Fixed EFL build Clearing flags on attachment: 214048 Committed
r157331
: <
http://trac.webkit.org/changeset/157331
>
WebKit Commit Bot
Comment 9
2013-10-11 21:51:16 PDT
All reviewed patches have been landed. Closing bug.
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