[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

mjs mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:12:32 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit e8c8c94b3dad11fc3f0dd75319f266e84a816403
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Nov 16 21:20:06 2003 +0000

            Reviewed by Ken and Dave.
    
    	- fixed 3471925 - getting and setting cssText not implemented
    
            * khtml/css/css_valueimpl.cpp:
            (CSSStyleDeclarationImpl::cssText): Implemented by gathering text of all
    	properties (that are not non-CSS hints), separated with semicolons.
            (CSSStyleDeclarationImpl::setCssText): Implemented by clearing all existing
    	properties (that are not non-CSS hints) and invoking css parser.
            (CSSValueListImpl::cssText): Implemented.
            (FontValueImpl::cssText): Implemented.
            (ShadowValueImpl::cssText): Implemented.
            (CSSProperty::cssText): Implemented.
            * khtml/css/css_valueimpl.h: Declared new methods; made
    	CSSValueImpl::cssText() pure virtual; removed CSSValueImpl::setCssText().
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5521 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 9def7eb..de0da4d 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,21 @@
+2003-11-14  Maciej Stachowiak  <mjs at apple.com>
+
+        Reviewed by Ken and Dave.
+
+	- fixed 3471925 - getting and setting cssText not implemented
+
+        * khtml/css/css_valueimpl.cpp:
+        (CSSStyleDeclarationImpl::cssText): Implemented by gathering text of all
+	properties (that are not non-CSS hints), separated with semicolons.
+        (CSSStyleDeclarationImpl::setCssText): Implemented by clearing all existing
+	properties (that are not non-CSS hints) and invoking css parser.
+        (CSSValueListImpl::cssText): Implemented.
+        (FontValueImpl::cssText): Implemented.
+        (ShadowValueImpl::cssText): Implemented.
+        (CSSProperty::cssText): Implemented.
+        * khtml/css/css_valueimpl.h: Declared new methods; made
+	CSSValueImpl::cssText() pure virtual; removed CSSValueImpl::setCssText().
+
 2003-11-16  David Hyatt  <hyatt at apple.com>
 
 	3485717, Cleanup of the float code.  Eliminated the -khtml-flow-mode style property in favor of two simple methods,
diff --git a/WebCore/khtml/css/css_valueimpl.cpp b/WebCore/khtml/css/css_valueimpl.cpp
index a292b7e..4f0ebc2 100644
--- a/WebCore/khtml/css/css_valueimpl.cpp
+++ b/WebCore/khtml/css/css_valueimpl.cpp
@@ -351,13 +351,46 @@ CSSRuleImpl *CSSStyleDeclarationImpl::parentRule() const
 
 DOM::DOMString CSSStyleDeclarationImpl::cssText() const
 {
-    return DOM::DOMString();
-    // ###
+    DOMString result;
+    
+    if ( m_lstValues) {
+	QPtrListIterator<CSSProperty> lstValuesIt(*m_lstValues);
+	CSSProperty *current;
+	for ( lstValuesIt.toFirst(); (current = lstValuesIt.current()); ++lstValuesIt ) {
+	    if (!current->nonCSSHint) {
+		result += current->cssText();
+	    }
+	}
+    }
+
+    return result;
 }
 
-void CSSStyleDeclarationImpl::setCssText(DOM::DOMString /*str*/)
+void CSSStyleDeclarationImpl::setCssText(DOM::DOMString text)
 {
-    // ###
+    if (m_lstValues) {
+	QPtrList<CSSProperty> nonCSSHints;
+
+	{
+	    // make sure to destruct iterator before reassigning list contents
+	    QPtrListIterator<CSSProperty> lstValuesIt(*m_lstValues);
+	    CSSProperty *current;
+	    for ( lstValuesIt.toFirst(); (current = lstValuesIt.current()); ++lstValuesIt ) {
+		if (current->nonCSSHint) {
+		    nonCSSHints.append(new CSSProperty(*current));
+		}
+	    }
+	}
+
+	*m_lstValues = nonCSSHints;
+    } else {
+	m_lstValues = new QPtrList<CSSProperty>;
+	m_lstValues->setAutoDelete( true );
+    }
+
+    CSSParser parser( strictParsing );
+    parser.parseDeclaration( this, text, false );
+    setChanged();
 }
 
 bool CSSStyleDeclarationImpl::parseString( const DOMString &/*string*/, bool )
@@ -378,16 +411,6 @@ CSSValueImpl::~CSSValueImpl()
 {
 }
 
-DOM::DOMString CSSValueImpl::cssText() const
-{
-    return DOM::DOMString();
-}
-
-void CSSValueImpl::setCssText(DOM::DOMString /*str*/)
-{
-    // ###
-}
-
 unsigned short CSSInheritedValueImpl::cssValueType() const
 {
     return CSSValue::CSS_INHERIT;
@@ -437,8 +460,13 @@ void CSSValueListImpl::append(CSSValueImpl *val)
 
 DOM::DOMString CSSValueListImpl::cssText() const
 {
-    // ###
-    return DOM::DOMString();
+    DOMString result = "";
+
+    for (QPtrListIterator<CSSValueImpl> iterator(m_values); iterator.current(); ++iterator) {
+	result += iterator.current()->cssText();
+    }
+    
+    return result;
 }
 
 // -------------------------------------------------------------------------------------
@@ -888,6 +916,51 @@ FontValueImpl::~FontValueImpl()
     delete family;
 }
 
+DOMString FontValueImpl::cssText() const
+{
+    // font variant weight size / line-height family 
+
+    DOMString result("");
+
+    if (style) {
+	result += style->cssText();
+    }
+    if (variant) {
+	if (result.length() > 0) {
+	    result += " ";
+	}
+	result += variant->cssText();
+    }
+    if (weight) {
+	if (result.length() > 0) {
+	    result += " ";
+	}
+	result += weight->cssText();
+    }
+    if (size) {
+	if (result.length() > 0) {
+	    result += " ";
+	}
+	result += size->cssText();
+    }
+    if (lineHeight) {
+	if (!size) {
+	    result += " ";
+	}
+	result += "/";
+	result += lineHeight->cssText();
+    }
+    if (family) {
+	if (result.length() > 0) {
+	    result += " ";
+	}
+	result += family->cssText();
+    }
+
+    return result;
+}
+    
+
 // Used for text-shadow and box-shadow
 ShadowValueImpl::ShadowValueImpl(CSSPrimitiveValueImpl* _x, CSSPrimitiveValueImpl* _y,
                                  CSSPrimitiveValueImpl* _blur, CSSPrimitiveValueImpl* _color)
@@ -902,3 +975,35 @@ ShadowValueImpl::~ShadowValueImpl()
     delete color;
 }
 
