Title: [89625] trunk/Source/WebCore
- Revision
- 89625
- Author
- e...@chromium.org
- Date
- 2011-06-23 15:15:00 -0700 (Thu, 23 Jun 2011)
Log Message
2011-06-23 Emil A Eklund <e...@chromium.org>
Reviewed by Eric Seidel.
FloatRect should implement the same methods as IntRect
https://bugs.webkit.org/show_bug.cgi?id=63273
Add missing methods from IntRect to FloatRect in preparation for moving
the rendering tree over to floats.
* platform/graphics/FloatPoint.h:
(WebCore::FloatPoint::expandedTo):
(WebCore::FloatPoint::transposedPoint):
* platform/graphics/FloatRect.h:
(WebCore::FloatRect::move):
(WebCore::FloatRect::expand):
(WebCore::FloatRect::contract):
(WebCore::FloatRect::shiftXEdgeTo):
(WebCore::FloatRect::shiftMaxXEdgeTo):
(WebCore::FloatRect::shiftYEdgeTo):
(WebCore::FloatRect::shiftMaxYEdgeTo):
(WebCore::FloatRect::minXMinYCorner):
(WebCore::FloatRect::maxXMinYCorner):
(WebCore::FloatRect::minXMaxYCorner):
(WebCore::FloatRect::maxXMaxYCorner):
(WebCore::FloatRect::transposedRect):
* platform/graphics/FloatSize.h:
(WebCore::FloatSize::expand):
(WebCore::FloatSize::transposedSize):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (89624 => 89625)
--- trunk/Source/WebCore/ChangeLog 2011-06-23 22:13:30 UTC (rev 89624)
+++ trunk/Source/WebCore/ChangeLog 2011-06-23 22:15:00 UTC (rev 89625)
@@ -1,5 +1,35 @@
2011-06-23 Emil A Eklund <e...@chromium.org>
+ Reviewed by Eric Seidel.
+
+ FloatRect should implement the same methods as IntRect
+ https://bugs.webkit.org/show_bug.cgi?id=63273
+
+ Add missing methods from IntRect to FloatRect in preparation for moving
+ the rendering tree over to floats.
+
+ * platform/graphics/FloatPoint.h:
+ (WebCore::FloatPoint::expandedTo):
+ (WebCore::FloatPoint::transposedPoint):
+ * platform/graphics/FloatRect.h:
+ (WebCore::FloatRect::move):
+ (WebCore::FloatRect::expand):
+ (WebCore::FloatRect::contract):
+ (WebCore::FloatRect::shiftXEdgeTo):
+ (WebCore::FloatRect::shiftMaxXEdgeTo):
+ (WebCore::FloatRect::shiftYEdgeTo):
+ (WebCore::FloatRect::shiftMaxYEdgeTo):
+ (WebCore::FloatRect::minXMinYCorner):
+ (WebCore::FloatRect::maxXMinYCorner):
+ (WebCore::FloatRect::minXMaxYCorner):
+ (WebCore::FloatRect::maxXMaxYCorner):
+ (WebCore::FloatRect::transposedRect):
+ * platform/graphics/FloatSize.h:
+ (WebCore::FloatSize::expand):
+ (WebCore::FloatSize::transposedSize):
+
+2011-06-23 Emil A Eklund <e...@chromium.org>
+
Reviewed by Darin Adler.
input/textarea onchange doesn't fire if value is set in key listener
Modified: trunk/Source/WebCore/platform/graphics/FloatPoint.h (89624 => 89625)
--- trunk/Source/WebCore/platform/graphics/FloatPoint.h 2011-06-23 22:13:30 UTC (rev 89624)
+++ trunk/Source/WebCore/platform/graphics/FloatPoint.h 2011-06-23 22:15:00 UTC (rev 89625)
@@ -123,8 +123,13 @@
FloatPoint expandedTo(const FloatPoint& other) const
{
return FloatPoint(std::max(m_x, other.m_x), std::max(m_y, other.m_y));
- }
+ }
+ FloatPoint transposedPoint() const
+ {
+ return FloatPoint(m_y, m_x);
+ }
+
#if USE(CG) || USE(SKIA_ON_MAC_CHROME)
FloatPoint(const CGPoint&);
operator CGPoint() const;
Modified: trunk/Source/WebCore/platform/graphics/FloatRect.h (89624 => 89625)
--- trunk/Source/WebCore/platform/graphics/FloatRect.h 2011-06-23 22:13:30 UTC (rev 89624)
+++ trunk/Source/WebCore/platform/graphics/FloatRect.h 2011-06-23 22:15:00 UTC (rev 89625)
@@ -106,9 +106,42 @@
FloatPoint center() const { return FloatPoint(x() + width() / 2, y() + height() / 2); }
void move(const FloatSize& delta) { m_location += delta; }
+ void moveBy(const FloatPoint& delta) { m_location.move(delta.x(), delta.y()); }
void move(float dx, float dy) { m_location.move(dx, dy); }
- void moveBy(const FloatPoint& delta) { m_location.move(delta.x(), delta.y()); }
+ void expand(const FloatSize& size) { m_size += size; }
+ void expand(float dw, float dh) { m_size.expand(dw, dh); }
+ void contract(const FloatSize& size) { m_size -= size; }
+ void contract(float dw, float dh) { m_size.expand(-dw, -dh); }
+
+ void shiftXEdgeTo(float edge)
+ {
+ float delta = edge - x();
+ setX(edge);
+ setWidth(std::max(0.0f, width() - delta));
+ }
+ void shiftMaxXEdgeTo(float edge)
+ {
+ float delta = edge - maxX();
+ setWidth(std::max(0.0f, width() + delta));
+ }
+ void shiftYEdgeTo(float edge)
+ {
+ float delta = edge - y();
+ setY(edge);
+ setHeight(std::max(0.0f, height() - delta));
+ }
+ void shiftMaxYEdgeTo(float edge)
+ {
+ float delta = edge - maxY();
+ setHeight(std::max(0.0f, height() + delta));
+ }
+
+ FloatPoint minXMinYCorner() const { return m_location; } // typically topLeft
+ FloatPoint maxXMinYCorner() const { return FloatPoint(m_location.x() + m_size.width(), m_location.y()); } // typically topRight
+ FloatPoint minXMaxYCorner() const { return FloatPoint(m_location.x(), m_location.y() + m_size.height()); } // typically bottomLeft
+ FloatPoint maxXMaxYCorner() const { return FloatPoint(m_location.x() + m_size.width(), m_location.y() + m_size.height()); } // typically bottomRight
+
bool intersects(const FloatRect&) const;
bool contains(const FloatRect&) const;
@@ -134,6 +167,8 @@
void scale(float s) { scale(s, s); }
void scale(float sx, float sy);
+ FloatRect transposedRect() const { return FloatRect(m_location.transposedPoint(), m_size.transposedSize()); }
+
// Re-initializes this rectangle to fit the sets of passed points.
void fitToPoints(const FloatPoint& p0, const FloatPoint& p1);
void fitToPoints(const FloatPoint& p0, const FloatPoint& p1, const FloatPoint& p2);
Modified: trunk/Source/WebCore/platform/graphics/FloatSize.h (89624 => 89625)
--- trunk/Source/WebCore/platform/graphics/FloatSize.h 2011-06-23 22:13:30 UTC (rev 89624)
+++ trunk/Source/WebCore/platform/graphics/FloatSize.h 2011-06-23 22:15:00 UTC (rev 89625)
@@ -65,6 +65,12 @@
float aspectRatio() const { return m_width / m_height; }
+ void expand(float width, float height)
+ {
+ m_width += width;
+ m_height += height;
+ }
+
void scale(float s) { scale(s, s); }
void scale(float scaleX, float scaleY)
@@ -91,6 +97,11 @@
return m_width * m_width + m_height * m_height;
}
+ FloatSize transposedSize() const
+ {
+ return FloatSize(m_height, m_width);
+ }
+
#if USE(CG) || (PLATFORM(WX) && OS(DARWIN)) || USE(SKIA_ON_MAC_CHROME)
explicit FloatSize(const CGSize&); // don't do this implicitly since it's lossy
operator CGSize() const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes