Title: [88264] trunk/Source/WebCore
- Revision
- 88264
- Author
- [email protected]
- Date
- 2011-06-07 14:06:26 -0700 (Tue, 07 Jun 2011)
Log Message
2011-06-07 Emil A Eklund <[email protected]>
Reviewed by Eric Seidel.
Switch ContainerNode to use IntPoint
https://bugs.webkit.org/show_bug.cgi?id=61893
Covered by existing tests.
* dom/ContainerNode.cpp:
(WebCore::ContainerNode::getUpperLeftCorner):
(WebCore::ContainerNode::getLowerRightCorner):
(WebCore::ContainerNode::getRect):
Change to use maxX/maxY instead of x+width/y+height
* platform/graphics/FloatPoint.h:
(WebCore::FloatPoint::move):
(WebCore::FloatPoint::moveBy):
(WebCore::FloatPoint::expandedTo):
Add move, moveBy and expandedTo mirroring the IntPoint implementation of the same.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (88263 => 88264)
--- trunk/Source/WebCore/ChangeLog 2011-06-07 20:59:47 UTC (rev 88263)
+++ trunk/Source/WebCore/ChangeLog 2011-06-07 21:06:26 UTC (rev 88264)
@@ -1,3 +1,24 @@
+2011-06-07 Emil A Eklund <[email protected]>
+
+ Reviewed by Eric Seidel.
+
+ Switch ContainerNode to use IntPoint
+ https://bugs.webkit.org/show_bug.cgi?id=61893
+
+ Covered by existing tests.
+
+ * dom/ContainerNode.cpp:
+ (WebCore::ContainerNode::getUpperLeftCorner):
+ (WebCore::ContainerNode::getLowerRightCorner):
+ (WebCore::ContainerNode::getRect):
+ Change to use maxX/maxY instead of x+width/y+height
+
+ * platform/graphics/FloatPoint.h:
+ (WebCore::FloatPoint::move):
+ (WebCore::FloatPoint::moveBy):
+ (WebCore::FloatPoint::expandedTo):
+ Add move, moveBy and expandedTo mirroring the IntPoint implementation of the same.
+
2011-06-07 Ryosuke Niwa <[email protected]>
Speculative build fix after r88259.
Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (88263 => 88264)
--- trunk/Source/WebCore/dom/ContainerNode.cpp 2011-06-07 20:59:47 UTC (rev 88263)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp 2011-06-07 21:06:26 UTC (rev 88264)
@@ -878,7 +878,7 @@
toRenderText(o)->firstTextBox()->root()->lineTop());
} else if (o->isBox()) {
RenderBox* box = toRenderBox(o);
- point.move(box->x(), box->y());
+ point.moveBy(box->location());
}
point = o->container()->localToAbsolute(point, false, true);
return true;
@@ -904,7 +904,7 @@
if (!o->isInline() || o->isReplaced()) {
RenderBox* box = toRenderBox(o);
point = o->localToAbsolute(FloatPoint(), false, true);
- point.move(box->width(), box->height());
+ point.move(box->size());
return true;
}
@@ -930,12 +930,12 @@
if (o->isText()) {
RenderText* text = toRenderText(o);
IntRect linesBox = text->linesBoundingBox();
- if (!linesBox.x() && !linesBox.width() && !linesBox.y() && !linesBox.height())
+ if (!linesBox.maxX() && !linesBox.maxY())
continue;
- point.move(linesBox.x() + linesBox.width(), linesBox.y() + linesBox.height());
+ point.moveBy(linesBox.maxXMaxYCorner());
} else {
RenderBox* box = toRenderBox(o);
- point.move(box->x() + box->width(), box->y() + box->height());
+ point.moveBy(box->frameRect().maxXMaxYCorner());
}
point = o->container()->localToAbsolute(point, false, true);
return true;
@@ -959,10 +959,7 @@
upperLeft = lowerRight;
}
- lowerRight.setX(max(upperLeft.x(), lowerRight.x()));
- lowerRight.setY(max(upperLeft.y(), lowerRight.y()));
-
- return enclosingIntRect(FloatRect(upperLeft, lowerRight - upperLeft));
+ return enclosingIntRect(FloatRect(upperLeft, lowerRight.expandedTo(upperLeft) - upperLeft));
}
void ContainerNode::setFocus(bool received)
Modified: trunk/Source/WebCore/platform/graphics/FloatPoint.h (88263 => 88264)
--- trunk/Source/WebCore/platform/graphics/FloatPoint.h 2011-06-07 20:59:47 UTC (rev 88263)
+++ trunk/Source/WebCore/platform/graphics/FloatPoint.h 2011-06-07 21:06:26 UTC (rev 88264)
@@ -91,6 +91,16 @@
m_x += dx;
m_y += dy;
}
+ void move(const IntSize& a)
+ {
+ m_x += a.width();
+ m_y += a.height();
+ }
+ void moveBy(const IntPoint& a)
+ {
+ m_x += a.x();
+ m_y += a.y();
+ }
void scale(float sx, float sy)
{
m_x *= sx;
@@ -110,6 +120,11 @@
return m_x * m_x + m_y * m_y;
}
+ FloatPoint expandedTo(const FloatPoint& other) const
+ {
+ return FloatPoint(std::max(m_x, other.m_x), std::max(m_y, other.m_y));
+ }
+
#if USE(CG) || USE(SKIA_ON_MAC_CHROME)
FloatPoint(const CGPoint&);
operator CGPoint() const;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes