Commit aa0cba07 authored by hyatt@apple.com's avatar hyatt@apple.com

https://bugs.webkit.org/show_bug.cgi?id=53520

        
Reviewed by Oliver Hunt.

Remove the physical terminology from IntRect and FloatRect.
        
Now that we have flipped RenderBlocks for vertical-rl and horizontal-bt writing modes,
we need to update our terminology to be more accurate.

I'm borrowing a page from AppKit here (which also supports flipped NSViews) and
renaming right() and bottom() to maxX() and maxY().  These terms remain accurate
even for flipped rectangles.

../WebCore: 

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::boundsForVisiblePositionRange):
* accessibility/mac/AccessibilityObjectWrapper.mm:
(-[AccessibilityObjectWrapper position]):
* dom/ClientRect.h:
(WebCore::ClientRect::right):
(WebCore::ClientRect::bottom):
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::convertLogicalToDevice):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::normalizeRect):
* inspector/InspectorAgent.cpp:
(WebCore::InspectorAgent::drawElementTitle):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::adjustWindowRect):
* page/DragController.cpp:
(WebCore::dragLocForSelectionDrag):
* page/EventHandler.cpp:
(WebCore::EventHandler::sendContextMenuEventForKey):
* page/PrintContext.cpp:
(WebCore::PrintContext::computePageRectsWithPageSizeInternal):
(WebCore::PrintContext::pageNumberForElement):
* page/SpatialNavigation.cpp:
(WebCore::end):
(WebCore::areRectsFullyAligned):
(WebCore::areRectsMoreThanFullScreenApart):
(WebCore::below):
(WebCore::rightOf):
(WebCore::isRectInDirection):
(WebCore::entryAndExitPointsForDirection):
(WebCore::virtualRectForDirection):
* page/WindowFeatures.cpp:
(WebCore::WindowFeatures::WindowFeatures):
* platform/ScrollView.cpp:
(WebCore::ScrollView::wheelEvent):
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::setFrameRect):
* platform/ScrollbarThemeComposite.cpp:
(WebCore::ScrollbarThemeComposite::splitTrack):
* platform/chromium/ScrollbarThemeChromium.cpp:
(WebCore::ScrollbarThemeChromium::paintTickmarks):
* platform/graphics/FloatQuad.h:
(WebCore::FloatQuad::FloatQuad):
* platform/graphics/FloatRect.cpp:
(WebCore::FloatRect::intersects):
(WebCore::FloatRect::contains):
(WebCore::FloatRect::intersect):
(WebCore::FloatRect::unite):
(WebCore::enclosingIntRect):
* platform/graphics/FloatRect.h:
(WebCore::FloatRect::maxX):
(WebCore::FloatRect::maxY):
(WebCore::FloatRect::contains):
* platform/graphics/IntRect.cpp:
(WebCore::IntRect::intersects):
(WebCore::IntRect::contains):
(WebCore::IntRect::intersect):
(WebCore::IntRect::unite):
* platform/graphics/IntRect.h:
(WebCore::IntRect::maxX):
(WebCore::IntRect::maxY):
(WebCore::IntRect::shiftXEdgeTo):
(WebCore::IntRect::shiftMaxXEdgeTo):
(WebCore::IntRect::shiftYEdgeTo):
(WebCore::IntRect::shiftMaxYEdgeTo):
(WebCore::IntRect::contains):
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advance):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawRect):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::fillRect):
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::getImageData):
(WebCore::putImageData):
* platform/graphics/cg/ImageCG.cpp:
(WebCore::BitmapImage::draw):
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::copyImageBytes):
* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::ComplexTextController::adjustGlyphsAndAdvances):
* platform/graphics/mac/SimpleFontDataMac.mm:
(WebCore::SimpleFontData::platformBoundsForGlyph):
* platform/graphics/transforms/AffineTransform.cpp:
(WebCore::AffineTransform::mapRect):
* platform/graphics/win/FontCGWin.cpp:
(WebCore::drawGDIGlyphs):
* platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp:
(WebCore::MediaPlayerPrivate::paint):
* platform/gtk/RenderThemeGtk.cpp:
(WebCore::centerRectVerticallyInParentInputElement):
* platform/mac/WidgetMac.mm:
(WebCore::Widget::paint):
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::addBoxShadowVisualOverflow):
(WebCore::InlineFlowBox::addTextBoxVisualOverflow):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::selectionRect):
(WebCore::InlineTextBox::paint):
(WebCore::InlineTextBox::positionForOffset):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::addOverflowFromChildren):
(WebCore::RenderBlock::paintChildren):
(WebCore::RenderBlock::paintEllipsisBoxes):
(WebCore::RenderBlock::inlineSelectionGaps):
(WebCore::RenderBlock::adjustPointToColumnContents):
(WebCore::RenderBlock::flipForWritingModeIncludingColumns):
(WebCore::RenderBlock::adjustForColumns):
* rendering/RenderBlock.h:
(WebCore::RenderBlock::FloatingObject::right):
(WebCore::RenderBlock::FloatingObject::bottom):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::reflectedRect):
(WebCore::RenderBox::localCaretRect):
(WebCore::RenderBox::addShadowOverflow):
(WebCore::RenderBox::addLayoutOverflow):
(WebCore::RenderBox::visualOverflowRectForPropagation):
(WebCore::RenderBox::layoutOverflowRectForPropagation):
(WebCore::RenderBox::flipForWritingMode):
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::paintColumnBorder):
(WebCore::RenderFrameSet::paintRowBorder):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::paintOutlineForLine):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::getRectToExpose):
(WebCore::cornerRect):
(WebCore::RenderLayer::positionOverflowControls):
(WebCore::RenderLayer::overflowBottom):
(WebCore::RenderLayer::overflowRight):
(WebCore::RenderLayer::paintResizer):
* rendering/RenderLineBoxList.cpp:
(WebCore::RenderLineBoxList::rangeIntersectsRect):
(WebCore::RenderLineBoxList::paint):
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::positionListMarker):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::paint):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::repaintAfterLayoutIfNeeded):
* rendering/RenderOverflow.h:
(WebCore::RenderOverflow::RenderOverflow):
(WebCore::RenderOverflow::addLayoutOverflow):
(WebCore::RenderOverflow::addVisualOverflow):
(WebCore::RenderOverflow::setLayoutOverflow):
(WebCore::RenderOverflow::setVisualOverflow):
(WebCore::RenderOverflow::resetLayoutOverflow):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::shouldPaint):
* rendering/RenderScrollbarTheme.cpp:
(WebCore::RenderScrollbarTheme::constrainTrackRectToTrackPieces):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::paint):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::paint):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::paintObject):
* rendering/RenderText.cpp:
(WebCore::RenderText::absoluteQuads):
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::forwardEvent):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintMenuListButtonGradients):
(WebCore::RenderThemeMac::paintMenuListButton):
(WebCore::RenderThemeMac::paintSliderTrack):
* rendering/RenderView.cpp:
(WebCore::RenderView::computeRectForRepaint):
(WebCore::RenderView::docBottom):
(WebCore::RenderView::docRight):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::paddedLayoutOverflowRect):
* rendering/svg/RenderSVGInlineText.cpp:
(WebCore::RenderSVGInlineText::localCaretRect):

