Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
When the web page transparency changes, DrawingAreaImpl needs to know…
… about it

https://bugs.webkit.org/show_bug.cgi?id=115062

Reviewed by Tim Horton.

The non-composited contents layer owned by LayerTreeHostMac needs to
be marked as opaque or not depending on whether the WebPage draws
a background (or transparent background). It computed this at creation,
but did not dynamically update the state. Fix it so it does.

This fixes cases of garbage pixels in the Web Inspector toolbar area
in some configurations.

* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::pageBackgroundTransparencyChanged):
* WebProcess/WebPage/DrawingAreaImpl.h:
(DrawingAreaImpl):
* WebProcess/WebPage/LayerTreeHost.h:
* WebProcess/WebPage/mac/LayerTreeHostMac.h:
* WebProcess/WebPage/mac/LayerTreeHostMac.mm:
(WebKit::LayerTreeHostMac::pageBackgroundTransparencyChanged):

Canonical link: https://commits.webkit.org/133503@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@149004 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
smfr committed Apr 23, 2013
1 parent b8c3039 commit 54b0937
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,27 @@
2013-04-23 Simon Fraser <simon.fraser@apple.com>

When the web page transparency changes, DrawingAreaImpl needs to know about it
https://bugs.webkit.org/show_bug.cgi?id=115062

Reviewed by Tim Horton.

The non-composited contents layer owned by LayerTreeHostMac needs to
be marked as opaque or not depending on whether the WebPage draws
a background (or transparent background). It computed this at creation,
but did not dynamically update the state. Fix it so it does.

This fixes cases of garbage pixels in the Web Inspector toolbar area
in some configurations.

* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::pageBackgroundTransparencyChanged):
* WebProcess/WebPage/DrawingAreaImpl.h:
(DrawingAreaImpl):
* WebProcess/WebPage/LayerTreeHost.h:
* WebProcess/WebPage/mac/LayerTreeHostMac.h:
* WebProcess/WebPage/mac/LayerTreeHostMac.mm:
(WebKit::LayerTreeHostMac::pageBackgroundTransparencyChanged):

2013-04-23 Anders Carlsson <andersca@apple.com>

REGRESSION(r148922): Crash opening web archives or loading web pages
Expand Down
6 changes: 6 additions & 0 deletions Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
Expand Up @@ -178,6 +178,12 @@ void DrawingAreaImpl::scroll(const IntRect& scrollRect, const IntSize& scrollDel
m_scrollOffset += scrollDelta;
}

void DrawingAreaImpl::pageBackgroundTransparencyChanged()
{
if (m_layerTreeHost)
m_layerTreeHost->pageBackgroundTransparencyChanged();
}

void DrawingAreaImpl::setLayerTreeStateIsFrozen(bool isFrozen)
{
if (m_layerTreeStateIsFrozen == isFrozen)
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
Expand Up @@ -54,6 +54,7 @@ class DrawingAreaImpl : public DrawingArea {
virtual void setNeedsDisplay() OVERRIDE;
virtual void setNeedsDisplayInRect(const WebCore::IntRect&) OVERRIDE;
virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta);
virtual void pageBackgroundTransparencyChanged() OVERRIDE;
virtual void setLayerTreeStateIsFrozen(bool);
virtual bool layerTreeStateIsFrozen() const { return m_layerTreeStateIsFrozen; }
virtual LayerTreeHost* layerTreeHost() const { return m_layerTreeHost.get(); }
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
Expand Up @@ -72,6 +72,7 @@ class LayerTreeHost : public RefCounted<LayerTreeHost> {
virtual bool forceRepaintAsync(uint64_t /*callbackID*/) { return false; }
virtual void sizeDidChange(const WebCore::IntSize& newSize) = 0;
virtual void deviceOrPageScaleFactorChanged() = 0;
virtual void pageBackgroundTransparencyChanged() = 0;

virtual void didInstallPageOverlay(PageOverlay*) = 0;
virtual void didUninstallPageOverlay(PageOverlay*) = 0;
Expand Down
1 change: 1 addition & 0 deletions Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.h
Expand Up @@ -58,6 +58,7 @@ class LayerTreeHostMac : public LayerTreeHost, private WebCore::GraphicsLayerCli
virtual void forceRepaint() OVERRIDE;
virtual void sizeDidChange(const WebCore::IntSize& newSize) OVERRIDE;
virtual void deviceOrPageScaleFactorChanged() OVERRIDE;
virtual void pageBackgroundTransparencyChanged() OVERRIDE;

virtual void didInstallPageOverlay(PageOverlay*) OVERRIDE;
virtual void didUninstallPageOverlay(PageOverlay*) OVERRIDE;
Expand Down
5 changes: 5 additions & 0 deletions Source/WebKit2/WebProcess/WebPage/mac/LayerTreeHostMac.mm
Expand Up @@ -182,6 +182,11 @@ + (void)synchronize;
m_nonCompositedContentLayer->deviceOrPageScaleFactorChanged();
}

void LayerTreeHostMac::pageBackgroundTransparencyChanged()
{
m_nonCompositedContentLayer->setContentsOpaque(m_webPage->drawsBackground() && !m_webPage->drawsTransparentBackground());
}

void LayerTreeHostMac::didInstallPageOverlay(PageOverlay* pageOverlay)
{
createPageOverlayLayer(pageOverlay);
Expand Down

0 comments on commit 54b0937

Please sign in to comment.