[webkit-changes] cvs commit: WebCore/khtml/xsl
xsl_stylesheetimpl.cpp
Darin
darin at opensource.apple.com
Mon Oct 24 17:07:48 PDT 2005
darin 05/10/24 17:07:48
Modified: . ChangeLog
khtml/css css_base.cpp css_base.h css_ruleimpl.cpp
css_stylesheetimpl.cpp css_valueimpl.cpp
khtml/rendering render_replaced.cpp
khtml/xml dom_nodeimpl.cpp dom_nodeimpl.h
khtml/xsl xsl_stylesheetimpl.cpp
Log:
Reviewed by Beth.
- got ready to make m_parent private by removing references to it
also removed tabs (and used spaces instead) to files I touched
- fixed code that initialized m_parent twice
* khtml/css/css_base.cpp:
(StyleBaseImpl::checkLoaded): Use parent().
(StyleBaseImpl::stylesheet): Ditto.
* khtml/css/css_base.h:
(DOM::StyleBaseImpl::StyleBaseImpl): Initialize base TreeShared with the appropriate
parent instead of first setting m_parent to 0 and then to the correct value. Also
removed setParent, since the base class setParent works fine.
* khtml/css/css_ruleimpl.cpp:
(DOM::CSSRuleImpl::parentStyleSheet): Use parent().
(DOM::CSSRuleImpl::parentRule): Ditto.
* khtml/css/css_stylesheetimpl.cpp:
(StyleSheetImpl::parentStyleSheet): Ditto.
(MediaListImpl::parentStyleSheet): Ditto.
(MediaListImpl::parentRule): Ditto.
* khtml/css/css_valueimpl.cpp:
(DOM::CSSStyleDeclarationImpl::parentRule): Ditto.
* khtml/rendering/render_replaced.cpp: Reformatting only, and removed some
APPLE_CHANGES-only instead.
* khtml/xml/dom_nodeimpl.cpp:
(DOM::NodeImpl::isContentEditable): Use parent().
* khtml/xml/dom_nodeimpl.h:
(DOM::NodeImpl::parentNode): Ditto.
* khtml/xsl/xsl_stylesheetimpl.cpp:
(DOM::XSLImportRuleImpl::parentStyleSheet): Ditto.
Revision Changes Path
1.279 +33 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.278
retrieving revision 1.279
diff -u -r1.278 -r1.279
--- ChangeLog 24 Oct 2005 22:59:30 -0000 1.278
+++ ChangeLog 25 Oct 2005 00:07:41 -0000 1.279
@@ -1,3 +1,36 @@
+2005-10-24 Darin Adler <darin at apple.com>
+
+ Reviewed by Beth.
+
+ - got ready to make m_parent private by removing references to it
+ also removed tabs (and used spaces instead) to files I touched
+ - fixed code that initialized m_parent twice
+
+ * khtml/css/css_base.cpp:
+ (StyleBaseImpl::checkLoaded): Use parent().
+ (StyleBaseImpl::stylesheet): Ditto.
+ * khtml/css/css_base.h:
+ (DOM::StyleBaseImpl::StyleBaseImpl): Initialize base TreeShared with the appropriate
+ parent instead of first setting m_parent to 0 and then to the correct value. Also
+ removed setParent, since the base class setParent works fine.
+ * khtml/css/css_ruleimpl.cpp:
+ (DOM::CSSRuleImpl::parentStyleSheet): Use parent().
+ (DOM::CSSRuleImpl::parentRule): Ditto.
+ * khtml/css/css_stylesheetimpl.cpp:
+ (StyleSheetImpl::parentStyleSheet): Ditto.
+ (MediaListImpl::parentStyleSheet): Ditto.
+ (MediaListImpl::parentRule): Ditto.
+ * khtml/css/css_valueimpl.cpp:
+ (DOM::CSSStyleDeclarationImpl::parentRule): Ditto.
+ * khtml/rendering/render_replaced.cpp: Reformatting only, and removed some
+ APPLE_CHANGES-only instead.
+ * khtml/xml/dom_nodeimpl.cpp:
+ (DOM::NodeImpl::isContentEditable): Use parent().
+ * khtml/xml/dom_nodeimpl.h:
+ (DOM::NodeImpl::parentNode): Ditto.
+ * khtml/xsl/xsl_stylesheetimpl.cpp:
+ (DOM::XSLImportRuleImpl::parentStyleSheet): Ditto.
+
2005-10-24 David Hyatt <hyatt at apple.com>
Fix for 5485, make sure generated content's "rightmost selector"
1.22 +3 -3 WebCore/khtml/css/css_base.cpp
Index: css_base.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_base.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- css_base.cpp 23 Oct 2005 15:12:30 -0000 1.21
+++ css_base.cpp 25 Oct 2005 00:07:45 -0000 1.22
@@ -41,14 +41,14 @@
void StyleBaseImpl::checkLoaded()
{
- if(m_parent) m_parent->checkLoaded();
+ if (parent()) parent()->checkLoaded();
}
StyleSheetImpl* StyleBaseImpl::stylesheet()
{
StyleBaseImpl *b = this;
- while(b && !b->isStyleSheet())
- b = b->m_parent;
+ while (b && !b->isStyleSheet())
+ b = b->parent();
return static_cast<StyleSheetImpl *>(b);
}
1.20 +7 -9 WebCore/khtml/css/css_base.h
Index: css_base.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_base.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- css_base.h 23 Oct 2005 15:12:30 -0000 1.19
+++ css_base.h 25 Oct 2005 00:07:45 -0000 1.20
@@ -21,8 +21,8 @@
* Boston, MA 02111-1307, USA.
*/
-#ifndef _CSS_BASE_H
-#define _CSS_BASE_H
+#ifndef CSS_BASE_H
+#define CSS_BASE_H
#include "dom/dom_string.h"
#include "dom/dom_misc.h"
@@ -116,7 +116,7 @@
{
None = 0,
Id,
- Class,
+ Class,
Exact,
Set,
List,
@@ -200,10 +200,10 @@
class StyleBaseImpl : public khtml::TreeShared<StyleBaseImpl>
{
public:
- StyleBaseImpl() { m_parent = 0; strictParsing = true; multiLength = false; }
- StyleBaseImpl(StyleBaseImpl *p) {
- m_parent = p;
- strictParsing = (m_parent ? m_parent->useStrictParsing() : true);
+ typedef khtml::TreeShared<StyleBaseImpl> TreeShared;
+ StyleBaseImpl() { strictParsing = true; multiLength = false; }
+ StyleBaseImpl(StyleBaseImpl *p) : TreeShared(p) {
+ strictParsing = (p ? p->useStrictParsing() : true);
multiLength = false;
}
@@ -232,8 +232,6 @@
virtual bool isValueList() { return false; }
virtual bool isValueCustom() { return false; }
- void setParent(StyleBaseImpl *parent) { m_parent = parent; }
-
virtual bool parseString(const DOMString &/*cssString*/, bool = false) { return false; }
virtual void checkLoaded();
1.25 +17 -17 WebCore/khtml/css/css_ruleimpl.cpp
Index: css_ruleimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_ruleimpl.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- css_ruleimpl.cpp 3 Oct 2005 21:12:06 -0000 1.24
+++ css_ruleimpl.cpp 25 Oct 2005 00:07:45 -0000 1.25
@@ -34,20 +34,18 @@
#include "misc/loader.h"
#include "xml/dom_docimpl.h"
-using namespace DOM;
-
#include <kdebug.h>
+namespace DOM {
+
CSSStyleSheetImpl *CSSRuleImpl::parentStyleSheet() const
{
- return ( m_parent && m_parent->isCSSStyleSheet() ) ?
- static_cast<CSSStyleSheetImpl *>(m_parent) : 0;
+ return (parent() && parent()->isCSSStyleSheet()) ? static_cast<CSSStyleSheetImpl *>(parent()) : 0;
}
CSSRuleImpl *CSSRuleImpl::parentRule() const
{
- return ( m_parent && m_parent->isRule() ) ?
- static_cast<CSSRuleImpl *>(m_parent) : 0;
+ return (parent() && parent()->isRule()) ? static_cast<CSSRuleImpl *>(parent()) : 0;
}
DOM::DOMString CSSRuleImpl::cssText() const
@@ -86,7 +84,7 @@
m_lstMedia = media;
if ( !m_lstMedia )
- m_lstMedia = new MediaListImpl( this, DOMString() );
+ m_lstMedia = new MediaListImpl( this, DOMString() );
m_lstMedia->setParent( this );
m_lstMedia->ref();
@@ -118,8 +116,8 @@
CSSImportRuleImpl::~CSSImportRuleImpl()
{
if( m_lstMedia ) {
- m_lstMedia->setParent( 0 );
- m_lstMedia->deref();
+ m_lstMedia->setParent( 0 );
+ m_lstMedia->deref();
}
if(m_styleSheet) {
m_styleSheet->setParent(0);
@@ -156,9 +154,9 @@
StyleBaseImpl *root = this;
StyleBaseImpl *parent;
while ( ( parent = root->parent()) )
- root = parent;
+ root = parent;
if (root->isCSSStyleSheet())
- docLoader = static_cast<CSSStyleSheetImpl*>(root)->docLoader();
+ docLoader = static_cast<CSSStyleSheetImpl*>(root)->docLoader();
DOMString absHref = m_strHref;
CSSStyleSheetImpl *parentSheet = parentStyleSheet();
@@ -246,13 +244,13 @@
CSSMediaRuleImpl::~CSSMediaRuleImpl()
{
if( m_lstMedia ) {
- m_lstMedia->setParent( 0 );
+ m_lstMedia->setParent( 0 );
m_lstMedia->deref();
}
int length = m_lstCSSRules->length();
for (int i = 0; i < length; i++) {
- m_lstCSSRules->item( i )->setParent( 0 );
+ m_lstCSSRules->item( i )->setParent( 0 );
}
m_lstCSSRules->deref();
}
@@ -260,7 +258,7 @@
unsigned CSSMediaRuleImpl::append( CSSRuleImpl *rule )
{
if (!rule) {
- return 0;
+ return 0;
}
rule->setParent(this);
@@ -274,7 +272,7 @@
CSSRuleImpl *newRule = p.parseRule( parentStyleSheet(), rule );
if (!newRule) {
- return 0;
+ return 0;
}
newRule->setParent(this);
@@ -362,8 +360,8 @@
CSSStyleRuleImpl::~CSSStyleRuleImpl()
{
if(m_style) {
- m_style->setParent( 0 );
- m_style->deref();
+ m_style->setParent( 0 );
+ m_style->deref();
}
delete m_selector;
}
@@ -435,3 +433,5 @@
// ### Should throw INDEX_SIZE_ERR exception instead! (TODO)
return 0;
}
+
+}
1.19 +22 -28 WebCore/khtml/css/css_stylesheetimpl.cpp
Index: css_stylesheetimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_stylesheetimpl.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- css_stylesheetimpl.cpp 3 Oct 2005 21:12:06 -0000 1.18
+++ css_stylesheetimpl.cpp 25 Oct 2005 00:07:45 -0000 1.19
@@ -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.18 2005/10/03 21:12:06 mjs Exp $
+ * $Id: css_stylesheetimpl.cpp,v 1.19 2005/10/25 00:07:45 darin Exp $
*/
//#define CSS_STYLESHEET_DEBUG
@@ -75,25 +75,23 @@
StyleSheetImpl::~StyleSheetImpl()
{
- if(m_media) {
- m_media->setParent( 0 );
- m_media->deref();
+ if (m_media) {
+ m_media->setParent( 0 );
+ m_media->deref();
}
}
StyleSheetImpl *StyleSheetImpl::parentStyleSheet() const
{
- if( !m_parent ) return 0;
- if( m_parent->isStyleSheet() ) return static_cast<StyleSheetImpl *>(m_parent);
- return 0;
+ return (parent() && parent()->isStyleSheet()) ? static_cast<StyleSheetImpl *>(parent()) : 0;
}
void StyleSheetImpl::setMedia( MediaListImpl *media )
{
- if( media )
- media->ref();
- if( m_media )
- m_media->deref();
+ if (media)
+ media->ref();
+ if (m_media)
+ m_media->deref();
m_media = media;
}
@@ -160,22 +158,20 @@
CSSRuleImpl *CSSStyleSheetImpl::ownerRule() const
{
- if( !m_parent ) return 0;
- if( m_parent->isRule() ) return static_cast<CSSRuleImpl *>(m_parent);
- return 0;
+ return (parent() && parent()->isRule()) ? static_cast<CSSRuleImpl *>(parent()) : 0;
}
unsigned CSSStyleSheetImpl::insertRule( const DOMString &rule, unsigned index, int &exceptioncode )
{
exceptioncode = 0;
- if(index > m_lstChildren->count()) {
+ if (index > m_lstChildren->count()) {
exceptioncode = DOMException::INDEX_SIZE_ERR;
return 0;
}
CSSParser p( strictParsing );
CSSRuleImpl *r = p.parseRule( this, rule );
- if(!r) {
+ if (!r) {
exceptioncode = CSSException::SYNTAX_ERR + CSSException::_EXCEPTION_OFFSET;
return 0;
}
@@ -202,7 +198,7 @@
{
exceptioncode = 0;
StyleBaseImpl *b = m_lstChildren->take(index);
- if(!b) {
+ if (!b) {
exceptioncode = DOMException::INDEX_SIZE_ERR;
return;
}
@@ -253,13 +249,13 @@
StyleBaseImpl *rule;
for ( rule = m_lstChildren->first(); rule != 0; rule = m_lstChildren->next() )
{
- if(rule->isImportRule())
+ if (rule->isImportRule())
{
CSSImportRuleImpl *import = static_cast<CSSImportRuleImpl *>(rule);
#ifdef CSS_STYLESHEET_DEBUG
kdDebug( 6080 ) << "found import" << endl;
#endif
- if(import->isLoading())
+ if (import->isLoading())
{
#ifdef CSS_STYLESHEET_DEBUG
kdDebug( 6080 ) << "--> not loaded" << endl;
@@ -273,9 +269,9 @@
void CSSStyleSheetImpl::checkLoaded()
{
- if(isLoading()) return;
- if(m_parent) m_parent->checkLoaded();
- if(m_parentNode) m_parentNode->sheetLoaded();
+ if (isLoading()) return;
+ if (parent()) parent()->checkLoaded();
+ if (m_parentNode) m_parentNode->sheetLoaded();
}
khtml::DocLoader *CSSStyleSheetImpl::docLoader()
@@ -359,20 +355,18 @@
CSSStyleSheetImpl *MediaListImpl::parentStyleSheet() const
{
- if( m_parent->isCSSStyleSheet() ) return static_cast<CSSStyleSheetImpl *>(m_parent);
- return 0;
+ return parent()->isCSSStyleSheet() ? static_cast<CSSStyleSheetImpl *>(parent()) : 0;
}
CSSRuleImpl *MediaListImpl::parentRule() const
{
- if( m_parent->isRule() ) return static_cast<CSSRuleImpl *>(m_parent);
- return 0;
+ return parent()->isRule() ? static_cast<CSSRuleImpl *>(parent()) : 0;
}
void MediaListImpl::deleteMedium( const DOMString &oldMedium )
{
for ( QValueList<DOMString>::Iterator it = m_lstMedia.begin(); it != m_lstMedia.end(); ++it ) {
- if( (*it) == oldMedium ) {
+ if ((*it) == oldMedium) {
m_lstMedia.remove( it );
return;
}
@@ -398,7 +392,7 @@
for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it )
{
DOMString medium = (*it).stripWhiteSpace();
- if( medium != "" )
+ if (!medium.isEmpty())
m_lstMedia.append( medium );
}
}
1.79 +129 -143 WebCore/khtml/css/css_valueimpl.cpp
Index: css_valueimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/css/css_valueimpl.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- css_valueimpl.cpp 3 Oct 2005 21:12:07 -0000 1.78
+++ css_valueimpl.cpp 25 Oct 2005 00:07:45 -0000 1.79
@@ -449,8 +449,8 @@
bool success = parser.parseValue(this, propertyID, value, important);
if (!success) {
#if !APPLE_CHANGES
- kdDebug( 6080 ) << "CSSMutableStyleDeclarationImpl::setProperty invalid property: [" << getPropertyName(id).qstring()
- << "] value: [" << value.qstring() << "]"<< endl;
+ kdDebug( 6080 ) << "CSSMutableStyleDeclarationImpl::setProperty invalid property: [" << getPropertyName(id).qstring()
+ << "] value: [" << value.qstring() << "]"<< endl;
#endif
exceptionCode = CSSException::SYNTAX_ERR + CSSException::_EXCEPTION_OFFSET;
} else if (notifyChanged)
@@ -523,8 +523,7 @@
CSSRuleImpl *CSSStyleDeclarationImpl::parentRule() const
{
- return (m_parent && m_parent->isRule() ) ?
- static_cast<CSSRuleImpl *>(m_parent) : 0;
+ return (parent() && parent()->isRule()) ? static_cast<CSSRuleImpl *>(parent()) : 0;
}
DOM::DOMString CSSMutableStyleDeclarationImpl::cssText() const
@@ -712,11 +711,8 @@
CSSValueListImpl::~CSSValueListImpl()
{
- CSSValueImpl *val = m_values.first();
- while( val ) {
- val->deref();
- val = m_values.next();
- }
+ for (CSSValueImpl *val = m_values.first(); val; val = m_values.next())
+ val->deref();
}
unsigned short CSSValueListImpl::cssValueType() const
@@ -735,10 +731,9 @@
DOMString result = "";
for (QPtrListIterator<CSSValueImpl> iterator(m_values); iterator.current(); ++iterator) {
- if (result.length() != 0) {
- result += ", ";
- }
- result += iterator.current()->cssText();
+ if (!result.isEmpty())
+ result += ", ";
+ result += iterator.current()->cssText();
}
return result;
@@ -776,7 +771,7 @@
{
m_value.counter = c;
if (m_value.counter)
- m_value.counter->ref();
+ m_value.counter->ref();
m_type = CSSPrimitiveValue::CSS_COUNTER;
}
@@ -784,7 +779,7 @@
{
m_value.rect = r;
if (m_value.rect)
- m_value.rect->ref();
+ m_value.rect->ref();
m_type = CSSPrimitiveValue::CSS_RECT;
}
@@ -792,7 +787,7 @@
{
m_value.region = r;
if (m_value.region)
- m_value.region->ref();
+ m_value.region->ref();
m_type = CSSPrimitiveValue::CSS_DASHBOARD_REGION;
}
@@ -806,7 +801,7 @@
{
m_value.pair = p;
if (p)
- p->ref();
+ p->ref();
m_type = CSSPrimitiveValue::CSS_PAIR;
}
@@ -890,7 +885,7 @@
// FIXME: We have a bug right now where the zoom will be applied multiple times to EX units.
// We really need to compute EX using fontMetrics for the original specifiedSize and not use
// our actual constructed rendering font.
- {
+ {
QFontMetrics fm = style->fontMetrics();
#if APPLE_CHANGES
factor = fm.xHeight();
@@ -899,14 +894,14 @@
factor = b.height();
#endif
break;
- }
+ }
case CSSPrimitiveValue::CSS_PX:
break;
case CSSPrimitiveValue::CSS_CM:
- factor = dpiY/2.54; //72dpi/(2.54 cm/in)
+ factor = dpiY/2.54; //72dpi/(2.54 cm/in)
break;
case CSSPrimitiveValue::CSS_MM:
- factor = dpiY/25.4;
+ factor = dpiY/25.4;
break;
case CSSPrimitiveValue::CSS_IN:
factor = dpiY;
@@ -930,9 +925,9 @@
exceptioncode = 0;
cleanup();
// ### check if property supports this type
- if(m_type > CSSPrimitiveValue::CSS_DIMENSION) {
- exceptioncode = CSSException::SYNTAX_ERR + CSSException::_EXCEPTION_OFFSET;
- return;
+ if (m_type > CSSPrimitiveValue::CSS_DIMENSION) {
+ exceptioncode = CSSException::SYNTAX_ERR + CSSException::_EXCEPTION_OFFSET;
+ return;
}
//if(m_type > CSSPrimitiveValue::CSS_DIMENSION) throw DOMException(DOMException::INVALID_ACCESS_ERR);
m_value.num = floatValue;
@@ -945,15 +940,15 @@
cleanup();
//if(m_type < CSSPrimitiveValue::CSS_STRING) throw DOMException(DOMException::INVALID_ACCESS_ERR);
//if(m_type > CSSPrimitiveValue::CSS_ATTR) throw DOMException(DOMException::INVALID_ACCESS_ERR);
- if(m_type < CSSPrimitiveValue::CSS_STRING || m_type >> CSSPrimitiveValue::CSS_ATTR) {
- exceptioncode = CSSException::SYNTAX_ERR + CSSException::_EXCEPTION_OFFSET;
- return;
+ if (m_type < CSSPrimitiveValue::CSS_STRING || m_type >> CSSPrimitiveValue::CSS_ATTR) {
+ exceptioncode = CSSException::SYNTAX_ERR + CSSException::_EXCEPTION_OFFSET;
+ return;
}
if(stringType != CSSPrimitiveValue::CSS_IDENT)
{
- m_value.string = stringValue.impl();
- m_value.string->ref();
- m_type = stringType;
+ m_value.string = stringValue.impl();
+ m_value.string->ref();
+ m_type = stringType;
}
// ### parse ident
}
@@ -998,90 +993,90 @@
// name if it was specified) - check what spec says about this
DOMString text;
switch ( m_type ) {
- case CSSPrimitiveValue::CSS_UNKNOWN:
- // ###
- break;
- case CSSPrimitiveValue::CSS_NUMBER:
- text = DOMString(QString::number( m_value.num ));
- break;
- case CSSPrimitiveValue::CSS_PERCENTAGE:
- text = DOMString(QString::number( m_value.num ) + "%");
- break;
- case CSSPrimitiveValue::CSS_EMS:
- text = DOMString(QString::number( m_value.num ) + "em");
- break;
- case CSSPrimitiveValue::CSS_EXS:
- text = DOMString(QString::number( m_value.num ) + "ex");
- break;
- case CSSPrimitiveValue::CSS_PX:
- text = DOMString(QString::number( m_value.num ) + "px");
- break;
- case CSSPrimitiveValue::CSS_CM:
- text = DOMString(QString::number( m_value.num ) + "cm");
- break;
- case CSSPrimitiveValue::CSS_MM:
- text = DOMString(QString::number( m_value.num ) + "mm");
- break;
- case CSSPrimitiveValue::CSS_IN:
- text = DOMString(QString::number( m_value.num ) + "in");
- break;
- case CSSPrimitiveValue::CSS_PT:
- text = DOMString(QString::number( m_value.num ) + "pt");
- break;
- case CSSPrimitiveValue::CSS_PC:
- text = DOMString(QString::number( m_value.num ) + "pc");
- break;
- case CSSPrimitiveValue::CSS_DEG:
- text = DOMString(QString::number( m_value.num ) + "deg");
- break;
- case CSSPrimitiveValue::CSS_RAD:
- text = DOMString(QString::number( m_value.num ) + "rad");
- break;
- case CSSPrimitiveValue::CSS_GRAD:
- text = DOMString(QString::number( m_value.num ) + "grad");
- break;
- case CSSPrimitiveValue::CSS_MS:
- text = DOMString(QString::number( m_value.num ) + "ms");
- break;
- case CSSPrimitiveValue::CSS_S:
- text = DOMString(QString::number( m_value.num ) + "s");
- break;
- case CSSPrimitiveValue::CSS_HZ:
- text = DOMString(QString::number( m_value.num ) + "hz");
- break;
- case CSSPrimitiveValue::CSS_KHZ:
- text = DOMString(QString::number( m_value.num ) + "khz");
- break;
- case CSSPrimitiveValue::CSS_DIMENSION:
- // ###
- break;
- case CSSPrimitiveValue::CSS_STRING:
- text = quoteStringIfNeeded(m_value.string);
- break;
- case CSSPrimitiveValue::CSS_URI:
+ case CSSPrimitiveValue::CSS_UNKNOWN:
+ // ###
+ break;
+ case CSSPrimitiveValue::CSS_NUMBER:
+ text = DOMString(QString::number( m_value.num ));
+ break;
+ case CSSPrimitiveValue::CSS_PERCENTAGE:
+ text = DOMString(QString::number( m_value.num ) + "%");
+ break;
+ case CSSPrimitiveValue::CSS_EMS:
+ text = DOMString(QString::number( m_value.num ) + "em");
+ break;
+ case CSSPrimitiveValue::CSS_EXS:
+ text = DOMString(QString::number( m_value.num ) + "ex");
+ break;
+ case CSSPrimitiveValue::CSS_PX:
+ text = DOMString(QString::number( m_value.num ) + "px");
+ break;
+ case CSSPrimitiveValue::CSS_CM:
+ text = DOMString(QString::number( m_value.num ) + "cm");
+ break;
+ case CSSPrimitiveValue::CSS_MM:
+ text = DOMString(QString::number( m_value.num ) + "mm");
+ break;
+ case CSSPrimitiveValue::CSS_IN:
+ text = DOMString(QString::number( m_value.num ) + "in");
+ break;
+ case CSSPrimitiveValue::CSS_PT:
+ text = DOMString(QString::number( m_value.num ) + "pt");
+ break;
+ case CSSPrimitiveValue::CSS_PC:
+ text = DOMString(QString::number( m_value.num ) + "pc");
+ break;
+ case CSSPrimitiveValue::CSS_DEG:
+ text = DOMString(QString::number( m_value.num ) + "deg");
+ break;
+ case CSSPrimitiveValue::CSS_RAD:
+ text = DOMString(QString::number( m_value.num ) + "rad");
+ break;
+ case CSSPrimitiveValue::CSS_GRAD:
+ text = DOMString(QString::number( m_value.num ) + "grad");
+ break;
+ case CSSPrimitiveValue::CSS_MS:
+ text = DOMString(QString::number( m_value.num ) + "ms");
+ break;
+ case CSSPrimitiveValue::CSS_S:
+ text = DOMString(QString::number( m_value.num ) + "s");
+ break;
+ case CSSPrimitiveValue::CSS_HZ:
+ text = DOMString(QString::number( m_value.num ) + "hz");
+ break;
+ case CSSPrimitiveValue::CSS_KHZ:
+ text = DOMString(QString::number( m_value.num ) + "khz");
+ break;
+ case CSSPrimitiveValue::CSS_DIMENSION:
+ // ###
+ break;
+ case CSSPrimitiveValue::CSS_STRING:
+ text = quoteStringIfNeeded(m_value.string);
+ break;
+ case CSSPrimitiveValue::CSS_URI:
text = "url(";
- text += DOMString( m_value.string );
+ text += DOMString( m_value.string );
text += ")";
- break;
- case CSSPrimitiveValue::CSS_IDENT:
- text = getValueName(m_value.ident);
- break;
- case CSSPrimitiveValue::CSS_ATTR:
- // ###
- break;
- case CSSPrimitiveValue::CSS_COUNTER:
- // ###
- break;
+ break;
+ case CSSPrimitiveValue::CSS_IDENT:
+ text = getValueName(m_value.ident);
+ break;
+ case CSSPrimitiveValue::CSS_ATTR:
+ // ###
+ break;
+ case CSSPrimitiveValue::CSS_COUNTER:
+ // ###
+ break;
case CSSPrimitiveValue::CSS_RECT: {
- RectImpl* rectVal = getRectValue();
+ RectImpl* rectVal = getRectValue();
text = "rect(";
text += rectVal->top()->cssText() + " ";
text += rectVal->right()->cssText() + " ";
text += rectVal->bottom()->cssText() + " ";
text += rectVal->left()->cssText() + ")";
- break;
+ break;
}
- case CSSPrimitiveValue::CSS_RGBCOLOR: {
+ case CSSPrimitiveValue::CSS_RGBCOLOR: {
QColor color(m_value.rgbcolor);
if (qAlpha(m_value.rgbcolor) < 0xFF)
text = "rgba(";
@@ -1358,38 +1353,33 @@
DOMString result("");
if (style) {
- result += style->cssText();
+ result += style->cssText();
}
if (variant) {
- if (result.length() > 0) {
- result += " ";
- }
- result += variant->cssText();
+ if (!result.isEmpty())
+ result += " ";
+ result += variant->cssText();
}
if (weight) {
- if (result.length() > 0) {
- result += " ";
- }
- result += weight->cssText();
+ if (!result.isEmpty())
+ result += " ";
+ result += weight->cssText();
}
if (size) {
- if (result.length() > 0) {
- result += " ";
- }
- result += size->cssText();
+ if (!result.isEmpty())
+ result += " ";
+ result += size->cssText();
}
if (lineHeight) {
- if (!size) {
- result += " ";
- }
- result += "/";
- result += lineHeight->cssText();
+ if (!size)
+ result += " ";
+ result += "/";
+ result += lineHeight->cssText();
}
if (family) {
- if (result.length() > 0) {
- result += " ";
- }
- result += family->cssText();
+ if (!result.isEmpty())
+ result += " ";
+ result += family->cssText();
}
return result;
@@ -1399,7 +1389,7 @@
// Used for text-shadow and box-shadow
ShadowValueImpl::ShadowValueImpl(CSSPrimitiveValueImpl* _x, CSSPrimitiveValueImpl* _y,
CSSPrimitiveValueImpl* _blur, CSSPrimitiveValueImpl* _color)
-:x(_x), y(_y), blur(_blur), color(_color)
+:x(_x), y(_y), blur(_blur), color(_color)
{}
ShadowValueImpl::~ShadowValueImpl()
@@ -1413,26 +1403,22 @@
DOMString ShadowValueImpl::cssText() const
{
DOMString text("");
- if (color) {
- text += color->cssText();
- }
+ if (color)
+ text += color->cssText();
if (x) {
- if (text.length() > 0) {
- text += " ";
- }
- text += x->cssText();
+ if (!text.isEmpty())
+ text += " ";
+ text += x->cssText();
}
if (y) {
- if (text.length() > 0) {
- text += " ";
- }
- text += y->cssText();
+ if (!text.isEmpty())
+ text += " ";
+ text += y->cssText();
}
if (blur) {
- if (text.length() > 0) {
- text += " ";
- }
- text += blur->cssText();
+ if (!text.isEmpty())
+ text += " ";
+ text += blur->cssText();
}
return text;
1.92 +14 -69 WebCore/khtml/rendering/render_replaced.cpp
Index: render_replaced.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_replaced.cpp,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -r1.91 -r1.92
--- render_replaced.cpp 19 Oct 2005 09:15:14 -0000 1.91
+++ render_replaced.cpp 25 Oct 2005 00:07:46 -0000 1.92
@@ -281,9 +281,8 @@
{
KHTMLAssert( refCount() <= 0 );
- if (m_deleteWidget) {
- delete m_widget;
- }
+ if (m_deleteWidget)
+ delete m_widget;
}
void RenderWidget::resizeWidget( QWidget *widget, int w, int h )
@@ -310,9 +309,8 @@
if (m_widget) {
m_widget->removeEventFilter(this);
disconnect( m_widget, SIGNAL( destroyed()), this, SLOT( slotWidgetDestructed()));
- if (m_deleteWidget) {
- delete m_widget;
- }
+ if (m_deleteWidget)
+ delete m_widget;
m_widget = 0;
}
m_widget = widget;
@@ -323,23 +321,21 @@
// widget immediately, but we have to have really been full constructed (with a non-null
// style pointer).
if (!needsLayout() && style()) {
- resizeWidget( m_widget,
- m_width-borderLeft()-borderRight()-paddingLeft()-paddingRight(),
- m_height-borderLeft()-borderRight()-paddingLeft()-paddingRight() );
+ resizeWidget( m_widget,
+ m_width-borderLeft()-borderRight()-paddingLeft()-paddingRight(),
+ m_height-borderLeft()-borderRight()-paddingLeft()-paddingRight() );
}
else
setPos(xPos(), -500000);
-#if APPLE_CHANGES
- if (style()) {
- if (style()->visibility() != VISIBLE)
+ if (style()) {
+ if (style()->visibility() != VISIBLE)
m_widget->hide();
- else
- m_widget->show();
- }
-#endif
+ else
+ m_widget->show();
+ }
}
- m_view->addChild( m_widget, -500000, 0 );
+ m_view->addChild( m_widget, -500000, 0 );
}
m_deleteWidget = deleteWidget;
}
@@ -391,7 +387,6 @@
if (shouldPaintBackgroundOrBorder() && i.phase != PaintActionOutline)
paintBoxDecorations(i, _tx, _ty);
-#if APPLE_CHANGES
if (!m_widget || !m_view || i.phase != PaintActionForeground ||
style()->visibility() != VISIBLE)
return;
@@ -415,56 +410,6 @@
QRect selRect(selectionRect());
i.p->fillRect(selRect.x(), selRect.y(), selRect.width(), selRect.height(), brush);
}
-
-#else
- if (!m_widget || !m_view || i.phase != PaintActionForeground)
- return;
-
- if (style()->visibility() != VISIBLE) {
- m_widget->hide();
- return;
- }
-
- int xPos = _tx+borderLeft()+paddingLeft();
- int yPos = _ty+borderTop()+paddingTop();
-
- int childw = m_widget->width();
- int childh = m_widget->height();
- if ( (childw == 2000 || childh == 3072) && m_widget->inherits( "KHTMLView" ) ) {
- KHTMLView *vw = static_cast<KHTMLView *>(m_widget);
- int cy = m_view->contentsY();
- int ch = m_view->visibleHeight();
-
-
- int childx = m_view->childX( m_widget );
- int childy = m_view->childY( m_widget );
-
- int xNew = xPos;
- int yNew = childy;
-
- // qDebug("cy=%d, ch=%d, childy=%d, childh=%d", cy, ch, childy, childh );
- if ( childh == 3072 ) {
- if ( cy + ch > childy + childh ) {
- yNew = cy + ( ch - childh )/2;
- } else if ( cy < childy ) {
- yNew = cy + ( ch - childh )/2;
- }
-// qDebug("calculated yNew=%d", yNew);
- }
- yNew = kMin( yNew, yPos + m_height - childh );
- yNew = kMax( yNew, yPos );
- if ( yNew != childy || xNew != childx ) {
- if ( vw->contentsHeight() < yNew - yPos + childh )
- vw->resizeContents( vw->contentsWidth(), yNew - yPos + childh );
- vw->setContentsPos( xNew - xPos, yNew - yPos );
- }
- xPos = xNew;
- yPos = yNew;
- }
-
- m_view->addChild(m_widget, xPos, yPos );
- m_widget->show();
-#endif
}
void RenderWidget::handleFocusOut()
@@ -497,7 +442,7 @@
// KHTMLPartBrowserExtension *ext = static_cast<KHTMLPartBrowserExtension *>( elem->view->part()->browserExtension() );
// if ( ext ) ext->editableWidgetBlurred( m_widget );
// }
- handleFocusOut();
+ handleFocusOut();
}
break;
case QEvent::FocusIn:
1.201 +1 -1 WebCore/khtml/xml/dom_nodeimpl.cpp
Index: dom_nodeimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.cpp,v
retrieving revision 1.200
retrieving revision 1.201
diff -u -r1.200 -r1.201
--- dom_nodeimpl.cpp 7 Oct 2005 01:21:43 -0000 1.200
+++ dom_nodeimpl.cpp 25 Oct 2005 00:07:47 -0000 1.201
@@ -345,7 +345,7 @@
bool NodeImpl::isContentEditable() const
{
- return m_parent ? m_parent->isContentEditable() : false;
+ return parent() && parent()->isContentEditable();
}
QRect NodeImpl::getRect() const
1.107 +1 -1 WebCore/khtml/xml/dom_nodeimpl.h
Index: dom_nodeimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.h,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -r1.106 -r1.107
--- dom_nodeimpl.h 16 Oct 2005 03:36:06 -0000 1.106
+++ dom_nodeimpl.h 25 Oct 2005 00:07:47 -0000 1.107
@@ -88,7 +88,7 @@
virtual DOMString nodeValue() const;
virtual void setNodeValue( const DOMString &_nodeValue, int &exceptioncode );
virtual unsigned short nodeType() const = 0;
- NodeImpl *parentNode() const { return m_parent; }
+ NodeImpl *parentNode() const { return parent(); }
NodeImpl *previousSibling() const { return m_previous; }
NodeImpl *nextSibling() const { return m_next; }
virtual SharedPtr<NodeListImpl> childNodes();
1.5 +5 -5 WebCore/khtml/xsl/xsl_stylesheetimpl.cpp
Index: xsl_stylesheetimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xsl/xsl_stylesheetimpl.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- xsl_stylesheetimpl.cpp 3 Oct 2005 21:12:59 -0000 1.4
+++ xsl_stylesheetimpl.cpp 25 Oct 2005 00:07:48 -0000 1.5
@@ -82,8 +82,8 @@
{
if (isLoading())
return;
- if (m_parent)
- m_parent->checkLoaded();
+ if (parent())
+ parent()->checkLoaded();
if (m_parentNode)
m_parentNode->sheetLoaded();
}
@@ -178,7 +178,7 @@
XSLStyleSheetImpl* XSLImportRuleImpl::parentStyleSheet() const
{
- return (m_parent && m_parent->isXSLStyleSheet()) ? static_cast<XSLStyleSheetImpl*>(m_parent) : 0;
+ return (parent() && parent()->isXSLStyleSheet()) ? static_cast<XSLStyleSheetImpl*>(parent()) : 0;
}
xsltStylesheetPtr XSLStyleSheetImpl::compileStyleSheet()
@@ -276,9 +276,9 @@
StyleBaseImpl* root = this;
StyleBaseImpl* parent;
while ((parent = root->parent()))
- root = parent;
+ root = parent;
if (root->isXSLStyleSheet())
- docLoader = static_cast<XSLStyleSheetImpl*>(root)->docLoader();
+ docLoader = static_cast<XSLStyleSheetImpl*>(root)->docLoader();
DOMString absHref = m_strHref;
XSLStyleSheetImpl* parentSheet = parentStyleSheet();
More information about the webkit-changes
mailing list