CSS 2.1 failure: first-letter-nested-004.htm fails
authorrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 May 2012 18:25:19 +0000 (18:25 +0000)
committerrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 May 2012 18:25:19 +0000 (18:25 +0000)
commitd0f799e11eb3a428f2a3a8b66cfd2c0dd23e86a6
tree6736ce4bf89fd2641e95262e0165463cd2e407fb
parentba12b4db8cef88ce55e8a05f1c2cd6599b672c8b
CSS 2.1 failure: first-letter-nested-004.htm fails
https://bugs.webkit.org/show_bug.cgi?id=72987

Reviewed by Eric Seidel.

Source/WebCore:

When styling first-letter check each sibling and drill into its inlines until we find either (i) a text node
that is not all whitespace, or (ii) a line break.

This makes our rendering of the following tests compatible with FF and Opera. Our current behaviour is also conformant
since the spec allows UAs to style just one element:
    css2.1/20110323/first-letter-quote-002.htm
    css2.1/20110323/first-letter-quote-003.htm
    css2.1/20110323/first-letter-quote-004.htm
    css2.1/20110323/first-letter-quote-005.htm

This fixes the following two tests. We now drill into the descendants of an element styled with :first-letter looking
for text to style:
    css2.1/20110323/first-letter-nested-004.htm
    css2.1/20110323/first-letter-nested-006.htm

This patch changes our rendering of first-letter-dynamic-001.htm as we now render adjacent quotes in the second line as
green. This is consistent with the spec, which allows this behaviour but does not require it. It's the 'right' behaviour
since it is consistent with the rendering of such quotes in a single element with :first-letter style.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::findLastObjectWithFirstLetterText): Iterate through the child's siblings looking for the last
  object to be styled :first-letter.
(WebCore::RenderBlock::findLastObjectAfterFirstLetterPunctuation): Style any leading punctuation as first-letter, drill
  down into the child's descendants looking for text if necessary.
(WebCore::RenderBlock::updateFirstLetter): Refactor to drill into sibling's children looking for inlines
 that should be styled as first-letter.
(WebCore::RenderBlock::addFirstLetter): Split out from updateFirstLetter so that it can be used when a
 descendant node inside a sibling is found in findLastObjectWithFirstLetterText() needs to be styled as first-letter.
* rendering/RenderBlock.h:

LayoutTests:

* css2.1/20110323/first-letter-000.htm: Added.
* css2.1/20110323/first-letter-001.htm: Added.
* css2.1/20110323/first-letter-dynamic-001.htm: Added.
* css2.1/20110323/first-letter-dynamic-002.htm: Added.
* css2.1/20110323/first-letter-dynamic-003a.htm: Added.
* css2.1/20110323/first-letter-dynamic-003b.htm: Added.
* css2.1/20110323/first-letter-inherit-001.htm: Added.
* css2.1/20110323/first-letter-nested-001.htm: Added.
* css2.1/20110323/first-letter-nested-002.htm: Added.
* css2.1/20110323/first-letter-nested-003.htm: Added.
* css2.1/20110323/first-letter-nested-004.htm: Added.
* css2.1/20110323/first-letter-nested-005.htm: Added.
* css2.1/20110323/first-letter-nested-006.htm: Added.
* css2.1/20110323/first-letter-nested-007.htm: Added.
* css2.1/20110323/first-letter-quote-001.htm: Added.
* css2.1/20110323/first-letter-quote-002.htm: Added.
* css2.1/20110323/first-letter-quote-003.htm: Added.
* css2.1/20110323/first-letter-quote-004.htm: Added.
* css2.1/20110323/first-letter-quote-005.htm: Added.
* css2.1/20110323/first-letter-quote-006.htm: Added.
* fast/css/first-letter-capitalized-edit-select-crash-expected.txt:
  Rebaselined.
* fast/css/first-letter-nested-positioned.htm: Added.
   Tests that text nested inside a positioned object is styled.
* fast/css/first-letter-quotes-no-content-before-after.html: Added.
   Tests that two consecutive quotes, each in a :before and :after pseudo element surrounding
   an empty main element, get styled with first letter.

Behold! Pixel Results!

* platform/chromium-linux-x86/css2.1/20110323/first-letter-000-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-000-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-001-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-001-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-001-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-001-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-002-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-002-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-003a-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-003a-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-003b-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-003b-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-inherit-001-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-inherit-001-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-001-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-001-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-002-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-002-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-003-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-003-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-004-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-004-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-005-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-005-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-006-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-006-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-007-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-007-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-001-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-001-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-002-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-002-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-003-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-003-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-004-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-004-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-005-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-005-expected.txt: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-006-expected.png: Added.
* platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-006-expected.txt: Added.
* platform/chromium-linux-x86/fast/css/first-letter-nested-positioned-expected.png: Added.
* platform/chromium-linux-x86/fast/css/first-letter-nested-positioned-expected.txt: Added.
* platform/chromium-linux-x86/fast/css/first-letter-quotes-no-content-before-after-expected.png: Added.
* platform/chromium-linux-x86/fast/css/first-letter-quotes-no-content-before-after-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@116438 268f45cc-cd09-0410-ab3c-d52691b4dbfc
71 files changed:
LayoutTests/ChangeLog
LayoutTests/css2.1/20110323/first-letter-000.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-001.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-dynamic-001.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-dynamic-002.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-dynamic-003a.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-dynamic-003b.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-inherit-001.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-nested-001.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-nested-002.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-nested-003.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-nested-004.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-nested-005.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-nested-006.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-nested-007.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-quote-001.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-quote-002.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-quote-003.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-quote-004.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-quote-005.htm [new file with mode: 0644]
LayoutTests/css2.1/20110323/first-letter-quote-006.htm [new file with mode: 0644]
LayoutTests/fast/css/first-letter-capitalized-edit-select-crash-expected.txt
LayoutTests/fast/css/first-letter-nested-positioned.htm [new file with mode: 0644]
LayoutTests/fast/css/first-letter-quotes-no-content-before-after.html [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-000-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-000-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-001-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-001-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-001-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-001-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-002-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-002-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-003a-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-003a-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-003b-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-003b-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-inherit-001-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-inherit-001-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-001-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-001-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-002-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-002-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-003-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-003-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-004-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-004-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-005-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-005-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-006-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-006-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-007-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-007-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-001-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-001-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-002-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-002-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-003-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-003-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-004-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-004-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-005-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-005-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-006-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-006-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/fast/css/first-letter-nested-positioned-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/fast/css/first-letter-nested-positioned-expected.txt [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/fast/css/first-letter-quotes-no-content-before-after-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux-x86/fast/css/first-letter-quotes-no-content-before-after-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h