blur() on shadow host should work when a shadow host contains a focused element in...
[WebKit-https.git] / Source / WebCore / dom / ShadowRoot.h
index e760558f9cdb5ca84042f4c595f340109800d9d1..58b48c64b5b8953a9a2a29ad8fbb4ee3c4104c2b 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "Document.h"
 #include "DocumentFragment.h"
+#include "Element.h"
 #include "ExceptionCode.h"
 #include "TreeScope.h"
 #include <wtf/DoublyLinkedList.h>
@@ -122,8 +123,8 @@ inline bool ShadowRoot::isUsedForRendering() const
 
 inline Element* ShadowRoot::activeElement() const
 {
-    if (document()->isHTMLDocument())
-        return treeScope()->activeElement();
+    if (Node* node = treeScope()->focusedNode())
+        return node->isElementNode() ? toElement(node) : 0;
     return 0;
 }