Commit c76605ad authored by mitz@apple.com's avatar mitz@apple.com

WebCore:

        Reviewed by Darin Adler.

        - make :first-letter apply to the first letter in normal flow, skipping
          floats and positioned objects

        Test: fast/css/first-letter-skip-out-of-flow.html

        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::updateFirstLetter):

LayoutTests:

        Reviewed by Darin Adler.

        - test that :first-letter applies to the first letter in normal flow,
          skipping floats and positioned objects

        * fast/css/first-letter-skip-out-of-flow.html: Added.
        * platform/mac-leopard/fast/css/first-letter-skip-out-of-flow-expected.checksum: Added.
        * platform/mac-leopard/fast/css/first-letter-skip-out-of-flow-expected.png: Added.
        * platform/mac/fast/css/first-letter-skip-out-of-flow-expected.txt: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@30724 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 31f4ae60
2008-03-03 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
- test that :first-letter applies to the first letter in normal flow,
skipping floats and positioned objects
* fast/css/first-letter-skip-out-of-flow.html: Added.
* platform/mac-leopard/fast/css/first-letter-skip-out-of-flow-expected.checksum: Added.
* platform/mac-leopard/fast/css/first-letter-skip-out-of-flow-expected.png: Added.
* platform/mac/fast/css/first-letter-skip-out-of-flow-expected.txt: Added.
2008-03-03 Mark Rowe <mrowe@apple.com>
Reviewed by Dan Bernstein.
<style>
.greenFirstLetter:first-letter { color: green; }
</style>
<p>
All the X&rsquo;s below should be green. All other letters should be black.
</p>
<div class="greenFirstLetter">
XY
</div>
<div class="greenFirstLetter">
<img>YZ
</div>
<div class="greenFirstLetter">
<img align="left">XY
</div>
<div class="greenFirstLetter">
<div style="position: absolute; left: 100px;">VW</div>XY
</div>
<div class="greenFirstLetter">
<div>
<div style="position: absolute; left: 100px;">VW</div>XY
</div>
</div>
<div class="greenFirstLetter">
<div>
<img>
<div style="position: absolute; left: 100px;">VW</div>YZ
</div>
</div>
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 784x584
RenderBlock {P} at (0,0) size 784x18
RenderText {#text} at (0,0) size 429x18
text run at (0,0) width 429: "All the X\x{2019}s below should be green. All other letters should be black."
RenderBlock {DIV} at (0,34) size 784x18
RenderInline (generated) at (0,0) size 12x18 [color=#008000]
RenderText {#text} at (0,0) size 12x18
text run at (0,0) width 12: "X"
RenderText {#text} at (12,0) size 12x18
text run at (12,0) width 12: "Y"
RenderBlock {DIV} at (0,52) size 784x18
RenderImage {IMG} at (0,14) size 0x0
RenderText {#text} at (0,0) size 22x18
text run at (0,0) width 22: "YZ"
RenderBlock {DIV} at (0,70) size 784x18
RenderInline (generated) at (0,0) size 12x18 [color=#008000]
RenderText {#text} at (0,0) size 12x18
text run at (0,0) width 12: "X"
RenderImage {IMG} at (0,0) size 0x0
RenderText {#text} at (12,0) size 12x18
text run at (12,0) width 12: "Y"
RenderBlock {DIV} at (0,88) size 784x18
RenderInline (generated) at (0,0) size 12x18 [color=#008000]
RenderText {#text} at (0,0) size 12x18
text run at (0,0) width 12: "X"
RenderText {#text} at (12,0) size 12x18
text run at (12,0) width 12: "Y"
RenderBlock {DIV} at (0,106) size 784x18
RenderBlock {DIV} at (0,0) size 784x18
RenderInline (generated) at (0,0) size 12x18 [color=#008000]
RenderText {#text} at (0,0) size 12x18
text run at (0,0) width 12: "X"
RenderText {#text} at (12,0) size 12x18
text run at (12,0) width 12: "Y"
RenderBlock {DIV} at (0,124) size 784x18
RenderBlock {DIV} at (0,0) size 784x18
RenderImage {IMG} at (0,14) size 0x0
RenderText {#text} at (0,0) size 4x18
text run at (0,0) width 4: " "
RenderText {#text} at (4,0) size 22x18
text run at (4,0) width 22: "YZ"
layer at (100,114) size 27x18
RenderBlock (positioned) {DIV} at (100,114) size 27x18
RenderText {#text} at (0,0) size 27x18
text run at (0,0) width 27: "VW"
layer at (100,132) size 27x18
RenderBlock (positioned) {DIV} at (100,132) size 27x18
RenderText {#text} at (0,0) size 27x18
text run at (0,0) width 27: "VW"
layer at (100,150) size 27x18
RenderBlock (positioned) {DIV} at (100,150) size 27x18
RenderText {#text} at (0,0) size 27x18
text run at (0,0) width 27: "VW"
2008-03-03 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler.
- make :first-letter apply to the first letter in normal flow, skipping
floats and positioned objects
Test: fast/css/first-letter-skip-out-of-flow.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::updateFirstLetter):
2008-03-03 Ada Chan <adachan@apple.com>
Fix build.
......@@ -4081,19 +4081,23 @@ void RenderBlock::updateFirstLetter()
if (!hasPseudoStyle)
return;
// Drill into inlines looking for our first text child.
RenderObject* currChild = firstLetterBlock->firstChild();
while (currChild && currChild->needsLayout() && !currChild->isReplaced() && !currChild->isText())
currChild = currChild->firstChild();
while (currChild && currChild->needsLayout() && (!currChild->isReplaced() || currChild->isFloatingOrPositioned()) && !currChild->isText()) {
if (currChild->isFloatingOrPositioned())
currChild = currChild->nextSibling();
else
currChild = currChild->firstChild();
}
// Get list markers out of the way.
while (currChild && currChild->isListMarker())
currChild = currChild->nextSibling();
if (!currChild)
return;
RenderObject* firstLetterContainer = currChild->parent();
// If the child already has style, then it has already been created, so we just want
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment