Changeset 105903 in webkit


Ignore:
Timestamp:
Jan 25, 2012 11:27:54 AM (12 years ago)
Author:
tony@chromium.org
Message:

support overflow:auto and overflow:scroll in new flexbox
https://bugs.webkit.org/show_bug.cgi?id=76953

Reviewed by David Hyatt.

Source/WebCore:

Tests: css3/flexbox/flexbox-overflow-auto-expected.html

css3/flexbox/flexbox-overflow-auto.html

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::addLayoutOverflow): In the case of reverse flexboxen, we can overflow up or to the left (like horizontal-bt or rtl content).

  • rendering/RenderFlexibleBox.cpp:

(WebCore::RenderFlexibleBox::layoutBlock): Call updateScrollInfoAfterLayout() to add overflow scrollbars.
(WebCore::RenderFlexibleBox::layoutAndPlaceChildren): In row-reverse, offset the start of the content by the scrollbar.
(WebCore::RenderFlexibleBox::layoutColumnReverse): In column-reverse, offset the start of the content by the scrollbar.

  • rendering/RenderFlexibleBox.h:

(RenderFlexibleBox): Make isHorizontalFlow public.

  • rendering/style/RenderStyle.h:

(WebCore::RenderStyleBitfields::isReverseFlexDirection): Convenience method.

LayoutTests:

  • css3/flexbox/flexbox-overflow-auto-expected.html: Added.
  • css3/flexbox/flexbox-overflow-auto.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r105902 r105903  
     12012-01-25  Tony Chang  <tony@chromium.org>
     2
     3        support overflow:auto and overflow:scroll in new flexbox
     4        https://bugs.webkit.org/show_bug.cgi?id=76953
     5
     6        Reviewed by David Hyatt.
     7
     8        * css3/flexbox/flexbox-overflow-auto-expected.html: Added.
     9        * css3/flexbox/flexbox-overflow-auto.html: Added.
     10
    1112012-01-25  Sheriff Bot  <webkit.review.bot@gmail.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r105902 r105903  
     12012-01-25  Tony Chang  <tony@chromium.org>
     2
     3        support overflow:auto and overflow:scroll in new flexbox
     4        https://bugs.webkit.org/show_bug.cgi?id=76953
     5
     6        Reviewed by David Hyatt.
     7
     8        Tests: css3/flexbox/flexbox-overflow-auto-expected.html
     9               css3/flexbox/flexbox-overflow-auto.html
     10
     11        * rendering/RenderBox.cpp:
     12        (WebCore::RenderBox::addLayoutOverflow): In the case of reverse flexboxen, we can overflow up or to the left (like horizontal-bt or rtl content).
     13        * rendering/RenderFlexibleBox.cpp:
     14        (WebCore::RenderFlexibleBox::layoutBlock): Call updateScrollInfoAfterLayout() to add overflow scrollbars.
     15        (WebCore::RenderFlexibleBox::layoutAndPlaceChildren): In row-reverse, offset the start of the content by the scrollbar.
     16        (WebCore::RenderFlexibleBox::layoutColumnReverse): In column-reverse, offset the start of the content by the scrollbar.
     17        * rendering/RenderFlexibleBox.h:
     18        (RenderFlexibleBox): Make isHorizontalFlow public.
     19        * rendering/style/RenderStyle.h:
     20        (WebCore::RenderStyleBitfields::isReverseFlexDirection): Convenience method.
     21
    1222012-01-25  Sheriff Bot  <webkit.review.bot@gmail.com>
    223
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r105394 r105903  
    4343#include "RenderArena.h"
    4444#include "RenderBoxRegionInfo.h"
     45#include "RenderFlexibleBox.h"
    4546#include "RenderFlowThread.h"
    4647#include "RenderInline.h"
     
    35943595        bool hasTopOverflow = !style()->isLeftToRightDirection() && !isHorizontalWritingMode();
    35953596        bool hasLeftOverflow = !style()->isLeftToRightDirection() && isHorizontalWritingMode();
     3597        if (isFlexibleBox() && style()->isReverseFlexDirection()) {
     3598            RenderFlexibleBox* flexibleBox = static_cast<RenderFlexibleBox*>(this);
     3599            if (flexibleBox->isHorizontalFlow())
     3600                hasLeftOverflow = true;
     3601            else
     3602                hasTopOverflow = true;
     3603        }
    35963604       
    35973605        if (!hasTopOverflow)
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp

    r105694 r105903  
    176176    m_overflow.clear();
    177177
     178    // For overflow:scroll blocks, ensure we have both scrollbars in place always.
     179    if (scrollsOverflow()) {
     180        if (style()->overflowX() == OSCROLL)
     181            layer()->setHasHorizontalScrollbar(true);
     182        if (style()->overflowY() == OSCROLL)
     183            layer()->setHasVerticalScrollbar(true);
     184    }
     185
    178186    layoutFlexItems(relayoutChildren);
    179187
     
    191199
    192200    updateLayerTransform();
     201
     202    // Update our scroll information if we're overflow:auto/scroll/hidden now that we know if
     203    // we overflow or not.
     204    if (hasOverflowClip())
     205        layer()->updateScrollInfoAfterLayout();
    193206
    194207    repainter.repaintAfterLayout();
     
    637650    LayoutUnit mainAxisOffset = flowAwareBorderStart() + flowAwarePaddingStart();
    638651    mainAxisOffset += initialPackingOffset(availableFreeSpace, totalPositiveFlexibility, style()->flexPack(), childSizes.size());
     652    if (style()->flexDirection() == FlowRowReverse)
     653        mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() : horizontalScrollbarHeight();
    639654
    640655    LayoutUnit crossAxisOffset = flowAwareBorderBefore() + flowAwarePaddingBefore();
     
    700715    LayoutUnit mainAxisOffset = logicalHeight() - flowAwareBorderEnd() - flowAwarePaddingEnd();
    701716    mainAxisOffset -= initialPackingOffset(availableFreeSpace, totalPositiveFlexibility, style()->flexPack(), childSizes.size());
     717    mainAxisOffset -= isHorizontalFlow() ? verticalScrollbarWidth() : horizontalScrollbarHeight();
    702718
    703719    LayoutUnit crossAxisOffset = flowAwareBorderBefore() + flowAwarePaddingBefore();
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.h

    r104645 r105903  
    4747    virtual void layoutBlock(bool relayoutChildren, int pageLogicalHeight = 0, BlockLayoutPass = NormalLayoutPass);
    4848
     49    bool isHorizontalFlow() const;
     50
    4951private:
    5052    class TreeOrderIterator;
     
    5456    bool hasOrthogonalFlow(RenderBox* child) const;
    5557    bool isColumnFlow() const;
    56     bool isHorizontalFlow() const;
    5758    bool isLeftToRightFlow() const;
    5859    Length crossAxisLength() const;
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r105901 r105903  
    809809    EFlexDirection flexDirection() const { return static_cast<EFlexDirection>(rareNonInheritedData->m_flexibleBox->m_flexDirection); }
    810810    bool isColumnFlexDirection() const { return flexDirection() == FlowColumn || flexDirection() == FlowColumnReverse; }
     811    bool isReverseFlexDirection() const { return flexDirection() == FlowRowReverse || flexDirection() == FlowColumnReverse; }
    811812    EFlexWrap flexWrap() const { return static_cast<EFlexWrap>(rareNonInheritedData->m_flexibleBox->m_flexWrap); }
    812813
Note: See TracChangeset for help on using the changeset viewer.