diff options
Diffstat (limited to 'Source/WebCore/rendering/RenderBox.cpp')
-rw-r--r-- | Source/WebCore/rendering/RenderBox.cpp | 59 |
1 files changed, 36 insertions, 23 deletions
diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 265c46a..39c80d4 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -425,8 +425,8 @@ int RenderBox::scrollWidth() const // For objects with visible overflow, this matches IE. // FIXME: Need to work right with writing modes. if (style()->isLeftToRightDirection()) - return max(clientWidth(), rightLayoutOverflow() - borderLeft()); - return clientWidth() - min(0, leftLayoutOverflow() - borderLeft()); + return max(clientWidth(), maxXLayoutOverflow() - borderLeft()); + return clientWidth() - min(0, minXLayoutOverflow() - borderLeft()); } int RenderBox::scrollHeight() const @@ -435,7 +435,7 @@ int RenderBox::scrollHeight() const return layer()->scrollHeight(); // For objects with visible overflow, this matches IE. // FIXME: Need to work right with writing modes. - return max(clientHeight(), bottomLayoutOverflow() - borderTop()); + return max(clientHeight(), maxYLayoutOverflow() - borderTop()); } int RenderBox::scrollLeft() const @@ -559,16 +559,16 @@ IntRect RenderBox::reflectedRect(const IntRect& r) const IntRect result = r; switch (style()->boxReflect()->direction()) { case ReflectionBelow: - result.setY(box.bottom() + reflectionOffset() + (box.bottom() - r.bottom())); + result.setY(box.maxY() + reflectionOffset() + (box.maxY() - r.maxY())); break; case ReflectionAbove: - result.setY(box.y() - reflectionOffset() - box.height() + (box.bottom() - r.bottom())); + result.setY(box.y() - reflectionOffset() - box.height() + (box.maxY() - r.maxY())); break; case ReflectionLeft: - result.setX(box.x() - reflectionOffset() - box.width() + (box.right() - r.right())); + result.setX(box.x() - reflectionOffset() - box.width() + (box.maxX() - r.maxX())); break; case ReflectionRight: - result.setX(box.right() + reflectionOffset() + (box.right() - r.right())); + result.setX(box.maxX() + reflectionOffset() + (box.maxX() - r.maxX())); break; } return result; @@ -1279,8 +1279,14 @@ IntSize RenderBox::offsetFromContainer(RenderObject* o, const IntPoint& point) c if (!isInline() || isReplaced()) { if (style()->position() != AbsolutePosition && style()->position() != FixedPosition) { - o->adjustForColumns(offset, IntPoint(point.x() + x(), point.y() + y())); - offset += locationOffsetIncludingFlipping(); + if (o->hasColumns()) { + IntRect columnRect(frameRect()); + toRenderBlock(o)->flipForWritingModeIncludingColumns(columnRect); + offset += IntSize(columnRect.location().x(), columnRect.location().y()); + columnRect.move(point.x(), point.y()); + o->adjustForColumns(offset, columnRect.location()); + } else + offset += locationOffsetIncludingFlipping(); } else offset += locationOffset(); } @@ -3067,12 +3073,12 @@ IntRect RenderBox::localCaretRect(InlineBox* box, int caretOffset, int* extraWid // <rdar://problem/3777804> Deleting all content in a document can result in giant tall-as-window insertion point // // FIXME: ignoring :first-line, missing good reason to take care of - int fontHeight = style()->font().height(); + int fontHeight = style()->fontMetrics().height(); if (fontHeight > rect.height() || (!isReplaced() && !isTable())) rect.setHeight(fontHeight); if (extraWidthToEndOfLine) - *extraWidthToEndOfLine = x() + width() - rect.right(); + *extraWidthToEndOfLine = x() + width() - rect.maxX(); // Move to local coords rect.move(-x(), -y()); @@ -3193,9 +3199,9 @@ void RenderBox::addShadowOverflow() style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadowLeft); IntRect borderBox = borderBoxRect(); int overflowLeft = borderBox.x() + shadowLeft; - int overflowRight = borderBox.right() + shadowRight; + int overflowRight = borderBox.maxX() + shadowRight; int overflowTop = borderBox.y() + shadowTop; - int overflowBottom = borderBox.bottom() + shadowBottom; + int overflowBottom = borderBox.maxY() + shadowBottom; addVisualOverflow(IntRect(overflowLeft, overflowTop, overflowRight - overflowLeft, overflowBottom - overflowTop)); } @@ -3234,13 +3240,13 @@ void RenderBox::addLayoutOverflow(const IntRect& rect) bool hasLeftOverflow = !style()->isLeftToRightDirection() && style()->isHorizontalWritingMode(); if (!hasTopOverflow) - overflowRect.shiftTopEdgeTo(max(overflowRect.y(), clientBox.y())); + overflowRect.shiftYEdgeTo(max(overflowRect.y(), clientBox.y())); else - overflowRect.shiftBottomEdgeTo(min(overflowRect.bottom(), clientBox.bottom())); + overflowRect.shiftMaxYEdgeTo(min(overflowRect.maxY(), clientBox.maxY())); if (!hasLeftOverflow) - overflowRect.shiftLeftEdgeTo(max(overflowRect.x(), clientBox.x())); + overflowRect.shiftXEdgeTo(max(overflowRect.x(), clientBox.x())); else - overflowRect.shiftRightEdgeTo(min(overflowRect.right(), clientBox.right())); + overflowRect.shiftMaxXEdgeTo(min(overflowRect.maxX(), clientBox.maxX())); // Now re-test with the adjusted rectangle and see if it has become unreachable or fully // contained. @@ -3329,9 +3335,9 @@ IntRect RenderBox::visualOverflowRectForPropagation(RenderStyle* parentStyle) co // We are putting ourselves into our parent's coordinate space. If there is a flipped block mismatch // in a particular axis, then we have to flip the rect along that axis. if (style()->writingMode() == RightToLeftWritingMode || parentStyle->writingMode() == RightToLeftWritingMode) - rect.setX(width() - rect.right()); + rect.setX(width() - rect.maxX()); else if (style()->writingMode() == BottomToTopWritingMode || parentStyle->writingMode() == BottomToTopWritingMode) - rect.setY(height() - rect.bottom()); + rect.setY(height() - rect.maxY()); return rect; } @@ -3375,9 +3381,9 @@ IntRect RenderBox::layoutOverflowRectForPropagation(RenderStyle* parentStyle) co // We are putting ourselves into our parent's coordinate space. If there is a flipped block mismatch // in a particular axis, then we have to flip the rect along that axis. if (style()->writingMode() == RightToLeftWritingMode || parentStyle->writingMode() == RightToLeftWritingMode) - rect.setX(width() - rect.right()); + rect.setX(width() - rect.maxX()); else if (style()->writingMode() == BottomToTopWritingMode || parentStyle->writingMode() == BottomToTopWritingMode) - rect.setY(height() - rect.bottom()); + rect.setY(height() - rect.maxY()); return rect; } @@ -3400,9 +3406,9 @@ void RenderBox::flipForWritingMode(IntRect& rect) const return; if (style()->isHorizontalWritingMode()) - rect.setY(height() - rect.bottom()); + rect.setY(height() - rect.maxY()); else - rect.setX(width() - rect.right()); + rect.setX(width() - rect.maxX()); } int RenderBox::flipForWritingMode(int position) const @@ -3419,6 +3425,13 @@ IntPoint RenderBox::flipForWritingMode(const IntPoint& position) const return style()->isHorizontalWritingMode() ? IntPoint(position.x(), height() - position.y()) : IntPoint(width() - position.x(), position.y()); } +IntPoint RenderBox::flipForWritingModeIncludingColumns(const IntPoint& point) const +{ + if (!hasColumns() || !style()->isFlippedBlocksWritingMode()) + return flipForWritingMode(point); + return toRenderBlock(this)->flipForWritingModeIncludingColumns(point); +} + IntSize RenderBox::flipForWritingMode(const IntSize& offset) const { if (!style()->isFlippedBlocksWritingMode()) |