2006-04-26 Mitz Pettel <opendarwin.org@mitzpettel.com>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Apr 2006 21:23:53 +0000 (21:23 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 25 Apr 2006 21:23:53 +0000 (21:23 +0000)
        Reviewed by darin.  Landed by eseidel.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8452
          mangleme(0x58c22e11): Random crashes

        Test: fast/frames/empty-cols-attribute.html

        * platform/StringImpl.cpp:
        (WebCore::StringImpl::toLengthArray): If the string is empty, return 0
        but set len to 1. This gives the same behavior you get if you don't specify
        the attribute at all, matching WinIE and Firefox. Previously, the empty
        string resulted in len being set to 0 (and a memory smasher in
        RenderFrameSet::layout()).
        * rendering/render_frames.cpp:
        (WebCore::RenderFrameSet::layout): Added an assert.

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

LayoutTests/fast/frames/empty-cols-attribute-expected.checksum [new file with mode: 0644]
LayoutTests/fast/frames/empty-cols-attribute-expected.txt [new file with mode: 0644]
LayoutTests/fast/frames/empty-cols-attribute.html [new file with mode: 0644]
WebCore/platform/StringImpl.cpp
WebCore/rendering/render_frames.cpp

diff --git a/LayoutTests/fast/frames/empty-cols-attribute-expected.checksum b/LayoutTests/fast/frames/empty-cols-attribute-expected.checksum
new file mode 100644 (file)
index 0000000..5bf1e84
--- /dev/null
@@ -0,0 +1,2 @@
+4ba76443f17a0b4b19c9d0505b0323d9
+\ No newline at end of file
diff --git a/LayoutTests/fast/frames/empty-cols-attribute-expected.txt b/LayoutTests/fast/frames/empty-cols-attribute-expected.txt
new file mode 100644 (file)
index 0000000..031d23c
--- /dev/null
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderFrameSet {FRAMESET} at (0,0) size 800x600
+      RenderFrame {FRAME} at (0,0) size 800x298
+        layer at (0,0) size 798x294
+          RenderCanvas at (0,0) size 798x294
+        layer at (0,0) size 798x294
+          RenderBlock {HTML} at (0,0) size 798x294
+            RenderBody {BODY} at (8,8) size 782x278 [bgcolor=#FF0000]
+      RenderFrame {FRAME} at (0,302) size 800x298
+        layer at (0,0) size 798x294
+          RenderCanvas at (0,0) size 798x294
+        layer at (0,0) size 798x294
+          RenderBlock {HTML} at (0,0) size 798x294
+            RenderBody {BODY} at (8,8) size 782x278 [bgcolor=#800080]
diff --git a/LayoutTests/fast/frames/empty-cols-attribute.html b/LayoutTests/fast/frames/empty-cols-attribute.html
new file mode 100644 (file)
index 0000000..16106c1
--- /dev/null
@@ -0,0 +1,4 @@
+<frameset cols="" rows="1,1">
+<frame src="resources/red.html">
+<frame src="resources/purple.html">
+</frameset>
index ca9d16e2b4f2d53b37eba2bcc72386b80e148008..cee396ffb2733bc82e3901cd3cde35d27e8cbc3f 100644 (file)
@@ -316,6 +316,10 @@ Length* StringImpl::toCoordsArray(int& len) const
 
 Length* StringImpl::toLengthArray(int& len) const
 {
+    if (!length()) {
+        len = 1;
+        return 0;
+    }
     DeprecatedString str(m_data, m_length);
     str = str.simplifyWhiteSpace();
 
index 135d447d09086b24525de115b4fb12a10be0c6a7..a1f81c619b5ff7593f7b5a556cc15a3502378acc 100644 (file)
@@ -147,6 +147,7 @@ void RenderFrameSet::layout( )
         int* gridLayout = m_gridLayout[k];
 
         if (grid) {
+            assert(gridLen);
             // First we need to investigate how many columns of each type we have and
             // how much space these columns are going to require.
             for (int i = 0; i < gridLen; ++i) {