[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kfm-devel
Subject:    PATCH: dynamically changing stle.visibility
From:       Peter Kelly <pmkelly () dingoblue ! net ! au>
Date:       2001-02-04 6:06:51
[Download RAW message or body]

This patch fixed the problems with the DHTML test on
http://www.xs4all.nl/~ppk/js/index.html?blockinvi.html (bug #19639)

If there are no objections, I will commit.

--
Peter Kelly
pmk@post.com
["visibility.patch" (text/plain)]

? khtml.kdevprj
Index: css/css_valueimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/css/css_valueimpl.cpp,v
retrieving revision 1.30
diff -u -p -r1.30 css_valueimpl.cpp
--- css/css_valueimpl.cpp	2001/01/21 22:35:06	1.30
+++ css/css_valueimpl.cpp	2001/02/04 05:28:55
@@ -493,9 +493,12 @@ int CSSPrimitiveValueImpl::getIdent()
 
 DOM::DOMString CSSPrimitiveValueImpl::cssText() const
 {
+    // ### return the original value instead of a generated one (e.g. color
+    // 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( (int)m_value.num ));
@@ -549,19 +552,30 @@ DOM::DOMString CSSPrimitiveValueImpl::cs
 	    text = DOMString(QString::number( m_value.num ) + "khz");
 	    break;
 	case CSSPrimitiveValue::CSS_DIMENSION:
+	    // ###
 	    break;
 	case CSSPrimitiveValue::CSS_STRING:
+	    // ###
+	    break;
 	case CSSPrimitiveValue::CSS_URI:
 	    text = DOMString( m_value.string );
 	    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:
+	    // ###
 	    break;
 	case CSSPrimitiveValue::CSS_RGBCOLOR:
-	    QColor c = m_value.rgbcolor->color();
-	    text = "#" + QString::number( c.red(), 16 ) + QString::number( c.red(), 16 ) + \
QString::number( c.red(), 16 ); +	    text = m_value.rgbcolor->color().name();
+	    break;
+	default:
 	    break;
     }
     return text;
Index: css/cssvalues.c
===================================================================
RCS file: /home/kde/kdelibs/khtml/css/cssvalues.c,v
retrieving revision 1.8
diff -u -p -r1.8 cssvalues.c
--- css/cssvalues.c	2001/01/19 01:18:54	1.8
+++ css/cssvalues.c	2001/02/04 05:31:35
@@ -1,5 +1,5 @@
-/* ANSI-C code produced by gperf version 2.7.2 */
-/* Command-line: gperf -a -L ANSI-C -E -C -c -o -t -k '*' -NfindValue -Hhash_val \
-Wwordlist_value -D -s 2 cssvalues.gperf  */ +/* ANSI-C code produced by gperf \
version 2.7 */ +/* Command-line: gperf -a -L ANSI-C -E -C -c -o -t -k * -NfindValue \
-Hhash_val -Wwordlist_value -D -s 2 cssvalues.gperf  */  /* This file is \
automatically generated from cssvalues.in by makevalues, do not edit */  /* Copyright \
1999 W. Bastian */  #include "cssvalues.h"
@@ -11,11 +11,7 @@ struct css_value {
 
 #ifdef __GNUC__
 __inline
-#else
-#ifdef __cplusplus
-inline
 #endif
-#endif
 static unsigned int
 hash_val (register const char *str, register unsigned int len)
 {
@@ -484,7 +480,7 @@ findValue (register const char *str, reg
             {
               register const char *s = wordlist_value[index].name;
 
-              if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == \
'\0') +              if (*str == *s && !strncmp (str + 1, s + 1, len - 1))
                 return &wordlist_value[index];
             }
           else if (index < -TOTAL_KEYWORDS)
@@ -497,7 +493,7 @@ findValue (register const char *str, reg
                 {
                   register const char *s = wordptr->name;
 
-                  if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == \
'\0') +                  if (*str == *s && !strncmp (str + 1, s + 1, len - 1))
                     return wordptr;
                   wordptr++;
                 }
@@ -506,3 +502,203 @@ findValue (register const char *str, reg
     }
   return 0;
 }
+static const char * valueList[] = {
+"",
+"above", 
+"absolute", 
+"always", 
+"armenian", 
+"auto", 
+"avoid", 
+"baseline", 
+"behind", 
+"below", 
+"bidi-override", 
+"blink", 
+"block", 
+"bold", 
+"bolder", 
+"both", 
+"bottom", 
+"capitalize", 
+"caption", 
+"center", 
+"center-left", 
+"center-right", 
+"circle", 
+"cjk-ideographic", 
+"close-quote", 
+"code", 
+"collapse", 
+"compact", 
+"condensed", 
+"continuous", 
+"crop", 
+"cross", 
+"crosshair", 
+"dashed", 
+"decimal", 
+"decimal-leading-zero", 
+"default", 
+"digits", 
+"disc", 
+"dotted", 
+"double", 
+"e-resize", 
+"embed", 
+"expanded", 
+"extra-condensed", 
+"extra-expanded", 
+"far-left", 
+"far-right", 
+"fast", 
+"faster", 
+"fixed", 
+"georgian", 
+"groove", 
+"hand", 
+"hebrew", 
+"help", 
+"hidden", 
+"hide", 
+"high", 
+"higher", 
+"hiragana", 
+"hiragana-iroha", 
+"icon", 
+"inline", 
+"inline-table", 
+"inset", 
+"inside", 
+"invert", 
+"italic", 
+"justify", 
+"katakana", 
+"katakana-iroha", 
+"landscape", 
+"large", 
+"larger", 
+"left", 
+"left-side", 
+"leftwards", 
+"level", 
+"lighter", 
+"line-through", 
+"list-item", 
+"loud", 
+"low", 
+"lower", 
+"lower-alpha", 
+"lower-greek", 
+"lower-latin", 
+"lower-roman", 
+"lowercase", 
+"ltr", 
+"marker", 
+"medium", 
+"menu", 
+"message-box", 
+"middle", 
+"mix", 
+"move", 
+"n-resize", 
+"narrower", 
+"ne-resize", 
+"no-close-quote", 
+"no-open-quote", 
+"no-repeat", 
+"none", 
+"normal", 
+"nowrap", 
+"nw-resize", 
+"oblique", 
+"once", 
+"open-quote", 
+"outset", 
+"outside", 
+"overline", 
+"pointer", 
+"portrait", 
+"pre", 
+"relative", 
+"repeat", 
+"repeat-x", 
+"repeat-y", 
+"repeat-none", 
+"ridge", 
+"right", 
+"right-side", 
+"rightwards", 
+"rtl", 
+"run-in", 
+"s-resize", 
+"scroll", 
+"se-resize", 
+"semi-condensed", 
+"semi-expanded", 
+"separate", 
+"show", 
+"silent", 
+"slow", 
+"slower", 
+"small", 
+"smaller", 
+"small-caps", 
+"small-caption", 
+"soft", 
+"solid", 
+"spell-out", 
+"square", 
+"static", 
+"status-bar", 
+"sub", 
+"super", 
+"sw-resize", 
+"table", 
+"table-caption", 
+"table-cell", 
+"table-column", 
+"table-column-group", 
+"table-footer-group", 
+"table-header-group", 
+"table-row", 
+"table-row-group", 
+"text", 
+"text-bottom", 
+"text-top", 
+"thin", 
+"thick", 
+"top", 
+"transparent", 
+"ultra-condensed", 
+"ultra-expanded", 
+"underline", 
+"upper-alpha", 
+"upper-latin", 
+"upper-roman", 
+"uppercase", 
+"visible", 
+"w-resize", 
+"wait", 
+"wider", 
+"x-fast", 
+"x-high", 
+"x-large", 
+"x-loud", 
+"x-low", 
+"x-slow", 
+"x-small", 
+"x-soft", 
+"xx-large", 
+"xx-small", 
+"konq-center", 
+    0
+};
+DOMString getValueName(unsigned short id)
+{
+    if(id >= CSS_VAL_TOTAL || id == 0)
+      return 0;
+    else
+      return DOMString(valueList[id]);
+};
+
Index: css/cssvalues.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/css/cssvalues.h,v
retrieving revision 1.6
diff -u -p -r1.6 cssvalues.h
--- css/cssvalues.h	2000/11/21 17:59:01	1.6
+++ css/cssvalues.h	2001/02/04 05:31:36
@@ -5,6 +5,7 @@
 #ifndef CSSVALUES_H
 #define CSSVALUES_H
 
+DOM::DOMString getValueName(unsigned short id);
 
 #define CSS_VAL_INVALID 0
 #define CSS_VAL_MIN 1
Index: css/makevalues
===================================================================
RCS file: /home/kde/kdelibs/khtml/css/makevalues,v
retrieving revision 1.2
diff -u -p -r1.2 makevalues
--- css/makevalues	2000/03/03 17:56:02	1.2
+++ css/makevalues	2001/02/04 05:31:36
@@ -26,7 +26,7 @@ echo -e '%{\n/* This file is automatical
 cat cssvalues.in | awk '{ do { prop = $0; gsub("-", "_"); print prop ", CSS_VAL_" \
toupper($0) } while (getline) }' >> cssvalues.gperf  echo '%%' >> cssvalues.gperf
 echo -e '/* This file is automatically generated from cssvalues.in by
-#makevalues, do not edit */\n/* Copyright 1998 W. Bastian */\n\n#ifndef \
CSSVALUES_H\n#define CSSVALUES_H\n\n' > cssvalues.h +#makevalues, do not edit */\n/* \
Copyright 1998 W. Bastian */\n\n#ifndef CSSVALUES_H\n#define \
CSSVALUES_H\n\nDOM::DOMString getValueName(unsigned short id);\n' > cssvalues.h  cat \
cssvalues.in | awk '{ \  i=1; \
 print "#define CSS_VAL_INVALID 0"; \
@@ -37,3 +37,25 @@ print "#define CSS_VAL_TOTAL " i \
 }' >> cssvalues.h
 gperf -a -L 'ANSI-C' -E -C -c -o -t -k '*' -NfindValue -Hhash_val -Wwordlist_value \
-D -s 2 cssvalues.gperf > cssvalues.c  echo -e '#endif\n' >> cssvalues.h
+
+cat cssvalues.in | awk '{ \
+i=1; \
+print "static const char * valueList[] = {"; \
+print "\"\","; \
+do { print "\"" $0 "\", "; i = i + 1 } while (getline); \
+print "    0"; \
+print "};"; \
+print "DOMString getValueName(unsigned short id)"; \
+print "{"; \
+print "    if(id >= CSS_VAL_TOTAL || id == 0)"; \
+print "      return 0;";\
+print "    else";\
+print "      return DOMString(valueList[id]);"; \
+print "};"; \
+print ""; \
+}' >> cssvalues.c
+
+
+
+
+
Index: ecma/kjs_css.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/ecma/kjs_css.cpp,v
retrieving revision 1.7
diff -u -p -r1.7 kjs_css.cpp
--- ecma/kjs_css.cpp	2000/10/28 10:33:20	1.7
+++ ecma/kjs_css.cpp	2001/02/04 05:31:36
@@ -21,6 +21,7 @@
 
 #include <xml/dom_nodeimpl.h>
 #include <dom/html_element.h>
+#include <html/html_elementimpl.h>
 #include <rendering/render_style.h>
 #include <kjs/types.h>
 #include <css/cssproperties.h>
@@ -74,5 +75,5 @@ void Style::put(const UString &p, const 
     }
     el.removeCSSProperty( prop );
     if(!propvalue.isEmpty())
-        el.addCSSProperty( prop, DOM::DOMString(propvalue) );
+        static_cast<HTMLElementImpl*>(el.handle())->addCSSProperty( prop, \
DOM::DOMString(propvalue), false );  }
Index: html/html_elementimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/html_elementimpl.cpp,v
retrieving revision 1.102
diff -u -p -r1.102 html_elementimpl.cpp
--- html/html_elementimpl.cpp	2001/01/21 16:11:08	1.102
+++ html/html_elementimpl.cpp	2001/02/04 05:31:36
@@ -214,10 +214,10 @@ static inline CSSStyleDeclarationImpl *c
     return m_styleDecls;
 }
 
