Title: [110509] branches/subpixellayout/Source/WebCore/rendering
Revision
110509
Author
[email protected]
Date
2012-03-12 17:14:39 -0700 (Mon, 12 Mar 2012)

Log Message

Fixing/cleaning up rounding in RenderReplaced classes, and removing an unnecessary static_cast in RenderFrameSet.

Modified Paths

Diff

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderFrameSet.cpp (110508 => 110509)


--- branches/subpixellayout/Source/WebCore/rendering/RenderFrameSet.cpp	2012-03-13 00:09:56 UTC (rev 110508)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderFrameSet.cpp	2012-03-13 00:14:39 UTC (rev 110509)
@@ -481,8 +481,8 @@
     }
 
     LayoutUnit borderThickness = frameSet()->border();
-    layOutAxis(m_rows, frameSet()->rowLengths(), height() - static_cast<int>(rows - 1) * borderThickness);
-    layOutAxis(m_cols, frameSet()->colLengths(), width() - static_cast<int>(cols - 1) * borderThickness);
+    layOutAxis(m_rows, frameSet()->rowLengths(), height() - (rows - 1) * borderThickness);
+    layOutAxis(m_cols, frameSet()->colLengths(), width() - (cols - 1) * borderThickness);
 
     if (flattenFrameSet())
         positionFramesWithFlattening();

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderImage.cpp (110508 => 110509)


--- branches/subpixellayout/Source/WebCore/rendering/RenderImage.cpp	2012-03-13 00:09:56 UTC (rev 110508)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderImage.cpp	2012-03-13 00:14:39 UTC (rev 110509)
@@ -153,7 +153,7 @@
         return;
     
     if (!m_didIncrementVisuallyNonEmptyPixelCount) {
-        view()->frameView()->incrementVisuallyNonEmptyPixelCount(expandedIntSize(m_imageResource->imageSize(1.0f)));
+        view()->frameView()->incrementVisuallyNonEmptyPixelCount(m_imageResource->imageSize(1.0f));
         m_didIncrementVisuallyNonEmptyPixelCount = true;
     }
 
@@ -428,7 +428,7 @@
     CompositeOperator compositeOperator = imageElt ? imageElt->compositeOperator() : CompositeSourceOver;
     Image* image = m_imageResource->image().get();
     bool useLowQualityScaling = shouldPaintAtLowQuality(context, image, image, alignedRect.size());
-    context->drawImage(m_imageResource->image(alignedRect.width(), alignedRect.height()).get(), style()->colorSpace(), alignedRect, FloatRect(0, 0, -1, -1), compositeOperator, useLowQualityScaling);
+    context->drawImage(m_imageResource->image(alignedRect.width(), alignedRect.height()).get(), style()->colorSpace(), alignedRect, compositeOperator, useLowQualityScaling);
 }
 
 bool RenderImage::backgroundIsObscured() const

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderVideo.cpp (110508 => 110509)


--- branches/subpixellayout/Source/WebCore/rendering/RenderVideo.cpp	2012-03-13 00:09:56 UTC (rev 110508)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderVideo.cpp	2012-03-13 00:14:39 UTC (rev 110509)
@@ -166,7 +166,7 @@
     else
         elementSize = intrinsicSize();
 
-    IntRect contentRect = enclosingIntRect(contentBoxRect());
+    IntRect contentRect = pixelSnappedIntRect(contentBoxRect());
     if (elementSize.isEmpty() || contentRect.isEmpty())
         return IntRect();
 
@@ -225,9 +225,9 @@
     if (displayingPoster)
         paintIntoRect(paintInfo.context, rect);
     else if (document()->view() && document()->view()->paintBehavior() & PaintBehaviorFlattenCompositingLayers)
-        mediaPlayer->paintCurrentFrameInContext(paintInfo.context, enclosingIntRect(rect));
+        mediaPlayer->paintCurrentFrameInContext(paintInfo.context, pixelSnappedIntRect(rect));
     else
-        mediaPlayer->paint(paintInfo.context, enclosingIntRect(rect));
+        mediaPlayer->paint(paintInfo.context, pixelSnappedIntRect(rect));
 }
 
 void RenderVideo::layout()

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderWidget.cpp (110508 => 110509)


--- branches/subpixellayout/Source/WebCore/rendering/RenderWidget.cpp	2012-03-13 00:09:56 UTC (rev 110508)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderWidget.cpp	2012-03-13 00:14:39 UTC (rev 110509)
@@ -140,12 +140,18 @@
     clearWidget();
 }
 
+// We always place widgets on integer boundaries, so rounding the size is actually acceptable
+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 = enclosingIntRect(enclosingLayer()->childrenClipRect());
+    IntRect clipRect = roundedIntRect(enclosingLayer()->childrenClipRect());
     bool clipChanged = m_clipRect != clipRect;
     bool boundsChanged = m_widget->frameRect() != frame;
 
@@ -156,7 +162,7 @@
 
     RenderWidgetProtector protector(this);
     RefPtr<Node> protectedNode(node());
-    m_widget->setFrameRect(IntRect(roundedIntPoint(frame.location()), roundedIntSize(frame.size())));
+    m_widget->setFrameRect(IntRect(roundedIntRect(frame)));
     
 #if USE(ACCELERATED_COMPOSITING)
     if (hasLayer() && layer()->isComposited())
@@ -276,12 +282,12 @@
     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());
+        IntPoint widgetLocation = m_widget->frameRect().location();
+        IntPoint paintLocation(roundToInt(adjustedPaintOffset.x() + borderLeft() + paddingLeft()),
+            roundToInt(adjustedPaintOffset.y() + borderTop() + paddingTop()));
         IntRect paintRect = paintInfo.rect;
 
-        // We round instead of pixel snapping here since widgets are always placed on integer bounds.
-        IntSize widgetPaintOffset = roundedIntSize(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()) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to