23 #include "dom/css_rule.h"
24 #include "dom/dom_exception.h"
26 #include "css/css_renderstyledeclarationimpl.h"
27 #include "css/css_valueimpl.h"
31 CSSStyleDeclaration::CSSStyleDeclaration()
36 CSSStyleDeclaration::CSSStyleDeclaration(
const CSSStyleDeclaration &other)
42 CSSStyleDeclaration::CSSStyleDeclaration(CSSStyleDeclarationImpl *i)
48 CSSStyleDeclaration &CSSStyleDeclaration::operator = (
const CSSStyleDeclaration &other)
50 if ( impl != other.impl ) {
51 if(impl) impl->deref();
58 CSSStyleDeclaration::~CSSStyleDeclaration()
60 if(impl) impl->deref();
66 return static_cast<CSSStyleDeclarationImpl *
>(impl)->
cssText();
72 impl->setCssText(value);
83 int id = getPropertyID(propertyName.string().ascii(), propertyName.length());
96 int id = getPropertyID(propertyName.string().ascii(), propertyName.length());
103 int id = getPropertyID(property.string().ascii(),
property.length());
105 return static_cast<CSSStyleDeclarationImpl *
>(impl)->
removeProperty(
id );
115 int id = getPropertyID(propertyName.string().ascii(), propertyName.length());
117 if (impl->getPropertyPriority(
id))
125 int id = getPropertyID(propName.string().lower().ascii(), propName.length());
127 bool important =
false;
128 TQString str = priority.string();
129 if (str.find(
"important", 0,
false) != -1)
132 static_cast<CSSStyleDeclarationImpl *
>(impl)->
setProperty(
id, value, important );
138 return static_cast<CSSStyleDeclarationImpl *
>(impl)->
length();
149 return static_cast<CSSStyleDeclarationImpl *
>(impl)->
item( index );
154 return static_cast<CSSStyleDeclarationImpl *
>(impl)->
parentRule();
157 CSSStyleDeclarationImpl *CSSStyleDeclaration::handle()
const
162 bool CSSStyleDeclaration::isNull()
const
174 CSSValue::CSSValue(
const CSSValue &other)
177 if(impl) impl->ref();
180 CSSValue::CSSValue(CSSValueImpl *i)
183 if(impl) impl->ref();
186 CSSValue &CSSValue::operator = (
const CSSValue &other)
188 if ( impl != other.impl ) {
189 if(impl) impl->deref();
191 if(impl) impl->ref();
196 CSSValue::~CSSValue()
198 if(impl) impl->deref();
204 return ((CSSValueImpl *)impl)->cssText();
210 ((CSSValueImpl *)impl)->cssText();
216 return ((CSSValueImpl *)impl)->cssValueType();
219 bool CSSValue::isCSSValueList()
const
221 if(!impl)
return false;
222 return ((CSSValueImpl *)impl)->isValueList();
225 bool CSSValue::isCSSPrimitiveValue()
const
227 if(!impl)
return false;
228 return ((CSSValueImpl *)impl)->isPrimitiveValue();
231 CSSValueImpl *CSSValue::handle()
const
236 bool CSSValue::isNull()
const
243 CSSValueList::CSSValueList() : CSSValue()
247 CSSValueList::CSSValueList(
const CSSValueList &other) : CSSValue(other)
251 CSSValueList::CSSValueList(
const CSSValue &other)
257 CSSValueList::CSSValueList(CSSValueListImpl *impl) : CSSValue(impl)
261 CSSValueList &CSSValueList::operator = (
const CSSValueList &other)
263 if ( impl != other.impl ) {
264 if (impl) impl->deref();
265 impl = other.handle();
266 if (impl) impl->ref();
271 CSSValueList &CSSValueList::operator = (
const CSSValue &other)
273 CSSValueImpl *ohandle = other.handle() ;
274 if ( impl != ohandle ) {
275 if (impl) impl->deref();
276 if (!other.isNull() && !other.isCSSValueList()) {
280 if (impl) impl->ref();
286 CSSValueList::~CSSValueList()
293 return ((CSSValueListImpl *)impl)->length();
299 return ((CSSValueListImpl *)impl)->item( index );
304 CSSPrimitiveValue::CSSPrimitiveValue() :
CSSValue()
308 CSSPrimitiveValue::CSSPrimitiveValue(
const CSSPrimitiveValue &other) : CSSValue(other)
312 CSSPrimitiveValue::CSSPrimitiveValue(
const CSSValue &other) : CSSValue(other)
318 CSSPrimitiveValue::CSSPrimitiveValue(CSSPrimitiveValueImpl *impl) : CSSValue(impl)
322 CSSPrimitiveValue &CSSPrimitiveValue::operator = (
const CSSPrimitiveValue &other)
324 if ( impl != other.impl ) {
325 if (impl) impl->deref();
326 impl = other.handle();
327 if (impl) impl->ref();
332 CSSPrimitiveValue &CSSPrimitiveValue::operator = (
const CSSValue &other)
334 CSSValueImpl *ohandle = other.handle();
335 if ( impl != ohandle ) {
336 if (impl) impl->deref();
337 if (!other.isNull() && !other.isCSSPrimitiveValue()) {
341 if (impl) impl->ref();
347 CSSPrimitiveValue::~CSSPrimitiveValue()
354 return ((CSSPrimitiveValueImpl *)impl)->primitiveType();
360 int exceptioncode = 0;
361 ((CSSPrimitiveValueImpl *)impl)->setFloatValue( unitType, floatValue, exceptioncode );
362 if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
363 throw CSSException( exceptioncode - CSSException::_EXCEPTION_OFFSET );
374 return ((CSSPrimitiveValueImpl *)impl)->floatValue( unitType );
379 int exceptioncode = 0;
381 ((CSSPrimitiveValueImpl *)impl)->setStringValue( stringType, stringValue, exceptioncode );
382 if ( exceptioncode >= CSSException::_EXCEPTION_OFFSET )
383 throw CSSException( exceptioncode - CSSException::_EXCEPTION_OFFSET );
392 return ((CSSPrimitiveValueImpl *)impl)->getStringValue( );
398 return ((CSSPrimitiveValueImpl *)impl)->getCounterValue( );
403 if(!impl)
return Rect();
404 return ((CSSPrimitiveValueImpl *)impl)->getRectValue( );
421 Counter::Counter(
const Counter &)
426 Counter &Counter::operator = (
const Counter &other)
428 if ( impl != other.impl ) {
429 if (impl) impl->deref();
431 if (impl) impl->ref();
436 Counter::Counter(CounterImpl *i)
439 if (impl) impl->ref();
444 if (impl) impl->deref();
450 return impl->identifier();
456 return khtml::stringForListStyleType((khtml::EListStyleType)impl->listStyle());
462 return impl->separator();
465 CounterImpl *Counter::handle()
const
470 bool Counter::isNull()
const
481 RGBColor::RGBColor(
const RGBColor &other)
483 m_color = other.m_color;
486 RGBColor::RGBColor(QRgb color)
491 RGBColor &RGBColor::operator = (
const RGBColor &other)
493 m_color = other.m_color;
497 RGBColor::~RGBColor()
503 return new CSSPrimitiveValueImpl(
float(tqAlpha(m_color) ? tqRed(m_color) : 0), CSSPrimitiveValue::CSS_DIMENSION);
508 return new CSSPrimitiveValueImpl(
float(tqAlpha(m_color) ? tqGreen(m_color) : 0), CSSPrimitiveValue::CSS_DIMENSION);
513 return new CSSPrimitiveValueImpl(
float(tqAlpha(m_color) ? tqBlue(m_color) : 0), CSSPrimitiveValue::CSS_DIMENSION);
524 Rect::Rect(
const Rect &other)
527 if (impl) impl->ref();
530 Rect::Rect(RectImpl *i)
533 if (impl) impl->ref();
536 Rect &Rect::operator = (
const Rect &other)
538 if ( impl != other.impl ) {
539 if (impl) impl->deref();
541 if (impl) impl->ref();
548 if (impl) impl->deref();
560 return impl->right();
566 return impl->bottom();
575 RectImpl *Rect::handle()
const
580 bool Rect::isNull()
const