[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

hyatt at apple.com hyatt at apple.com
Wed Dec 22 13:34:55 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit cdb931e2e3067ca3a40b0d03b32eaba3a98f54d0
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 20 21:03:16 2010 +0000

    https://bugs.webkit.org/show_bug.cgi?id=46116, implement block-flow-aware logical properties.
    
    Reviewed by Dan Bernstein.
    
    This patch adds all the logical properties from the CSS3 Writing Mode draft for margins, padding, border,
    width and height.
    
    Added fast/css/logical-property-resolution.html
    
    WebCore:
    
    * css/CSSComputedStyleDeclaration.cpp:
    (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
    * css/CSSParser.cpp:
    (WebCore::CSSParser::parseValue):
    * css/CSSProperty.cpp:
    (WebCore::resolveToPhysicalProperty):
    (WebCore::CSSProperty::resolveDirectionAwareProperty):
    * css/CSSProperty.h:
    * css/CSSPropertyNames.in:
    * css/CSSStyleSelector.cpp:
    (WebCore::CSSStyleSelector::applyDeclarations):
    (WebCore::CSSStyleSelector::applyProperty):
    
    LayoutTests:
    
    * fast/css/logical-property-resolution-expected.txt: Added.
    * fast/css/logical-property-resolution.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67882 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 6af2834..e109a15 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,17 @@
+2010-09-20  David Hyatt  <hyatt at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=46116, implement block-flow-aware logical properties.
+        
+        This patch adds all the logical properties from the CSS3 Writing Mode draft for margins, padding, border,
+        width and height.
+
+        Added fast/css/logical-property-resolution.html
+
+        * fast/css/logical-property-resolution-expected.txt: Added.
+        * fast/css/logical-property-resolution.html: Added.
+
 2010-09-20  James Robinson  <jamesr at chromium.org>
 
         Fix mis-merge of chromium mac expectations.
diff --git a/LayoutTests/fast/css/logical-property-resolution-expected.txt b/LayoutTests/fast/css/logical-property-resolution-expected.txt
new file mode 100644
index 0000000..c7945c3
--- /dev/null
+++ b/LayoutTests/fast/css/logical-property-resolution-expected.txt
@@ -0,0 +1,49 @@
+Block #1:
+Margins: 1px 2px 3px 4px
+Padding: 4px 3px 2px 1px
+Borders: 1px solid rgb(0, 0, 0), 2px dotted rgb(0, 128, 0), 3px dashed rgb(255, 255, 0), 4px double rgb(128, 0, 128)
+Width: 100px
+Height: 50px
+Block #2:
+Margins: 3px 2px 1px 4px
+Padding: 2px 3px 4px 1px
+Borders: 3px dashed rgb(255, 255, 0), 2px dotted rgb(0, 128, 0), 1px solid rgb(0, 0, 0), 4px double rgb(128, 0, 128)
+Width: 100px
+Height: 50px
+Block #3:
+Margins: 4px 3px 2px 1px
+Padding: 1px 2px 3px 4px
+Borders: 4px double rgb(128, 0, 128), 3px dashed rgb(255, 255, 0), 2px dotted rgb(0, 128, 0), 1px solid rgb(0, 0, 0)
+Width: 50px
+Height: 100px
+Block #4:
+Margins: 4px 1px 2px 3px
+Padding: 1px 4px 3px 2px
+Borders: 4px double rgb(128, 0, 128), 1px solid rgb(0, 0, 0), 2px dotted rgb(0, 128, 0), 3px dashed rgb(255, 255, 0)
+Width: 50px
+Height: 100px
+Block #5:
+Margins: 1px 4px 3px 2px
+Padding: 4px 1px 2px 3px
+Borders: 1px solid rgb(0, 0, 0), 4px double rgb(128, 0, 128), 3px dashed rgb(255, 255, 0), 2px dotted rgb(0, 128, 0)
+Width: 100px
+Height: 50px
+Block #6:
+Margins: 3px 4px 1px 2px
+Padding: 2px 1px 4px 3px
+Borders: 3px dashed rgb(255, 255, 0), 4px double rgb(128, 0, 128), 1px solid rgb(0, 0, 0), 2px dotted rgb(0, 128, 0)
+Width: 100px
+Height: 50px
+Block #7:
+Margins: 2px 3px 4px 1px
+Padding: 3px 2px 1px 4px
+Borders: 2px dotted rgb(0, 128, 0), 3px dashed rgb(255, 255, 0), 4px double rgb(128, 0, 128), 1px solid rgb(0, 0, 0)
+Width: 50px
+Height: 100px
+Block #8:
+Margins: 2px 1px 4px 3px
+Padding: 3px 4px 1px 2px
+Borders: 2px dotted rgb(0, 128, 0), 1px solid rgb(0, 0, 0), 4px double rgb(128, 0, 128), 3px dashed rgb(255, 255, 0)
+Width: 50px
+Height: 100px
+
diff --git a/LayoutTests/fast/css/logical-property-resolution.html b/LayoutTests/fast/css/logical-property-resolution.html
new file mode 100644
index 0000000..091d320
--- /dev/null
+++ b/LayoutTests/fast/css/logical-property-resolution.html
@@ -0,0 +1,99 @@
+<html>
+<head>
+<style>
+.ltr-text {
+  direction: ltr
+}
+
+.rtl-text {
+  direction: rtl
+}
+
+.tb-block {
+  -webkit-block-flow: tb
+}
+
+.bt-block {
+  -webkit-block-flow: bt
+}
+
+.lr-block {
+  -webkit-block-flow: lr
+}
+
+.rl-block {
+  -webkit-block-flow: rl
+}
+
+.test {
+  -webkit-margin-before: 1px;
+  -webkit-margin-end: 2px;
+  -webkit-margin-after: 3px;
+  -webkit-margin-start: 4px;
+  -webkit-padding-before:4px;
+  -webkit-padding-end:3px;
+  -webkit-padding-after:2px;
+  -webkit-padding-start:1px;
+  -webkit-logical-width:100px;
+  -webkit-logical-height:50px;
+  -webkit-border-before: 1px solid black;
+  -webkit-border-end: 2px dotted green;
+  -webkit-border-after: 3px dashed yellow;
+  -webkit-border-start: 4px double purple;
+  float:left;
+}
+</style>
+<script>
+if (window.layoutTestController)
+  window.layoutTestController.dumpAsText()
+  
+function dumpBlockProperties()
+{
+   result = document.getElementById('result');
+   blocks = document.getElementsByTagName('div');
+   resultStr = "";
+   for (i = 0; i < blocks.length; ++i) {
+        resultStr += "<b>Block #" + (i+1) + ":</b><br>";
+        resultStr += "Margins: ";
+        c = getComputedStyle(blocks[i], null);
+        resultStr += c.getPropertyValue("margin-top") + " "
+                     + c.getPropertyValue("margin-right") + " "
+                     + c.getPropertyValue("margin-bottom") + " "
+                     + c.getPropertyValue("margin-left") + "<br>";
+                     
+        resultStr += "Padding: ";
+        c = getComputedStyle(blocks[i], null);
+        resultStr += c.getPropertyValue("padding-top") + " "
+                     + c.getPropertyValue("padding-right") + " "
+                     + c.getPropertyValue("padding-bottom") + " "
+                     + c.getPropertyValue("padding-left") + "<br>";
+        
+        resultStr += "Borders: "
+        resultStr += c.getPropertyValue("border-top-width") + " " + c.getPropertyValue("border-top-style") + " " + c.getPropertyValue("border-top-color") + ", "
+                     + c.getPropertyValue("border-right-width") + " " + c.getPropertyValue("border-right-style") + " " + c.getPropertyValue("border-right-color") + ", "
+                     + c.getPropertyValue("border-bottom-width") + " " + c.getPropertyValue("border-bottom-style") + " " + c.getPropertyValue("border-bottom-color") + ", "
+                     + c.getPropertyValue("border-left-width") + " " + c.getPropertyValue("border-left-style") + " " + c.getPropertyValue("border-left-color") + "<br>"
+                     
+        resultStr += "Width: "
+        resultStr += c.getPropertyValue("width") + "<br>";
+        
+        resultStr += "Height: "
+        resultStr += c.getPropertyValue("height") + "<br>";
+   }
+   result.innerHTML = resultStr;
+}
+</script>
+</head>
+<body onload="dumpBlockProperties()">
+<div class="ltr-text tb-block test"></div>
+<div class="ltr-text bt-block test"></div>
+<div class="ltr-text lr-block test"></div>
+<div class="ltr-text rl-block test"></div>
+<div class="rtl-text tb-block test"></div>
+<div class="rtl-text bt-block test"></div>
+<div class="rtl-text lr-block test"></div>
+<div class="rtl-text rl-block test"></div>
+<p style="clear:both" id="result"></p>
+</body>
+</html>
+
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0d4b79d..11a6b6d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,5 +1,29 @@
 2010-09-20  David Hyatt  <hyatt at apple.com>
 
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=46116, implement block-flow-aware logical properties.
+        
+        This patch adds all the logical properties from the CSS3 Writing Mode draft for margins, padding, border,
+        width and height.
+
+        Added fast/css/logical-property-resolution.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseValue):
+        * css/CSSProperty.cpp:
+        (WebCore::resolveToPhysicalProperty):
+        (WebCore::CSSProperty::resolveDirectionAwareProperty):
+        * css/CSSProperty.h:
+        * css/CSSPropertyNames.in:
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::applyDeclarations):
+        (WebCore::CSSStyleSelector::applyProperty):
+
+2010-09-20  David Hyatt  <hyatt at apple.com>
+
         Reviewed by Beth Dakin.
 
         https://bugs.webkit.org/show_bug.cgi?id=46114, two tables repaint tests failing on bots.
diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp
index e4a4186..1333239 100644
--- a/WebCore/css/CSSComputedStyleDeclaration.cpp
+++ b/WebCore/css/CSSComputedStyleDeclaration.cpp
@@ -733,7 +733,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
     if (!style)
         return 0;
 
-    propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style->direction());
+    propertyID = CSSProperty::resolveDirectionAwareProperty(propertyID, style->direction(), style->blockFlow());
 
     switch (static_cast<CSSPropertyID>(propertyID)) {
         case CSSPropertyInvalid:
@@ -1504,10 +1504,28 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
         case CSSPropertyWebkitBorderStartColor:
         case CSSPropertyWebkitBorderStartStyle:
         case CSSPropertyWebkitBorderStartWidth:
+        case CSSPropertyWebkitBorderAfter:
+        case CSSPropertyWebkitBorderAfterColor:
+        case CSSPropertyWebkitBorderAfterStyle:
+        case CSSPropertyWebkitBorderAfterWidth:
+        case CSSPropertyWebkitBorderBefore:
+        case CSSPropertyWebkitBorderBeforeColor:
+        case CSSPropertyWebkitBorderBeforeStyle:
+        case CSSPropertyWebkitBorderBeforeWidth:
         case CSSPropertyWebkitMarginEnd:
         case CSSPropertyWebkitMarginStart:
+        case CSSPropertyWebkitMarginAfter:
+        case CSSPropertyWebkitMarginBefore:
         case CSSPropertyWebkitPaddingEnd:
         case CSSPropertyWebkitPaddingStart:
+        case CSSPropertyWebkitPaddingAfter:
+        case CSSPropertyWebkitPaddingBefore:
+        case CSSPropertyWebkitLogicalWidth:
+        case CSSPropertyWebkitLogicalHeight:
+        case CSSPropertyWebkitMinLogicalWidth:
+        case CSSPropertyWebkitMinLogicalHeight:
+        case CSSPropertyWebkitMaxLogicalWidth:
+        case CSSPropertyWebkitMaxLogicalHeight:
             ASSERT_NOT_REACHED();
             break;
 
diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
index 11e8e6e..86bcd0d 100644
--- a/WebCore/css/CSSParser.cpp
+++ b/WebCore/css/CSSParser.cpp
@@ -776,6 +776,8 @@ bool CSSParser::parseValue(int propId, bool important)
     case CSSPropertyBorderLeftStyle:
     case CSSPropertyWebkitBorderStartStyle:
     case CSSPropertyWebkitBorderEndStyle:
+    case CSSPropertyWebkitBorderBeforeStyle:
+    case CSSPropertyWebkitBorderAfterStyle:
     case CSSPropertyWebkitColumnRuleStyle:
         if (id >= CSSValueNone && id <= CSSValueDouble)
             validPrimitive = true;
@@ -822,6 +824,8 @@ bool CSSParser::parseValue(int propId, bool important)
     case CSSPropertyBorderLeftColor:
     case CSSPropertyWebkitBorderStartColor:
     case CSSPropertyWebkitBorderEndColor:
+    case CSSPropertyWebkitBorderBeforeColor:
+    case CSSPropertyWebkitBorderAfterColor:
     case CSSPropertyColor: // <color> | inherit
     case CSSPropertyTextLineThroughColor: // CSS3 text decoration colors
     case CSSPropertyTextUnderlineColor:
@@ -973,6 +977,8 @@ bool CSSParser::parseValue(int propId, bool important)
     case CSSPropertyBorderLeftWidth:
     case CSSPropertyWebkitBorderStartWidth:
     case CSSPropertyWebkitBorderEndWidth:
+    case CSSPropertyWebkitBorderBeforeWidth:
+    case CSSPropertyWebkitBorderAfterWidth:
     case CSSPropertyWebkitColumnRuleWidth:
         if (id == CSSValueThin || id == CSSValueMedium || id == CSSValueThick)
             validPrimitive = true;
@@ -1008,11 +1014,15 @@ bool CSSParser::parseValue(int propId, bool important)
     case CSSPropertyPaddingLeft:         ////
     case CSSPropertyWebkitPaddingStart:
     case CSSPropertyWebkitPaddingEnd:
+    case CSSPropertyWebkitPaddingBefore:
+    case CSSPropertyWebkitPaddingAfter:
         validPrimitive = (!id && validUnit(value, FLength | FPercent | FNonNeg, m_strict));
         break;
 
     case CSSPropertyMaxHeight:           // <length> | <percentage> | none | inherit
     case CSSPropertyMaxWidth:            // <length> | <percentage> | none | inherit
+    case CSSPropertyWebkitMaxLogicalWidth:
+    case CSSPropertyWebkitMaxLogicalHeight:
         if (id == CSSValueNone || id == CSSValueIntrinsic || id == CSSValueMinIntrinsic) {
             validPrimitive = true;
             break;
@@ -1020,6 +1030,8 @@ bool CSSParser::parseValue(int propId, bool important)
         /* nobreak */
     case CSSPropertyMinHeight:           // <length> | <percentage> | inherit
     case CSSPropertyMinWidth:            // <length> | <percentage> | inherit
+    case CSSPropertyWebkitMinLogicalWidth:
+    case CSSPropertyWebkitMinLogicalHeight:
         if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic)
             validPrimitive = true;
         else
@@ -1052,6 +1064,8 @@ bool CSSParser::parseValue(int propId, bool important)
 
     case CSSPropertyHeight:               // <length> | <percentage> | auto | inherit
     case CSSPropertyWidth:                // <length> | <percentage> | auto | inherit
+    case CSSPropertyWebkitLogicalWidth:  
+    case CSSPropertyWebkitLogicalHeight:
         if (id == CSSValueAuto || id == CSSValueIntrinsic || id == CSSValueMinIntrinsic)
             validPrimitive = true;
         else
@@ -1069,6 +1083,8 @@ bool CSSParser::parseValue(int propId, bool important)
     case CSSPropertyMarginLeft:          ////
     case CSSPropertyWebkitMarginStart:
     case CSSPropertyWebkitMarginEnd:
+    case CSSPropertyWebkitMarginBefore:
+    case CSSPropertyWebkitMarginAfter:
         if (id == CSSValueAuto)
             validPrimitive = true;
         else
@@ -1638,19 +1654,29 @@ bool CSSParser::parseValue(int propId, bool important)
         return parseShorthand(propId, properties, 3, important);
     }
     case CSSPropertyWebkitBorderStart:
