<rdar://problem/9291132> Add support for -epub-prefixed properties
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Apr 2011 23:36:02 +0000 (23:36 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Apr 2011 23:36:02 +0000 (23:36 +0000)
Reviewed by Simon Fraser.

Source/WebCore:

Test: fast/css/epub-properties.html

* bindings/js/JSCSSStyleDeclarationCustom.cpp:
(WebCore::cssPropertyName): Map "epub"-prefixed properties to "-epub"-prefixed ones.
* css/CSSPropertyNames.in: Added -epub- aliases to caption-side, -webkit-hyphens, -webkit-text-combine,
-webkit-text-emphasis, -webkit-text-emphasis-color, -webkit-text-emphasis-style, -webkit-text-orientation,
text-transform, text-transform, word-break, and -webkit-writing-mode.

LayoutTests:

* fast/css/epub-properties-expected.txt: Added.
* fast/css/epub-properties.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/css/epub-properties-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/epub-properties.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
Source/WebCore/css/CSSPropertyNames.in

index 606d60e..6253d1e 100644 (file)
@@ -1,3 +1,12 @@
+2011-04-28  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Simon Fraser.
+
+        <rdar://problem/9291132> Add support for -epub-prefixed properties
+
+        * fast/css/epub-properties-expected.txt: Added.
+        * fast/css/epub-properties.html: Added.
+
 2011-04-28  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Eric Seidel.
diff --git a/LayoutTests/fast/css/epub-properties-expected.txt b/LayoutTests/fast/css/epub-properties-expected.txt
new file mode 100644 (file)
index 0000000..7b1eba4
--- /dev/null
@@ -0,0 +1,10 @@
+PASS: -epub-caption-side is an alias for caption-side
+PASS: -epub-hyphens is an alias for -webkit-hyphens
+PASS: -epub-text-combine is an alias for -webkit-text-combine
+PASS: -epub-text-emphasis-style is an alias for -webkit-text-emphasis-style
+PASS: -epub-text-emphasis-color is an alias for -webkit-text-emphasis-color
+PASS: -epub-text-orientation is an alias for -webkit-text-orientation
+PASS: -epub-text-transform is an alias for text-transform
+PASS: -epub-word-break is an alias for word-break
+PASS: -epub-writing-mode is an alias for -webkit-writing-mode
+
diff --git a/LayoutTests/fast/css/epub-properties.html b/LayoutTests/fast/css/epub-properties.html
new file mode 100644 (file)
index 0000000..a1cb15a
--- /dev/null
@@ -0,0 +1,40 @@
+<pre id="console"></pre>
+<script>
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+
+    function log(message)
+    {
+        document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
+    }
+
+    function testEpubProperty(name, alias, jsName, jsAlias, value)
+    {
+        var pass = true;
+        var element = document.createElement("div");
+        element.setAttribute("style", name + ": " + value);
+        if (eval("element.style." + jsAlias) !== value) {
+            log("FAIL: element.style." + jsAlias + " is not '" + value + "' after setting style to " + element.getAttribute("style") + ".");
+            pass = false;
+        }
+
+        element.setAttribute("style", alias + ":" + value);
+        if (eval("element.style." + jsName) !== value) {
+            log("FAIL: element.style." + jsName + " is not '" + value + "' after setting style to " + element.getAttribute("style") + ".");
+            pass = false;
+        }
+
+        if (pass)
+            log("PASS: " + alias + " is an alias for " + name);
+    }
+
+    testEpubProperty("caption-side", "-epub-caption-side", "captionSide", "epubCaptionSide", "bottom");
+    testEpubProperty("-webkit-hyphens", "-epub-hyphens", "webkitHyphens", "epubHyphens", "manual");
+    testEpubProperty("-webkit-text-combine", "-epub-text-combine", "webkitTextCombine", "epubTextCombine", "horizontal");
+    testEpubProperty("-webkit-text-emphasis-style", "-epub-text-emphasis-style", "webkitTextEmphasisStyle", "epubTextEmphasisStyle", "open sesame");
+    testEpubProperty("-webkit-text-emphasis-color", "-epub-text-emphasis-color", "webkitTextEmphasisColor", "epubTextEmphasisColor", "red");
+    testEpubProperty("-webkit-text-orientation", "-epub-text-orientation", "webkitTextOrientation", "epubTextOrientation", "upright");
+    testEpubProperty("text-transform", "-epub-text-transform", "textTransform", "epubTextTransform", "uppercase");
+    testEpubProperty("word-break", "-epub-word-break", "wordBreak", "epubWordBreak", "break-all");
+    testEpubProperty("-webkit-writing-mode", "-epub-writing-mode", "webkitWritingMode", "epubWritingMode", "vertical-rl");
+</script>
index 553f749..f39af83 100644 (file)
@@ -1,3 +1,17 @@
+2011-04-28  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Simon Fraser.
+
+        <rdar://problem/9291132> Add support for -epub-prefixed properties
+
+        Test: fast/css/epub-properties.html
+
+        * bindings/js/JSCSSStyleDeclarationCustom.cpp:
+        (WebCore::cssPropertyName): Map "epub"-prefixed properties to "-epub"-prefixed ones.
+        * css/CSSPropertyNames.in: Added -epub- aliases to caption-side, -webkit-hyphens, -webkit-text-combine,
+        -webkit-text-emphasis, -webkit-text-emphasis-color, -webkit-text-emphasis-style, -webkit-text-orientation,
+        text-transform, text-transform, word-break, and -webkit-writing-mode.
+
 2011-04-28  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Eric Seidel.
index 6c9182e..84b59db 100644 (file)
@@ -103,7 +103,8 @@ static String cssPropertyName(const Identifier& propertyName, bool* hadPixelOrPo
             *hadPixelOrPosPrefix = true;
     } else if (hasCSSPropertyNamePrefix(propertyName, "webkit")
             || hasCSSPropertyNamePrefix(propertyName, "khtml")
-            || hasCSSPropertyNamePrefix(propertyName, "apple"))
+            || hasCSSPropertyNamePrefix(propertyName, "apple")
+            || hasCSSPropertyNamePrefix(propertyName, "epub"))
         builder.append('-');
     else {
         if (isASCIIUpper(propertyName.characters()[0]))
index 8da3cf8..ea54c12 100644 (file)
@@ -22,8 +22,10 @@ font-weight
 text-rendering
 -webkit-font-smoothing
 -webkit-text-orientation
+-epub-text-orientation = -webkit-text-orientation
 -webkit-text-size-adjust
 -webkit-writing-mode
+-epub-writing-mode = -webkit-writing-mode
 zoom
 
 # line height needs to be right after the above high-priority properties
@@ -80,6 +82,7 @@ box-sizing
 # -webkit-box-sizing worked in Safari 4 and earlier.
 -webkit-box-sizing = box-sizing
 caption-side
+-epub-caption-side = caption-side
 clear
 clip
 content
@@ -152,6 +155,7 @@ text-overline-style
 text-overline-width
 text-shadow
 text-transform
+-epub-text-transform = text-transform
 text-underline
 text-underline-color
 text-underline-mode
@@ -166,6 +170,7 @@ white-space
 widows
 width
 word-break
+-epub-word-break = word-break
 word-spacing
 word-wrap
 z-index
@@ -240,6 +245,7 @@ z-index
 -webkit-hyphenate-limit-after
 -webkit-hyphenate-limit-before
 -webkit-hyphens
+-epub-hyphens = -webkit-hyphens
 -webkit-line-box-contain
 -webkit-line-break
 -webkit-line-clamp
@@ -291,11 +297,15 @@ z-index
 -webkit-perspective-origin-y
 -webkit-rtl-ordering
 -webkit-text-combine
+-epub-text-combine = -webkit-text-combine
 -webkit-text-decorations-in-effect
 -webkit-text-emphasis
+-epub-text-emphasis = -webkit-text-emphasis
 -webkit-text-emphasis-color
+-epub-text-emphasis-color = -webkit-text-emphasis-color
 -webkit-text-emphasis-position
 -webkit-text-emphasis-style
+-epub-text-emphasis-style = -webkit-text-emphasis-style
 -webkit-text-fill-color
 -webkit-text-security
 -webkit-text-stroke