Diff
Modified: trunk/Source/WebKit2/ChangeLog (153691 => 153692)
--- trunk/Source/WebKit2/ChangeLog 2013-08-04 00:12:21 UTC (rev 153691)
+++ trunk/Source/WebKit2/ChangeLog 2013-08-04 00:31:27 UTC (rev 153692)
@@ -1,3 +1,51 @@
+2013-08-03 Tim Horton <[email protected]>
+
+ Remove pageOverlayShouldApplyFadeWhenPainting() and adopt composited fade for the Mac port
+ https://bugs.webkit.org/show_bug.cgi?id=119411
+
+ Reviewed by Simon Fraser.
+
+ Mac is the only holdout that performs non-composited fades of page
+ overlays. We should adopt that mechanism (as a precursor to doing a
+ CA-accelerated fade) and remove the now-unnecessary property.
+
+ * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
+ (WKBundlePageOverlayFractionFadedIn):
+ Always return 1 (fully-faded-in) so that clients who attempt to use this
+ to bake the fade opacity into their painting will paint at full opacity,
+ allowing us to do the composited fade separately.
+
+ * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
+ * WebProcess/WebPage/DrawingArea.h:
+ * WebProcess/WebPage/DrawingAreaImpl.cpp:
+ * WebProcess/WebPage/DrawingAreaImpl.h:
+ * WebProcess/WebPage/LayerTreeHost.h:
+ * WebProcess/WebPage/PageOverlay.cpp:
+ (WebKit::PageOverlay::PageOverlay):
+ (WebKit::PageOverlay::setPage):
+ (WebKit::PageOverlay::setNeedsDisplay):
+ (WebKit::PageOverlay::fadeAnimationTimerFired):
+ * WebProcess/WebPage/PageOverlay.h:
+ Remove pageOverlayShouldApplyFadeWhenPainting and fractionFadedIn().
+
+ * WebProcess/WebPage/FindController.cpp:
+ (WebKit::FindController::drawRect):
+ Draw the find overlay without taking the PageOverlay's fade into account.
+
+ * WebProcess/WebPage/TapHighlightController.cpp:
+ (WebKit::TapHighlightController::drawRect):
+ Remove pageOverlayShouldApplyFadeWhenPainting. Since it's always
+ "false" for all ports now, take the second path here.
+
+ * WebProcess/WebPage/mac/LayerTreeHostMac.h:
+ * WebProcess/WebPage/mac/LayerTreeHostMac.mm:
+ (WebKit::LayerTreeHostMac::setPageOverlayOpacity):
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+ * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+ (WebKit::TiledCoreAnimationDrawingArea::setPageOverlayOpacity):
+ Implement setPageOverlayOpacity for DrawingAreaImpl
+ and TiledCoreAnimationDrawingArea.
+
2013-08-02 Gavin Barraclough <[email protected]>
Remove no-arguments constructor to PropertySlot
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp (153691 => 153692)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp 2013-08-04 00:12:21 UTC (rev 153691)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp 2013-08-04 00:31:27 UTC (rev 153692)
@@ -169,5 +169,9 @@
float WKBundlePageOverlayFractionFadedIn(WKBundlePageOverlayRef bundlePageOverlayRef)
{
- return toImpl(bundlePageOverlayRef)->fractionFadedIn();
+ // Clients who include the fade opacity during painting interfere
+ // with composited fade, so we'll pretend we're opaque and do the
+ // fade on our own.
+
+ return 1;
}
Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h (153691 => 153692)
--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h 2013-08-04 00:12:21 UTC (rev 153691)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h 2013-08-04 00:31:27 UTC (rev 153692)
@@ -68,7 +68,6 @@
virtual void didUninstallPageOverlay(PageOverlay*);
virtual void setPageOverlayNeedsDisplay(PageOverlay*, const WebCore::IntRect&);
virtual void setPageOverlayOpacity(PageOverlay*, float);
- virtual bool pageOverlayShouldApplyFadeWhenPainting() const { return false; }
virtual void pauseRendering() { m_isSuspended = true; }
virtual void resumeRendering() { m_isSuspended = false; scheduleLayerFlush(); }
Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (153691 => 153692)
--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h 2013-08-04 00:12:21 UTC (rev 153691)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h 2013-08-04 00:31:27 UTC (rev 153692)
@@ -77,8 +77,6 @@
virtual void didUninstallPageOverlay(PageOverlay*) { }
virtual void setPageOverlayNeedsDisplay(PageOverlay*, const WebCore::IntRect&) { }
virtual void setPageOverlayOpacity(PageOverlay*, float) { }
- // If this function returns false, PageOverlay should apply opacity when painting.
- virtual bool pageOverlayShouldApplyFadeWhenPainting() const { return true; }
virtual void setPaintingEnabled(bool) { }
virtual void updatePreferences(const WebPreferencesStore&) { }
Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp (153691 => 153692)
--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp 2013-08-04 00:12:21 UTC (rev 153691)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp 2013-08-04 00:31:27 UTC (rev 153692)
@@ -253,14 +253,6 @@
m_layerTreeHost->setPageOverlayOpacity(pageOverlay, value);
}
-bool DrawingAreaImpl::pageOverlayShouldApplyFadeWhenPainting() const
-{
- if (m_layerTreeHost && !m_layerTreeHost->pageOverlayShouldApplyFadeWhenPainting())
- return false;
-
- return true;
-}
-
void DrawingAreaImpl::setPaintingEnabled(bool paintingEnabled)
{
m_isPaintingEnabled = paintingEnabled;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h (153691 => 153692)
--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h 2013-08-04 00:12:21 UTC (rev 153691)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h 2013-08-04 00:31:27 UTC (rev 153692)
@@ -65,7 +65,6 @@
virtual void didUninstallPageOverlay(PageOverlay*);
virtual void setPageOverlayNeedsDisplay(PageOverlay*, const WebCore::IntRect&);
virtual void setPageOverlayOpacity(PageOverlay*, float);
- virtual bool pageOverlayShouldApplyFadeWhenPainting() const;
virtual void setPaintingEnabled(bool);
virtual void updatePreferences(const WebPreferencesStore&) OVERRIDE;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp (153691 => 153692)
--- trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp 2013-08-04 00:12:21 UTC (rev 153691)
+++ trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp 2013-08-04 00:31:27 UTC (rev 153692)
@@ -397,35 +397,20 @@
static const float overlayBackgroundBlue = 0.1;
static const float overlayBackgroundAlpha = 0.25;
-static Color overlayBackgroundColor(float fractionFadedIn)
-{
- return Color(overlayBackgroundRed, overlayBackgroundGreen, overlayBackgroundBlue, overlayBackgroundAlpha * fractionFadedIn);
-}
-
-static Color holeShadowColor(float fractionFadedIn)
-{
- return Color(0.0f, 0.0f, 0.0f, fractionFadedIn);
-}
-
-static Color holeFillColor(float fractionFadedIn)
-{
- return Color(1.0f, 1.0f, 1.0f, fractionFadedIn);
-}
-
void FindController::drawRect(PageOverlay* pageOverlay, GraphicsContext& graphicsContext, const IntRect& dirtyRect)
{
- float fractionFadedIn = pageOverlay->fractionFadedIn();
+ Color overlayBackgroundColor(overlayBackgroundRed, overlayBackgroundGreen, overlayBackgroundBlue, overlayBackgroundAlpha);
Vector<IntRect> rects = rectsForTextMatches();
// Draw the background.
- graphicsContext.fillRect(dirtyRect, overlayBackgroundColor(fractionFadedIn), ColorSpaceSRGB);
+ graphicsContext.fillRect(dirtyRect, overlayBackgroundColor, ColorSpaceSRGB);
{
GraphicsContextStateSaver stateSaver(graphicsContext);
- graphicsContext.setShadow(FloatSize(shadowOffsetX, shadowOffsetY), shadowBlurRadius, holeShadowColor(fractionFadedIn), ColorSpaceSRGB);
- graphicsContext.setFillColor(holeFillColor(fractionFadedIn), ColorSpaceSRGB);
+ graphicsContext.setShadow(FloatSize(shadowOffsetX, shadowOffsetY), shadowBlurRadius, Color::black, ColorSpaceSRGB);
+ graphicsContext.setFillColor(Color::white, ColorSpaceSRGB);
// Draw white frames around the holes.
for (size_t i = 0; i < rects.size(); ++i) {
Modified: trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h (153691 => 153692)
--- trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h 2013-08-04 00:12:21 UTC (rev 153691)
+++ trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h 2013-08-04 00:31:27 UTC (rev 153692)
@@ -78,7 +78,6 @@
virtual void didUninstallPageOverlay(PageOverlay*) = 0;
virtual void setPageOverlayNeedsDisplay(PageOverlay*, const WebCore::IntRect&) = 0;
virtual void setPageOverlayOpacity(PageOverlay*, float) { }
- virtual bool pageOverlayShouldApplyFadeWhenPainting() const { return true; }
virtual void pauseRendering() { }
virtual void resumeRendering() { }
Modified: trunk/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp (153691 => 153692)
--- trunk/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp 2013-08-04 00:12:21 UTC (rev 153691)
+++ trunk/Source/WebKit2/WebProcess/WebPage/PageOverlay.cpp 2013-08-04 00:31:27 UTC (rev 153692)
@@ -55,7 +55,6 @@
, m_fadeAnimationDuration(fadeAnimationDuration)
, m_fadeAnimationType(NoAnimation)
, m_fractionFadedIn(1.0)
- , m_pageOverlayShouldApplyFadeWhenPainting(true)
{
}
@@ -85,17 +84,13 @@
m_webPage = webPage;
m_client->didMoveToWebPage(this, webPage);
- if (m_webPage)
- m_pageOverlayShouldApplyFadeWhenPainting = m_webPage->drawingArea()->pageOverlayShouldApplyFadeWhenPainting();
-
m_fadeAnimationTimer.stop();
}
void PageOverlay::setNeedsDisplay(const IntRect& dirtyRect)
{
if (m_webPage) {
- if (!m_pageOverlayShouldApplyFadeWhenPainting)
- m_webPage->drawingArea()->setPageOverlayOpacity(this, m_fractionFadedIn);
+ m_webPage->drawingArea()->setPageOverlayOpacity(this, m_fractionFadedIn);
m_webPage->drawingArea()->setPageOverlayNeedsDisplay(this, dirtyRect);
}
}
@@ -181,12 +176,8 @@
float fadeAnimationValue = sine * sine;
m_fractionFadedIn = (m_fadeAnimationType == FadeInAnimation) ? fadeAnimationValue : 1 - fadeAnimationValue;
+ m_webPage->drawingArea()->setPageOverlayOpacity(this, m_fractionFadedIn);
- if (m_pageOverlayShouldApplyFadeWhenPainting)
- setNeedsDisplay();
- else
- m_webPage->drawingArea()->setPageOverlayOpacity(this, m_fractionFadedIn);
-
if (animationProgress == 1.0) {
m_fadeAnimationTimer.stop();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/PageOverlay.h (153691 => 153692)
--- trunk/Source/WebKit2/WebProcess/WebPage/PageOverlay.h 2013-08-04 00:12:21 UTC (rev 153691)
+++ trunk/Source/WebKit2/WebProcess/WebPage/PageOverlay.h 2013-08-04 00:31:27 UTC (rev 153692)
@@ -76,7 +76,6 @@
void startFadeOutAnimation();
void stopFadeOutAnimation();
- float fractionFadedIn() const { return m_fractionFadedIn; }
Client* client() const { return m_client; }
protected:
@@ -103,7 +102,6 @@
FadeAnimationType m_fadeAnimationType;
float m_fractionFadedIn;
- bool m_pageOverlayShouldApplyFadeWhenPainting;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp (153691 => 153692)
--- trunk/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp 2013-08-04 00:12:21 UTC (rev 153691)
+++ trunk/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp 2013-08-04 00:31:27 UTC (rev 153692)
@@ -104,10 +104,7 @@
{
GraphicsContextStateSaver stateSaver(context);
- if (m_webPage->drawingArea()->pageOverlayShouldApplyFadeWhenPainting())
- context.setFillColor(highlightColor(m_color, pageOverlay->fractionFadedIn() * 0.5f), ColorSpaceSRGB);
- else
- context.setFillColor(highlightColor(m_color, 0.5f), ColorSpaceSRGB);
+ context.setFillColor(highlightColor(m_color, 0.5f), ColorSpaceSRGB);
context.fillPath(m_path);
}
}
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h (153691 => 153692)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h 2013-08-04 00:12:21 UTC (rev 153691)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h 2013-08-04 00:31:27 UTC (rev 153692)
@@ -63,6 +63,7 @@
virtual void didInstallPageOverlay(PageOverlay*) OVERRIDE;
virtual void didUninstallPageOverlay(PageOverlay*) OVERRIDE;
virtual void setPageOverlayNeedsDisplay(PageOverlay*, const WebCore::IntRect&) OVERRIDE;
+ virtual void setPageOverlayOpacity(PageOverlay*, float) OVERRIDE;
virtual void pauseRendering() OVERRIDE;
virtual void resumeRendering() OVERRIDE;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm (153691 => 153692)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm 2013-08-04 00:12:21 UTC (rev 153691)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm 2013-08-04 00:31:27 UTC (rev 153692)
@@ -210,6 +210,17 @@
scheduleLayerFlush();
}
+void LayerTreeHostMac::setPageOverlayOpacity(PageOverlay* pageOverlay, float opacity)
+{
+ GraphicsLayer* layer = m_pageOverlayLayers.get(pageOverlay);
+
+ if (!layer)
+ return;
+
+ layer->setOpacity(opacity);
+ scheduleLayerFlush();
+}
+
void LayerTreeHostMac::pauseRendering()
{
CALayer* root = m_rootLayer->platformLayer();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h (153691 => 153692)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h 2013-08-04 00:12:21 UTC (rev 153691)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h 2013-08-04 00:31:27 UTC (rev 153692)
@@ -72,6 +72,7 @@
virtual void didInstallPageOverlay(PageOverlay*) OVERRIDE;
virtual void didUninstallPageOverlay(PageOverlay*) OVERRIDE;
virtual void setPageOverlayNeedsDisplay(PageOverlay*, const WebCore::IntRect&) OVERRIDE;
+ virtual void setPageOverlayOpacity(PageOverlay*, float) OVERRIDE;
virtual void updatePreferences(const WebPreferencesStore&) OVERRIDE;
virtual void mainFrameContentSizeChanged(const WebCore::IntSize&) OVERRIDE;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (153691 => 153692)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2013-08-04 00:12:21 UTC (rev 153691)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm 2013-08-04 00:31:27 UTC (rev 153692)
@@ -225,6 +225,17 @@
scheduleCompositingLayerFlush();
}
+void TiledCoreAnimationDrawingArea::setPageOverlayOpacity(PageOverlay* pageOverlay, float opacity)
+{
+ GraphicsLayer* layer = m_pageOverlayLayers.get(pageOverlay);
+
+ if (!layer)
+ return;
+
+ layer->setOpacity(opacity);
+ scheduleCompositingLayerFlush();
+}
+
void TiledCoreAnimationDrawingArea::updatePreferences(const WebPreferencesStore&)
{
Settings* settings = m_webPage->corePage()->settings();