Normalize all our custom properties in our implementation to be -khtml (remove all...
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 May 2005 23:08:02 +0000 (23:08 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 May 2005 23:08:02 +0000 (23:08 +0000)
Make sure that -apple, -khtml, and -moz are all able to be used.  -apple and -moz just map to -khtml.

Add support for automatically converting -khtml-opacity to opacity (for legacy Safari 1.1 compat).

        Reviewed by darin

        * khtml/css/css_computedstyle.cpp:
        (DOM::):
        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
        * khtml/css/cssparser.cpp:
        (CSSParser::parseValue):
        * khtml/css/cssproperties.in:
        * khtml/css/cssstyleselector.cpp:
        (khtml::CSSStyleSelector::applyDeclarations):
        (khtml::CSSStyleSelector::applyProperty):
        * khtml/css/parser.y:
        * khtml/ecma/kjs_css.cpp:
        (cssPropertyName):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@9101 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/css/css_computedstyle.cpp
WebCore/khtml/css/cssparser.cpp
WebCore/khtml/css/cssproperties.in
WebCore/khtml/css/cssstyleselector.cpp
WebCore/khtml/css/parser.y
WebCore/khtml/ecma/kjs_css.cpp

index 1d16d21b49492e1917fcc8f481f9fcccf33ff43b..641e7b6e6c1f7bc70105b503a51f4a1b19f61a98 100644 (file)
@@ -1,3 +1,26 @@
+2005-05-03  David Hyatt  <hyatt@apple.com>
+
+       Normalize all our custom properties in our implementation to be -khtml (remove all the -apple).
+
+       Make sure that -apple, -khtml, and -moz are all able to be used.  -apple and -moz just map to -khtml.
+
+       Add support for automatically converting -khtml-opacity to opacity (for legacy Safari 1.1 compat).
+       
+        Reviewed by darin
+
+        * khtml/css/css_computedstyle.cpp:
+        (DOM::):
+        (DOM::CSSComputedStyleDeclarationImpl::getPropertyCSSValue):
+        * khtml/css/cssparser.cpp:
+        (CSSParser::parseValue):
+        * khtml/css/cssproperties.in:
+        * khtml/css/cssstyleselector.cpp:
+        (khtml::CSSStyleSelector::applyDeclarations):
+        (khtml::CSSStyleSelector::applyProperty):
+        * khtml/css/parser.y:
+        * khtml/ecma/kjs_css.cpp:
+        (cssPropertyName):
+
 2005-05-03  Darin Adler  <darin@apple.com>
 
         - fix the build
index f397a2d58bdfd0c82207fd89eff18bcaf798e019..9955e5e8db3e81f9e506de51fe69546fb7ee0bb2 100644 (file)
@@ -90,7 +90,7 @@ static const int computedProperties[] = {
     CSS_PROP_CLEAR,
     CSS_PROP_COLOR,
     CSS_PROP_CURSOR,
-    CSS_PROP__APPLE_DASHBOARD_REGION,
+    CSS_PROP__KHTML_DASHBOARD_REGION,
     CSS_PROP_DIRECTION,
     CSS_PROP_DISPLAY,
     CSS_PROP_EMPTY_CELLS,
@@ -104,7 +104,7 @@ static const int computedProperties[] = {
     CSS_PROP_LEFT,
     CSS_PROP_LETTER_SPACING,
     CSS_PROP__KHTML_LINE_BREAK,
-    CSS_PROP__APPLE_LINE_CLAMP,
+    CSS_PROP__KHTML_LINE_CLAMP,
     CSS_PROP_LINE_HEIGHT,
     CSS_PROP_LIST_STYLE_IMAGE,
     CSS_PROP_LIST_STYLE_POSITION,
@@ -682,7 +682,7 @@ CSSValueImpl *CSSComputedStyleDeclarationImpl::getPropertyCSSValue(int propertyI
         if (style->letterSpacing() == 0)
             return new CSSPrimitiveValueImpl(CSS_VAL_NORMAL);
         return new CSSPrimitiveValueImpl(style->letterSpacing(), CSSPrimitiveValue::CSS_PX);
-    case CSS_PROP__APPLE_LINE_CLAMP:
+    case CSS_PROP__KHTML_LINE_CLAMP:
         return new CSSPrimitiveValueImpl(style->lineClamp(), CSSPrimitiveValue::CSS_PERCENTAGE);
     case CSS_PROP_LINE_HEIGHT: {
         Length length(style->lineHeight());
@@ -993,7 +993,7 @@ CSSValueImpl *CSSComputedStyleDeclarationImpl::getPropertyCSSValue(int propertyI
         return valueForLength(style->textIndent());
     case CSS_PROP_TEXT_SHADOW:
         return valueForShadow(style->textShadow());
-    case CSS_PROP__APPLE_TEXT_SIZE_ADJUST:
+    case CSS_PROP__KHTML_TEXT_SIZE_ADJUST:
         if (style->textSizeAdjust()) 
             return new CSSPrimitiveValueImpl(CSS_VAL_AUTO);
         else
@@ -1185,7 +1185,7 @@ CSSValueImpl *CSSComputedStyleDeclarationImpl::getPropertyCSSValue(int propertyI
         break;
 #endif
 #if APPLE_CHANGES
-        case CSS_PROP__APPLE_DASHBOARD_REGION: {
+        case CSS_PROP__KHTML_DASHBOARD_REGION: {
             QValueList<StyleDashboardRegion> regions = style->dashboardRegions();
             uint i, count = regions.count();
             if (count == 1 && regions[0].type == StyleDashboardRegion::None)
index d0987171efd2dc189d5527bad37dc5d08b0c0669..1034ad401c86cf18b3f64fd89dbd9539d8cd0922 100644 (file)
@@ -511,7 +511,7 @@ bool CSSParser::parseValue( int propId, bool important )
        break;
 
 #if APPLE_CHANGES
-    case CSS_PROP__APPLE_DASHBOARD_REGION:                 // <dashboard-region> | <dashboard-region> 
+    case CSS_PROP__KHTML_DASHBOARD_REGION:                 // <dashboard-region> | <dashboard-region> 
        if ( value->unit == Value::Function || id == CSS_VAL_NONE)
            return parseDashboardRegions( propId, important );
        break;
@@ -1119,10 +1119,10 @@ bool CSSParser::parseValue( int propId, bool important )
 #if APPLE_CHANGES
     // Apple specific properties.  These will never be standardized and are purely to
     // support custom WebKit-based Apple applications.
-    case CSS_PROP__APPLE_LINE_CLAMP:
+    case CSS_PROP__KHTML_LINE_CLAMP:
         valid_primitive = (!id && validUnit(value, FPercent, false));
         break;
-    case CSS_PROP__APPLE_TEXT_SIZE_ADJUST:
+    case CSS_PROP__KHTML_TEXT_SIZE_ADJUST:
         if (id == CSS_VAL_AUTO || id == CSS_VAL_NONE)
             valid_primitive = true;
         break;
index 600e0a2e31f7914ee2957a1f5b3d701a9900f7a1..42fa2ae8c7eacf8876325c833e5fb5a4b2f6ee34 100644 (file)
@@ -67,7 +67,7 @@ font-weight
 height
 left
 letter-spacing
--apple-line-clamp
+-khtml-line-clamp
 line-height
 list-style-image
 list-style-position
@@ -135,8 +135,8 @@ text-underline-color
 text-underline-mode
 text-underline-style
 text-underline-width
--apple-text-size-adjust
--apple-dashboard-region
+-khtml-text-size-adjust
+-khtml-dashboard-region
 top
 unicode-bidi
 -khtml-user-drag
index 44c1865fba61175b0458b30ecfbb27be687932aa..b813cba4ee6fb0fab65d6a4d9d09ad539a97d015 100644 (file)
@@ -1730,7 +1730,7 @@ void CSSStyleSelector::applyDeclarations(bool applyFirst, bool isImportant,
                     case CSS_PROP_FONT_FAMILY:
                     case CSS_PROP_FONT_WEIGHT:
 #if APPLE_CHANGES
-                    case CSS_PROP__APPLE_TEXT_SIZE_ADJUST:
+                    case CSS_PROP__KHTML_TEXT_SIZE_ADJUST:
 #endif
                         // these have to be applied first, because other properties use the computed
                         // values of these porperties.
@@ -3772,20 +3772,20 @@ void CSSStyleSelector::applyProperty( int id, DOM::CSSValueImpl *value )
 
 #if APPLE_CHANGES
     // Apple-specific changes.  Do not merge these properties into KHTML.
-    case CSS_PROP__APPLE_LINE_CLAMP: {
+    case CSS_PROP__KHTML_LINE_CLAMP: {
         HANDLE_INHERIT_AND_INITIAL(lineClamp, LineClamp)
         if (!primitiveValue) return;
         style->setLineClamp((int)primitiveValue->getFloatValue(CSSPrimitiveValue::CSS_PERCENTAGE));
         break;
     }
-    case CSS_PROP__APPLE_TEXT_SIZE_ADJUST: {
+    case CSS_PROP__KHTML_TEXT_SIZE_ADJUST: {
         HANDLE_INHERIT_AND_INITIAL(textSizeAdjust, TextSizeAdjust)
         if (!primitiveValue || !primitiveValue->getIdent()) return;
         style->setTextSizeAdjust(primitiveValue->getIdent() == CSS_VAL_AUTO);
         fontDirty = true;
         break;
     }
-    case CSS_PROP__APPLE_DASHBOARD_REGION: {
+    case CSS_PROP__KHTML_DASHBOARD_REGION: {
         HANDLE_INHERIT_AND_INITIAL(dashboardRegions, DashboardRegions)
         if (!primitiveValue)
             return;
index 4dc398a603757afb07d6b4cda6d41a9d9a791034..3791b7e9104af4d1a865ca0fa692165adabc79ba 100644 (file)
@@ -59,6 +59,27 @@ using namespace DOM;
 
 int DOM::getPropertyID(const char *tagStr, int len)
 {
+    if (len && tagStr && tagStr[0] == '-') {
+        QString prop(tagStr);
+        if (prop.startsWith("-apple")) {
+            prop = prop.mid(6);
+            prop.insert(0, "-khtml");
+            tagStr = prop.ascii();
+        }
+        else if (prop.startsWith("-moz")) {
+            prop = prop.mid(4);
+            prop.insert(0, "-khtml");
+            len += 2;
+            tagStr = prop.ascii();
+        }
+        
+        // Honor the use of -khtml-opacity (for Safari 1.1) and also the use of -moz-opacity in Mozilla.
+        if (prop == "-khtml-opacity") {
+            tagStr = "opacity";
+            len = 7;
+        }
+    }
+    
     const struct props *propsPtr = findProp(tagStr, len);
     if (!propsPtr)
         return 0;
@@ -68,6 +89,21 @@ int DOM::getPropertyID(const char *tagStr, int len)
 
 static inline int getValueID(const char *tagStr, int len)
 {
+    if (len && tagStr && tagStr[0] == '-') {
+        QString prop(tagStr);
+        if (prop.startsWith("-apple")) {
+            prop = prop.mid(6);
+            prop.insert(0, "-khtml");
+            tagStr = prop.ascii();
+        }
+        else if (prop.startsWith("-moz")) {
+            prop = prop.mid(4);
+            prop.insert(0, "-khtml");
+            len += 2;
+            tagStr = prop.ascii();
+        }
+    }
+
     const struct css_value *val = findValue(tagStr, len);
     if (!val)
         return 0;
index 320b183d4fcf07ef7d8d97335c2fa44c44128d64..1b15515f165f692e7845781c36c8e00d31f2df9f 100644 (file)
@@ -57,7 +57,7 @@ static QString cssPropertyName(const Identifier &p, bool *hadPixelOrPosPrefix =
         prop = prop.mid(4);
         if (hadPixelOrPosPrefix)
             *hadPixelOrPosPrefix = true;
-    } else if (prop.startsWith("khtml-") || prop.startsWith("apple-")) {
+    } else if (prop.startsWith("khtml-") || prop.startsWith("apple-") || prop.startsWith("moz-")) {
         prop.insert(0, '-');
     }