Changeset 59247 in webkit


Ignore:
Timestamp:
May 12, 2010 12:03:58 PM (14 years ago)
Author:
hyatt@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=38891

Reviewed by Darin Adler.

First-letter had a number of bugs that were exposed by my attempt to optimize the setting of styles when updating first-letter.
The code that drills down to find the first-letter child stopped if it hit an element that didn't need layout. This means it could
return random incorrect results (and cause the first-letter object to not be found).

In addition when the first-letter was floated/positioned, the text child was not correctly returned, but the container itself was
returned instead.

Finally, the updating code was leaving the box that wrapped the first letter text with a stale style. The old code happened to work because
it made new styles for the text elements instead of using the enclosing box style. The regression was caused by my change to make the
text children simply share style with their parent (thus making the bug that the parent had the wrong style become more prominent).

No new tests, since there's a timing component to reproducing the issue.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::updateFirstLetter):

Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r59245 r59247  
     12010-05-12  David Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=38891
     6
     7        First-letter had a number of bugs that were exposed by my attempt to optimize the setting of styles when updating first-letter.
     8        The code that drills down to find the first-letter child stopped if it hit an element that didn't need layout.  This means it could
     9        return random incorrect results (and cause the first-letter object to not be found).
     10
     11        In addition when the first-letter was floated/positioned, the text child was not correctly returned, but the container itself was
     12        returned instead.
     13
     14        Finally, the updating code was leaving the box that wrapped the first letter text with a stale style.  The old code happened to work because
     15        it made new styles for the text elements instead of using the enclosing box style.  The regression was caused by my change to make the
     16        text children simply share style with their parent (thus making the bug that the parent had the wrong style become more prominent).
     17
     18        No new tests, since there's a timing component to reproducing the issue.
     19
     20        * rendering/RenderBlock.cpp:
     21        (WebCore::RenderBlock::updateFirstLetter):
     22
    1232010-05-12  Enrica Casucci  <enrica@apple.com>
    224
  • trunk/WebCore/rendering/RenderBlock.cpp

    r59245 r59247  
    46504650    // Drill into inlines looking for our first text child.
    46514651    RenderObject* currChild = firstLetterBlock->firstChild();
    4652     while (currChild && currChild->needsLayout() && ((!currChild->isReplaced() && !currChild->isRenderButton() && !currChild->isMenuList()) || currChild->isFloatingOrPositioned()) && !currChild->isText()) {
     4652    while (currChild && ((!currChild->isReplaced() && !currChild->isRenderButton() && !currChild->isMenuList()) || currChild->isFloatingOrPositioned()) && !currChild->isText()) {
    46534653        if (currChild->isFloatingOrPositioned()) {
    4654             if (currChild->style()->styleType() == FIRST_LETTER)
     4654            if (currChild->style()->styleType() == FIRST_LETTER) {
     4655                currChild = currChild->firstChild();
    46554656                break;
     4657            }
    46564658            currChild = currChild->nextSibling();
    46574659        } else
     
    46704672    // If the child already has style, then it has already been created, so we just want
    46714673    // to update it.
    4672     if (currChild->style()->styleType() == FIRST_LETTER) {
     4674    if (firstLetterContainer->style()->styleType() == FIRST_LETTER) {
    46734675        RenderStyle* pseudo = firstLetterBlock->getCachedPseudoStyle(FIRST_LETTER,
    4674                                                                      firstLetterContainer->firstLineStyle());
    4675         currChild->setStyle(pseudo);
    4676         for (RenderObject* genChild = currChild->firstChild(); genChild; genChild = genChild->nextSibling()) {
     4676                                                                     firstLetterContainer->parent()->firstLineStyle());
     4677        firstLetterContainer->setStyle(pseudo);
     4678        for (RenderObject* genChild = firstLetterContainer->firstChild(); genChild; genChild = genChild->nextSibling()) {
    46774679            if (genChild->isText())
    46784680                genChild->setStyle(pseudo);
Note: See TracChangeset for help on using the changeset viewer.