summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderWidget.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
commit2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch)
tree988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/WebCore/rendering/RenderWidget.cpp
parentdd91e772430dc294e3bf478c119ef8d43c0a3358 (diff)
downloadqtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/WebCore/rendering/RenderWidget.cpp')
-rw-r--r--Source/WebCore/rendering/RenderWidget.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/Source/WebCore/rendering/RenderWidget.cpp b/Source/WebCore/rendering/RenderWidget.cpp
index 55802c4c2..c49d8f201 100644
--- a/Source/WebCore/rendering/RenderWidget.cpp
+++ b/Source/WebCore/rendering/RenderWidget.cpp
@@ -140,12 +140,20 @@ RenderWidget::~RenderWidget()
clearWidget();
}
-bool RenderWidget::setWidgetGeometry(const IntRect& frame)
+// Widgets are always placed on integer boundaries, so rounding the size is actually
+// the desired behavior. This function is here because it's otherwise seldom what we
+// want to do with a LayoutRect.
+static inline IntRect roundedIntRect(const LayoutRect& rect)
+{
+ return IntRect(roundedIntPoint(rect.location()), roundedIntSize(rect.size()));
+}
+
+bool RenderWidget::setWidgetGeometry(const LayoutRect& frame)
{
if (!node())
return false;
- IntRect clipRect = enclosingLayer()->childrenClipRect();
+ IntRect clipRect = roundedIntRect(enclosingLayer()->childrenClipRect());
bool clipChanged = m_clipRect != clipRect;
bool boundsChanged = m_widget->frameRect() != frame;
@@ -156,7 +164,7 @@ bool RenderWidget::setWidgetGeometry(const IntRect& frame)
RenderWidgetProtector protector(this);
RefPtr<Node> protectedNode(node());
- m_widget->setFrameRect(frame);
+ m_widget->setFrameRect(roundedIntRect(frame));
#if USE(ACCELERATED_COMPOSITING)
if (hasLayer() && layer()->isComposited())
@@ -168,11 +176,11 @@ bool RenderWidget::setWidgetGeometry(const IntRect& frame)
bool RenderWidget::updateWidgetGeometry()
{
- IntRect contentBox = contentBoxRect();
+ IntRect contentBox = pixelSnappedIntRect(contentBoxRect());
if (!m_widget->transformsAffectFrameRect())
return setWidgetGeometry(absoluteContentBox());
- IntRect absoluteContentBox = IntRect(localToAbsoluteQuad(FloatQuad(contentBox)).boundingBox());
+ IntRect absoluteContentBox(localToAbsoluteQuad(FloatQuad(contentBox)).boundingBox());
if (m_widget->isFrameView()) {
contentBox.setLocation(absoluteContentBox.location());
return setWidgetGeometry(contentBox);
@@ -270,17 +278,18 @@ void RenderWidget::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
// Push a clip if we have a border radius, since we want to round the foreground content that gets painted.
paintInfo.context->save();
- paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(borderRect));
+ paintInfo.context->addRoundedRectClip(style()->getRoundedBorderFor(borderRect, view()));
}
if (m_widget) {
// Tell the widget to paint now. This is the only time the widget is allowed
// to paint itself. That way it will composite properly with z-indexed layers.
- LayoutPoint widgetLocation = m_widget->frameRect().location();
- LayoutPoint paintLocation(adjustedPaintOffset.x() + borderLeft() + paddingLeft(), adjustedPaintOffset.y() + borderTop() + paddingTop());
- LayoutRect paintRect = paintInfo.rect;
+ IntPoint widgetLocation = m_widget->frameRect().location();
+ IntPoint paintLocation(roundToInt(adjustedPaintOffset.x() + borderLeft() + paddingLeft()),
+ roundToInt(adjustedPaintOffset.y() + borderTop() + paddingTop()));
+ IntRect paintRect = paintInfo.rect;
- LayoutSize widgetPaintOffset = paintLocation - widgetLocation;
+ IntSize widgetPaintOffset = paintLocation - widgetLocation;
// When painting widgets into compositing layers, tx and ty are relative to the enclosing compositing layer,
// not the root. In this case, shift the CTM and adjust the paintRect to be root-relative to fix plug-in drawing.
if (!widgetPaintOffset.isZero()) {