Changeset 53506 in webkit


Ignore:
Timestamp:
Jan 19, 2010 4:09:18 PM (14 years ago)
Author:
eric@webkit.org
Message:

2010-01-19 Carol Szabo <carol.szabo@nokia.com>

Reviewed by Darin Adler.

Another crazy counters bug
https://bugs.webkit.org/show_bug.cgi?id=11031
Added tests for dynamic DOM changes affecting counters.

  • fast/css/counters/counter-increment-002.html: Added.
  • fast/css/counters/counter-reset-000.html: Added.
  • fast/css/counters/counter-reset-002.html: Added.
  • fast/css/counters/counter-increment-002-expected.txt: Added.
  • fast/css/counters/counter-reset-000-expected.txt: Added.
  • fast/css/counters/counter-reset-002-expected.txt: Added.

2010-01-19 Carol Szabo <carol.szabo@nokia.com>

Reviewed by Darin Adler.

Another crazy counters bug
https://bugs.webkit.org/show_bug.cgi?id=11031

This patch actually provides for counter updating when the style
of a renderer changes.

Tests: fast/css/counters/counter-increment-002.html

fast/css/counters/counter-reset-000.html
fast/css/counters/counter-reset-002.html

  • rendering/RenderCounter.cpp: (WebCore::RenderCounter::rendererStyleChanged): This function is added to update the counter hierarchy in response to changes to the style of a renderer.
  • rendering/RenderCounter.h:
  • rendering/RenderObject.cpp: (WebCore::RenderObject::styleDidChange): For changes that may include the counter directives added a call to RenderCounter::rendererStyleChanged.
Location:
trunk
Files:
6 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r53504 r53506  
     12010-01-19  Carol Szabo  <carol.szabo@nokia.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Another crazy counters bug
     6        https://bugs.webkit.org/show_bug.cgi?id=11031
     7        Added tests for dynamic DOM changes affecting counters.
     8
     9        * fast/css/counters/counter-increment-002.html: Added.
     10        * fast/css/counters/counter-reset-000.html: Added.
     11        * fast/css/counters/counter-reset-002.html: Added.
     12        * fast/css/counters/counter-increment-002-expected.txt: Added.
     13        * fast/css/counters/counter-reset-000-expected.txt: Added.
     14        * fast/css/counters/counter-reset-002-expected.txt: Added.
     15
    1162010-01-19  Alexey Proskuryakov  <ap@apple.com>
    217
  • trunk/WebCore/ChangeLog

    r53503 r53506  
     12010-01-19  Carol Szabo  <carol.szabo@nokia.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Another crazy counters bug
     6        https://bugs.webkit.org/show_bug.cgi?id=11031
     7
     8        This patch actually provides for counter updating when the style
     9        of a renderer changes.
     10
     11        Tests: fast/css/counters/counter-increment-002.html
     12               fast/css/counters/counter-reset-000.html
     13               fast/css/counters/counter-reset-002.html
     14
     15        * rendering/RenderCounter.cpp:
     16        (WebCore::RenderCounter::rendererStyleChanged):
     17        This function is added to update the counter hierarchy in
     18        response to changes to the style of a renderer.
     19        * rendering/RenderCounter.h:
     20        * rendering/RenderObject.cpp:
     21        (WebCore::RenderObject::styleDidChange):
     22        For changes that may include the counter directives added a
     23        call to RenderCounter::rendererStyleChanged.
     24
    1252010-01-19  Gustavo Noronha Silva  <gns@gnome.org>
    226
  • trunk/WebCore/rendering/RenderCounter.cpp

    r53355 r53506  
    441441}
    442442
     443void RenderCounter::rendererStyleChanged(RenderObject* renderer, const RenderStyle* oldStyle, const RenderStyle* newStyle)
     444{
     445    const CounterDirectiveMap* newCounterDirectives;
     446    const CounterDirectiveMap* oldCounterDirectives;
     447    if (oldStyle && (oldCounterDirectives = oldStyle->counterDirectives())) {
     448        if (newStyle && (newCounterDirectives = newStyle->counterDirectives())) {
     449            CounterDirectiveMap::const_iterator newMapEnd = newCounterDirectives->end();
     450            CounterDirectiveMap::const_iterator oldMapEnd = oldCounterDirectives->end();
     451            for (CounterDirectiveMap::const_iterator it = newCounterDirectives->begin(); it != newMapEnd; ++it) {
     452                CounterDirectiveMap::const_iterator oldMapIt = oldCounterDirectives->find(it->first);
     453                if (oldMapIt != oldMapEnd) {
     454                    if (oldMapIt->second == it->second)
     455                        continue;
     456                    RenderCounter::destroyCounterNode(renderer, it->first.get());
     457                }
     458                // We must create this node here, because the changed node may be a node with no display such as
     459                // as those created by the increment or reset directives and the re-layout that will happen will
     460                // not catch the change if the node had no children.
     461                makeCounterNode(renderer, it->first.get(), false);
     462            }
     463            // Destroying old counters that do not exist in the new counterDirective map.
     464            for (CounterDirectiveMap::const_iterator it = oldCounterDirectives->begin(); it !=oldMapEnd; ++it) {
     465                if (!newCounterDirectives->contains(it->first))
     466                    RenderCounter::destroyCounterNode(renderer, it->first.get());
     467            }
     468        } else {
     469            if (renderer->m_hasCounterNodeMap)
     470                RenderCounter::destroyCounterNodes(renderer);
     471        }
     472    } else if (newStyle && (newCounterDirectives = newStyle->counterDirectives())) {
     473        CounterDirectiveMap::const_iterator newMapEnd = newCounterDirectives->end();
     474        for (CounterDirectiveMap::const_iterator it = newCounterDirectives->begin(); it != newMapEnd; ++it) {
     475            // We must create this node here, because the added node may be a node with no display such as
     476            // as those created by the increment or reset directives and the re-layout that will happen will
     477            // not catch the change if the node had no children.
     478            makeCounterNode(renderer, it->first.get(), false);
     479        }
     480    }
     481}
     482
    443483} // namespace WebCore
  • trunk/WebCore/rendering/RenderCounter.h

    r53355 r53506  
    4343    static void destroyCounterNode(RenderObject*, const AtomicString& identifier);
    4444    static void rendererSubtreeAttached(RenderObject*);
     45    static void rendererStyleChanged(RenderObject*, const RenderStyle* oldStyle, const RenderStyle* newStyle);
    4546
    4647private:
  • trunk/WebCore/rendering/RenderObject.cpp

    r53476 r53506  
    16741674}
    16751675
    1676 void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle*)
     1676void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
    16771677{
    16781678    if (s_affectsParentBlock)
     
    16821682        return;
    16831683   
    1684     if (diff == StyleDifferenceLayout)
     1684    if (diff == StyleDifferenceLayout) {
     1685        RenderCounter::rendererStyleChanged(this, oldStyle, m_style.get());
    16851686        setNeedsLayoutAndPrefWidthsRecalc();
    1686     else if (diff == StyleDifferenceLayoutPositionedMovementOnly)
     1687    } else if (diff == StyleDifferenceLayoutPositionedMovementOnly)
    16871688        setNeedsPositionedMovementLayout();
    16881689
Note: See TracChangeset for help on using the changeset viewer.