+2004-11-15 Darin Adler <darin@apple.com>
+
+ Reviewed by Ken.
+
+ Use separate mutable style and computed style types as appropriate.
+ For now this should have no effect, but it prepares us for refactoring later.
+ Also remove some unnecessary "DOM::" prefixes and in one case factor out
+ some shared code.
+
+ * khtml/khtml_part.cpp:
+ (KHTMLPart::typingStyle):
+ (KHTMLPart::setTypingStyle):
+ (updateState):
+ (KHTMLPart::selectionHasStyle):
+ (KHTMLPart::selectionStartHasStyle):
+ (KHTMLPart::selectionComputedStyle):
+ * khtml/khtml_part.h:
+ * khtml/khtmlpart_p.h:
+
+ * khtml/css/css_base.h:
+ * khtml/css/css_ruleimpl.cpp:
+ (CSSStyleRuleImpl::setDeclaration):
+ * khtml/css/css_ruleimpl.h:
+ (DOM::CSSFontFaceRuleImpl::style):
+ (DOM::CSSPageRuleImpl::style):
+ (DOM::CSSStyleRuleImpl::style):
+ (DOM::CSSStyleRuleImpl::declaration):
+ * khtml/css/css_valueimpl.h:
+ (DOM::CSSPrimitiveValueImpl::):
+ * khtml/css/cssparser.cpp:
+ (CSSParser::parseValue):
+ (CSSParser::parseColor):
+ (CSSParser::parseDeclaration):
+ (CSSParser::createStyleDeclaration):
+ * khtml/css/cssparser.h:
+ * khtml/css/cssstyleselector.cpp:
+ (khtml::CSSStyleSelector::addMatchedDeclaration):
+ (khtml::CSSStyleSelector::matchRulesForList):
+ (khtml::CSSStyleSelector::styleForElement):
+ (khtml::CSSStyleSelector::applyDeclarations):
+ * khtml/css/cssstyleselector.h:
+ * khtml/css/parser.cpp:
+ * khtml/css/parser.y:
+ * khtml/dom/css_rule.h:
+ * khtml/dom/css_stylesheet.h:
+ * khtml/dom/css_value.h:
+ * khtml/dom/dom2_views.cpp:
+ * khtml/xml/dom2_viewsimpl.cpp:
+ (DOM::AbstractViewImpl::getComputedStyle):
+ * khtml/xml/dom_docimpl.cpp:
+ (DocumentImpl::importNode):
+ (DocumentImpl::setStyleSheet):
+ * khtml/xml/dom_docimpl.h:
+ * khtml/xml/dom_xmlimpl.cpp:
+ (DOM::ProcessingInstructionImpl::setStyleSheet):
+ * khtml/xml/dom_xmlimpl.h:
+
+ * khtml/dom/css_value.cpp:
+ (DOM::throwException): Added.
+ (DOM::CSSStyleDeclaration::setCssText): Call throwException, but always on 0 for now.
+ The real thing is coming with the next change to refactor.
+ (DOM::CSSPrimitiveValue::setFloatValue): Call throwException.
+ (DOM::CSSPrimitiveValue::setStringValue): Ditto.
+
2004-11-15 Darin Adler <darin@apple.com>
Reviewed by Ken.
class CSSProperty;
class CSSValueImpl;
class CSSPrimitiveValueImpl;
- class CSSStyleDeclarationImpl;
class CSSRuleImpl;
class CSSStyleRuleImpl;
return false;
}
-void CSSStyleRuleImpl::setDeclaration( CSSStyleDeclarationImpl *style)
+void CSSStyleRuleImpl::setDeclaration( CSSMutableStyleDeclarationImpl *style)
{
if ( m_style != style ) {
if(m_style) m_style->deref();
class CSSStyleSheet;
class CSSStyleSheetImpl;
class CSSStyleDeclarationImpl;
+typedef CSSStyleDeclarationImpl CSSMutableStyleDeclarationImpl;
class MediaListImpl;
class CSSRuleImpl : public StyleBaseImpl
virtual ~CSSFontFaceRuleImpl();
- CSSStyleDeclarationImpl *style() const { return m_style; }
+ CSSMutableStyleDeclarationImpl *style() const { return m_style; }
virtual bool isFontFaceRule() { return true; }
protected:
- CSSStyleDeclarationImpl *m_style;
+ CSSMutableStyleDeclarationImpl *m_style;
};
virtual ~CSSPageRuleImpl();
- CSSStyleDeclarationImpl *style() const { return m_style; }
+ CSSMutableStyleDeclarationImpl *style() const { return m_style; }
virtual bool isPageRule() { return true; }
void setSelectorText(DOM::DOMString str);
protected:
- CSSStyleDeclarationImpl *m_style;
+ CSSMutableStyleDeclarationImpl *m_style;
};
class CSSImportantRuleImpl;
virtual ~CSSStyleRuleImpl();
- CSSStyleDeclarationImpl *style() const { return m_style; }
+ CSSMutableStyleDeclarationImpl *style() const { return m_style; }
virtual bool isStyleRule() { return true; }
virtual bool parseString( const DOMString &string, bool = false );
void setSelector(CSSSelector* selector) { m_selector = selector; }
- void setDeclaration( CSSStyleDeclarationImpl *style);
+ void setDeclaration( CSSMutableStyleDeclarationImpl *style);
CSSSelector* selector() { return m_selector; }
- CSSStyleDeclarationImpl *declaration() { return m_style; }
+ CSSMutableStyleDeclarationImpl *declaration() { return m_style; }
protected:
- CSSStyleDeclarationImpl *m_style;
+ CSSMutableStyleDeclarationImpl *m_style;
CSSSelector* m_selector;
};
* This file is part of the DOM implementation for KDE.
*
* (C) 1999-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2002 Apple Computer, Inc.
+ * Copyright (C) 2004 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
class CSSStyleDeclarationImpl : public StyleBaseImpl
{
public:
- CSSStyleDeclarationImpl(CSSRuleImpl *parentRule);
+ CSSStyleDeclarationImpl(CSSRuleImpl *parentRule = 0);
CSSStyleDeclarationImpl(CSSRuleImpl *parentRule, QPtrList<CSSProperty> *lstValues);
virtual ~CSSStyleDeclarationImpl();
virtual unsigned short cssValueType() const = 0;
- virtual DOM::DOMString cssText() const = 0;
+ virtual DOMString cssText() const = 0;
virtual bool isValue() { return true; }
virtual bool isFontValue() { return false; }
virtual ~CSSInheritedValueImpl() {}
virtual unsigned short cssValueType() const;
- virtual DOM::DOMString cssText() const;
+ virtual DOMString cssText() const;
};
class CSSInitialValueImpl : public CSSValueImpl
{
public:
virtual unsigned short cssValueType() const;
- virtual DOM::DOMString cssText() const;
+ virtual DOMString cssText() const;
};
class CSSValueListImpl : public CSSValueImpl
virtual unsigned short cssValueType() const;
void append(CSSValueImpl *val);
- virtual DOM::DOMString cssText() const;
+ virtual DOMString cssText() const;
protected:
QPtrList<CSSValueImpl> m_values;
int getIdent();
virtual bool parseString( const DOMString &string, bool = false);
- virtual DOM::DOMString cssText() const;
+ virtual DOMString cssText() const;
virtual bool isQuirkValue() { return false; }
union {
int ident;
double num;
- DOM::DOMStringImpl *string;
+ DOMStringImpl *string;
CounterImpl *counter;
RectImpl *rect;
QRgb rgbcolor;
const QString &fontName() const { return parsedFontName; }
int genericFamilyType() const { return _genericFamilyType; }
- virtual DOM::DOMString cssText() const;
+ virtual DOMString cssText() const;
QString parsedFontName;
private:
virtual unsigned short cssValueType() const { return CSSValue::CSS_CUSTOM; }
- virtual DOM::DOMString cssText() const;
+ virtual DOMString cssText() const;
virtual bool isFontValue() { return true; }
virtual unsigned short cssValueType() const { return CSSValue::CSS_CUSTOM; }
- virtual DOM::DOMString cssText() const;
+ virtual DOMString cssText() const;
CSSPrimitiveValueImpl* x;
CSSPrimitiveValueImpl* y;
virtual unsigned short cssValueType() const { return CSSValue::CSS_CUSTOM; }
- virtual DOM::DOMString cssText() const;
+ virtual DOMString cssText() const;
bool isAuto() const { return autoValue; }
CSSValueImpl *value() const { return m_value; }
- DOM::DOMString cssText() const;
+ DOMString cssText() const;
// make sure the following fits in 4 bytes.
int m_id;
CSSProperty &operator=(const CSSProperty&);
};
+typedef CSSStyleDeclarationImpl CSSMutableStyleDeclarationImpl;
} // namespace
* This file is part of the DOM implementation for KDE.
*
* Copyright (C) 2003 Lars Knoll (knoll@kde.org)
- *
- * $Id$
+ * Copyright (C) 2004 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
return result;
}
-bool CSSParser::parseValue( DOM::CSSStyleDeclarationImpl *declaration, int _id, const DOM::DOMString &string,
+bool CSSParser::parseValue( CSSMutableStyleDeclarationImpl *declaration, int _id, const DOMString &string,
bool _important)
{
#ifdef CSS_DEBUG
QRgb CSSParser::parseColor( const DOM::DOMString &string )
{
QRgb color = 0;
- DOM::CSSStyleDeclarationImpl *dummyStyleDeclaration = new DOM::CSSStyleDeclarationImpl(0);
+ CSSMutableStyleDeclarationImpl *dummyStyleDeclaration = new CSSMutableStyleDeclarationImpl;
dummyStyleDeclaration->ref();
return color;
}
-bool CSSParser::parseColor( DOM::CSSStyleDeclarationImpl *declaration, const DOM::DOMString &string )
+bool CSSParser::parseColor( CSSMutableStyleDeclarationImpl *declaration, const DOMString &string )
{
styleElement = declaration->stylesheet();
return ok;
}
-bool CSSParser::parseDeclaration( DOM::CSSStyleDeclarationImpl *declaration, const DOM::DOMString &string )
+bool CSSParser::parseDeclaration( CSSMutableStyleDeclarationImpl *declaration, const DOMString &string )
{
#ifdef CSS_DEBUG
kdDebug( 6080 ) << "CSSParser::parseDeclaration:value='" << string.string() << "'" << endl;
parsedProperties[numParsedProperties++] = prop;
}
-CSSStyleDeclarationImpl *CSSParser::createStyleDeclaration( CSSStyleRuleImpl *rule )
+CSSMutableStyleDeclarationImpl *CSSParser::createStyleDeclaration( CSSStyleRuleImpl *rule )
{
QPtrList<CSSProperty> *propList = new QPtrList<CSSProperty>;
propList->setAutoDelete( true );
propList->append( parsedProperties[i] );
numParsedProperties = 0;
- return new CSSStyleDeclarationImpl(rule, propList);
+ return new CSSMutableStyleDeclarationImpl(rule, propList);
}
void CSSParser::clearProperties()
* This file is part of the DOM implementation for KDE.
*
* Copyright (C) 2003 Lars Knoll (knoll@kde.org)
- *
- * $Id$
+ * Copyright (C) 2004 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
class CSSValueImpl;
class CSSValueListImpl;
class CSSPrimitiveValueImpl;
- class CSSStyleDeclarationImpl;
+ typedef class CSSStyleDeclarationImpl CSSMutableStyleDeclarationImpl;
class CSSProperty;
class CSSRuleListImpl;
void parseSheet( DOM::CSSStyleSheetImpl *sheet, const DOM::DOMString &string );
DOM::CSSRuleImpl *parseRule( DOM::CSSStyleSheetImpl *sheet, const DOM::DOMString &string );
- bool parseValue( DOM::CSSStyleDeclarationImpl *decls, int id, const DOM::DOMString &string,
+ bool parseValue( DOM::CSSMutableStyleDeclarationImpl *decls, int id, const DOM::DOMString &string,
bool _important );
static QRgb CSSParser::parseColor( const DOM::DOMString &string );
- bool parseColor( DOM::CSSStyleDeclarationImpl *declaration, const DOM::DOMString &string );
- bool parseDeclaration( DOM::CSSStyleDeclarationImpl *decls, const DOM::DOMString &string );
+ bool parseColor( DOM::CSSMutableStyleDeclarationImpl *declaration, const DOM::DOMString &string );
+ bool parseDeclaration( DOM::CSSMutableStyleDeclarationImpl *decls, const DOM::DOMString &string );
static CSSParser *current() { return currentParser; }
void addProperty( int propId, CSSValueImpl *value, bool important );
bool hasProperties() const { return numParsedProperties > 0; }
- CSSStyleDeclarationImpl *createStyleDeclaration( CSSStyleRuleImpl *rule );
+ CSSMutableStyleDeclarationImpl *createStyleDeclaration( CSSStyleRuleImpl *rule );
void clearProperties();
bool parseValue( int propId, bool important );
m_matchedRules[m_matchedRuleCount++] = rule;
}
-void CSSStyleSelector::addMatchedDeclaration(CSSStyleDeclarationImpl* decl)
+void CSSStyleSelector::addMatchedDeclaration(CSSMutableStyleDeclarationImpl* decl)
{
if (m_matchedDecls.size() <= m_matchedDeclCount)
m_matchedDecls.resize(2*m_matchedDecls.size()+1);
Q_UINT16 tag = localNamePart(d->selector()->tag);
if ((cssTagId == tag || tag == anyLocalName) && checkSelector(d->selector(), element)) {
// If the rule has no properties to apply, then ignore it.
- CSSStyleDeclarationImpl* decl = rule->declaration();
+ CSSMutableStyleDeclarationImpl* decl = rule->declaration();
if (!decl) continue;
// If we're matching normal rules, set a pseudo bit if
// Now we check additional mapped declarations.
// Tables and table cells share an additional mapped rule that must be applied
// after all attributes, since their mapped style depends on the values of multiple attributes.
- CSSStyleDeclarationImpl* attributeDecl = htmlElement->additionalAttributeStyleDecl();
+ CSSMutableStyleDeclarationImpl* attributeDecl = htmlElement->additionalAttributeStyleDecl();
if (attributeDecl) {
if (firstAuthorRule == -1) firstAuthorRule = m_matchedDeclCount;
lastAuthorRule = m_matchedDeclCount;
// 7. Now check our inline style attribute.
if (htmlElement) {
- CSSStyleDeclarationImpl* inlineDecl = htmlElement->inlineStyleDecl();
+ CSSMutableStyleDeclarationImpl* inlineDecl = htmlElement->inlineStyleDecl();
if (inlineDecl) {
if (firstAuthorRule == -1) firstAuthorRule = m_matchedDeclCount;
lastAuthorRule = m_matchedDeclCount;
{
if (startIndex == -1) return;
for (int i = startIndex; i <= endIndex; i++) {
- CSSStyleDeclarationImpl* decl = m_matchedDecls[i];
+ CSSMutableStyleDeclarationImpl* decl = m_matchedDecls[i];
QPtrList<CSSProperty>* props = decl->values();
if (props) {
QPtrListIterator<CSSProperty> propertyIt(*props);
int& firstRuleIndex, int& lastRuleIndex);
void sortMatchedRules(uint firstRuleIndex, uint lastRuleIndex);
void addMatchedRule(CSSRuleData* rule);
- void addMatchedDeclaration(DOM::CSSStyleDeclarationImpl* decl);
+ void addMatchedDeclaration(DOM::CSSMutableStyleDeclarationImpl* decl);
void applyDeclarations(bool firstPass, bool important, int startIndex, int endIndex);
static DOM::CSSStyleSheetImpl *defaultSheet;
// set of matched decls four times, once for those properties that others depend on (like font-size),
// and then a second time for all the remaining properties. We then do the same two passes
// for any !important rules.
- QMemArray<DOM::CSSStyleDeclarationImpl*> m_matchedDecls;
+ QMemArray<DOM::CSSMutableStyleDeclarationImpl*> m_matchedDecls;
unsigned m_matchedDeclCount;
// A buffer used to hold the set of matched rules for an element, and a temporary buffer used for
CSSParser *p = static_cast<CSSParser *>(parser);
if ( yyvsp[-4].selector ) {
CSSStyleRuleImpl *rule = new CSSStyleRuleImpl( p->styleElement );
- CSSStyleDeclarationImpl *decl = p->createStyleDeclaration( rule );
+ CSSMutableStyleDeclarationImpl *decl = p->createStyleDeclaration( rule );
rule->setSelector( yyvsp[-4].selector );
rule->setDeclaration(decl);
yyval.rule = rule;
CSSParser *p = static_cast<CSSParser *>(parser);
if ( $1 ) {
CSSStyleRuleImpl *rule = new CSSStyleRuleImpl( p->styleElement );
- CSSStyleDeclarationImpl *decl = p->createStyleDeclaration( rule );
+ CSSMutableStyleDeclarationImpl *decl = p->createStyleDeclaration( rule );
rule->setSelector( $1 );
rule->setDeclaration(decl);
$$ = rule;
* the current state of the rule and not its initial value.
*
*/
- DOM::DOMString cssText() const;
+ DOMString cssText() const;
/**
* see @ref cssText
* INVALID_MODIFICATION_ERR: Raised if the specified CSS string value
* represents a different type of rule than the current one.
*/
- void setCssText( const DOM::DOMString & );
+ void setCssText( const DOMString & );
/**
* The style sheet that contains this rule.
* rule.
*
*/
- DOM::DOMString encoding() const;
+ DOMString encoding() const;
/**
* see @ref encoding
* readonly.
*
*/
- void setEncoding( const DOM::DOMString & );
+ void setEncoding( const DOMString & );
};
* the URI.
*
*/
- DOM::DOMString href() const;
+ DOMString href() const;
/**
* A list of media types for which this style sheet may be used.
* and is unparsable.
*
*/
- unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index );
+ unsigned long insertRule ( const DOMString &rule, unsigned long index );
/**
* Used to delete a rule from the media block.
* the rule.
*
*/
- DOM::DOMString selectorText() const;
+ DOMString selectorText() const;
/**
* see @ref selectorText
* readonly.
*
*/
- void setSelectorText( const DOM::DOMString & );
+ void setSelectorText( const DOMString & );
/**
* The <a href="http://www.w3.org/TR/REC-CSS2/syndata.html#q8">
* insignificant whitespace while parsing the selector.
*
*/
- DOM::DOMString selectorText() const;
+ DOMString selectorText() const;
/**
* see @ref selectorText
* readonly.
*
*/
- void setSelectorText( const DOM::DOMString & );
+ void setSelectorText( const DOMString & );
/**
* The <a href="http://www.w3.org/TR/REC-CSS2/syndata.html#q8">
* processing instruction </a> .
*
*/
- DOM::DOMString type() const;
+ DOMString type() const;
/**
* <code> false </code> if the style sheet is applied to the
* other style sheets, this attribute has a value of null.
*
*/
- DOM::Node ownerNode() const;
+ Node ownerNode() const;
/**
* For style sheet languages that support the concept of style
* processing instruction </a> .
*
*/
- DOM::DOMString href() const;
+ DOMString href() const;
/**
* The advisory title. The title is often specified in the <code>
* processing instruction </a> .
*
*/
- DOM::DOMString title() const;
+ DOMString title() const;
/**
* The intended destination media for style information. The media
* and is unparsable.
*
*/
- unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index );
+ unsigned long insertRule ( const DOMString &rule, unsigned long index );
/**
* Used to delete a rule from the style sheet.
*
* NO_MODIFICATION_ALLOWED_ERR: Raised if this media list is readonly.
*/
- DOM::DOMString mediaText() const;
+ DOMString mediaText() const;
/**
* see @ref mediaText
*/
- void setMediaText(const DOM::DOMString &value);
+ void setMediaText(const DOMString &value);
/**
* The number of media in the list. The range of valid media is 0 to length-1 inclusive.
* @return The medium at the indexth position in the MediaList, or null if
* that is not a valid index.
*/
- DOM::DOMString item(unsigned long index) const;
+ DOMString item(unsigned long index) const;
/**
* Deletes the medium indicated by oldMedium from the list.
*
* NOT_FOUND_ERR: Raised if oldMedium is not in the list.
*/
- void deleteMedium(const DOM::DOMString &oldMedium);
+ void deleteMedium(const DOMString &oldMedium);
/**
* Adds the medium newMedium to the end of the list. If the newMedium is
*
* NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly.
*/
- void appendMedium(const DOM::DOMString &newMedium);
+ void appendMedium(const DOMString &newMedium);
/**
* @internal
bool isNull() const;
protected:
- DOM::NodeImpl *node;
+ NodeImpl *node;
LinkStyleImpl *impl;
};
bool isNull() const;
protected:
- DOM::DocumentImpl *doc;
+ DocumentImpl *doc;
DocumentStyleImpl *impl;
};
return static_cast<CSSStyleDeclarationImpl *>(impl)->cssText();
}
+static void throwException(int exceptioncode)
+{
+ if (exceptioncode >= CSSException::_EXCEPTION_OFFSET)
+ throw CSSException(exceptioncode - CSSException::_EXCEPTION_OFFSET);
+ if (exceptioncode)
+ throw DOMException(exceptioncode);
+}
+
void CSSStyleDeclaration::setCssText( const DOMString &value )
{
if(!impl) return;
+ int exceptionCode = 0;
impl->setCssText(value);
+ throwException(exceptionCode);
}
DOMString CSSStyleDeclaration::getPropertyValue( const DOMString &propertyName )
if(!impl) return;
int exceptioncode = 0;
((CSSPrimitiveValueImpl *)impl)->setFloatValue( unitType, floatValue, exceptioncode );
- if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
- throw CSSException( exceptioncode - CSSException::_EXCEPTION_OFFSET );
- if ( exceptioncode )
- throw DOMException( exceptioncode );
+ throwException(exceptioncode);
}
float CSSPrimitiveValue::getFloatValue( unsigned short unitType )
int exceptioncode = 0;
if(impl)
((CSSPrimitiveValueImpl *)impl)->setStringValue( stringType, stringValue, exceptioncode );
- if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
- throw CSSException( exceptioncode - CSSException::_EXCEPTION_OFFSET );
- if ( exceptioncode )
- throw DOMException( exceptioncode );
+ throwException(exceptioncode);
}
* resetting of the properties in the declaration block.
*
*/
- DOM::DOMString cssText() const;
+ DOMString cssText() const;
/**
* see @ref cssText
* readonly.
*
*/
- void setCssText( const DOM::DOMString & );
+ void setCssText( const DOMString & );
/**
* The number of properties that have been explicitly set in this
* string if the property has not been set.
*
*/
- DOM::DOMString getPropertyValue ( const DOM::DOMString &propertyName );
+ DOMString getPropertyValue ( const DOMString &propertyName );
/**
* Used to retrieve the object representation of the value of a
* null </code> if the property has not been set.
*
*/
- CSSValue getPropertyCSSValue ( const DOM::DOMString &propertyName );
+ CSSValue getPropertyCSSValue ( const DOMString &propertyName );
/**
* Used to remove a CSS property if it has been explicitly set
* readonly.
*
*/
- DOM::DOMString removeProperty ( const DOM::DOMString &propertyName );
+ DOMString removeProperty ( const DOMString &propertyName );
/**
* Used to retrieve the priority of a CSS property (e.g. the
* exists.
*
*/
- DOM::DOMString getPropertyPriority ( const DOM::DOMString &propertyName );
+ DOMString getPropertyPriority ( const DOMString &propertyName );
/**
* Used to set a property value and priority within this
* readonly.
*
*/
- void setProperty ( const DOM::DOMString &propertyName, const DOM::DOMString &value, const DOM::DOMString &priority );
+ void setProperty ( const DOMString &propertyName, const DOMString &value, const DOMString &priority );
/**
* Used to retrieve the properties that have been explicitly set
* empty string if no property exists at this position.
*
*/
- DOM::DOMString item ( unsigned long index );
+ DOMString item ( unsigned long index );
/**
* @internal
* A string representation of the current value.
*
*/
- DOM::DOMString cssText() const;
+ DOMString cssText() const;
/**
* see @ref cssText
* readonly.
*
*/
- void setCssText( const DOM::DOMString & );
+ void setCssText( const DOMString & );
/**
* A code defining the type of the value as defined above.
* readonly.
*
*/
- void setStringValue ( unsigned short stringType, const DOM::DOMString &stringValue );
+ void setStringValue ( unsigned short stringType, const DOMString &stringValue );
/**
* This method is used to get the string value in a specified
* string value.
*
*/
- DOM::DOMString getStringValue ( );
+ DOMString getStringValue ( );
/**
* This method is used to get the Counter value. If this CSS value
* This attribute is used for the identifier of the counter.
*
*/
- DOM::DOMString identifier() const;
+ DOMString identifier() const;
/**
* This attribute is used for the style of the list.
*
*/
- DOM::DOMString listStyle() const;
+ DOMString listStyle() const;
/**
* This attribute is used for the separator of nested counters.
*
*/
- DOM::DOMString separator() const;
+ DOMString separator() const;
/**
* @internal
* This file is part of the DOM implementation for KDE.
*
* (C) 2001 Peter Kelly (pmk@post.com)
+ * Copyright (C) 2004 Apple Computer, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
#include "dom/dom_doc.h"
#include "xml/dom_elementimpl.h"
#include "xml/dom2_viewsimpl.h"
+#include "css/css_computedstyle.h"
using namespace DOM;
d->m_lastEditCommand = EditCommandPtr::emptyCommand();
}
-CSSStyleDeclarationImpl *KHTMLPart::typingStyle() const
+CSSMutableStyleDeclarationImpl *KHTMLPart::typingStyle() const
{
return d->m_typingStyle;
}
if (d->m_typingStyle == style)
return;
- CSSStyleDeclarationImpl *old = d->m_typingStyle;
+ CSSMutableStyleDeclarationImpl *old = d->m_typingStyle;
d->m_typingStyle = style;
if (d->m_typingStyle)
d->m_typingStyle->ref();
}
}
-static void updateState(CSSStyleDeclarationImpl *desiredStyle, CSSStyleDeclarationImpl *computedStyle, bool &atStart, KHTMLPart::TriState &state)
+static void updateState(CSSMutableStyleDeclarationImpl *desiredStyle, CSSComputedStyleDeclarationImpl *computedStyle, bool &atStart, KHTMLPart::TriState &state)
{
for (QPtrListIterator<CSSProperty> it(*desiredStyle->values()); it.current(); ++it) {
int propertyID = it.current()->id();
bool atStart = true;
TriState state = falseTriState;
+ CSSMutableStyleDeclarationImpl *mutableStyle = style;
+ CSSStyleDeclaration protectQueryStyle(mutableStyle);
+
if (!d->m_selection.isRange()) {
NodeImpl *nodeToRemove;
- CSSStyleDeclarationImpl *selectionStyle = selectionComputedStyle(nodeToRemove);
+ CSSComputedStyleDeclarationImpl *selectionStyle = selectionComputedStyle(nodeToRemove);
if (!selectionStyle)
return falseTriState;
selectionStyle->ref();
- updateState(style, selectionStyle, atStart, state);
+ updateState(mutableStyle, selectionStyle, atStart, state);
selectionStyle->deref();
if (nodeToRemove) {
int exceptionCode = 0;
}
} else {
for (NodeImpl *node = d->m_selection.start().node(); node; node = node->traverseNextNode()) {
- CSSStyleDeclarationImpl *computedStyle = new CSSComputedStyleDeclarationImpl(node);
+ CSSComputedStyleDeclarationImpl *computedStyle = new CSSComputedStyleDeclarationImpl(node);
if (computedStyle) {
computedStyle->ref();
- updateState(style, computedStyle, atStart, state);
+ updateState(mutableStyle, computedStyle, atStart, state);
computedStyle->deref();
}
if (state == mixedTriState)
if (!selectionStyle)
return false;
- selectionStyle->ref();
+ CSSMutableStyleDeclarationImpl *mutableStyle = style;
+
+ CSSStyleDeclaration protectSelectionStyle(selectionStyle);
+ CSSStyleDeclaration protectQueryStyle(mutableStyle);
bool match = true;
- for (QPtrListIterator<CSSProperty> it(*style->values()); it.current(); ++it) {
+ for (QPtrListIterator<CSSProperty> it(*mutableStyle->values()); it.current(); ++it) {
int propertyID = it.current()->id();
DOMString desiredProperty = style->getPropertyValue(propertyID);
DOMString selectionProperty = selectionStyle->getPropertyValue(propertyID);
}
}
- selectionStyle->deref();
-
if (nodeToRemove) {
int exceptionCode = 0;
nodeToRemove->remove(exceptionCode);
return value;
}
-CSSStyleDeclarationImpl *KHTMLPart::selectionComputedStyle(NodeImpl *&nodeToRemove) const
+CSSComputedStyleDeclarationImpl *KHTMLPart::selectionComputedStyle(NodeImpl *&nodeToRemove) const
{
nodeToRemove = 0;
{
class CSSComputedStyleDeclarationImpl;
class CSSStyleDeclarationImpl;
+ typedef CSSStyleDeclarationImpl CSSMutableStyleDeclarationImpl;
class DOMString;
class Document;
class DocumentImpl;
/**
* Returns the typing style for the document.
*/
- DOM::CSSStyleDeclarationImpl *typingStyle() const;
+ DOM::CSSMutableStyleDeclarationImpl *typingStyle() const;
/**
* Sets the typing style for the document.
void handleMousePressEventTripleClick(khtml::MousePressEvent *event);
#endif
- DOM::CSSStyleDeclarationImpl *selectionComputedStyle(DOM::NodeImpl *&nodeToRemove) const;
+ DOM::CSSComputedStyleDeclarationImpl *selectionComputedStyle(DOM::NodeImpl *&nodeToRemove) const;
KHTMLPartPrivate *d;
friend class KHTMLPartPrivate;
khtml::EditCommandPtr m_lastEditCommand;
int m_xPosForVerticalArrowNavigation;
- DOM::CSSStyleDeclarationImpl *m_typingStyle;
+ DOM::CSSMutableStyleDeclarationImpl *m_typingStyle;
int m_focusNodeNumber;
#include "dom2_viewsimpl.h"
-#include "css/css_base.h"
#include "css/css_computedstyle.h"
-#include "css/css_stylesheetimpl.h"
-#include "rendering/render_object.h"
+#include "dom_elementimpl.h"
-using DOM::AbstractViewImpl;
-using DOM::CSSComputedStyleDeclarationImpl;
-using DOM::CSSStyleDeclarationImpl;
-using DOM::DocumentImpl;
-using DOM::DOMStringImpl;
-using DOM::ElementImpl;
+namespace DOM {
AbstractViewImpl::AbstractViewImpl(DocumentImpl *_document)
{
return new CSSComputedStyleDeclarationImpl(elt);
}
+
+}
for(unsigned int i = 0; i < attr->length(); i++)
{
- DOM::DOMString qualifiedName = attr->item(i)->nodeName();
- DOM::DOMString value = attr->item(i)->nodeValue();
+ DOMString qualifiedName = attr->item(i)->nodeName();
+ DOMString value = attr->item(i)->nodeValue();
int colonpos = qualifiedName.find(':');
DOMString localName = qualifiedName;
m_styleSelector->setEncodedURL(m_url);
}
-void DocumentImpl::setStyleSheet(const DOM::DOMString &url, const DOM::DOMString &sheet)
+void DocumentImpl::setStyleSheet(const DOMString &url, const DOMString &sheet)
{
// kdDebug( 6030 ) << "HTMLDocument::setStyleSheet()" << endl;
m_sheet = new CSSStyleSheetImpl(this, url);
#endif
// from cachedObjectClient
- virtual void setStyleSheet(const DOM::DOMString &url, const DOM::DOMString &sheetStr);
+ virtual void setStyleSheet(const DOMString &url, const DOMString &sheetStr);
void setUserStyleSheet(const QString& sheet);
QString userStyleSheet() const { return m_usersheet; }
void setPrintStyleSheet(const QString& sheet) { m_printSheet = sheet; }
getDocument()->stylesheetLoaded();
}
-void ProcessingInstructionImpl::setStyleSheet(const DOM::DOMString &url, const DOM::DOMString &sheet)
+void ProcessingInstructionImpl::setStyleSheet(const DOMString &url, const DOMString &sheet)
{
if (m_sheet)
m_sheet->deref();
virtual bool childTypeAllowed( unsigned short type );
StyleSheetImpl *sheet() const;
bool checkStyleSheet();
- virtual void setStyleSheet(const DOM::DOMString &url, const DOM::DOMString &sheet);
+ virtual void setStyleSheet(const DOMString &url, const DOMString &sheet);
virtual void setStyleSheet(CSSStyleSheetImpl* sheet);
bool isLoading() const;
void sheetLoaded();