Commit 166f2512 authored by darin@apple.com's avatar darin@apple.com

WebCore:

2008-06-14  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - fix https://bugs.webkit.org/show_bug.cgi?id=19538
          <rdar://problem/5957595> Reading transition property from the style JS gives the wrong value

        Test: fast/dom/CSSStyleDeclaration/transition-property-names.html

        * css/CSSPrimitiveValue.cpp:
        (WebCore::valueOrPropertyName): Added.
        (WebCore::CSSPrimitiveValue::getStringValue): Use valueOrPropertyName since the ident can either
        be a value or property ID.
        (WebCore::CSSPrimitiveValue::cssText): Ditto.

        * css/makeprop.pl: Assign property IDs starting at 1001 instead of 1 so they can be stored along
        with value IDs with no ambiguity.

LayoutTests:

2008-06-14  Darin Adler  <darin@apple.com>

        Reviewed by Maciej.

        - test for https://bugs.webkit.org/show_bug.cgi?id=19538
          <rdar://problem/5957595> Reading transition property from the style JS gives the wrong value

        * fast/dom/CSSStyleDeclaration/resources/transition-property-names.js: Added.
        * fast/dom/CSSStyleDeclaration/transition-property-names-expected.txt: Added.
        * fast/dom/CSSStyleDeclaration/transition-property-names.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34542 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ff10c48f
2008-06-14 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- test for https://bugs.webkit.org/show_bug.cgi?id=19538
<rdar://problem/5957595> Reading transition property from the style JS gives the wrong value
* fast/dom/CSSStyleDeclaration/resources/transition-property-names.js: Added.
* fast/dom/CSSStyleDeclaration/transition-property-names-expected.txt: Added.
* fast/dom/CSSStyleDeclaration/transition-property-names.html: Added.
2008-06-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
Reviewed by Oliver.
description(
'This test checks that CSS property names work round trip in the transition property.'
);
var element = document.createElement('a');
element.style.webkitTransitionProperty = "height";
shouldBe("element.style.webkitTransitionProperty", "'height'");
element.style.webkitTransitionProperty = "opacity";
shouldBe("element.style.webkitTransitionProperty", "'opacity'");
var successfullyParsed = true;
This test checks that CSS property names work round trip in the transition property.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS element.style.webkitTransitionProperty is 'height'
PASS element.style.webkitTransitionProperty is 'opacity'
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../js/resources/js-test-style.css">
<script src="../../js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/transition-property-names.js"></script>
<script src="../../js/resources/js-test-post.js"></script>
</body>
</html>
2008-06-14 Darin Adler <darin@apple.com>
Reviewed by Maciej.
- fix https://bugs.webkit.org/show_bug.cgi?id=19538
<rdar://problem/5957595> Reading transition property from the style JS gives the wrong value
Test: fast/dom/CSSStyleDeclaration/transition-property-names.html
* css/CSSPrimitiveValue.cpp:
(WebCore::valueOrPropertyName): Added.
(WebCore::CSSPrimitiveValue::getStringValue): Use valueOrPropertyName since the ident can either
be a value or property ID.
(WebCore::CSSPrimitiveValue::cssText): Ditto.
* css/makeprop.pl: Assign property IDs starting at 1001 instead of 1 so they can be stored along
with value IDs with no ambiguity.
2008-06-14 Adam Barth <abarth@webkit.org>
Reviewed by David Kilzer.
......@@ -22,6 +22,7 @@
#include "CSSPrimitiveValue.h"
#include "CSSHelper.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "Color.h"
#include "Counter.h"
......@@ -39,6 +40,13 @@ using namespace WTF;
namespace WebCore {
static const char* valueOrPropertyName(int valueOrPropertyID)
{
if (const char* valueName = getValueName(valueOrPropertyID))
return valueName;
return getPropertyName(static_cast<CSSPropertyID>(valueOrPropertyID));
}
// "ident" from the CSS tokenizer, minus backslash-escape sequences
static bool isCSSTokenizerIdentifier(const String& string)
{
......@@ -504,7 +512,7 @@ String CSSPrimitiveValue::getStringValue(ExceptionCode& ec) const
case CSS_URI:
return m_value.string;
case CSS_IDENT:
return getValueName(m_value.ident);
return valueOrPropertyName(m_value.ident);
default:
ec = INVALID_ACCESS_ERR;
break;
......@@ -521,7 +529,7 @@ String CSSPrimitiveValue::getStringValue() const
case CSS_URI:
return m_value.string;
case CSS_IDENT:
return getValueName(m_value.ident);
return valueOrPropertyName(m_value.ident);
default:
break;
}
......@@ -661,7 +669,7 @@ String CSSPrimitiveValue::cssText() const
text = "url(" + quoteURLIfNeeded(m_value.string) + ")";
break;
case CSS_IDENT:
text = getValueName(m_value.ident);
text = valueOrPropertyName(m_value.ident);
break;
case CSS_ATTR:
// FIXME
......
......@@ -3,7 +3,7 @@
# This file is part of the WebKit project
#
# Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
# Copyright (C) 2007 Apple Inc. All rights reserved.
# Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
# Copyright (C) 2007 Trolltech ASA
#
# This library is free software; you can redistribute it and/or
......@@ -65,7 +65,8 @@ enum CSSPropertyID {
CSSPropertyInvalid = 0,
EOF
my $i = 1;
my $first = 1001;
my $i = 1001;
my $maxLen = 0;
foreach my $name (@names) {
my $id = $name;
......@@ -76,9 +77,12 @@ foreach my $name (@names) {
$maxLen = length($name);
}
}
my $num = $i - $first;
print HEADER "};\n\n";
print HEADER "const int numCSSProperties = " . $i . ";\n";
print HEADER "const size_t maxCSSPropertyNameLength = " . $maxLen . ";\n";
print HEADER "const int firstCSSProperty = $first;\n";
print HEADER "const int numCSSProperties = $num;\n";
print HEADER "const size_t maxCSSPropertyNameLength = $maxLen;\n";
print HEADER << "EOF";
......@@ -92,21 +96,22 @@ close HEADER;
system("gperf -a -L ANSI-C -E -C -c -o -t --key-positions=\"*\" -NfindProp -Hhash_prop -Wwordlist_prop -D -s 2 CSSPropertyNames.gperf > CSSPropertyNames.cpp");
open C, ">>CSSPropertyNames.cpp" || die "Could not open CSSPropertyNames.cpp for writing";
print C "static const char * const propertyList[] = {\n";
print C "\"\",\n";
print C "static const char * const propertyNameStrings[$num] = {\n";
foreach my $name (@names) {
print C "\"" . $name . "\", \n";
print C "\"$name\",\n";
}
print C << "EOF";
0
};
const char* getPropertyName(CSSPropertyID id)
{
if (id >= numCSSProperties || id <= 0)
if (id < firstCSSProperty)
return 0;
int index = id - firstCSSProperty;
if (index >= numCSSProperties)
return 0;
return propertyList[id];
return propertyNameStrings[index];
}
EOF
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment