Title: [99908] branches/subpixellayout/Source/WebCore
Revision
99908
Author
[email protected]
Date
2011-11-10 15:32:03 -0800 (Thu, 10 Nov 2011)

Log Message

Adding a pixelSnappedIntRect method and using it throughout WebCore where enclosingIntRect wasn't actually appropriate.

Modified Paths

Diff

Modified: branches/subpixellayout/Source/WebCore/WebCore.xcodeproj/project.pbxproj (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-11-10 23:32:03 UTC (rev 99908)
@@ -1371,7 +1371,6 @@
 		501BAAA913950E2C00F7ACEB /* WindRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 501BAAA813950E2C00F7ACEB /* WindRule.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		508CCA4F13CF106B003151F3 /* RenderFlowThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 508CCA4D13CF106B003151F3 /* RenderFlowThread.h */; };
 		508CCA5013CF106B003151F3 /* RenderFlowThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 508CCA4E13CF106B003151F3 /* RenderFlowThread.cpp */; };
-		50B42158146976960087E604 /* WebKitCSSShaderValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 50B42157146976960087E604 /* WebKitCSSShaderValue.h */; };
 		50E566D6139E38C500214433 /* CSSWrapShapes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 501BAAB11395114B00F7ACEB /* CSSWrapShapes.cpp */; };
 		510184690B08602A004A825F /* CachedPage.h in Headers */ = {isa = PBXBuildFile; fileRef = 510184670B08602A004A825F /* CachedPage.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		5101846A0B08602A004A825F /* CachedPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510184680B08602A004A825F /* CachedPage.cpp */; };

Modified: branches/subpixellayout/Source/WebCore/accessibility/AccessibilityRenderObject.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/accessibility/AccessibilityRenderObject.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -704,7 +704,7 @@
     LayoutRect contentRect = m_renderer->absoluteClippedOverflowRect();
     FrameView* view = m_renderer->frame()->view();
     IntRect viewRect = view->visibleContentRect();
-    viewRect.intersect(enclosingIntRect(contentRect));
+    viewRect.intersect(pixelSnappedIntRect(contentRect));
     return viewRect.isEmpty();
 }
 
@@ -2616,7 +2616,7 @@
 #if PLATFORM(MAC)
     return m_renderer->document()->view()->contentsToScreen(enclosingIntRect(ourrect));
 #else
-    return enclosingIntRect(ourrect);
+    return pixelSnappedIntRect(ourrect);
 #endif
 }
     

Modified: branches/subpixellayout/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapper.mm	2011-11-10 23:32:03 UTC (rev 99908)
@@ -1416,7 +1416,7 @@
             rect = scrollView->contentsToWindow(enclosingIntRect(rect));
         
         if (m_object->page())
-            point = m_object->page()->chrome()->windowToScreen(enclosingIntRect(rect)).location();
+            point = m_object->page()->chrome()->windowToScreen(pixelSnappedIntRect(rect)).location();
         else
             point = rect.location();
     }

Modified: branches/subpixellayout/Source/WebCore/dom/Range.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/dom/Range.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/dom/Range.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -1675,7 +1675,7 @@
     const size_t n = rects.size();
     for (size_t i = 0; i < n; ++i)
         result.unite(rects[i]);
-    return enclosingIntRect(result); // FIXME
+    return pixelSnappedIntRect(result);
 }
 
 void Range::textRects(Vector<LayoutRect>& rects, bool useSelectionHeight, RangeInFixedPosition* inFixed)

Modified: branches/subpixellayout/Source/WebCore/html/HTMLCanvasElement.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/html/HTMLCanvasElement.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/html/HTMLCanvasElement.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -282,9 +282,9 @@
         ImageBuffer* imageBuffer = buffer();
         if (imageBuffer) {
             if (m_presentedImage)
-                context->drawImage(m_presentedImage.get(), ColorSpaceDeviceRGB, enclosingIntRect(r), CompositeSourceOver, useLowQualityScale);
+                context->drawImage(m_presentedImage.get(), ColorSpaceDeviceRGB, pixelSnappedIntRect(r), CompositeSourceOver, useLowQualityScale);
             else
-                context->drawImageBuffer(imageBuffer, ColorSpaceDeviceRGB, enclosingIntRect(r), CompositeSourceOver, useLowQualityScale);
+                context->drawImageBuffer(imageBuffer, ColorSpaceDeviceRGB, pixelSnappedIntRect(r), CompositeSourceOver, useLowQualityScale);
         }
     }
 