-        // [ '-webkit-border-start-width' || 'border-style' || <color> ] | inherit
     {
         const int properties[3] = { CSSPropertyWebkitBorderStartWidth, CSSPropertyWebkitBorderStartStyle,
             CSSPropertyWebkitBorderStartColor };
         return parseShorthand(propId, properties, 3, important);
     }
     case CSSPropertyWebkitBorderEnd:
-        // [ '-webkit-border-end-width' || 'border-style' || <color> ] | inherit
     {
         const int properties[3] = { CSSPropertyWebkitBorderEndWidth, CSSPropertyWebkitBorderEndStyle,
             CSSPropertyWebkitBorderEndColor };
         return parseShorthand(propId, properties, 3, important);
     }
+    case CSSPropertyWebkitBorderBefore:
+    {
+        const int properties[3] = { CSSPropertyWebkitBorderBeforeWidth, CSSPropertyWebkitBorderBeforeStyle,
+            CSSPropertyWebkitBorderBeforeColor };
+        return parseShorthand(propId, properties, 3, important);
+    }
+    case CSSPropertyWebkitBorderAfter:
+    {
+        const int properties[3] = { CSSPropertyWebkitBorderAfterWidth, CSSPropertyWebkitBorderAfterStyle,
+            CSSPropertyWebkitBorderAfterColor };
+        return parseShorthand(propId, properties, 3, important);
+    }
     case CSSPropertyOutline:
         // [ 'outline-color' || 'outline-style' || 'outline-width' ] | inherit
     {
diff --git a/WebCore/css/CSSProperty.cpp b/WebCore/css/CSSProperty.cpp
index 453b381..7779aad 100644
--- a/WebCore/css/CSSProperty.cpp
+++ b/WebCore/css/CSSProperty.cpp
@@ -23,6 +23,7 @@
 
 #include "CSSPropertyNames.h"
 #include "PlatformString.h"
+#include "RenderStyleConstants.h"
 
 namespace WebCore {
 
@@ -38,37 +39,246 @@ bool operator==(const CSSProperty& a, const CSSProperty& b)
     return a.m_id == b.m_id && a.m_important == b.m_important && a.m_value == b.m_value;
 }
 
-int CSSProperty::resolveDirectionAwareProperty(int propertyID, TextDirection direction)
-{
-    switch (static_cast<CSSPropertyID>(propertyID)) {
-    case CSSPropertyWebkitMarginEnd:
-        return direction == LTR ? CSSPropertyMarginRight : CSSPropertyMarginLeft;
-    case CSSPropertyWebkitMarginStart:
-        return direction == LTR ? CSSPropertyMarginLeft : CSSPropertyMarginRight;
+enum LogicalBoxSide { BeforeSide, EndSide, AfterSide, StartSide };
+enum PhysicalBoxSide { TopSide, RightSide, BottomSide, LeftSide };
 
-    case CSSPropertyWebkitPaddingEnd:
-        return direction == LTR ? CSSPropertyPaddingRight : CSSPropertyPaddingLeft;
-    case CSSPropertyWebkitPaddingStart:
-        return direction == LTR ? CSSPropertyPaddingLeft : CSSPropertyPaddingRight;
+static int resolveToPhysicalProperty(TextDirection direction, EBlockFlowDirection blockDirection, LogicalBoxSide logicalSide, const int* properties)
+{
+    if (direction == LTR) {
+        if (blockDirection == TopToBottomBlockFlow) {
+            // The common case. The logical and physical box sides match.
+            // Left = Start, Right = End, Before = Top, After = Bottom
+            return properties[logicalSide];
+        }
+        
+        if (blockDirection == BottomToTopBlockFlow) {
+            // Start = Left, End = Right, Before = Bottom, After = Top.
+            switch (logicalSide) {
+            case StartSide:
+                return properties[LeftSide];
+            case EndSide:
+                return properties[RightSide];
+            case BeforeSide:
+                return properties[BottomSide];
+            default:
+                return properties[TopSide];
+            }
+        }
+        
+        if (blockDirection == LeftToRightBlockFlow) {
+            // Start = Top, End = Bottom, Before = Left, After = Right.
+            switch (logicalSide) {
+            case StartSide:
+                return properties[TopSide];
+            case EndSide:
+                return properties[BottomSide];
+            case BeforeSide:
+                return properties[LeftSide];
+            default:
+                return properties[RightSide];
+            }
+        }
+        
+        // Start = Top, End = Bottom, Before = Right, After = Left
+        switch (logicalSide) {
+        case StartSide:
+            return properties[TopSide];
+        case EndSide:
+            return properties[BottomSide];
+        case BeforeSide:
+            return properties[RightSide];
+        default:
+            return properties[LeftSide];
+        }
+    }
 
-    case CSSPropertyWebkitBorderEnd:
-        return direction == LTR ? CSSPropertyBorderRight : CSSPropertyBorderLeft;
-    case CSSPropertyWebkitBorderEndColor:
-        return direction == LTR ? CSSPropertyBorderRightColor : CSSPropertyBorderLeftColor;
-    case CSSPropertyWebkitBorderEndStyle:
-        return direction == LTR ? CSSPropertyBorderRightStyle : CSSPropertyBorderLeftStyle;
-    case CSSPropertyWebkitBorderEndWidth:
-        return direction == LTR ? CSSPropertyBorderRightWidth : CSSPropertyBorderLeftWidth;
+    if (blockDirection == TopToBottomBlockFlow) {
+        // Start = Right, End = Left, Before = Top, After = Bottom
+        switch (logicalSide) {
+        case StartSide:
+            return properties[RightSide];
+        case EndSide:
+            return properties[LeftSide];
+        case BeforeSide:
+            return properties[TopSide];
+        default:
+            return properties[BottomSide];
+        }
+    }
+    
+    if (blockDirection == BottomToTopBlockFlow) {
+        // Start = Right, End = Left, Before = Bottom, After = Top
+        switch (logicalSide) {
+        case StartSide:
+            return properties[RightSide];
+        case EndSide:
+            return properties[LeftSide];
+        case BeforeSide:
+            return properties[BottomSide];
+        default:
+            return properties[TopSide];
+        }
+    }
+    
+    if (blockDirection == LeftToRightBlockFlow) {
+        // Start = Bottom, End = Top, Before = Left, After = Right
+        switch (logicalSide) {
+        case StartSide:
+            return properties[BottomSide];
+        case EndSide:
+            return properties[TopSide];
+        case BeforeSide:
+            return properties[LeftSide];
+        default:
+            return properties[RightSide];
+        }
+    }
+    
+    // Start = Bottom, End = Top, Before = Right, After = Left
+    switch (logicalSide) {
+    case StartSide:
+        return properties[BottomSide];
+    case EndSide:
+        return properties[TopSide];
+    case BeforeSide:
+        return properties[RightSide];
+    default:
+        return properties[LeftSide];
+    }
+}
 
-    case CSSPropertyWebkitBorderStart:
-        return direction == LTR ? CSSPropertyBorderLeft : CSSPropertyBorderRight;
-    case CSSPropertyWebkitBorderStartColor:
-        return direction == LTR ? CSSPropertyBorderLeftColor : CSSPropertyBorderRightColor;
-    case CSSPropertyWebkitBorderStartStyle:
-        return direction == LTR ? CSSPropertyBorderLeftStyle : CSSPropertyBorderRightStyle;
-    case CSSPropertyWebkitBorderStartWidth:
-        return direction == LTR ? CSSPropertyBorderLeftWidth : CSSPropertyBorderRightWidth;
+enum LogicalExtent { LogicalWidth, LogicalHeight };
 
+static int resolveToPhysicalProperty(EBlockFlowDirection blockDirection, LogicalExtent logicalSide, const int* properties)
+{
+    if (blockDirection == TopToBottomBlockFlow || blockDirection == BottomToTopBlockFlow)
+        return properties[logicalSide];
+    return logicalSide == LogicalWidth ? properties[1] : properties[0];
+}
+        
+int CSSProperty::resolveDirectionAwareProperty(int propertyID, TextDirection direction, EBlockFlowDirection blockDirection)
+{
+    switch (static_cast<CSSPropertyID>(propertyID)) {
+    case CSSPropertyWebkitMarginEnd: {
+        const int properties[4] = { CSSPropertyMarginTop, CSSPropertyMarginRight, CSSPropertyMarginBottom, CSSPropertyMarginLeft };
+        return resolveToPhysicalProperty(direction, blockDirection, EndSide, properties);
+    }
+    case CSSPropertyWebkitMarginStart: {
+        const int properties[4] = { CSSPropertyMarginTop, CSSPropertyMarginRight, CSSPropertyMarginBottom, CSSPropertyMarginLeft };
+        return resolveToPhysicalProperty(direction, blockDirection, StartSide, properties);
+    }
+    case CSSPropertyWebkitMarginBefore: {
+        const int properties[4] = { CSSPropertyMarginTop, CSSPropertyMarginRight, CSSPropertyMarginBottom, CSSPropertyMarginLeft };
+        return resolveToPhysicalProperty(direction, blockDirection, BeforeSide, properties);
+    }
+    case CSSPropertyWebkitMarginAfter: {
+        const int properties[4] = { CSSPropertyMarginTop, CSSPropertyMarginRight, CSSPropertyMarginBottom, CSSPropertyMarginLeft };
+        return resolveToPhysicalProperty(direction, blockDirection, AfterSide, properties);
+    }
+    case CSSPropertyWebkitPaddingEnd: {
+        const int properties[4] = { CSSPropertyPaddingTop, CSSPropertyPaddingRight, CSSPropertyPaddingBottom, CSSPropertyPaddingLeft };
+        return resolveToPhysicalProperty(direction, blockDirection, EndSide, properties);
+    }
+    case CSSPropertyWebkitPaddingStart: {
+        const int properties[4] = { CSSPropertyPaddingTop, CSSPropertyPaddingRight, CSSPropertyPaddingBottom, CSSPropertyPaddingLeft };
+        return resolveToPhysicalProperty(direction, blockDirection, StartSide, properties);
+    }
+    case CSSPropertyWebkitPaddingBefore: {
+        const int properties[4] = { CSSPropertyPaddingTop, CSSPropertyPaddingRight, CSSPropertyPaddingBottom, CSSPropertyPaddingLeft };
+        return resolveToPhysicalProperty(direction, blockDirection, BeforeSide, properties);
+    }
+    case CSSPropertyWebkitPaddingAfter: {
+        const int properties[4] = { CSSPropertyPaddingTop, CSSPropertyPaddingRight, CSSPropertyPaddingBottom, CSSPropertyPaddingLeft };
+        return resolveToPhysicalProperty(direction, blockDirection, AfterSide, properties);
+    }
+    case CSSPropertyWebkitBorderEnd: {
+        const int properties[4] = { CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft };
+        return resolveToPhysicalProperty(direction, blockDirection, EndSide, properties);
+    }
+    case CSSPropertyWebkitBorderStart: {
+        const int properties[4] = { CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft };
+        return resolveToPhysicalProperty(direction, blockDirection, StartSide, properties);
+    }
+    case CSSPropertyWebkitBorderBefore: {
+        const int properties[4] = { CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft };
+        return resolveToPhysicalProperty(direction, blockDirection, BeforeSide, properties);
+    }
+    case CSSPropertyWebkitBorderAfter: {
+        const int properties[4] = { CSSPropertyBorderTop, CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft };
+        return resolveToPhysicalProperty(direction, blockDirection, AfterSide, properties);
+    }
+    case CSSPropertyWebkitBorderEndColor: {
+        const int properties[4] = { CSSPropertyBorderTopColor, CSSPropertyBorderRightColor, CSSPropertyBorderBottomColor, CSSPropertyBorderLeftColor };
+        return resolveToPhysicalProperty(direction, blockDirection, EndSide, properties);
+    }
+    case CSSPropertyWebkitBorderStartColor: {
+        const int properties[4] = { CSSPropertyBorderTopColor, CSSPropertyBorderRightColor, CSSPropertyBorderBottomColor, CSSPropertyBorderLeftColor };
+        return resolveToPhysicalProperty(direction, blockDirection, StartSide, properties);
+    }
+    case CSSPropertyWebkitBorderBeforeColor: {
+        const int properties[4] = { CSSPropertyBorderTopColor, CSSPropertyBorderRightColor, CSSPropertyBorderBottomColor, CSSPropertyBorderLeftColor };
+        return resolveToPhysicalProperty(direction, blockDirection, BeforeSide, properties);
+    }
+    case CSSPropertyWebkitBorderAfterColor: {
+        const int properties[4] = { CSSPropertyBorderTopColor, CSSPropertyBorderRightColor, CSSPropertyBorderBottomColor, CSSPropertyBorderLeftColor };
+        return resolveToPhysicalProperty(direction, blockDirection, AfterSide, properties);
+    }
+    case CSSPropertyWebkitBorderEndStyle: {
+        const int properties[4] = { CSSPropertyBorderTopStyle, CSSPropertyBorderRightStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle };
+        return resolveToPhysicalProperty(direction, blockDirection, EndSide, properties);
+    }
+    case CSSPropertyWebkitBorderStartStyle: {
+        const int properties[4] = { CSSPropertyBorderTopStyle, CSSPropertyBorderRightStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle };
+        return resolveToPhysicalProperty(direction, blockDirection, StartSide, properties);
+    }
+    case CSSPropertyWebkitBorderBeforeStyle: {
+        const int properties[4] = { CSSPropertyBorderTopStyle, CSSPropertyBorderRightStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle };
+        return resolveToPhysicalProperty(direction, blockDirection, BeforeSide, properties);
+    }
+    case CSSPropertyWebkitBorderAfterStyle: {
+        const int properties[4] = { CSSPropertyBorderTopStyle, CSSPropertyBorderRightStyle, CSSPropertyBorderBottomStyle, CSSPropertyBorderLeftStyle };
+        return resolveToPhysicalProperty(direction, blockDirection, AfterSide, properties);
+    }
+    case CSSPropertyWebkitBorderEndWidth: {
+        const int properties[4] = { CSSPropertyBorderTopWidth, CSSPropertyBorderRightWidth, CSSPropertyBorderBottomWidth, CSSPropertyBorderLeftWidth };
+        return resolveToPhysicalProperty(direction, blockDirection, EndSide, properties);
+    }
+    case CSSPropertyWebkitBorderStartWidth: {
+        const int properties[4] = { CSSPropertyBorderTopWidth, CSSPropertyBorderRightWidth, CSSPropertyBorderBottomWidth, CSSPropertyBorderLeftWidth };
+        return resolveToPhysicalProperty(direction, blockDirection, StartSide, properties);
+    }
+    case CSSPropertyWebkitBorderBeforeWidth: {
+        const int properties[4] = { CSSPropertyBorderTopWidth, CSSPropertyBorderRightWidth, CSSPropertyBorderBottomWidth, CSSPropertyBorderLeftWidth };
+        return resolveToPhysicalProperty(direction, blockDirection, BeforeSide, properties);
+    }
+    case CSSPropertyWebkitBorderAfterWidth: {
+        const int properties[4] = { CSSPropertyBorderTopWidth, CSSPropertyBorderRightWidth, CSSPropertyBorderBottomWidth, CSSPropertyBorderLeftWidth };
+        return resolveToPhysicalProperty(direction, blockDirection, AfterSide, properties);
+    }
+    case CSSPropertyWebkitLogicalWidth: {
+        const int properties[2] = { CSSPropertyWidth, CSSPropertyHeight };
+        return resolveToPhysicalProperty(blockDirection, LogicalWidth, properties);
+    }
+    case CSSPropertyWebkitLogicalHeight: {
+        const int properties[2] = { CSSPropertyWidth, CSSPropertyHeight };
+        return resolveToPhysicalProperty(blockDirection, LogicalHeight, properties);
+    }
+    case CSSPropertyWebkitMinLogicalWidth: {
+        const int properties[2] = { CSSPropertyMinWidth, CSSPropertyMinHeight };
+        return resolveToPhysicalProperty(blockDirection, LogicalWidth, properties);
+    }
+    case CSSPropertyWebkitMinLogicalHeight: {
+        const int properties[2] = { CSSPropertyMinWidth, CSSPropertyMinHeight };
+        return resolveToPhysicalProperty(blockDirection, LogicalHeight, properties);
+    }
+    case CSSPropertyWebkitMaxLogicalWidth: {
+        const int properties[2] = { CSSPropertyMaxWidth, CSSPropertyMaxHeight };
+        return resolveToPhysicalProperty(blockDirection, LogicalWidth, properties);
+    }
+    case CSSPropertyWebkitMaxLogicalHeight: {
+        const int properties[2] = { CSSPropertyMaxWidth, CSSPropertyMaxHeight };
+        return resolveToPhysicalProperty(blockDirection, LogicalHeight, properties);
+    }
     default:
         return propertyID;
     }
diff --git a/WebCore/css/CSSProperty.h b/WebCore/css/CSSProperty.h
index 7a3da68..0da6050 100644
--- a/WebCore/css/CSSProperty.h
+++ b/WebCore/css/CSSProperty.h
@@ -22,6 +22,7 @@
 #define CSSProperty_h
 
 #include "CSSValue.h"
+#include "RenderStyleConstants.h"
 #include "TextDirection.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
@@ -59,7 +60,7 @@ public:
     
     String cssText() const;
 
-    static int resolveDirectionAwareProperty(int propertyID, TextDirection);
+    static int resolveDirectionAwareProperty(int propertyID, TextDirection, EBlockFlowDirection);
 
     friend bool operator==(const CSSProperty&, const CSSProperty&);
 
diff --git a/WebCore/css/CSSPropertyNames.in b/WebCore/css/CSSPropertyNames.in
index 9079ea1..addecca 100644
--- a/WebCore/css/CSSPropertyNames.in
+++ b/WebCore/css/CSSPropertyNames.in
@@ -20,8 +20,10 @@ font-style
 font-variant
 font-weight
 text-rendering
+-webkit-block-flow
 -webkit-font-smoothing
 -webkit-text-size-adjust
+-webkit-writing-mode
 zoom
 
 # line height needs to be right after the above high-priority properties
@@ -173,8 +175,14 @@ z-index
 # a single value: -webkit-background-size: l; is equivalent to background-size: l l;
 # whereas background-size: l; is equivalent to background-size: l auto;
 -webkit-background-size
-# CSS Text Layout Module Level 3: Vertical writing support
--webkit-block-flow
+-webkit-border-after
+-webkit-border-after-color
+-webkit-border-after-style
+-webkit-border-after-width
+-webkit-border-before
+-webkit-border-before-color
+-webkit-border-before-style
+-webkit-border-before-width
 -webkit-border-end
 -webkit-border-end-color
 -webkit-border-end-style
@@ -222,8 +230,12 @@ z-index
 -webkit-hyphens
 -webkit-line-break
 -webkit-line-clamp
+-webkit-logical-width
+-webkit-logical-height
 -webkit-margin-bottom-collapse
 -webkit-margin-collapse
+-webkit-margin-after
+-webkit-margin-before
 -webkit-margin-end
 -webkit-margin-start
 -webkit-margin-top-collapse
@@ -248,7 +260,13 @@ z-index
 -webkit-mask-repeat-y
 -webkit-mask-size
 -webkit-match-nearest-mail-blockquote-color
+-webkit-max-logical-width
+-webkit-max-logical-height
+-webkit-min-logical-width
+-webkit-min-logical-height
 -webkit-nbsp-mode
+-webkit-padding-after
+-webkit-padding-before
 -webkit-padding-end
 -webkit-padding-start
 -webkit-perspective
@@ -277,5 +295,3 @@ z-index
 -webkit-user-modify
 -webkit-user-select
 -webkit-variable-declaration-block
-# CSS Text Layout Module Level 3: Vertical writing support
--webkit-writing-mode
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index 8568917..05f59ab 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -2923,7 +2923,7 @@ void CSSStyleSelector::applyDeclarations(bool isImportant, int startIndex, int e
 
                 if (applyFirst) {
                     COMPILE_ASSERT(firstCSSProperty == CSSPropertyColor, CSS_color_is_first_property);
-                    COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 12, CSS_zoom_is_end_of_first_prop_range);
+                    COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 14, CSS_zoom_is_end_of_first_prop_range);
                     COMPILE_ASSERT(CSSPropertyLineHeight == CSSPropertyZoom + 1, CSS_line_height_is_after_zoom);
 
                     // give special priority to font-xxx, color properties, etc
@@ -3111,7 +3111,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
     bool isInherit = m_parentNode && valueType == CSSValue::CSS_INHERIT;
     bool isInitial = valueType == CSSValue::CSS_INITIAL || (!m_parentNode && valueType == CSSValue::CSS_INHERIT);
     
-    id = CSSProperty::resolveDirectionAwareProperty(id, m_style->direction());
+    id = CSSProperty::resolveDirectionAwareProperty(id, m_style->direction(), m_style->blockFlow());
 
     if (m_checker.m_matchVisitedPseudoClass && !isValidVisitedLinkProperty(id)) {
         // Limit the properties that can be applied to only the ones honored by :visited.
@@ -5474,10 +5474,28 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
     case CSSPropertyWebkitBorderStartColor:
     case CSSPropertyWebkitBorderStartStyle:
     case CSSPropertyWebkitBorderStartWidth:
+    case CSSPropertyWebkitBorderBefore:
+    case CSSPropertyWebkitBorderBeforeColor:
+    case CSSPropertyWebkitBorderBeforeStyle:
+    case CSSPropertyWebkitBorderBeforeWidth:
+    case CSSPropertyWebkitBorderAfter:
+    case CSSPropertyWebkitBorderAfterColor:
+    case CSSPropertyWebkitBorderAfterStyle:
+    case CSSPropertyWebkitBorderAfterWidth:
     case CSSPropertyWebkitMarginEnd:
     case CSSPropertyWebkitMarginStart:
+    case CSSPropertyWebkitMarginBefore:
+    case CSSPropertyWebkitMarginAfter:
     case CSSPropertyWebkitPaddingEnd:
     case CSSPropertyWebkitPaddingStart:
+    case CSSPropertyWebkitPaddingBefore:
+    case CSSPropertyWebkitPaddingAfter:
+    case CSSPropertyWebkitLogicalWidth:
+    case CSSPropertyWebkitLogicalHeight:
+    case CSSPropertyWebkitMinLogicalWidth:
+    case CSSPropertyWebkitMinLogicalHeight:
+    case CSSPropertyWebkitMaxLogicalWidth:
+    case CSSPropertyWebkitMaxLogicalHeight:
         ASSERT_NOT_REACHED();
         break;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list