Changeset 14953 in webkit
- Timestamp:
- Jun 21, 2006 3:45:00 PM (18 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r14952 r14953 1 2006-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 1 74 2006-06-21 Justin Garcia <justin.garcia@apple.com> 2 75 -
trunk/WebCore/css/CSSComputedStyleDeclaration.cpp
r14763 r14953 121 121 CSS_PROP_OUTLINE_STYLE, 122 122 CSS_PROP_OVERFLOW, 123 CSS_PROP_OVERFLOW_X, 124 CSS_PROP_OVERFLOW_Y, 123 125 CSS_PROP_PADDING_TOP, 124 126 CSS_PROP_PADDING_RIGHT, … … 890 892 break; 891 893 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) { 893 908 case OVISIBLE: 894 909 return new CSSPrimitiveValue(CSS_VAL_VISIBLE); -
trunk/WebCore/css/CSSPropertyNames.in
r14763 r14953 108 108 outline-width 109 109 overflow 110 overflow-x 111 overflow-y 110 112 padding-top 111 113 padding-right -
trunk/WebCore/css/cssparser.cpp
r14879 r14953 543 543 544 544 case CSS_PROP_OVERFLOW: // visible | hidden | scroll | auto | marquee | overlay | inherit 545 case CSS_PROP_OVERFLOW_X: 546 case CSS_PROP_OVERFLOW_Y: 545 547 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) 547 549 valid_primitive = true; 548 550 break; -
trunk/WebCore/css/cssstyleselector.cpp
r14879 r14953 1039 1039 style->addToTextDecorationsInEffect(style->textDecoration()); 1040 1040 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 1041 1051 // Table rows, sections and the table itself will support overflow:hidden and will ignore scroll/auto. 1042 1052 // 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 } 1047 1060 1048 1061 // Links should be user selectable when content editable … … 2045 2058 case CSS_PROP_OVERFLOW: 2046 2059 { 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) 2049 2097 EOverflow o; 2050 2098 switch(primitiveValue->getIdent()) … … 2058 2106 case CSS_VAL_AUTO: 2059 2107 o = OAUTO; break; 2060 case CSS_VAL__WEBKIT_MARQUEE:2061 o = OMARQUEE; break;2062 2108 case CSS_VAL__WEBKIT_OVERLAY: 2063 2109 o = OOVERLAY; break; … … 2065 2111 return; 2066 2112 } 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); 2068 2137 return; 2069 2138 } -
trunk/WebCore/page/FrameView.cpp
r14916 r14953 264 264 // scrollbars. The CSS2.1 draft states that HTML UAs should use the <html> or <body> element and XML/XHTML UAs should 265 265 // use the root element. 266 switch (o->style()->overflow()) {266 switch (o->style()->overflowX()) { 267 267 case OHIDDEN: 268 hMode = vMode =ScrollBarAlwaysOff;268 hMode = ScrollBarAlwaysOff; 269 269 break; 270 270 case OSCROLL: 271 hMode = vMode =ScrollBarAlwaysOn;271 hMode = ScrollBarAlwaysOn; 272 272 break; 273 273 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; 275 290 break; 276 291 default: … … 363 378 hMode = ScrollBarAlwaysOff; 364 379 } 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; 366 382 applyOverflowToViewport(o, hMode, vMode); // Only applies to HTML UAs, not to XML/XHTML UAs 367 383 } -
trunk/WebCore/rendering/RenderBlock.cpp
r14949 r14953 477 477 } 478 478 479 // For overflow:scroll blocks, ensure we have both scrollbars in place always. 479 480 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) 482 482 m_layer->setHasHorizontalScrollbar(true); 483 if (style()->overflowY() == OSCROLL) 483 484 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 491 487 IntRect repaintRect; 492 488 if (childrenInline()) … … 497 493 // Expand our intrinsic height to encompass floats. 498 494 int toAdd = borderBottom() + paddingBottom(); 499 if (include ScrollbarSize())495 if (includeHorizontalScrollbarSize()) 500 496 toAdd += m_layer->horizontalScrollbarHeight(); 501 497 if (floatBottom() > (m_height - toAdd) && (isInlineBlockOrInlineTable() || isFloatingOrPositioned() || hasOverflowClip() || … … 937 933 child->setPos(chPos, child->yPos()); 938 934 } else { 939 int xPos = m_width - borderRight() - paddingRight() - (include ScrollbarSize() ? m_layer->verticalScrollbarWidth() : 0);935 int xPos = m_width - borderRight() - paddingRight() - (includeVerticalScrollbarSize() ? m_layer->verticalScrollbarWidth() : 0); 940 936 int chPos = xPos - (child->width() + child->marginRight()); 941 937 if (child->avoidsFloats()) { … … 1007 1003 { 1008 1004 int top = borderTop() + paddingTop(); 1009 int bottom = borderBottom() + paddingBottom() + (include ScrollbarSize() ? m_layer->horizontalScrollbarHeight() : 0);1005 int bottom = borderBottom() + paddingBottom() + (includeHorizontalScrollbarSize() ? m_layer->horizontalScrollbarHeight() : 0); 1010 1006 1011 1007 m_height = m_overflowHeight = top; … … 2021 2017 { 2022 2018 int right = m_width - borderRight() - paddingRight(); 2023 if (include ScrollbarSize())2019 if (includeVerticalScrollbarSize()) 2024 2020 right -= m_layer->verticalScrollbarWidth(); 2025 2021 return right; … … 2181 2177 for (InlineRunBox* currBox = firstLineBox(); currBox; currBox = currBox->nextLineBox()) { 2182 2178 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; 2183 2183 right = max(right, rp); 2184 2184 } 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;2188 2185 } 2189 2186 … … 2738 2735 2739 2736 // 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()) 2742 2738 m_minWidth = 0; 2743 2739 } -
trunk/WebCore/rendering/RenderBox.cpp
r14847 r14953 110 110 111 111 // 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 } 115 118 116 119 if (requiresLayer()) { … … 174 177 int w = m_width - (borderLeft() + borderRight() + paddingLeft() + paddingRight()); 175 178 176 if (include ScrollbarSize())179 if (includeVerticalScrollbarSize()) 177 180 w -= m_layer->verticalScrollbarWidth(); 178 181 … … 184 187 int h = m_height - (borderTop() + borderBottom() + paddingTop() + paddingBottom()); 185 188 186 if (include ScrollbarSize())189 if (includeHorizontalScrollbarSize()) 187 190 h -= m_layer->horizontalScrollbarHeight(); 188 191 … … 1087 1090 // Children of a horizontal marquee do not fill the container by default. 1088 1091 // FIXME: Need to deal with MAUTO value properly. It could be vertical. 1089 if (parent()->style()->overflow () == OMARQUEE) {1092 if (parent()->style()->overflowX() == OMARQUEE) { 1090 1093 EMarqueeDirection dir = parent()->style()->marqueeDirection(); 1091 1094 if (dir == MAUTO || dir == MFORWARD || dir == MBACKWARD || dir == MLEFT || dir == MRIGHT) … … 1206 1209 1207 1210 // 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() && 1209 1212 m_layer->marquee()->isUnfurlMarquee() && !m_layer->marquee()->isHorizontal()) { 1210 1213 m_layer->marquee()->setEnd(m_height); … … 1273 1276 // preferable to the alternative (sizing intrinsically and making the row end up too big). 1274 1277 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())) 1277 1279 return 0; 1278 1280 return -1; -
trunk/WebCore/rendering/RenderFlexibleBox.cpp
r14297 r14953 271 271 initMaxMarginValues(); 272 272 273 // For overflow:scroll blocks, ensure we have both scrollbars in place always. 273 274 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) 276 276 m_layer->setHasHorizontalScrollbar(true); 277 if (style()->overflowY() == OSCROLL) 277 278 m_layer->setHasVerticalScrollbar(true); 278 }279 280 // Move the scrollbars aside during layout. The layer will move them back when it281 // does painting or event handling.282 m_layer->moveScrollbarsAside();283 279 } 284 280 -
trunk/WebCore/rendering/RenderLayer.cpp
r14916 r14953 578 578 void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repaint) 579 579 { 580 if (renderer()->style()->overflow () != OMARQUEE) {580 if (renderer()->style()->overflowX() != OMARQUEE) { 581 581 if (x < 0) x = 0; 582 582 if (y < 0) y = 0; … … 794 794 bool RenderLayer::shouldAutoscroll() 795 795 { 796 if (renderer()->hasOverflowClip() && (m_object->s tyle()->overflow() != OHIDDEN|| renderer()->node()->isContentEditable()))796 if (renderer()->hasOverflowClip() && (m_object->scrollsOverflow() || renderer()->node()->isContentEditable())) 797 797 return true; 798 798 return false; … … 917 917 } 918 918 919 void920 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 928 919 bool RenderLayer::isPointInResizeControl(const IntPoint& p) 929 920 { … … 1008 999 { 1009 1000 m_scrollDimensionsDirty = true; 1010 if (m_object->style()->overflow () == OHIDDEN)1001 if (m_object->style()->overflowX() == OHIDDEN && m_object->style()->overflowY() == OHIDDEN) 1011 1002 return; // All we had to do was dirty. 1012 1003 … … 1014 1005 computeScrollDimensions(&needHorizontalBar, &needVerticalBar); 1015 1006 1016 if (m_object->style()->overflow () != OMARQUEE) {1007 if (m_object->style()->overflowX() != OMARQUEE) { 1017 1008 // Layout may cause us to be in an invalid scroll position. In this case we need 1018 1009 // to pull our scroll offsets back to the max (or push them up to the min). … … 1029 1020 1030 1021 // overflow:scroll should just enable/disable. 1031 if (m_object->style()->overflow () == OSCROLL) {1022 if (m_object->style()->overflowX() == OSCROLL) 1032 1023 m_hBar->setEnabled(needHorizontalBar); 1024 if (m_object->style()->overflowY() == OSCROLL) 1033 1025 m_vBar->setEnabled(needVerticalBar); 1034 }1035 1026 1036 1027 // overflow:auto may need to lay out again if scrollbars got added/removed. 1037 bool scrollbarsChanged = (m_object->hasAuto Scrollbars()) &&1038 (haveHorizontalBar != needHorizontalBar ||haveVerticalBar != needVerticalBar);1028 bool scrollbarsChanged = (m_object->hasAutoHorizontalScrollbar() && haveHorizontalBar != needHorizontalBar) || 1029 (m_object->hasAutoVerticalScrollbar() && haveVerticalBar != needVerticalBar); 1039 1030 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 1043 1036 #if __APPLE__ 1044 1037 // Force an update since we know the scrollbars have changed things. … … 1049 1042 m_object->repaint(); 1050 1043 1051 if (m_object->style()->overflow () == OAUTO) {1044 if (m_object->style()->overflowX() == OAUTO || m_object->style()->overflowY() == OAUTO) { 1052 1045 if (!m_inOverflowRelayout) { 1053 1046 // Our proprietary overflow: overlay value doesn't trigger a layout. … … 1820 1813 } 1821 1814 1822 if (m_object->style()->overflow () == OMARQUEE && m_object->style()->marqueeBehavior() != MNONE) {1815 if (m_object->style()->overflowX() == OMARQUEE && m_object->style()->marqueeBehavior() != MNONE) { 1823 1816 if (!m_marquee) 1824 1817 m_marquee = new Marquee(this); -
trunk/WebCore/rendering/RenderLayer.h
r14765 r14953 239 239 int verticalScrollbarWidth(); 240 240 int horizontalScrollbarHeight(); 241 void moveScrollbarsAside();242 241 void positionScrollbars(const IntRect& absBounds); 243 242 void positionResizeControl(); -
trunk/WebCore/rendering/RenderObject.cpp
r14916 r14953 599 599 { 600 600 return width() - borderLeft() - borderRight() - 601 (include ScrollbarSize() ? layer()->verticalScrollbarWidth() : 0);601 (includeVerticalScrollbarSize() ? layer()->verticalScrollbarWidth() : 0); 602 602 } 603 603 … … 606 606 { 607 607 return height() - borderTop() - borderBottom() - 608 (include ScrollbarSize() ? layer()->horizontalScrollbarHeight() : 0);608 (includeHorizontalScrollbarSize() ? layer()->horizontalScrollbarHeight() : 0); 609 609 } 610 610 -
trunk/WebCore/rendering/RenderObject.h
r14827 r14953 311 311 312 312 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); } 319 323 320 324 RenderStyle* getPseudoStyle(RenderStyle::PseudoId pseudo, RenderStyle* parentStyle = 0) const; -
trunk/WebCore/rendering/RenderTextArea.cpp
r14638 r14953 79 79 w->setWritingDirection(style()->direction() == RTL ? RTL : LTR); 80 80 81 ScrollBarMode scrollMode = ScrollBarAuto;82 switch (style()->overflow ()) {81 ScrollBarMode verticalScrollMode = ScrollBarAuto; 82 switch (style()->overflowY()) { 83 83 case OAUTO: 84 84 case OMARQUEE: // makes no sense, map to auto … … 87 87 break; 88 88 case OHIDDEN: 89 scrollMode = ScrollBarAlwaysOff;89 verticalScrollMode = ScrollBarAlwaysOff; 90 90 break; 91 91 case OSCROLL: 92 scrollMode = ScrollBarAlwaysOn;92 verticalScrollMode = ScrollBarAlwaysOn; 93 93 break; 94 94 } 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 96 110 if (static_cast<HTMLTextAreaElement*>(node())->wrap() != HTMLTextAreaElement::ta_NoWrap) 97 111 horizontalScrollMode = ScrollBarAlwaysOff; 98 112 99 w->setScrollBarModes(horizontalScrollMode, scrollMode);113 w->setScrollBarModes(horizontalScrollMode, verticalScrollMode); 100 114 } 101 115 -
trunk/WebCore/rendering/RenderTextField.cpp
r14931 r14953 83 83 84 84 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 90 89 // Set word wrap property based on wrap attribute 91 90 if (static_cast<HTMLTextAreaElement*>(element)->wrap() == HTMLTextAreaElement::ta_NoWrap) { … … 99 98 } else { 100 99 divStyle->setWhiteSpace(PRE); 101 divStyle->setOverflow(OHIDDEN); 100 divStyle->setOverflowX(OHIDDEN); 101 divStyle->setOverflowY(OHIDDEN); 102 102 } 103 103 … … 317 317 int scrollbarSize = 0; 318 318 // 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)) 320 320 scrollbarSize = 15; 321 321 … … 349 349 factor = static_cast<HTMLTextAreaElement*>(node())->cols(); 350 350 // 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) 352 352 scrollbarSize = 15; 353 353 } -
trunk/WebCore/rendering/bidi.cpp
r14816 r14953 1486 1486 m_height = borderTop() + paddingTop(); 1487 1487 int toAdd = borderBottom() + paddingBottom(); 1488 if (include ScrollbarSize())1488 if (includeHorizontalScrollbarSize()) 1489 1489 toAdd += m_layer->horizontalScrollbarHeight(); 1490 1490 -
trunk/WebCore/rendering/render_style.cpp
r14763 r14953 878 878 return Layout; 879 879 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 880 885 // only for inline: 881 886 // EVerticalAlign _vertical_align : 4; … … 919 924 // Repaint: 920 925 // EVisibility _visibility : 2; 921 // EOverflow _overflow : 4 ;922 926 // int _text_decoration : 4; 923 927 // DataRef<StyleBackgroundData> background; 924 928 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 || 927 930 !(inherited_flags._text_decorations == other->inherited_flags._text_decorations) || 928 931 !(inherited_flags._force_backgrounds_to_white == other->inherited_flags._force_backgrounds_to_white) || -
trunk/WebCore/rendering/render_style.h
r14763 r14953 376 376 377 377 enum EOverflow { 378 OVISIBLE, OHIDDEN, OSCROLL, OAUTO, O MARQUEE, OOVERLAY378 OVISIBLE, OHIDDEN, OSCROLL, OAUTO, OOVERLAY, OMARQUEE 379 379 }; 380 380 … … 973 973 (_originalDisplay == other._originalDisplay) && 974 974 (_bg_repeat == other._bg_repeat) && 975 (_overflow == other._overflow) && 975 (_overflowX == other._overflowX) && 976 (_overflowY == other._overflowY) && 976 977 (_vertical_align == other._vertical_align) && 977 978 (_clear == other._clear) && … … 996 997 unsigned _originalDisplay : 5; // EDisplay 997 998 unsigned _bg_repeat : 2; // EBackgroundRepeat 998 unsigned _overflow : 4; // EOverflow 999 unsigned _overflowX : 4; // EOverflow 1000 unsigned _overflowY : 4; // EOverflow 999 1001 unsigned _vertical_align : 4; // EVerticalAlign 1000 1002 unsigned _clear : 2; // EClear … … 1064 1066 1065 1067 noninherited_flags._effectiveDisplay = noninherited_flags._originalDisplay = initialDisplay(); 1066 noninherited_flags._overflow = initialOverflow(); 1068 noninherited_flags._overflowX = initialOverflowX(); 1069 noninherited_flags._overflowY = initialOverflowY(); 1067 1070 noninherited_flags._vertical_align = initialVerticalAlign(); 1068 1071 noninherited_flags._clear = initialClear(); … … 1186 1189 const Color & outlineColor() const { return background->m_outline.color; } 1187 1190 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 1189 1194 EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); } 1190 1195 EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(noninherited_flags._vertical_align); } … … 1428 1433 void setOutlineColor(const Color & v) { SET_VAR(background,m_outline.color,v) } 1429 1434 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; } 1431 1437 void setVisibility(EVisibility v) { inherited_flags._visibility = v; } 1432 1438 void setVerticalAlign(EVerticalAlign v) { noninherited_flags._vertical_align = v; } … … 1626 1632 static EListStylePosition initialListStylePosition() { return OUTSIDE; } 1627 1633 static EListStyleType initialListStyleType() { return DISC; } 1628 static EOverflow initialOverflow() { return OVISIBLE; } 1634 static EOverflow initialOverflowX() { return OVISIBLE; } 1635 static EOverflow initialOverflowY() { return OVISIBLE; } 1629 1636 static EPageBreak initialPageBreak() { return PBAUTO; } 1630 1637 static EPosition initialPosition() { return StaticPosition; }
Note: See TracChangeset
for help on using the changeset viewer.