Fieldset unexpectedly stretches to minimum intrinsic width
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Mar 2012 03:07:24 +0000 (03:07 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Mar 2012 03:07:24 +0000 (03:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=79128

Patch by SravanKumar Sandela <ssandela@innominds.com> on 2012-03-22
Reviewed by Julien Chaffraix.

Source/WebCore:

Fieldset element width will now check if css width is specified explicitly
before stretching to minimum intrinsic width. The reference
can be taken from IE9, instead of FF(FF acknowledged the broken behavior).

Tests: fast/forms/fieldset-width-nostretch-ifspecified-expected.html
       fast/forms/fieldset-width-nostretch-ifspecified.html

* rendering/RenderFieldset.cpp:
(WebCore::RenderFieldset::stretchesToMinIntrinsicLogicalWidth):
(WebCore):
* rendering/RenderFieldset.h:
(RenderFieldset):

LayoutTests:

Ref tests to check no stretching to intrinsic width if width is explicitly specified.
Currently, calc width is Work-In-Progress, so it wont be supported now, and these ref
tests should automatically take care once Webkit enables it. Need to keep an eye on it.

* fast/forms/fieldset-width-nostretch-ifspecified-expected.html: Added.
* fast/forms/fieldset-width-nostretch-ifspecified.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/forms/fieldset-width-nostretch-ifspecified-expected.html [new file with mode: 0644]
LayoutTests/fast/forms/fieldset-width-nostretch-ifspecified.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderFieldset.cpp
Source/WebCore/rendering/RenderFieldset.h

index efa4840c520ac7a643258183e0e6d5f33a0d7864..521f2447a6fcec27f02d452484b0e5650bc0062e 100644 (file)
@@ -1,3 +1,17 @@
+2012-03-22  SravanKumar Sandela  <ssandela@innominds.com>
+
+        Fieldset unexpectedly stretches to minimum intrinsic width
+        https://bugs.webkit.org/show_bug.cgi?id=79128
+
+        Reviewed by Julien Chaffraix.
+
+        Ref tests to check no stretching to intrinsic width if width is explicitly specified.
+        Currently, calc width is Work-In-Progress, so it wont be supported now, and these ref
+        tests should automatically take care once Webkit enables it. Need to keep an eye on it. 
+
+        * fast/forms/fieldset-width-nostretch-ifspecified-expected.html: Added.
+        * fast/forms/fieldset-width-nostretch-ifspecified.html: Added.
+
 2012-03-22  Tom Sepez  <tsepez@chromium.org>
 
         XSS Auditor bypass via script tag src=data:, URLS.
diff --git a/LayoutTests/fast/forms/fieldset-width-nostretch-ifspecified-expected.html b/LayoutTests/fast/forms/fieldset-width-nostretch-ifspecified-expected.html
new file mode 100644 (file)
index 0000000..f0119b8
--- /dev/null
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <style type="text/css">
+            .percentStyle {
+                width: 50%;
+                padding: 0;
+                margin: 0;
+                border: 1px solid green;
+            }
+            .fixedStyle {
+                width: 300px;
+                padding: 0;
+                margin: 0;
+                border: 1px solid green;
+            }
+            .calculatedStyle {
+                width: 200px;
+                width: calc(350px + 50px);
+                padding: 0;
+                margin: 0;
+                border: 1px solid green;
+            }
+            .wrap {
+                width: 500px;
+            }
+        </style>
+    </head>
+    <body>
+    <p> Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=79128">79128</a>: Fieldset unexpectedly stretches to minimum intrinsic width </p>
+    <p> For this test to pass, you should see our first container to be 50% of its parent, second 300px fixed and third calc width of 400px(if not supported fallback to 200px fixed) </p>
+        <div class="wrap">
+            <div class="percentStyle">
+               Lorem ipsum dolor sit amet, consectetur adipisicing elit 
+            </div>
+            <div class="fixedStyle">
+               Lorem ipsum dolor sit amet, consectetur adipisicing elit 
+            </div>
+            <div class="calculatedStyle">
+               Lorem ipsum dolor sit amet, consectetur adipisicing elit 
+            </div>
+        </div>
+    </body>
+</html>
diff --git a/LayoutTests/fast/forms/fieldset-width-nostretch-ifspecified.html b/LayoutTests/fast/forms/fieldset-width-nostretch-ifspecified.html
new file mode 100644 (file)
index 0000000..8a65640
--- /dev/null
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <style type="text/css">
+            .percentStyle {
+                width: 50%;
+                padding: 0;
+                margin: 0;
+                border: 1px solid green;
+            }
+            .fixedStyle {
+                width: 300px;
+                padding: 0;
+                margin: 0;
+                border: 1px solid green;
+            }
+            .calculatedStyle {
+                width: 200px;
+                width: calc(350px + 50px);
+                padding: 0;
+                margin: 0;
+                border: 1px solid green;
+            }
+            .wrap {
+                width: 500px;
+            }
+        </style>
+    </head>
+    <body>
+    <p> Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=79128">79128</a>: Fieldset unexpectedly stretches to minimum intrinsic width </p>
+    <p> For this test to pass, you should see our first container to be 50% of its parent, second 300px fixed and third calc width of 400px(if not supported fallback to 200px fixed) </p>
+        <div class="wrap">
+            <fieldset class="percentStyle">
+               Lorem ipsum dolor sit amet, consectetur adipisicing elit 
+            </fieldset>
+            <fieldset class="fixedStyle">
+               Lorem ipsum dolor sit amet, consectetur adipisicing elit 
+            </fieldset>
+            <fieldset class="calculatedStyle">
+               Lorem ipsum dolor sit amet, consectetur adipisicing elit 
+            </fieldset>
+        </div>
+    </body>
+</html>
index 11fe2a9b5caac750f9a7dbc4714a863f64b751c7..3ce610c3dc91cd479fe3f9e37b3a168cf4c9f7aa 100644 (file)
@@ -1,3 +1,23 @@
+2012-03-22  SravanKumar Sandela  <ssandela@innominds.com>
+
+        Fieldset unexpectedly stretches to minimum intrinsic width
+        https://bugs.webkit.org/show_bug.cgi?id=79128
+
+        Reviewed by Julien Chaffraix.
+
+        Fieldset element width will now check if css width is specified explicitly
+        before stretching to minimum intrinsic width. The reference
+        can be taken from IE9, instead of FF(FF acknowledged the broken behavior). 
+
+        Tests: fast/forms/fieldset-width-nostretch-ifspecified-expected.html
+               fast/forms/fieldset-width-nostretch-ifspecified.html
+
+        * rendering/RenderFieldset.cpp:
+        (WebCore::RenderFieldset::stretchesToMinIntrinsicLogicalWidth):
+        (WebCore):
+        * rendering/RenderFieldset.h:
+        (RenderFieldset):
+
 2012-03-22  Shawn Singh  <shawnsingh@chromium.org>
 
         [chromium] Target surface should be damaged for a new layers even when layer had no changes
index 3b70e6a113cab89755ce9eb85a83f3e18ba51e52..c9c7dc45f8d4f9da8a05ef529f5c5e0382943ee6 100644 (file)
@@ -195,4 +195,13 @@ void RenderFieldset::paintMask(PaintInfo& paintInfo, const LayoutPoint& paintOff
     paintMaskImages(paintInfo, paintRect);
 }
 
+bool RenderFieldset::stretchesToMinIntrinsicLogicalWidth() const
+{
+    // If width is explicitly specified then Fieldsets should not stretch
+    if (style()->width().isPercent())
+        return false;
+
+    return true;
+}
+
 } // namespace WebCore
index bd12c555329bbcb06e168d14c5b9b22bb33036cb..12dbda5025c046da6faa958d034b13712bb31c80 100644 (file)
@@ -42,7 +42,7 @@ private:
 
     virtual void computePreferredLogicalWidths();
     virtual bool avoidsFloats() const { return true; }
-    virtual bool stretchesToMinIntrinsicLogicalWidth() const { return true; }
+    virtual bool stretchesToMinIntrinsicLogicalWidth() const OVERRIDE;
 
     virtual void paintBoxDecorations(PaintInfo&, const LayoutPoint&);
     virtual void paintMask(PaintInfo&, const LayoutPoint&);