WebCore:
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Jun 2008 06:44:20 +0000 (06:44 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Jun 2008 06:44:20 +0000 (06:44 +0000)
        Reviewed by Dave Hyatt.

        - fix <rdar://problem/5876370> Safari 3.1.1 bad rendering of pages from http://www.legifrance.gouv.fr/

        Tests: fast/parser/p-in-scope-strict.html
               fast/parser/p-in-scope.html

        * html/HTMLParagraphElement.h:
        (WebCore::HTMLParagraphElement::endTagRequirement): Changed to require
        an end tag. The explicit closing of one P element by another is now
        done in error checking, and therefore takes scope into account, allowing
        for <p><button><p>, for example.

        * html/HTMLParser.cpp:
        (WebCore::HTMLParser::HTMLParser): Initialize m_hasPElementInScope.
        (WebCore::isScopingTag): Added. Returns whether the given tag represents
        a scoping element as defined in HTML 5 section 8.2.3.2.
        (WebCore::HTMLParser::formCreateErrorCheck): Added a call to
        pCloserCreateErrorCheck().
        (WebCore::HTMLParser::ddCreateErrorCheck): Ditto.
        (WebCore::HTMLParser::dtCreateErrorCheck): Ditto.
        (WebCore::HTMLParser::nestedPCloserCreateErrorCheck): Added for use with
        <li>, which both closes P elements in scope and any previous LI.
        (WebCore::HTMLParser::pCloserCreateErrorCheck): Added. If there is a P
        element in scope, acts as if a </p> tag was seen.
        (WebCore::HTMLParser::pCloserStrictCreateErrorCheck): Ditto, but only
        in strict mode. Used for <table>.
        (WebCore::HTMLParser::getNode): Added entries for tags that close a P
        element in scope.
        (WebCore::HTMLParser::handleResidualStyleCloseTagAcrossBlocks): Added
        code to reset m_hasPElementInScope.
        (WebCore::HTMLParser::pushBlock): Added code to update
        m_hasPElementInScope.
        (WebCore::HTMLParser::popOneBlockCommon): Ditto.
        (WebCore::HTMLParser::checkIfHasPElementInScope): Added. Updates
        m_hasPElementInScope.

        * html/HTMLParser.h:
        (WebCore::HTMLParser::hasPElementInScope): Added. Calls
        checkIfHasPElementInScope() if needed and returns whether there
        is a P element in scope.

LayoutTests:

        Reviewed by Dave Hyatt.

        - tests, updated tests and updated results for
          <rdar://problem/5876370> Safari 3.1.1 bad rendering of pages from http://www.legifrance.gouv.fr/

        * fast/block/basic/001.html:
        * fast/block/positioning/absolute-in-inline-ltr-2.html:
        * fast/block/positioning/absolute-in-inline-ltr-3.html:
        * fast/block/positioning/absolute-in-inline-ltr.html:
        * fast/block/positioning/absolute-in-inline-rtl-2.html:
        * fast/block/positioning/absolute-in-inline-rtl-3.html:
        * fast/block/positioning/absolute-in-inline-rtl.html:
        * fast/block/positioning/absolute-in-inline-short-ltr.html:
        * fast/block/positioning/absolute-in-inline-short-rtl.html:
        * fast/block/positioning/auto/006.html:
        * fast/inline/continuation-outlines-with-layers.html:
        * fast/inline/continuation-outlines.html:
        * fast/parser/p-in-scope-expected.txt: Added.
        * fast/parser/p-in-scope-strict-expected.txt: Added.
        * fast/parser/p-in-scope-strict.html: Added.
        * fast/parser/p-in-scope.html: Added.
        * fast/parser/resources/p-in-scope.css: Added.
        * fast/parser/resources/p-in-scope.js: Added.
        * fast/repaint/subtree-root-clip-2.html:
        * platform/mac/fast/block/basic/001-expected.txt:
        * platform/mac/fast/block/positioning/absolute-in-inline-ltr-2-expected.txt:
        * platform/mac/fast/block/positioning/absolute-in-inline-ltr-3-expected.txt:
        * platform/mac/fast/block/positioning/absolute-in-inline-ltr-expected.txt:
        * platform/mac/fast/block/positioning/absolute-in-inline-rtl-2-expected.txt:
        * platform/mac/fast/block/positioning/absolute-in-inline-rtl-3-expected.txt:
        * platform/mac/fast/block/positioning/absolute-in-inline-rtl-expected.txt:
        * platform/mac/fast/block/positioning/absolute-in-inline-short-ltr-expected.txt:
        * platform/mac/fast/block/positioning/absolute-in-inline-short-rtl-expected.txt:
        * platform/mac/fast/block/positioning/auto/006-expected.txt:
        * platform/mac/fast/inline/continuation-outlines-expected.txt:
        * platform/mac/fast/inline/continuation-outlines-with-layers-expected.txt:
        * platform/mac/fast/repaint/subtree-root-clip-2-expected.txt:

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

39 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/block/basic/001.html
LayoutTests/fast/block/positioning/absolute-in-inline-ltr-2.html
LayoutTests/fast/block/positioning/absolute-in-inline-ltr-3.html
LayoutTests/fast/block/positioning/absolute-in-inline-ltr.html
LayoutTests/fast/block/positioning/absolute-in-inline-rtl-2.html
LayoutTests/fast/block/positioning/absolute-in-inline-rtl-3.html
LayoutTests/fast/block/positioning/absolute-in-inline-rtl.html
LayoutTests/fast/block/positioning/absolute-in-inline-short-ltr.html
LayoutTests/fast/block/positioning/absolute-in-inline-short-rtl.html
LayoutTests/fast/block/positioning/auto/006.html
LayoutTests/fast/inline/continuation-outlines-with-layers.html
LayoutTests/fast/inline/continuation-outlines.html
LayoutTests/fast/parser/p-in-scope-expected.txt [new file with mode: 0644]
LayoutTests/fast/parser/p-in-scope-strict-expected.txt [new file with mode: 0644]
LayoutTests/fast/parser/p-in-scope-strict.html [new file with mode: 0644]
LayoutTests/fast/parser/p-in-scope.html [new file with mode: 0644]
LayoutTests/fast/parser/resources/p-in-scope.css [new file with mode: 0644]
LayoutTests/fast/parser/resources/p-in-scope.js [new file with mode: 0644]
LayoutTests/fast/repaint/subtree-root-clip-2.html
LayoutTests/platform/mac/fast/block/basic/001-expected.txt
LayoutTests/platform/mac/fast/block/positioning/absolute-in-inline-ltr-2-expected.txt
LayoutTests/platform/mac/fast/block/positioning/absolute-in-inline-ltr-3-expected.txt
LayoutTests/platform/mac/fast/block/positioning/absolute-in-inline-ltr-expected.txt
LayoutTests/platform/mac/fast/block/positioning/absolute-in-inline-rtl-2-expected.txt
LayoutTests/platform/mac/fast/block/positioning/absolute-in-inline-rtl-3-expected.txt
LayoutTests/platform/mac/fast/block/positioning/absolute-in-inline-rtl-expected.txt
LayoutTests/platform/mac/fast/block/positioning/absolute-in-inline-short-ltr-expected.txt
LayoutTests/platform/mac/fast/block/positioning/absolute-in-inline-short-rtl-expected.txt
LayoutTests/platform/mac/fast/block/positioning/auto/006-expected.txt
LayoutTests/platform/mac/fast/inline/continuation-outlines-expected.txt
LayoutTests/platform/mac/fast/inline/continuation-outlines-with-layers-expected.txt
LayoutTests/platform/mac/fast/repaint/subtree-root-clip-2-expected.txt
WebCore/ChangeLog
WebCore/html/HTMLParagraphElement.h
WebCore/html/HTMLParser.cpp
WebCore/html/HTMLParser.h
WebKitSite/demos/transitions-and-transforms/index.html
WebKitTools/Scripts/bisect-builds

index 2283496..713e713 100644 (file)
@@ -1,3 +1,43 @@
+2008-06-11  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        - tests, updated tests and updated results for
+          <rdar://problem/5876370> Safari 3.1.1 bad rendering of pages from http://www.legifrance.gouv.fr/
+
+        * fast/block/basic/001.html:
+        * fast/block/positioning/absolute-in-inline-ltr-2.html:
+        * fast/block/positioning/absolute-in-inline-ltr-3.html:
+        * fast/block/positioning/absolute-in-inline-ltr.html:
+        * fast/block/positioning/absolute-in-inline-rtl-2.html:
+        * fast/block/positioning/absolute-in-inline-rtl-3.html:
+        * fast/block/positioning/absolute-in-inline-rtl.html:
+        * fast/block/positioning/absolute-in-inline-short-ltr.html:
+        * fast/block/positioning/absolute-in-inline-short-rtl.html:
+        * fast/block/positioning/auto/006.html:
+        * fast/inline/continuation-outlines-with-layers.html:
+        * fast/inline/continuation-outlines.html:
+        * fast/parser/p-in-scope-expected.txt: Added.
+        * fast/parser/p-in-scope-strict-expected.txt: Added.
+        * fast/parser/p-in-scope-strict.html: Added.
+        * fast/parser/p-in-scope.html: Added.
+        * fast/parser/resources/p-in-scope.css: Added.
+        * fast/parser/resources/p-in-scope.js: Added.
+        * fast/repaint/subtree-root-clip-2.html:
+        * platform/mac/fast/block/basic/001-expected.txt:
+        * platform/mac/fast/block/positioning/absolute-in-inline-ltr-2-expected.txt:
+        * platform/mac/fast/block/positioning/absolute-in-inline-ltr-3-expected.txt:
+        * platform/mac/fast/block/positioning/absolute-in-inline-ltr-expected.txt:
+        * platform/mac/fast/block/positioning/absolute-in-inline-rtl-2-expected.txt:
+        * platform/mac/fast/block/positioning/absolute-in-inline-rtl-3-expected.txt:
+        * platform/mac/fast/block/positioning/absolute-in-inline-rtl-expected.txt:
+        * platform/mac/fast/block/positioning/absolute-in-inline-short-ltr-expected.txt:
+        * platform/mac/fast/block/positioning/absolute-in-inline-short-rtl-expected.txt:
+        * platform/mac/fast/block/positioning/auto/006-expected.txt:
+        * platform/mac/fast/inline/continuation-outlines-expected.txt:
+        * platform/mac/fast/inline/continuation-outlines-with-layers-expected.txt:
+        * platform/mac/fast/repaint/subtree-root-clip-2-expected.txt:
+
 2008-06-11  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Sam Weinig.
index d0e0df3..0870d59 100644 (file)
@@ -1,4 +1,4 @@
-<p style="border:2px solid red">
+<div style="border:2px solid red">
 <i>Start of a line. <font color=red>More red on this line:
 <h3>Suddenly a block appears!</h3>
 <h2>And another block!</h2>
index c8df0bd..d17a347 100644 (file)
@@ -27,7 +27,7 @@
 </head>
 <body>
     <p>The black outline box should be a 50px by 50px square with its bottom right corner anchored to the right <span style="color: orange;">orange</span> border on the third line.</p>
-    <p id="outside">
+    <div id="outside">
         ILorem ipsum dolor sit amet,
         <span id="containingBlock">
             con a pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culp qui officia deserunt mollit animequs
@@ -35,6 +35,6 @@
             ILOREM ipsum dol sDuis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nullat
         </span>
         duis aute irure dolor in reprehenderit in voluptate velit.
-    </p>
+    </div>
 </body>
 </html>
index 81820af..58eb877 100644 (file)
@@ -27,7 +27,7 @@
 </head>
 <body>
     <p>The black outline box should be a 50px by 50px square with its top left corner anchored to the left <span style="color: blue;">blue</span> border on the first line.</p>
-    <p id="outside">
+    <div id="outside">
         ILorem ipsum dolor sit amet,
         <span id="containingBlock">
             con a pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culp qui officia deserunt mollit animequs
@@ -35,6 +35,6 @@
             ILOREM ipsum dol sDuis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nullat
         </span>
         duis aute irure dolor in reprehenderit in voluptate velit.
-    </p>
+    </div>
 </body>
 </html>
index dc0e7a9..bc3f5db 100644 (file)
@@ -27,7 +27,7 @@
 </head>
 <body>
     <p>The black outline box should stretch from the left <span style="color: blue;">blue</span> border on the first line, to the right <span style="color: orange;">orange</span> border on the third line.</p>
-    <p id="outside">
+    <div id="outside">
         ILorem ipsum dolor sit amet,
         <span id="containingBlock">
             con a pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culp qui officia deserunt mollit animequs
@@ -35,6 +35,6 @@
             ILOREM ipsum dol sDuis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nullat
         </span>
         duis aute irure dolor in reprehenderit in voluptate velit.
-    </p>
+    </div>
 </body>
 </html>
index 071bd19..cbb0adc 100644 (file)
@@ -29,7 +29,7 @@
 </head>
 <body>
     <p>The black outline box should be a 50px by 50px square with its bottom left corner anchored to the left <span style="color: orange;">orange</span> border on the third line.</p>
-    <p id="outside">
+    <div id="outside">
         ILorem ipsum dolor sit amet,
         <span id="containingBlock">
             con a pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culp qui officia deserunt mollit animequs
@@ -37,6 +37,6 @@
             ILOREM ipsum dol sDuis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nullat
         </span>
         duis aute irure dolor in reprehenderit in voluptate velit.
-    </p>
+    </div>
 </body>
 </html>
index 0657db4..87793a2 100644 (file)
@@ -29,7 +29,7 @@
 </head>
 <body>
     <p>The black outline box should be a 50px by 50px square with its top right corner anchored to the right <span style="color: blue;">blue</span> border on the first line.</p>
-    <p id="outside">
+    <div id="outside">
         ILorem ipsum dolor sit amet,
         <span id="containingBlock">
             con a pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culp qui officia deserunt mollit animequs
@@ -37,6 +37,6 @@
             ILOREM ipsum dol sDuis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nullat
         </span>
         duis aute irure dolor in reprehenderit in voluptate velit.
-    </p>
+    </div>
 </body>
 </html>
index 33fc980..41fd741 100644 (file)
@@ -29,7 +29,7 @@
 </head>
 <body>
     <p>The black outline box should stretch from the right <span style="color: blue;">blue</span> border on the first line, to the left <span style="color: orange;">orange</span> border on the third line.</p>
-    <p id="outside">
+    <div id="outside">
         ILorem ipsum dolor sit amet,
         <span id="containingBlock">
             con a pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culp qui officia deserunt mollit animequs
@@ -37,6 +37,6 @@
             ILOREM ipsum dol sDuis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nullat
         </span>
         duis aute irure dolor in reprehenderit in voluptate velit.
-    </p>
+    </div>
 </body>
 </html>
index 22751f1..6351a1d 100644 (file)
@@ -27,7 +27,7 @@
 </head>
 <body>
     <p>The black outline box should stretch from the left <span style="color: blue;">blue</span> border, to the right <span style="color: orange;">orange</span> border.</p>
-    <p id="outside">
+    <div id="outside">
         ILorem ipsum dolor sit amet,
         <span id="containingBlock">
             con a pariatur.
@@ -35,6 +35,6 @@
             duis aute
         </span>
         irure dolor in reprehenderit.
-    </p>
+    </div>
 </body>
 </html>
index 9bef8d6..8c899e1 100644 (file)
@@ -29,7 +29,7 @@
 </head>
 <body>
     <p>The black outline box should stretch from the right <span style="color: blue;">blue</span> border, to the left <span style="color: orange;">orange</span> border.</p>
-    <p id="outside">
+    <div id="outside">
         ILorem ipsum dolor sit amet,
         <span id="containingBlock">
             con a pariatur.
@@ -37,6 +37,6 @@
             duis aute
         </span>
         irure dolor in reprehenderit.
-    </p>
+    </div>
 </body>
 </html>
index 9e0a326..b90fb38 100644 (file)
@@ -4,7 +4,7 @@ In this test, you should see three blocks that are aligned right within a black
 be stacked vertically with the green box in between two olive boxes.  The olive boxes and the green box
 should be 100x100, and there should be 100 pixels of padding on the left side of the box stack.  
 
-<p style="position: relative; direction:rtl">The
+<div style="position: relative; direction:rtl; margin: 1em 0;">The
 black box's top should be aligned with the end of the last line in this parargaph and its right side should begin right after the end of this sentence.
 
  <span style="direction:rtl; position:absolute;width:100px;height:200px;border:20px solid black;padding-top:50px;padding-bottom:50px;padding-left:100px;padding-right:0px">
@@ -12,6 +12,6 @@ black box's top should be aligned with the end of the last line in this parargap
 <div style="position:absolute;width:100px;height:100px;background-color:olive;top:0px"></div>
 <div style="right:0px; position:absolute;width:100px;height:100px;background-color:olive;top:200px"></div>
 </span>
-</p>
+</div>
 </body>
 </html>
index c71590f..e38a935 100644 (file)
@@ -2,18 +2,19 @@
 <head>
 <style>
 span { outline: 10px auto purple; position:relative }
+div { margin: 1em 0; }
 </style>
 </head>
 <body>
-<p>Outline ring painting test.</p>
+<div>Outline ring painting test.</div>
 
-<p><span>Content before.
+<div><span>Content before.
 <h3>Bold with margin.</h3>
-Content after</span></p>
+Content after</span></div>
 
-<p><span><h3>No content before.</h3>Content after.</span></p>
+<div><span><h3>No content before.</h3>Content after.</span></div>
 
-<p><span>Content before<h3>But No Content After</h3></span></p>
+<div><span>Content before<h3>But No Content After</h3></span></div>
 
-<p><span><h3>No content before or after.</h3></span></p>
+<div><span><h3>No content before or after.</h3></span></div>
 
index 3c05abf..8066c94 100644 (file)
@@ -2,18 +2,19 @@
 <head>
 <style>
 span { outline: 10px auto purple }
+div { margin: 1em 0; }
 </style>
 </head>
 <body>
-<p>Outline ring painting test.</p>
+<div>Outline ring painting test.</div>
 
-<p><span>Content before.
+<div><span>Content before.
 <h3>Bold with margin.</h3>
-Content after</span></p>
+Content after</span></div>
 
-<p><span><h3>No content before.</h3>Content after.</span></p>
+<div><span><h3>No content before.</h3>Content after.</span></div>
 
-<p><span>Content before<h3>But No Content After</h3></span></p>
+<div><span>Content before<h3>But No Content After</h3></span></div>
 
-<p><span><h3>No content before or after.</h3></span></p>
+<div><span><h3>No content before or after.</h3></span></div>
 
diff --git a/LayoutTests/fast/parser/p-in-scope-expected.txt b/LayoutTests/fast/parser/p-in-scope-expected.txt
new file mode 100644 (file)
index 0000000..32797fd
--- /dev/null
@@ -0,0 +1,30 @@
+The symbol in row foo and column bar shows whether <p><bar><foo> is allowed (+) or closes the <p> before opening <foo> (-).
+
+Leaf           a       b       big     em      i       s       small   strike  strong  tt      u       abbr    acronym bdo     cite    code    dfn     kbd     q       samp    sub     sup     var     font    nobr    button  applet  object  span    del     ins     marquee
+address        -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+blockquote     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+center -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+dir    -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+div    -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+dl     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+fieldset       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+h1     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+h2     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+h3     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+h4     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+h5     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+h6     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+menu   -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+ol     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+p      -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+ul     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+pre    -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+listing        -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+form   -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+hr     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+li     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+dd     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+dt     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+plaintext      -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+table  +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       +       -
+
diff --git a/LayoutTests/fast/parser/p-in-scope-strict-expected.txt b/LayoutTests/fast/parser/p-in-scope-strict-expected.txt
new file mode 100644 (file)
index 0000000..f40008d
--- /dev/null
@@ -0,0 +1,30 @@
+The symbol in row foo and column bar shows whether <p><bar><foo> is allowed (+) or closes the <p> before opening <foo> (-).
+
+Leaf           a       b       big     em      i       s       small   strike  strong  tt      u       abbr    acronym bdo     cite    code    dfn     kbd     q       samp    sub     sup     var     font    nobr    button  applet  object  span    del     ins     marquee
+address        -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+blockquote     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+center -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+dir    -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+div    -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+dl     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+fieldset       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+h1     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+h2     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+h3     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+h4     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+h5     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+h6     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+menu   -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+ol     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+p      -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+ul     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+pre    -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+listing        -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+form   -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+hr     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+li     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+dd     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+dt     -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+plaintext      -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+table  -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       -       +       +       +       +       -       -       -       -
+
diff --git a/LayoutTests/fast/parser/p-in-scope-strict.html b/LayoutTests/fast/parser/p-in-scope-strict.html
new file mode 100644 (file)
index 0000000..39fbe3d
--- /dev/null
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<link rel="stylesheet" href="resources/p-in-scope.css">
+<p>
+    The symbol in row <tt>foo</tt> and column <tt>bar</tt> shows whether
+    <tt>&lt;p>&lt;bar>&lt;foo></tt> is allowed (+) or closes the
+    <tt>&lt;p></tt> before opening <tt>&lt;foo></tt> (-).
+</p>
+<table>
+    <thead>
+        <tr id="header-row">
+            <th>Leaf</th>
+            <th></th>
+        </tr>
+    </thead>
+    <tbody id="results">
+    </tbody>
+</table>
+<pre id="console"></pre>
+<script src="resources/p-in-scope.js"></script>
diff --git a/LayoutTests/fast/parser/p-in-scope.html b/LayoutTests/fast/parser/p-in-scope.html
new file mode 100644 (file)
index 0000000..01a41ea
--- /dev/null
@@ -0,0 +1,18 @@
+<link rel="stylesheet" href="resources/p-in-scope.css">
+<p>
+    The symbol in row <tt>foo</tt> and column <tt>bar</tt> shows whether
+    <tt>&lt;p>&lt;bar>&lt;foo></tt> is allowed (+) or closes the
+    <tt>&lt;p></tt> before opening <tt>&lt;foo></tt> (-).
+</p>
+<table>
+    <thead>
+        <tr id="header-row">
+            <th>Leaf</th>
+            <th></th>
+        </tr>
+    </thead>
+    <tbody id="results">
+    </tbody>
+</table>
+<pre id="console"></pre>
+<script src="resources/p-in-scope.js"></script>
diff --git a/LayoutTests/fast/parser/resources/p-in-scope.css b/LayoutTests/fast/parser/resources/p-in-scope.css
new file mode 100644 (file)
index 0000000..c198426
--- /dev/null
@@ -0,0 +1,8 @@
+table { border-collapse: collapse; font-size: x-small; font-family: Lucida Grande; border: 1px solid #999; }
+td, th { border-left: 1px solid #999; border-right: 1px solid #999; padding: 4px 8px; }
+thead > tr { background-color: #dde; }
+tbody > tr:nth-child(odd) { background-color: #eee; }
+tbody > tr:nth-child(even) { background-color: #ccc; }
+td.allowed { color: green; }
+td.closed { color: red; }
+td.other { color: orange; }
diff --git a/LayoutTests/fast/parser/resources/p-in-scope.js b/LayoutTests/fast/parser/resources/p-in-scope.js
new file mode 100644 (file)
index 0000000..41a6523
--- /dev/null
@@ -0,0 +1,137 @@
+function testAsChild(tag)
+{
+    var markup = "<p>1<" + tag + ">";
+    var container = document.createElement("body");
+
+    container.innerHTML = markup;
+
+    if (container.childNodes.length == 1)
+        return "allowed";
+
+    if (container.lastChild.tagName.toLowerCase() == tag)
+        return "closed";
+
+    return "other";
+}
+
+function testAsGrandchild(tag, intermediateTag)
+{
+    var markup = "<p>1<" + intermediateTag + ">2<" + tag + ">3";
+    var container = document.createElement("body");
+    container.innerHTML = markup;
+
+    if (container.childNodes.length == 1)
+        return "allowed";
+    if (container.firstChild.lastChild && container.firstChild.lastChild.tagName && container.firstChild.lastChild.tagName.toLowerCase() == tag)
+        return "allowed";
+
+    return "closed";
+}
+
+function log(message)
+{
+    document.getElementById("console").appendChild(document.createTextNode(message + "\n\r"));
+}
+
+var leafTags = [
+    "address",
+    "blockquote",
+    "center",
+    "dir",
+    "div",
+    "dl",
+    "fieldset",
+    "h1",
+    "h2",
+    "h3",
+    "h4",
+    "h5",
+    "h6",
+    "menu",
+    "ol",
+    "p",
+    "ul",
+
+    "pre",
+    "listing",
+
+    "form",
+
+    "hr",
+
+    "li",
+
+    "dd",
+    "dt",
+
+    "plaintext",
+
+    "table",
+];
+
+var intermediateTags = [
+    "a",            // formatting
+
+    "b",            // formatting
+    "big",          // formatting
+    "em",           // formatting
+    "i",            // formatting
+    "s",            // formatting
+    "small",        // formatting
+    "strike",       // formatting
+    "strong",       // formatting
+    "tt",           // formatting
+    "u",            // formatting
+
+    "abbr",
+    "acronym",
+    "bdo",
+    "cite",
+    "code",
+    "dfn",
+    "kbd",
+    "q",
+    "samp",
+    "sub",
+    "sup",
+    "var",
+
+    "font",         // formatting
+
+    "nobr",         // formatting
+
+    "button",       // scoping
+
+    "applet",       // scoping
+    "object",       // scoping
+
+    "span",         // phrasing
+    "del",          // phrasing?
+    "ins",          // phrasing?
+
+    "marquee",      // scoping
+];
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+var headerRow = document.getElementById("header-row");
+for (var i = 0; i < intermediateTags.length; ++i)
+    headerRow.appendChild(document.createElement("th")).appendChild(document.createTextNode(intermediateTags[i]));
+
+for (var i = 0; i < leafTags.length; ++i) {
+    var tag = leafTags[i];
+    var row = document.getElementById("results").appendChild(document.createElement("tr"));
+    row.appendChild(document.createElement("td")).appendChild(document.createTextNode(tag));
+    var asChild = testAsChild(tag);
+    var cell = row.appendChild(document.createElement("td"));
+    cell.className = asChild;
+    cell.innerText = asChild == "allowed" ? "+" : asChild == "closed" ? "-" : "?";
+    for (var j = 0; j < intermediateTags.length; ++j) {
+        var intermediateTag = intermediateTags[j];
+        var asGrandchild = testAsGrandchild(tag, intermediateTag);
+        cell = row.appendChild(document.createElement("td"));
+        cell.className = asGrandchild;
+        cell.innerText = asGrandchild == "allowed" ? "+" : asGrandchild == "closed" ? "-" : "?";
+    }
+}
index 0d4367f..2a0d724 100644 (file)
@@ -9,13 +9,13 @@
     </script>
 </head>
 <body onload="runRepaintTest()">
-<p>
+<div>
     <span style="-position: relative; top: 25px; left: 25px;">
         <div style="float: left; height: 100px; width: 100px; overflow: hidden; background-color: red;">
             <div id="target" style="height: 100px; width: 0; background-color: green;">
             </div>
         </div>
     </span>
-</p>
+</div>
 </body>
 </html>
index 25d973a..49d01cd 100644 (file)
@@ -2,8 +2,8 @@ layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
-    RenderBody {BODY} at (8,8) size 784x576
-      RenderBlock {P} at (0,0) size 784x182 [border: (2px solid #FF0000)]
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (0,0) size 784x182 [border: (2px solid #FF0000)]
         RenderBlock (anonymous) at (2,2) size 780x18
           RenderInline {I} at (0,0) size 230x18
             RenderText {#text} at (0,0) size 93x18
index bdf6638..6216a4d 100644 (file)
@@ -2,7 +2,7 @@ layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
-    RenderBody {BODY} at (8,8) size 784x576
+    RenderBody {BODY} at (8,8) size 784x584
       RenderBlock {P} at (0,0) size 784x36
         RenderText {#text} at (0,0) size 664x18
           text run at (0,0) width 664: "The black outline box should be a 50px by 50px square with its bottom right corner anchored to the right "
@@ -12,7 +12,7 @@ layer at (0,0) size 800x600
         RenderText {#text} at (707,0) size 772x36
           text run at (707,0) width 65: " border on"
           text run at (0,18) width 83: "the third line."
-      RenderBlock {P} at (0,52) size 600x72
+      RenderBlock {DIV} at (0,52) size 600x72
         RenderText {#text} at (0,0) size 186x18
           text run at (0,0) width 186: "ILorem ipsum dolor sit amet, "
         RenderText {#text} at (504,36) size 593x36
index 87d1bdd..9bec94f 100644 (file)
@@ -2,7 +2,7 @@ layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
-    RenderBody {BODY} at (8,8) size 784x576
+    RenderBody {BODY} at (8,8) size 784x584
       RenderBlock {P} at (0,0) size 784x36
         RenderText {#text} at (0,0) size 622x18
           text run at (0,0) width 622: "The black outline box should be a 50px by 50px square with its top left corner anchored to the left "
@@ -12,7 +12,7 @@ layer at (0,0) size 800x600
         RenderText {#text} at (649,0) size 765x36
           text run at (649,0) width 116: " border on the first"
           text run at (0,18) width 27: "line."
-      RenderBlock {P} at (0,52) size 600x72
+      RenderBlock {DIV} at (0,52) size 600x72
         RenderText {#text} at (0,0) size 186x18
           text run at (0,0) width 186: "ILorem ipsum dolor sit amet, "
         RenderText {#text} at (504,36) size 593x36
index ef4be55..912d923 100644 (file)
@@ -2,7 +2,7 @@ layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
-    RenderBody {BODY} at (8,8) size 784x576
+    RenderBody {BODY} at (8,8) size 784x584
       RenderBlock {P} at (0,0) size 784x18
         RenderText {#text} at (0,0) size 314x18
           text run at (0,0) width 314: "The black outline box should stretch from the left "
@@ -16,7 +16,7 @@ layer at (0,0) size 800x600
             text run at (564,0) width 43: "orange"
         RenderText {#text} at (607,0) size 152x18
           text run at (607,0) width 152: " border on the third line."
-      RenderBlock {P} at (0,34) size 600x72
+      RenderBlock {DIV} at (0,34) size 600x72
         RenderText {#text} at (0,0) size 186x18
           text run at (0,0) width 186: "ILorem ipsum dolor sit amet, "
         RenderText {#text} at (504,36) size 593x36
index 3b8cb55..166c8c0 100644 (file)
@@ -2,7 +2,7 @@ layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
-    RenderBody {BODY} at (8,8) size 784x576
+    RenderBody {BODY} at (8,8) size 784x584
       RenderBlock {P} at (0,0) size 784x36
         RenderText {#text} at (0,0) size 646x18
           text run at (0,0) width 646: "The black outline box should be a 50px by 50px square with its bottom left corner anchored to the left "
@@ -12,7 +12,7 @@ layer at (0,0) size 800x600
         RenderText {#text} at (689,0) size 777x36
           text run at (689,0) width 88: " border on the"
           text run at (0,18) width 60: "third line."
-      RenderBlock {P} at (0,52) size 600x72
+      RenderBlock {DIV} at (0,52) size 600x72
         RenderText {#text} at (414,0) size 186x18
           text run at (414,0) width 186 RTL override: "ILorem ipsum dolor sit amet, "
         RenderText {#text} at (7,36) size 593x36
index e153b63..3fc1f2a 100644 (file)
@@ -2,7 +2,7 @@ layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
-    RenderBody {BODY} at (8,8) size 784x576
+    RenderBody {BODY} at (8,8) size 784x584
       RenderBlock {P} at (0,0) size 784x36
         RenderText {#text} at (0,0) size 640x18
           text run at (0,0) width 640: "The black outline box should be a 50px by 50px square with its top right corner anchored to the right "
@@ -12,7 +12,7 @@ layer at (0,0) size 800x600
         RenderText {#text} at (667,0) size 783x36
           text run at (667,0) width 116: " border on the first"
           text run at (0,18) width 27: "line."
-      RenderBlock {P} at (0,52) size 600x72
+      RenderBlock {DIV} at (0,52) size 600x72
         RenderText {#text} at (414,0) size 186x18
           text run at (414,0) width 186 RTL override: "ILorem ipsum dolor sit amet, "
         RenderText {#text} at (7,36) size 593x36
index a353fe6..412200d 100644 (file)
@@ -2,7 +2,7 @@ layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
-    RenderBody {BODY} at (8,8) size 784x576
+    RenderBody {BODY} at (8,8) size 784x584
       RenderBlock {P} at (0,0) size 784x18
         RenderText {#text} at (0,0) size 323x18
           text run at (0,0) width 323: "The black outline box should stretch from the right "
@@ -16,7 +16,7 @@ layer at (0,0) size 800x600
             text run at (564,0) width 43: "orange"
         RenderText {#text} at (607,0) size 152x18
           text run at (607,0) width 152: " border on the third line."
-      RenderBlock {P} at (0,34) size 600x72
+      RenderBlock {DIV} at (0,34) size 600x72
         RenderText {#text} at (414,0) size 186x18
           text run at (414,0) width 186 RTL override: "ILorem ipsum dolor sit amet, "
         RenderText {#text} at (7,36) size 593x36
index 15e8884..ea9fbf0 100644 (file)
@@ -2,7 +2,7 @@ layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
-    RenderBody {BODY} at (8,8) size 784x576
+    RenderBody {BODY} at (8,8) size 784x584
       RenderBlock {P} at (0,0) size 784x18
         RenderText {#text} at (0,0) size 314x18
           text run at (0,0) width 314: "The black outline box should stretch from the left "
@@ -16,7 +16,7 @@ layer at (0,0) size 800x600
             text run at (466,0) width 43: "orange"
         RenderText {#text} at (509,0) size 49x18
           text run at (509,0) width 49: " border."
-      RenderBlock {P} at (0,34) size 600x18
+      RenderBlock {DIV} at (0,34) size 600x18
         RenderText {#text} at (0,0) size 186x18
           text run at (0,0) width 186: "ILorem ipsum dolor sit amet, "
         RenderText {#text} at (420,0) size 173x18
index c1b7479..1cd2326 100644 (file)
@@ -2,7 +2,7 @@ layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
-    RenderBody {BODY} at (8,8) size 784x576
+    RenderBody {BODY} at (8,8) size 784x584
       RenderBlock {P} at (0,0) size 784x18
         RenderText {#text} at (0,0) size 323x18
           text run at (0,0) width 323: "The black outline box should stretch from the right "
@@ -16,7 +16,7 @@ layer at (0,0) size 800x600
             text run at (466,0) width 43: "orange"
         RenderText {#text} at (509,0) size 49x18
           text run at (509,0) width 49: " border."
-      RenderBlock {P} at (0,34) size 600x18
+      RenderBlock {DIV} at (0,34) size 600x18
         RenderText {#text} at (414,0) size 186x18
           text run at (414,0) width 186 RTL override: "ILorem ipsum dolor sit amet, "
         RenderText {#text} at (7,0) size 173x18
index 584af17..577b7b3 100644 (file)
@@ -11,7 +11,7 @@ layer at (0,0) size 800x600
           text run at (248,18) width 502: "The olive boxes and the green box should be 100x100, and there should be 100"
           text run at (0,36) width 313: "pixels of padding on the left side of the box stack."
 layer at (8,78) size 784x36
-  RenderBlock (relative positioned) {P} at (0,70) size 784x36
+  RenderBlock (relative positioned) {DIV} at (0,70) size 784x36
     RenderText {#text} at (5,0) size 779x36
       text run at (5,0) width 779: "The black box's top should be aligned with the end of the last line in this parargaph and its right side should begin right after"
       text run at (629,18) width 8 RTL: ". "
index 6abd433..a6da613 100644 (file)
@@ -2,11 +2,11 @@ layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
-    RenderBody {BODY} at (8,8) size 784x574
-      RenderBlock {P} at (0,0) size 784x18
+    RenderBody {BODY} at (8,16) size 784x566
+      RenderBlock {DIV} at (0,0) size 784x18
         RenderText {#text} at (0,0) size 160x18
           text run at (0,0) width 160: "Outline ring painting test."
-      RenderBlock {P} at (0,34) size 784x94
+      RenderBlock {DIV} at (0,34) size 784x94
         RenderBlock (anonymous) at (0,0) size 784x18
           RenderInline {SPAN} at (0,0) size 98x18
             RenderText {#text} at (0,0) size 98x18
@@ -19,7 +19,7 @@ layer at (0,0) size 800x600
           RenderInline {SPAN} at (0,0) size 82x18
             RenderText {#text} at (0,0) size 82x18
               text run at (0,0) width 82: "Content after"
-      RenderBlock {P} at (0,146) size 784x58
+      RenderBlock {DIV} at (0,146) size 784x58
         RenderBlock (anonymous) at (0,0) size 784x0
           RenderInline {SPAN} at (0,0) size 0x0
         RenderBlock (anonymous) at (0,0) size 784x22
@@ -30,7 +30,7 @@ layer at (0,0) size 800x600
           RenderInline {SPAN} at (0,0) size 86x18
             RenderText {#text} at (0,0) size 86x18
               text run at (0,0) width 86: "Content after."
-      RenderBlock {P} at (0,220) size 784x58
+      RenderBlock {DIV} at (0,220) size 784x58
         RenderBlock (anonymous) at (0,0) size 784x18
           RenderInline {SPAN} at (0,0) size 94x18
             RenderText {#text} at (0,0) size 94x18
@@ -41,7 +41,7 @@ layer at (0,0) size 800x600
               text run at (0,0) width 177: "But No Content After"
         RenderBlock (anonymous) at (0,76) size 784x0
           RenderInline {SPAN} at (0,0) size 0x0
-      RenderBlock {P} at (0,296) size 784x22
+      RenderBlock {DIV} at (0,296) size 784x22
         RenderBlock (anonymous) at (0,0) size 784x0
           RenderInline {SPAN} at (0,0) size 0x0
         RenderBlock (anonymous) at (0,0) size 784x22
index 77a0633..eee3e23 100644 (file)
@@ -2,51 +2,51 @@ layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
-    RenderBody {BODY} at (8,8) size 784x574
-      RenderBlock {P} at (0,0) size 784x18
+    RenderBody {BODY} at (8,16) size 784x566
+      RenderBlock {DIV} at (0,0) size 784x18
         RenderText {#text} at (0,0) size 160x18
           text run at (0,0) width 160: "Outline ring painting test."
-      RenderBlock {P} at (0,34) size 784x94
+      RenderBlock {DIV} at (0,34) size 784x94
         RenderBlock (anonymous) at (0,0) size 784x18
         RenderBlock (anonymous) at (0,36) size 784x22
           RenderBlock {H3} at (0,0) size 784x22
             RenderText {#text} at (0,0) size 150x22
               text run at (0,0) width 150: "Bold with margin."
         RenderBlock (anonymous) at (0,76) size 784x18
-      RenderBlock {P} at (0,146) size 784x58
+      RenderBlock {DIV} at (0,146) size 784x58
         RenderBlock (anonymous) at (0,0) size 784x0
         RenderBlock (anonymous) at (0,0) size 784x22
           RenderBlock {H3} at (0,0) size 784x22
             RenderText {#text} at (0,0) size 150x22
               text run at (0,0) width 150: "No content before."
         RenderBlock (anonymous) at (0,40) size 784x18
-      RenderBlock {P} at (0,220) size 784x58
+      RenderBlock {DIV} at (0,220) size 784x58
         RenderBlock (anonymous) at (0,0) size 784x18
         RenderBlock (anonymous) at (0,36) size 784x22
           RenderBlock {H3} at (0,0) size 784x22
             RenderText {#text} at (0,0) size 177x22
               text run at (0,0) width 177: "But No Content After"
         RenderBlock (anonymous) at (0,76) size 784x0
-      RenderBlock {P} at (0,296) size 784x22
+      RenderBlock {DIV} at (0,296) size 784x22
         RenderBlock (anonymous) at (0,0) size 784x0
         RenderBlock (anonymous) at (0,0) size 784x22
           RenderBlock {H3} at (0,0) size 784x22
             RenderText {#text} at (0,0) size 216x22
               text run at (0,0) width 216: "No content before or after."
         RenderBlock (anonymous) at (0,40) size 784x0
-layer at (8,42) size 98x18
+layer at (8,50) size 98x18
   RenderInline (relative positioned) {SPAN} at (0,0) size 98x18
     RenderText {#text} at (0,0) size 98x18
       text run at (0,0) width 98: "Content before."
-layer at (8,118) size 82x18
+layer at (8,126) size 82x18
   RenderInline (relative positioned) {SPAN} at (0,0) size 82x18
     RenderText {#text} at (0,0) size 82x18
       text run at (0,0) width 82: "Content after"
-layer at (8,194) size 86x18
+layer at (8,202) size 86x18
   RenderInline (relative positioned) {SPAN} at (0,0) size 86x18
     RenderText {#text} at (0,0) size 86x18
       text run at (0,0) width 86: "Content after."
-layer at (8,228) size 94x18
+layer at (8,236) size 94x18
   RenderInline (relative positioned) {SPAN} at (0,0) size 94x18
     RenderText {#text} at (0,0) size 94x18
       text run at (0,0) width 94: "Content before"
index 3480faa..0dc9c16 100644 (file)
@@ -3,7 +3,7 @@ layer at (0,0) size 800x600
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
-      RenderBlock {P} at (0,0) size 784x0
+      RenderBlock {DIV} at (0,0) size 784x0
         RenderInline {SPAN} at (0,0) size 0x0
           RenderText {#text} at (0,0) size 0x0
         RenderText {#text} at (0,0) size 0x0
index b92ed26..0a219ce 100644 (file)
@@ -1,3 +1,47 @@
+2008-06-11  Dan Bernstein  <mitz@apple.com>
+
+        Reviewed by Dave Hyatt.
+
+        - fix <rdar://problem/5876370> Safari 3.1.1 bad rendering of pages from http://www.legifrance.gouv.fr/
+
+        Tests: fast/parser/p-in-scope-strict.html
+               fast/parser/p-in-scope.html
+
+        * html/HTMLParagraphElement.h:
+        (WebCore::HTMLParagraphElement::endTagRequirement): Changed to require
+        an end tag. The explicit closing of one P element by another is now
+        done in error checking, and therefore takes scope into account, allowing
+        for <p><button><p>, for example.
+
+        * html/HTMLParser.cpp:
+        (WebCore::HTMLParser::HTMLParser): Initialize m_hasPElementInScope.
+        (WebCore::isScopingTag): Added. Returns whether the given tag represents
+        a scoping element as defined in HTML 5 section 8.2.3.2.
+        (WebCore::HTMLParser::formCreateErrorCheck): Added a call to
+        pCloserCreateErrorCheck().
+        (WebCore::HTMLParser::ddCreateErrorCheck): Ditto.
+        (WebCore::HTMLParser::dtCreateErrorCheck): Ditto.
+        (WebCore::HTMLParser::nestedPCloserCreateErrorCheck): Added for use with
+        <li>, which both closes P elements in scope and any previous LI.
+        (WebCore::HTMLParser::pCloserCreateErrorCheck): Added. If there is a P
+        element in scope, acts as if a </p> tag was seen.
+        (WebCore::HTMLParser::pCloserStrictCreateErrorCheck): Ditto, but only
+        in strict mode. Used for <table>.
+        (WebCore::HTMLParser::getNode): Added entries for tags that close a P
+        element in scope.
+        (WebCore::HTMLParser::handleResidualStyleCloseTagAcrossBlocks): Added
+        code to reset m_hasPElementInScope.
+        (WebCore::HTMLParser::pushBlock): Added code to update
+        m_hasPElementInScope.
+        (WebCore::HTMLParser::popOneBlockCommon): Ditto.
+        (WebCore::HTMLParser::checkIfHasPElementInScope): Added. Updates
+        m_hasPElementInScope.
+
+        * html/HTMLParser.h:
+        (WebCore::HTMLParser::hasPElementInScope): Added. Calls
+        checkIfHasPElementInScope() if needed and returns whether there
+        is a P element in scope.
+
 2008-06-11  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Sam Weinig.
index a6be6b4..9b5b4fa 100644 (file)
@@ -32,7 +32,7 @@ class HTMLParagraphElement : public HTMLElement {
 public:
     HTMLParagraphElement(Document*);
 
-    virtual HTMLTagStatus endTagRequirement() const { return TagStatusOptional; }
+    virtual HTMLTagStatus endTagRequirement() const { return TagStatusRequired; }
     virtual int tagPriority() const { return 3; }
     virtual bool checkDTD(const Node* newChild);
 
index 4fb96b8..ba60334 100644 (file)
@@ -116,6 +116,7 @@ HTMLParser::HTMLParser(HTMLDocument* doc, bool reportErrors)
     , current(doc)
     , didRefCurrent(false)
     , blockStack(0)
+    , m_hasPElementInScope(NotInScope)
     , head(0)
     , inBody(false)
     , haveContent(false)
@@ -132,6 +133,7 @@ HTMLParser::HTMLParser(DocumentFragment* frag)
     , current(frag)
     , didRefCurrent(true)
     , blockStack(0)
+    , m_hasPElementInScope(NotInScope)
     , head(0)
     , inBody(true)
     , haveContent(false)
@@ -299,6 +301,11 @@ static bool isTableRelated(Node* n)
     return n->hasTagName(tableTag) || isTablePart(n);
 }
 
+static bool isScopingTag(const AtomicString& tagName)
+{
+    return tagName == appletTag || tagName == captionTag || tagName == tdTag || tagName == thTag || tagName == buttonTag || tagName == marqueeTag || tagName == objectTag || tagName == tableTag || tagName == htmlTag;
+}
+
 bool HTMLParser::insertNode(Node* n, bool flat)
 {
     RefPtr<Node> protectNode(n);
@@ -699,6 +706,7 @@ bool HTMLParser::formCreateErrorCheck(Token* t, RefPtr<Node>& result)
     if (!m_currentFormElement) {
         m_currentFormElement = new HTMLFormElement(document);
         result = m_currentFormElement;
+        pCloserCreateErrorCheck(t, result);
     }
     return false;
 }
@@ -722,6 +730,7 @@ bool HTMLParser::selectCreateErrorCheck(Token* t, RefPtr<Node>& result)
 
 bool HTMLParser::ddCreateErrorCheck(Token* t, RefPtr<Node>& result)
 {
+    pCloserCreateErrorCheck(t, result);
     popBlock(dtTag);
     popBlock(ddTag);
     return true;
@@ -729,6 +738,7 @@ bool HTMLParser::ddCreateErrorCheck(Token* t, RefPtr<Node>& result)
 
 bool HTMLParser::dtCreateErrorCheck(Token* t, RefPtr<Node>& result)
 {
+    pCloserCreateErrorCheck(t, result);
     popBlock(ddTag);
     popBlock(dtTag);
     return true;
@@ -740,6 +750,13 @@ bool HTMLParser::nestedCreateErrorCheck(Token* t, RefPtr<Node>& result)
     return true;
 }
 
+bool HTMLParser::nestedPCloserCreateErrorCheck(Token* t, RefPtr<Node>& result)
+{
+    pCloserCreateErrorCheck(t, result);
+    popBlock(t->tagName);
+    return true;
+}
+
 bool HTMLParser::nestedStyleCreateErrorCheck(Token* t, RefPtr<Node>& result)
 {
     return allowNestedRedundantTag(t->tagName);
@@ -782,6 +799,22 @@ bool HTMLParser::noscriptCreateErrorCheck(Token* t, RefPtr<Node>& result)
     return true;
 }
 
+bool HTMLParser::pCloserCreateErrorCheck(Token* t, RefPtr<Node>& result)
+{
+    if (hasPElementInScope())
+        popBlock(pTag);
+    return true;
+}
+
+bool HTMLParser::pCloserStrictCreateErrorCheck(Token* t, RefPtr<Node>& result)
+{
+    if (document->inCompatMode())
+        return true;
+    if (hasPElementInScope())
+        popBlock(pTag);
+    return true;
+}
+
 bool HTMLParser::mapCreateErrorCheck(Token* t, RefPtr<Node>& result)
 {
     m_currentMapElement = new HTMLMapElement(document);
@@ -795,28 +828,49 @@ PassRefPtr<Node> HTMLParser::getNode(Token* t)
     static FunctionMap gFunctionMap;
     if (gFunctionMap.isEmpty()) {
         gFunctionMap.set(aTag.localName().impl(), &HTMLParser::nestedCreateErrorCheck);
+        gFunctionMap.set(addressTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
         gFunctionMap.set(bTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
         gFunctionMap.set(bigTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
+        gFunctionMap.set(blockquoteTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
         gFunctionMap.set(bodyTag.localName().impl(), &HTMLParser::bodyCreateErrorCheck);
         gFunctionMap.set(buttonTag.localName().impl(), &HTMLParser::nestedCreateErrorCheck);
+        gFunctionMap.set(centerTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
         gFunctionMap.set(commentAtom.impl(), &HTMLParser::commentCreateErrorCheck);
         gFunctionMap.set(ddTag.localName().impl(), &HTMLParser::ddCreateErrorCheck);
+        gFunctionMap.set(dirTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
+        gFunctionMap.set(divTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
+        gFunctionMap.set(dlTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
         gFunctionMap.set(dtTag.localName().impl(), &HTMLParser::dtCreateErrorCheck);
         gFunctionMap.set(formTag.localName().impl(), &HTMLParser::formCreateErrorCheck);
+        gFunctionMap.set(fieldsetTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
         gFunctionMap.set(framesetTag.localName().impl(), &HTMLParser::framesetCreateErrorCheck);
+        gFunctionMap.set(h1Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
+        gFunctionMap.set(h2Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
+        gFunctionMap.set(h3Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
+        gFunctionMap.set(h4Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
+        gFunctionMap.set(h5Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
+        gFunctionMap.set(h6Tag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
         gFunctionMap.set(headTag.localName().impl(), &HTMLParser::headCreateErrorCheck);
+        gFunctionMap.set(hrTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
         gFunctionMap.set(iTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
         gFunctionMap.set(isindexTag.localName().impl(), &HTMLParser::isindexCreateErrorCheck);
-        gFunctionMap.set(liTag.localName().impl(), &HTMLParser::nestedCreateErrorCheck);
+        gFunctionMap.set(liTag.localName().impl(), &HTMLParser::nestedPCloserCreateErrorCheck);
+        gFunctionMap.set(listingTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
         gFunctionMap.set(mapTag.localName().impl(), &HTMLParser::mapCreateErrorCheck);
+        gFunctionMap.set(menuTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
         gFunctionMap.set(nobrTag.localName().impl(), &HTMLParser::nestedCreateErrorCheck);
         gFunctionMap.set(noembedTag.localName().impl(), &HTMLParser::noembedCreateErrorCheck);
         gFunctionMap.set(noframesTag.localName().impl(), &HTMLParser::noframesCreateErrorCheck);
         gFunctionMap.set(noscriptTag.localName().impl(), &HTMLParser::noscriptCreateErrorCheck);
+        gFunctionMap.set(olTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
+        gFunctionMap.set(pTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
+        gFunctionMap.set(plaintextTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
+        gFunctionMap.set(preTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
         gFunctionMap.set(sTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
         gFunctionMap.set(selectTag.localName().impl(), &HTMLParser::selectCreateErrorCheck);
         gFunctionMap.set(smallTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
         gFunctionMap.set(strikeTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
+        gFunctionMap.set(tableTag.localName().impl(), &HTMLParser::pCloserStrictCreateErrorCheck);
         gFunctionMap.set(tbodyTag.localName().impl(), &HTMLParser::tableSectionCreateErrorCheck);
         gFunctionMap.set(tdTag.localName().impl(), &HTMLParser::tableCellCreateErrorCheck);
         gFunctionMap.set(textAtom.impl(), &HTMLParser::textCreateErrorCheck);
@@ -826,6 +880,7 @@ PassRefPtr<Node> HTMLParser::getNode(Token* t)
         gFunctionMap.set(trTag.localName().impl(), &HTMLParser::nestedCreateErrorCheck);
         gFunctionMap.set(ttTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
         gFunctionMap.set(uTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
+        gFunctionMap.set(ulTag.localName().impl(), &HTMLParser::pCloserCreateErrorCheck);
     }
 
     bool proceed = true;
@@ -1018,6 +1073,8 @@ void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem)
         if (!parentElem->childAllowed(blockElem))
             return;
 
+        m_hasPElementInScope = Unknown;
+
         if (maxElem->node->parentNode() != elem->node) {
             // Walk the stack and remove any elements that aren't residual style tags.  These
             // are basically just being closed up.  Example:
@@ -1233,6 +1290,10 @@ void HTMLParser::pushBlock(const AtomicString& tagName, int level)
 {
     blockStack = new HTMLStackElem(tagName, level, current, didRefCurrent, blockStack);
     didRefCurrent = false;
+    if (tagName == pTag)
+        m_hasPElementInScope = InScope;
+    else if (isScopingTag(tagName))
+        m_hasPElementInScope = NotInScope;
 }
 
 void HTMLParser::popBlock(const AtomicString& tagName, bool reportErrors)
@@ -1328,6 +1389,11 @@ inline HTMLStackElem* HTMLParser::popOneBlockCommon()
     if (elem->strayTableContent)
         inStrayTableContent--;
 
+    if (elem->tagName == pTag)
+        m_hasPElementInScope = NotInScope;
+    else if (isScopingTag(elem->tagName))
+        m_hasPElementInScope = Unknown;
+
     return elem;
 }
 
@@ -1365,6 +1431,21 @@ void HTMLParser::moveOneBlockToStack(HTMLStackElem*& head)
     head = elem;
 }
 
+void HTMLParser::checkIfHasPElementInScope()
+{
+    m_hasPElementInScope = NotInScope;
+    HTMLStackElem* elem = blockStack;
+    while (elem) {
+        const AtomicString& tagName = elem->tagName;
+        if (tagName == pTag) {
+            m_hasPElementInScope = InScope;
+            return;
+        } else if (isScopingTag(tagName))
+            return;
+        elem = elem->next;
+    }
+}
+
 void HTMLParser::popInlineBlocks()
 {
     while (blockStack && isInline(current))
index 7c6a022..3a5b437 100644 (file)
@@ -92,11 +92,14 @@ private:
     bool isindexCreateErrorCheck(Token*, RefPtr<Node>&);
     bool mapCreateErrorCheck(Token*, RefPtr<Node>&);
     bool nestedCreateErrorCheck(Token*, RefPtr<Node>&);
+    bool nestedPCloserCreateErrorCheck(Token*, RefPtr<Node>&);
     bool nestedStyleCreateErrorCheck(Token*, RefPtr<Node>&);
     bool noembedCreateErrorCheck(Token*, RefPtr<Node>&);
     bool noframesCreateErrorCheck(Token*, RefPtr<Node>&);
     bool nolayerCreateErrorCheck(Token*, RefPtr<Node>&);
     bool noscriptCreateErrorCheck(Token*, RefPtr<Node>&);
+    bool pCloserCreateErrorCheck(Token*, RefPtr<Node>&);
+    bool pCloserStrictCreateErrorCheck(Token*, RefPtr<Node>&);
     bool selectCreateErrorCheck(Token*, RefPtr<Node>&);
     bool tableCellCreateErrorCheck(Token*, RefPtr<Node>&);
     bool tableSectionCreateErrorCheck(Token*, RefPtr<Node>&);
@@ -134,6 +137,14 @@ private:
     void startBody(); // inserts the isindex element
     PassRefPtr<Node> handleIsindex(Token*);
 
+    void checkIfHasPElementInScope();
+    bool hasPElementInScope()
+    {
+        if (m_hasPElementInScope == Unknown)
+            checkIfHasPElementInScope();
+        return m_hasPElementInScope == InScope;
+    }
+
     void reportError(HTMLParserErrorCode errorCode, const AtomicString* tagName1 = 0, const AtomicString* tagName2 = 0, bool closeTags = false)
     { if (!m_reportErrors) return; reportErrorToConsole(errorCode, tagName1, tagName2, closeTags); }
 
@@ -148,6 +159,9 @@ private:
 
     HTMLStackElem* blockStack;
 
+    enum ElementInScopeState { NotInScope, InScope, Unknown }; 
+    ElementInScopeState m_hasPElementInScope;
+
     RefPtr<HTMLFormElement> m_currentFormElement; // currently active form
     RefPtr<HTMLMapElement> m_currentMapElement; // current map
     HTMLHeadElement* head; // head element; needed for HTML which defines <base> after </head>
index 3777a3a..33907a0 100644 (file)
@@ -21,7 +21,7 @@
   </div>
 </li>
 <li>
-  <h2 class="name">Cover Flow</h2>
+  <h2 class="name">Cover <span style="font-family: Times;">Flow</span></h2>
   <div class="picture"><img src="Finder%20Coverflow.png" alt="Screenshot of a Finder window, showing a Cover Flow view of the user's Documents directory."></div>
   <div class="description">
     <b>Cover Flow</b> lets you flip through your documents as easily
index 55b31c1..cb9ae54 100755 (executable)
@@ -271,7 +271,7 @@ sub findSafariVersion($)
     while (<PLIST>) {
         if (m#^\s*<key>CFBundleShortVersionString</key>#) {
             $version = <PLIST>;
-            $version =~ s#^\s*<string>(.+)</string>\s*[\r\n]*#$1#;
+            $version =~ s#^\s*<string>([0-9.]+)[^<]*</string>\s*[\r\n]*#$1#;
         }
     }
     close(PLIST);