KDE/kdelibs/khtml

View: New views
1 Messages — Rating Filter:   Alert me  

KDE/kdelibs/khtml

by Bugzilla from germain@ebooksfrance.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

SVN commit 1046456 by ggarand:

need to distinguish at least two types of CSS value lists : those that
use the comma as a separator when flattened to a string, and
those that use the space.

initial patch by Vincent Ricard <magic@...>, with input from
dfaure and SadEagle, extended to apply to (hopefully) all relevant
properties.

BUG: 105108

 M  +1 -1      css/css_renderstyledeclarationimpl.cpp  
 M  +1 -1      css/css_svgcssparser.cpp  
 M  +7 -1      css/css_valueimpl.cpp  
 M  +8 -1      css/css_valueimpl.h  
 M  +3 -3      css/css_webfont.cpp  
 M  +5 -5      css/cssparser.cpp  
 M  +1 -1      svg/SVGFontFaceElement.cpp  
 M  +1 -1      svg/SVGFontFaceSrcElement.cpp  


--- trunk/KDE/kdelibs/khtml/css/css_renderstyledeclarationimpl.cpp #1046455:1046456
@@ -304,7 +304,7 @@
 {
     if (!shadow)
         return new CSSPrimitiveValueImpl(CSS_VAL_NONE);
-    CSSValueListImpl *list = new CSSValueListImpl;
+    CSSValueListImpl *list = new CSSValueListImpl(CSSValueListImpl::Comma);
     for (const ShadowData *s = shadow; s; s = s->next) {
         CSSPrimitiveValueImpl *x = new CSSPrimitiveValueImpl(s->x, CSSPrimitiveValue::CSS_PX);
         CSSPrimitiveValueImpl *y = new CSSPrimitiveValueImpl(s->y, CSSPrimitiveValue::CSS_PX);
--- trunk/KDE/kdelibs/khtml/css/css_svgcssparser.cpp #1046455:1046456
@@ -303,7 +303,7 @@
 
 CSSValueImpl* CSSParser::parseSVGStrokeDasharray()
 {
-    CSSValueListImpl* ret = new CSSValueListImpl;
+    CSSValueListImpl* ret = new CSSValueListImpl(CSSValueListImpl::Comma);
     Value* value = valueList->current();
     bool valid_primitive = true;
     while (value) {
--- trunk/KDE/kdelibs/khtml/css/css_valueimpl.cpp #1046455:1046456
@@ -924,7 +924,13 @@
     DOMString result = "";
 
     for (QListIterator<CSSValueImpl*> iterator(m_values); iterator.hasNext();) {
- result += iterator.next()->cssText();
+        if (!result.isEmpty()) {
+            if (m_separator == Comma)
+                result += ", ";
+            else if (m_separator == Space)
+                result += " ";
+        }
+        result += iterator.next()->cssText();
     }
 
     return result;
--- trunk/KDE/kdelibs/khtml/css/css_valueimpl.h #1046455:1046456
@@ -152,8 +152,14 @@
 class CSSValueListImpl : public CSSValueImpl
 {
 public:
-    CSSValueListImpl() : CSSValueImpl() {}
+    enum Separator {
+        Space,
+        Comma
+    };
 
+    CSSValueListImpl() : CSSValueImpl(), m_separator(Space) {}
+    CSSValueListImpl(Separator sep) : CSSValueImpl(), m_separator(sep) {}
+
     virtual ~CSSValueListImpl();
 
     unsigned long length() const { return m_values.count(); }
@@ -167,6 +173,7 @@
     virtual DOM::DOMString cssText() const;
 
 protected:
+    KDE_BF_ENUM(Separator) m_separator: 1;
     QList<CSSValueImpl*> m_values;
 };
 
--- trunk/KDE/kdelibs/khtml/css/css_webfont.cpp #1046455:1046456
@@ -372,7 +372,7 @@
     if (CSSValueImpl* fontStyle = style->getPropertyCSSValue(CSS_PROP_FONT_STYLE)) {
 
         if (fontStyle->isPrimitiveValue()) {
-            CSSValueListImpl* list = new CSSValueListImpl();// ### CSSValueListImpl::createCommaSeparated();
+            CSSValueListImpl* list = new CSSValueListImpl(CSSValueListImpl::Comma);
             list->append(fontStyle);
             fontStyle = list;
         } else if (!fontStyle->isValueList())
@@ -404,7 +404,7 @@
 
     if (CSSValueImpl* fontWeight = style->getPropertyCSSValue(CSS_PROP_FONT_WEIGHT)) {
         if (fontWeight->isPrimitiveValue()) {
-            CSSValueListImpl* list = new CSSValueListImpl();// ### CSSValueListImpl::createCommaSeparated();
+            CSSValueListImpl* list = new CSSValueListImpl(CSSValueListImpl::Comma);
             list->append(fontWeight);
             fontWeight = list;
         } else if (!fontWeight->isValueList())
@@ -460,7 +460,7 @@
 
     if (CSSValueImpl* fontVariant = style->getPropertyCSSValue(CSS_PROP_FONT_VARIANT)) {
         if (fontVariant->isPrimitiveValue()) {
-            CSSValueListImpl* list = new CSSValueListImpl();// ### CSSValueListImpl::createCommaSeparated();
+            CSSValueListImpl* list = new CSSValueListImpl(CSSValueListImpl::Comma);
             list->append(fontVariant);
             fontVariant = list;
         } else if (!fontVariant->isValueList())
--- trunk/KDE/kdelibs/khtml/css/cssparser.cpp #1046455:1046456
@@ -348,7 +348,7 @@
             // change those to a list of values containing a single value, so that we may always cast to a list in the CSSFontSelector.
             CSSValueImpl* value = property->value();
             value->ref();
-            property->setValue( new CSSValueListImpl ); // ### createCommaSeparated();
+            property->setValue( new CSSValueListImpl(CSSValueListImpl::Comma) );
             static_cast<CSSValueListImpl*>(property->value())->append(value);
             value->deref();
         }
@@ -1489,7 +1489,7 @@
 // [ <string> | attr(X) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit
 bool CSSParser::parseContent( int propId, bool important )
 {
-    CSSValueListImpl* values = new CSSValueListImpl();
+    CSSValueListImpl* values = new CSSValueListImpl(CSSValueListImpl::Comma);
 
     bool isValid = true;
     Value *val;
@@ -2116,7 +2116,7 @@
 CSSValueListImpl *CSSParser::parseFontFamily()
 {
 //     kDebug( 6080 ) << "CSSParser::parseFontFamily current=" << valueList->currentValue;
-    CSSValueListImpl *list = new CSSValueListImpl;
+    CSSValueListImpl *list = new CSSValueListImpl(CSSValueListImpl::Comma);
     Value *value = valueList->current();
     QString currFace;
 
@@ -2202,7 +2202,7 @@
 
 bool CSSParser::parseFontFaceSrc()
 {
-    CSSValueListImpl* values = new CSSValueListImpl; // ### CSSValueList::createCommaSeparated()
+    CSSValueListImpl* values = new CSSValueListImpl(CSSValueListImpl::Comma);
     Value* val;
     bool expectComma = false;
     bool allowFormat = false;
@@ -2479,7 +2479,7 @@
         // Handle the ,, case gracefully by doing nothing.
         if (x || y || blur || color) {
             if (!values)
-                values = new CSSValueListImpl();
+                values = new CSSValueListImpl(CSSValueListImpl::Comma);
 
             // Construct the current shadow value and add it to the list.
             values->append(new ShadowValueImpl(x, y, blur, color));
--- trunk/KDE/kdelibs/khtml/svg/SVGFontFaceElement.cpp #1046455:1046456
@@ -318,7 +318,7 @@
     if (describesParentFont) {
         m_fontElement = static_cast<SVGFontElement*>(parentNode());
 
-        list = new CSSValueList;
+        list = new CSSValueList; // ### CSSValueListImpl(CSSValueListImpl::Comma);
         list->append(new CSSFontFaceSrcValue(fontFamily(), true));
     } else if (srcElement)
         list = srcElement->srcValue();
--- trunk/KDE/kdelibs/khtml/svg/SVGFontFaceSrcElement.cpp #1046455:1046456
@@ -40,7 +40,7 @@
 
 PassRefPtr<CSSValueList> SVGFontFaceSrcElement::srcValue() const
 {
-    RefPtr<CSSValueList> list = new CSSValueList;
+    RefPtr<CSSValueList> list = new CSSValueList; // ### CSSValueListImpl(CSSValueListImpl::Comma)
     for (Node* child = firstChild(); child; child = child->nextSibling()) {
         if (child->hasTagName(font_face_uriTag))
             list->append(static_cast<SVGFontFaceUriElement*>(child)->srcValue());
_______________________________________________
Khtml-cvs mailing list
Khtml-cvs@...
https://mail.kde.org/mailman/listinfo/khtml-cvs