Add HitTestResult::setToNonShadowAncestor
authoraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Jul 2007 02:59:52 +0000 (02:59 +0000)
committeraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Jul 2007 02:59:52 +0000 (02:59 +0000)
Reviewed by Sam.

* page/EventHandler.cpp:
(WebCore::EventHandler::hitTestResultAtPoint): Moved logic into
HitTestResult::setToNonShadowAncestor.
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::setToNonShadowAncestor):
* rendering/HitTestResult.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@23995 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/page/EventHandler.cpp
WebCore/rendering/HitTestResult.cpp
WebCore/rendering/HitTestResult.h

index c8da7a1787585ed850d13dff0c47b62da3f43abd..bd16f3b6d04a7959d11d887dd5f2a7495c6df8b3 100644 (file)
@@ -1,3 +1,16 @@
+2007-07-04  Adam Roben  <aroben@apple.com>
+
+        Add HitTestResult::setToNonShadowAncestor
+
+        Reviewed by Sam.
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::hitTestResultAtPoint): Moved logic into
+        HitTestResult::setToNonShadowAncestor.
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::setToNonShadowAncestor):
+        * rendering/HitTestResult.h:
+
 2007-07-04  Adam Roben  <aroben@apple.com>
 
         Change MouseEventWithHitTestResults to hold onto a HitTestResult
index af55c81f04e39e5a7443607b3fec57a894c73aa5..245065eacc5ea53b8e177c911e7a81cf479a88c8 100644 (file)
@@ -541,16 +541,8 @@ HitTestResult EventHandler::hitTestResultAtPoint(const IntPoint& point, bool all
         result = widgetHitTestResult;
     }
 
-    if (!allowShadowContent) {
-        Node* node = result.innerNode();
-        if (node)
-            node = node->shadowAncestorNode();
-        result.setInnerNode(node);
-        node = result.innerNonSharedNode();
-        if (node)
-            node = node->shadowAncestorNode();
-        result.setInnerNonSharedNode(node); 
-    }
+    if (!allowShadowContent)
+        result.setToNonShadowAncestor();
 
     return result;
 }
index 956e7bedee42997552b99db0e6992ea22f932a0f..4da4c7299354e4685ccce048de7a70bf22372949 100644 (file)
@@ -76,6 +76,18 @@ HitTestResult& HitTestResult::operator=(const HitTestResult& other)
     return *this;
 }
 
+void HitTestResult::setToNonShadowAncestor()
+{
+    Node* node = innerNode();
+    if (node)
+        node = node->shadowAncestorNode();
+    setInnerNode(node);
+    node = innerNonSharedNode();
+    if (node)
+        node = node->shadowAncestorNode();
+    setInnerNonSharedNode(node);
+}
+
 void HitTestResult::setInnerNode(Node* n)
 {
     m_innerNode = n;
index d87e3223bb1d28eb8023c37369e27531b14e4243..50639720fbda4594aff97355fd29d877fa75b016 100644 (file)
@@ -50,6 +50,8 @@ public:
     Element* URLElement() const { return m_innerURLElement.get(); }
     PlatformScrollbar* scrollbar() const { return m_scrollbar.get(); }
 
+    void setToNonShadowAncestor();
+
     void setInnerNode(Node*);
     void setInnerNonSharedNode(Node*);
     void setPoint(const IntPoint& p) { m_point = p; }