[webkit-changes] cvs commit: WebCore/khtml/css
css_computedstyle.cpp css_ruleimpl.cpp css_ruleimpl.h
css_stylesheetimpl.cpp css_stylesheetimpl.h css_valueimpl.cpp
css_valueimpl.h cssparser.cpp cssstyleselector.cpp
Eric
eseidel at opensource.apple.com
Thu Dec 15 13:39:59 PST 2005
eseidel 05/12/15 13:39:59
Modified: . ChangeLog
khtml/css css_computedstyle.cpp css_ruleimpl.cpp
css_ruleimpl.h css_stylesheetimpl.cpp
css_stylesheetimpl.h css_valueimpl.cpp
css_valueimpl.h cssparser.cpp cssstyleselector.cpp
Log:
Bug #: 6094
Submitted by: eseidel
Reviewed by: darin
khtml/css should use RefPtr instead of manual ref() deref()
http://bugzilla.opendarwin.org/show_bug.cgi?id=6094
No functionality changes, thus no tests.
* khtml/css/css_computedstyle.cpp:
(DOM::CSSComputedStyleDeclarationImpl::getPropertyValue):
* khtml/css/css_ruleimpl.cpp:
(DOM::CSSFontFaceRuleImpl::CSSFontFaceRuleImpl):
(DOM::CSSFontFaceRuleImpl::~CSSFontFaceRuleImpl):
(DOM::CSSImportRuleImpl::CSSImportRuleImpl):
(DOM::CSSImportRuleImpl::~CSSImportRuleImpl):
(DOM::CSSImportRuleImpl::setStyleSheet):
(DOM::CSSMediaRuleImpl::CSSMediaRuleImpl):
(DOM::CSSMediaRuleImpl::~CSSMediaRuleImpl):
(DOM::CSSPageRuleImpl::CSSPageRuleImpl):
(DOM::CSSPageRuleImpl::~CSSPageRuleImpl):
(DOM::CSSStyleRuleImpl::CSSStyleRuleImpl):
(DOM::CSSStyleRuleImpl::~CSSStyleRuleImpl):
(DOM::CSSStyleRuleImpl::setDeclaration):
* khtml/css/css_ruleimpl.h:
(DOM::CSSFontFaceRuleImpl::style):
(DOM::CSSImportRuleImpl::media):
(DOM::CSSImportRuleImpl::styleSheet):
(DOM::CSSMediaRuleImpl::cssRules):
(DOM::CSSPageRuleImpl::style):
(DOM::CSSStyleRuleImpl::style):
(DOM::CSSStyleRuleImpl::declaration):
* khtml/css/css_stylesheetimpl.cpp:
(StyleSheetImpl::StyleSheetImpl):
(StyleSheetImpl::~StyleSheetImpl):
(StyleSheetImpl::setMedia):
* khtml/css/css_stylesheetimpl.h:
(DOM::StyleSheetImpl::media):
* khtml/css/css_valueimpl.cpp:
(DOM::CSSMutableStyleDeclarationImpl::get4Values):
(DOM::CSSMutableStyleDeclarationImpl::getShortHandValue):
(DOM::CSSMutableStyleDeclarationImpl::merge):
(DOM::CSSStyleDeclarationImpl::diff):
(DOM::CSSPrimitiveValueImpl::CSSPrimitiveValueImpl):
(DOM::CSSPrimitiveValueImpl::cleanup):
(DOM::CSSPrimitiveValueImpl::cssText):
(DOM::RectImpl::RectImpl):
(DOM::RectImpl::~RectImpl):
(DOM::RectImpl::setTop):
(DOM::RectImpl::setRight):
(DOM::RectImpl::setBottom):
(DOM::RectImpl::setLeft):
(DOM::PairImpl::PairImpl):
(DOM::PairImpl::~PairImpl):
(DOM::PairImpl::setFirst):
(DOM::PairImpl::setSecond):
(DOM::CSSBorderImageValueImpl::CSSBorderImageValueImpl):
(DOM::CSSBorderImageValueImpl::~CSSBorderImageValueImpl):
* khtml/css/css_valueimpl.h:
(DOM::RectImpl::top):
(DOM::RectImpl::right):
(DOM::RectImpl::bottom):
(DOM::RectImpl::left):
(DOM::PairImpl::first):
(DOM::PairImpl::second):
(DOM::DashboardRegionImpl::setNext):
(DOM::CSSProperty::CSSProperty):
(DOM::CSSProperty::operator=):
(DOM::CSSProperty::~CSSProperty):
(DOM::CSSProperty::setValue):
(DOM::CSSProperty::value):
* khtml/css/cssparser.cpp:
(CSSParser::parseColor):
* khtml/css/cssstyleselector.cpp:
(khtml::CSSStyleSelector::applyProperty):
* khtml/xsl/xslt_processorimpl.cpp:
(DOM::XSLTProcessorImpl::transformToString):
Revision Changes Path
1.536 +78 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.535
retrieving revision 1.536
diff -u -r1.535 -r1.536
--- ChangeLog 15 Dec 2005 21:06:43 -0000 1.535
+++ ChangeLog 15 Dec 2005 21:39:51 -0000 1.536
@@ -1,3 +1,81 @@
+2005-12-15 Eric Seidel <eseidel at apple.com>
+
+ Reviewed by darin.
+
+ khtml/css should use RefPtr instead of manual ref() deref()
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=6094
+
+ No functionality changes, thus no tests.
+
+ * khtml/css/css_computedstyle.cpp:
+ (DOM::CSSComputedStyleDeclarationImpl::getPropertyValue):
+ * khtml/css/css_ruleimpl.cpp:
+ (DOM::CSSFontFaceRuleImpl::CSSFontFaceRuleImpl):
+ (DOM::CSSFontFaceRuleImpl::~CSSFontFaceRuleImpl):
+ (DOM::CSSImportRuleImpl::CSSImportRuleImpl):
+ (DOM::CSSImportRuleImpl::~CSSImportRuleImpl):
+ (DOM::CSSImportRuleImpl::setStyleSheet):
+ (DOM::CSSMediaRuleImpl::CSSMediaRuleImpl):
+ (DOM::CSSMediaRuleImpl::~CSSMediaRuleImpl):
+ (DOM::CSSPageRuleImpl::CSSPageRuleImpl):
+ (DOM::CSSPageRuleImpl::~CSSPageRuleImpl):
+ (DOM::CSSStyleRuleImpl::CSSStyleRuleImpl):
+ (DOM::CSSStyleRuleImpl::~CSSStyleRuleImpl):
+ (DOM::CSSStyleRuleImpl::setDeclaration):
+ * khtml/css/css_ruleimpl.h:
+ (DOM::CSSFontFaceRuleImpl::style):
+ (DOM::CSSImportRuleImpl::media):
+ (DOM::CSSImportRuleImpl::styleSheet):
+ (DOM::CSSMediaRuleImpl::cssRules):
+ (DOM::CSSPageRuleImpl::style):
+ (DOM::CSSStyleRuleImpl::style):
+ (DOM::CSSStyleRuleImpl::declaration):
+ * khtml/css/css_stylesheetimpl.cpp:
+ (StyleSheetImpl::StyleSheetImpl):
+ (StyleSheetImpl::~StyleSheetImpl):
+ (StyleSheetImpl::setMedia):
+ * khtml/css/css_stylesheetimpl.h:
+ (DOM::StyleSheetImpl::media):
+ * khtml/css/css_valueimpl.cpp:
+ (DOM::CSSMutableStyleDeclarationImpl::get4Values):
+ (DOM::CSSMutableStyleDeclarationImpl::getShortHandValue):
+ (DOM::CSSMutableStyleDeclarationImpl::merge):
+ (DOM::CSSStyleDeclarationImpl::diff):
+ (DOM::CSSPrimitiveValueImpl::CSSPrimitiveValueImpl):
+ (DOM::CSSPrimitiveValueImpl::cleanup):
+ (DOM::CSSPrimitiveValueImpl::cssText):
+ (DOM::RectImpl::RectImpl):
+ (DOM::RectImpl::~RectImpl):
+ (DOM::RectImpl::setTop):
+ (DOM::RectImpl::setRight):
+ (DOM::RectImpl::setBottom):
+ (DOM::RectImpl::setLeft):
+ (DOM::PairImpl::PairImpl):
+ (DOM::PairImpl::~PairImpl):
+ (DOM::PairImpl::setFirst):
+ (DOM::PairImpl::setSecond):
+ (DOM::CSSBorderImageValueImpl::CSSBorderImageValueImpl):
+ (DOM::CSSBorderImageValueImpl::~CSSBorderImageValueImpl):
+ * khtml/css/css_valueimpl.h:
+ (DOM::RectImpl::top):
+ (DOM::RectImpl::right):
+ (DOM::RectImpl::bottom):
+ (DOM::RectImpl::left):
+ (DOM::PairImpl::first):
+ (DOM::PairImpl::second):
+ (DOM::DashboardRegionImpl::setNext):
+ (DOM::CSSProperty::CSSProperty):
+ (DOM::CSSProperty::operator=):
+ (DOM::CSSProperty::~CSSProperty):
+ (DOM::CSSProperty::setValue):
+ (DOM::CSSProperty::value):
+ * khtml/css/cssparser.cpp:
+ (CSSParser::parseColor):
+ * khtml/css/cssstyleselector.cpp:
+ (khtml::CSSStyleSelector::applyProperty):
+ * khtml/xsl/xslt_processorimpl.cpp:
+ (DOM::XSLTProcessorImpl::transformToString):
+
2005-12-15 Adele Peterson <adele at apple.com>
Reviewed by Darin and Hyatt.
1.42 +3 -7 WebCore/khtml/css/css_computedstyle.cpp
Index: css_computedstyle.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_computedstyle.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- css_computedstyle.cpp 8 Dec 2005 08:40:24 -0000 1.41
+++ css_computedstyle.cpp 15 Dec 2005 21:39:56 -0000 1.42
@@ -1211,13 +1211,9 @@
DOMString CSSComputedStyleDeclarationImpl::getPropertyValue(int propertyID) const
{
- CSSValueImpl* value = getPropertyCSSValue(propertyID);
- if (value) {
- value->ref();
- DOMString result = value->cssText();
- value->deref();
- return result;
- }
+ RefPtr<CSSValueImpl> value = getPropertyCSSValue(propertyID);
+ if (value)
+ return value->cssText();
return "";
}
1.28 +15 -51 WebCore/khtml/css/css_ruleimpl.cpp
Index: css_ruleimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_ruleimpl.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- css_ruleimpl.cpp 12 Dec 2005 22:22:21 -0000 1.27
+++ css_ruleimpl.cpp 15 Dec 2005 21:39:56 -0000 1.28
@@ -64,12 +64,10 @@
: CSSRuleImpl(parent)
{
m_type = CSSRule::FONT_FACE_RULE;
- m_style = 0;
}
CSSFontFaceRuleImpl::~CSSFontFaceRuleImpl()
{
- if(m_style) m_style->deref();
}
// --------------------------------------------------------------------------
@@ -82,14 +80,11 @@
m_type = CSSRule::IMPORT_RULE;
m_lstMedia = media;
- if ( !m_lstMedia )
- m_lstMedia = new MediaListImpl( this, DOMString() );
- m_lstMedia->setParent( this );
- m_lstMedia->ref();
+ if (!m_lstMedia)
+ m_lstMedia = new MediaListImpl(this, DOMString());
+ m_lstMedia->setParent(this);
m_strHref = href;
- m_styleSheet = 0;
-
m_cachedSheet = 0;
init();
@@ -100,13 +95,8 @@
: CSSRuleImpl(parent)
{
m_type = CSSRule::IMPORT_RULE;
-
- m_lstMedia = new MediaListImpl( this, media );
- m_lstMedia->ref();
-
+ m_lstMedia = new MediaListImpl(this, media);
m_strHref = href;
- m_styleSheet = 0;
-
m_cachedSheet = 0;
init();
@@ -114,26 +104,19 @@
CSSImportRuleImpl::~CSSImportRuleImpl()
{
- if( m_lstMedia ) {
+ if(m_lstMedia)
m_lstMedia->setParent( 0 );
- m_lstMedia->deref();
- }
- if(m_styleSheet) {
+ if(m_styleSheet)
m_styleSheet->setParent(0);
- m_styleSheet->deref();
- }
-
- if(m_cachedSheet) m_cachedSheet->deref(this);
+ if(m_cachedSheet)
+ m_cachedSheet->deref(this);
}
void CSSImportRuleImpl::setStyleSheet(const DOM::DOMString &url, const DOM::DOMString &sheet)
{
- if ( m_styleSheet ) {
+ if (m_styleSheet)
m_styleSheet->setParent(0);
- m_styleSheet->deref();
- }
m_styleSheet = new CSSStyleSheetImpl(this, url);
- m_styleSheet->ref();
CSSStyleSheetImpl *parent = parentStyleSheet();
m_styleSheet->parseString( sheet, parent ? parent->useStrictParsing() : true );
@@ -216,9 +199,7 @@
{
m_type = CSSRule::MEDIA_RULE;
m_lstMedia = mediaList;
- m_lstMedia->ref();
m_lstCSSRules = ruleList;
- m_lstCSSRules->ref();
}
CSSMediaRuleImpl::CSSMediaRuleImpl(StyleBaseImpl *parent)
@@ -227,7 +208,6 @@
m_type = CSSRule::MEDIA_RULE;
m_lstMedia = 0;
m_lstCSSRules = new CSSRuleListImpl();
- m_lstCSSRules->ref();
}
CSSMediaRuleImpl::CSSMediaRuleImpl( StyleBaseImpl *parent, const DOM::DOMString &media )
@@ -235,23 +215,17 @@
{
m_type = CSSRule::MEDIA_RULE;
m_lstMedia = new MediaListImpl( this, media );
- m_lstMedia->ref();
m_lstCSSRules = new CSSRuleListImpl();
- m_lstCSSRules->ref();
}
CSSMediaRuleImpl::~CSSMediaRuleImpl()
{
- if( m_lstMedia ) {
- m_lstMedia->setParent( 0 );
- m_lstMedia->deref();
- }
+ if(m_lstMedia)
+ m_lstMedia->setParent(0);
int length = m_lstCSSRules->length();
- for (int i = 0; i < length; i++) {
- m_lstCSSRules->item( i )->setParent( 0 );
- }
- m_lstCSSRules->deref();
+ for (int i = 0; i < length; i++)
+ m_lstCSSRules->item(i)->setParent(0);
}
unsigned CSSMediaRuleImpl::append( CSSRuleImpl *rule )
@@ -327,12 +301,10 @@
: CSSRuleImpl(parent)
{
m_type = CSSRule::PAGE_RULE;
- m_style = 0;
}
CSSPageRuleImpl::~CSSPageRuleImpl()
{
- if(m_style) m_style->deref();
}
DOM::DOMString CSSPageRuleImpl::selectorText() const
@@ -352,16 +324,13 @@
: CSSRuleImpl(parent)
{
m_type = CSSRule::STYLE_RULE;
- m_style = 0;
m_selector = 0;
}
CSSStyleRuleImpl::~CSSStyleRuleImpl()
{
- if(m_style) {
+ if(m_style)
m_style->setParent( 0 );
- m_style->deref();
- }
delete m_selector;
}
@@ -403,13 +372,8 @@
void CSSStyleRuleImpl::setDeclaration( CSSMutableStyleDeclarationImpl *style)
{
- if ( m_style != style ) {
- if (m_style)
- m_style->deref();
+ if (m_style != style)
m_style = style;
- if (m_style)
- m_style->ref();
- }
}
void CSSRuleListImpl::deleteRule ( unsigned index )
1.19 +14 -14 WebCore/khtml/css/css_ruleimpl.h
Index: css_ruleimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_ruleimpl.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- css_ruleimpl.h 27 Sep 2005 22:37:01 -0000 1.18
+++ css_ruleimpl.h 15 Dec 2005 21:39:56 -0000 1.19
@@ -20,7 +20,7 @@
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
- * $Id: css_ruleimpl.h,v 1.18 2005/09/27 22:37:01 mjs Exp $
+ * $Id: css_ruleimpl.h,v 1.19 2005/12/15 21:39:56 eseidel Exp $
*/
#ifndef _CSS_css_ruleimpl_h_
#define _CSS_css_ruleimpl_h_
@@ -89,12 +89,12 @@
CSSFontFaceRuleImpl(StyleBaseImpl *parent);
virtual ~CSSFontFaceRuleImpl();
- CSSMutableStyleDeclarationImpl *style() const { return m_style; }
+ CSSMutableStyleDeclarationImpl *style() const { return m_style.get(); }
virtual bool isFontFaceRule() { return true; }
protected:
- CSSMutableStyleDeclarationImpl *m_style;
+ RefPtr<CSSMutableStyleDeclarationImpl> m_style;
};
@@ -108,8 +108,8 @@
virtual ~CSSImportRuleImpl();
DOM::DOMString href() const { return m_strHref; }
- MediaListImpl *media() const { return m_lstMedia; }
- CSSStyleSheetImpl *styleSheet() const { return m_styleSheet; }
+ MediaListImpl *media() const { return m_lstMedia.get(); }
+ CSSStyleSheetImpl *styleSheet() const { return m_styleSheet.get(); }
virtual bool isImportRule() { return true; }
virtual DOMString cssText() const;
@@ -122,8 +122,8 @@
protected:
DOMString m_strHref;
- MediaListImpl *m_lstMedia;
- CSSStyleSheetImpl *m_styleSheet;
+ RefPtr<MediaListImpl> m_lstMedia;
+ RefPtr<CSSStyleSheetImpl> m_styleSheet;
khtml::CachedCSSStyleSheet *m_cachedSheet;
bool m_loading;
};
@@ -158,7 +158,7 @@
virtual ~CSSMediaRuleImpl();
MediaListImpl *media() const { return m_lstMedia; }
- CSSRuleListImpl *cssRules() { return m_lstCSSRules; }
+ CSSRuleListImpl *cssRules() { return m_lstCSSRules.get(); }
unsigned insertRule ( const DOM::DOMString &rule, unsigned index );
void deleteRule ( unsigned index ) { m_lstCSSRules->deleteRule( index ); }
@@ -170,7 +170,7 @@
unsigned append( CSSRuleImpl *rule );
protected:
MediaListImpl *m_lstMedia;
- CSSRuleListImpl *m_lstCSSRules;
+ RefPtr<CSSRuleListImpl> m_lstCSSRules;
};
@@ -180,7 +180,7 @@
CSSPageRuleImpl(StyleBaseImpl *parent);
virtual ~CSSPageRuleImpl();
- CSSMutableStyleDeclarationImpl *style() const { return m_style; }
+ CSSMutableStyleDeclarationImpl *style() const { return m_style.get(); }
virtual bool isPageRule() { return true; }
@@ -188,7 +188,7 @@
void setSelectorText(DOM::DOMString str);
protected:
- CSSMutableStyleDeclarationImpl *m_style;
+ RefPtr<CSSMutableStyleDeclarationImpl> m_style;
};
class CSSImportantRuleImpl;
@@ -199,7 +199,7 @@
CSSStyleRuleImpl(StyleBaseImpl *parent);
virtual ~CSSStyleRuleImpl();
- CSSMutableStyleDeclarationImpl *style() const { return m_style; }
+ CSSMutableStyleDeclarationImpl *style() const { return m_style.get(); }
virtual bool isStyleRule() { return true; }
virtual DOMString cssText() const;
@@ -213,10 +213,10 @@
void setDeclaration( CSSMutableStyleDeclarationImpl *style);
CSSSelector* selector() { return m_selector; }
- CSSMutableStyleDeclarationImpl *declaration() { return m_style; }
+ CSSMutableStyleDeclarationImpl *declaration() { return m_style.get(); }
protected:
- CSSMutableStyleDeclarationImpl *m_style;
+ RefPtr<CSSMutableStyleDeclarationImpl> m_style;
CSSSelector* m_selector;
};
1.20 +4 -13 WebCore/khtml/css/css_stylesheetimpl.cpp
Index: css_stylesheetimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_stylesheetimpl.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- css_stylesheetimpl.cpp 25 Oct 2005 00:07:45 -0000 1.19
+++ css_stylesheetimpl.cpp 15 Dec 2005 21:39:56 -0000 1.20
@@ -19,7 +19,7 @@
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
- * $Id: css_stylesheetimpl.cpp,v 1.19 2005/10/25 00:07:45 darin Exp $
+ * $Id: css_stylesheetimpl.cpp,v 1.20 2005/12/15 21:39:56 eseidel Exp $
*/
//#define CSS_STYLESHEET_DEBUG
@@ -49,7 +49,6 @@
: StyleListImpl(parentSheet)
{
m_disabled = false;
- m_media = 0;
m_parentNode = 0;
m_strHref = href;
}
@@ -60,7 +59,6 @@
{
m_parentNode = parentNode;
m_disabled = false;
- m_media = 0;
m_strHref = href;
}
@@ -68,17 +66,14 @@
: StyleListImpl(owner)
{
m_disabled = false;
- m_media = 0;
m_parentNode = 0;
m_strHref = href;
}
StyleSheetImpl::~StyleSheetImpl()
{
- if (m_media) {
- m_media->setParent( 0 );
- m_media->deref();
- }
+ if (m_media)
+ m_media->setParent(0);
}
StyleSheetImpl *StyleSheetImpl::parentStyleSheet() const
@@ -86,12 +81,8 @@
return (parent() && parent()->isStyleSheet()) ? static_cast<StyleSheetImpl *>(parent()) : 0;
}
-void StyleSheetImpl::setMedia( MediaListImpl *media )
+void StyleSheetImpl::setMedia(MediaListImpl *media)
{
- if (media)
- media->ref();
- if (m_media)
- m_media->deref();
m_media = media;
}
1.14 +3 -3 WebCore/khtml/css/css_stylesheetimpl.h
Index: css_stylesheetimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_stylesheetimpl.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- css_stylesheetimpl.h 16 Sep 2005 22:42:01 -0000 1.13
+++ css_stylesheetimpl.h 15 Dec 2005 21:39:56 -0000 1.14
@@ -19,7 +19,7 @@
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
- * $Id: css_stylesheetimpl.h,v 1.13 2005/09/16 22:42:01 adele Exp $
+ * $Id: css_stylesheetimpl.h,v 1.14 2005/12/15 21:39:56 eseidel Exp $
*/
#ifndef _CSS_css_stylesheetimpl_h_
#define _CSS_css_stylesheetimpl_h_
@@ -69,7 +69,7 @@
StyleSheetImpl *parentStyleSheet() const;
DOM::DOMString href() const { return m_strHref; }
DOM::DOMString title() const { return m_strTitle; }
- MediaListImpl *media() const { return m_media; }
+ MediaListImpl *media() const { return m_media.get(); }
void setMedia( MediaListImpl *media );
virtual bool isLoading() { return false; }
@@ -78,7 +78,7 @@
DOM::NodeImpl *m_parentNode;
DOM::DOMString m_strHref;
DOM::DOMString m_strTitle;
- MediaListImpl *m_media;
+ RefPtr<MediaListImpl> m_media;
bool m_disabled;
};
1.85 +15 -60 WebCore/khtml/css/css_valueimpl.cpp
Index: css_valueimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_valueimpl.cpp,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -r1.84 -r1.85
--- css_valueimpl.cpp 14 Dec 2005 00:40:56 -0000 1.84
+++ css_valueimpl.cpp 15 Dec 2005 21:39:56 -0000 1.85
@@ -314,14 +314,12 @@
DOMString res;
for (int i = 0; i < 4; ++i) {
if (!isPropertyImplicit(properties[i])) {
- CSSValueImpl* value = getPropertyCSSValue(properties[i]);
+ RefPtr<CSSValueImpl> value = getPropertyCSSValue(properties[i]);
if (!value) // apparently all 4 properties must be specified.
return DOMString();
- value->ref();
if (!res.isNull())
res += " ";
res += value->cssText();
- value->deref();
}
}
return res;
@@ -332,13 +330,11 @@
DOMString res;
for (int i = 0; i < number; ++i) {
if (!isPropertyImplicit(properties[i])) {
- CSSValueImpl* value = getPropertyCSSValue(properties[i]);
+ RefPtr<CSSValueImpl> value = getPropertyCSSValue(properties[i]);
if (value) { // TODO provide default value if !value
- value->ref();
if (!res.isNull())
res += " ";
res += value->cssText();
- value->deref();
}
}
}
@@ -552,10 +548,8 @@
QValueListConstIterator<CSSProperty> end;
for (QValueListConstIterator<CSSProperty> it = other->valuesIterator(); it != end; ++it) {
const CSSProperty &property = *it;
- CSSValueImpl *value = getPropertyCSSValue(property.id());
+ RefPtr<CSSValueImpl> value = getPropertyCSSValue(property.id());
if (value) {
- value->ref();
- value->deref();
if (!argOverridesOnConflict)
continue;
removeProperty(property.id());
@@ -575,14 +569,9 @@
QValueListConstIterator<CSSProperty> end;
for (QValueListConstIterator<CSSProperty> it(style->valuesIterator()); it != end; ++it) {
const CSSProperty &property = *it;
- CSSValueImpl *value = getPropertyCSSValue(property.id());
- if (value) {
- value->ref();
- if (value->cssText() == property.value()->cssText()) {
- properties.append(property.id());
- }
- value->deref();
- }
+ RefPtr<CSSValueImpl> value = getPropertyCSSValue(property.id());
+ if (value && (value->cssText() == property.value()->cssText()))
+ properties.append(property.id());
}
for (QValueListIterator<int> it(properties.begin()); it != properties.end(); ++it)
@@ -762,31 +751,28 @@
CSSPrimitiveValueImpl::CSSPrimitiveValueImpl(const DOMString &str, CSSPrimitiveValue::UnitTypes type)
{
- m_value.string = str.impl();
- if(m_value.string) m_value.string->ref();
+ if ((m_value.string = str.impl()))
+ m_value.string->ref();
m_type = type;
}
CSSPrimitiveValueImpl::CSSPrimitiveValueImpl(CounterImpl *c)
{
- m_value.counter = c;
- if (m_value.counter)
+ if ((m_value.counter = c))
m_value.counter->ref();
m_type = CSSPrimitiveValue::CSS_COUNTER;
}
CSSPrimitiveValueImpl::CSSPrimitiveValueImpl( RectImpl *r)
{
- m_value.rect = r;
- if (m_value.rect)
+ if ((m_value.rect = r))
m_value.rect->ref();
m_type = CSSPrimitiveValue::CSS_RECT;
}
CSSPrimitiveValueImpl::CSSPrimitiveValueImpl( DashboardRegionImpl *r)
{
- m_value.region = r;
- if (m_value.region)
+ if ((m_value.region = r))
m_value.region->ref();
m_type = CSSPrimitiveValue::CSS_DASHBOARD_REGION;
}
@@ -799,8 +785,7 @@
CSSPrimitiveValueImpl::CSSPrimitiveValueImpl(PairImpl* p)
{
- m_value.pair = p;
- if (p)
+ if ((m_value.pair = p))
p->ref();
m_type = CSSPrimitiveValue::CSS_PAIR;
}
@@ -816,7 +801,8 @@
case CSSPrimitiveValue::CSS_STRING:
case CSSPrimitiveValue::CSS_URI:
case CSSPrimitiveValue::CSS_ATTR:
- if(m_value.string) m_value.string->deref();
+ if(m_value.string)
+ m_value.string->deref();
break;
case CSSPrimitiveValue::CSS_COUNTER:
m_value.counter->deref();
@@ -1101,7 +1087,7 @@
text += region->bottom()->cssText() + " ";
text += region->left()->cssText();
text += ")";
- region = region->m_next;
+ region = region->m_next.get();
}
break;
}
@@ -1113,45 +1099,29 @@
RectImpl::RectImpl()
{
- m_top = 0;
- m_right = 0;
- m_bottom = 0;
- m_left = 0;
}
RectImpl::~RectImpl()
{
- if (m_top) m_top->deref();
- if (m_right) m_right->deref();
- if (m_bottom) m_bottom->deref();
- if (m_left) m_left->deref();
}
void RectImpl::setTop( CSSPrimitiveValueImpl *top )
{
- if( top ) top->ref();
- if ( m_top ) m_top->deref();
m_top = top;
}
void RectImpl::setRight( CSSPrimitiveValueImpl *right )
{
- if( right ) right->ref();
- if ( m_right ) m_right->deref();
m_right = right;
}
void RectImpl::setBottom( CSSPrimitiveValueImpl *bottom )
{
- if( bottom ) bottom->ref();
- if ( m_bottom ) m_bottom->deref();
m_bottom = bottom;
}
void RectImpl::setLeft( CSSPrimitiveValueImpl *left )
{
- if( left ) left->ref();
- if ( m_left ) m_left->deref();
m_left = left;
}
@@ -1159,26 +1129,19 @@
PairImpl::PairImpl()
{
- m_first = m_second = 0;
}
PairImpl::~PairImpl()
{
- if (m_first) m_first->deref();
- if (m_second) m_second->deref();
}
void PairImpl::setFirst(CSSPrimitiveValueImpl *first)
{
- if (first) first->ref();
- if (m_first) m_first->deref();
m_first = first;
}
void PairImpl::setSecond(CSSPrimitiveValueImpl *second)
{
- if (second) second->ref();
- if (m_second) m_second->deref();
m_second = second;
}
@@ -1224,18 +1187,10 @@
: m_image(image), m_imageSliceRect(imageRect),
m_horizontalSizeRule(horizontalRule), m_verticalSizeRule(verticalRule)
{
- if (m_image)
- m_image->ref();
- if (m_imageSliceRect)
- m_imageSliceRect->ref();
}
CSSBorderImageValueImpl::~CSSBorderImageValueImpl()
{
- if (m_image)
- m_image->deref();
- if (m_imageSliceRect)
- m_imageSliceRect->deref();
}
DOMString CSSBorderImageValueImpl::cssText() const
1.55 +18 -35 WebCore/khtml/css/css_valueimpl.h
Index: css_valueimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_valueimpl.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- css_valueimpl.h 7 Dec 2005 01:12:36 -0000 1.54
+++ css_valueimpl.h 15 Dec 2005 21:39:57 -0000 1.55
@@ -259,20 +259,20 @@
RectImpl();
virtual ~RectImpl();
- CSSPrimitiveValueImpl *top() const { return m_top; }
- CSSPrimitiveValueImpl *right() const { return m_right; }
- CSSPrimitiveValueImpl *bottom() const { return m_bottom; }
- CSSPrimitiveValueImpl *left() const { return m_left; }
+ CSSPrimitiveValueImpl *top() const { return m_top.get(); }
+ CSSPrimitiveValueImpl *right() const { return m_right.get(); }
+ CSSPrimitiveValueImpl *bottom() const { return m_bottom.get(); }
+ CSSPrimitiveValueImpl *left() const { return m_left.get(); }
void setTop( CSSPrimitiveValueImpl *top );
void setRight( CSSPrimitiveValueImpl *right );
void setBottom( CSSPrimitiveValueImpl *bottom );
void setLeft( CSSPrimitiveValueImpl *left );
protected:
- CSSPrimitiveValueImpl *m_top;
- CSSPrimitiveValueImpl *m_right;
- CSSPrimitiveValueImpl *m_bottom;
- CSSPrimitiveValueImpl *m_left;
+ RefPtr<CSSPrimitiveValueImpl> m_top;
+ RefPtr<CSSPrimitiveValueImpl> m_right;
+ RefPtr<CSSPrimitiveValueImpl> m_bottom;
+ RefPtr<CSSPrimitiveValueImpl> m_left;
};
// A primitive value representing a pair. This is useful for properties like border-radius, background-size/position,
@@ -284,15 +284,15 @@
PairImpl();
virtual ~PairImpl();
- CSSPrimitiveValueImpl *first() const { return m_first; }
- CSSPrimitiveValueImpl *second() const { return m_second; }
+ CSSPrimitiveValueImpl *first() const { return m_first.get(); }
+ CSSPrimitiveValueImpl *second() const { return m_second.get(); }
void setFirst(CSSPrimitiveValueImpl *first);
void setSecond(CSSPrimitiveValueImpl *second);
protected:
- CSSPrimitiveValueImpl *m_first;
- CSSPrimitiveValueImpl *m_second;
+ RefPtr<CSSPrimitiveValueImpl> m_first;
+ RefPtr<CSSPrimitiveValueImpl> m_second;
};
@@ -306,13 +306,11 @@
void setNext (DashboardRegionImpl *next)
{
- if (next) next->ref();
- if (m_next) m_next->deref();
m_next = next;
}
public:
- DashboardRegionImpl *m_next;
+ RefPtr<DashboardRegionImpl> m_next;
QString m_label;
QString m_geometryType;
unsigned int m_isCircle:1;
@@ -346,11 +344,11 @@
public:
// The border image.
- CSSImageValueImpl* m_image;
+ RefPtr<CSSImageValueImpl> m_image;
// These four values are used to make "cuts" in the image. They can be numbers
// or percentages.
- RectImpl* m_imageSliceRect;
+ RefPtr<RectImpl> m_imageSliceRect;
// Values for how to handle the scaling/stretching/tiling of the image slices.
int m_horizontalSizeRule; // Rule for how to adjust the widths of the top/middle/bottom
@@ -414,8 +412,6 @@
CSSProperty(int propID, CSSValueImpl *value, bool important = false, int shorthandID = 0, bool implicit = false)
: m_id(propID), m_shorthandID(shorthandID), m_important(important), m_implicit(implicit), m_value(value)
{
- if (value)
- value->ref();
}
CSSProperty(const CSSProperty& o)
@@ -425,16 +421,10 @@
m_important = o.m_important;
m_implicit = o.m_implicit;
m_value = o.m_value;
- if (m_value)
- m_value->ref();
}
CSSProperty &operator=(const CSSProperty& o)
{
- if (o.m_value)
- o.m_value->ref();
- if (m_value)
- m_value->deref();
m_id = o.m_id;
m_shorthandID = o.m_shorthandID;
m_important = o.m_important;
@@ -442,16 +432,9 @@
return *this;
}
- ~CSSProperty() {
- if (m_value)
- m_value->deref();
- }
+ ~CSSProperty() {}
void setValue(CSSValueImpl *val) {
- if (val)
- val->ref();
- if (m_value)
- m_value->deref();
m_value = val;
}
@@ -461,7 +444,7 @@
bool isImportant() const { return m_important; }
bool isImplicit() const { return m_implicit; }
- CSSValueImpl *value() const { return m_value; }
+ CSSValueImpl *value() const { return m_value.get(); }
DOMString cssText() const;
@@ -474,7 +457,7 @@
friend bool operator==(const CSSProperty &, const CSSProperty &);
protected:
- CSSValueImpl *m_value;
+ RefPtr<CSSValueImpl> m_value;
};
class CSSMutableStyleDeclarationImpl : public CSSStyleDeclarationImpl
1.117 +2 -8 WebCore/khtml/css/cssparser.cpp
Index: cssparser.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/cssparser.cpp,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- cssparser.cpp 11 Dec 2005 09:26:06 -0000 1.116
+++ cssparser.cpp 15 Dec 2005 21:39:57 -0000 1.117
@@ -237,9 +237,7 @@
QRgb CSSParser::parseColor(const DOMString &string)
{
QRgb color = 0;
- CSSMutableStyleDeclarationImpl *dummyStyleDeclaration = new CSSMutableStyleDeclarationImpl;
-
- dummyStyleDeclaration->ref();
+ RefPtr<CSSMutableStyleDeclarationImpl>dummyStyleDeclaration = new CSSMutableStyleDeclarationImpl;
CSSParser parser(true);
@@ -247,19 +245,15 @@
if (!parser.parseColor(string.qstring(), color)) {
// Now try to create a color from the rgb() or rgba() syntax.
- bool ok = parser.parseColor(dummyStyleDeclaration, string);
- if ( ok ) {
+ if (parser.parseColor(dummyStyleDeclaration.get(), string)) {
CSSValueImpl *value = parser.parsedProperties[0]->value();
if (value->cssValueType() == CSSValue::CSS_PRIMITIVE_VALUE) {
CSSPrimitiveValueImpl *primitiveValue = static_cast<CSSPrimitiveValueImpl *>(value);
color = primitiveValue->getRGBColorValue();
}
}
-
}
- dummyStyleDeclaration->deref();
-
return color;
}
1.230 +2 -2 WebCore/khtml/css/cssstyleselector.cpp
Index: cssstyleselector.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/cssstyleselector.cpp,v
retrieving revision 1.229
retrieving revision 1.230
diff -u -r1.229 -r1.230
--- cssstyleselector.cpp 14 Dec 2005 23:31:43 -0000 1.229
+++ cssstyleselector.cpp 15 Dec 2005 21:39:57 -0000 1.230
@@ -3504,7 +3504,7 @@
// Set up a length box to represent our image slices.
LengthBox& l = image.m_slices;
- RectImpl* r = borderImage->m_imageSliceRect;
+ RectImpl* r = borderImage->m_imageSliceRect.get();
if (r->top()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
l.top = Length((int)r->top()->getFloatValue(CSSPrimitiveValue::CSS_PERCENTAGE), Percent);
else
@@ -4035,7 +4035,7 @@
else if (region->m_isRectangle) {
style->setDashboardRegion (StyleDashboardRegion::Rectangle, region->m_label, top, right, bottom, left, region == first ? false : true);
}
- region = region->m_next;
+ region = region->m_next.get();
}
element->getDocument()->setHasDashboardRegions (true);
More information about the webkit-changes
mailing list