Modified: branches/subpixellayout/Source/WebCore/html/shadow/TextControlInnerElements.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/html/shadow/TextControlInnerElements.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/html/shadow/TextControlInnerElements.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -541,7 +541,7 @@
     AtomicString language = input->computeInheritedLanguage();
     String grammar = input->getAttribute(webkitgrammarAttr);
     // FIXME: this should probably respect transforms
-    IntRect rect = enclosingIntRect(renderer()->absoluteBoundingBoxRectIgnoringTransforms()); // FIXME
+    IntRect rect = pixelSnappedIntRect(renderer()->absoluteBoundingBoxRectIgnoringTransforms());
     if (speechInput()->startRecognition(m_listenerId, rect, language, grammar, document()->securityOrigin()))
         setState(Recording);
 }

Modified: branches/subpixellayout/Source/WebCore/page/Frame.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/page/Frame.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/page/Frame.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -1107,7 +1107,7 @@
     m_view->setNodeToDraw(node); // Enable special sub-tree drawing mode.
 
     LayoutRect topLevelRect;
-    IntRect paintingRect = enclosingIntRect(renderer->paintingRootRect(topLevelRect)); // FIXME
+    IntRect paintingRect = pixelSnappedIntRect(renderer->paintingRootRect(topLevelRect));
 
     OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size()));
     if (!buffer)

Modified: branches/subpixellayout/Source/WebCore/page/FrameView.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/page/FrameView.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/page/FrameView.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -1867,11 +1867,11 @@
     for (unsigned i = 0; i < size; i++) {
 #if USE(TILED_BACKING_STORE)
         if (frame()->tiledBackingStore()) {
-            frame()->tiledBackingStore()->invalidate(enclosingIntRect(m_repaintRects[i]));
+            frame()->tiledBackingStore()->invalidate(pixelSnappedIntRect(m_repaintRects[i]));
             continue;
         }
 #endif
-        ScrollView::repaintContentRectangle(enclosingIntRect(m_repaintRects[i]), false);
+        ScrollView::repaintContentRectangle(pixelSnappedIntRect(m_repaintRects[i]), false);
     }
     m_repaintRects.clear();
     m_repaintCount = 0;
@@ -2342,9 +2342,9 @@
     // Apply the clip from the layer.
     IntRect clipRect;
     if (clipToLayerContents)
-        clipRect = enclosingIntRect(layer->childrenClipRect());
+        clipRect = pixelSnappedIntRect(layer->childrenClipRect());
     else
-        clipRect = enclosingIntRect(layer->selfClipRect());
+        clipRect = pixelSnappedIntRect(layer->selfClipRect());
     clipRect = contentsToWindow(clipRect); 
     return intersection(clipRect, windowClipRect());
 }

Modified: branches/subpixellayout/Source/WebCore/platform/graphics/FixedRect.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/platform/graphics/FixedRect.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/platform/graphics/FixedRect.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -154,4 +154,11 @@
                      rect.maxY() - rect.y() + AppUnit::epsilon());
 }
 
+IntRect pixelSnappedIntRect(const FixedRect& rect)
+{
+    IntPoint roundedLocation = roundedIntPoint(rect.location());
+    return IntRect(roundedLocation, IntSize((rect.x() + rect.width()).round() - roundedLocation.x(),
+                                            (rect.y() + rect.height()).round() - roundedLocation.y()));
+}
+
 } // namespace WebCore

Modified: branches/subpixellayout/Source/WebCore/platform/graphics/FixedRect.h (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/platform/graphics/FixedRect.h	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/platform/graphics/FixedRect.h	2011-11-10 23:32:03 UTC (rev 99908)
@@ -258,6 +258,7 @@
 
 IntRect enclosingIntRect(const FixedRect&);
 FixedRect enclosingFixedRect(const FloatRect&);
+IntRect pixelSnappedIntRect(const FixedRect&);
 
 } // namespace WebCore
 

Modified: branches/subpixellayout/Source/WebCore/platform/mac/ScrollAnimatorMac.mm (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/platform/mac/ScrollAnimatorMac.mm	2011-11-10 23:32:03 UTC (rev 99908)
@@ -1496,7 +1496,7 @@
 {
     IntRect rectInViewCoordinates = scrollerThumb;
     if (Scrollbar* verticalScrollbar = m_scrollableArea->verticalScrollbar())
-        rectInViewCoordinates = enclosingIntRect(verticalScrollbar->convertToContainingView(scrollerThumb));
+        rectInViewCoordinates = pixelSnappedIntRect(verticalScrollbar->convertToContainingView(scrollerThumb));
 
     if (rectInViewCoordinates == m_visibleScrollerThumbRect)
         return;

Modified: branches/subpixellayout/Source/WebCore/plugins/PluginView.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/plugins/PluginView.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/plugins/PluginView.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -145,11 +145,11 @@
 
 #if OS(WINDOWS)
     // On Windows always call plugin to change geometry.
-    setNPWindowRect(enclosingIntRect(rect));
+    setNPWindowRect(pixelSnappedIntRect(rect));
 #elif defined(XP_UNIX)
     // On Unix, multiple calls to setNPWindow() in windowed mode causes Flash to crash
     if (m_mode == NP_FULL || !m_isWindowed)
-        setNPWindowRect(enclosingIntRect(rect));
+        setNPWindowRect(pixelSnappedIntRect(rect));
 #endif
 }
 

Modified: branches/subpixellayout/Source/WebCore/rendering/InlineFlowBox.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/rendering/InlineFlowBox.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/rendering/InlineFlowBox.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -1002,7 +1002,7 @@
     flipForWritingMode(overflowRect);
     overflowRect.moveBy(paintOffset);
     
-    if (!paintInfo.rect.intersects(enclosingIntRect(overflowRect))) // FIXME: Make Emil more consistent.
+    if (!paintInfo.rect.intersects(pixelSnappedIntRect(overflowRect)))
         return;
 
     if (paintInfo.phase != PaintPhaseChildOutlines) {

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBlock.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/rendering/RenderBlock.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBlock.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -2467,7 +2467,7 @@
         }
         colRect.moveBy(paintOffset);
         PaintInfo info(paintInfo);
-        info.rect.intersect(enclosingIntRect(colRect));         // FIXME: make Emil more consistent.
+        info.rect.intersect(pixelSnappedIntRect(colRect));
         
         if (!info.rect.isEmpty()) {
             GraphicsContextStateSaver stateSaver(*context);
@@ -2946,7 +2946,7 @@
                                     r->m_renderer->width(), r->m_renderer->height());
                 rootBlock->flipForWritingMode(floatBox);
                 floatBox.move(rootBlockPhysicalPosition.x(), rootBlockPhysicalPosition.y());
-                paintInfo->context->clipOut(enclosingIntRect(floatBox));
+                paintInfo->context->clipOut(pixelSnappedIntRect(floatBox));
             }
         }
     }

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBox.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/rendering/RenderBox.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBox.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -934,12 +934,12 @@
         paintBackground(paintInfo, paintRect, bleedAvoidance);
 
         if (style()->hasAppearance())
-            theme()->paintDecorations(this, paintInfo, enclosingIntRect(paintRect));
+            theme()->paintDecorations(this, paintInfo, pixelSnappedIntRect(paintRect));
     }
     paintBoxShadow(paintInfo, paintRect, style(), Inset);
 
     // The theme will tell us whether or not we should also paint the CSS border.
-    if ((!style()->hasAppearance() || (!themePainted && theme()->paintBorderOnly(this, paintInfo, enclosingIntRect(paintRect)))) && style()->hasBorder())
+    if ((!style()->hasAppearance() || (!themePainted && theme()->paintBorderOnly(this, paintInfo, pixelSnappedIntRect(paintRect)))) && style()->hasBorder())
         paintBorder(paintInfo, paintRect, style(), bleedAvoidance);
 
     if (bleedAvoidance == BackgroundBleedUseTransparencyLayer)
@@ -1209,7 +1209,7 @@
         paintObject(paintInfo, accumulatedOffset);
         paintInfo.phase = PaintPhaseChildBlockBackgrounds;
     }
-    IntRect clipRect = enclosingIntRect(isControlClip ? controlClipRect(accumulatedOffset) : overflowClipRect(accumulatedOffset, paintInfo.renderRegion)); // FIXME
+    IntRect clipRect = pixelSnappedIntRect(isControlClip ? controlClipRect(accumulatedOffset) : overflowClipRect(accumulatedOffset, paintInfo.renderRegion));
     paintInfo.context->save();
     if (style()->hasBorderRadius())
         paintInfo.context->addRoundedRectClip(style()->getRoundedInnerBorderFor(LayoutRect(accumulatedOffset, size())));

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderBoxModelObject.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/rendering/RenderBoxModelObject.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderBoxModelObject.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -693,7 +693,7 @@
         // We have to draw our text into a mask that can then be used to clip background drawing.
         // First figure out how big the mask has to be.  It should be no bigger than what we need
         // to actually render, so we should intersect the dirty rect with the border box of the background.
-        IntRect maskRect = enclosingIntRect(rect);
+        IntRect maskRect = pixelSnappedIntRect(rect);
         maskRect.intersect(paintInfo.rect);
         
         // Now create the mask.
@@ -753,7 +753,7 @@
 
     // Paint the color first underneath all images.
     if (!bgLayer->next()) {
-        LayoutRect backgroundRect(scrolledPaintRect);
+        IntRect backgroundRect(pixelSnappedIntRect(scrolledPaintRect));
         backgroundRect.intersect(paintInfo.rect);
         // If we have an alpha and we are painting the root element, go ahead and blend with the base background color.
         Color baseColor;
@@ -990,7 +990,7 @@
     LayoutUnit left = 0;
     LayoutUnit top = 0;
     IntSize positioningAreaSize;
-    IntRect alignedRect = IntRect(roundedIntPoint(paintRect.location()), roundedIntSize(paintRect.size()));
+    IntRect alignedRect = pixelSnappedIntRect(paintRect);
 
     // Determine the background positioning area and set destRect to the background painting area.
     // destRect will be adjusted later if the background is non-repeating.
@@ -1029,13 +1029,13 @@
         // its margins. Since those were added in already, we have to factor them out when computing
         // the background positioning area.
         if (isRoot()) {
-            positioningAreaSize = expandedIntSize(LayoutSize(toRenderBox(this)->width() - left - right, toRenderBox(this)->height() - top - bottom));
+            positioningAreaSize = roundedIntSize(LayoutSize(toRenderBox(this)->width() - left - right, toRenderBox(this)->height() - top - bottom));
             left += marginLeft();
             top += marginTop();
         } else
-            positioningAreaSize = expandedIntSize(LayoutSize(paintRect.width() - left - right, paintRect.height() - top - bottom));
+            positioningAreaSize = roundedIntSize(LayoutSize(alignedRect.width() - left - right, alignedRect.height() - top - bottom));
     } else {
-        geometry.setDestRect(enclosingIntRect(viewRect()));
+        geometry.setDestRect(pixelSnappedIntRect(viewRect()));
         positioningAreaSize = geometry.destRect().size();
     }
 
@@ -1883,7 +1883,7 @@
 
     graphicsContext->setStrokeStyle(NoStroke);
     graphicsContext->setFillColor(color, style->colorSpace());
-    graphicsContext->drawRect(enclosingIntRect(borderRect));
+    graphicsContext->drawRect(pixelSnappedIntRect(borderRect));
 }
 #else
 void RenderBoxModelObject::paintBorder(const PaintInfo& info, const IntRect& rect, const RenderStyle* style,
@@ -2584,7 +2584,7 @@
                 if (!rectToClipOut.isEmpty())
                     context->clipOutRoundedRect(rectToClipOut);
 
-                RoundedRect influenceRect(enclosingIntRect(shadowRect), border.radii());
+                RoundedRect influenceRect(pixelSnappedIntRect(shadowRect), border.radii());
                 influenceRect.expandRadii(2 * shadowBlur + shadowSpread);
                 if (allCornersClippedOut(influenceRect, info.rect))
                     context->fillRect(fillRect.rect(), Color::black, s->colorSpace());
@@ -2607,7 +2607,7 @@
                 }
 
                 if (!rectToClipOut.isEmpty())
-                    context->clipOut(enclosingIntRect(rectToClipOut));
+                    context->clipOut(pixelSnappedIntRect(rectToClipOut));
                 context->fillRect(fillRect.rect(), Color::black, s->colorSpace());
             }
         } else {
@@ -2642,7 +2642,7 @@
             Color fillColor(shadowColor.red(), shadowColor.green(), shadowColor.blue(), 255);
 
             LayoutRect outerRect = areaCastingShadowInHole(border.rect(), shadowBlur, shadowSpread, shadowOffset);
-            RoundedRect roundedHole(enclosingIntRect(holeRect), border.radii());
+            RoundedRect roundedHole(pixelSnappedIntRect(holeRect), border.radii());
 
             GraphicsContextStateSaver stateSaver(*context);
             if (hasBorderRadius) {
@@ -2662,7 +2662,7 @@
             else
                 context->setShadow(shadowOffset, shadowBlur, shadowColor, s->colorSpace());
 
-            context->fillRectWithRoundedHole(enclosingIntRect(outerRect), roundedHole, fillColor, s->colorSpace());
+            context->fillRectWithRoundedHole(pixelSnappedIntRect(outerRect), roundedHole, fillColor, s->colorSpace());
         }
     }
 }

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderDetailsMarker.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/rendering/RenderDetailsMarker.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderDetailsMarker.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -132,7 +132,7 @@
     overflowRect.moveBy(boxOrigin);
     overflowRect.inflate(maximalOutlineSize(paintInfo.phase));
 
-    if (!paintInfo.rect.intersects(enclosingIntRect(overflowRect))) // FIXME: Make Emil more consistent.
+    if (!paintInfo.rect.intersects(pixelSnappedIntRect(overflowRect)))
         return;
 
     const Color color(style()->visitedDependentColor(CSSPropertyColor));

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderFlowThread.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/rendering/RenderFlowThread.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderFlowThread.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -427,7 +427,7 @@
     LayoutRect regionClippingRect(paintOffset + (regionOverflowRect.location() - regionRect.location()), regionOverflowRect.size());
 
     PaintInfo info(paintInfo);
