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):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14953
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-06-21 David Hyatt <hyatt@apple.com>
+
+ 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):
+
2006-06-21 Justin Garcia <justin.garcia@apple.com>
Reviewed by levi
CSS_PROP_ORPHANS,
CSS_PROP_OUTLINE_STYLE,
CSS_PROP_OVERFLOW,
+ CSS_PROP_OVERFLOW_X,
+ CSS_PROP_OVERFLOW_Y,
CSS_PROP_PADDING_TOP,
CSS_PROP_PADDING_RIGHT,
CSS_PROP_PADDING_BOTTOM,
// FIXME: unimplemented
break;
case CSS_PROP_OVERFLOW:
- switch (style->overflow()) {
+ case CSS_PROP_OVERFLOW_X:
+ case CSS_PROP_OVERFLOW_Y:
+ EOverflow overflow;
+ switch (propertyID) {
+ case CSS_PROP_OVERFLOW_X:
+ overflow = style->overflowX();
+ break;
+ case CSS_PROP_OVERFLOW_Y:
+ overflow = style->overflowY();
+ break;
+ default:
+ overflow = max(style->overflowX(), style->overflowY());
+ }
+ switch (overflow) {
case OVISIBLE:
return new CSSPrimitiveValue(CSS_VAL_VISIBLE);
case OHIDDEN:
outline-style
outline-width
overflow
+overflow-x
+overflow-y
padding-top
padding-right
padding-bottom
break;
case CSS_PROP_OVERFLOW: // visible | hidden | scroll | auto | marquee | overlay | inherit
+ case CSS_PROP_OVERFLOW_X:
+ case CSS_PROP_OVERFLOW_Y:
if (id == CSS_VAL_VISIBLE || id == CSS_VAL_HIDDEN || id == CSS_VAL_SCROLL || id == CSS_VAL_AUTO ||
- id == CSS_VAL__WEBKIT_MARQUEE || id == CSS_VAL__WEBKIT_OVERLAY)
+ id == CSS_VAL__WEBKIT_OVERLAY || id == CSS_VAL__WEBKIT_MARQUEE)
valid_primitive = true;
break;
else
style->addToTextDecorationsInEffect(style->textDecoration());
+ // If either overflow value is not visible, change to auto.
+ if (style->overflowX() == OMARQUEE && style->overflowY() != OMARQUEE)
+ style->setOverflowY(OMARQUEE);
+ else if (style->overflowY() == OMARQUEE && style->overflowX() != OMARQUEE)
+ style->setOverflowX(OMARQUEE);
+ else if (style->overflowX() == OVISIBLE && style->overflowY() != OVISIBLE)
+ style->setOverflowX(OAUTO);
+ else if (style->overflowY() == OVISIBLE && style->overflowX() != OVISIBLE)
+ style->setOverflowY(OAUTO);
+
// Table rows, sections and the table itself will support overflow:hidden and will ignore scroll/auto.
// FIXME: Eventually table sections will support auto and scroll.
- if (style->overflow() != OVISIBLE && style->overflow() != OHIDDEN &&
- (style->display() == TABLE || style->display() == INLINE_TABLE ||
- style->display() == TABLE_ROW_GROUP || style->display() == TABLE_ROW))
- style->setOverflow(OVISIBLE);
+ if (style->display() == TABLE || style->display() == INLINE_TABLE ||
+ style->display() == TABLE_ROW_GROUP || style->display() == TABLE_ROW) {
+ if (style->overflowX() != OVISIBLE && style->overflowX() != OHIDDEN)
+ style->setOverflowX(OVISIBLE);
+ if (style->overflowY() != OVISIBLE && style->overflowY() != OHIDDEN)
+ style->setOverflowY(OVISIBLE);
+ }
// Links should be user selectable when content editable
if (e && e->isLink() && (style->userModify() == READ_WRITE || style->userModify() == READ_WRITE_PLAINTEXT_ONLY))
case CSS_PROP_OVERFLOW:
{
- HANDLE_INHERIT_AND_INITIAL(overflow, Overflow)
- if (!primitiveValue) return;
+ if (isInherit) {
+ style->setOverflowX(parentStyle->overflowX());
+ style->setOverflowY(parentStyle->overflowY());
+ return;
+ }
+
+ if (isInitial) {
+ style->setOverflowX(RenderStyle::initialOverflowX());
+ style->setOverflowY(RenderStyle::initialOverflowY());
+ return;
+ }
+
+ EOverflow o;
+ switch(primitiveValue->getIdent()) {
+ case CSS_VAL_VISIBLE:
+ o = OVISIBLE; break;
+ case CSS_VAL_HIDDEN:
+ o = OHIDDEN; break;
+ case CSS_VAL_SCROLL:
+ o = OSCROLL; break;
+ case CSS_VAL_AUTO:
+ o = OAUTO; break;
+ case CSS_VAL__WEBKIT_MARQUEE:
+ o = OMARQUEE; break;
+ case CSS_VAL__WEBKIT_OVERLAY:
+ o = OOVERLAY; break;
+ default:
+ return;
+ }
+ style->setOverflowX(o);
+ style->setOverflowY(o);
+ return;
+ }
+
+ case CSS_PROP_OVERFLOW_X:
+ {
+ HANDLE_INHERIT_AND_INITIAL(overflowX, OverflowX)
+ EOverflow o;
+ switch(primitiveValue->getIdent())
+ {
+ case CSS_VAL_VISIBLE:
+ o = OVISIBLE; break;
+ case CSS_VAL_HIDDEN:
+ o = OHIDDEN; break;
+ case CSS_VAL_SCROLL:
+ o = OSCROLL; break;
+ case CSS_VAL_AUTO:
+ o = OAUTO; break;
+ case CSS_VAL__WEBKIT_OVERLAY:
+ o = OOVERLAY; break;
+ default:
+ return;
+ }
+ style->setOverflowX(o);
+ return;
+ }
+
+ case CSS_PROP_OVERFLOW_Y:
+ {
+ HANDLE_INHERIT_AND_INITIAL(overflowY, OverflowY)
EOverflow o;
switch(primitiveValue->getIdent())
{
o = OSCROLL; break;
case CSS_VAL_AUTO:
o = OAUTO; break;
- case CSS_VAL__WEBKIT_MARQUEE:
- o = OMARQUEE; break;
case CSS_VAL__WEBKIT_OVERLAY:
o = OOVERLAY; break;
default:
return;
}
- style->setOverflow(o);
+ style->setOverflowY(o);
return;
}
// overflow:hidden and overflow:scroll on <body> as applying to the document's
// scrollbars. The CSS2.1 draft states that HTML UAs should use the <html> or <body> element and XML/XHTML UAs should
// use the root element.
- switch(o->style()->overflow()) {
+ switch (o->style()->overflowX()) {
case OHIDDEN:
- hMode = vMode = ScrollBarAlwaysOff;
+ hMode = ScrollBarAlwaysOff;
break;
case OSCROLL:
- hMode = vMode = ScrollBarAlwaysOn;
+ hMode = ScrollBarAlwaysOn;
break;
case OAUTO:
- hMode = vMode = ScrollBarAuto;
+ hMode = ScrollBarAuto;
+ break;
+ default:
+ // Don't set it at all.
+ ;
+ }
+
+ switch (o->style()->overflowY()) {
+ case OHIDDEN:
+ vMode = ScrollBarAlwaysOff;
+ break;
+ case OSCROLL:
+ vMode = ScrollBarAlwaysOn;
+ break;
+ case OAUTO:
+ vMode = ScrollBarAuto;
break;
default:
// Don't set it at all.
vMode = ScrollBarAlwaysOff;
hMode = ScrollBarAlwaysOff;
} else if (body->hasTagName(bodyTag)) {
- RenderObject* o = (rootRenderer->style()->overflow() == OVISIBLE) ? body->renderer() : rootRenderer;
+ // It's sufficient to just check one overflow direction, since it's illegal to have visible in only one direction.
+ RenderObject* o = rootRenderer->style()->overflowX() == OVISIBLE ? body->renderer() : rootRenderer;
applyOverflowToViewport(o, hMode, vMode); // Only applies to HTML UAs, not to XML/XHTML UAs
}
}
m_maxBottomPosMargin = m_maxBottomNegMargin = 0;
}
+ // For overflow:scroll blocks, ensure we have both scrollbars in place always.
if (scrollsOverflow()) {
- // For overflow:scroll blocks, ensure we have both scrollbars in place always.
- if (style()->overflow() == OSCROLL) {
+ if (style()->overflowX() == OSCROLL)
m_layer->setHasHorizontalScrollbar(true);
+ if (style()->overflowY() == OSCROLL)
m_layer->setHasVerticalScrollbar(true);
- }
-
- // Move the scrollbars aside during layout. The layer will move them back when it
- // does painting or event handling.
- m_layer->moveScrollbarsAside();
}
-
+
IntRect repaintRect;
if (childrenInline())
repaintRect = layoutInlineChildren(relayoutChildren);
// Expand our intrinsic height to encompass floats.
int toAdd = borderBottom() + paddingBottom();
- if (includeScrollbarSize())
+ if (includeHorizontalScrollbarSize())
toAdd += m_layer->horizontalScrollbarHeight();
if (floatBottom() > (m_height - toAdd) && (isInlineBlockOrInlineTable() || isFloatingOrPositioned() || hasOverflowClip() ||
(parent() && parent()->isFlexibleBox())))
}
child->setPos(chPos, child->yPos());
} else {
- int xPos = m_width - borderRight() - paddingRight() - (includeScrollbarSize() ? m_layer->verticalScrollbarWidth() : 0);
+ int xPos = m_width - borderRight() - paddingRight() - (includeVerticalScrollbarSize() ? m_layer->verticalScrollbarWidth() : 0);
int chPos = xPos - (child->width() + child->marginRight());
if (child->avoidsFloats()) {
int rightOff = rightOffset(m_height);
void RenderBlock::layoutBlockChildren(bool relayoutChildren)
{
int top = borderTop() + paddingTop();
- int bottom = borderBottom() + paddingBottom() + (includeScrollbarSize() ? m_layer->horizontalScrollbarHeight() : 0);
+ int bottom = borderBottom() + paddingBottom() + (includeHorizontalScrollbarSize() ? m_layer->horizontalScrollbarHeight() : 0);
m_height = m_overflowHeight = top;
RenderBlock::rightOffset() const
{
int right = m_width - borderRight() - paddingRight();
- if (includeScrollbarSize())
+ if (includeVerticalScrollbarSize())
right -= m_layer->verticalScrollbarWidth();
return right;
}
if (!includeSelf && firstLineBox()) {
for (InlineRunBox* currBox = firstLineBox(); currBox; currBox = currBox->nextLineBox()) {
int rp = currBox->xPos() + currBox->width();
+ // If this node is a root editable element, then the rightmostPosition should account for a caret at the end.
+ // FIXME: Need to find another way to do this, since scrollbars could show when we don't want them to.
+ if (node()->isContentEditable() && node() == node()->rootEditableElement() && style()->direction() == LTR)
+ rp += 1;
right = max(right, rp);
}
- // If this node is a root editable element, then the rightmostPosition should account for a caret at the end.
- if (node()->isContentEditable() && node() == node()->rootEditableElement() && style()->direction() == LTR)
- right += 1;
}
return right;
m_minWidth = m_maxWidth;
// A horizontal marquee with inline children has no minimum width.
- if (style()->overflow() == OMARQUEE && m_layer && m_layer->marquee() &&
- m_layer->marquee()->isHorizontal() && !m_layer->marquee()->isUnfurlMarquee())
+ if (m_layer && m_layer->marquee() && m_layer->marquee()->isHorizontal() && !m_layer->marquee()->isUnfurlMarquee())
m_minWidth = 0;
}
}
// We also handle <body> and <html>, whose overflow applies to the viewport.
- if (_style->overflow() != OVISIBLE && !isRoot() && (!isBody() || !document()->isHTMLDocument()) &&
- (isRenderBlock() || isTableRow() || isTableSection()))
- setHasOverflowClip();
+ if (!isRoot() && (!isBody() || !document()->isHTMLDocument()) && (isRenderBlock() || isTableRow() || isTableSection())) {
+ // Check for overflow clip.
+ // It's sufficient to just check one direction, since it's illegal to have visible on only one overflow value.
+ if (_style->overflowX() != OVISIBLE)
+ setHasOverflowClip();
+ }
if (requiresLayer()) {
if (!m_layer) {
{
int w = m_width - (borderLeft() + borderRight() + paddingLeft() + paddingRight());
- if (includeScrollbarSize())
+ if (includeVerticalScrollbarSize())
w -= m_layer->verticalScrollbarWidth();
return w;
{
int h = m_height - (borderTop() + borderBottom() + paddingTop() + paddingBottom());
- if (includeScrollbarSize())
+ if (includeHorizontalScrollbarSize())
h -= m_layer->horizontalScrollbarHeight();
return h;
// Children of a horizontal marquee do not fill the container by default.
// FIXME: Need to deal with MAUTO value properly. It could be vertical.
- if (parent()->style()->overflow() == OMARQUEE) {
+ if (parent()->style()->overflowX() == OMARQUEE) {
EMarqueeDirection dir = parent()->style()->marqueeDirection();
if (dir == MAUTO || dir == MFORWARD || dir == MBACKWARD || dir == MLEFT || dir == MRIGHT)
return true;
}
// Unfurling marquees override with the furled height.
- if (style()->overflow() == OMARQUEE && m_layer && m_layer->marquee() &&
+ if (style()->overflowX() == OMARQUEE && m_layer && m_layer->marquee() &&
m_layer->marquee()->isUnfurlMarquee() && !m_layer->marquee()->isHorizontal()) {
m_layer->marquee()->setEnd(m_height);
m_height = min(m_height, m_layer->marquee()->unfurlPos());
// to grow to fill the space. This could end up being wrong in some cases, but it is
// preferable to the alternative (sizing intrinsically and making the row end up too big).
RenderTableCell* cell = static_cast<RenderTableCell*>(cb);
- if (scrollsOverflow() &&
- (!cell->style()->height().isAuto() || !cell->table()->style()->height().isAuto()))
+ if (scrollsOverflowY() && (!cell->style()->height().isAuto() || !cell->table()->style()->height().isAuto()))
return 0;
return -1;
}
initMaxMarginValues();
+ // For overflow:scroll blocks, ensure we have both scrollbars in place always.
if (scrollsOverflow()) {
- // For overflow:scroll blocks, ensure we have both scrollbars in place always.
- if (style()->overflow() == OSCROLL) {
+ if (style()->overflowX() == OSCROLL)
m_layer->setHasHorizontalScrollbar(true);
+ if (style()->overflowY() == OSCROLL)
m_layer->setHasVerticalScrollbar(true);
- }
-
- // Move the scrollbars aside during layout. The layer will move them back when it
- // does painting or event handling.
- m_layer->moveScrollbarsAside();
}
if (isHorizontal())
void RenderLayer::scrollToOffset(int x, int y, bool updateScrollbars, bool repaint)
{
- if (renderer()->style()->overflow() != OMARQUEE) {
+ if (renderer()->style()->overflowX() != OMARQUEE) {
if (x < 0) x = 0;
if (y < 0) y = 0;
bool RenderLayer::shouldAutoscroll()
{
- if (renderer()->hasOverflowClip() && (m_object->style()->overflow() != OHIDDEN || renderer()->node()->isContentEditable()))
+ if (renderer()->hasOverflowClip() && (m_object->scrollsOverflow() || renderer()->node()->isContentEditable()))
return true;
return false;
}
return m_hBar->height();
}
-void
-RenderLayer::moveScrollbarsAside()
-{
- if (m_hBar)
- m_hBar->move(0, -50000);
- if (m_vBar)
- m_vBar->move(0, -50000);
-}
-
bool RenderLayer::isPointInResizeControl(const IntPoint& p)
{
return resizeControlRect().contains(IntRect(p, IntSize()));
RenderLayer::updateScrollInfoAfterLayout()
{
m_scrollDimensionsDirty = true;
- if (m_object->style()->overflow() == OHIDDEN)
+ if (m_object->style()->overflowX() == OHIDDEN && m_object->style()->overflowY() == OHIDDEN)
return; // All we had to do was dirty.
bool needHorizontalBar, needVerticalBar;
computeScrollDimensions(&needHorizontalBar, &needVerticalBar);
- if (m_object->style()->overflow() != OMARQUEE) {
+ if (m_object->style()->overflowX() != OMARQUEE) {
// Layout may cause us to be in an invalid scroll position. In this case we need
// to pull our scroll offsets back to the max (or push them up to the min).
int newX = max(0, min(scrollXOffset(), scrollWidth() - m_object->clientWidth()));
bool haveVerticalBar = m_vBar;
// overflow:scroll should just enable/disable.
- if (m_object->style()->overflow() == OSCROLL) {
+ if (m_object->style()->overflowX() == OSCROLL)
m_hBar->setEnabled(needHorizontalBar);
+ if (m_object->style()->overflowY() == OSCROLL)
m_vBar->setEnabled(needVerticalBar);
- }
// overflow:auto may need to lay out again if scrollbars got added/removed.
- bool scrollbarsChanged = (m_object->hasAutoScrollbars()) &&
- (haveHorizontalBar != needHorizontalBar || haveVerticalBar != needVerticalBar);
+ bool scrollbarsChanged = (m_object->hasAutoHorizontalScrollbar() && haveHorizontalBar != needHorizontalBar) ||
+ (m_object->hasAutoVerticalScrollbar() && haveVerticalBar != needVerticalBar);
if (scrollbarsChanged) {
- setHasHorizontalScrollbar(needHorizontalBar);
- setHasVerticalScrollbar(needVerticalBar);
-
+ if (m_object->hasAutoHorizontalScrollbar())
+ setHasHorizontalScrollbar(needHorizontalBar);
+ if (m_object->hasAutoVerticalScrollbar())
+ setHasVerticalScrollbar(needVerticalBar);
+
#if __APPLE__
// Force an update since we know the scrollbars have changed things.
if (m_object->document()->hasDashboardRegions())
m_object->repaint();
- if (m_object->style()->overflow() == OAUTO) {
+ if (m_object->style()->overflowX() == OAUTO || m_object->style()->overflowY() == OAUTO) {
if (!m_inOverflowRelayout) {
// Our proprietary overflow: overlay value doesn't trigger a layout.
m_inOverflowRelayout = true;
sc->dirtyZOrderLists();
}
- if (m_object->style()->overflow() == OMARQUEE && m_object->style()->marqueeBehavior() != MNONE) {
+ if (m_object->style()->overflowX() == OMARQUEE && m_object->style()->marqueeBehavior() != MNONE) {
if (!m_marquee)
m_marquee = new Marquee(this);
m_marquee->updateMarqueeStyle();
QScrollBar* verticalScrollbar() { return m_vBar; }
int verticalScrollbarWidth();
int horizontalScrollbarHeight();
- void moveScrollbarsAside();
void positionScrollbars(const IntRect& absBounds);
void positionResizeControl();
bool isPointInResizeControl(const IntPoint&);
RenderObject::clientWidth() const
{
return width() - borderLeft() - borderRight() -
- (includeScrollbarSize() ? layer()->verticalScrollbarWidth() : 0);
+ (includeVerticalScrollbarSize() ? layer()->verticalScrollbarWidth() : 0);
}
int
RenderObject::clientHeight() const
{
return height() - borderTop() - borderBottom() -
- (includeScrollbarSize() ? layer()->horizontalScrollbarHeight() : 0);
+ (includeHorizontalScrollbarSize() ? layer()->horizontalScrollbarHeight() : 0);
}
// scrollWidth/scrollHeight will be the same as clientWidth/clientHeight unless the
bool isSelectionBorder() const;
bool hasOverflowClip() const { return m_hasOverflowClip; }
- bool hasAutoScrollbars() const { return hasOverflowClip() &&
- (style()->overflow() == OAUTO || style()->overflow() == OOVERLAY); }
- bool scrollsOverflow() const { return hasOverflowClip() &&
- (style()->overflow() == OSCROLL || hasAutoScrollbars()); }
- bool includeScrollbarSize() const { return hasOverflowClip() &&
- (style()->overflow() == OSCROLL || style()->overflow() == OAUTO); }
+
+ bool hasAutoVerticalScrollbar() const { return hasOverflowClip() && (style()->overflowY() == OAUTO || style()->overflowY() == OOVERLAY); }
+ bool hasAutoHorizontalScrollbar() const { return hasOverflowClip() && (style()->overflowX() == OAUTO || style()->overflowX() == OOVERLAY); }
+
+ bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY(); }
+ bool scrollsOverflowX() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || hasAutoHorizontalScrollbar()); }
+ bool scrollsOverflowY() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || hasAutoVerticalScrollbar()); }
+
+ bool includeVerticalScrollbarSize() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || style()->overflowY() == OAUTO); }
+ bool includeHorizontalScrollbarSize() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || style()->overflowX() == OAUTO); }
RenderStyle* getPseudoStyle(RenderStyle::PseudoId pseudo, RenderStyle* parentStyle = 0) const;
w->setWritingDirection(style()->direction() == RTL ? RTL : LTR);
- ScrollBarMode scrollMode = ScrollBarAuto;
- switch (style()->overflow()) {
+ ScrollBarMode verticalScrollMode = ScrollBarAuto;
+ switch (style()->overflowY()) {
case OAUTO:
case OMARQUEE: // makes no sense, map to auto
case OOVERLAY: // not implemented for text, map to auto
case OVISIBLE:
break;
case OHIDDEN:
- scrollMode = ScrollBarAlwaysOff;
+ verticalScrollMode = ScrollBarAlwaysOff;
break;
case OSCROLL:
- scrollMode = ScrollBarAlwaysOn;
+ verticalScrollMode = ScrollBarAlwaysOn;
break;
}
- ScrollBarMode horizontalScrollMode = scrollMode;
+ ScrollBarMode horizontalScrollMode = ScrollBarAuto;
+ switch (style()->overflowX()) {
+ case OAUTO:
+ case OMARQUEE: // makes no sense, map to auto
+ case OOVERLAY: // not implemented for text, map to auto
+ case OVISIBLE:
+ break;
+ case OHIDDEN:
+ horizontalScrollMode = ScrollBarAlwaysOff;
+ break;
+ case OSCROLL:
+ horizontalScrollMode = ScrollBarAlwaysOn;
+ break;
+ }
+
if (static_cast<HTMLTextAreaElement*>(node())->wrap() != HTMLTextAreaElement::ta_NoWrap)
horizontalScrollMode = ScrollBarAlwaysOff;
- w->setScrollBarModes(horizontalScrollMode, scrollMode);
+ w->setScrollBarModes(horizontalScrollMode, verticalScrollMode);
}
void RenderTextArea::setEdited(bool x)
divStyle->setUserModify(element->isReadOnlyControl() ? READ_ONLY : READ_WRITE_PLAINTEXT_ONLY);
if (m_multiLine) {
- // Forward overflow property
- if (startStyle->overflow() == OHIDDEN || startStyle->overflow() == OSCROLL)
- divStyle->setOverflow(startStyle->overflow());
- else
- divStyle->setOverflow(OAUTO);
+ // Forward overflow properties.
+ divStyle->setOverflowX(startStyle->overflowX() == OVISIBLE ? OAUTO : startStyle->overflowX());
+ divStyle->setOverflowY(startStyle->overflowY() == OVISIBLE ? OAUTO : startStyle->overflowY());
+
// Set word wrap property based on wrap attribute
if (static_cast<HTMLTextAreaElement*>(element)->wrap() == HTMLTextAreaElement::ta_NoWrap) {
divStyle->setWhiteSpace(PRE);
} else {
divStyle->setWhiteSpace(PRE);
- divStyle->setOverflow(OHIDDEN);
+ divStyle->setOverflowX(OHIDDEN);
+ divStyle->setOverflowY(OHIDDEN);
}
if (!m_multiLine) {
// FIXME: We should get the size of the scrollbar from the RenderTheme instead of hard coding it here.
int scrollbarSize = 0;
// We are able to have a horizontal scrollbar if the overflow style is scroll, or if its auto and there's no word wrap.
- if (m_div->renderer()->style()->overflow() == OSCROLL || (m_div->renderer()->style()->overflow() == OAUTO && m_div->renderer()->style()->wordWrap() == WBNORMAL))
+ if (m_div->renderer()->style()->overflowX() == OSCROLL || (m_div->renderer()->style()->overflowX() == OAUTO && m_div->renderer()->style()->wordWrap() == WBNORMAL))
scrollbarSize = 15;
m_height = line * rows + toAdd + scrollbarSize;
if (m_multiLine) {
factor = static_cast<HTMLTextAreaElement*>(node())->cols();
// FIXME: We should get the size of the scrollbar from the RenderTheme instead of hard coding it here.
- if (m_div->renderer()->style()->overflow() != OHIDDEN)
+ if (m_div->renderer()->style()->overflowY() != OHIDDEN)
scrollbarSize = 15;
}
else {
m_height = borderTop() + paddingTop();
int toAdd = borderBottom() + paddingBottom();
- if (includeScrollbarSize())
+ if (includeHorizontalScrollbarSize())
toAdd += m_layer->horizontalScrollbarHeight();
// Figure out if we should clear out our line boxes.
)
return Layout;
+ // Overflow returns a layout hint.
+ if (noninherited_flags._overflowX != other->noninherited_flags._overflowX ||
+ noninherited_flags._overflowY != other->noninherited_flags._overflowY)
+ return Layout;
+
// only for inline:
// EVerticalAlign _vertical_align : 4;
// Repaint:
// EVisibility _visibility : 2;
-// EOverflow _overflow : 4 ;
// int _text_decoration : 4;
// DataRef<StyleBackgroundData> background;
if (inherited->color != other->inherited->color ||
- !(inherited_flags._visibility == other->inherited_flags._visibility) ||
- !(noninherited_flags._overflow == other->noninherited_flags._overflow) ||
+ inherited_flags._visibility != other->inherited_flags._visibility ||
!(inherited_flags._text_decorations == other->inherited_flags._text_decorations) ||
!(inherited_flags._force_backgrounds_to_white == other->inherited_flags._force_backgrounds_to_white) ||
!(surround->border == other->surround->border) ||
// Random visual rendering model attributes. Not inherited.
enum EOverflow {
- OVISIBLE, OHIDDEN, OSCROLL, OAUTO, OMARQUEE, OOVERLAY
+ OVISIBLE, OHIDDEN, OSCROLL, OAUTO, OOVERLAY, OMARQUEE
};
enum EVerticalAlign {
return (_effectiveDisplay == other._effectiveDisplay) &&
(_originalDisplay == other._originalDisplay) &&
(_bg_repeat == other._bg_repeat) &&
- (_overflow == other._overflow) &&
+ (_overflowX == other._overflowX) &&
+ (_overflowY == other._overflowY) &&
(_vertical_align == other._vertical_align) &&
(_clear == other._clear) &&
(_position == other._position) &&
unsigned _effectiveDisplay : 5; // EDisplay
unsigned _originalDisplay : 5; // EDisplay
unsigned _bg_repeat : 2; // EBackgroundRepeat
- unsigned _overflow : 4; // EOverflow
+ unsigned _overflowX : 4; // EOverflow
+ unsigned _overflowY : 4; // EOverflow
unsigned _vertical_align : 4; // EVerticalAlign
unsigned _clear : 2; // EClear
unsigned _position : 2; // EPosition
inherited_flags._force_backgrounds_to_white = false;
noninherited_flags._effectiveDisplay = noninherited_flags._originalDisplay = initialDisplay();
- noninherited_flags._overflow = initialOverflow();
+ noninherited_flags._overflowX = initialOverflowX();
+ noninherited_flags._overflowY = initialOverflowY();
noninherited_flags._vertical_align = initialVerticalAlign();
noninherited_flags._clear = initialClear();
noninherited_flags._position = initialPosition();
bool outlineStyleIsAuto() const { return background->m_outline._auto; }
const Color & outlineColor() const { return background->m_outline.color; }
- EOverflow overflow() const { return static_cast<EOverflow>(noninherited_flags._overflow); }
+ EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); }
+ EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags._overflowY); }
+
EVisibility visibility() const { return static_cast<EVisibility>(inherited_flags._visibility); }
EVerticalAlign verticalAlign() const { return static_cast<EVerticalAlign>(noninherited_flags._vertical_align); }
Length verticalAlignLength() const { return box->vertical_align; }
}
void setOutlineColor(const Color & v) { SET_VAR(background,m_outline.color,v) }
- void setOverflow(EOverflow v) { noninherited_flags._overflow = v; }
+ void setOverflowX(EOverflow v) { noninherited_flags._overflowX = v; }
+ void setOverflowY(EOverflow v) { noninherited_flags._overflowY = v; }
void setVisibility(EVisibility v) { inherited_flags._visibility = v; }
void setVerticalAlign(EVerticalAlign v) { noninherited_flags._vertical_align = v; }
void setVerticalAlignLength(Length l) { SET_VAR(box, vertical_align, l ) }
static EFloat initialFloating() { return FNONE; }
static EListStylePosition initialListStylePosition() { return OUTSIDE; }
static EListStyleType initialListStyleType() { return DISC; }
- static EOverflow initialOverflow() { return OVISIBLE; }
+ static EOverflow initialOverflowX() { return OVISIBLE; }
+ static EOverflow initialOverflowY() { return OVISIBLE; }
static EPageBreak initialPageBreak() { return PBAUTO; }
static EPosition initialPosition() { return StaticPosition; }
static ETableLayout initialTableLayout() { return TAUTO; }