https://bugs.webkit.org/show_bug.cgi?id=128460
Reviewed by Simon Fraser.
GraphicsClient::paintContents takes clipRect as FloatRect now so that we can paint on
subpixel position.
No change in functionality.
Source/WebCore:
* platform/graphics/GraphicsLayerClient.h:
* platform/graphics/texmap/coordinated/CompositingCoordinator.cpp:
(WebCore::CompositingCoordinator::paintContents):
* platform/graphics/texmap/coordinated/CompositingCoordinator.h:
* rendering/RenderLayer.cpp:
(WebCore::cornerRect):
(WebCore::RenderLayer::scrollCornerRect):
(WebCore::resizerCornerRect):
(WebCore::RenderLayer::scrollCornerAndResizerRect):
(WebCore::RenderLayer::verticalScrollbarStart):
(WebCore::RenderLayer::horizontalScrollbarStart):
(WebCore::RenderLayer::paintResizer):
(WebCore::RenderLayer::hitTestOverflowControls):
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::paintIntoLayer):
(WebCore::RenderLayerBacking::paintContents):
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::paintContents):
* rendering/RenderLayerCompositor.h:
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::paint):
Source/WebKit/gtk:
* WebCoreSupport/AcceleratedCompositingContext.h:
* WebCoreSupport/AcceleratedCompositingContextGL.cpp:
(WebKit::AcceleratedCompositingContext::paintContents):
Source/WebKit/win:
* WebView.cpp:
(WebView::paintContents):
* WebView.h:
Source/WebKit2:
* WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
(WebKit::LayerTreeHostGtk::paintContents):
* WebProcess/WebPage/gtk/LayerTreeHostGtk.h:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::paintContents):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::paintContents):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163931
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2014-02-11 Zalan Bujtas <zalan@apple.com>
+
+ Subpixel rendering: Make GraphicsLayerClient::paintContents's clip rect subpixel based.
+ https://bugs.webkit.org/show_bug.cgi?id=128460
+
+ Reviewed by Simon Fraser.
+
+ GraphicsClient::paintContents takes clipRect as FloatRect now so that we can paint on
+ subpixel position.
+
+ No change in functionality.
+
+ * platform/graphics/GraphicsLayerClient.h:
+ * platform/graphics/texmap/coordinated/CompositingCoordinator.cpp:
+ (WebCore::CompositingCoordinator::paintContents):
+ * platform/graphics/texmap/coordinated/CompositingCoordinator.h:
+ * rendering/RenderLayer.cpp:
+ (WebCore::cornerRect):
+ (WebCore::RenderLayer::scrollCornerRect):
+ (WebCore::resizerCornerRect):
+ (WebCore::RenderLayer::scrollCornerAndResizerRect):
+ (WebCore::RenderLayer::verticalScrollbarStart):
+ (WebCore::RenderLayer::horizontalScrollbarStart):
+ (WebCore::RenderLayer::paintResizer):
+ (WebCore::RenderLayer::hitTestOverflowControls):
+ * rendering/RenderLayer.h:
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::paintIntoLayer):
+ (WebCore::RenderLayerBacking::paintContents):
+ * rendering/RenderLayerBacking.h:
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::paintContents):
+ * rendering/RenderLayerCompositor.h:
+ * rendering/RenderWidget.cpp:
+ (WebCore::RenderWidget::paint):
+
2014-02-11 Antti Koivisto <antti@apple.com>
GIF animations should be suspended when outside of viewport
namespace WebCore {
class FloatPoint;
+class FloatRect;
class GraphicsContext;
class GraphicsLayer;
class IntPoint;
// Notification that this layer requires a flush before the next display refresh.
virtual void notifyFlushBeforeDisplayRefresh(const GraphicsLayer*) { }
- virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) = 0;
+ virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const FloatRect& inClip) = 0;
virtual void didCommitChangesForLayer(const GraphicsLayer*) const { }
// Provides current transform (taking transform-origin and animations into account). Input matrix has been
}
-void CompositingCoordinator::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const IntRect& clipRect)
+void CompositingCoordinator::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const FloatRect& clipRect)
{
- m_client->paintLayerContents(graphicsLayer, graphicsContext, clipRect);
+ m_client->paintLayerContents(graphicsLayer, graphicsContext, enclosingIntRect(clipRect));
}
std::unique_ptr<GraphicsLayer> CompositingCoordinator::createGraphicsLayer(GraphicsLayerClient* client)
// GraphicsLayerClient
virtual void notifyAnimationStarted(const GraphicsLayer*, double time) override;
virtual void notifyFlushRequired(const GraphicsLayer*) override;
- virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& clipRect) override;
+ virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const FloatRect& clipRect) override;
virtual float deviceScaleFactor() const override;
virtual float pageScaleFactor() const override;
{
RenderBox* box = renderBox();
if (!box)
- return IntRect();
+ return LayoutRect();
LayoutRect scrollCornerAndResizer = scrollCornerRect();
if (scrollCornerAndResizer.isEmpty())
scrollCornerAndResizer = resizerCornerRect(this, box->borderBoxRect());
}
void RenderLayerBacking::paintIntoLayer(const GraphicsLayer* graphicsLayer, GraphicsContext* context,
- const IntRect& paintDirtyRect, // In the coords of rootLayer.
- PaintBehavior paintBehavior, GraphicsLayerPaintingPhase paintingPhase)
+ const LayoutRect& paintDirtyRect, // In the coords of rootLayer.
+ PaintBehavior paintBehavior, GraphicsLayerPaintingPhase paintingPhase)
{
if (paintsIntoWindow() || paintsIntoCompositedAncestor()) {
#if !PLATFORM(IOS)
}
// Up-call from compositing layer drawing callback.
-void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const IntRect& clip)
+void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const FloatRect& clip)
{
#ifndef NDEBUG
if (Page* page = renderer().frame().page())
page->setIsPainting(true);
#endif
+ // The dirtyRect is in the coords of the painting root.
+ LayoutRect dirtyRect(clip);
+ IntRect pixelSnappedRectForIntegralPositionedItems = pixelSnappedIntRect(dirtyRect);
+
if (graphicsLayer == m_graphicsLayer.get()
|| graphicsLayer == m_foregroundLayer.get()
|| graphicsLayer == m_backgroundLayer.get()
|| graphicsLayer == m_scrollingContentsLayer.get()) {
InspectorInstrumentation::willPaint(&renderer());
- // The dirtyRect is in the coords of the painting root.
- IntRect dirtyRect = clip;
if (!(paintingPhase & GraphicsLayerPaintOverflowContents))
dirtyRect.intersect(enclosingIntRect(compositedBoundsIncludingMargin()));
// We have to use the same root as for hit testing, because both methods can compute and cache clipRects.
paintIntoLayer(graphicsLayer, &context, dirtyRect, PaintBehaviorNormal, paintingPhase);
- InspectorInstrumentation::didPaint(&renderer(), &context, clip);
+ InspectorInstrumentation::didPaint(&renderer(), &context, dirtyRect);
} else if (graphicsLayer == layerForHorizontalScrollbar()) {
- paintScrollbar(m_owningLayer.horizontalScrollbar(), context, clip);
+ paintScrollbar(m_owningLayer.horizontalScrollbar(), context, pixelSnappedRectForIntegralPositionedItems);
} else if (graphicsLayer == layerForVerticalScrollbar()) {
- paintScrollbar(m_owningLayer.verticalScrollbar(), context, clip);
+ paintScrollbar(m_owningLayer.verticalScrollbar(), context, pixelSnappedRectForIntegralPositionedItems);
} else if (graphicsLayer == layerForScrollCorner()) {
const LayoutRect& scrollCornerAndResizer = m_owningLayer.scrollCornerAndResizerRect();
context.save();
context.translate(-scrollCornerAndResizer.x(), -scrollCornerAndResizer.y());
- LayoutRect transformedClip = clip;
+ LayoutRect transformedClip = LayoutRect(clip);
transformedClip.moveBy(scrollCornerAndResizer.location());
m_owningLayer.paintScrollCorner(&context, IntPoint(), pixelSnappedIntRect(transformedClip));
m_owningLayer.paintResizer(&context, IntPoint(), transformedClip);
virtual void notifyFlushRequired(const GraphicsLayer*) override;
virtual void notifyFlushBeforeDisplayRefresh(const GraphicsLayer*) override;
- virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& clip) override;
+ virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const FloatRect& clip) override;
virtual float deviceScaleFactor() const override;
virtual float contentsScaleMultiplierForNewTiles(const GraphicsLayer*) const override;
bool hasTiledBackingFlatteningLayer() const { return (m_childContainmentLayer && m_usingTiledCacheLayer); }
GraphicsLayer* tileCacheFlatteningLayer() const { return m_usingTiledCacheLayer ? m_childContainmentLayer.get() : 0; }
- void paintIntoLayer(const GraphicsLayer*, GraphicsContext*, const IntRect& paintDirtyRect, PaintBehavior, GraphicsLayerPaintingPhase);
+ void paintIntoLayer(const GraphicsLayer*, GraphicsContext*, const LayoutRect& paintDirtyRect, PaintBehavior, GraphicsLayerPaintingPhase);
// Helper function for updateGraphicsLayerGeometry.
void adjustAncestorCompositingBoundsForFlowThread(IntRect& ancestorCompositingBounds, const RenderLayer* compositingAncestor) const;
context.restore();
}
-void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& clip)
+void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase, const FloatRect& clip)
{
+ IntRect pixelSnappedRectForIntegralPositionedItems = pixelSnappedIntRect(LayoutRect(clip));
if (graphicsLayer == layerForHorizontalScrollbar())
- paintScrollbar(m_renderView.frameView().horizontalScrollbar(), context, clip);
+ paintScrollbar(m_renderView.frameView().horizontalScrollbar(), context, pixelSnappedRectForIntegralPositionedItems);
else if (graphicsLayer == layerForVerticalScrollbar())
- paintScrollbar(m_renderView.frameView().verticalScrollbar(), context, clip);
+ paintScrollbar(m_renderView.frameView().verticalScrollbar(), context, pixelSnappedRectForIntegralPositionedItems);
else if (graphicsLayer == layerForScrollCorner()) {
const IntRect& scrollCorner = m_renderView.frameView().scrollCornerRect();
context.save();
context.translate(-scrollCorner.x(), -scrollCorner.y());
- IntRect transformedClip = clip;
+ IntRect transformedClip = pixelSnappedRectForIntegralPositionedItems;
transformedClip.moveBy(scrollCorner.location());
m_renderView.frameView().paintScrollCorner(&context, transformedClip);
context.restore();
// GraphicsLayerClient implementation
virtual void notifyAnimationStarted(const GraphicsLayer*, double) override { }
virtual void notifyFlushRequired(const GraphicsLayer*) override;
- virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect&) override;
+ virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const FloatRect&) override;
virtual bool isTrackingRepaints() const override;
+2014-02-11 Zalan Bujtas <zalan@apple.com>
+
+ Subpixel rendering: Make GraphicsLayerClient::paintContents's clip rect subpixel based.
+ https://bugs.webkit.org/show_bug.cgi?id=128460
+
+ Reviewed by Simon Fraser.
+
+ GraphicsClient::paintContents takes clipRect as FloatRect now so that we can paint on
+ subpixel position.
+
+ No change in functionality.
+
+ * WebCoreSupport/AcceleratedCompositingContext.h:
+ * WebCoreSupport/AcceleratedCompositingContextGL.cpp:
+ (WebKit::AcceleratedCompositingContext::paintContents):
+
2014-02-10 Carlos Garcia Campos <cgarcia@igalia.com>
[GLIB] Add GUniqueOutPtr and use it instead of GOwnPtr
#ifndef AcceleratedCompositingContext_h
#define AcceleratedCompositingContext_h
+#include "FloatRect.h"
#include "GraphicsLayer.h"
#include "GraphicsLayerClient.h"
#include "IntRect.h"
// GraphicsLayerClient
virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time);
virtual void notifyFlushRequired(const WebCore::GraphicsLayer*);
- virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& rectToPaint);
+ virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::FloatRect& rectToPaint);
void initialize();
}
-void AcceleratedCompositingContext::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& rectToPaint)
+void AcceleratedCompositingContext::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase, const FloatRect& rectToPaint)
{
context.save();
context.clip(rectToPaint);
- core(m_webView)->mainFrame().view()->paint(&context, rectToPaint);
+ core(m_webView)->mainFrame().view()->paint(&context, enclosingIntRect(rectToPaint));
context.restore();
}
+2014-02-11 Zalan Bujtas <zalan@apple.com>
+
+ Subpixel rendering: Make GraphicsLayerClient::paintContents's clip rect subpixel based.
+ https://bugs.webkit.org/show_bug.cgi?id=128460
+
+ Reviewed by Simon Fraser.
+
+ GraphicsClient::paintContents takes clipRect as FloatRect now so that we can paint on
+ subpixel position.
+
+ No change in functionality.
+
+ * WebView.cpp:
+ (WebView::paintContents):
+ * WebView.h:
+
2014-02-11 Alex Christensen <achristensen@webkit.org>
Fixed pointer truncation on Win64.
flushPendingGraphicsLayerChangesSoon();
}
-void WebView::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& inClip)
+void WebView::paintContents(const GraphicsLayer*, GraphicsContext& context, GraphicsLayerPaintingPhase, const FloatRect& inClip)
{
Frame* frame = core(m_mainFrame);
if (!frame)
context.save();
context.clip(inClip);
- frame->view()->paint(&context, inClip);
+ frame->view()->paint(&context, enclosingIntRect(inClip));
context.restore();
}
// GraphicsLayerClient
virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time);
virtual void notifyFlushRequired(const WebCore::GraphicsLayer*);
- virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& inClip);
+ virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::FloatRect& inClip);
// CACFLayerTreeHostClient
virtual void flushPendingGraphicsLayerChanges();
+2014-02-11 Zalan Bujtas <zalan@apple.com>
+
+ Subpixel rendering: Make GraphicsLayerClient::paintContents's clip rect subpixel based.
+ https://bugs.webkit.org/show_bug.cgi?id=128460
+
+ Reviewed by Simon Fraser.
+
+ GraphicsClient::paintContents takes clipRect as FloatRect now so that we can paint on
+ subpixel position.
+
+ No change in functionality.
+
+ * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
+ (WebKit::LayerTreeHostGtk::paintContents):
+ * WebProcess/WebPage/gtk/LayerTreeHostGtk.h:
+ * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
+ * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
+ (WebKit::RemoteLayerTreeDrawingArea::paintContents):
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+ (WebKit::TiledCoreAnimationDrawingArea::paintContents):
+
2014-02-11 Sam Weinig <sam@webkit.org>
[WebKit2, JSC] Add user default to disable the JIT
{
}
-void LayerTreeHostGtk::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const IntRect& clipRect)
+void LayerTreeHostGtk::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const FloatRect& clipRect)
{
if (graphicsLayer == m_nonCompositedContentLayer.get()) {
- m_webPage->drawRect(graphicsContext, clipRect);
+ m_webPage->drawRect(graphicsContext, enclosingIntRect(clipRect));
return;
}
for (auto& pageOverlayLayer : m_pageOverlayLayers) {
if (pageOverlayLayer.value.get() == graphicsLayer) {
- m_webPage->drawPageOverlay(pageOverlayLayer.key, graphicsContext, clipRect);
+ m_webPage->drawPageOverlay(pageOverlayLayer.key, graphicsContext, enclosingIntRect(clipRect));
break;
}
}
// GraphicsLayerClient
virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time);
virtual void notifyFlushRequired(const WebCore::GraphicsLayer*);
- virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect);
+ virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::FloatRect& clipRect);
virtual void didCommitChangesForLayer(const WebCore::GraphicsLayer*) const { }
void createPageOverlayLayer(PageOverlay*);
// WebCore::GraphicsLayerClient
virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) override { }
virtual void notifyFlushRequired(const WebCore::GraphicsLayer*) override { }
- virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect) override;
+ virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::FloatRect& clipRect) override;
virtual float deviceScaleFactor() const override;
virtual void didCommitChangesForLayer(const WebCore::GraphicsLayer*) const override { }
#if PLATFORM(IOS)
scheduleCompositingLayerFlush();
}
-void RemoteLayerTreeDrawingArea::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const IntRect& clipRect)
+void RemoteLayerTreeDrawingArea::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const FloatRect& clipRect)
{
for (const auto& overlayAndLayer : m_pageOverlayLayers) {
if (overlayAndLayer.value.get() == graphicsLayer) {
- m_webPage->drawPageOverlay(overlayAndLayer.key, graphicsContext, clipRect);
+ m_webPage->drawPageOverlay(overlayAndLayer.key, graphicsContext, enclosingIntRect(clipRect));
break;
}
}
// WebCore::GraphicsLayerClient
virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) override;
virtual void notifyFlushRequired(const WebCore::GraphicsLayer*) override;
- virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect) override;
+ virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::FloatRect& clipRect) override;
virtual float deviceScaleFactor() const override;
virtual void didCommitChangesForLayer(const WebCore::GraphicsLayer*) const override;
{
}
-void TiledCoreAnimationDrawingArea::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const IntRect& clipRect)
+void TiledCoreAnimationDrawingArea::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& graphicsContext, GraphicsLayerPaintingPhase, const FloatRect& clipRect)
{
for (auto it = m_pageOverlayLayers.begin(), end = m_pageOverlayLayers.end(); it != end; ++it) {
if (it->value.get() == graphicsLayer) {
- m_webPage->drawPageOverlay(it->key, graphicsContext, clipRect);
+ m_webPage->drawPageOverlay(it->key, graphicsContext, enclosingIntRect(clipRect));
break;
}
}