[CSS Grid Layout] Ignore ::first-letter pseudo-element
authorrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Sep 2014 21:58:11 +0000 (21:58 +0000)
committerrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Sep 2014 21:58:11 +0000 (21:58 +0000)
commita566a3386dce5eaff1cd58c0b0081af44abdea7b
tree75abb4c573cb48435793921ea1d0bdac3866f614
parent2079b15c698cc56786cb6d43f45aaef90da058f7
[CSS Grid Layout] Ignore ::first-letter pseudo-element
https://bugs.webkit.org/show_bug.cgi?id=136625

Reviewed by Darin Adler.

Source/WebCore:

According to the spec the ::first-letter pseudo-element do not apply to
grid containers (neither to flexboxes).

Fixed issue in RenderBlock::getFirstLetter() that applies to both grids
and flexboxes. Basically if the grid's or flexbox's container was
defining the ::first-line pseudo-element and the grid or flexbox itself
too, the value from the grid or flexbox was being applied to the items.
Added the proper check to avoid this.

Added two new tests for grid and modified one flexbox test to cover the
issue explained above.

Tests: css3/flexbox/flexbox-ignore-container-firstLetter.html
       fast/css-grid-layout/grid-container-ignore-first-letter.html
       fast/css-grid-layout/grid-item-first-letter-valid.html

* rendering/RenderBlock.cpp:
(WebCore::isRenderBlockFlowOrRenderButton): New method refactoring
similar calls through the source code.
(WebCore::RenderBlock::firstLineBlock): Use
isRenderBlockFlowOrRenderButton().
(WebCore::findFirstLetterBlock): Modify it to use
isRenderBlockFlowOrRenderButton() in order to include grids and not only
check flexboxes.
(WebCore::RenderBlock::getFirstLetter): Use
isRenderBlockFlowOrRenderButton().
(WebCore::RenderBlock::updateFirstLetter): Early return if
firstLetterContainer is null (in the case of flexboxes or grids).

LayoutTests:

* css3/flexbox/flexbox-ignore-container-firstLetter.html: Modify test,
in order to actually check that the ::first-letter in a regular
container is ignored in the flexbox.
* fast/css-grid-layout/grid-container-ignore-first-letter-expected.txt: Added.
* fast/css-grid-layout/grid-container-ignore-first-letter.html: Added.
* fast/css-grid-layout/grid-item-first-letter-valid-expected.txt: Added.
* fast/css-grid-layout/grid-item-first-letter-valid.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173444 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/css3/flexbox/flexbox-ignore-container-firstLetter.html
LayoutTests/fast/css-grid-layout/grid-container-ignore-first-letter-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-container-ignore-first-letter.html [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-item-first-letter-valid-expected.txt [new file with mode: 0644]
LayoutTests/fast/css-grid-layout/grid-item-first-letter-valid.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp