| Index: Source/WebCore/dom/Document.cpp
|
| ===================================================================
|
| --- Source/WebCore/dom/Document.cpp (revision 139390)
|
| +++ Source/WebCore/dom/Document.cpp (working copy)
|
| @@ -690,7 +690,7 @@
|
| m_docType = 0;
|
| m_focusedNode = 0;
|
| m_hoverNode = 0;
|
| - m_activeNode = 0;
|
| + m_activeElement = 0;
|
| m_titleElement = 0;
|
| m_documentElement = 0;
|
| m_contextFeatures = ContextFeatures::defaultSwitch();
|
| @@ -2121,7 +2121,7 @@
|
|
|
| m_hoverNode = 0;
|
| m_focusedNode = 0;
|
| - m_activeNode = 0;
|
| + m_activeElement = 0;
|
|
|
| ContainerNode::detach();
|
|
|
| @@ -3240,7 +3240,12 @@
|
|
|
| void Document::setActiveNode(PassRefPtr<Node> newActiveNode)
|
| {
|
| - m_activeNode = newActiveNode;
|
| + if (!newActiveNode) {
|
| + m_activeElement.clear();
|
| + return;
|
| + }
|
| +
|
| + m_activeElement = newActiveNode->isElementNode() ? toElement(newActiveNode.get()) : newActiveNode->parentElement();
|
| }
|
|
|
| void Document::focusedNodeRemoved()
|
| @@ -3281,12 +3286,12 @@
|
|
|
| void Document::activeChainNodeDetached(Node* node)
|
| {
|
| - if (!m_activeNode || (node != m_activeNode && (!m_activeNode->isTextNode() || node != m_activeNode->parentNode())))
|
| + if (!m_activeElement || (node != m_activeElement && (!m_activeElement->isTextNode() || node != m_activeElement->parentNode())))
|
| return;
|
|
|
| - m_activeNode = node->parentNode();
|
| - while (m_activeNode && !m_activeNode->renderer())
|
| - m_activeNode = m_activeNode->parentNode();
|
| + m_activeElement = node->parentElement();
|
| + while (m_activeElement && !m_activeElement->renderer())
|
| + m_activeElement = m_activeElement->parentElement();
|
| }
|
|
|
| #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(DRAGGABLE_REGION)
|
| @@ -5811,7 +5816,7 @@
|
| Node* innerNodeInDocument = result.innerNode();
|
| ASSERT(!innerNodeInDocument || innerNodeInDocument->document() == this);
|
|
|
| - Node* oldActiveNode = activeNode();
|
| + Node* oldActiveNode = activeElement();
|
| if (oldActiveNode && !request.active()) {
|
| // We are clearing the :active chain because the mouse has been released.
|
| for (RenderObject* curr = oldActiveNode->renderer(); curr; curr = curr->parent()) {
|
| @@ -5830,12 +5835,13 @@
|
| if (curr->node() && !curr->isText())
|
| m_userActionElements.setInActiveChain(curr->node(), true);
|
| }
|
| +
|
| setActiveNode(newActiveNode);
|
| }
|
| }
|
| // If the mouse has just been pressed, set :active on the chain. Those (and only those)
|
| // nodes should remain :active until the mouse is released.
|
| - bool allowActiveChanges = !oldActiveNode && activeNode();
|
| + bool allowActiveChanges = !oldActiveNode && activeElement();
|
|
|
| // If the mouse is down and if this is a mouse move event, we want to restrict changes in
|
| // :hover/:active to only apply to elements that are in the :active chain that we froze
|
|
|