../WebKit/mac: 

* WebView/WebHTMLView.mm:
(setNeedsDisplayInRect):

../WebKit2: 

* Platform/Region.cpp:
(WebKit::Region::Shape::Shape):
* UIProcess/API/mac/WKPrintingView.mm:
(pageDidComputePageRects):
* UIProcess/FindIndicator.cpp:
(WebKit::FindIndicator::draw):
* UIProcess/TiledDrawingAreaProxy.cpp:
(WebKit::TiledDrawingAreaProxy::invalidate):
(WebKit::TiledDrawingAreaProxy::paint):
(WebKit::TiledDrawingAreaProxy::createTiles):
* UIProcess/mac/ChunkedUpdateDrawingAreaProxyMac.mm:
(WebKit::ChunkedUpdateDrawingAreaProxy::drawUpdateChunkIntoBackingStore):
* WebProcess/Plugins/Netscape/NetscapePlugin.cpp:
(WebKit::NetscapePlugin::callSetWindow):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77286 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8d8f1e04
2011-02-01 David Hyatt <hyatt@apple.com>
Reviewed by Oliver Hunt.
https://bugs.webkit.org/show_bug.cgi?id=53520
Remove the physical terminology from IntRect and FloatRect.
Now that we have flipped RenderBlocks for vertical-rl and horizontal-bt writing modes,
we need to update our terminology to be more accurate.
I'm borrowing a page from AppKit here (which also supports flipped NSViews) and
renaming right() and bottom() to maxX() and maxY(). These terms remain accurate
even for flipped rectangles.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::boundsForVisiblePositionRange):
* accessibility/mac/AccessibilityObjectWrapper.mm:
(-[AccessibilityObjectWrapper position]):
* dom/ClientRect.h:
(WebCore::ClientRect::right):
(WebCore::ClientRect::bottom):
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::convertLogicalToDevice):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::normalizeRect):
* inspector/InspectorAgent.cpp:
(WebCore::InspectorAgent::drawElementTitle):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::adjustWindowRect):
* page/DragController.cpp:
(WebCore::dragLocForSelectionDrag):
* page/EventHandler.cpp:
(WebCore::EventHandler::sendContextMenuEventForKey):
* page/PrintContext.cpp:
(WebCore::PrintContext::computePageRectsWithPageSizeInternal):
(WebCore::PrintContext::pageNumberForElement):
* page/SpatialNavigation.cpp:
(WebCore::end):
(WebCore::areRectsFullyAligned):
(WebCore::areRectsMoreThanFullScreenApart):
(WebCore::below):
(WebCore::rightOf):
(WebCore::isRectInDirection):
(WebCore::entryAndExitPointsForDirection):
(WebCore::virtualRectForDirection):
* page/WindowFeatures.cpp:
(WebCore::WindowFeatures::WindowFeatures):
* platform/ScrollView.cpp:
(WebCore::ScrollView::wheelEvent):
* platform/Scrollbar.cpp:
(WebCore::Scrollbar::setFrameRect):
* platform/ScrollbarThemeComposite.cpp:
(WebCore::ScrollbarThemeComposite::splitTrack):
* platform/chromium/ScrollbarThemeChromium.cpp:
(WebCore::ScrollbarThemeChromium::paintTickmarks):
* platform/graphics/FloatQuad.h:
(WebCore::FloatQuad::FloatQuad):
* platform/graphics/FloatRect.cpp:
(WebCore::FloatRect::intersects):
(WebCore::FloatRect::contains):
(WebCore::FloatRect::intersect):
(WebCore::FloatRect::unite):
(WebCore::enclosingIntRect):
* platform/graphics/FloatRect.h:
(WebCore::FloatRect::maxX):
(WebCore::FloatRect::maxY):
(WebCore::FloatRect::contains):
* platform/graphics/IntRect.cpp:
(WebCore::IntRect::intersects):
(WebCore::IntRect::contains):
(WebCore::IntRect::intersect):
(WebCore::IntRect::unite):
* platform/graphics/IntRect.h:
(WebCore::IntRect::maxX):
(WebCore::IntRect::maxY):
(WebCore::IntRect::shiftXEdgeTo):
(WebCore::IntRect::shiftMaxXEdgeTo):
(WebCore::IntRect::shiftYEdgeTo):
(WebCore::IntRect::shiftMaxYEdgeTo):
(WebCore::IntRect::contains):
* platform/graphics/WidthIterator.cpp:
(WebCore::WidthIterator::advance):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawRect):
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::fillRect):
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::getImageData):
(WebCore::putImageData):
* platform/graphics/cg/ImageCG.cpp:
(WebCore::BitmapImage::draw):
* platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::copyImageBytes):
* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::ComplexTextController::adjustGlyphsAndAdvances):
* platform/graphics/mac/SimpleFontDataMac.mm:
(WebCore::SimpleFontData::platformBoundsForGlyph):
* platform/graphics/transforms/AffineTransform.cpp:
(WebCore::AffineTransform::mapRect):
* platform/graphics/win/FontCGWin.cpp:
(WebCore::drawGDIGlyphs):
* platform/graphics/win/MediaPlayerPrivateQuickTimeWin.cpp:
(WebCore::MediaPlayerPrivate::paint):
* platform/gtk/RenderThemeGtk.cpp:
(WebCore::centerRectVerticallyInParentInputElement):
* platform/mac/WidgetMac.mm:
(WebCore::Widget::paint):
* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::addBoxShadowVisualOverflow):
(WebCore::InlineFlowBox::addTextBoxVisualOverflow):
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::selectionRect):
(WebCore::InlineTextBox::paint):
(WebCore::InlineTextBox::positionForOffset):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::addOverflowFromChildren):
(WebCore::RenderBlock::paintChildren):
(WebCore::RenderBlock::paintEllipsisBoxes):
(WebCore::RenderBlock::inlineSelectionGaps):
(WebCore::RenderBlock::adjustPointToColumnContents):
(WebCore::RenderBlock::flipForWritingModeIncludingColumns):
(WebCore::RenderBlock::adjustForColumns):
* rendering/RenderBlock.h:
(WebCore::RenderBlock::FloatingObject::right):
(WebCore::RenderBlock::FloatingObject::bottom):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::reflectedRect):
(WebCore::RenderBox::localCaretRect):
(WebCore::RenderBox::addShadowOverflow):
(WebCore::RenderBox::addLayoutOverflow):
(WebCore::RenderBox::visualOverflowRectForPropagation):
(WebCore::RenderBox::layoutOverflowRectForPropagation):
(WebCore::RenderBox::flipForWritingMode):
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::paintColumnBorder):
(WebCore::RenderFrameSet::paintRowBorder):
* rendering/RenderInline.cpp:
(WebCore::RenderInline::paintOutlineForLine):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::getRectToExpose):
(WebCore::cornerRect):
(WebCore::RenderLayer::positionOverflowControls):
(WebCore::RenderLayer::overflowBottom):
(WebCore::RenderLayer::overflowRight):
(WebCore::RenderLayer::paintResizer):
* rendering/RenderLineBoxList.cpp:
(WebCore::RenderLineBoxList::rangeIntersectsRect):
(WebCore::RenderLineBoxList::paint):
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::positionListMarker):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::paint):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::repaintAfterLayoutIfNeeded):
* rendering/RenderOverflow.h:
(WebCore::RenderOverflow::RenderOverflow):
(WebCore::RenderOverflow::addLayoutOverflow):
(WebCore::RenderOverflow::addVisualOverflow):
(WebCore::RenderOverflow::setLayoutOverflow):
(WebCore::RenderOverflow::setVisualOverflow):
(WebCore::RenderOverflow::resetLayoutOverflow):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::shouldPaint):
* rendering/RenderScrollbarTheme.cpp:
(WebCore::RenderScrollbarTheme::constrainTrackRectToTrackPieces):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::paint):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::paint):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::paintObject):
* rendering/RenderText.cpp:
(WebCore::RenderText::absoluteQuads):
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::forwardEvent):
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintMenuListButtonGradients):
(WebCore::RenderThemeMac::paintMenuListButton):
(WebCore::RenderThemeMac::paintSliderTrack):
* rendering/RenderView.cpp:
(WebCore::RenderView::computeRectForRepaint):
(WebCore::RenderView::docBottom):
(WebCore::RenderView::docRight):
* rendering/RootInlineBox.cpp:
(WebCore::RootInlineBox::paddedLayoutOverflowRect):
* rendering/svg/RenderSVGInlineText.cpp:
(WebCore::RenderSVGInlineText::localCaretRect):
2011-02-01 Beth Dakin <bdakin@apple.com>
Reviewed by Sam Weinig.
......@@ -2519,7 +2519,7 @@ IntRect AccessibilityRenderObject::boundsForVisiblePositionRange(const VisiblePo
ourrect.unite(rect2);
// if the rectangle spans lines and contains multiple text chars, use the range's bounding box intead
if (rect1.bottom() != rect2.bottom()) {
if (rect1.maxY() != rect2.maxY()) {
RefPtr<Range> dataRange = makeRange(range.start, range.end);
IntRect boundingBox = dataRange->boundingBox();
String rangeString = plainText(dataRange.get());
......
......@@ -1125,7 +1125,7 @@ static NSMutableArray* convertToNSArray(const AccessibilityObject::Accessibility
point.y = screenHeight - (point.y + remotePosition.y + rect.height() - scrollPosition.y);
} else {
// The Cocoa accessibility API wants the lower-left corner.
point = NSMakePoint(rect.x(), rect.bottom());
point = NSMakePoint(rect.x(), rect.maxY());
if (frameView) {
NSView* view = frameView->documentView();
......
......@@ -42,8 +42,8 @@ namespace WebCore {
static PassRefPtr<ClientRect> create(const FloatRect& rect) { return adoptRef(new ClientRect(rect)); }
float top() const { return m_rect.y(); }
float right() const { return m_rect.right(); }
float bottom() const { return m_rect.bottom(); }
float right() const { return m_rect.maxX(); }
float bottom() const { return m_rect.maxY(); }
float left() const { return m_rect.x(); }
float width() const { return m_rect.width(); }
float height() const { return m_rect.height(); }
......
......@@ -344,10 +344,10 @@ String HTMLCanvasElement::toDataURL(const String& mimeType, const double* qualit
IntRect HTMLCanvasElement::convertLogicalToDevice(const FloatRect& logicalRect) const
{
float left = floorf(logicalRect.left() * m_pageScaleFactor);
float top = floorf(logicalRect.top() * m_pageScaleFactor);
float right = ceilf(logicalRect.right() * m_pageScaleFactor);
float bottom = ceilf(logicalRect.bottom() * m_pageScaleFactor);
float left = floorf(logicalRect.x() * m_pageScaleFactor);
float top = floorf(logicalRect.y() * m_pageScaleFactor);
float right = ceilf(logicalRect.maxX() * m_pageScaleFactor);
float bottom = ceilf(logicalRect.maxY() * m_pageScaleFactor);
return IntRect(IntPoint(left, top), convertToValidDeviceSize(right - left, bottom - top));
}
......
......@@ -1105,8 +1105,8 @@ static IntSize size(HTMLVideoElement* video)
static inline FloatRect normalizeRect(const FloatRect& rect)
{
return FloatRect(min(rect.x(), rect.right()),
min(rect.y(), rect.bottom()),
return FloatRect(min(rect.x(), rect.maxX()),
min(rect.y(), rect.maxY()),
max(rect.width(), -rect.width()),
max(rect.height(), -rect.height()));
}
......
......@@ -1274,7 +1274,7 @@ void InspectorAgent::drawElementTitle(GraphicsContext& context, const IntRect& b
font.update(0);
TextRun nodeTitleRun(nodeTitle);
IntPoint titleBasePoint = boundingBox.bottomLeft();
IntPoint titleBasePoint = IntPoint(boundingBox.x(), boundingBox.maxY() - 1);
titleBasePoint.move(rectInflatePx, rectInflatePx);
IntRect titleRect = enclosingIntRect(font.selectionRectForText(nodeTitleRun, titleBasePoint, fontHeightPx));
titleRect.inflate(rectInflatePx);
......@@ -1284,19 +1284,19 @@ void InspectorAgent::drawElementTitle(GraphicsContext& context, const IntRect& b
int dy = borderWidthPx;
// If the tip sticks beyond the right of overlayRect, right-align the tip with the said boundary.
if (titleRect.right() > overlayRect.right())
dx = overlayRect.right() - titleRect.right();
if (titleRect.maxX() > overlayRect.maxX())
dx = overlayRect.maxX() - titleRect.maxX();
// If the tip sticks beyond the left of overlayRect, left-align the tip with the said boundary.
if (titleRect.x() + dx < overlayRect.x())
dx = overlayRect.x() - titleRect.x() - borderWidthPx;
// If the tip sticks beyond the bottom of overlayRect, show the tip at top of bounding box.
if (titleRect.bottom() > overlayRect.bottom()) {
dy = boundingBox.y() - titleRect.bottom() - borderWidthPx;
if (titleRect.maxY() > overlayRect.maxY()) {
dy = boundingBox.y() - titleRect.maxY() - borderWidthPx;
// If the tip still sticks beyond the bottom of overlayRect, bottom-align the tip with the said boundary.
if (titleRect.bottom() + dy > overlayRect.bottom())
dy = overlayRect.bottom() - titleRect.bottom();
if (titleRect.maxY() + dy > overlayRect.maxY())
dy = overlayRect.maxY() - titleRect.maxY();
}
// If the tip sticks beyond the top of overlayRect, show the tip at top of overlayRect.
......
......@@ -342,8 +342,8 @@ void DOMWindow::adjustWindowRect(const FloatRect& screen, FloatRect& window, con
window.setHeight(min(max(100.0f, window.height()), screen.height()));
// Constrain the window position to the screen.
window.setX(max(screen.x(), min(window.x(), screen.right() - window.width())));
window.setY(max(screen.y(), min(window.y(), screen.bottom() - window.height())));
window.setX(max(screen.x(), min(window.x(), screen.maxX() - window.width())));
window.setY(max(screen.y(), min(window.y(), screen.maxY() - window.height())));
}
// FIXME: We can remove this function once V8 showModalDialog is changed to use DOMWindow.
......
......@@ -644,9 +644,9 @@ static IntPoint dragLocForDHTMLDrag(const IntPoint& mouseDraggedPoint, const Int
static IntPoint dragLocForSelectionDrag(Frame* src)
{
IntRect draggingRect = enclosingIntRect(src->selection()->bounds());
int xpos = draggingRect.right();
int xpos = draggingRect.maxX();
xpos = draggingRect.x() < xpos ? draggingRect.x() : xpos;
int ypos = draggingRect.bottom();
int ypos = draggingRect.maxY();
#if PLATFORM(MAC)
// Deal with flipped coordinates on Mac
ypos = draggingRect.y() > ypos ? draggingRect.y() : ypos;
......
......@@ -2132,12 +2132,12 @@ bool EventHandler::sendContextMenuEventForKey()
RefPtr<Range> selection = selectionController->toNormalizedRange();
IntRect firstRect = m_frame->editor()->firstRectForRange(selection.get());
int x = rightAligned ? firstRect.right() : firstRect.x();
location = IntPoint(x, firstRect.bottom());
int x = rightAligned ? firstRect.maxX() : firstRect.x();
location = IntPoint(x, firstRect.maxY());
} else if (focusedNode) {
RenderBoxModelObject* box = focusedNode->renderBoxModelObject();
IntRect clippedRect = box->absoluteClippedOverflowRect();
location = clippedRect.bottomLeft();
location = IntPoint(clippedRect.x(), clippedRect.maxY() - 1);
} else {
location = IntPoint(
rightAligned ? view->contentsWidth() - kContextMenuMargin : kContextMenuMargin,
......
......@@ -135,24 +135,24 @@ void PrintContext::computePageRectsWithPageSizeInternal(const FloatSize& pageSiz
int blockDirectionEnd;
if (isHorizontal) {
if (view->style()->isFlippedBlocksWritingMode()) {
blockDirectionStart = docRect.bottom();
blockDirectionStart = docRect.maxY();
blockDirectionEnd = docRect.y();
} else {
blockDirectionStart = docRect.y();
blockDirectionEnd = docRect.bottom();
blockDirectionEnd = docRect.maxY();
}
inlineDirectionStart = view->style()->isLeftToRightDirection() ? docRect.x() : docRect.right();
inlineDirectionEnd = view->style()->isLeftToRightDirection() ? docRect.right() : docRect.x();
inlineDirectionStart = view->style()->isLeftToRightDirection() ? docRect.x() : docRect.maxX();
inlineDirectionEnd = view->style()->isLeftToRightDirection() ? docRect.maxX() : docRect.x();
} else {
if (view->style()->isFlippedBlocksWritingMode()) {
blockDirectionStart = docRect.right();
blockDirectionStart = docRect.maxX();
blockDirectionEnd = docRect.x();
} else {
blockDirectionStart = docRect.x();
blockDirectionEnd = docRect.right();
blockDirectionEnd = docRect.maxX();
}
inlineDirectionStart = view->style()->isLeftToRightDirection() ? docRect.y() : docRect.bottom();
inlineDirectionEnd = view->style()->isLeftToRightDirection() ? docRect.bottom() : docRect.y();
inlineDirectionStart = view->style()->isLeftToRightDirection() ? docRect.y() : docRect.maxY();
inlineDirectionEnd = view->style()->isLeftToRightDirection() ? docRect.maxY() : docRect.y();
}
unsigned pageCount = ceilf((float)docLogicalHeight / pageLogicalHeight);
......@@ -274,7 +274,7 @@ int PrintContext::pageNumberForElement(Element* element, const FloatSize& pageSi
size_t pageNumber = 0;
for (; pageNumber < printContext.pageCount(); pageNumber++) {
const IntRect& page = printContext.pageRect(pageNumber);
if (page.x() <= left && left < page.right() && page.y() <= top && top < page.bottom())
if (page.x() <= left && left < page.maxX() && page.y() <= top && top < page.maxY())
return pageNumber;
}
return -1;
......
......@@ -127,7 +127,7 @@ static inline int middle(FocusDirection direction, const IntRect& rect)
static inline int end(FocusDirection direction, const IntRect& rect)
{
return isHorizontalMove(direction) ? rect.bottom() : rect.right();
return isHorizontalMove(direction) ? rect.maxY() : rect.maxX();
}
// This method checks if rects |a| and |b| are fully aligned either vertically or
......@@ -144,11 +144,11 @@ static bool areRectsFullyAligned(FocusDirection direction, const IntRect& a, con
switch (direction) {
case FocusDirectionLeft:
aStart = a.x();
bEnd = b.right();
bEnd = b.maxX();
break;
case FocusDirectionRight:
aStart = b.x();
bEnd = a.right();
bEnd = a.maxX();
break;
case FocusDirectionUp:
aStart = a.y();
......@@ -245,13 +245,13 @@ static bool areRectsMoreThanFullScreenApart(FocusDirection direction, const IntR
switch (direction) {
case FocusDirectionLeft:
return curRect.x() - targetRect.right() > viewSize.width();
return curRect.x() - targetRect.maxX() > viewSize.width();
case FocusDirectionRight:
return targetRect.x() - curRect.right() > viewSize.width();
return targetRect.x() - curRect.maxX() > viewSize.width();
case FocusDirectionUp:
return curRect.y() - targetRect.bottom() > viewSize.height();
return curRect.y() - targetRect.maxY() > viewSize.height();
case FocusDirectionDown:
return targetRect.y() - curRect.bottom() > viewSize.height();
return targetRect.y() - curRect.maxY() > viewSize.height();
default:
ASSERT_NOT_REACHED();
return true;
......@@ -261,26 +261,26 @@ static bool areRectsMoreThanFullScreenApart(FocusDirection direction, const IntR
// Return true if rect |a| is below |b|. False otherwise.
static inline bool below(const IntRect& a, const IntRect& b)
{
return a.y() > b.bottom();
return a.y() > b.maxY();
}
// Return true if rect |a| is on the right of |b|. False otherwise.
static inline bool rightOf(const IntRect& a, const IntRect& b)
{
return a.x() > b.right();
return a.x() > b.maxX();
}
static bool isRectInDirection(FocusDirection direction, const IntRect& curRect, const IntRect& targetRect)
{
switch (direction) {
case FocusDirectionLeft:
return targetRect.right() <= curRect.x();
return targetRect.maxX() <= curRect.x();
case FocusDirectionRight:
return targetRect.x() >= curRect.right();
return targetRect.x() >= curRect.maxX();
case FocusDirectionUp:
return targetRect.bottom() <= curRect.y();
return targetRect.maxY() <= curRect.y();
case FocusDirectionDown:
return targetRect.y() >= curRect.bottom();
return targetRect.y() >= curRect.maxY();
default:
ASSERT_NOT_REACHED();
return false;
......@@ -544,18 +544,18 @@ void entryAndExitPointsForDirection(FocusDirection direction, const IntRect& sta
switch (direction) {
case FocusDirectionLeft:
exitPoint.setX(startingRect.x());
entryPoint.setX(potentialRect.right());
entryPoint.setX(potentialRect.maxX());
break;
case FocusDirectionUp:
exitPoint.setY(startingRect.y());
entryPoint.setY(potentialRect.bottom());
entryPoint.setY(potentialRect.maxY());
break;
case FocusDirectionRight:
exitPoint.setX(startingRect.right());
exitPoint.setX(startingRect.maxX());
entryPoint.setX(potentialRect.x());
break;
case FocusDirectionDown:
exitPoint.setY(startingRect.bottom());
exitPoint.setY(startingRect.maxY());
entryPoint.setY(potentialRect.y());
break;
default:
......@@ -567,9 +567,9 @@ void entryAndExitPointsForDirection(FocusDirection direction, const IntRect& sta
case FocusDirectionRight:
if (below(startingRect, potentialRect)) {
exitPoint.setY(startingRect.y());
entryPoint.setY(potentialRect.bottom());
entryPoint.setY(potentialRect.maxY());
} else if (below(potentialRect, startingRect)) {
exitPoint.setY(startingRect.bottom());
exitPoint.setY(startingRect.maxY());
entryPoint.setY(potentialRect.y());
} else {
exitPoint.setY(max(startingRect.y(), potentialRect.y()));
......@@ -580,9 +580,9 @@ void entryAndExitPointsForDirection(FocusDirection direction, const IntRect& sta
case FocusDirectionDown:
if (rightOf(startingRect, potentialRect)) {
exitPoint.setX(startingRect.x());
entryPoint.setX(potentialRect.right());
entryPoint.setX(potentialRect.maxX());
} else if (rightOf(potentialRect, startingRect)) {
exitPoint.setX(startingRect.right());
exitPoint.setX(startingRect.maxX());
entryPoint.setX(potentialRect.x());
} else {
exitPoint.setX(max(startingRect.x(), potentialRect.x()));
......@@ -675,11 +675,11 @@ IntRect virtualRectForDirection(FocusDirection direction, const IntRect& startin
IntRect virtualStartingRect = startingRect;
switch (direction) {
case FocusDirectionLeft:
virtualStartingRect.setX(virtualStartingRect.right() - width);
virtualStartingRect.setX(virtualStartingRect.maxX() - width);
virtualStartingRect.setWidth(width);
break;
case FocusDirectionUp:
virtualStartingRect.setY(virtualStartingRect.bottom() - width);
virtualStartingRect.setY(virtualStartingRect.maxY() - width);
virtualStartingRect.setHeight(width);
break;
case FocusDirectionRight:
......
......@@ -186,9 +186,9 @@ WindowFeatures::WindowFeatures(const String& dialogFeaturesString, const FloatRe
width = floatFeature(features, "dialogwidth", 100, screenAvailableRect.width(), 620); // default here came from frame size of dialog in MacIE
height = floatFeature(features, "dialogheight", 100, screenAvailableRect.height(), 450); // default here came from frame size of dialog in MacIE
x = floatFeature(features, "dialogleft", screenAvailableRect.x(), screenAvailableRect.right() - width, -1);
x = floatFeature(features, "dialogleft", screenAvailableRect.x(), screenAvailableRect.maxX() - width, -1);
xSet = x > 0;
y = floatFeature(features, "dialogtop", screenAvailableRect.y(), screenAvailableRect.bottom() - height, -1);
y = floatFeature(features, "dialogtop", screenAvailableRect.y(), screenAvailableRect.maxY() - height, -1);
ySet = y > 0;
if (boolFeature(features, "center", true)) {
......
......@@ -925,7 +925,7 @@ void ScrollView::calculateOverhangAreasForPainting(IntRect& horizontalOverhangRe
} else if (scrollY() > contentsHeight() - visibleContentRect(true).height()) {
int height = scrollY() - (contentsHeight() - visibleContentRect(true).height());
horizontalOverhangRect = frameRect();
horizontalOverhangRect.setY(frameRect().bottom() - height);
horizontalOverhangRect.setY(frameRect().maxY() - height);
horizontalOverhangRect.setHeight(height);
}
......@@ -941,7 +941,7 @@ void ScrollView::calculateOverhangAreasForPainting(IntRect& horizontalOverhangRe
int width = scrollX() - (contentsWidth() - visibleContentRect(true).width());
verticalOverhangRect.setWidth(width);
verticalOverhangRect.setHeight(frameRect().height() - horizontalOverhangRect.height());
verticalOverhangRect.setX(frameRect().right() - width);
verticalOverhangRect.setX(frameRect().maxX() - width);
if (horizontalOverhangRect.y() == frameRect().y())
verticalOverhangRect.setY(frameRect().y() + horizontalOverhangRect.height());
else
......
......@@ -393,14 +393,14 @@ void Scrollbar::setFrameRect(const IntRect& rect)
IntRect resizerRect = view->convertFromContainingWindow(view->windowResizerRect());
if (rect.intersects(resizerRect)) {
if (orientation() == HorizontalScrollbar) {
int overlap = rect.right() - resizerRect.x();
if (overlap > 0 && resizerRect.right() >= rect.right()) {
int overlap = rect.maxX() - resizerRect.x();
if (overlap > 0 && resizerRect.maxX() >= rect.maxX()) {
adjustedRect.setWidth(rect.width() - overlap);
overlapsResizer = true;
}
} else {
int overlap = rect.bottom() - resizerRect.y();
if (overlap > 0 && resizerRect.bottom() >= rect.bottom()) {
int overlap = rect.maxY() - resizerRect.y();
if (overlap > 0 && resizerRect.maxY() >= rect.maxY()) {
adjustedRect.setHeight(rect.height() - overlap);
overlapsResizer = true;
}
......
......@@ -248,11 +248,11 @@ void ScrollbarThemeComposite::splitTrack(Scrollbar* scrollbar, const IntRect& un
if (scrollbar->orientation() == HorizontalScrollbar) {
thumbRect = IntRect(trackRect.x() + thumbPos, trackRect.y() + (trackRect.height() - thickness) / 2, thumbLength(scrollbar), thickness);
beforeThumbRect = IntRect(trackRect.x(), trackRect.y(), thumbPos + thumbRect.width() / 2, trackRect.height());
afterThumbRect = IntRect(trackRect.x() + beforeThumbRect.width(), trackRect.y(), trackRect.right() - beforeThumbRect.right(), trackRect.height());
afterThumbRect = IntRect(trackRect.x() + beforeThumbRect.width(), trackRect.y(), trackRect.maxX() - beforeThumbRect.maxX(), trackRect.height());
} else {
thumbRect = IntRect(trackRect.x() + (trackRect.width() - thickness) / 2, trackRect.y() + thumbPos, thickness, thumbLength(scrollbar));
beforeThumbRect = IntRect(trackRect.x(), trackRect.y(), trackRect.width(), thumbPos + thumbRect.height() / 2);
afterThumbRect = IntRect(trackRect.x(), trackRect.y() + beforeThumbRect.height(), trackRect.width(), trackRect.bottom() - beforeThumbRect.bottom());
afterThumbRect = IntRect(trackRect.x(), trackRect.y() + beforeThumbRect.height(), trackRect.width(), trackRect.maxY() - beforeThumbRect.maxY());
}
}
......
......@@ -128,7 +128,7 @@ void ScrollbarThemeChromium::paintTickmarks(GraphicsContext* context, Scrollbar*
const float percent = static_cast<float>(i->y()) / scrollbar->totalSize();
// Calculate how far down (in pixels) the tick-mark should appear.
const int yPos = rect.topLeft().y() + (rect.height() * percent);
const int yPos = rect.y() + (rect.height() * percent);
IntPoint tick(scrollbar->x(), yPos);
context->drawImage(dash.get(), ColorSpaceDeviceRGB, tick);
......