Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1011)

Unified Diff: Source/core/page/EventHandler.cpp

Issue 266063002: Store SVGElement instead of SVGElementInstance for instancesForElement (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/page/EventHandler.cpp
diff --git a/Source/core/page/EventHandler.cpp b/Source/core/page/EventHandler.cpp
index fe0fcb17693312a9b493ac1bc5c384a54ad16bae..f49e71b9a6b850c379b5fbdc7f7d014c2d477e2b 100644
--- a/Source/core/page/EventHandler.cpp
+++ b/Source/core/page/EventHandler.cpp
@@ -85,7 +85,6 @@
#include "core/rendering/style/CursorList.h"
#include "core/rendering/style/RenderStyle.h"
#include "core/svg/SVGDocument.h"
-#include "core/svg/SVGElementInstance.h"
#include "core/svg/SVGUseElement.h"
#include "platform/PlatformGestureEvent.h"
#include "platform/PlatformKeyboardEvent.h"
@@ -260,7 +259,6 @@ void EventHandler::clear()
m_resizeScrollableArea = 0;
m_nodeUnderMouse = nullptr;
m_lastNodeUnderMouse = nullptr;
- m_lastInstanceUnderMouse = nullptr;
m_lastMouseMoveEventSubframe = nullptr;
m_lastScrollbarUnderMouse = nullptr;
m_clickCount = 0;
@@ -1804,22 +1802,6 @@ MouseEventWithHitTestResults EventHandler::prepareMouseEvent(const HitTestReques
return m_frame->document()->prepareMouseEvent(request, documentPointForWindowPoint(m_frame, mev.position()), mev);
}
-static inline SVGElementInstance* instanceAssociatedWithShadowTreeElement(Node* referenceNode)
-{
- if (!referenceNode || !referenceNode->isSVGElement())
- return 0;
-
- ShadowRoot* shadowRoot = referenceNode->containingShadowRoot();
- if (!shadowRoot)
- return 0;
-
- Element* shadowTreeParentElement = shadowRoot->host();
- if (!isSVGUseElement(shadowTreeParentElement))
- return 0;
-
- return toSVGUseElement(shadowTreeParentElement)->instanceForShadowTreeElement(referenceNode);
-}
-
void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMouseEvent& mouseEvent, bool fireMouseOverOut)
{
Node* result = targetNode;
@@ -1834,37 +1816,6 @@ void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
}
m_nodeUnderMouse = result;
- // <use> shadow tree elements may have been recloned, update node under mouse in any case
- if (m_lastInstanceUnderMouse) {
- SVGElement* lastCorrespondingElement = m_lastInstanceUnderMouse->correspondingElement();
- SVGElement* lastCorrespondingUseElement = m_lastInstanceUnderMouse->correspondingUseElement();
-
- if (lastCorrespondingElement && lastCorrespondingUseElement) {
- HashSet<SVGElementInstance*> instances = lastCorrespondingElement->instancesForElement();
-
- // Locate the recloned shadow tree element for our corresponding instance
- HashSet<SVGElementInstance*>::iterator end = instances.end();
- for (HashSet<SVGElementInstance*>::iterator it = instances.begin(); it != end; ++it) {
- SVGElementInstance* instance = (*it);
- ASSERT(instance->correspondingElement() == lastCorrespondingElement);
-
- if (instance == m_lastInstanceUnderMouse)
- continue;
-
- if (instance->correspondingUseElement() != lastCorrespondingUseElement)
- continue;
-
- SVGElement* shadowTreeElement = instance->shadowTreeElement();
- if (!shadowTreeElement->inDocument() || m_lastNodeUnderMouse == shadowTreeElement)
- continue;
-
- m_lastNodeUnderMouse = shadowTreeElement;
- m_lastInstanceUnderMouse = instance;
- break;
- }
- }
- }
-
// Fire mouseout/mouseover if the mouse has shifted to a different node.
if (fireMouseOverOut) {
RenderLayer* layerForLastNode = layerForNode(m_lastNodeUnderMouse.get());
@@ -1898,7 +1849,6 @@ void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
if (m_lastNodeUnderMouse && m_lastNodeUnderMouse->document() != m_frame->document()) {
m_lastNodeUnderMouse = nullptr;
m_lastScrollbarUnderMouse = nullptr;
- m_lastInstanceUnderMouse = nullptr;
}
if (m_lastNodeUnderMouse != m_nodeUnderMouse) {
@@ -1910,7 +1860,6 @@ void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMo
m_nodeUnderMouse->dispatchMouseEvent(mouseEvent, EventTypeNames::mouseover, 0, m_lastNodeUnderMouse.get());
}
m_lastNodeUnderMouse = m_nodeUnderMouse;
- m_lastInstanceUnderMouse = instanceAssociatedWithShadowTreeElement(m_nodeUnderMouse.get());
}
}

Powered by Google App Engine
This is Rietveld 408576698