| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 8 * Copyright (C) 2011 Google Inc. All rights reserved. | 8 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 { | 59 { |
| 60 ASSERT(referenceNode); | 60 ASSERT(referenceNode); |
| 61 | 61 |
| 62 #if ENABLE(SVG) | 62 #if ENABLE(SVG) |
| 63 if (!referenceNode->isSVGElement() || !referenceNode->isInShadowTree()) | 63 if (!referenceNode->isSVGElement() || !referenceNode->isInShadowTree()) |
| 64 return referenceNode; | 64 return referenceNode; |
| 65 | 65 |
| 66 // Spec: The event handling for the non-exposed tree works as if the referen
ced element had been textually included | 66 // Spec: The event handling for the non-exposed tree works as if the referen
ced element had been textually included |
| 67 // as a deeply cloned child of the 'use' element, except that events are dis
patched to the SVGElementInstance objects | 67 // as a deeply cloned child of the 'use' element, except that events are dis
patched to the SVGElementInstance objects |
| 68 Element* shadowHostElement = referenceNode->treeScope()->rootNode()->shadowH
ost(); | 68 Element* shadowHostElement = referenceNode->treeScope()->rootNode()->shadowH
ost(); |
| 69 // At this time, SVG nodes are not allowed in non-<use> shadow trees, so any
shadow root we do | 69 // At this time, SVG nodes are not supported in non-<use> shadow trees. |
| 70 // have should be a use. The assert and following test is here to catch futu
re shadow DOM changes | 70 if (!shadowHostElement || !shadowHostElement->hasTagName(SVGNames::useTag)) |
| 71 // that do enable SVG in a shadow tree. | 71 return referenceNode; |
| 72 ASSERT(!shadowHostElement || shadowHostElement->hasTagName(SVGNames::useTag)
); | 72 SVGUseElement* useElement = static_cast<SVGUseElement*>(shadowHostElement); |
| 73 if (shadowHostElement && shadowHostElement->hasTagName(SVGNames::useTag)) { | 73 if (SVGElementInstance* instance = useElement->instanceForShadowTreeElement(
referenceNode)) |
| 74 SVGUseElement* useElement = static_cast<SVGUseElement*>(shadowHostElemen
t); | 74 return instance; |
| 75 | |
| 76 if (SVGElementInstance* instance = useElement->instanceForShadowTreeElem
ent(referenceNode)) | |
| 77 return instance; | |
| 78 } | |
| 79 #endif | 75 #endif |
| 80 | 76 |
| 81 return referenceNode; | 77 return referenceNode; |
| 82 } | 78 } |
| 83 | 79 |
| 84 void EventDispatcher::dispatchScopedEvent(Node* node, PassRefPtr<EventDispatchMe
diator> mediator) | 80 void EventDispatcher::dispatchScopedEvent(Node* node, PassRefPtr<EventDispatchMe
diator> mediator) |
| 85 { | 81 { |
| 86 // We need to set the target here because it can go away by the time we actu
ally fire the event. | 82 // We need to set the target here because it can go away by the time we actu
ally fire the event. |
| 87 mediator->event()->setTarget(eventTargetRespectingSVGTargetRules(node)); | 83 mediator->event()->setTarget(eventTargetRespectingSVGTargetRules(node)); |
| 88 ScopedEventQueue::instance()->enqueueEventDispatchMediator(mediator); | 84 ScopedEventQueue::instance()->enqueueEventDispatchMediator(mediator); |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 // WebKit never allowed selectstart event to cross the the shadow DOM bounda
ry. | 388 // WebKit never allowed selectstart event to cross the the shadow DOM bounda
ry. |
| 393 // Changing this breaks existing sites. | 389 // Changing this breaks existing sites. |
| 394 // See https://bugs.webkit.org/show_bug.cgi?id=52195 for details. | 390 // See https://bugs.webkit.org/show_bug.cgi?id=52195 for details. |
| 395 if (event->type() == eventNames().selectstartEvent) | 391 if (event->type() == eventNames().selectstartEvent) |
| 396 return StayInsideShadowDOM; | 392 return StayInsideShadowDOM; |
| 397 | 393 |
| 398 return RetargetEvent; | 394 return RetargetEvent; |
| 399 } | 395 } |
| 400 | 396 |
| 401 } | 397 } |
| OLD | NEW |