Changeset 47200 in webkit


Ignore:
Timestamp:
Aug 13, 2009 9:16:11 AM (15 years ago)
Author:
eric@webkit.org
Message:

2009-08-13 Shinichiro Hamaji <hamaji@chromium.org>

Reviewed by Eric Seidel.

wrong calculation of overflow size for flexbox and table
https://bugs.webkit.org/show_bug.cgi?id=28064

RenderFlexibleBox and RenderTable were using the width of overflow
to update height of overflow, so height became wrong value and
width was not updated. As the corresponding code of RenderBlock
was sane, I factored it out and used from RenderFlexibleBox and
RenderTable.

  • fast/reflections/reflection-overflow-scroll-expected.txt:
  • fast/reflections/reflection-overflow-scroll.html:
  • fast/reflections/resources/reflection-overflow-scroll.js:

2009-08-13 Shinichiro Hamaji <hamaji@chromium.org>

Reviewed by Eric Seidel.

wrong calculation of overflow size for flexbox and table
https://bugs.webkit.org/show_bug.cgi?id=28064

RenderFlexibleBox and RenderTable were using the width of overflow
to update height of overflow, so height became wrong value and
width was not updated. As the corresponding code of RenderBlock
was sane, I factored it out and used from RenderFlexibleBox and
RenderTable.

  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::updateOverflowWithShadowAndReflection): created from code of layoutBlock (WebCore::RenderBlock::layoutBlock):
  • rendering/RenderBlock.h:
  • rendering/RenderFlexibleBox.cpp: use updateOverflowWithShadowAndReflection (WebCore::RenderFlexibleBox::layoutBlock):
  • rendering/RenderTable.cpp: (WebCore::RenderTable::layout): use updateOverflowWithShadowAndReflection
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r47196 r47200  
     12009-08-13  Shinichiro Hamaji  <hamaji@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        wrong calculation of overflow size for flexbox and table
     6        https://bugs.webkit.org/show_bug.cgi?id=28064
     7
     8        RenderFlexibleBox and RenderTable were using the width of overflow
     9        to update height of overflow, so height became wrong value and
     10        width was not updated. As the corresponding code of RenderBlock
     11        was sane, I factored it out and used from RenderFlexibleBox and
     12        RenderTable.
     13
     14        * fast/reflections/reflection-overflow-scroll-expected.txt:
     15        * fast/reflections/reflection-overflow-scroll.html:
     16        * fast/reflections/resources/reflection-overflow-scroll.js:
     17
    1182009-08-13  Ariya Hidayat  <ariya.hidayat@nokia.com>
    219
  • trunk/LayoutTests/fast/reflections/reflection-overflow-scroll-expected.txt

    r46889 r47200  
    66PASS element.scrollLeft is 150
    77PASS element.scrollTop is 80
     8PASS element.scrollLeft is 150
     9PASS element.scrollTop is 80
     10PASS element.scrollLeft is 150
     11PASS element.scrollTop is 80
    812PASS successfullyParsed is true
    913
  • trunk/LayoutTests/fast/reflections/reflection-overflow-scroll.html

    r46889 r47200  
    3030</div>
    3131
     32<p>
     33With flexbox. There should be horizontal scroll bar.
     34<div id="horizontal_flex" style="overflow-x:scroll; width:150px;">
     35<div style="display:-webkit-box; -webkit-box-reflect:right; width:150px;">
     36Madam, I am Adam.
     37</div>
     38</div>
     39
     40<p>
     41With flexbox. There should be vertical scroll bar.
     42<div id="vertical_flex" style="overflow-y:scroll; width:150px; height:80px;">
     43<div style="display:-webkit-box; -webkit-box-reflect:below; height:80px;">
     44Madam,<br>
     45I<br>
     46am<br>
     47Adam.
     48</div>
     49</div>
     50
     51<p>
     52With table. There should be horizontal scroll bar.
     53<div id="horizontal_table" style="overflow-x:scroll; width:150px;">
     54<table style="-webkit-box-reflect:right; width:150px;">
     55<tr><td>
     56Madam, I am Adam.
     57</tr></td>
     58</table>
     59</div>
     60
     61<p>
     62With table. There should be vertical scroll bar.
     63<div id="vertical_table" style="overflow-y:scroll; width:150px; height:80px;">
     64<table style="-webkit-box-reflect:below; height:80px;">
     65<tr><td>
     66Madam,<br>
     67I<br>
     68am<br>
     69Adam.
     70</tr></td>
     71</table>
     72</div>
     73
    3274</div>
    3375
  • trunk/LayoutTests/fast/reflections/resources/reflection-overflow-scroll.js

    r46889 r47200  
    88element.scrollLeft = 500;
    99shouldBe("element.scrollLeft", "150");
     10element = document.getElementById("vertical");
     11element.scrollTop = 500;
     12shouldBe("element.scrollTop", "80");
    1013
    11 element = document.getElementById("vertical");
     14element = document.getElementById("horizontal_flex");
     15element.scrollLeft = 500;
     16shouldBe("element.scrollLeft", "150");
     17element = document.getElementById("vertical_flex");
     18element.scrollTop = 500;
     19shouldBe("element.scrollTop", "80");
     20
     21element = document.getElementById("horizontal_table");
     22element.scrollLeft = 500;
     23shouldBe("element.scrollLeft", "150");
     24element = document.getElementById("vertical_table");
    1225element.scrollTop = 500;
    1326shouldBe("element.scrollTop", "80");
  • trunk/WebCore/ChangeLog

    r47195 r47200  
     12009-08-13  Shinichiro Hamaji  <hamaji@chromium.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        wrong calculation of overflow size for flexbox and table
     6        https://bugs.webkit.org/show_bug.cgi?id=28064
     7
     8        RenderFlexibleBox and RenderTable were using the width of overflow
     9        to update height of overflow, so height became wrong value and
     10        width was not updated. As the corresponding code of RenderBlock
     11        was sane, I factored it out and used from RenderFlexibleBox and
     12        RenderTable.
     13
     14        * rendering/RenderBlock.cpp:
     15        (WebCore::RenderBlock::updateOverflowWithShadowAndReflection): created from code of layoutBlock
     16        (WebCore::RenderBlock::layoutBlock):
     17        * rendering/RenderBlock.h:
     18        * rendering/RenderFlexibleBox.cpp: use updateOverflowWithShadowAndReflection
     19        (WebCore::RenderFlexibleBox::layoutBlock):
     20        * rendering/RenderTable.cpp:
     21        (WebCore::RenderTable::layout): use updateOverflowWithShadowAndReflection
     22
    1232009-08-13  Mark Rowe  <mrowe@apple.com>
    224
  • trunk/WebCore/rendering/RenderBlock.cpp

    r46889 r47200  
    731731}
    732732
     733void RenderBlock::updateOverflowWithShadowAndReflection()
     734{
     735    if (hasOverflowClip())
     736        return;
     737
     738    int shadowLeft;
     739    int shadowRight;
     740    int shadowTop;
     741    int shadowBottom;
     742    style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft);
     743
     744    m_overflowLeft = min(m_overflowLeft, shadowLeft);
     745    m_overflowWidth = max(m_overflowWidth, width() + shadowRight);
     746    m_overflowTop = min(m_overflowTop, shadowTop);
     747    m_overflowHeight = max(m_overflowHeight, height() + shadowBottom);
     748
     749    if (hasReflection()) {
     750        IntRect reflection(reflectionBox());
     751        m_overflowLeft = min(m_overflowLeft, reflection.x());
     752        m_overflowWidth = max(m_overflowWidth, reflection.right());
     753        m_overflowTop = min(m_overflowTop, reflection.y());
     754        m_overflowHeight = max(m_overflowHeight, reflection.bottom());
     755    }
     756}
     757
    733758void RenderBlock::layout()
    734759{
     
    869894    m_overflowHeight = max(m_overflowHeight, height());
    870895
    871     if (!hasOverflowClip()) {
    872         int shadowLeft;
    873         int shadowRight;
    874         int shadowTop;
    875         int shadowBottom;
    876         style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft);
    877 
    878         m_overflowLeft = min(m_overflowLeft, shadowLeft);
    879         m_overflowWidth = max(m_overflowWidth, width() + shadowRight);
    880         m_overflowTop = min(m_overflowTop, shadowTop);
    881         m_overflowHeight = max(m_overflowHeight, height() + shadowBottom);
    882 
    883         if (hasReflection()) {
    884             IntRect reflection(reflectionBox());
    885             m_overflowLeft = min(m_overflowLeft, reflection.x());
    886             m_overflowWidth = max(m_overflowWidth, reflection.right());
    887             m_overflowTop = min(m_overflowTop, reflection.y());
    888             m_overflowHeight = max(m_overflowHeight, reflection.bottom());
    889         }
    890     }
     896    updateOverflowWithShadowAndReflection();
    891897
    892898    statePusher.pop();
  • trunk/WebCore/rendering/RenderBlock.h

    r46815 r47200  
    205205    virtual bool hasLineIfEmpty() const;
    206206    bool layoutOnlyPositionedObjects();
    207    
     207
     208    void updateOverflowWithShadowAndReflection();
     209
    208210private:
    209211    virtual RenderObjectChildList* virtualChildren() { return children(); }
  • trunk/WebCore/rendering/RenderFlexibleBox.cpp

    r46553 r47200  
    279279        m_overflowWidth = width();
    280280
    281     if (!hasOverflowClip()) {
    282         int shadowLeft;
    283         int shadowRight;
    284         int shadowTop;
    285         int shadowBottom;
    286         style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft);
    287 
    288         m_overflowLeft = min(m_overflowLeft, shadowLeft);
    289         m_overflowWidth = max(m_overflowWidth, width() + shadowRight);
    290         m_overflowTop = min(m_overflowTop, shadowTop);
    291         m_overflowHeight = max(m_overflowHeight, height() + shadowBottom);
    292 
    293         if (hasReflection()) {
    294             IntRect reflection(reflectionBox());
    295             m_overflowTop = min(m_overflowTop, reflection.y());
    296             m_overflowHeight = max(m_overflowHeight, reflection.bottom());
    297             m_overflowLeft = min(m_overflowLeft, reflection.x());
    298             m_overflowHeight = max(m_overflowWidth, reflection.right());
    299         }
    300     }
     281    updateOverflowWithShadowAndReflection();
    301282
    302283    statePusher.pop();
  • trunk/WebCore/rendering/RenderTable.cpp

    r46888 r47200  
    390390    layoutPositionedObjects(true);
    391391
    392     if (!hasOverflowClip()) {
    393         int shadowLeft;
    394         int shadowRight;
    395         int shadowTop;
    396         int shadowBottom;
    397         style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft);
    398 
    399         m_overflowLeft = min(m_overflowLeft, shadowLeft);
    400         m_overflowWidth = max(m_overflowWidth, width() + shadowRight);
    401         m_overflowTop = min(m_overflowTop, shadowTop);
    402         m_overflowHeight = max(m_overflowHeight, height() + shadowBottom);
    403 
    404         if (hasReflection()) {
    405             IntRect reflection(reflectionBox());
    406             m_overflowTop = min(m_overflowTop, reflection.y());
    407             m_overflowHeight = max(m_overflowHeight, reflection.bottom());
    408             m_overflowLeft = min(m_overflowLeft, reflection.x());
    409             m_overflowHeight = max(m_overflowWidth, reflection.right());
    410         }
    411     }
     392    updateOverflowWithShadowAndReflection();
    412393
    413394    statePusher.pop();
Note: See TracChangeset for help on using the changeset viewer.