12011-11-25 Andreas Kling <kling@webkit.org>
2
3 Factor element pointer out of CSSMutableStyleDeclaration.
4 <http://webkit.org/b/73121>
5
6 Reviewed by NOBODY (OOPS!).
7
8 Move the StyledElement pointer out of CSSMutableStyleDeclaration and into a subclass
9 for the cases where it's needed. This reduces the size of vanilla style declarations
10 by one CPU word (4 or 8 bytes, depending on architecture.)
11
12 * css/CSSMutableStyleDeclaration.h:
13 (WebCore::CSSElementStyleDeclaration::element):
14 (WebCore::CSSElementStyleDeclaration::setElement):
15 (WebCore::CSSElementStyleDeclaration::CSSElementStyleDeclaration):
16 (WebCore::CSSElementStyleDeclaration::~CSSElementStyleDeclaration):
17
18 Added CSSElementStyleDeclaration, a common parent class for inline styles
19 and mapped attributes. It extends CSSMutableStyleDeclaration by adding a backpointer
20 to the StyledElement that owns it.
21
22 * GNUmakefile.list.am:
23 * Target.pri:
24 * WebCore.gypi:
25 * WebCore.vcproj/WebCore.vcproj:
26 * WebCore.xcodeproj/project.pbxproj:
27 * css/CSSInlineStyleDeclaration.h: Added.
28 (WebCore::CSSInlineStyleDeclaration::~CSSInlineStyleDeclaration):
29 (WebCore::CSSInlineStyleDeclaration::create):
30 (WebCore::CSSInlineStyleDeclaration::CSSInlineStyleDeclaration):
31
32 Added CSSInlineStyleDeclaration.
33
34 * bindings/js/JSDOMBinding.h:
35 (WebCore::root):
36 * css/CSSMutableStyleDeclaration.cpp:
37 (WebCore::CSSMutableStyleDeclaration::setNeedsStyleRecalc):
38 * css/CSSStyleRule.cpp:
39 (WebCore::CSSStyleRule::setSelectorText):
40
41 Only follow the associated element on CSSElementStyleDeclarations.
42
43 * css/CSSMutableStyleDeclaration.cpp:
44 (WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration):
45 (WebCore::CSSMutableStyleDeclaration::operator=):
46
47 Remove comment about m_element since the field was moved to a subclass.
48
49 * css/CSSStyleDeclaration.cpp:
50 (WebCore::CSSStyleDeclaration::CSSStyleDeclaration):
51 * css/CSSStyleDeclaration.h:
52 (WebCore::CSSStyleDeclaration::isElementStyleDeclaration):
53 (WebCore::CSSStyleDeclaration::isInlineStyleDeclaration):
54
55 We no longer need to track whether a style declaration is mutable or not,
56 so the constructors are slightly simplified.
57 Added two bits (isElementStyleDeclaration and isInlineStyleDeclaration) for
58 runtime type checking. These are protected and set by the CSSElementStyleDeclaration
59 constructor.
60
61 * dom/CSSMappedAttributeDeclaration.h:
62 (WebCore::CSSMappedAttributeDeclaration::create):
63 (WebCore::CSSMappedAttributeDeclaration::CSSMappedAttributeDeclaration):
64
65 Remove pointless CSSRule* argument to constructor since we always passed 0.
66
67 * dom/StyledElement.h:
68 (WebCore::StyledElement::inlineStyleDecl):
69 * dom/StyledElement.cpp:
70 (WebCore::StyledElement::createInlineStyleDecl):
71 (WebCore::StyledElement::getInlineStyleDecl):
72 (WebCore::StyledElement::addSubresourceAttributeURLs):
73
74 Make the inline style on StyledElement a CSSInlineStyleDeclaration.
75
76 * inspector/InspectorCSSAgent.cpp:
77 (WebCore::InspectorCSSAgent::inlineStyleElement):
78
79 Slightly simplified by having CSSInlineStyleDeclaration.
80