15c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)/* 25c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Copyright (c) 2012, Google Inc. All rights reserved. 35c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without 55c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * modification, are permitted provided that the following conditions are 65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * met: 75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * * Redistributions of source code must retain the above copyright 95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * notice, this list of conditions and the following disclaimer. 105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * * Redistributions in binary form must reproduce the above 115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * copyright notice, this list of conditions and the following disclaimer 125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * in the documentation and/or other materials provided with the 135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * distribution. 145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * * Neither the name of Google Inc. nor the names of its 155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * contributors may be used to endorse or promote products derived from 165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * this software without specific prior written permission. 175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 295c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) */ 305c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 315c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#ifndef LayoutPoint_h 325c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#define LayoutPoint_h 335c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 3453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/platform/graphics/FloatPoint.h" 3553e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "core/platform/graphics/LayoutSize.h" 367757ec2eadfa2dd8ac2aeed0a4399e9b07ec38cbBen Murdoch#include "wtf/MathExtras.h" 375c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)namespace WebCore { 395c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)class LayoutPoint { 415c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)public: 425c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) LayoutPoint() : m_x(0), m_y(0) { } 435c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) LayoutPoint(LayoutUnit x, LayoutUnit y) : m_x(x), m_y(y) { } 445c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) LayoutPoint(const IntPoint& point) : m_x(point.x()), m_y(point.y()) { } 455c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) explicit LayoutPoint(const FloatPoint& size) : m_x(size.x()), m_y(size.y()) { } 465c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) explicit LayoutPoint(const LayoutSize& size) : m_x(size.width()), m_y(size.height()) { } 475c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 485c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) static LayoutPoint zero() { return LayoutPoint(); } 495c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 505c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) LayoutUnit x() const { return m_x; } 515c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) LayoutUnit y() const { return m_y; } 525c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 535c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) void setX(LayoutUnit x) { m_x = x; } 545c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) void setY(LayoutUnit y) { m_y = y; } 555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 5602772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch void move(const LayoutSize& s) { move(s.width(), s.height()); } 575c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) void moveBy(const LayoutPoint& offset) { move(offset.x(), offset.y()); } 585c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) void move(LayoutUnit dx, LayoutUnit dy) { m_x += dx; m_y += dy; } 595c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) void scale(float sx, float sy) 605c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) { 615c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) m_x *= sx; 625c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) m_y *= sy; 635c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) } 6402772c6a72f1ee0b226341a4f4439970c29fc861Ben Murdoch 655c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) LayoutPoint expandedTo(const LayoutPoint& other) const 665c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) { 675c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return LayoutPoint(std::max(m_x, other.m_x), std::max(m_y, other.m_y)); 685c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) } 695c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 705c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) LayoutPoint shrunkTo(const LayoutPoint& other) const 715c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) { 725c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return LayoutPoint(std::min(m_x, other.m_x), std::min(m_y, other.m_y)); 735c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) } 745c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 755c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) void clampNegativeToZero() 765c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) { 775c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *this = expandedTo(zero()); 785c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) } 795c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 805c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) LayoutPoint transposedPoint() const 815c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) { 825c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return LayoutPoint(m_y, m_x); 835c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) } 845c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 855c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)private: 865c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) LayoutUnit m_x, m_y; 875c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)}; 885c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 895c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline LayoutPoint& operator+=(LayoutPoint& a, const LayoutSize& b) 905c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 915c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) a.move(b.width(), b.height()); 925c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return a; 935c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 945c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 955c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline LayoutPoint& operator-=(LayoutPoint& a, const LayoutSize& b) 965c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 975c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) a.move(-b.width(), -b.height()); 985c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return a; 995c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1005c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1015c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline LayoutPoint operator+(const LayoutPoint& a, const LayoutSize& b) 1025c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1035c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return LayoutPoint(a.x() + b.width(), a.y() + b.height()); 1045c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1055c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1065c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline LayoutPoint operator+(const LayoutPoint& a, const LayoutPoint& b) 1075c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1085c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return LayoutPoint(a.x() + b.x(), a.y() + b.y()); 1095c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline LayoutSize operator-(const LayoutPoint& a, const LayoutPoint& b) 1125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return LayoutSize(a.x() - b.x(), a.y() - b.y()); 1145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline LayoutPoint operator-(const LayoutPoint& a, const LayoutSize& b) 1175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return LayoutPoint(a.x() - b.width(), a.y() - b.height()); 1195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline LayoutPoint operator-(const LayoutPoint& point) 1225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return LayoutPoint(-point.x(), -point.y()); 1245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1255c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1265c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline bool operator==(const LayoutPoint& a, const LayoutPoint& b) 1275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1285c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return a.x() == b.x() && a.y() == b.y(); 1295c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1305c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1315c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline bool operator!=(const LayoutPoint& a, const LayoutPoint& b) 1325c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1335c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return a.x() != b.x() || a.y() != b.y(); 1345c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1355c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1365c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline LayoutPoint toPoint(const LayoutSize& size) 1375c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1385c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return LayoutPoint(size.width(), size.height()); 1395c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1405c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1415c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline LayoutPoint toLayoutPoint(const LayoutSize& p) 1425c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1435c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return LayoutPoint(p.width(), p.height()); 1445c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1455c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1465c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline LayoutSize toSize(const LayoutPoint& a) 1475c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1485c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return LayoutSize(a.x(), a.y()); 1495c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1505c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1515c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline IntPoint flooredIntPoint(const LayoutPoint& point) 1525c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1535c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return IntPoint(point.x().floor(), point.y().floor()); 1545c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1555c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1565c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline IntPoint roundedIntPoint(const LayoutPoint& point) 1575c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1585c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return IntPoint(point.x().round(), point.y().round()); 1595c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1605c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1615c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline IntPoint roundedIntPoint(const LayoutSize& size) 1625c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1635c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return IntPoint(size.width().round(), size.height().round()); 1645c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1655c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1665c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline IntPoint ceiledIntPoint(const LayoutPoint& point) 1675c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1685c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return IntPoint(point.x().ceil(), point.y().ceil()); 1695c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1705c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1715c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline LayoutPoint flooredLayoutPoint(const FloatPoint& p) 1725c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1735c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return LayoutPoint(LayoutUnit::fromFloatFloor(p.x()), LayoutUnit::fromFloatFloor(p.y())); 1745c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1755c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1765c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline LayoutPoint ceiledLayoutPoint(const FloatPoint& p) 1775c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1785c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return LayoutPoint(LayoutUnit::fromFloatCeil(p.x()), LayoutUnit::fromFloatCeil(p.y())); 1795c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1805c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1815c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline IntSize pixelSnappedIntSize(const LayoutSize& s, const LayoutPoint& p) 1825c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1835c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return IntSize(snapSizeToPixel(s.width(), p.x()), snapSizeToPixel(s.height(), p.y())); 1845c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1855c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1865c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline LayoutPoint roundedLayoutPoint(const FloatPoint& p) 1875c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1885c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return LayoutPoint(p); 1895c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1905c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1915c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline LayoutSize toLayoutSize(const LayoutPoint& p) 1925c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1935c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return LayoutSize(p.x(), p.y()); 1945c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 1955c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 1965c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)inline LayoutPoint flooredLayoutPoint(const FloatSize& s) 1975c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles){ 1985c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) return flooredLayoutPoint(FloatPoint(s)); 1995c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} 2005c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2015c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2025c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)} // namespace WebCore 2035c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) 2045c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)#endif // LayoutPoint_h 205