Diff
Modified: trunk/Source/WebCore/ChangeLog (198579 => 198580)
--- trunk/Source/WebCore/ChangeLog 2016-03-23 08:21:03 UTC (rev 198579)
+++ trunk/Source/WebCore/ChangeLog 2016-03-23 08:51:59 UTC (rev 198580)
@@ -1,3 +1,16 @@
+2016-03-23 Carlos Garcia Campos <[email protected]>
+
+ Use Region instead of IntRect in PageClient and WebPageProxy setViewNeedsDisplay method
+ https://bugs.webkit.org/show_bug.cgi?id=155747
+
+ Reviewed by Darin Adler.
+
+ Add helper function to make cairo region out of a WebCore::Region.
+
+ * platform/graphics/cairo/CairoUtilities.cpp:
+ (WebCore::toCairoRegion):
+ * platform/graphics/cairo/CairoUtilities.h:
+
2016-03-22 Tim Horton <[email protected]>
Invoking a link preview on a complex link (e.g. an image) results in an empty TextIndicator
Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp (198579 => 198580)
--- trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp 2016-03-23 08:21:03 UTC (rev 198579)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp 2016-03-23 08:51:59 UTC (rev 198580)
@@ -37,6 +37,7 @@
#include "Path.h"
#include "PlatformPathCairo.h"
#include "RefPtrCairo.h"
+#include "Region.h"
#include <wtf/Assertions.h>
#include <wtf/Vector.h>
@@ -308,6 +309,16 @@
#endif
}
+RefPtr<cairo_region_t> toCairoRegion(const Region& region)
+{
+ RefPtr<cairo_region_t> cairoRegion = adoptRef(cairo_region_create());
+ for (const auto& rect : region.rects()) {
+ cairo_rectangle_int_t cairoRect = rect;
+ cairo_region_union_rectangle(cairoRegion.get(), &cairoRect);
+ }
+ return cairoRegion;
+}
+
} // namespace WebCore
#endif // USE(CAIRO)
Modified: trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h (198579 => 198580)
--- trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h 2016-03-23 08:21:03 UTC (rev 198579)
+++ trunk/Source/WebCore/platform/graphics/cairo/CairoUtilities.h 2016-03-23 08:51:59 UTC (rev 198580)
@@ -44,6 +44,7 @@
class IntSize;
class IntRect;
class Path;
+class Region;
void copyContextProperties(cairo_t* srcCr, cairo_t* dstCr);
void setSourceRGBAFromColor(cairo_t*, const Color&);
@@ -65,6 +66,8 @@
void cairoSurfaceSetDeviceScale(cairo_surface_t*, double xScale, double yScale);
void cairoSurfaceGetDeviceScale(cairo_surface_t*, double& xScale, double& yScale);
+RefPtr<cairo_region_t> toCairoRegion(const Region&);
+
} // namespace WebCore
#endif // USE(CAIRO)
Modified: trunk/Source/WebKit2/ChangeLog (198579 => 198580)
--- trunk/Source/WebKit2/ChangeLog 2016-03-23 08:21:03 UTC (rev 198579)
+++ trunk/Source/WebKit2/ChangeLog 2016-03-23 08:51:59 UTC (rev 198580)
@@ -1,3 +1,39 @@
+2016-03-23 Carlos Garcia Campos <[email protected]>
+
+ Use Region instead of IntRect in PageClient and WebPageProxy setViewNeedsDisplay method
+ https://bugs.webkit.org/show_bug.cgi?id=155747
+
+ Reviewed by Darin Adler.
+
+ This way instead of calling setViewNeedsDisplay() for every
+ rectangle in the damage area, we can build a region and call
+ setViewNeedsDisplay() once. GTK+ has API to queue a redraw for a
+ given region, so we also avoid scheduling multiple redraws in GTK+
+ port.
+
+ * UIProcess/API/gtk/PageClientImpl.cpp:
+ (WebKit::PageClientImpl::setViewNeedsDisplay): Convert the Region
+ into a cairo_region_t and use gtk_widget_queue_draw_region()
+ instyead of gtk_widget_queue_draw_area().
+ * UIProcess/API/gtk/PageClientImpl.h:
+ * UIProcess/DrawingAreaProxyImpl.cpp:
+ (WebKit::DrawingAreaProxyImpl::incorporateUpdate): Build a Region
+ with the damage rectangles and call
+ WebPageProxy::setViewNeedsDisplay() once.
+ * UIProcess/PageClient.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::setViewNeedsDisplay):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/efl/WebView.cpp:
+ (WebKit::WebView::setViewNeedsDisplay):
+ * UIProcess/efl/WebView.h:
+ * UIProcess/ios/PageClientImplIOS.h:
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::setViewNeedsDisplay):
+ * UIProcess/mac/PageClientImpl.h:
+ * UIProcess/mac/PageClientImpl.mm:
+ (WebKit::PageClientImpl::setViewNeedsDisplay):
+
2016-03-22 Tim Horton <[email protected]>
Invoking a link preview on a complex link (e.g. an image) results in an empty TextIndicator
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp (198579 => 198580)
--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp 2016-03-23 08:21:03 UTC (rev 198579)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp 2016-03-23 08:51:59 UTC (rev 198580)
@@ -41,9 +41,11 @@
#include "WebPageProxy.h"
#include "WebPopupMenuProxyGtk.h"
#include "WebProcessPool.h"
+#include <WebCore/CairoUtilities.h>
#include <WebCore/Cursor.h>
#include <WebCore/EventNames.h>
#include <WebCore/GtkUtilities.h>
+#include <WebCore/RefPtrCairo.h>
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
@@ -62,9 +64,10 @@
return std::make_unique<DrawingAreaProxyImpl>(*webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_viewWidget)));
}
-void PageClientImpl::setViewNeedsDisplay(const WebCore::IntRect& rect)
+void PageClientImpl::setViewNeedsDisplay(const WebCore::Region& region)
{
- gtk_widget_queue_draw_area(m_viewWidget, rect.x(), rect.y(), rect.width(), rect.height());
+ RefPtr<cairo_region_t> damageRegion = toCairoRegion(region);
+ gtk_widget_queue_draw_region(m_viewWidget, damageRegion.get());
}
void PageClientImpl::requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, bool)
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h (198579 => 198580)
--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h 2016-03-23 08:21:03 UTC (rev 198579)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h 2016-03-23 08:51:59 UTC (rev 198580)
@@ -55,7 +55,7 @@
private:
// PageClient
std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy() override;
- void setViewNeedsDisplay(const WebCore::IntRect&) override;
+ void setViewNeedsDisplay(const WebCore::Region&) override;
void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll) override;
WebCore::IntSize viewSize() override;
bool isViewWindowActive() override;
Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp (198579 => 198580)
--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp 2016-03-23 08:21:03 UTC (rev 198579)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp 2016-03-23 08:51:59 UTC (rev 198580)
@@ -228,11 +228,14 @@
m_backingStore = std::make_unique<BackingStore>(updateInfo.viewSize, updateInfo.deviceScaleFactor, m_webPageProxy);
m_backingStore->incorporateUpdate(updateInfo);
+
+ Region damageRegion;
if (updateInfo.scrollRect.isEmpty()) {
for (const auto& rect : updateInfo.updateRects)
- m_webPageProxy.setViewNeedsDisplay(rect);
+ damageRegion.unite(rect);
} else
- m_webPageProxy.setViewNeedsDisplay(IntRect(IntPoint(), m_webPageProxy.viewSize()));
+ damageRegion = IntRect(IntPoint(), m_webPageProxy.viewSize());
+ m_webPageProxy.setViewNeedsDisplay(damageRegion);
}
void DrawingAreaProxyImpl::backingStoreStateDidChange(RespondImmediatelyOrNot respondImmediatelyOrNot)
Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (198579 => 198580)
--- trunk/Source/WebKit2/UIProcess/PageClient.h 2016-03-23 08:21:03 UTC (rev 198579)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h 2016-03-23 08:51:59 UTC (rev 198580)
@@ -93,8 +93,8 @@
// Create a new drawing area proxy for the given page.
virtual std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy() = 0;
- // Tell the view to invalidate the given rect. The rect is in view coordinates.
- virtual void setViewNeedsDisplay(const WebCore::IntRect&) = 0;
+ // Tell the view to invalidate the given region. The region is in view coordinates.
+ virtual void setViewNeedsDisplay(const WebCore::Region&) = 0;
// Tell the view to scroll to the given position, and whether this was a programmatic scroll.
virtual void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll) = 0;
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (198579 => 198580)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-03-23 08:21:03 UTC (rev 198579)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-03-23 08:51:59 UTC (rev 198580)
@@ -1319,9 +1319,9 @@
m_process->send(Messages::WebPage::ViewWillEndLiveResize(), m_pageID);
}
-void WebPageProxy::setViewNeedsDisplay(const IntRect& rect)
+void WebPageProxy::setViewNeedsDisplay(const Region& region)
{
- m_pageClient.setViewNeedsDisplay(rect);
+ m_pageClient.setViewNeedsDisplay(region);
}
void WebPageProxy::requestScroll(const FloatPoint& scrollPosition, const IntPoint& scrollOrigin, bool isProgrammaticScroll)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (198579 => 198580)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-03-23 08:21:03 UTC (rev 198579)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-03-23 08:51:59 UTC (rev 198580)
@@ -413,7 +413,7 @@
void clearSelection();
void restoreSelectionInFocusedEditableElement();
- void setViewNeedsDisplay(const WebCore::IntRect&);
+ void setViewNeedsDisplay(const WebCore::Region&);
void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll);
void setDelegatesScrolling(bool delegatesScrolling) { m_delegatesScrolling = delegatesScrolling; }
Modified: trunk/Source/WebKit2/UIProcess/efl/WebView.cpp (198579 => 198580)
--- trunk/Source/WebKit2/UIProcess/efl/WebView.cpp 2016-03-23 08:21:03 UTC (rev 198579)
+++ trunk/Source/WebKit2/UIProcess/efl/WebView.cpp 2016-03-23 08:51:59 UTC (rev 198580)
@@ -409,9 +409,10 @@
return std::make_unique<CoordinatedDrawingAreaProxy>(*m_page);
}
-void WebView::setViewNeedsDisplay(const WebCore::IntRect& area)
+void WebView::setViewNeedsDisplay(const WebCore::Region& region)
{
- m_client.viewNeedsDisplay(this, area);
+ for (const auto& rect : region.rects())
+ m_client.viewNeedsDisplay(this, rect);
}
void WebView::requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, bool)
Modified: trunk/Source/WebKit2/UIProcess/efl/WebView.h (198579 => 198580)
--- trunk/Source/WebKit2/UIProcess/efl/WebView.h 2016-03-23 08:21:03 UTC (rev 198579)
+++ trunk/Source/WebKit2/UIProcess/efl/WebView.h 2016-03-23 08:51:59 UTC (rev 198580)
@@ -154,7 +154,7 @@
// PageClient
std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy() override;
- void setViewNeedsDisplay(const WebCore::IntRect&) override;
+ void setViewNeedsDisplay(const WebCore::Region&) override;
void requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, bool) override;
Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (198579 => 198580)
--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h 2016-03-23 08:21:03 UTC (rev 198579)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h 2016-03-23 08:51:59 UTC (rev 198580)
@@ -50,7 +50,7 @@
private:
// PageClient
std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy() override;
- void setViewNeedsDisplay(const WebCore::IntRect&) override;
+ void setViewNeedsDisplay(const WebCore::Region&) override;
void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll) override;
WebCore::IntSize viewSize() override;
bool isViewWindowActive() override;
Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (198579 => 198580)
--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm 2016-03-23 08:21:03 UTC (rev 198579)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm 2016-03-23 08:51:59 UTC (rev 198580)
@@ -123,7 +123,7 @@
return [m_contentView _createDrawingAreaProxy];
}
-void PageClientImpl::setViewNeedsDisplay(const IntRect& rect)
+void PageClientImpl::setViewNeedsDisplay(const Region&)
{
ASSERT_NOT_REACHED();
}
Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (198579 => 198580)
--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h 2016-03-23 08:21:03 UTC (rev 198579)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h 2016-03-23 08:51:59 UTC (rev 198580)
@@ -62,7 +62,7 @@
private:
// PageClient
std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy() override;
- void setViewNeedsDisplay(const WebCore::IntRect&) override;
+ void setViewNeedsDisplay(const WebCore::Region&) override;
void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, bool isProgrammaticScroll) override;
WebCore::IntSize viewSize() override;
Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (198579 => 198580)
--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2016-03-23 08:21:03 UTC (rev 198579)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2016-03-23 08:51:59 UTC (rev 198580)
@@ -115,7 +115,7 @@
return m_impl->createDrawingAreaProxy();
}
-void PageClientImpl::setViewNeedsDisplay(const WebCore::IntRect& rect)
+void PageClientImpl::setViewNeedsDisplay(const WebCore::Region&)
{
ASSERT_NOT_REACHED();
}