+DOMString ShadowValueImpl::cssText() const
+{
+    DOMString text("");
+    if (color) {
+	text += color->cssText();
+    }
+    if (x) {
+	if (text.length() > 0) {
+	    text += " ";
+	}
+	text += x->cssText();
+    }
+    if (y) {
+	if (text.length() > 0) {
+	    text += " ";
+	}
+	text += y->cssText();
+    }
+    if (blur) {
+	if (text.length() > 0) {
+	    text += " ";
+	}
+	text += blur->cssText();
+    }
+
+    return text;
+}
+
+DOMString CSSProperty::cssText() const
+{
+    return getPropertyName(m_id) + DOMString(": ") + m_value->cssText() + (m_bImportant ? DOMString(" !important") : DOMString()) + DOMString("; ");
+}
diff --git a/WebCore/khtml/css/css_valueimpl.h b/WebCore/khtml/css/css_valueimpl.h
index 327228d..90ee609 100644
--- a/WebCore/khtml/css/css_valueimpl.h
+++ b/WebCore/khtml/css/css_valueimpl.h
@@ -66,7 +66,7 @@ public:
     void setProperty ( const DOMString &propertyString);
     DOM::DOMString item ( unsigned long index );
 
-    DOM::DOMString cssText() const;
+    virtual DOM::DOMString cssText() const;
     void setCssText(DOM::DOMString str);
 
     virtual bool isStyleDeclaration() { return true; }
@@ -103,8 +103,7 @@ public:
 
     virtual unsigned short cssValueType() const = 0;
 
-    virtual DOM::DOMString cssText() const;
-    void setCssText(DOM::DOMString str);
+    virtual DOM::DOMString cssText() const = 0;
 
     virtual bool isValue() { return true; }
     virtual bool isFontValue() { return false; }
@@ -314,7 +313,9 @@ public:
     virtual ~FontValueImpl();
 
     virtual unsigned short cssValueType() const { return CSSValue::CSS_CUSTOM; }
-
+    
+    virtual DOM::DOMString cssText() const;
+    
     virtual bool isFontValue() { return true; }
 
     CSSPrimitiveValueImpl *style;
@@ -335,6 +336,8 @@ public:
 
     virtual unsigned short cssValueType() const { return CSSValue::CSS_CUSTOM; }
 
+    virtual DOM::DOMString cssText() const;
+
     CSSPrimitiveValueImpl* x;
     CSSPrimitiveValueImpl* y;
     CSSPrimitiveValueImpl* blur;
@@ -376,6 +379,8 @@ public:
 
     CSSValueImpl *value() { return m_value; }
 
+    DOM::DOMString cssText() const;
+
     // make sure the following fits in 4 bytes.
     int  m_id 		: 29;
     bool m_bImportant 	: 1;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list