OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. | 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "PropertySetCSSStyleDeclaration.h" | 23 #include "PropertySetCSSStyleDeclaration.h" |
24 | 24 |
25 #include "CSSParser.h" | 25 #include "CSSParser.h" |
26 #include "CSSStyleSheet.h" | 26 #include "CSSStyleSheet.h" |
27 #include "HTMLNames.h" | 27 #include "HTMLNames.h" |
28 #include "InspectorInstrumentation.h" | 28 #include "InspectorInstrumentation.h" |
29 #include "MutationObserverInterestGroup.h" | 29 #include "MutationObserverInterestGroup.h" |
30 #include "MutationRecord.h" | 30 #include "MutationRecord.h" |
31 #include "StylePropertySet.h" | 31 #include "StylePropertySet.h" |
32 #include "StyledElement.h" | 32 #include "StyledElement.h" |
33 #include "WebCoreMemoryInstrumentation.h" | |
34 #include <wtf/MemoryInstrumentationHashMap.h> | |
35 | 33 |
36 using namespace std; | 34 using namespace std; |
37 | 35 |
38 namespace WebCore { | 36 namespace WebCore { |
39 | 37 |
40 namespace { | 38 namespace { |
41 | 39 |
42 class StyleAttributeMutationScope { | 40 class StyleAttributeMutationScope { |
43 WTF_MAKE_NONCOPYABLE(StyleAttributeMutationScope); | 41 WTF_MAKE_NONCOPYABLE(StyleAttributeMutationScope); |
44 public: | 42 public: |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void PropertySetCSSStyleDeclaration::ref() | 123 void PropertySetCSSStyleDeclaration::ref() |
126 { | 124 { |
127 m_propertySet->ref(); | 125 m_propertySet->ref(); |
128 } | 126 } |
129 | 127 |
130 void PropertySetCSSStyleDeclaration::deref() | 128 void PropertySetCSSStyleDeclaration::deref() |
131 { | 129 { |
132 m_propertySet->deref(); | 130 m_propertySet->deref(); |
133 } | 131 } |
134 | 132 |
135 void PropertySetCSSStyleDeclaration::reportMemoryUsage(MemoryObjectInfo* memoryO
bjectInfo) const | |
136 { | |
137 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); | |
138 info.addMember(m_propertySet, "propertySet"); | |
139 info.addMember(m_cssomCSSValueClones, "cssomCSSValueClones"); | |
140 } | |
141 | |
142 unsigned PropertySetCSSStyleDeclaration::length() const | 133 unsigned PropertySetCSSStyleDeclaration::length() const |
143 { | 134 { |
144 return m_propertySet->propertyCount(); | 135 return m_propertySet->propertyCount(); |
145 } | 136 } |
146 | 137 |
147 String PropertySetCSSStyleDeclaration::item(unsigned i) const | 138 String PropertySetCSSStyleDeclaration::item(unsigned i) const |
148 { | 139 { |
149 if (i >= m_propertySet->propertyCount()) | 140 if (i >= m_propertySet->propertyCount()) |
150 return ""; | 141 return ""; |
151 return m_propertySet->propertyAt(i).cssName(); | 142 return m_propertySet->propertyAt(i).cssName(); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 } | 356 } |
366 | 357 |
367 void StyleRuleCSSStyleDeclaration::reattach(StylePropertySet* propertySet) | 358 void StyleRuleCSSStyleDeclaration::reattach(StylePropertySet* propertySet) |
368 { | 359 { |
369 ASSERT(propertySet); | 360 ASSERT(propertySet); |
370 m_propertySet->deref(); | 361 m_propertySet->deref(); |
371 m_propertySet = propertySet; | 362 m_propertySet = propertySet; |
372 m_propertySet->ref(); | 363 m_propertySet->ref(); |
373 } | 364 } |
374 | 365 |
375 void StyleRuleCSSStyleDeclaration::reportMemoryUsage(MemoryObjectInfo* memoryObj
ectInfo) const | |
376 { | |
377 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); | |
378 PropertySetCSSStyleDeclaration::reportMemoryUsage(memoryObjectInfo); | |
379 info.addMember(m_parentRule, "parentRule"); | |
380 } | |
381 | |
382 void InlineCSSStyleDeclaration::reportMemoryUsage(MemoryObjectInfo* memoryObject
Info) const | |
383 { | |
384 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); | |
385 PropertySetCSSStyleDeclaration::reportMemoryUsage(memoryObjectInfo); | |
386 info.addMember(m_parentElement, "parentElement"); | |
387 } | |
388 | |
389 void InlineCSSStyleDeclaration::didMutate(MutationType type) | 366 void InlineCSSStyleDeclaration::didMutate(MutationType type) |
390 { | 367 { |
391 if (type == NoChanges) | 368 if (type == NoChanges) |
392 return; | 369 return; |
393 | 370 |
394 m_cssomCSSValueClones.clear(); | 371 m_cssomCSSValueClones.clear(); |
395 | 372 |
396 if (!m_parentElement) | 373 if (!m_parentElement) |
397 return; | 374 return; |
398 | 375 |
399 m_parentElement->setNeedsStyleRecalc(InlineStyleChange); | 376 m_parentElement->setNeedsStyleRecalc(InlineStyleChange); |
400 m_parentElement->invalidateStyleAttribute(); | 377 m_parentElement->invalidateStyleAttribute(); |
401 StyleAttributeMutationScope(this).didInvalidateStyleAttr(); | 378 StyleAttributeMutationScope(this).didInvalidateStyleAttr(); |
402 } | 379 } |
403 | 380 |
404 CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const | 381 CSSStyleSheet* InlineCSSStyleDeclaration::parentStyleSheet() const |
405 { | 382 { |
406 return m_parentElement ? m_parentElement->document()->elementSheet() : 0; | 383 return m_parentElement ? m_parentElement->document()->elementSheet() : 0; |
407 } | 384 } |
408 | 385 |
409 } // namespace WebCore | 386 } // namespace WebCore |
OLD | NEW |