Changeset 27254 in webkit


Ignore:
Timestamp:
Oct 29, 2007 10:27:09 PM (16 years ago)
Author:
bdakin
Message:

WebCore:

Reviewed by Hyatt.

Fix for <rdar://problem/5399614> anchor tag is not rendered without
text content, works in Firefox with CSS background-image (13237)

This patch allows empty inlines that have box decorations or width
from border/padding/margin to have line boxes.

  • rendering/bidi.cpp: (WebCore::inlineFlowAllowsLineBox): Convenience function that defines when we allow an inline flow to have a line box. (WebCore::requiresLineBox): Call inlineFlowAllowsLineBox. (WebCore::shouldSkipWhitespaceAfterStartObject): New function to merge some shared code between list markers and empty inline flows that fall at the beginning of a line. (WebCore::RenderBlock::findNextLineBreak): Make flows more like list markers.

One interesting side effect of this bug appeared in our xhtml/svg
tests that generate parser error tags. The tag we generate was
actually an empty inline with box decorations. This patch causes
those inlines to draw now, and the parser errors looked strange. So
I changed it so that the parsererror tag is display:block. This
matches Firefox, and I think was the original intent of the tag
since that causes its red background and border to show up.

  • dom/XMLTokenizer.cpp: (WebCore::createXHTMLParserErrorHeader):

LayoutTests:

Reviewed by Hyatt.

New tests and new results for old tests for <rdar://problem/
5399614> anchor tag is not rendered without text content, works in
Firefox with CSS background-image (13237)

New tests:

  • fast/inline/drawStyledEmptyInlines.html: Added.
  • fast/inline/drawStyledEmptyInlinesWithWS.html: Added.
  • fast/inline/emptyInlinesWithinLists.html: Added.
  • fast/inline/styledEmptyInlinesWithBRs.html: Added.
  • platform/mac/fast/inline/drawStyledEmptyInlines-expected.checksum: Added.
  • platform/mac/fast/inline/drawStyledEmptyInlines-expected.png: Added.
  • platform/mac/fast/inline/drawStyledEmptyInlines-expected.txt: Added.
  • platform/mac/fast/inline/drawStyledEmptyInlinesWithWS-expected.checksum: Added.
  • platform/mac/fast/inline/drawStyledEmptyInlinesWithWS-expected.png: Added.
  • platform/mac/fast/inline/drawStyledEmptyInlinesWithWS-expected.txt: Added.
  • platform/mac/fast/inline/emptyInlinesWithinLists-expected.checksum: Added.
  • platform/mac/fast/inline/emptyInlinesWithinLists-expected.png: Added.
  • platform/mac/fast/inline/emptyInlinesWithinLists-expected.txt: Added.
  • platform/mac/fast/inline/styledEmptyInlinesWithBRs-expected.checksum: Added.
  • platform/mac/fast/inline/styledEmptyInlinesWithBRs-expected.png: Added.
  • platform/mac/fast/inline/styledEmptyInlinesWithBRs-expected.txt: Added.


New results for tests with <paserererrors> since <parsererror> is
now block.

  • platform/mac/fast/invalid/junk-data-expected.checksum: Replaced.
  • platform/mac/fast/invalid/junk-data-expected.png: Replaced.
  • platform/mac/fast/invalid/junk-data-expected.txt:
  • platform/mac/fast/invalid/missing-end-tag-expected.checksum: Replaced.
  • platform/mac/fast/invalid/missing-end-tag-expected.png: Replaced.
  • platform/mac/fast/invalid/missing-end-tag-expected.txt:
  • platform/mac/fast/parser/xhtml-alternate-entities-expected.checksum: Replaced.
  • platform/mac/fast/parser/xhtml-alternate-entities-expected.png: Replaced.
  • platform/mac/fast/parser/xhtml-alternate-entities-expected.txt:
  • platform/mac/fast/xsl/xslt-extra-content-at-end-expected.checksum: Replaced.
  • platform/mac/fast/xsl/xslt-extra-content-at-end-expected.png: Replaced.
  • platform/mac/fast/xsl/xslt-extra-content-at-end-expected.txt: Removed.
  • platform/mac/svg/custom/junk-data-expected.checksum: Replaced.
  • platform/mac/svg/custom/junk-data-expected.png: Replaced.
  • platform/mac/svg/custom/junk-data-expected.txt:
  • platform/mac/svg/custom/missing-xlink-expected.checksum: Replaced.
  • platform/mac/svg/custom/missing-xlink-expected.png: Replaced.
  • platform/mac/svg/custom/missing-xlink-expected.txt:
  • platform/mac/svg/hixie/error/012-expected.checksum: Replaced.
  • platform/mac/svg/hixie/error/012-expected.png: Replaced.
  • platform/mac/svg/hixie/error/012-expected.txt:
