Changeset 14953 in webkit


Ignore:
Timestamp:
Jun 21, 2006 3:45:00 PM (18 years ago)
Author:
hyatt
Message:

Fix for 7362, implement the CSS3 overflow-x and overflow-y properties.

Reviewed by adele

  • WebCore.xcodeproj/project.pbxproj:
  • css/CSSComputedStyleDeclaration.cpp: (WebCore::): (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
  • css/CSSPropertyNames.in:
  • css/cssparser.cpp: (WebCore::CSSParser::parseValue):
  • css/cssstyleselector.cpp: (WebCore::CSSStyleSelector::adjustRenderStyle): (WebCore::CSSStyleSelector::applyProperty):
  • page/FrameView.cpp: (WebCore::FrameView::applyOverflowToViewport): (WebCore::FrameView::layout):
  • rendering/RenderBlock.cpp: (WebCore::RenderBlock::layoutBlock): (WebCore::RenderBlock::determineHorizontalPosition): (WebCore::RenderBlock::layoutBlockChildren): (WebCore::RenderBlock::rightOffset): (WebCore::RenderBlock::rightmostPosition): (WebCore::RenderBlock::calcMinMaxWidth):
  • rendering/RenderBox.cpp: (WebCore::RenderBox::setStyle): (WebCore::RenderBox::contentWidth): (WebCore::RenderBox::contentHeight): (WebCore::RenderBox::sizesToIntrinsicWidth): (WebCore::RenderBox::calcHeight): (WebCore::RenderBox::calcPercentageHeight):
  • rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::layoutBlock):
  • rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollToOffset): (WebCore::RenderLayer::shouldAutoscroll): (WebCore::RenderLayer::updateScrollInfoAfterLayout): (WebCore::RenderLayer::styleChanged):
  • rendering/RenderLayer.h:
  • rendering/RenderObject.cpp: (WebCore::RenderObject::clientWidth): (WebCore::RenderObject::clientHeight):
  • rendering/RenderObject.h: (WebCore::RenderObject::hasAutoVerticalScrollbar): (WebCore::RenderObject::hasAutoHorizontalScrollbar): (WebCore::RenderObject::scrollsOverflow): (WebCore::RenderObject::scrollsOverflowX): (WebCore::RenderObject::scrollsOverflowY): (WebCore::RenderObject::includeVerticalScrollbarSize): (WebCore::RenderObject::includeHorizontalScrollbarSize):
  • rendering/RenderTextArea.cpp: (WebCore::RenderTextArea::setStyle):
  • rendering/RenderTextField.cpp: (WebCore::RenderTextField::createDivStyle): (WebCore::RenderTextField::calcHeight): (WebCore::RenderTextField::calcMinMaxWidth):
  • rendering/bidi.cpp: (WebCore::RenderBlock::layoutInlineChildren):
  • rendering/render_style.cpp: (WebCore::RenderStyle::diff):
  • rendering/render_style.h: (WebCore::): (WebCore::RenderStyle::NonInheritedFlags::operator==): (WebCore::RenderStyle::setBitDefaults): (WebCore::RenderStyle::overflowX): (WebCore::RenderStyle::overflowY): (WebCore::RenderStyle::setOverflowX): (WebCore::RenderStyle::setOverflowY): (WebCore::RenderStyle::initialOverflowX): (WebCore::RenderStyle::initialOverflowY):
