- Revision
- 106384
- Author
- [email protected]
- Date
- 2012-01-31 13:24:12 -0800 (Tue, 31 Jan 2012)
Log Message
Remove CSSStyleDeclaration isElementStyleDeclaration bit
https://bugs.webkit.org/show_bug.cgi?id=77460
Reviewed by Andreas Kling.
Inline style declaration is now the only type of style declaration with element parent.
We can remove the bit and the associated logic.
* bindings/js/JSDOMBinding.h:
(WebCore::root):
* css/CSSMutableStyleDeclaration.cpp:
(WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration):
(WebCore::CSSMutableStyleDeclaration::setNeedsStyleRecalc):
* css/CSSMutableStyleDeclaration.h:
(WebCore::CSSMutableStyleDeclaration::createInline):
(CSSMutableStyleDeclaration):
* css/CSSStyleDeclaration.cpp:
(WebCore::CSSStyleDeclaration::CSSStyleDeclaration):
(WebCore):
(WebCore::CSSStyleDeclaration::parentStyleSheet):
* css/CSSStyleDeclaration.h:
(WebCore::CSSStyleDeclaration::parentRule):
(WebCore::CSSStyleDeclaration::clearParentRule):
(WebCore::CSSStyleDeclaration::parentElement):
(WebCore::CSSStyleDeclaration::clearParentElement):
(CSSStyleDeclaration):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (106383 => 106384)
--- trunk/Source/WebCore/ChangeLog 2012-01-31 21:15:27 UTC (rev 106383)
+++ trunk/Source/WebCore/ChangeLog 2012-01-31 21:24:12 UTC (rev 106384)
@@ -1,3 +1,32 @@
+2012-01-31 Antti Koivisto <[email protected]>
+
+ Remove CSSStyleDeclaration isElementStyleDeclaration bit
+ https://bugs.webkit.org/show_bug.cgi?id=77460
+
+ Reviewed by Andreas Kling.
+
+ Inline style declaration is now the only type of style declaration with element parent.
+ We can remove the bit and the associated logic.
+
+ * bindings/js/JSDOMBinding.h:
+ (WebCore::root):
+ * css/CSSMutableStyleDeclaration.cpp:
+ (WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration):
+ (WebCore::CSSMutableStyleDeclaration::setNeedsStyleRecalc):
+ * css/CSSMutableStyleDeclaration.h:
+ (WebCore::CSSMutableStyleDeclaration::createInline):
+ (CSSMutableStyleDeclaration):
+ * css/CSSStyleDeclaration.cpp:
+ (WebCore::CSSStyleDeclaration::CSSStyleDeclaration):
+ (WebCore):
+ (WebCore::CSSStyleDeclaration::parentStyleSheet):
+ * css/CSSStyleDeclaration.h:
+ (WebCore::CSSStyleDeclaration::parentRule):
+ (WebCore::CSSStyleDeclaration::clearParentRule):
+ (WebCore::CSSStyleDeclaration::parentElement):
+ (WebCore::CSSStyleDeclaration::clearParentElement):
+ (CSSStyleDeclaration):
+
2012-01-31 Dana Jansens <[email protected]>
[chromium] Compute occlusion during paint loop
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (106383 => 106384)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2012-01-31 21:15:27 UTC (rev 106383)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2012-01-31 21:24:12 UTC (rev 106384)
@@ -209,8 +209,6 @@
return root(parentRule);
if (CSSStyleSheet* styleSheet = style->parentStyleSheet())
return root(styleSheet);
- // A style declaration with an associated element should've returned a style sheet above.
- ASSERT(!style->isElementStyleDeclaration() || !static_cast<CSSMutableStyleDeclaration*>(style)->parentElement());
return style;
}
Modified: trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp (106383 => 106384)
--- trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp 2012-01-31 21:15:27 UTC (rev 106383)
+++ trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp 2012-01-31 21:24:12 UTC (rev 106384)
@@ -134,7 +134,6 @@
} // namespace
CSSMutableStyleDeclaration::CSSMutableStyleDeclaration()
- : CSSStyleDeclaration(0)
{
// This constructor is used for various inline style declarations, so disable strict parsing.
m_strictParsing = false;
@@ -175,8 +174,8 @@
}
}
-CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(StyledElement* element, bool isInline)
- : CSSStyleDeclaration(element, isInline)
+CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(StyledElement* element)
+ : CSSStyleDeclaration(element)
{
}
@@ -643,15 +642,13 @@
void CSSMutableStyleDeclaration::setNeedsStyleRecalc()
{
- if (isElementStyleDeclaration() && parentElement()) {
+ if (isInlineStyleDeclaration()) {
StyledElement* element = parentElement();
- if (!isInlineStyleDeclaration())
- element->setNeedsStyleRecalc(FullStyleChange);
- else {
- element->setNeedsStyleRecalc(InlineStyleChange);
- element->invalidateStyleAttribute();
- StyleAttributeMutationScope(this).didInvalidateStyleAttr();
- }
+ if (!element)
+ return;
+ element->setNeedsStyleRecalc(InlineStyleChange);
+ element->invalidateStyleAttribute();
+ StyleAttributeMutationScope(this).didInvalidateStyleAttr();
return;
}
Modified: trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h (106383 => 106384)
--- trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h 2012-01-31 21:15:27 UTC (rev 106383)
+++ trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h 2012-01-31 21:24:12 UTC (rev 106384)
@@ -55,7 +55,7 @@
}
static PassRefPtr<CSSMutableStyleDeclaration> createInline(StyledElement* element)
{
- return adoptRef(new CSSMutableStyleDeclaration(element, true));
+ return adoptRef(new CSSMutableStyleDeclaration(element));
}
unsigned propertyCount() const { return m_properties.size(); }
@@ -115,7 +115,7 @@
CSSMutableStyleDeclaration(CSSRule* parentRule);
CSSMutableStyleDeclaration(CSSRule* parentRule, const Vector<CSSProperty>&);
CSSMutableStyleDeclaration(CSSRule* parentRule, const CSSProperty* const *, int numProperties);
- CSSMutableStyleDeclaration(StyledElement*, bool isInline);
+ CSSMutableStyleDeclaration(StyledElement*);
virtual PassRefPtr<CSSMutableStyleDeclaration> makeMutable();
Modified: trunk/Source/WebCore/css/CSSStyleDeclaration.cpp (106383 => 106384)
--- trunk/Source/WebCore/css/CSSStyleDeclaration.cpp 2012-01-31 21:15:27 UTC (rev 106383)
+++ trunk/Source/WebCore/css/CSSStyleDeclaration.cpp 2012-01-31 21:24:12 UTC (rev 106384)
@@ -41,34 +41,25 @@
CSSStyleDeclaration::CSSStyleDeclaration(CSSRule* parentRule)
: m_strictParsing(!parentRule || parentRule->useStrictParsing())
- , m_isElementStyleDeclaration(false)
, m_isInlineStyleDeclaration(false)
, m_parent(parentRule)
{
}
-
-CSSStyleDeclaration::CSSStyleDeclaration(StyledElement* parentElement, bool isInline)
+
+CSSStyleDeclaration::CSSStyleDeclaration(StyledElement* parentElement)
: m_strictParsing(false)
- , m_isElementStyleDeclaration(true)
- , m_isInlineStyleDeclaration(isInline)
+ , m_isInlineStyleDeclaration(true)
, m_parent(parentElement)
{
}
CSSStyleSheet* CSSStyleDeclaration::parentStyleSheet() const
{
- if (m_isElementStyleDeclaration) {
- if (!m_parent.element)
- return 0;
- Document* document = m_parent.element->document();
- if (!document)
- return 0;
- // If this is not an inline declaration then it is an SVG font face declaration.
- return m_isInlineStyleDeclaration ? document->elementSheet() : document->mappedElementSheet();
+ if (m_isInlineStyleDeclaration) {
+ Document* document = m_parent.element ? m_parent.element->document() : 0;
+ return document ? document->elementSheet() : 0;
}
- if (!m_parent.rule)
- return 0;
- return m_parent.rule->parentStyleSheet();
+ return m_parent.rule ? m_parent.rule->parentStyleSheet() : 0;
}
bool CSSStyleDeclaration::isPropertyName(const String& propertyName)
Modified: trunk/Source/WebCore/css/CSSStyleDeclaration.h (106383 => 106384)
--- trunk/Source/WebCore/css/CSSStyleDeclaration.h 2012-01-31 21:15:27 UTC (rev 106383)
+++ trunk/Source/WebCore/css/CSSStyleDeclaration.h 2012-01-31 21:24:12 UTC (rev 106384)
@@ -42,11 +42,11 @@
static bool isPropertyName(const String&);
- CSSRule* parentRule() const { return m_isElementStyleDeclaration ? 0 : m_parent.rule; }
- void clearParentRule() { ASSERT(!m_isElementStyleDeclaration); m_parent.rule = 0; }
+ CSSRule* parentRule() const { return m_isInlineStyleDeclaration ? 0 : m_parent.rule; }
+ void clearParentRule() { ASSERT(!m_isInlineStyleDeclaration); m_parent.rule = 0; }
- StyledElement* parentElement() const { ASSERT(m_isElementStyleDeclaration); return m_parent.element; }
- void clearParentElement() { ASSERT(m_isElementStyleDeclaration); m_parent.element = 0; }
+ StyledElement* parentElement() const { ASSERT(m_isInlineStyleDeclaration); return m_parent.element; }
+ void clearParentElement() { ASSERT(m_isInlineStyleDeclaration); m_parent.element = 0; }
CSSStyleSheet* parentStyleSheet() const;
@@ -77,19 +77,17 @@
void showStyle();
#endif
- bool isElementStyleDeclaration() const { return m_isElementStyleDeclaration; }
bool isInlineStyleDeclaration() const { return m_isInlineStyleDeclaration; }
protected:
CSSStyleDeclaration(CSSRule* parentRule = 0);
- CSSStyleDeclaration(StyledElement* parentElement, bool isInline);
+ CSSStyleDeclaration(StyledElement* parentElement);
// The bits in this section are only used by specific subclasses but kept here
// to maximize struct packing.
// CSSMutableStyleDeclaration bits:
bool m_strictParsing : 1;
- bool m_isElementStyleDeclaration : 1;
bool m_isInlineStyleDeclaration : 1;
private: