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

Side by Side Diff: Source/WebCore/dom/ShadowRoot.cpp

Issue 12518022: Merge 143840 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 9 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 unified diff | Download patch
« no previous file with comments | « Source/WebCore/dom/ShadowRoot.h ('k') | Source/WebCore/dom/TreeScope.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 COMPILE_ASSERT(sizeof(ShadowRoot) == sizeof(SameSizeAsShadowRoot), shadowroot_sh ould_stay_small); 46 COMPILE_ASSERT(sizeof(ShadowRoot) == sizeof(SameSizeAsShadowRoot), shadowroot_sh ould_stay_small);
47 47
48 enum ShadowRootUsageOriginType { 48 enum ShadowRootUsageOriginType {
49 ShadowRootUsageOriginWeb = 0, 49 ShadowRootUsageOriginWeb = 0,
50 ShadowRootUsageOriginNotWeb, 50 ShadowRootUsageOriginNotWeb,
51 ShadowRootUsageOriginMax 51 ShadowRootUsageOriginMax
52 }; 52 };
53 53
54 ShadowRoot::ShadowRoot(Document* document, ShadowRootType type) 54 ShadowRoot::ShadowRoot(Document* document, ShadowRootType type)
55 : DocumentFragment(document, CreateShadowRoot) 55 : DocumentFragment(0, CreateShadowRoot)
56 , TreeScope(this, document) 56 , TreeScope(this, document)
57 , m_prev(0) 57 , m_prev(0)
58 , m_next(0) 58 , m_next(0)
59 , m_numberOfStyles(0) 59 , m_numberOfStyles(0)
60 , m_applyAuthorStyles(false) 60 , m_applyAuthorStyles(false)
61 , m_resetStyleInheritance(false) 61 , m_resetStyleInheritance(false)
62 , m_type(type) 62 , m_type(type)
63 , m_registeredWithParentShadowRoot(false) 63 , m_registeredWithParentShadowRoot(false)
64 { 64 {
65 ASSERT(document); 65 ASSERT(document);
66 setTreeScope(this);
67 66
68 #if PLATFORM(CHROMIUM) 67 #if PLATFORM(CHROMIUM)
69 if (type == ShadowRoot::AuthorShadowRoot) { 68 if (type == ShadowRoot::AuthorShadowRoot) {
70 ShadowRootUsageOriginType usageType = document->url().protocolIsInHTTPFa mily() ? ShadowRootUsageOriginWeb : ShadowRootUsageOriginNotWeb; 69 ShadowRootUsageOriginType usageType = document->url().protocolIsInHTTPFa mily() ? ShadowRootUsageOriginWeb : ShadowRootUsageOriginNotWeb;
71 HistogramSupport::histogramEnumeration("WebCore.ShadowRoot.constructor", usageType, ShadowRootUsageOriginMax); 70 HistogramSupport::histogramEnumeration("WebCore.ShadowRoot.constructor", usageType, ShadowRootUsageOriginMax);
72 } 71 }
73 #endif 72 #endif
74 } 73 }
75 74
76 ShadowRoot::~ShadowRoot() 75 ShadowRoot::~ShadowRoot()
77 { 76 {
78 ASSERT(!m_prev); 77 ASSERT(!m_prev);
79 ASSERT(!m_next); 78 ASSERT(!m_next);
80 79
81 // We must remove all of our children first before the TreeScope destructor 80 // We must remove all of our children first before the TreeScope destructor
82 // runs so we don't go through TreeScopeAdopter for each child with a 81 // runs so we don't go through TreeScopeAdopter for each child with a
83 // destructed tree scope in each descendant. 82 // destructed tree scope in each descendant.
84 removeDetachedChildren(); 83 removeDetachedChildren();
85 84
86 // We must call clearRareData() here since a ShadowRoot class inherits TreeS cope 85 // We must call clearRareData() here since a ShadowRoot class inherits TreeS cope
87 // as well as Node. See a comment on TreeScope.h for the reason. 86 // as well as Node. See a comment on TreeScope.h for the reason.
88 if (hasRareData()) 87 if (hasRareData())
89 clearRareData(); 88 clearRareData();
90 } 89 }
91 90
91 void ShadowRoot::dispose()
92 {
93 removeDetachedChildren();
94 }
95
92 PassRefPtr<Node> ShadowRoot::cloneNode(bool, ExceptionCode& ec) 96 PassRefPtr<Node> ShadowRoot::cloneNode(bool, ExceptionCode& ec)
93 { 97 {
94 ec = DATA_CLONE_ERR; 98 ec = DATA_CLONE_ERR;
95 return 0; 99 return 0;
96 } 100 }
97 101
98 String ShadowRoot::innerHTML() const 102 String ShadowRoot::innerHTML() const
99 { 103 {
100 return createMarkup(this, ChildrenOnly); 104 return createMarkup(this, ChildrenOnly);
101 } 105 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 { 252 {
249 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); 253 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
250 DocumentFragment::reportMemoryUsage(memoryObjectInfo); 254 DocumentFragment::reportMemoryUsage(memoryObjectInfo);
251 TreeScope::reportMemoryUsage(memoryObjectInfo); 255 TreeScope::reportMemoryUsage(memoryObjectInfo);
252 info.addMember(m_prev, "prev"); 256 info.addMember(m_prev, "prev");
253 info.addMember(m_next, "next"); 257 info.addMember(m_next, "next");
254 info.addMember(m_scopeDistribution, "scopeDistribution"); 258 info.addMember(m_scopeDistribution, "scopeDistribution");
255 } 259 }
256 260
257 } 261 }
OLDNEW
« no previous file with comments | « Source/WebCore/dom/ShadowRoot.h ('k') | Source/WebCore/dom/TreeScope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698