[iOS] Play button on video is too dark
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Apr 2016 03:59:21 +0000 (03:59 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Apr 2016 03:59:21 +0000 (03:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156383
<rdar://problem/23540816>

Reviewed by Simon Fraser.

.:

Add a manual test for iOS that shows the expected appearance
of a video element. Unfortunately, due to the way we take
snapshots on iOS within our test runner, we don't get the
platform blurring effect, which means an automated test
won't work.

* ManualTests/ios/start-playback-button-appearance-expected.html: Added.
* ManualTests/ios/start-playback-button-appearance.html: Added.

Source/WebKit2:

Elements that are backed by a layer with either LightBackdropAppearance
or DarkBackdropAppearance are actually a combination of a
few layers (inside a special view). If we apply a mask to one
of those layers, it needs to be attached to the correct
child layer.

* Shared/mac/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyProperties): If we have
one of the special appearance flags, apply the mask layer to
a particular child, rather than the layer itself.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199212 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
ManualTests/ios/start-playback-button-appearance-expected.html [new file with mode: 0644]
ManualTests/ios/start-playback-button-appearance.html [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm

index 84f1c09..e3669b0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2016-04-07  Dean Jackson  <dino@apple.com>
+
+        [iOS] Play button on video is too dark
+        https://bugs.webkit.org/show_bug.cgi?id=156383
+        <rdar://problem/23540816>
+
+        Reviewed by Simon Fraser.
+
+        Add a manual test for iOS that shows the expected appearance
+        of a video element. Unfortunately, due to the way we take
+        snapshots on iOS within our test runner, we don't get the
+        platform blurring effect, which means an automated test
+        won't work.
+
+        * ManualTests/ios/start-playback-button-appearance-expected.html: Added.
+        * ManualTests/ios/start-playback-button-appearance.html: Added.
+
 2016-04-06  Alex Christensen  <achristensen@webkit.org>
 
         Fix CMake DumpRenderTree
diff --git a/ManualTests/ios/start-playback-button-appearance-expected.html b/ManualTests/ios/start-playback-button-appearance-expected.html
new file mode 100644 (file)
index 0000000..c94b31f
--- /dev/null
@@ -0,0 +1,67 @@
+<meta name="viewport" content="width=device-width,initial-scale=1">
+<style>
+div {
+    width: 250px;
+    height: 200px;
+    position: relative;
+}
+
+.a {
+    background-color: #895;
+}
+
+.b {
+    background-color: #55f;
+}
+
+.button {
+    position: absolute;
+    width: 72px;
+    height: 72px;
+    left: calc(50% - 36px);
+    top: calc(50% - 36px);
+}
+
+.background {
+    position: absolute;
+    width: 72px;
+    height: 72px;
+    -webkit-clip-path: circle(36px);
+}
+
+.a .background {
+    background-color: rgb(159, 181, 85);
+}
+
+.b .background {
+    background-color: rgb(113, 113, 255);
+}
+
+.glyph {
+    -webkit-appearance: none;
+    position: absolute;
+    width: 72px;
+    height: 72px;
+    opacity: 0.6;
+    background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIwAAACMCAYAAACuwEE+AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABKFJREFUeNrsnV9ojWEcx5+jhdUulF0YNS6IpDRJuNDhyi5cjBvkglGKCxtKIlxILkwi+VPsRnbDphTuLEXzJ8u/0UhstJupKRojx+/X85xIztlztrNznve8n099W9lZ3vd9Pr3P8z7P7zxvIpVKGQBfxnEJAGEAYQBhAGEAYQAQBhAGEAYQBhAGEAYAYQBhAGEAYQBhAGEAEAYQBhAGEAYQBgBhAGEAYQBhAGEAYQAQBhAGEAaCpCyKB51IJPTHRMkVyQpJr+Sa5IzkXZwasOAbQul/GLU4GvTw/8kPSZNkUpyEKWSi3CWtynDH3Cl5Kamny2UM8zezs/xuiuSC5JEkSTMjjDLV4zM1ktuSFkk1zR1fYSbo2DeHz6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mvTdODVjo9oukMECXBAgDCAMIwyUAhAGEAYQBhAGEAUAYQBhAGEAYQBhAGACEAYQBhAGEAYQBhAFAGEAYQBhAGEAYAIQBhAGEAYQBhIEY8FuAAQBHs44NYWX3+AAAAABJRU5ErkJggg==');
+    background-repeat: no-repeat;
+    background-position: 50% 50%;
+    background-size: 100% 100%;
+}
+
+
+</style>
+
+<div class="a">
+    <div class="button">
+        <div class="background"></div>
+        <div class="glyph"></div>
+    </div>
+</div>
+
+<div class="b">
+    <div class="button">
+        <div class="background"></div>
+        <div class="glyph"></div>
+    </div>
+</div>
diff --git a/ManualTests/ios/start-playback-button-appearance.html b/ManualTests/ios/start-playback-button-appearance.html
new file mode 100644 (file)
index 0000000..84323ec
--- /dev/null
@@ -0,0 +1,28 @@
+<meta name="viewport" content="width=device-width,initial-scale=1">
+<style>
+video {
+    width: 250px;
+    height: 200px;
+    background-color: rgb(136, 153, 85);
+    display: block;
+}
+
+video:nth-of-type(2) {
+    background-color: rgb(85, 85, 255);
+}
+</style>
+<script>
+if (window.testRunner) {
+    window.testRunner.waitUntilDone();
+
+    window.addEventListener("load", function () {
+        setTimeout(function () {
+            window.testRunner.notifyDone();
+        }, 3000);
+    }, false);
+}
+
+</script>
+
+<video controls src="content/counting.mp4"></video>
+<video controls src="content/counting.mp4"></video>
index 3b44b83..784ef5d 100644 (file)
@@ -1,3 +1,22 @@
+2016-04-07  Dean Jackson  <dino@apple.com>
+
+        [iOS] Play button on video is too dark
+        https://bugs.webkit.org/show_bug.cgi?id=156383
+        <rdar://problem/23540816>
+
+        Reviewed by Simon Fraser.
+
+        Elements that are backed by a layer with either LightBackdropAppearance
+        or DarkBackdropAppearance are actually a combination of a
+        few layers (inside a special view). If we apply a mask to one
+        of those layers, it needs to be attached to the correct
+        child layer.
+
+        * Shared/mac/RemoteLayerTreePropertyApplier.mm:
+        (WebKit::RemoteLayerTreePropertyApplier::applyProperties): If we have
+        one of the special appearance flags, apply the mask layer to
+        a particular child, rather than the layer itself.
+
 2016-04-07  Jeremy Jones  <jeremyj@apple.com>
 
         Clearing the application cache doesn't work.
index 2d3cb45..44c725c 100644 (file)
@@ -312,14 +312,24 @@ void RemoteLayerTreePropertyApplier::applyProperties(UIView *view, RemoteLayerTr
     }
 
     if (properties.changedProperties & RemoteLayerTreeTransaction::MaskLayerChanged) {
+
+        CALayer *maskOwnerLayer = view.layer;
+
+        if (properties.customAppearance == GraphicsLayer::LightBackdropAppearance || properties.customAppearance == GraphicsLayer::DarkBackdropAppearance) {
+            // This is a UIBackdropView, which means any mask must be applied to the CABackdropLayer rather
+            // that the view's layer. The backdrop is the first layer child.
+            if (view.layer.sublayers.count && [view.layer.sublayers[0] isKindOfClass:[CABackdropLayer class]])
+                maskOwnerLayer = view.layer.sublayers[0];
+        }
+
         if (!properties.maskLayerID)
-            view.layer.mask = nullptr;
+            maskOwnerLayer.mask = nullptr;
         else {
             UIView *maskView = relatedLayers.get(properties.maskLayerID);
             // FIXME: need to check that the mask view is kept alive.
             ASSERT(!maskView.layer.superlayer);
             if (!maskView.layer.superlayer)
-                view.layer.mask = maskView.layer;
+                maskOwnerLayer.mask = maskView.layer;
         }
     }
     END_BLOCK_OBJC_EXCEPTIONS;