-void HTMLElementImpl::addCSSProperty( const DOMString &property, const DOMString \
&value) +void HTMLElementImpl::addCSSProperty( const DOMString &property, const \
DOMString &value, bool nonCSSHint)  {
     if(!m_styleDecls) m_styleDecls = createDecl( document );
-    m_styleDecls->setProperty(property, value, false, true);
+    m_styleDecls->setProperty(property, value, false, nonCSSHint);
 }
 
 void HTMLElementImpl::addCSSProperty(int id, const DOMString &value)
Index: html/html_elementimpl.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/html_elementimpl.h,v
retrieving revision 1.37
diff -u -p -r1.37 html_elementimpl.h
--- html/html_elementimpl.h	2001/01/21 16:30:10	1.37
+++ html/html_elementimpl.h	2001/02/04 05:31:36
@@ -49,7 +49,7 @@ public:
 
     virtual DOM::CSSStyleDeclarationImpl *styleRules() { return m_styleDecls; }
 
-    void addCSSProperty( const DOMString &property, const DOMString &value);
+    void addCSSProperty( const DOMString &property, const DOMString &value, bool \
nonCSSHint = true);  void addCSSLength(int id, const DOMString &value);
     void addCSSProperty(int id, const DOMString &value);
     void addCSSProperty(const DOMString &property);



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic