Title: [139391] branches/chromium/1364
Revision
139391
Author
cev...@google.com
Date
2013-01-10 17:54:20 -0800 (Thu, 10 Jan 2013)

Log Message

Merge 139029
BUG=167868
Review URL: https://codereview.chromium.org/11840004

Modified Paths

Added Paths

Diff

Copied: branches/chromium/1364/LayoutTests/svg/custom/text-use-click-crash-expected.txt (from rev 139029, trunk/LayoutTests/svg/custom/text-use-click-crash-expected.txt) (0 => 139391)


--- branches/chromium/1364/LayoutTests/svg/custom/text-use-click-crash-expected.txt	                        (rev 0)
+++ branches/chromium/1364/LayoutTests/svg/custom/text-use-click-crash-expected.txt	2013-01-11 01:54:20 UTC (rev 139391)
@@ -0,0 +1 @@
+PASS

Copied: branches/chromium/1364/LayoutTests/svg/custom/text-use-click-crash.xhtml (from rev 139029, trunk/LayoutTests/svg/custom/text-use-click-crash.xhtml) (0 => 139391)


--- branches/chromium/1364/LayoutTests/svg/custom/text-use-click-crash.xhtml	                        (rev 0)
+++ branches/chromium/1364/LayoutTests/svg/custom/text-use-click-crash.xhtml	2013-01-11 01:54:20 UTC (rev 139391)
@@ -0,0 +1,33 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<body>
+<svg viewBox="0 0 480 360" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">
+    <text font-size="58em" id="target">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX</text>
+    <use xlink:href=""
+</svg>
+<script><![CDATA[
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+function keyDownMouseClick(x1, y1, x2, y2)
+{
+    if (!window.eventSender)
+        return;
+    eventSender.mouseMoveTo(x1, y1);
+    eventSender.mouseDown();
+    eventSender.mouseMoveTo(x2, y2);
+    eventSender.mouseUp();
+}
+
+target = document.getElementById("target");
+keyDownMouseClick(266, 322, 0, 0);
+target.setAttribute("requiredFeatures", "unknown_feature"); 
+keyDownMouseClick(226, 322, 0, 0);
+
+document.body.innerHTML = "PASS";
+testRunner.notifyDone();
+
+]]></script>
+</body>
+</html>

Modified: branches/chromium/1364/Source/WebCore/dom/Document.cpp (139390 => 139391)


--- branches/chromium/1364/Source/WebCore/dom/Document.cpp	2013-01-11 01:42:55 UTC (rev 139390)
+++ branches/chromium/1364/Source/WebCore/dom/Document.cpp	2013-01-11 01:54:20 UTC (rev 139391)
@@ -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

Modified: branches/chromium/1364/Source/WebCore/dom/Document.h (139390 => 139391)


--- branches/chromium/1364/Source/WebCore/dom/Document.h	2013-01-11 01:42:55 UTC (rev 139390)
+++ branches/chromium/1364/Source/WebCore/dom/Document.h	2013-01-11 01:54:20 UTC (rev 139391)
@@ -699,7 +699,7 @@
     Node* hoverNode() const { return m_hoverNode.get(); }
 
     void setActiveNode(PassRefPtr<Node>);
-    Node* activeNode() const { return m_activeNode.get(); }
+    Element* activeElement() const { return m_activeElement.get(); }
 
     void focusedNodeRemoved();
     void removeFocusedNodeOfSubtree(Node*, bool amongChildrenOnly = false);
@@ -1340,7 +1340,7 @@
 
     RefPtr<Node> m_focusedNode;
     RefPtr<Node> m_hoverNode;
-    RefPtr<Node> m_activeNode;
+    RefPtr<Element> m_activeElement;
     RefPtr<Element> m_documentElement;
     UserActionElementSet m_userActionElements;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to