[Webkit-unassigned] [Bug 122687] New: Extract an iterator/resolver class from calculateAdjustedNodes

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 11 20:02:26 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=122687

           Summary: Extract an iterator/resolver class from
                    calculateAdjustedNodes
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Unspecified
        OS/Version: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Event Handling
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: rniwa at webkit.org
                CC: andersca at apple.com, sam at webkit.org, koivisto at iki.fi,
                    akling at apple.com


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.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list