Changeset 130555 in webkit


Ignore:
Timestamp:
Oct 5, 2012 2:54:20 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Inline continuations create :after generated content on style recalcs
https://bugs.webkit.org/show_bug.cgi?id=93170

Patch by Takashi Sakamoto <tasak@google.com> on 2012-10-05
Reviewed by Abhishek Arya.

Source/WebCore:

The bug is caused by RenderInline::styleDidChange's setContinuation(0).
RenderObjectChildList uses continuation to know whether the given
renderer should have AFTER render object or not.
However, setContinuation(0) makes RenderObjectChildList to
misunderstand that all continuations are last continuation.
To avoid the misunderstanding, added a new flag to class
RenderObejctChildList to enable/disable updating :after content (and
also :before content).

Tests: fast/css-generated-content/after-with-inline-continuation.html

fast/css-generated-content/dynamic-apply-after-for-inline.html

  • rendering/RenderInline.cpp:

(WebCore::RenderInline::styleDidChange):
Disable upating :after content for continuations which are not
the last one during setStyle just after setContinuation(0).
The setStyle invokes RenderInline::styleDidChange and also invokes
updateBeforeAfterContent via the styleDidChange. This means,
the last continuation's updateBeforeAfterContent is also invoked
after setContinuation(0). We have to update :after for the last
continuation.

  • rendering/RenderObjectChildList.cpp:

(WebCore):
(WebCore::RenderObjectChildList::updateBeforeAfterContent):
If s_updateBeforeAfterContent is false, quickly exit
updateBeforeAfterContent.

  • rendering/RenderObjectChildList.h:

(RenderObjectChildList):
Added a new flag s_enableUpdateBeforeAfterContent to enable/disable
updating :before or :after content.

LayoutTests:

  • fast/css-generated-content/after-with-inline-continuation-expected.html: Added.
  • fast/css-generated-content/after-with-inline-continuation.html: Added.
  • fast/css-generated-content/dynamic-apply-after-for-inline-expected.html: Added.
  • fast/css-generated-content/dynamic-apply-after-for-inline.html: Added.
  • http/tests/misc/acid3-expected.txt:

The acid3-expected.txt has the duplicate RenderBlock (positioned).
Two 'layer at(638, 18) size 20x20, ... text run at (0,0) width 20: "X"'
exist. So did reset-results for acid3-expected.txt.

