LayoutTests:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Aug 2006 00:48:40 +0000 (00:48 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Aug 2006 00:48:40 +0000 (00:48 +0000)
        Reviewed by Hyatt.

        - test for <rdar://problem/4701494> REGRESSION: Scrollbar on EPSN widget doesn't scroll (also affects Widgets widget, web inspector)

        * fast/css/computed-style-negative-top-expected.txt: Added.
        * fast/css/computed-style-negative-top.html: Added.

WebCore:

        Reviewed by Hyatt.

        - fix <rdar://problem/4701494> REGRESSION: Scrollbar on EPSN widget doesn't scroll (also affects Widgets widget, web inspector)

        The bug was that we would return "none" for computed style properties when they were
        exactly "-1px".

        Test: fast/css/computed-style-negative-top.html

        * css/CSSComputedStyleDeclaration.cpp:
        (WebCore::valueForLength): Moved special case for "undefined length" out of here.
        (WebCore::valueForMaxLength): Moved it into here.
        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Use valueForMaxLength
        only for max-height and max-width.

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

LayoutTests/ChangeLog
LayoutTests/fast/css/computed-style-negative-top-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/computed-style-negative-top.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/css/CSSComputedStyleDeclaration.cpp

index f65550bc680b3c96dedd3207cc04024dc3d4b2aa..2fda9f5c0dded05be1272288a638afca7ea5f643 100644 (file)
@@ -1,3 +1,12 @@
+2006-08-29  Darin Adler  <darin@apple.com>
+
+        Reviewed by Hyatt.
+
+        - test for <rdar://problem/4701494> REGRESSION: Scrollbar on EPSN widget doesn't scroll (also affects Widgets widget, web inspector)
+
+        * fast/css/computed-style-negative-top-expected.txt: Added.
+        * fast/css/computed-style-negative-top.html: Added.
+
 2006-08-28  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by harrison
diff --git a/LayoutTests/fast/css/computed-style-negative-top-expected.txt b/LayoutTests/fast/css/computed-style-negative-top-expected.txt
new file mode 100644 (file)
index 0000000..1cf6f8b
--- /dev/null
@@ -0,0 +1 @@
+Test succeeded! Top is -1px.
diff --git a/LayoutTests/fast/css/computed-style-negative-top.html b/LayoutTests/fast/css/computed-style-negative-top.html
new file mode 100644 (file)
index 0000000..42bc8f8
--- /dev/null
@@ -0,0 +1,10 @@
+<div id="test" style="position:relative; top:-1px"></div>
+<script>
+var style = document.defaultView.getComputedStyle(document.getElementById("test"));
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+if (style.top == "-1px")
+    document.write("Test succeeded! Top is " + style.top + ".");
+else
+    document.write("Test failed! Top is " + style.top + ".");
+</script>
index a50a576526cc887ac9ede2074a1d7f32cd7a7ec6..69d0cff9dedabf38cdf5c673aa7a592512d84dc7 100644 (file)
@@ -1,3 +1,20 @@
+2006-08-29  Darin Adler  <darin@apple.com>
+
+        Reviewed by Hyatt.
+
+        - fix <rdar://problem/4701494> REGRESSION: Scrollbar on EPSN widget doesn't scroll (also affects Widgets widget, web inspector)
+
+        The bug was that we would return "none" for computed style properties when they were
+        exactly "-1px".
+
+        Test: fast/css/computed-style-negative-top.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::valueForLength): Moved special case for "undefined length" out of here.
+        (WebCore::valueForMaxLength): Moved it into here.
+        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Use valueForMaxLength
+        only for max-height and max-width.
+
 2006-08-29  Nikolas Zimmermann  <zimmermann@kde.org>
 
         Reviewed by eseidel.
index 2919d42a5bde5770c7fbd0262f6167197c062215..83f12a82902cf503784d51a9f164711ed5806e5f 100644 (file)
@@ -159,8 +159,6 @@ static CSSValue* valueForLength(const Length& length)
         case Auto:
             return new CSSPrimitiveValue(CSS_VAL_AUTO);
         case WebCore::Fixed:
-            if (length.value() == undefinedLength)
-                return new CSSPrimitiveValue(CSS_VAL_NONE);
             return new CSSPrimitiveValue(length.value(), CSSPrimitiveValue::CSS_PX);
         case Intrinsic:
             return new CSSPrimitiveValue(CSS_VAL_INTRINSIC);
@@ -177,6 +175,14 @@ static CSSValue* valueForLength(const Length& length)
     return new CSSPrimitiveValue(CSS_VAL_AUTO);
 }
 
+// Handles special value for "none".
+static CSSValue* valueForMaxLength(const Length& length)
+{
+    if (length.isFixed() && length.value() == undefinedLength)
+        return new CSSPrimitiveValue(CSS_VAL_NONE);
+    return valueForLength(length);
+}
+
 static CSSValue *valueForBorderStyle(EBorderStyle style)
 {
     switch (style) {
@@ -929,9 +935,9 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
         ASSERT_NOT_REACHED();
         return 0;
     case CSS_PROP_MAX_HEIGHT:
-        return valueForLength(style->maxHeight());
+        return valueForMaxLength(style->maxHeight());
     case CSS_PROP_MAX_WIDTH:
-        return valueForLength(style->maxWidth());
+        return valueForMaxLength(style->maxWidth());
     case CSS_PROP_MIN_HEIGHT:
         return valueForLength(style->minHeight());
     case CSS_PROP_MIN_WIDTH: