summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/ShadowRoot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/dom/ShadowRoot.cpp')
-rw-r--r--Source/WebCore/dom/ShadowRoot.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/Source/WebCore/dom/ShadowRoot.cpp b/Source/WebCore/dom/ShadowRoot.cpp
index 0da9f27a9..75192cded 100644
--- a/Source/WebCore/dom/ShadowRoot.cpp
+++ b/Source/WebCore/dom/ShadowRoot.cpp
@@ -38,6 +38,7 @@
#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "HTMLTextAreaElement.h"
+#include "HistogramSupport.h"
#include "InsertionPoint.h"
#include "NodeRareData.h"
#include "RuntimeEnabledFeatures.h"
@@ -86,8 +87,28 @@ static bool allowsAuthorShadowRoot(Element* element)
return element->areAuthorShadowsAllowed();
}
+enum ShadowRootUsageOriginType {
+ ShadowRootUsageOriginWeb = 0,
+ ShadowRootUsageOriginNotWeb,
+ ShadowRootUsageOriginTypes
+};
+
+static inline ShadowRootUsageOriginType determineUsageType(Element* host)
+{
+ // Enables only on CHROMIUM since this cost won't worth paying for platforms which don't collect this metrics.
+#if PLATFORM(CHROMIUM)
+ if (!host)
+ return ShadowRootUsageOriginWeb;
+ return host->document()->url().string().startsWith("http") ? ShadowRootUsageOriginWeb : ShadowRootUsageOriginNotWeb;
+#else
+ UNUSED_PARAM(host);
+ return ShadowRootUsageOriginWeb;
+#endif
+}
+
PassRefPtr<ShadowRoot> ShadowRoot::create(Element* element, ExceptionCode& ec)
{
+ HistogramSupport::histogramEnumeration("WebCore.ShadowRoot.constructor", determineUsageType(element), ShadowRootUsageOriginTypes);
return create(element, AuthorShadowRoot, ec);
}
@@ -215,8 +236,7 @@ void ShadowRoot::attach()
{
StyleResolver* styleResolver = document()->styleResolver();
styleResolver->pushParentShadowRoot(this);
- attachChildren();
- attachAsNode();
+ DocumentFragment::attach();
styleResolver->popParentShadowRoot(this);
}