Location:
trunk/WebCore
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r14952 r14953  
     12006-06-21  David Hyatt  <hyatt@apple.com>
     2
     3        Fix for 7362, implement the CSS3 overflow-x and overflow-y properties.
     4
     5        Reviewed by adele
     6
     7        * WebCore.xcodeproj/project.pbxproj:
     8        * css/CSSComputedStyleDeclaration.cpp:
     9        (WebCore::):
     10        (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
     11        * css/CSSPropertyNames.in:
     12        * css/cssparser.cpp:
     13        (WebCore::CSSParser::parseValue):
     14        * css/cssstyleselector.cpp:
     15        (WebCore::CSSStyleSelector::adjustRenderStyle):
     16        (WebCore::CSSStyleSelector::applyProperty):
     17        * page/FrameView.cpp:
     18        (WebCore::FrameView::applyOverflowToViewport):
     19        (WebCore::FrameView::layout):
     20        * rendering/RenderBlock.cpp:
     21        (WebCore::RenderBlock::layoutBlock):
     22        (WebCore::RenderBlock::determineHorizontalPosition):
     23        (WebCore::RenderBlock::layoutBlockChildren):
     24        (WebCore::RenderBlock::rightOffset):
     25        (WebCore::RenderBlock::rightmostPosition):
     26        (WebCore::RenderBlock::calcMinMaxWidth):
     27        * rendering/RenderBox.cpp:
     28        (WebCore::RenderBox::setStyle):
     29        (WebCore::RenderBox::contentWidth):
     30        (WebCore::RenderBox::contentHeight):
     31        (WebCore::RenderBox::sizesToIntrinsicWidth):
     32        (WebCore::RenderBox::calcHeight):
     33        (WebCore::RenderBox::calcPercentageHeight):
     34        * rendering/RenderFlexibleBox.cpp:
     35        (WebCore::RenderFlexibleBox::layoutBlock):
     36        * rendering/RenderLayer.cpp:
     37        (WebCore::RenderLayer::scrollToOffset):
     38        (WebCore::RenderLayer::shouldAutoscroll):
     39        (WebCore::RenderLayer::updateScrollInfoAfterLayout):
     40        (WebCore::RenderLayer::styleChanged):
     41        * rendering/RenderLayer.h:
     42        * rendering/RenderObject.cpp:
     43        (WebCore::RenderObject::clientWidth):
     44        (WebCore::RenderObject::clientHeight):
     45        * rendering/RenderObject.h:
     46        (WebCore::RenderObject::hasAutoVerticalScrollbar):
     47        (WebCore::RenderObject::hasAutoHorizontalScrollbar):
     48        (WebCore::RenderObject::scrollsOverflow):
     49        (WebCore::RenderObject::scrollsOverflowX):
     50        (WebCore::RenderObject::scrollsOverflowY):
     51        (WebCore::RenderObject::includeVerticalScrollbarSize):
     52        (WebCore::RenderObject::includeHorizontalScrollbarSize):
     53        * rendering/RenderTextArea.cpp:
     54        (WebCore::RenderTextArea::setStyle):
     55        * rendering/RenderTextField.cpp:
     56        (WebCore::RenderTextField::createDivStyle):
     57        (WebCore::RenderTextField::calcHeight):
     58        (WebCore::RenderTextField::calcMinMaxWidth):
     59        * rendering/bidi.cpp:
     60        (WebCore::RenderBlock::layoutInlineChildren):
     61        * rendering/render_style.cpp:
     62        (WebCore::RenderStyle::diff):
     63        * rendering/render_style.h:
     64        (WebCore::):
     65        (WebCore::RenderStyle::NonInheritedFlags::operator==):
     66        (WebCore::RenderStyle::setBitDefaults):
     67        (WebCore::RenderStyle::overflowX):
     68        (WebCore::RenderStyle::overflowY):
     69        (WebCore::RenderStyle::setOverflowX):
     70        (WebCore::RenderStyle::setOverflowY):
     71        (WebCore::RenderStyle::initialOverflowX):
     72        (WebCore::RenderStyle::initialOverflowY):
     73
    1742006-06-21  Justin Garcia  <justin.garcia@apple.com>
    275
  • trunk/WebCore/css/CSSComputedStyleDeclaration.cpp

    r14763 r14953  
    121121    CSS_PROP_OUTLINE_STYLE,
    122122    CSS_PROP_OVERFLOW,
     123    CSS_PROP_OVERFLOW_X,
     124    CSS_PROP_OVERFLOW_Y,
    123125    CSS_PROP_PADDING_TOP,
    124126    CSS_PROP_PADDING_RIGHT,
     
    890892        break;
    891893    case CSS_PROP_OVERFLOW:
    892         switch (style->overflow()) {
     894    case CSS_PROP_OVERFLOW_X:
     895    case CSS_PROP_OVERFLOW_Y:
     896        EOverflow overflow;
     897        switch (propertyID) {
     898            case CSS_PROP_OVERFLOW_X:
     899                overflow = style->overflowX();
     900                break;
     901            case CSS_PROP_OVERFLOW_Y:
     902                overflow = style->overflowY();
     903                break;
     904            default:
     905                overflow = max(style->overflowX(), style->overflowY());
     906        }
     907        switch (overflow) {
    893908            case OVISIBLE:
    894909                return new CSSPrimitiveValue(CSS_VAL_VISIBLE);
  • trunk/WebCore/css/CSSPropertyNames.in

    r14763 r14953  
    108108outline-width
    109109overflow
     110overflow-x
     111overflow-y
    110112padding-top
    111113padding-right
  • trunk/WebCore/css/cssparser.cpp

    r14879 r14953  
    543543
    544544    case CSS_PROP_OVERFLOW:             // visible | hidden | scroll | auto | marquee | overlay | inherit
     545    case CSS_PROP_OVERFLOW_X:
     546    case CSS_PROP_OVERFLOW_Y:
    545547        if (id == CSS_VAL_VISIBLE || id == CSS_VAL_HIDDEN || id == CSS_VAL_SCROLL || id == CSS_VAL_AUTO ||
    546             id == CSS_VAL__WEBKIT_MARQUEE || id == CSS_VAL__WEBKIT_OVERLAY)
     548            id == CSS_VAL__WEBKIT_OVERLAY || id == CSS_VAL__WEBKIT_MARQUEE)
    547549            valid_primitive = true;
    548550        break;
  • trunk/WebCore/css/cssstyleselector.cpp

    r14879 r14953  
    10391039        style->addToTextDecorationsInEffect(style->textDecoration());
    10401040   
     1041    // If either overflow value is not visible, change to auto.
     1042    if (style->overflowX() == OMARQUEE && style->overflowY() != OMARQUEE)
     1043        style->setOverflowY(OMARQUEE);
     1044    else if (style->overflowY() == OMARQUEE && style->overflowX() != OMARQUEE)
     1045        style->setOverflowX(OMARQUEE);
     1046    else if (style->overflowX() == OVISIBLE && style->overflowY() != OVISIBLE)
     1047        style->setOverflowX(OAUTO);
     1048    else if (style->overflowY() == OVISIBLE && style->overflowX() != OVISIBLE)
     1049        style->setOverflowY(OAUTO);
     1050
    10411051    // Table rows, sections and the table itself will support overflow:hidden and will ignore scroll/auto.
    10421052    // FIXME: Eventually table sections will support auto and scroll.
    1043     if (style->overflow() != OVISIBLE && style->overflow() != OHIDDEN &&
    1044         (style->display() == TABLE || style->display() == INLINE_TABLE ||
    1045          style->display() == TABLE_ROW_GROUP || style->display() == TABLE_ROW))
    1046         style->setOverflow(OVISIBLE);
     1053    if (style->display() == TABLE || style->display() == INLINE_TABLE ||
     1054        style->display() == TABLE_ROW_GROUP || style->display() == TABLE_ROW) {
     1055        if (style->overflowX() != OVISIBLE && style->overflowX() != OHIDDEN)
     1056            style->setOverflowX(OVISIBLE);
     1057        if (style->overflowY() != OVISIBLE && style->overflowY() != OHIDDEN)
     1058            style->setOverflowY(OVISIBLE);
     1059    }
    10471060
    10481061    // Links should be user selectable when content editable
     
    20452058    case CSS_PROP_OVERFLOW:
    20462059    {
    2047         HANDLE_INHERIT_AND_INITIAL(overflow, Overflow)
    2048         if (!primitiveValue) return;
     2060        if (isInherit) {
     2061            style->setOverflowX(parentStyle->overflowX());
     2062            style->setOverflowY(parentStyle->overflowY());
     2063            return;
     2064        }
     2065       
     2066        if (isInitial) {
     2067            style->setOverflowX(RenderStyle::initialOverflowX());
     2068            style->setOverflowY(RenderStyle::initialOverflowY());
     2069            return;
     2070        }
     2071           
     2072        EOverflow o;
     2073        switch(primitiveValue->getIdent()) {
     2074            case CSS_VAL_VISIBLE:
     2075                o = OVISIBLE; break;
     2076            case CSS_VAL_HIDDEN:
     2077                o = OHIDDEN; break;
     2078            case CSS_VAL_SCROLL:
     2079                o = OSCROLL; break;
     2080            case CSS_VAL_AUTO:
     2081                o = OAUTO; break;
     2082            case CSS_VAL__WEBKIT_MARQUEE:
     2083                o = OMARQUEE; break;
     2084            case CSS_VAL__WEBKIT_OVERLAY:
     2085                o = OOVERLAY; break;
     2086            default:
     2087                return;
     2088        }
     2089        style->setOverflowX(o);
     2090        style->setOverflowY(o);
     2091        return;
     2092    }
     2093
     2094    case CSS_PROP_OVERFLOW_X:
     2095    {
     2096        HANDLE_INHERIT_AND_INITIAL(overflowX, OverflowX)
    20492097        EOverflow o;
    20502098        switch(primitiveValue->getIdent())
     
    20582106        case CSS_VAL_AUTO:
    20592107            o = OAUTO; break;
    2060         case CSS_VAL__WEBKIT_MARQUEE:
    2061             o = OMARQUEE; break;
    20622108        case CSS_VAL__WEBKIT_OVERLAY:
    20632109            o = OOVERLAY; break;
     
    20652111            return;
    20662112        }
    2067         style->setOverflow(o);
     2113        style->setOverflowX(o);
     2114        return;
     2115    }
     2116
     2117    case CSS_PROP_OVERFLOW_Y:
     2118    {
     2119        HANDLE_INHERIT_AND_INITIAL(overflowY, OverflowY)
     2120        EOverflow o;
     2121        switch(primitiveValue->getIdent())
     2122        {
     2123        case CSS_VAL_VISIBLE:
     2124            o = OVISIBLE; break;
     2125        case CSS_VAL_HIDDEN:
     2126            o = OHIDDEN; break;
     2127        case CSS_VAL_SCROLL:
     2128            o = OSCROLL; break;
     2129        case CSS_VAL_AUTO:
     2130            o = OAUTO; break;
     2131        case CSS_VAL__WEBKIT_OVERLAY:
     2132            o = OOVERLAY; break;
     2133        default:
     2134            return;
     2135        }
     2136        style->setOverflowY(o);
    20682137        return;
    20692138    }
  • trunk/WebCore/page/FrameView.cpp

    r14916 r14953  
    264264    // scrollbars.  The CSS2.1 draft states that HTML UAs should use the <html> or <body> element and XML/XHTML UAs should
    265265    // use the root element.
    266     switch(o->style()->overflow()) {
     266    switch (o->style()->overflowX()) {
    267267        case OHIDDEN:
    268             hMode = vMode = ScrollBarAlwaysOff;
     268            hMode = ScrollBarAlwaysOff;
    269269            break;
    270270        case OSCROLL:
    271             hMode = vMode = ScrollBarAlwaysOn;
     271            hMode = ScrollBarAlwaysOn;
    272272            break;
    273273        case OAUTO:
    274             hMode = vMode = ScrollBarAuto;
     274            hMode = ScrollBarAuto;
     275            break;
     276        default:
     277            // Don't set it at all.
     278            ;
     279    }
     280   
     281     switch (o->style()->overflowY()) {
     282        case OHIDDEN:
     283            vMode = ScrollBarAlwaysOff;
     284            break;
     285        case OSCROLL:
     286            vMode = ScrollBarAlwaysOn;
     287            break;
     288        case OAUTO:
     289            vMode = ScrollBarAuto;
    275290            break;
    276291        default:
     
    363378                    hMode = ScrollBarAlwaysOff;
    364379                } else if (body->hasTagName(bodyTag)) {
    365                     RenderObject* o = (rootRenderer->style()->overflow() == OVISIBLE) ? body->renderer() : rootRenderer;
     380                    // It's sufficient to just check one overflow direction, since it's illegal to have visible in only one direction.
     381                    RenderObject* o = rootRenderer->style()->overflowX() == OVISIBLE ? body->renderer() : rootRenderer;
    366382                    applyOverflowToViewport(o, hMode, vMode); // Only applies to HTML UAs, not to XML/XHTML UAs
    367383                }
  • trunk/WebCore/rendering/RenderBlock.cpp

    r14949 r14953  
    477477    }
    478478
     479    // For overflow:scroll blocks, ensure we have both scrollbars in place always.
    479480    if (scrollsOverflow()) {
    480         // For overflow:scroll blocks, ensure we have both scrollbars in place always.
    481         if (style()->overflow() == OSCROLL) {
     481        if (style()->overflowX() == OSCROLL)
    482482            m_layer->setHasHorizontalScrollbar(true);
     483        if (style()->overflowY() == OSCROLL)
    483484            m_layer->setHasVerticalScrollbar(true);
    484         }
    485        
    486         // Move the scrollbars aside during layout.  The layer will move them back when it
    487         // does painting or event handling.
    488         m_layer->moveScrollbarsAside();
    489     }
    490    
     485    }
     486
    491487    IntRect repaintRect;
    492488    if (childrenInline())
     
    497493    // Expand our intrinsic height to encompass floats.
    498494    int toAdd = borderBottom() + paddingBottom();
    499     if (includeScrollbarSize())
     495    if (includeHorizontalScrollbarSize())
    500496        toAdd += m_layer->horizontalScrollbarHeight();
    501497    if (floatBottom() > (m_height - toAdd) && (isInlineBlockOrInlineTable() || isFloatingOrPositioned() || hasOverflowClip() ||
     
    937933        child->setPos(chPos, child->yPos());
    938934    } else {
    939         int xPos = m_width - borderRight() - paddingRight() - (includeScrollbarSize() ? m_layer->verticalScrollbarWidth() : 0);
     935        int xPos = m_width - borderRight() - paddingRight() - (includeVerticalScrollbarSize() ? m_layer->verticalScrollbarWidth() : 0);
    940936        int chPos = xPos - (child->width() + child->marginRight());
    941937        if (child->avoidsFloats()) {
     
    10071003{
    10081004    int top = borderTop() + paddingTop();
    1009     int bottom = borderBottom() + paddingBottom() + (includeScrollbarSize() ? m_layer->horizontalScrollbarHeight() : 0);
     1005    int bottom = borderBottom() + paddingBottom() + (includeHorizontalScrollbarSize() ? m_layer->horizontalScrollbarHeight() : 0);
    10101006
    10111007    m_height = m_overflowHeight = top;
     
    20212017{
    20222018    int right = m_width - borderRight() - paddingRight();
    2023     if (includeScrollbarSize())
     2019    if (includeVerticalScrollbarSize())
    20242020        right -= m_layer->verticalScrollbarWidth();
    20252021    return right;
     
    21812177        for (InlineRunBox* currBox = firstLineBox(); currBox; currBox = currBox->nextLineBox()) {
    21822178            int rp = currBox->xPos() + currBox->width();
     2179            // If this node is a root editable element, then the rightmostPosition should account for a caret at the end.
     2180            // FIXME: Need to find another way to do this, since scrollbars could show when we don't want them to.
     2181            if (node()->isContentEditable() && node() == node()->rootEditableElement() && style()->direction() == LTR)
     2182                rp += 1;
    21832183            right = max(right, rp);
    21842184        }
    2185         // If this node is a root editable element, then the rightmostPosition should account for a caret at the end.
    2186         if (node()->isContentEditable() && node() == node()->rootEditableElement() && style()->direction() == LTR)
    2187             right += 1;
    21882185    }
    21892186   
     
    27382735       
    27392736        // A horizontal marquee with inline children has no minimum width.
    2740         if (style()->overflow() == OMARQUEE && m_layer && m_layer->marquee() &&
    2741             m_layer->marquee()->isHorizontal() && !m_layer->marquee()->isUnfurlMarquee())
     2737        if (m_layer && m_layer->marquee() && m_layer->marquee()->isHorizontal() && !m_layer->marquee()->isUnfurlMarquee())
    27422738            m_minWidth = 0;
    27432739    }
  • trunk/WebCore/rendering/RenderBox.cpp

    r14847 r14953  
    110110
    111111    // We also handle <body> and <html>, whose overflow applies to the viewport.
    112     if (_style->overflow() != OVISIBLE && !isRoot() && (!isBody() || !document()->isHTMLDocument()) &&
    113         (isRenderBlock() || isTableRow() || isTableSection()))
    114         setHasOverflowClip();
     112    if (!isRoot() && (!isBody() || !document()->isHTMLDocument()) && (isRenderBlock() || isTableRow() || isTableSection())) {
     113        // Check for overflow clip.
     114        // It's sufficient to just check one direction, since it's illegal to have visible on only one overflow value.
     115        if (_style->overflowX() != OVISIBLE)
     116            setHasOverflowClip();
     117    }
    115118
    116119    if (requiresLayer()) {
     
    174177    int w = m_width - (borderLeft() + borderRight() + paddingLeft() + paddingRight());
    175178
    176     if (includeScrollbarSize())
     179    if (includeVerticalScrollbarSize())
    177180        w -= m_layer->verticalScrollbarWidth();
    178181   
     
    184187    int h = m_height - (borderTop() + borderBottom() + paddingTop() + paddingBottom());
    185188
    186     if (includeScrollbarSize())
     189    if (includeHorizontalScrollbarSize())
    187190        h -= m_layer->horizontalScrollbarHeight();
    188191
     
    10871090    // Children of a horizontal marquee do not fill the container by default.
    10881091    // FIXME: Need to deal with MAUTO value properly.  It could be vertical.
    1089     if (parent()->style()->overflow() == OMARQUEE) {
     1092    if (parent()->style()->overflowX() == OMARQUEE) {
    10901093        EMarqueeDirection dir = parent()->style()->marqueeDirection();
    10911094        if (dir == MAUTO || dir == MFORWARD || dir == MBACKWARD || dir == MLEFT || dir == MRIGHT)
     
    12061209   
    12071210    // Unfurling marquees override with the furled height.
    1208     if (style()->overflow() == OMARQUEE && m_layer && m_layer->marquee() &&
     1211    if (style()->overflowX() == OMARQUEE && m_layer && m_layer->marquee() &&
    12091212        m_layer->marquee()->isUnfurlMarquee() && !m_layer->marquee()->isHorizontal()) {
    12101213        m_layer->marquee()->setEnd(m_height);
     
    12731276            // preferable to the alternative (sizing intrinsically and making the row end up too big).
    12741277            RenderTableCell* cell = static_cast<RenderTableCell*>(cb);
    1275             if (scrollsOverflow() &&
    1276                 (!cell->style()->height().isAuto() || !cell->table()->style()->height().isAuto()))
     1278            if (scrollsOverflowY() && (!cell->style()->height().isAuto() || !cell->table()->style()->height().isAuto()))
    12771279                return 0;
    12781280            return -1;
  • trunk/WebCore/rendering/RenderFlexibleBox.cpp

    r14297 r14953  
    271271    initMaxMarginValues();
    272272
     273    // For overflow:scroll blocks, ensure we have both scrollbars in place always.
    273274    if (scrollsOverflow()) {
    274         // For overflow:scroll blocks, ensure we have both scrollbars in place always.
    275         if (style()->overflow() == OSCROLL) {
     275        if (style()->overflowX() == OSCROLL)
    276276            m_layer->setHasHorizontalScrollbar(true);
     277        if (style()->overflowY() == OSCROLL)
    277278            m_layer->setHasVerticalScrollbar(true);
    278         }
    279 
    280         // Move the scrollbars aside during layout.  The layer will move them back when it
    281         // does painting or event handling.
    282         m_layer->moveScrollbarsAside();
    283279    }
    284280
  • trunk/WebCore/rendering/RenderLayer.cpp

    r14916 r14953  
    578578void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repaint)
    579579{
    580     if (renderer()->style()->overflow() != OMARQUEE) {
     580    if (renderer()->style()->overflowX() != OMARQUEE) {
    581581        if (x < 0) x = 0;
    582582        if (y < 0) y = 0;
     
    794794bool RenderLayer::shouldAutoscroll()
    795795{
    796     if (renderer()->hasOverflowClip() && (m_object->style()->overflow() != OHIDDEN || renderer()->node()->isContentEditable()))
     796    if (renderer()->hasOverflowClip() && (m_object->scrollsOverflow() || renderer()->node()->isContentEditable()))
    797797        return true;
    798798    return false;
     
    917917}
    918918
    919 void
    920 RenderLayer::moveScrollbarsAside()
    921 {
    922     if (m_hBar)
    923         m_hBar->move(0, -50000);
    924     if (m_vBar)
    925         m_vBar->move(0, -50000);
    926 }
    927 
    928919bool RenderLayer::isPointInResizeControl(const IntPoint& p)
    929920{
     
    1008999{
    10091000    m_scrollDimensionsDirty = true;
    1010     if (m_object->style()->overflow() == OHIDDEN)
     1001    if (m_object->style()->overflowX() == OHIDDEN && m_object->style()->overflowY() == OHIDDEN)
    10111002        return; // All we had to do was dirty.
    10121003
     
    10141005    computeScrollDimensions(&needHorizontalBar, &needVerticalBar);
    10151006
    1016     if (m_object->style()->overflow() != OMARQUEE) {
     1007    if (m_object->style()->overflowX() != OMARQUEE) {
    10171008        // Layout may cause us to be in an invalid scroll position.  In this case we need
    10181009        // to pull our scroll offsets back to the max (or push them up to the min).
     
    10291020
    10301021    // overflow:scroll should just enable/disable.
    1031     if (m_object->style()->overflow() == OSCROLL) {
     1022    if (m_object->style()->overflowX() == OSCROLL)
    10321023        m_hBar->setEnabled(needHorizontalBar);
     1024    if (m_object->style()->overflowY() == OSCROLL)
    10331025        m_vBar->setEnabled(needVerticalBar);
    1034     }
    10351026
    10361027    // overflow:auto may need to lay out again if scrollbars got added/removed.
    1037     bool scrollbarsChanged = (m_object->hasAutoScrollbars()) &&
    1038         (haveHorizontalBar != needHorizontalBar || haveVerticalBar != needVerticalBar);   
     1028    bool scrollbarsChanged = (m_object->hasAutoHorizontalScrollbar() && haveHorizontalBar != needHorizontalBar) ||
     1029                             (m_object->hasAutoVerticalScrollbar() && haveVerticalBar != needVerticalBar);   
    10391030    if (scrollbarsChanged) {
    1040         setHasHorizontalScrollbar(needHorizontalBar);
    1041         setHasVerticalScrollbar(needVerticalBar);
    1042    
     1031        if (m_object->hasAutoHorizontalScrollbar())
     1032            setHasHorizontalScrollbar(needHorizontalBar);
     1033        if (m_object->hasAutoVerticalScrollbar())
     1034            setHasVerticalScrollbar(needVerticalBar);
     1035
    10431036#if __APPLE__
    10441037        // Force an update since we know the scrollbars have changed things.
     
    10491042        m_object->repaint();
    10501043
    1051         if (m_object->style()->overflow() == OAUTO) {
     1044        if (m_object->style()->overflowX() == OAUTO || m_object->style()->overflowY() == OAUTO) {
    10521045            if (!m_inOverflowRelayout) {
    10531046                // Our proprietary overflow: overlay value doesn't trigger a layout.
     
    18201813    }
    18211814
    1822     if (m_object->style()->overflow() == OMARQUEE && m_object->style()->marqueeBehavior() != MNONE) {
     1815    if (m_object->style()->overflowX() == OMARQUEE && m_object->style()->marqueeBehavior() != MNONE) {
    18231816        if (!m_marquee)
    18241817            m_marquee = new Marquee(this);
  • trunk/WebCore/rendering/RenderLayer.h

    r14765 r14953  
    239239    int verticalScrollbarWidth();
    240240    int horizontalScrollbarHeight();
    241     void moveScrollbarsAside();
    242241    void positionScrollbars(const IntRect& absBounds);
    243242    void positionResizeControl();
  • trunk/WebCore/rendering/RenderObject.cpp

    r14916 r14953  
    599599{
    600600    return width() - borderLeft() - borderRight() -
    601         (includeScrollbarSize() ? layer()->verticalScrollbarWidth() : 0);
     601        (includeVerticalScrollbarSize() ? layer()->verticalScrollbarWidth() : 0);
    602602}
    603603
     
    606606{
    607607    return height() - borderTop() - borderBottom() -
    608       (includeScrollbarSize() ? layer()->horizontalScrollbarHeight() : 0);
     608      (includeHorizontalScrollbarSize() ? layer()->horizontalScrollbarHeight() : 0);
    609609}
    610610
  • trunk/WebCore/rendering/RenderObject.h

    r14827 r14953  
    311311   
    312312    bool hasOverflowClip() const { return m_hasOverflowClip; }
    313     bool hasAutoScrollbars() const { return hasOverflowClip() &&
    314         (style()->overflow() == OAUTO || style()->overflow() == OOVERLAY); }
    315     bool scrollsOverflow() const { return hasOverflowClip() &&
    316         (style()->overflow() == OSCROLL || hasAutoScrollbars()); }
    317     bool includeScrollbarSize() const { return hasOverflowClip() &&
    318         (style()->overflow() == OSCROLL || style()->overflow() == OAUTO); }
     313   
     314    bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style()->overflowY() == OAUTO || style()->overflowY() == OOVERLAY); }
     315    bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); }
     316
     317    bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY(); }
     318    bool scrollsOverflowX() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || hasAutoHorizontalScrollbar()); }
     319    bool scrollsOverflowY() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || hasAutoVerticalScrollbar()); }
     320   
     321    bool includeVerticalScrollbarSize() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || style()->overflowY() == OAUTO); }
     322    bool includeHorizontalScrollbarSize() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || style()->overflowX() == OAUTO); }
    319323
    320324    RenderStyle* getPseudoStyle(RenderStyle::PseudoId pseudo, RenderStyle* parentStyle = 0) const;
  • trunk/WebCore/rendering/RenderTextArea.cpp

    r14638 r14953  
    7979    w->setWritingDirection(style()->direction() == RTL ? RTL : LTR);
    8080
    81     ScrollBarMode scrollMode = ScrollBarAuto;
    82     switch (style()->overflow()) {
     81    ScrollBarMode verticalScrollMode = ScrollBarAuto;
     82    switch (style()->overflowY()) {
    8383        case OAUTO:
    8484        case OMARQUEE: // makes no sense, map to auto
     
    8787            break;
    8888        case OHIDDEN:
    89             scrollMode = ScrollBarAlwaysOff;
     89            verticalScrollMode = ScrollBarAlwaysOff;
    9090            break;
    9191        case OSCROLL:
    92             scrollMode = ScrollBarAlwaysOn;
     92            verticalScrollMode = ScrollBarAlwaysOn;
    9393            break;
    9494    }
    95     ScrollBarMode horizontalScrollMode = scrollMode;
     95    ScrollBarMode horizontalScrollMode = ScrollBarAuto;
     96    switch (style()->overflowX()) {
     97        case OAUTO:
     98        case OMARQUEE: // makes no sense, map to auto
     99        case OOVERLAY: // not implemented for text, map to auto
     100        case OVISIBLE:
     101            break;
     102        case OHIDDEN:
     103            horizontalScrollMode = ScrollBarAlwaysOff;
     104            break;
     105        case OSCROLL:
     106            horizontalScrollMode = ScrollBarAlwaysOn;
     107            break;
     108    }
     109
    96110    if (static_cast<HTMLTextAreaElement*>(node())->wrap() != HTMLTextAreaElement::ta_NoWrap)
    97111        horizontalScrollMode = ScrollBarAlwaysOff;
    98112
    99     w->setScrollBarModes(horizontalScrollMode, scrollMode);
     113    w->setScrollBarModes(horizontalScrollMode, verticalScrollMode);
    100114}
    101115
  • trunk/WebCore/rendering/RenderTextField.cpp

    r14931 r14953  
    8383
    8484    if (m_multiLine) {
    85         // Forward overflow property
    86         if (startStyle->overflow() == OHIDDEN || startStyle->overflow() == OSCROLL)
    87             divStyle->setOverflow(startStyle->overflow());
    88         else
    89             divStyle->setOverflow(OAUTO);
     85        // Forward overflow properties.
     86        divStyle->setOverflowX(startStyle->overflowX() == OVISIBLE ? OAUTO : startStyle->overflowX());
     87        divStyle->setOverflowY(startStyle->overflowY() == OVISIBLE ? OAUTO : startStyle->overflowY());
     88
    9089        // Set word wrap property based on wrap attribute
    9190        if (static_cast<HTMLTextAreaElement*>(element)->wrap() == HTMLTextAreaElement::ta_NoWrap) {
     
    9998    } else {
    10099        divStyle->setWhiteSpace(PRE);
    101         divStyle->setOverflow(OHIDDEN);
     100        divStyle->setOverflowX(OHIDDEN);
     101        divStyle->setOverflowY(OHIDDEN);
    102102    }
    103103
     
    317317    int scrollbarSize = 0;
    318318    // We are able to have a horizontal scrollbar if the overflow style is scroll, or if its auto and there's no word wrap.
    319     if (m_div->renderer()->style()->overflow() == OSCROLL ||  (m_div->renderer()->style()->overflow() == OAUTO && m_div->renderer()->style()->wordWrap() == WBNORMAL))
     319    if (m_div->renderer()->style()->overflowX() == OSCROLL ||  (m_div->renderer()->style()->overflowX() == OAUTO && m_div->renderer()->style()->wordWrap() == WBNORMAL))
    320320        scrollbarSize = 15;
    321321
     
    349349            factor = static_cast<HTMLTextAreaElement*>(node())->cols();
    350350            // FIXME: We should get the size of the scrollbar from the RenderTheme instead of hard coding it here.
    351             if (m_div->renderer()->style()->overflow() != OHIDDEN)
     351            if (m_div->renderer()->style()->overflowY() != OHIDDEN)
    352352                scrollbarSize = 15;
    353353        }
  • trunk/WebCore/rendering/bidi.cpp

    r14816 r14953  
    14861486    m_height = borderTop() + paddingTop();
    14871487    int toAdd = borderBottom() + paddingBottom();
    1488     if (includeScrollbarSize())
     1488    if (includeHorizontalScrollbarSize())
    14891489        toAdd += m_layer->horizontalScrollbarHeight();
    14901490   
  • trunk/WebCore/rendering/render_style.cpp

    r14763 r14953  
    878878        return Layout;
    879879
     880    // Overflow returns a layout hint.
     881    if (noninherited_flags._overflowX != other->noninherited_flags._overflowX ||
     882        noninherited_flags._overflowY != other->noninherited_flags._overflowY)
     883        return Layout;
     884       
    880885// only for inline:
    881886//     EVerticalAlign _vertical_align : 4;
     
    919924    // Repaint:
    920925//      EVisibility _visibility : 2;
    921 //     EOverflow _overflow : 4 ;
    922926//      int _text_decoration : 4;
    923927//     DataRef<StyleBackgroundData> background;
    924928    if (inherited->color != other->inherited->color ||
    925         !(inherited_flags._visibility == other->inherited_flags._visibility) ||
    926         !(noninherited_flags._overflow == other->noninherited_flags._overflow) ||
     929        inherited_flags._visibility != other->inherited_flags._visibility ||
    927930        !(inherited_flags._text_decorations == other->inherited_flags._text_decorations) ||
    928931        !(inherited_flags._force_backgrounds_to_white == other->inherited_flags._force_backgrounds_to_white) ||
  • trunk/WebCore/rendering/render_style.h

    r14763 r14953  
    376376
    377377enum EOverflow {
    378     OVISIBLE, OHIDDEN, OSCROLL, OAUTO, OMARQUEE, OOVERLAY
     378    OVISIBLE, OHIDDEN, OSCROLL, OAUTO, OOVERLAY, OMARQUEE
    379379};
    380380
     
    973973            (_originalDisplay == other._originalDisplay) &&
    974974            (_bg_repeat == other._bg_repeat) &&
    975             (_overflow == other._overflow) &&
     975            (_overflowX == other._overflowX) &&
     976            (_overflowY == other._overflowY) &&
    976977            (_vertical_align == other._vertical_align) &&
    977978            (_clear == other._clear) &&
     
    996997        unsigned _originalDisplay : 5; // EDisplay
    997998        unsigned _bg_repeat : 2; // EBackgroundRepeat
    998         unsigned _overflow : 4; // EOverflow
     999        unsigned _overflowX : 4; // EOverflow
     1000        unsigned _overflowY : 4; // EOverflow
    9991001        unsigned _vertical_align : 4; // EVerticalAlign
    10001002        unsigned _clear : 2; // EClear
     
    10641066       
    10651067        noninherited_flags._effectiveDisplay = noninherited_flags._originalDisplay = initialDisplay();
    1066         noninherited_flags._overflow = initialOverflow();
     1068        noninherited_flags._overflowX = initialOverflowX();
     1069        noninherited_flags._overflowY = initialOverflowY();
    10671070        noninherited_flags._vertical_align = initialVerticalAlign();
    10681071        noninherited_flags._clear = initialClear();
     
    11861189    const Color &  outlineColor() const {  return background->m_outline.color; }
    11871190
    1188     EOverflow overflow() const { return  static_cast<EOverflow>(noninherited_flags._overflow); }
     1191    EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); }
     1192    EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags._overflowY); }
     1193
    11891194    EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); }
    11901195    EVerticalAlign verticalAlign() const { return  static_cast<EVerticalAlign>(noninherited_flags._vertical_align); }
     
    14281433    void setOutlineColor(const Color & v) {  SET_VAR(background,m_outline.color,v) }
    14291434
    1430     void setOverflow(EOverflow v) {  noninherited_flags._overflow = v; }
     1435    void setOverflowX(EOverflow v) { noninherited_flags._overflowX = v; }
     1436    void setOverflowY(EOverflow v) { noninherited_flags._overflowY = v; }
    14311437    void setVisibility(EVisibility v) { inherited_flags._visibility = v; }
    14321438    void setVerticalAlign(EVerticalAlign v) { noninherited_flags._vertical_align = v; }
     
    16261632    static EListStylePosition initialListStylePosition() { return OUTSIDE; }
    16271633    static EListStyleType initialListStyleType() { return DISC; }
    1628     static EOverflow initialOverflow() { return OVISIBLE; }
     1634    static EOverflow initialOverflowX() { return OVISIBLE; }
     1635    static EOverflow initialOverflowY() { return OVISIBLE; }
    16291636    static EPageBreak initialPageBreak() { return PBAUTO; }
    16301637    static EPosition initialPosition() { return StaticPosition; }
Note: See TracChangeset for help on using the changeset viewer.