Location:
trunk
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r130553 r130555  
     12012-10-05  Takashi Sakamoto  <tasak@google.com>
     2
     3        Inline continuations create :after generated content on style recalcs
     4        https://bugs.webkit.org/show_bug.cgi?id=93170
     5
     6        Reviewed by Abhishek Arya.
     7
     8        * fast/css-generated-content/after-with-inline-continuation-expected.html: Added.
     9        * fast/css-generated-content/after-with-inline-continuation.html: Added.
     10        * fast/css-generated-content/dynamic-apply-after-for-inline-expected.html: Added.
     11        * fast/css-generated-content/dynamic-apply-after-for-inline.html: Added.
     12        * http/tests/misc/acid3-expected.txt:
     13        The acid3-expected.txt has the duplicate RenderBlock (positioned).
     14        Two 'layer at(638, 18) size 20x20, ... text run at (0,0) width 20: "X"'
     15        exist. So did reset-results for acid3-expected.txt.
     16
    1172012-10-05  Tony Chang  <tony@chromium.org>
    218
  • trunk/LayoutTests/http/tests/misc/acid3-expected.txt

    r118566 r130555  
    217217        RenderText {#text} at (299,39) size 4x17
    218218          text run at (299,39) width 4: "."
    219 layer at (638,18) size 20x20
    220   RenderBlock (positioned) at (638,18) size 20x20 [color=#FFFFFF] [bgcolor=#FF00FF]
    221     RenderText at (0,0) size 20x20
    222       text run at (0,0) width 20: "X"
    223219layer at (130,84) size 300x150
    224220  RenderEmbeddedObject {OBJECT} at (130,84) size 300x150
  • trunk/Source/WebCore/ChangeLog

    r130554 r130555  
     12012-10-05  Takashi Sakamoto  <tasak@google.com>
     2
     3        Inline continuations create :after generated content on style recalcs
     4        https://bugs.webkit.org/show_bug.cgi?id=93170
     5
     6        Reviewed by Abhishek Arya.
     7
     8        The bug is caused by RenderInline::styleDidChange's setContinuation(0).
     9        RenderObjectChildList uses continuation to know whether the given
     10        renderer should have AFTER render object or not.
     11        However, setContinuation(0) makes RenderObjectChildList to
     12        misunderstand that all continuations are last continuation.
     13        To avoid the misunderstanding, added a new flag to class
     14        RenderObejctChildList to enable/disable updating :after content (and
     15        also :before content).
     16
     17        Tests: fast/css-generated-content/after-with-inline-continuation.html
     18               fast/css-generated-content/dynamic-apply-after-for-inline.html
     19
     20        * rendering/RenderInline.cpp:
     21        (WebCore::RenderInline::styleDidChange):
     22        Disable upating :after content for continuations which are not
     23        the last one during setStyle just after setContinuation(0).
     24        The setStyle invokes RenderInline::styleDidChange and also invokes
     25        updateBeforeAfterContent via the styleDidChange. This means,
     26        the last continuation's updateBeforeAfterContent is also invoked
     27        after setContinuation(0). We have to update :after for the last
     28        continuation.
     29        * rendering/RenderObjectChildList.cpp:
     30        (WebCore):
     31        (WebCore::RenderObjectChildList::updateBeforeAfterContent):
     32        If s_updateBeforeAfterContent is false, quickly exit
     33        updateBeforeAfterContent.
     34        * rendering/RenderObjectChildList.h:
     35        (RenderObjectChildList):
     36        Added a new flag s_enableUpdateBeforeAfterContent to enable/disable
     37        updating :before or :after content.
     38
    1392012-10-05  Simon Fraser  <simon.fraser@apple.com>
    240
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r130081 r130555  
    4141#include "VisiblePosition.h"
    4242
     43#include <wtf/TemporaryChange.h>
     44
    4345#if ENABLE(DASHBOARD_SUPPORT) || ENABLE(WIDGET_REGION)
    4446#include "Frame.h"
     
    168170    RenderStyle* newStyle = style();
    169171    RenderInline* continuation = inlineElementContinuation();
    170     for (RenderInline* currCont = continuation; currCont; currCont = currCont->inlineElementContinuation()) {
    171         RenderBoxModelObject* nextCont = currCont->continuation();
    172         currCont->setContinuation(0);
    173         currCont->setStyle(newStyle);
    174         currCont->setContinuation(nextCont);
     172    {
     173        TemporaryChange<bool> enableAfter(RenderObjectChildList::s_enableUpdateBeforeAfterContent, false);
     174        RenderInline* nextInlineElementCont = 0;
     175        for (RenderInline* currCont = continuation; currCont; currCont = nextInlineElementCont) {
     176            nextInlineElementCont = currCont->inlineElementContinuation();
     177            // We need to update :after content for the last continuation in the chain.
     178            RenderObjectChildList::s_enableUpdateBeforeAfterContent = !nextInlineElementCont;
     179            RenderBoxModelObject* nextCont = currCont->continuation();
     180            currCont->setContinuation(0);
     181            currCont->setStyle(newStyle);
     182            currCont->setContinuation(nextCont);
     183        }
    175184    }
    176185
  • trunk/Source/WebCore/rendering/RenderObjectChildList.cpp

    r129423 r130555  
    4646namespace WebCore {
    4747
     48bool RenderObjectChildList::s_enableUpdateBeforeAfterContent = true;
     49
    4850void RenderObjectChildList::destroyLeftoverChildren()
    4951{
     
    375377    if (owner->style()->styleType() == BEFORE || owner->style()->styleType() == AFTER)
    376378        return;
     379    if (!s_enableUpdateBeforeAfterContent)
     380        return;
    377381   
    378382    if (!styledObject)
  • trunk/Source/WebCore/rendering/RenderObjectChildList.h

    r126048 r130555  
    6161    RenderObject* afterPseudoElementRenderer(const RenderObject* owner) const;
    6262
     63public:
     64    static bool s_enableUpdateBeforeAfterContent;
     65
    6366private:
    6467    void updateBeforeAfterStyle(RenderObject* child, PseudoId type, RenderStyle* pseudoElementStyle);
Note: See TracChangeset for help on using the changeset viewer.