Ignore:
Timestamp:
Oct 1, 2013, 3:47:49 PM (12 years ago)
Author:
[email protected]
Message:

Quirksmode: CSS1: WebKit fails dynamic :first-letter test
https://bugs.webkit.org/show_bug.cgi?id=15602

Reviewed by David Hyatt.

Source/WebCore:

CSS first-letter property does not work properly when the first letter is changed
by DOM scripting.
This patch allows to check if the existing first-letter is no longer the
first-letter. In this case, it deletes the old first-letter object and creates
a new one. For the remaining text, the oldRemainingText object is used
again for containing the full text(first letter + remaining text).

Test: fast/css/first-letter-block-change.html

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::updateFirstLetter):

LayoutTests:

Add a test case that ensures that CSS first-letter property should work
properly when the first letter is changed by DOM scripting.

  • fast/css/first-letter-block-change.html: Added.
  • platform/efl/TestExpectations:
  • platform/gtk-wk1/fast/css/first-letter-block-change-expected.png: Added.
  • platform/gtk-wk2/fast/css/first-letter-block-change-expected.png: Added.
  • platform/gtk/fast/css/first-letter-block-change-expected.txt: Added.
  • platform/mac/TestExpectations:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r156738 r156742  
    59555955        return;
    59565956
    5957     // FIXME: We need to destroy the first-letter object if it is no longer the first child. Need to find
    5958     // an efficient way to check for that situation though before implementing anything.
    59595957    RenderElement* firstLetterBlock = findFirstLetterBlock(this);
    59605958    if (!firstLetterBlock)
     
    59885986        return;
    59895987
    5990     // If the child already has style, then it has already been created, so we just want
    5991     // to update it.
    59925988    if (descendant->parent()->style()->styleType() == FIRST_LETTER) {
     5989        // Destroy the first-letter object if it is no longer the first child.
     5990        RenderObject* remainingText = descendant->parent()->nextSibling();
     5991        if (remainingText && descendant->node() != remainingText->node()) {
     5992            if (!remainingText->isText() || remainingText->isBR())
     5993                return;
     5994
     5995            LayoutStateDisabler layoutStateDisabler(&view());
     5996
     5997            if (RenderObject* oldRemainingText = toRenderBoxModelObject(descendant->parent())->firstLetterRemainingText())
     5998                toRenderText(oldRemainingText)->setText(toText(oldRemainingText->node())->data().impl());
     5999
     6000            createFirstLetterRenderer(firstLetterBlock, toRenderText(remainingText));
     6001            return;
     6002        }   
     6003
     6004        // If the child already has style, then it has already been created, so we just want
     6005        // to update it.
    59936006        updateFirstLetterStyle(firstLetterBlock, descendant);
    59946007        return;
Note: See TracChangeset for help on using the changeset viewer.