Changeset 49225 in webkit


Ignore:
Timestamp:
Oct 6, 2009 11:20:02 PM (15 years ago)
Author:
hamaji@chromium.org
Message:

2009-10-07 Shinichiro Hamaji <hamaji@chromium.org>

Reviewed by Eric Seidel.

Dual lines in css2.1 layout tests do not match:
https://bugs.webkit.org/show_bug.cgi?id=23262

Now we can put a counter node as the next sibling of a reset node.
Re-layout the counter content when the count is updated.

Tests: fast/css/counters/t1204-increment-00-c-o.html

fast/css/counters/t1204-increment-01-c-o.html

  • rendering/CounterNode.cpp: (WebCore::CounterNode::recount):
  • rendering/RenderCounter.cpp: (WebCore::findPlaceForCounter):

2009-10-07 Shinichiro Hamaji <hamaji@chromium.org>

Reviewed by Eric Seidel.

Dual lines in css2.1 layout tests do not match:
https://bugs.webkit.org/show_bug.cgi?id=23262

Now we can put a counter node as the next sibling of a reset node.
Re-layout the counter content when the count is updated.

  • fast/css/counters/t1204-increment-00-c-o.html: Added.
  • fast/css/counters/t1204-increment-01-c-o.html: Added.
  • platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.checksum: Added.
  • platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.png: Added.
  • platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.txt: Added.
  • platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.checksum: Added.
  • platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.png: Added.
  • platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.txt: Added.
Location:
trunk
Files:
8 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r49214 r49225  
     12009-10-07  Shinichiro Hamaji  <hamaji@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Dual lines in css2.1 layout tests do not match:
     6        https://bugs.webkit.org/show_bug.cgi?id=23262
     7
     8        Now we can put a counter node as the next sibling of a reset node.
     9        Re-layout the counter content when the count is updated.
     10
     11        * fast/css/counters/t1204-increment-00-c-o.html: Added.
     12        * fast/css/counters/t1204-increment-01-c-o.html: Added.
     13        * platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.checksum: Added.
     14        * platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.png: Added.
     15        * platform/mac/fast/css/counters/t1204-increment-00-c-o-expected.txt: Added.
     16        * platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.checksum: Added.
     17        * platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.png: Added.
     18        * platform/mac/fast/css/counters/t1204-increment-01-c-o-expected.txt: Added.
     19
    1202009-10-05  Oliver Hunt  <oliver@apple.com>
    221
  • trunk/WebCore/ChangeLog

    r49223 r49225  
     12009-10-07  Shinichiro Hamaji  <hamaji@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        Dual lines in css2.1 layout tests do not match:
     6        https://bugs.webkit.org/show_bug.cgi?id=23262
     7
     8        Now we can put a counter node as the next sibling of a reset node.
     9        Re-layout the counter content when the count is updated.
     10
     11        Tests: fast/css/counters/t1204-increment-00-c-o.html
     12               fast/css/counters/t1204-increment-01-c-o.html
     13
     14        * rendering/CounterNode.cpp:
     15        (WebCore::CounterNode::recount):
     16        * rendering/RenderCounter.cpp:
     17        (WebCore::findPlaceForCounter):
     18
    1192009-10-06  Xan Lopez  <xlopez@igalia.com>
    220
  • trunk/WebCore/rendering/CounterNode.cpp

    r47583 r49225  
    6464        int oldCount = c->m_countInParent;
    6565        int newCount = c->computeCountInParent();
    66         c->m_countInParent = newCount;
    6766        if (oldCount == newCount)
    6867            break;
    69         if (c->m_renderer->isCounter())
    70             c->m_renderer->setNeedsLayoutAndPrefWidthsRecalc();
     68        c->m_countInParent = newCount;
     69        // m_renderer contains the parent of the render node
     70        // corresponding to a CounterNode. Let's find the counter
     71        // child and make this re-layout.
     72        for (RenderObject* o = c->m_renderer->firstChild(); o; o = o->nextSibling())
     73            if (!o->documentBeingDestroyed() && o->isCounter()) {
     74                o->setNeedsLayoutAndPrefWidthsRecalc();
     75                break;
     76            }
    7177    }
    7278}
  • trunk/WebCore/rendering/RenderCounter.cpp

    r46815 r49225  
    144144    RenderObject* prevCounterCandidate = object;
    145145    CounterNode* candidateCounter = 0;
     146    // When a reset counter is chosen as candidateCounter, we'll
     147    // decide the new node should be a child of the reset node or a
     148    // sibling or the reset node. This flag controls it.
     149    bool createChildForReset = true;
    146150    while ((prevCounterCandidate = prevCounterCandidate->previousInPreOrder())) {
    147151        CounterNode* c = counter(prevCounterCandidate, counterName, false);
    148152        if (prevCounterCandidate == resetCandidate) {
    149             if (!candidateCounter)
     153            if (!candidateCounter) {
    150154                candidateCounter = c;
     155                createChildForReset = true;
     156            }
    151157            if (candidateCounter) {
    152                 if (candidateCounter->isReset()) {
     158                if (createChildForReset && candidateCounter->isReset()) {
    153159                    parent = candidateCounter;
    154160                    previousSibling = 0;
     
    161167            resetCandidate = previousSiblingOrParent(resetCandidate);
    162168        } else if (c) {
    163             if (c->isReset())
    164                 candidateCounter = 0;
    165             else if (!candidateCounter)
     169            if (c->isReset()) {
     170                if (c->parent()) {
     171                    // The new node may be the next sibling of this reset node.
     172                    createChildForReset = false;
     173                    candidateCounter = c;
     174                } else {
     175                    createChildForReset = true;
     176                    candidateCounter = 0;
     177                }
     178            } else if (!candidateCounter) {
     179                createChildForReset = true;
    166180                candidateCounter = c;
     181            }
    167182        }
    168183    }
Note: See TracChangeset for help on using the changeset viewer.