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
+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
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,
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,
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());
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
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)
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;
#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;
height
left
letter-spacing
--apple-line-clamp
+-khtml-line-clamp
line-height
list-style-image
list-style-position
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
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.
#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;
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;
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;
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, '-');
}