2008-11-20 Antti Koivisto <antti@apple.com>
Reviewed by Maciej Stachowiak.
https://bugs.webkit.org/show_bug.cgi?id=22379
Make CSSOM use less memory
- Shrink CSSProperty by half by using bitfields.
- Get rid of m_strictParsing field in StyleBase by moving it up to CSSStyleSheet
and CSSMutableStyleDeclaration. This reduces size of many highly popular objects.
* css/CSSMutableStyleDeclaration.cpp:
(WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration):
(WebCore::CSSMutableStyleDeclaration::operator=):
* css/CSSMutableStyleDeclaration.h:
(WebCore::CSSMutableStyleDeclaration::setStrictParsing):
(WebCore::CSSMutableStyleDeclaration::useStrictParsing):
* css/CSSProperty.h:
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::CSSStyleSheet):
* css/CSSStyleSheet.h:
(WebCore::CSSStyleSheet::setStrictParsing):
(WebCore::CSSStyleSheet::useStrictParsing):
* css/StyleBase.h:
(WebCore::StyleBase::useStrictParsing):
(WebCore::StyleBase::StyleBase):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@38617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/css/CSSStyleSheet.cpp b/WebCore/css/CSSStyleSheet.cpp
index cfaf485..4287582 100644
--- a/WebCore/css/CSSStyleSheet.cpp
+++ b/WebCore/css/CSSStyleSheet.cpp
@@ -37,6 +37,7 @@
, m_namespaces(0)
, m_charset(charset)
, m_loadCompleted(false)
+ , m_strictParsing(!parentSheet || parentSheet->useStrictParsing())
{
}
@@ -46,6 +47,7 @@
, m_namespaces(0)
, m_charset(charset)
, m_loadCompleted(false)
+ , m_strictParsing(false)
{
}
@@ -54,6 +56,7 @@
, m_namespaces(0)
, m_charset(charset)
, m_loadCompleted(false)
+ , m_strictParsing(!ownerRule || ownerRule->useStrictParsing())
{
CSSStyleSheet* parentSheet = ownerRule ? ownerRule->parentStyleSheet() : 0;
m_doc = parentSheet ? parentSheet->doc() : 0;