- Revision
- 107366
- Author
- [email protected]
- Date
- 2012-02-09 23:07:21 -0800 (Thu, 09 Feb 2012)
Log Message
Convert Frame/FrameView to LayoutUnits in preparation for turning on subpixel layout
https://bugs.webkit.org/show_bug.cgi?id=78311
Reviewed by Eric Seidel.
No new tests, no new functionality.
* page/Frame.cpp:
(WebCore::Frame::nodeImage):
Pixel snap painting rect for image to ensure that it is painted aligned
to device pixels. This avoids avoid unwanted anti-aliasing.
* page/FrameView.cpp:
(WebCore::FrameView::windowClipRectForLayer):
Pixel snap clip rects as all window coordinates and sizes are exposed as
integers.
* page/GestureTapHighlighter.cpp:
* page/Page.cpp:
(WebCore::Page::addRelevantRepaintedObject):
As the painting is done aligned on pixel boundaries we need to pixel snap
the view rect when checking if it intersects the objects paint rect.
* page/mac/FrameMac.mm:
(WebCore::Frame::snapshotDragImage):
(WebCore::Frame::nodeImage):
Pixel snap painting rect for image to ensure that it is painted aligned
to device pixels. This avoids avoid unwanted anti-aliasing.
* page/win/FrameCGWin.cpp:
(WebCore::Frame::nodeImage):
Pixel snap painting rect for image to ensure that it is painted aligned
to device pixels. This avoids avoid unwanted anti-aliasing.
* rendering/LayoutTypes.h:
(WebCore::pixelSnappedIntRect):
(WebCore):
No-op implementation of pixelSnappedIntRect for now.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (107365 => 107366)
--- trunk/Source/WebCore/ChangeLog 2012-02-10 06:44:29 UTC (rev 107365)
+++ trunk/Source/WebCore/ChangeLog 2012-02-10 07:07:21 UTC (rev 107366)
@@ -1,3 +1,44 @@
+2012-02-09 Emil A Eklund <[email protected]>
+
+ Convert Frame/FrameView to LayoutUnits in preparation for turning on subpixel layout
+ https://bugs.webkit.org/show_bug.cgi?id=78311
+
+ Reviewed by Eric Seidel.
+
+ No new tests, no new functionality.
+
+ * page/Frame.cpp:
+ (WebCore::Frame::nodeImage):
+ Pixel snap painting rect for image to ensure that it is painted aligned
+ to device pixels. This avoids avoid unwanted anti-aliasing.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::windowClipRectForLayer):
+ Pixel snap clip rects as all window coordinates and sizes are exposed as
+ integers.
+
+ * page/GestureTapHighlighter.cpp:
+ * page/Page.cpp:
+ (WebCore::Page::addRelevantRepaintedObject):
+ As the painting is done aligned on pixel boundaries we need to pixel snap
+ the view rect when checking if it intersects the objects paint rect.
+
+ * page/mac/FrameMac.mm:
+ (WebCore::Frame::snapshotDragImage):
+ (WebCore::Frame::nodeImage):
+ Pixel snap painting rect for image to ensure that it is painted aligned
+ to device pixels. This avoids avoid unwanted anti-aliasing.
+
+ * page/win/FrameCGWin.cpp:
+ (WebCore::Frame::nodeImage):
+ Pixel snap painting rect for image to ensure that it is painted aligned
+ to device pixels. This avoids avoid unwanted anti-aliasing.
+
+ * rendering/LayoutTypes.h:
+ (WebCore::pixelSnappedIntRect):
+ (WebCore):
+ No-op implementation of pixelSnappedIntRect for now.
+
2012-02-09 Kenichi Ishibashi <[email protected]>
Add WebSocket extension support
Modified: trunk/Source/WebCore/page/Frame.cpp (107365 => 107366)
--- trunk/Source/WebCore/page/Frame.cpp 2012-02-10 06:44:29 UTC (rev 107365)
+++ trunk/Source/WebCore/page/Frame.cpp 2012-02-10 07:07:21 UTC (rev 107366)
@@ -1072,7 +1072,7 @@
m_view->setNodeToDraw(node); // Enable special sub-tree drawing mode.
LayoutRect topLevelRect;
- IntRect paintingRect = renderer->paintingRootRect(topLevelRect);
+ IntRect paintingRect = pixelSnappedIntRect(renderer->paintingRootRect(topLevelRect));
OwnPtr<ImageBuffer> buffer(ImageBuffer::create(paintingRect.size()));
if (!buffer)
Modified: trunk/Source/WebCore/page/FrameView.cpp (107365 => 107366)
--- trunk/Source/WebCore/page/FrameView.cpp 2012-02-10 06:44:29 UTC (rev 107365)
+++ trunk/Source/WebCore/page/FrameView.cpp 2012-02-10 07:07:21 UTC (rev 107366)
@@ -2483,9 +2483,9 @@
// Apply the clip from the layer.
IntRect clipRect;
if (clipToLayerContents)
- clipRect = layer->childrenClipRect();
+ clipRect = pixelSnappedIntRect(layer->childrenClipRect());
else
- clipRect = layer->selfClipRect();
+ clipRect = pixelSnappedIntRect(layer->selfClipRect());
clipRect = contentsToWindow(clipRect);
return intersection(clipRect, windowClipRect());
}
Modified: trunk/Source/WebCore/page/GestureTapHighlighter.cpp (107365 => 107366)
--- trunk/Source/WebCore/page/GestureTapHighlighter.cpp 2012-02-10 06:44:29 UTC (rev 107365)
+++ trunk/Source/WebCore/page/GestureTapHighlighter.cpp 2012-02-10 07:07:21 UTC (rev 107366)
@@ -55,7 +55,7 @@
Frame* mainFrame = containingFrame->page()->mainFrame();
- LayoutPoint mainFramePoint = mainFrame->view()->rootViewToContents(containingFrame->view()->contentsToRootView(LayoutPoint()));
+ LayoutPoint mainFramePoint = mainFrame->view()->rootViewToContents(containingFrame->view()->contentsToRootView(IntPoint()));
return mainFramePoint;
}
@@ -95,8 +95,8 @@
inline void shiftXEdgesToContainIfStrikes(LayoutRect& rect, const LayoutRect& other)
{
- int leftSide = rect.x();
- int rightSide = rect.maxX();
+ LayoutUnit leftSide = rect.x();
+ LayoutUnit rightSide = rect.maxX();
if (!other.isEmpty() && strikes(rect, other)) {
leftSide = std::min(leftSide, other.x());
Modified: trunk/Source/WebCore/page/Page.cpp (107365 => 107366)
--- trunk/Source/WebCore/page/Page.cpp 2012-02-10 06:44:29 UTC (rev 107365)
+++ trunk/Source/WebCore/page/Page.cpp 2012-02-10 07:07:21 UTC (rev 107366)
@@ -1076,7 +1076,7 @@
// The objects are only relevant if they are being painted within the viewRect().
if (RenderView* view = object->view()) {
- if (!objectPaintRect.intersects(view->viewRect()))
+ if (!objectPaintRect.intersects(pixelSnappedIntRect(view->viewRect())))
return;
}
Modified: trunk/Source/WebCore/page/mac/FrameMac.mm (107365 => 107366)
--- trunk/Source/WebCore/page/mac/FrameMac.mm 2012-02-10 06:44:29 UTC (rev 107365)
+++ trunk/Source/WebCore/page/mac/FrameMac.mm 2012-02-10 07:07:21 UTC (rev 107366)
@@ -158,7 +158,7 @@
m_doc->updateLayout(); // forces style recalc - needed since changing the drag state might
// imply new styles, plus JS could have changed other things
LayoutRect topLevelRect;
- NSRect paintingRect = renderer->paintingRootRect(topLevelRect);
+ NSRect paintingRect = pixelSnappedIntRect(renderer->paintingRootRect(topLevelRect));
m_view->setNodeToDraw(node); // invoke special sub-tree drawing mode
NSImage* result = imageFromRect(paintingRect);
@@ -167,7 +167,7 @@
m_view->setNodeToDraw(0);
if (elementRect)
- *elementRect = topLevelRect;
+ *elementRect = pixelSnappedIntRect(topLevelRect);
if (imageRect)
*imageRect = paintingRect;
return result;
@@ -182,7 +182,7 @@
m_doc->updateLayout(); // forces style recalc
LayoutRect topLevelRect;
- NSRect paintingRect = renderer->paintingRootRect(topLevelRect);
+ NSRect paintingRect = pixelSnappedIntRect(renderer->paintingRootRect(topLevelRect));
m_view->setNodeToDraw(node); // invoke special sub-tree drawing mode
NSImage* result = imageFromRect(paintingRect);
Modified: trunk/Source/WebCore/page/win/FrameCGWin.cpp (107365 => 107366)
--- trunk/Source/WebCore/page/win/FrameCGWin.cpp 2012-02-10 06:44:29 UTC (rev 107365)
+++ trunk/Source/WebCore/page/win/FrameCGWin.cpp 2012-02-10 07:07:21 UTC (rev 107366)
@@ -98,7 +98,7 @@
return 0;
LayoutRect topLevelRect;
- IntRect paintingRect = renderer->paintingRootRect(topLevelRect);
+ IntRect paintingRect = pixelSnappedIntRect(renderer->paintingRootRect(topLevelRect));
document()->updateLayout();
Modified: trunk/Source/WebCore/rendering/LayoutTypes.h (107365 => 107366)
--- trunk/Source/WebCore/rendering/LayoutTypes.h 2012-02-10 06:44:29 UTC (rev 107365)
+++ trunk/Source/WebCore/rendering/LayoutTypes.h 2012-02-10 07:07:21 UTC (rev 107366)
@@ -51,6 +51,11 @@
return enclosingIntRect(rect);
}
+inline IntRect pixelSnappedIntRect(const LayoutRect& rect)
+{
+ return rect;
+}
+
inline LayoutSize roundedLayoutSize(const FloatSize& s)
{
return roundedIntSize(s);