[Webkit-unassigned] [Bug 30708] ::first-letter inherits from ::after pseudo-element

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri May 28 02:53:15 PDT 2010


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


Yoshiki Hayashi <yhayashi at google.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hamaji at chromium.org,
                   |                            |hyatt at apple.com,
                   |                            |yhayashi at google.com




--- Comment #2 from Yoshiki Hayashi <yhayashi at google.com>  2010-05-28 02:53:14 PST ---
I investigated the bug and found that updateFirstLetter is called twice on the same node, one coming from HTMLParser::insertNode and other from RenderView::layout.  I copy pasted two stack traces below.  With some printf debugging, what I found out was that in the first call, the P node which has both :first-letter and :after has only the content of :after as a child and not the body of P.  So when updateFirstLetter is called, the first letter block inherits from the first line style which happens to be the style of :after and thus it inherits those properties instead of the one from the body of P.

The fix was simple, just removing updateFirstLetter call from styleDidChange as it will be called from the first thing in the layout anyways.

I'm going to attach a patch for this.  The included test depends on bug https://bugs.webkit.org/show_bug.cgi?id=39863 because otherwise first-letter doesn't show up in dumpAsText.

# 1st call
#0  WebCore::RenderBlock::updateFirstLetter (this=0xbed878)
    at ../../../WebCore/rendering/RenderBlock.cpp:4639
#1  0x00007ffff672e906 in WebCore::RenderBlock::styleDidChange (this=0xbed878, 
    diff=WebCore::StyleDifferenceEqual, oldStyle=0x0)
    at ../../../WebCore/rendering/RenderBlock.cpp:251
#2  0x00007ffff67a988f in WebCore::RenderObject::setStyle (this=0xbed878, 
    style=...) at ../../../WebCore/rendering/RenderObject.cpp:1545
#3  0x00007ffff67a73a0 in WebCore::RenderObject::setAnimatableStyle (
    this=0xbed878, style=...)
    at ../../../WebCore/rendering/RenderObject.cpp:1479
#4  0x00007ffff6347d5b in WebCore::Node::createRendererIfNeeded (this=0xbb7b40)
    at ../../../WebCore/dom/Node.cpp:1359
#5  0x00007ffff63175df in WebCore::Element::attach (this=0xbb7b40)
    at ../../../WebCore/dom/Element.cpp:820
#6  0x00007ffff64a8174 in WebCore::HTMLParser::insertNode (this=0xbe5650, 
    n=0xbb7b40, flat=false) at ../../../WebCore/html/HTMLParser.cpp:403
#7  0x00007ffff64aa726 in WebCore::HTMLParser::insertNodeAfterLimitDepth (
    this=0xbe5650, n=0xbb7b40, flat=false)
    at ../../../WebCore/html/HTMLParser.cpp:234
#8  0x00007ffff64aaf53 in WebCore::HTMLParser::parseToken (this=0xbe5650, 
    t=0xb5e5f8) at ../../../WebCore/html/HTMLParser.cpp:306
#9  0x00007ffff64bfe59 in WebCore::HTMLTokenizer::processToken (this=0xbc0ee0)
#10 0x00007ffff64c814f in WebCore::HTMLTokenizer::parseTag (this=0xbc0ee0,
    src=..., state=...) at ../../../WebCore/html/HTMLTokenizer.cpp:1513
#11 0x00007ffff64c8cae in WebCore::HTMLTokenizer::advance (this=0xbc0ee0,
    state=...) at ../../../WebCore/html/HTMLTokenizer.cpp:1702

#2nd call
#0  WebCore::RenderBlock::updateFirstLetter (this=0xbed878)
    at ../../../WebCore/rendering/RenderBlock.cpp:4639
#1  0x00007ffff672d052 in WebCore::RenderBlock::layout (this=0xbed878)
    at ../../../WebCore/rendering/RenderBlock.cpp:667
#2  0x00007ffff672bf4d in WebCore::RenderBlock::layoutBlockChild (
    this=0xbf00b8, child=0xbed878, marginInfo=..., 
    previousFloatBottom=@0x7fffffffbed4, maxFloatBottom=@0x7fffffffc024)
    at ../../../WebCore/rendering/RenderBlock.cpp:1364
#3  0x00007ffff672cd78 in WebCore::RenderBlock::layoutBlockChildren (
    this=0xbf00b8, relayoutChildren=true, maxFloatBottom=@0x7fffffffc024)
    at ../../../WebCore/rendering/RenderBlock.cpp:1307
#4  0x00007ffff672d777 in WebCore::RenderBlock::layoutBlock (this=0xbf00b8, 
    relayoutChildren=true) at ../../../WebCore/rendering/RenderBlock.cpp:749
#5  0x00007ffff672d06d in WebCore::RenderBlock::layout (this=0xbf00b8)
    at ../../../WebCore/rendering/RenderBlock.cpp:671
#6  0x00007ffff672bf4d in WebCore::RenderBlock::layoutBlockChild (
    this=0xbee9e8, child=0xbf00b8, marginInfo=..., 
    previousFloatBottom=@0x7fffffffc294, maxFloatBottom=@0x7fffffffc3e4)
    at ../../../WebCore/rendering/RenderBlock.cpp:1364
#7  0x00007ffff672cd78 in WebCore::RenderBlock::layoutBlockChildren (
    this=0xbee9e8, relayoutChildren=true, maxFloatBottom=@0x7fffffffc3e4)
    at ../../../WebCore/rendering/RenderBlock.cpp:1307
#8  0x00007ffff672d777 in WebCore::RenderBlock::layoutBlock (this=0xbee9e8, 
    relayoutChildren=true) at ../../../WebCore/rendering/RenderBlock.cpp:749
#9  0x00007ffff672d06d in WebCore::RenderBlock::layout (this=0xbee9e8)
    at ../../../WebCore/rendering/RenderBlock.cpp:671
#10 0x00007ffff672bf4d in WebCore::RenderBlock::layoutBlockChild (
    this=0xbe53b8, child=0xbee9e8, marginInfo=..., 
    previousFloatBottom=@0x7fffffffc654, maxFloatBottom=@0x7fffffffc7a4)
    at ../../../WebCore/rendering/RenderBlock.cpp:1364
#11 0x00007ffff672cd78 in WebCore::RenderBlock::layoutBlockChildren (
    this=0xbe53b8, relayoutChildren=true, maxFloatBottom=@0x7fffffffc7a4)
    at ../../../WebCore/rendering/RenderBlock.cpp:1307
#12 0x00007ffff672d777 in WebCore::RenderBlock::layoutBlock (this=0xbe53b8, 
    relayoutChildren=true) at ../../../WebCore/rendering/RenderBlock.cpp:749
#13 0x00007ffff672d06d in WebCore::RenderBlock::layout (this=0xbe53b8)
    at ../../../WebCore/rendering/RenderBlock.cpp:671
#14 0x00007ffff67f0dbc in WebCore::RenderView::layout (this=0xbe53b8)
    at ../../../WebCore/rendering/RenderView.cpp:123
#15 0x00007ffff6619aec in WebCore::FrameView::layout (this=0xb5f470, 
    allowSubtree=true) at ../../../WebCore/page/FrameView.cpp:749
#16 0x00007ffff62fc0a5 in WebCore::Document::implicitClose (this=0xbc0ee0)
    at ../../../WebCore/dom/Document.cpp:1884
#17 0x00007ffff656e051 in WebCore::FrameLoader::checkCallImplicitClose (

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list