-    info.rect.intersect(enclosingIntRect(regionClippingRect)); // FIXME: Make Emil more consistent.
+    info.rect.intersect(pixelSnappedIntRect(regionClippingRect));
 
     if (!info.rect.isEmpty()) {
         context->save();

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderFrameSet.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/rendering/RenderFrameSet.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderFrameSet.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -82,7 +82,7 @@
 
 void RenderFrameSet::paintColumnBorder(const PaintInfo& paintInfo, const LayoutRect& borderRect)
 {
-    if (!paintInfo.rect.intersects(enclosingIntRect(borderRect))) // FIXME: get rounding right
+    if (!paintInfo.rect.intersects(pixelSnappedIntRect(borderRect)))
         return;
         
     // FIXME: We should do something clever when borders from distinct framesets meet at a join.
@@ -102,7 +102,8 @@
 
 void RenderFrameSet::paintRowBorder(const PaintInfo& paintInfo, const LayoutRect& borderRect)
 {
-    if (!paintInfo.rect.intersects(enclosingIntRect(borderRect)))
+    IntRect snappedBorderRect = pixelSnappedIntRect(borderRect);
+    if (!paintInfo.rect.intersects(snappedBorderRect))
         return;
 
     // FIXME: We should do something clever when borders from distinct framesets meet at a join.
@@ -110,7 +111,7 @@
     // Fill first.
     GraphicsContext* context = paintInfo.context;
     ColorSpace colorSpace = style()->colorSpace();
-    context->fillRect(enclosingIntRect(borderRect), frameSet()->hasBorderColor() ? style()->visitedDependentColor(CSSPropertyBorderLeftColor) : borderFillColor(), colorSpace);
+    context->fillRect(snappedBorderRect, frameSet()->hasBorderColor() ? style()->visitedDependentColor(CSSPropertyBorderLeftColor) : borderFillColor(), colorSpace);
 
     // Now stroke the edges but only if we have enough room to paint both edges with a little
     // bit of the fill color showing through.
@@ -571,7 +572,7 @@
         int height = m_rows.m_sizes[r];
 
         for (int c = 0; c < cols; c++) {
-            IntRect oldFrameRect = enclosingIntRect(child->frameRect());
+            IntRect oldFrameRect = pixelSnappedIntRect(child->frameRect());
 
             int width = m_cols.m_sizes[c];
 
@@ -619,7 +620,7 @@
         xPos = 0;
         for (int c = 0; c < cols; c++) {
             // ensure the rows and columns are filled
-            IntRect oldRect = enclosingIntRect(child->frameRect());
+            IntRect oldRect = pixelSnappedIntRect(child->frameRect());
 
             child->setLocation(IntPoint(xPos, yPos));
             child->setHeight(m_rows.m_sizes[r]);

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderImage.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/rendering/RenderImage.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderImage.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -396,7 +396,7 @@
 
 void RenderImage::paintIntoRect(GraphicsContext* context, const LayoutRect& rect)
 {
-    IntRect alignedRect = enclosingIntRect(rect);
+    IntRect alignedRect = pixelSnappedIntRect(rect);
     if (!m_imageResource->hasImage() || m_imageResource->errorOccurred() || alignedRect.width() <= 0 || alignedRect.height() <= 0)
         return;
 

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderLayerBacking.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/rendering/RenderLayerBacking.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderLayerBacking.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -509,7 +509,7 @@
         reflectionBacking->graphicsLayer()->setReplicatedLayerPosition(FloatPoint() + (layerBounds.location() - reflectionLayerBounds.location()));
     }
 
-    m_graphicsLayer->setContentsRect(enclosingIntRect(contentsBox()));
+    m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox()));
     updateDrawsContent();
     updateAfterWidgetResize();
 }
@@ -1119,7 +1119,7 @@
         // Establish the clip used to paint our background.
         m_owningLayer->clipToRect(rootLayer, context, paintDirtyRect, damageRect, DoNotIncludeSelfForBorderRadius);
         
-        PaintInfo info(context, enclosingIntRect(damageRect.rect()) /* FIXME: Make Emil be more consistent. */, PaintPhaseBlockBackground, false, paintingRootForRenderer, 0, 0);
+        PaintInfo info(context, pixelSnappedIntRect(damageRect.rect()), PaintPhaseBlockBackground, false, paintingRootForRenderer, 0, 0);
         renderer()->paint(info, paintOffset);
 
         // Restore the clip.
@@ -1156,7 +1156,7 @@
 
         if (!outlineRect.isEmpty()) {
             // Paint our own outline
-            PaintInfo paintInfo(context, enclosingIntRect(outlineRect.rect()), PaintPhaseSelfOutline, false, paintingRootForRenderer, 0, 0);
+            PaintInfo paintInfo(context, pixelSnappedIntRect(outlineRect.rect()), PaintPhaseSelfOutline, false, paintingRootForRenderer, 0, 0);
             m_owningLayer->clipToRect(rootLayer, context, paintDirtyRect, outlineRect, DoNotIncludeSelfForBorderRadius);
             renderer()->paint(paintInfo, paintOffset);
             m_owningLayer->restoreClip(context, paintDirtyRect, outlineRect);
@@ -1174,7 +1174,7 @@
             m_owningLayer->clipToRect(rootLayer, context, paintDirtyRect, damageRect, DoNotIncludeSelfForBorderRadius);
 
             // Paint the mask.
-            PaintInfo paintInfo(context, enclosingIntRect(damageRect.rect()), PaintPhaseMask, false, paintingRootForRenderer, 0, 0);
+            PaintInfo paintInfo(context, pixelSnappedIntRect(damageRect.rect()), PaintPhaseMask, false, paintingRootForRenderer, 0, 0);
             renderer()->paint(paintInfo, paintOffset);
             
             // Restore the clip.
@@ -1195,7 +1195,7 @@
     context.translate(-scrollbarRect.x(), -scrollbarRect.y());
     LayoutRect transformedClip = clip;
     transformedClip.moveBy(scrollbarRect.location());
-    scrollbar->paint(&context, enclosingIntRect(transformedClip));
+    scrollbar->paint(&context, pixelSnappedIntRect(transformedClip));
     context.restore();
 }
 

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderObject.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/rendering/RenderObject.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderObject.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -962,7 +962,7 @@
                 // this matters for rects in transformed contexts.
                 bool wasAntialiased = graphicsContext->shouldAntialias();
                 graphicsContext->setShouldAntialias(antialias);
-                graphicsContext->drawRect(enclosingIntRect(LayoutRect(x1, y1, x2 - x1, y2 - y1)));
+                graphicsContext->drawRect(pixelSnappedIntRect(LayoutRect(x1, y1, x2 - x1, y2 - y1)));
                 graphicsContext->setShouldAntialias(wasAntialiased);
                 graphicsContext->setStrokeStyle(oldStrokeStyle);
                 return;
@@ -1107,7 +1107,7 @@
     const AtomicString& href = ""
     if (href.isNull())
         return;
-    context->setURLForRect(n->document()->completeURL(href), enclosingIntRect(rect));
+    context->setURLForRect(n->document()->completeURL(href), pixelSnappedIntRect(rect));
 }
 
 void RenderObject::paintOutline(GraphicsContext* graphicsContext, const LayoutRect& paintRect)

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderScrollbarTheme.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/rendering/RenderScrollbarTheme.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderScrollbarTheme.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -93,8 +93,8 @@
 
 IntRect RenderScrollbarTheme::constrainTrackRectToTrackPieces(Scrollbar* scrollbar, const IntRect& rect)
 { 
-    IntRect backRect = enclosingIntRect(toRenderScrollbar(scrollbar)->trackPieceRectWithMargins(BackTrackPart, rect));
-    IntRect forwardRect = enclosingIntRect(toRenderScrollbar(scrollbar)->trackPieceRectWithMargins(ForwardTrackPart, rect));
+    IntRect backRect = pixelSnappedIntRect(toRenderScrollbar(scrollbar)->trackPieceRectWithMargins(BackTrackPart, rect));
+    IntRect forwardRect = pixelSnappedIntRect(toRenderScrollbar(scrollbar)->trackPieceRectWithMargins(ForwardTrackPart, rect));
     IntRect result = rect;
     if (scrollbar->orientation() == HorizontalScrollbar) {
         result.setX(backRect.x());

Modified: branches/subpixellayout/Source/WebCore/rendering/RenderTextControlSingleLine.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/rendering/RenderTextControlSingleLine.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/rendering/RenderTextControlSingleLine.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -174,7 +174,7 @@
         m_searchPopup->saveRecentSearches(name, m_recentSearches);
     }
 
-    m_searchPopup->popupMenu()->show(/* FIXME snap/round? */ enclosingIntRect(absoluteBoundingBoxRect(true)), document()->view(), -1);
+    m_searchPopup->popupMenu()->show(pixelSnappedIntRect(absoluteBoundingBoxRect(true)), document()->view(), -1);
 }
 
 void RenderTextControlSingleLine::hidePopup()
@@ -195,7 +195,7 @@
 
         // Convert the rect into the coords used for painting the content
         contentsRect.moveBy(paintOffset + location());
-        theme()->paintCapsLockIndicator(this, paintInfo, /* FIXME snap/round? */ enclosingIntRect(contentsRect));
+        theme()->paintCapsLockIndicator(this, paintInfo, pixelSnappedIntRect(contentsRect));
     }
 }
 

Modified: branches/subpixellayout/Source/WebCore/rendering/style/RenderStyle.cpp (99907 => 99908)


--- branches/subpixellayout/Source/WebCore/rendering/style/RenderStyle.cpp	2011-11-10 23:31:45 UTC (rev 99907)
+++ branches/subpixellayout/Source/WebCore/rendering/style/RenderStyle.cpp	2011-11-10 23:32:03 UTC (rev 99908)
@@ -871,12 +871,6 @@
     return factor;
 }
 
-static inline IntRect pixelSnappedIntRect(const LayoutRect& borderRect)
-{
-    return IntRect(roundedIntPoint(borderRect.location()), IntSize((borderRect.x() + borderRect.width()).round() - borderRect.x().round(),
-        (borderRect.y() + borderRect.height()).round() - borderRect.y().round()));
-}
-
 RoundedRect RenderStyle::getRoundedBorderFor(const LayoutRect& borderRect, bool includeLogicalLeftEdge, bool includeLogicalRightEdge) const
 {
     RoundedRect roundedRect(pixelSnappedIntRect(borderRect));
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to