Location:
trunk
Files:
30 added
1 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r27251 r27254  
     12007-10-29  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Hyatt.
     4
     5        New tests and new results for old tests for <rdar://problem/
     6        5399614> anchor tag is not rendered without text content, works in
     7        Firefox with CSS background-image (13237)
     8
     9        New tests:
     10        * fast/inline/drawStyledEmptyInlines.html: Added.
     11        * fast/inline/drawStyledEmptyInlinesWithWS.html: Added.
     12        * fast/inline/emptyInlinesWithinLists.html: Added.
     13        * fast/inline/styledEmptyInlinesWithBRs.html: Added.
     14        * platform/mac/fast/inline/drawStyledEmptyInlines-expected.checksum: Added.
     15        * platform/mac/fast/inline/drawStyledEmptyInlines-expected.png: Added.
     16        * platform/mac/fast/inline/drawStyledEmptyInlines-expected.txt: Added.
     17        * platform/mac/fast/inline/drawStyledEmptyInlinesWithWS-expected.checksum: Added.
     18        * platform/mac/fast/inline/drawStyledEmptyInlinesWithWS-expected.png: Added.
     19        * platform/mac/fast/inline/drawStyledEmptyInlinesWithWS-expected.txt: Added.
     20        * platform/mac/fast/inline/emptyInlinesWithinLists-expected.checksum: Added.
     21        * platform/mac/fast/inline/emptyInlinesWithinLists-expected.png: Added.
     22        * platform/mac/fast/inline/emptyInlinesWithinLists-expected.txt: Added.
     23        * platform/mac/fast/inline/styledEmptyInlinesWithBRs-expected.checksum: Added.
     24        * platform/mac/fast/inline/styledEmptyInlinesWithBRs-expected.png: Added.
     25        * platform/mac/fast/inline/styledEmptyInlinesWithBRs-expected.txt: Added.
     26       
     27        New results for tests with <paserererrors> since <parsererror> is
     28        now block.
     29        * platform/mac/fast/invalid/junk-data-expected.checksum: Replaced.
     30        * platform/mac/fast/invalid/junk-data-expected.png: Replaced.
     31        * platform/mac/fast/invalid/junk-data-expected.txt:
     32        * platform/mac/fast/invalid/missing-end-tag-expected.checksum: Replaced.
     33        * platform/mac/fast/invalid/missing-end-tag-expected.png: Replaced.
     34        * platform/mac/fast/invalid/missing-end-tag-expected.txt:
     35        * platform/mac/fast/parser/xhtml-alternate-entities-expected.checksum: Replaced.
     36        * platform/mac/fast/parser/xhtml-alternate-entities-expected.png: Replaced.
     37        * platform/mac/fast/parser/xhtml-alternate-entities-expected.txt:
     38        * platform/mac/fast/xsl/xslt-extra-content-at-end-expected.checksum: Replaced.
     39        * platform/mac/fast/xsl/xslt-extra-content-at-end-expected.png: Replaced.
     40        * platform/mac/fast/xsl/xslt-extra-content-at-end-expected.txt: Removed.
     41        * platform/mac/svg/custom/junk-data-expected.checksum: Replaced.
     42        * platform/mac/svg/custom/junk-data-expected.png: Replaced.
     43        * platform/mac/svg/custom/junk-data-expected.txt:
     44        * platform/mac/svg/custom/missing-xlink-expected.checksum: Replaced.
     45        * platform/mac/svg/custom/missing-xlink-expected.png: Replaced.
     46        * platform/mac/svg/custom/missing-xlink-expected.txt:
     47        * platform/mac/svg/hixie/error/012-expected.checksum: Replaced.
     48        * platform/mac/svg/hixie/error/012-expected.png: Replaced.
     49        * platform/mac/svg/hixie/error/012-expected.txt:
     50
    1512007-10-29  Dan Bernstein  <mitz@apple.com>
    252
  • trunk/LayoutTests/platform/mac/fast/invalid/junk-data-expected.txt

    r25970 r27254  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x130
    4   RenderBlock {html} at (0,0) size 800x130
    5     RenderBody {body} at (8,18) size 784x94
    6       RenderBlock (anonymous) at (0,0) size 784x0
    7         RenderInline {parsererror} at (0,0) size 0x0 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
    8       RenderBlock (anonymous) at (0,0) size 784x94
    9         RenderBlock {h3} at (0,0) size 784x22
     3layer at (0,0) size 800x166
     4  RenderBlock {html} at (0,0) size 800x166
     5    RenderBody {body} at (8,16) size 784x134
     6      RenderBlock {parsererror} at (16,0) size 752x134 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
     7        RenderBlock {h3} at (18,20) size 716x22
    108          RenderText {#text} at (0,0) size 324x22
    119            text run at (0,0) width 324: "This page contains the following errors:"
    12         RenderBlock {div} at (0,40) size 784x14
     10        RenderBlock {div} at (18,60) size 716x14
    1311          RenderText {#text} at (0,0) size 483x14
    1412            text run at (0,0) width 483: "error on line 1 at column 1: Extra content at the end of the document"
    1513            text run at (483,0) width 0: " "
    16         RenderBlock {h3} at (0,72) size 784x22
     14        RenderBlock {h3} at (18,92) size 716x22
    1715          RenderText {#text} at (0,0) size 429x22
    1816            text run at (0,0) width 429: "Below is a rendering of the page up to the first error."
    19       RenderBlock (anonymous) at (0,112) size 784x0
    20         RenderInline {parsererror} at (0,0) size 0x0 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
  • trunk/LayoutTests/platform/mac/fast/invalid/missing-end-tag-expected.txt

    r25970 r27254  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x148
    4   RenderBlock {html} at (0,0) size 800x148
    5     RenderBlock (anonymous) at (0,0) size 800x0
    6       RenderInline {parsererror} at (0,0) size 0x0 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
    7     RenderBlock (anonymous) at (0,18) size 800x94
    8       RenderBlock {h3} at (0,0) size 800x22
     3layer at (0,0) size 800x184
     4  RenderBlock {html} at (0,0) size 800x184
     5    RenderBlock {parsererror} at (16,16) size 768x134 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
     6      RenderBlock {h3} at (18,20) size 732x22
    97        RenderText {#text} at (0,0) size 324x22
    108          text run at (0,0) width 324: "This page contains the following errors:"
    11       RenderBlock {div} at (0,40) size 800x14
     9      RenderBlock {div} at (18,60) size 732x14
    1210        RenderText {#text} at (0,0) size 560x14
    1311          text run at (0,0) width 560: "error on line 7 at column 29: Opening and ending tag mismatch: p line 0 and body"
    1412          text run at (560,0) width 0: " "
    15       RenderBlock {h3} at (0,72) size 800x22
     13      RenderBlock {h3} at (18,92) size 732x22
    1614        RenderText {#text} at (0,0) size 429x22
    1715          text run at (0,0) width 429: "Below is a rendering of the page up to the first error."
    18     RenderBlock (anonymous) at (0,130) size 800x18
    19       RenderInline {parsererror} at (0,0) size 0x0 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
     16    RenderBlock (anonymous) at (0,166) size 800x18
    2017      RenderInline {body} at (0,0) size 180x18
    2118        RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/platform/mac/fast/parser/xhtml-alternate-entities-expected.txt

    r25970 r27254  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x148
    4   RenderBlock {html} at (0,0) size 800x148
    5     RenderBlock (anonymous) at (0,0) size 800x0
    6       RenderInline {parsererror} at (0,0) size 0x0 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
    7     RenderBlock (anonymous) at (0,18) size 800x94
    8       RenderBlock {h3} at (0,0) size 800x22
     3layer at (0,0) size 800x184
     4  RenderBlock {html} at (0,0) size 800x184
     5    RenderBlock {parsererror} at (16,16) size 768x134 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
     6      RenderBlock {h3} at (18,20) size 732x22
    97        RenderText {#text} at (0,0) size 324x22
    108          text run at (0,0) width 324: "This page contains the following errors:"
    11       RenderBlock {div} at (0,40) size 800x14
     9      RenderBlock {div} at (18,60) size 732x14
    1210        RenderText {#text} at (0,0) size 385x14
    1311          text run at (0,0) width 385: "error on line 4 at column 17: Entity 'fnof' not defined"
    1412          text run at (385,0) width 0: " "
    15       RenderBlock {h3} at (0,72) size 800x22
     13      RenderBlock {h3} at (18,92) size 732x22
    1614        RenderText {#text} at (0,0) size 429x22
    1715          text run at (0,0) width 429: "Below is a rendering of the page up to the first error."
    18     RenderBlock (anonymous) at (0,130) size 800x18
    19       RenderInline {parsererror} at (0,0) size 0x0 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
    20       RenderText {#text} at (0,0) size 0x0
     16    RenderBlock (anonymous) at (0,166) size 800x18
    2117      RenderInline {h1} at (0,0) size 0x0
    2218        RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/platform/mac/svg/custom/junk-data-expected.txt

    r26599 r27254  
    1 layer at (0,0) size 785x742
     1layer at (0,0) size 785x778
    22  RenderView at (0,0) size 785x600
    3 layer at (0,0) size 785x742
    4   RenderBlock {html} at (0,0) size 785x742
    5     RenderBody {body} at (8,18) size 769x716
    6       RenderBlock (anonymous) at (0,0) size 769x0
    7         RenderInline {parsererror} at (0,0) size 0x0 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
    8       RenderBlock (anonymous) at (0,0) size 769x94
    9         RenderBlock {h3} at (0,0) size 769x22
     3layer at (0,0) size 785x778
     4  RenderBlock {html} at (0,0) size 785x778
     5    RenderBody {body} at (8,16) size 769x754
     6      RenderBlock {parsererror} at (16,0) size 737x134 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
     7        RenderBlock {h3} at (18,20) size 701x22
    108          RenderText {#text} at (0,0) size 324x22
    119            text run at (0,0) width 324: "This page contains the following errors:"
    12         RenderBlock {div} at (0,40) size 769x14
     10        RenderBlock {div} at (18,60) size 701x14
    1311          RenderText {#text} at (0,0) size 420x14
    1412            text run at (0,0) width 420: "error on line 6 at column 50: StartTag: invalid element name"
    1513            text run at (420,0) width 0: " "
    16         RenderBlock {h3} at (0,72) size 769x22
     14        RenderBlock {h3} at (18,92) size 701x22
    1715          RenderText {#text} at (0,0) size 429x22
    1816            text run at (0,0) width 429: "Below is a rendering of the page up to the first error."
    19       RenderBlock (anonymous) at (0,112) size 769x604
    20         RenderInline {parsererror} at (0,0) size 0x0 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
    21         RenderSVGRoot {svg} at (8,130) size 193x124
     17      RenderBlock (anonymous) at (0,150) size 769x604
     18        RenderSVGRoot {svg} at (8,166) size 193x124
    2219          RenderSVGText {text} at (0,120) size 193x18 contains 1 chunk(s)
    2320            RenderSVGInlineText {#text} at (0,-14) size 193x18
    2421              chunk 1 text run 1 at (0.00,120.00) startOffset 0 endOffset 29 width 193.00: "You should see an error above"
    25           RenderPath {rect} at (8,130) size 100x100 [fill={[type=SOLID] [color=#000000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
     22          RenderPath {rect} at (8,166) size 100x100 [fill={[type=SOLID] [color=#000000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
  • trunk/LayoutTests/platform/mac/svg/custom/missing-xlink-expected.txt

    r26599 r27254  
    1 layer at (0,0) size 785x742
     1layer at (0,0) size 785x778
    22  RenderView at (0,0) size 785x600
    3 layer at (0,0) size 785x742
    4   RenderBlock {html} at (0,0) size 785x742
    5     RenderBody {body} at (8,18) size 769x716
    6       RenderBlock (anonymous) at (0,0) size 769x0
    7         RenderInline {parsererror} at (0,0) size 0x0 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
    8       RenderBlock (anonymous) at (0,0) size 769x94
    9         RenderBlock {h3} at (0,0) size 769x22
     3layer at (0,0) size 785x778
     4  RenderBlock {html} at (0,0) size 785x778
     5    RenderBody {body} at (8,16) size 769x754
     6      RenderBlock {parsererror} at (16,0) size 737x134 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
     7        RenderBlock {h3} at (18,20) size 701x22
    108          RenderText {#text} at (0,0) size 324x22
    119            text run at (0,0) width 324: "This page contains the following errors:"
    12         RenderBlock {div} at (0,40) size 769x14
     10        RenderBlock {div} at (18,60) size 701x14
    1311          RenderText {#text} at (0,0) size 567x14
    1412            text run at (0,0) width 567: "error on line 6 at column 62: Namespace prefix xlink for href on a is not defined"
    1513            text run at (567,0) width 0: " "
    16         RenderBlock {h3} at (0,72) size 769x22
     14        RenderBlock {h3} at (18,92) size 701x22
    1715          RenderText {#text} at (0,0) size 429x22
    1816            text run at (0,0) width 429: "Below is a rendering of the page up to the first error."
    19       RenderBlock (anonymous) at (0,112) size 769x604
    20         RenderInline {parsererror} at (0,0) size 0x0 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
    21         RenderSVGRoot {svg} at (8,130) size 193x124
     17      RenderBlock (anonymous) at (0,150) size 769x604
     18        RenderSVGRoot {svg} at (8,166) size 193x124
    2219          RenderSVGText {text} at (0,120) size 193x18 contains 1 chunk(s)
    2320            RenderSVGInlineText {#text} at (0,-14) size 193x18
    2421              chunk 1 text run 1 at (0.00,120.00) startOffset 0 endOffset 29 width 193.00: "You should see an error above"
    25           RenderPath {rect} at (8,130) size 100x100 [fill={[type=SOLID] [color=#000000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
    26           RenderSVGContainer {a} at (8,130) size 100x100
    27             RenderPath {rect} at (8,130) size 100x100 [fill={[type=SOLID] [color=#000000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
     22          RenderPath {rect} at (8,166) size 100x100 [fill={[type=SOLID] [color=#000000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
     23          RenderSVGContainer {a} at (8,166) size 100x100
     24            RenderPath {rect} at (8,166) size 100x100 [fill={[type=SOLID] [color=#000000]}] [data="M0.00,0.00L100.00,0.00L100.00,100.00L0.00,100.00"]
  • trunk/LayoutTests/platform/mac/svg/hixie/error/012-expected.txt

    r26599 r27254  
    1 layer at (0,0) size 785x742
     1layer at (0,0) size 785x778
    22  RenderView at (0,0) size 785x600
    3 layer at (0,0) size 785x742
    4   RenderBlock {html} at (0,0) size 785x742
    5     RenderBody {body} at (8,18) size 769x716
    6       RenderBlock (anonymous) at (0,0) size 769x0
    7         RenderInline {parsererror} at (0,0) size 0x0 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
    8       RenderBlock (anonymous) at (0,0) size 769x94
    9         RenderBlock {h3} at (0,0) size 769x22
     3layer at (0,0) size 785x778
     4  RenderBlock {html} at (0,0) size 785x778
     5    RenderBody {body} at (8,16) size 769x754
     6      RenderBlock {parsererror} at (16,0) size 737x134 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
     7        RenderBlock {h3} at (18,20) size 701x22
    108          RenderText {#text} at (0,0) size 324x22
    119            text run at (0,0) width 324: "This page contains the following errors:"
    12         RenderBlock {div} at (0,40) size 769x14
     10        RenderBlock {div} at (18,60) size 701x14
    1311          RenderText {#text} at (0,0) size 581x14
    1412            text run at (0,0) width 581: "error on line 5 at column 149: Opening and ending tag mismatch: rect line 0 and svg"
    1513            text run at (581,0) width 0: " "
    16         RenderBlock {h3} at (0,72) size 769x22
     14        RenderBlock {h3} at (18,92) size 701x22
    1715          RenderText {#text} at (0,0) size 429x22
    1816            text run at (0,0) width 429: "Below is a rendering of the page up to the first error."
    19       RenderBlock (anonymous) at (0,112) size 769x604
    20         RenderInline {parsererror} at (0,0) size 0x0 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
    21         RenderSVGRoot {svg} at (18,140) size 200x200
    22           RenderPath {rect} at (18,140) size 200x200 [fill={[type=SOLID] [color=#FF0000]}] [data="M10.00,10.00L210.00,10.00L210.00,210.00L10.00,210.00"]
    23           RenderPath {rect} at (18,140) size 200x200 [fill={[type=SOLID] [color=#FF0000]}] [data="M10.00,10.00L210.00,10.00L210.00,210.00L10.00,210.00"]
     17      RenderBlock (anonymous) at (0,150) size 769x604
     18        RenderSVGRoot {svg} at (18,176) size 200x200
     19          RenderPath {rect} at (18,176) size 200x200 [fill={[type=SOLID] [color=#FF0000]}] [data="M10.00,10.00L210.00,10.00L210.00,210.00L10.00,210.00"]
     20          RenderPath {rect} at (18,176) size 200x200 [fill={[type=SOLID] [color=#FF0000]}] [data="M10.00,10.00L210.00,10.00L210.00,210.00L10.00,210.00"]
  • trunk/WebCore/ChangeLog

    r27253 r27254  
     12007-10-29  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Hyatt.
     4
     5        Fix for <rdar://problem/5399614> anchor tag is not rendered without
     6        text content, works in Firefox with CSS background-image (13237)
     7
     8        This patch allows empty inlines that have box decorations or width
     9        from border/padding/margin to have line boxes.
     10
     11        * rendering/bidi.cpp:
     12        (WebCore::inlineFlowAllowsLineBox): Convenience function that
     13        defines when we allow an inline flow to have a line box.
     14        (WebCore::requiresLineBox): Call inlineFlowAllowsLineBox.
     15        (WebCore::shouldSkipWhitespaceAfterStartObject): New function to
     16        merge some shared code between list markers and empty inline flows
     17        that fall at the beginning of a line.
     18        (WebCore::RenderBlock::findNextLineBreak): Make flows more like
     19        list markers.
     20
     21        One interesting side effect of this bug appeared in our xhtml/svg
     22        tests that generate parser error tags. The tag we generate was
     23        actually an empty inline with box decorations. This patch causes
     24        those inlines to draw now, and the parser errors looked strange. So
     25        I changed it so that the parsererror tag is display:block. This
     26        matches Firefox, and I think was the original intent of the tag
     27        since that causes its red background and border to show up.
     28        * dom/XMLTokenizer.cpp:
     29        (WebCore::createXHTMLParserErrorHeader):
     30
    1312007-10-29  Dan Bernstein  <mitz@apple.com>
    232
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r27228 r27254  
    1368113681                        isa = PBXProject;
    1368213682                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
     13683                        compatibilityVersion = "Xcode 2.4";
    1368313684                        hasScannedForEncodings = 1;
    1368413685                        knownRegions = (
  • trunk/WebCore/dom/XMLTokenizer.cpp

    r27144 r27254  
    12641264    ExceptionCode ec = 0;
    12651265    RefPtr<Element> reportElement = doc->createElementNS(xhtmlNamespaceURI, "parsererror", ec);
    1266     reportElement->setAttribute(styleAttr, "white-space: pre; border: 2px solid #c77; padding: 0 1em 0 1em; margin: 1em; background-color: #fdd; color: black");
     1266    reportElement->setAttribute(styleAttr, "display: block; white-space: pre; border: 2px solid #c77; padding: 0 1em 0 1em; margin: 1em; background-color: #fdd; color: black");
    12671267   
    12681268    RefPtr<Element> h3 = doc->createElementNS(xhtmlNamespaceURI, "h3", ec);
  • trunk/WebCore/rendering/bidi.cpp

    r26846 r27254  
    12451245}
    12461246
     1247static bool inlineFlowRequiresLineBox(RenderObject* flow)
     1248{
     1249    // FIXME: Right now, we only allow line boxes for inlines that are truly empty.
     1250    // We need to fix this, though, because at the very least, inlines with only text
     1251    // children that is all whitespace should should also have line boxes.
     1252    if (!flow->isInlineFlow() || flow->firstChild())
     1253        return false;
     1254
     1255    bool hasPaddingOrMargin = !(flow->paddingLeft() == 0 && flow->paddingRight() == 0
     1256        && flow->paddingTop() == 0 && flow->paddingBottom() == 0
     1257        && flow->marginLeft() == 0 && flow->marginRight() == 0
     1258        && flow->marginTop() == 0 && flow->marginBottom() == 0);
     1259    if (flow->hasBoxDecorations() || hasPaddingOrMargin)
     1260        return true;
     1261
     1262    return false;
     1263}
     1264
    12471265static inline bool requiresLineBox(BidiIterator& it)
    12481266{
    1249     if (it.obj->isFloatingOrPositioned() || it.obj->isInlineFlow())
     1267    if (it.obj->isFloatingOrPositioned())
    12501268        return false;
     1269
     1270    if (it.obj->isInlineFlow() && !inlineFlowRequiresLineBox(it.obj))
     1271        return false;
     1272
    12511273    if (!shouldCollapseWhiteSpace(it.obj->style()) || it.obj->isBR())
    12521274        return true;
     
    13211343}
    13221344
     1345// This is currently just used for list markers and inline flows that have line boxes. Neither should
     1346// have an effect on whitespace at the start of the line.
     1347static bool shouldSkipWhitespaceAfterStartObject(RenderBlock* block, RenderObject* o, BidiState &bidi)
     1348{
     1349    RenderObject* next = bidiNext(block, o, bidi);
     1350    if (next && !next->isBR() && next->isText() && static_cast<RenderText*>(next)->textLength() > 0) {
     1351        RenderText* nextText = static_cast<RenderText*>(next);
     1352        UChar nextChar = nextText->characters()[0];
     1353        if (nextText->style()->isCollapsibleWhiteSpace(nextChar)) {
     1354            BidiIterator endMid(0, o, 0);
     1355            addMidpoint(endMid);
     1356            return true;
     1357        }
     1358    }
     1359
     1360    return false;
     1361}
     1362
    13231363BidiIterator RenderBlock::findNextLineBreak(BidiIterator &start, BidiState &bidi)
    13241364{
     
    14491489            }
    14501490        } else if (o->isInlineFlow()) {
    1451             // Only empty inlines matter.  We treat those similarly to replaced elements.
     1491            // Right now, we should only encounter empty inlines here.
    14521492            ASSERT(!o->firstChild());
     1493   
     1494            // Now that some inline flows have line boxes, if we are already ignoring spaces, we need
     1495            // to make sure that we stop to include this object and then start ignoring spaces again.
     1496            // If this object is at the start of the line, we need to behave like list markers and
     1497            // start ignoring spaces.
     1498            if (inlineFlowRequiresLineBox(o)) {
     1499                if (ignoringSpaces) {
     1500                    trailingSpaceObject = 0;
     1501                    addMidpoint(BidiIterator(0, o, 0)); // Stop ignoring spaces.
     1502                    addMidpoint(BidiIterator(0, o, 0)); // Start ignoring again.
     1503                } else if (style()->collapseWhiteSpace() && start.obj == o
     1504                    && shouldSkipWhitespaceAfterStartObject(start.block, o, bidi)) {
     1505                    // Like with list markers, we start ignoring spaces to make sure that any
     1506                    // additional spaces we see will be discarded.
     1507                    currentCharacterIsSpace = true;
     1508                    currentCharacterIsWS = true;
     1509                    ignoringSpaces = true;
     1510                }
     1511            }
     1512
    14531513            if (static_cast<RenderFlow*>(o)->isWordBreak()) {
    14541514                w += tmpW;
     
    14781538            trailingSpaceObject = 0;
    14791539           
     1540            // Optimize for a common case. If we can't find whitespace after the list
     1541            // item, then this is all moot. -dwh
    14801542            if (o->isListMarker() && !static_cast<RenderListMarker*>(o)->isInside()) {
    1481                 // The marker must not have an effect on whitespace at the start
    1482                 // of the line.  We start ignoring spaces to make sure that any additional
    1483                 // spaces we see will be discarded.
    1484                 //
    1485                 // Optimize for a common case. If we can't find whitespace after the list
    1486                 // item, then this is all moot. -dwh
    1487                 RenderObject* next = bidiNext(start.block, o, bidi);
    1488                 if (style()->collapseWhiteSpace() && next && !next->isBR() && next->isText() && static_cast<RenderText*>(next)->textLength() > 0) {
    1489                     RenderText *nextText = static_cast<RenderText*>(next);
    1490                     UChar nextChar = nextText->characters()[0];
    1491                     if (nextText->style()->isCollapsibleWhiteSpace(nextChar)) {
    1492                         currentCharacterIsSpace = true;
    1493                         currentCharacterIsWS = true;
    1494                         ignoringSpaces = true;
    1495                         BidiIterator endMid( 0, o, 0 );
    1496                         addMidpoint(endMid);
    1497                     }
     1543                if (style()->collapseWhiteSpace() && shouldSkipWhitespaceAfterStartObject(start.block, o, bidi)) {
     1544                    // Like with inline flows, we start ignoring spaces to make sure that any
     1545                    // additional spaces we see will be discarded.
     1546                    currentCharacterIsSpace = true;
     1547                    currentCharacterIsWS = true;
     1548                    ignoringSpaces = true;
    14981549                }
    14991550            } else
Note: See TracChangeset for help on using the changeset viewer.