WebKit Bugzilla
Attachment 372118 Details for
Bug 181757
: [WPE][GTK] Content disappearing when using CSS transforms
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-181757-20190614112047.patch (text/plain), 26.57 KB, created by
Miguel Gomez
on 2019-06-14 02:20:49 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Miguel Gomez
Created:
2019-06-14 02:20:49 PDT
Size:
26.57 KB
patch
obsolete
>Subversion Revision: 246431 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 329a5165aa44df8dc80e7dae9981c8b06959a9a5..d09bab625f988a653a4ce3d4272b561e674bc245 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,38 @@ >+2019-06-14 Miguel Gomez <magomez@igalia.com> >+ >+ [WPE][GTK] Content disappearing when using CSS transforms >+ https://bugs.webkit.org/show_bug.cgi?id=181757 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ During each layer flush, create an AnimatedBackingStoreClient instance for each layer that >+ has a backingStore and is to be animated, and send that client to the appropriate >+ TextureMapperLayer on the compositor thread. During each frame rendering, the client will >+ use the future layer position (currently 50ms in the future) to check whether new tiles are >+ required to keep the animation ongoing, and notify the appropriate CoordinatedGraphicsLayer so >+ it can perform a layer flush and provide new tiles. >+ >+ * platform/TextureMapper.cmake: >+ * platform/graphics/nicosia/NicosiaAnimatedBackingStoreClient.h: Added. >+ * platform/graphics/nicosia/NicosiaPlatformLayer.h: >+ (Nicosia::CompositionLayer::flushState): >+ * platform/graphics/texmap/TextureMapperAnimation.cpp: >+ (WebCore::TextureMapperAnimation::applyKeepingInternalState): >+ (WebCore::TextureMapperAnimations::applyKeepingInternalState): >+ * platform/graphics/texmap/TextureMapperAnimation.h: >+ * platform/graphics/texmap/TextureMapperLayer.cpp: >+ (WebCore::TextureMapperLayer::computeTransformsRecursive): >+ (WebCore::TextureMapperLayer::setAnimatedBackingStoreClient): >+ (WebCore::TextureMapperLayer::syncAnimations): >+ * platform/graphics/texmap/TextureMapperLayer.h: >+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: >+ (WebCore::CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer): >+ (WebCore::clampToContentsRectIfRectIsInfinite): >+ (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly): >+ (WebCore::CoordinatedGraphicsLayer::requestBackingStoreUpdate): >+ (WebCore::CoordinatedGraphicsLayer::updateContentBuffers): >+ * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: >+ > 2019-06-14 Carlos Garcia Campos <cgarcia@igalia.com> > > [cairo] Entering text into forms on github.com creates a trapezoid artifact >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index be102fd6f527c897fee6b4ee4f6da1a16187e712..1792c8478aa98457f36b1463a733718d99cfcda8 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,15 @@ >+2019-06-14 Miguel Gomez <magomez@igalia.com> >+ >+ [WPE][GTK] Content disappearing when using CSS transforms >+ https://bugs.webkit.org/show_bug.cgi?id=181757 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Set the appropriate AnimatedBackingStoreClient to the TextureMapperLayers when required. >+ >+ * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp: >+ (WebKit::CoordinatedGraphicsScene::updateSceneState): >+ > 2019-06-13 Megan Gardner <megan_gardner@apple.com> > > Fix selection hang in Mail >diff --git a/Source/WebCore/platform/TextureMapper.cmake b/Source/WebCore/platform/TextureMapper.cmake >index 9198e20a14f6db1359c38b8cb91332c6b20209c3..ce9ab96f52b8969c91109ef06855c50839a52323 100644 >--- a/Source/WebCore/platform/TextureMapper.cmake >+++ b/Source/WebCore/platform/TextureMapper.cmake >@@ -97,6 +97,7 @@ if (USE_COORDINATED_GRAPHICS) > page/scrolling/nicosia/ScrollingTreeFixedNode.h > page/scrolling/nicosia/ScrollingTreeStickyNode.h > >+ platform/graphics/nicosia/NicosiaAnimatedBackingStoreClient.h > platform/graphics/nicosia/NicosiaBuffer.h > platform/graphics/nicosia/NicosiaPaintingEngine.h > platform/graphics/nicosia/NicosiaPlatformLayer.h >diff --git a/Source/WebCore/platform/graphics/nicosia/NicosiaAnimatedBackingStoreClient.h b/Source/WebCore/platform/graphics/nicosia/NicosiaAnimatedBackingStoreClient.h >new file mode 100644 >index 0000000000000000000000000000000000000000..21de15ecd54151c06795537be954cfa9e8160bfe >--- /dev/null >+++ b/Source/WebCore/platform/graphics/nicosia/NicosiaAnimatedBackingStoreClient.h >@@ -0,0 +1,49 @@ >+/* >+ * Copyright (C) 2019 Metrological Group B.V. >+ * Copyright (C) 2019 Igalia S.L. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above >+ * copyright notice, this list of conditions and the following >+ * disclaimer in the documentation and/or other materials provided >+ * with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS >+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT >+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR >+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT >+ * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT >+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, >+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY >+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if USE(COORDINATED_GRAPHICS) >+ >+#include <wtf/ThreadSafeRefCounted.h> >+ >+namespace WebCore { >+class TransformationMatrix; >+} >+ >+namespace Nicosia { >+ >+class AnimatedBackingStoreClient : public ThreadSafeRefCounted<AnimatedBackingStoreClient> { >+public: >+ virtual ~AnimatedBackingStoreClient() = default; >+ virtual void requestBackingStoreUpdateIfNeeded(const WebCore::TransformationMatrix&) = 0; >+}; >+ >+} // namespace Nicosia >+ >+#endif // USE(COORDINATED_GRAPHICS) >diff --git a/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h b/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h >index a3bf287eb8d752c9cc7104f47e21e2c06ff35a17..11c6059866733e7dc75f892bbf38fd2cb0e233b0 100644 >--- a/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h >+++ b/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h >@@ -34,6 +34,7 @@ > #include "FloatPoint3D.h" > #include "FloatRect.h" > #include "FloatSize.h" >+#include "NicosiaAnimatedBackingStoreClient.h" > #include "NicosiaSceneIntegration.h" > #include "TextureMapperAnimation.h" > #include "TransformationMatrix.h" >@@ -126,6 +127,7 @@ public: > bool contentLayerChanged : 1; > bool backingStoreChanged : 1; > bool imageBackingChanged : 1; >+ bool animatedBackingStoreClientChanged : 1; > bool repaintCounterChanged : 1; > bool debugBorderChanged : 1; > }; >@@ -178,6 +180,7 @@ public: > RefPtr<ContentLayer> contentLayer; > RefPtr<BackingStore> backingStore; > RefPtr<ImageBacking> imageBacking; >+ RefPtr<AnimatedBackingStoreClient> animatedBackingStoreClient; > > struct RepaintCounter { > unsigned count { 0 }; >@@ -256,6 +259,8 @@ public: > staging.contentLayer = pending.contentLayer; > if (pending.delta.imageBackingChanged) > staging.imageBacking = pending.imageBacking; >+ if (pending.delta.animatedBackingStoreClientChanged) >+ staging.animatedBackingStoreClient = pending.animatedBackingStoreClient; > > pending.delta = { }; > >diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp >index 01a2742439c227f222b8ceb2ca60a31fc94ff9f4..dd0b8dff752d7840aacc02feebcf6f843a8579e8 100644 >--- a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp >+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp >@@ -239,6 +239,19 @@ void TextureMapperAnimation::apply(ApplicationResult& applicationResults, Monoto > } > } > >+void TextureMapperAnimation::applyKeepingInternalState(ApplicationResult& applicationResults, MonotonicTime time) >+{ >+ MonotonicTime oldLastRefreshedTime = m_lastRefreshedTime; >+ Seconds oldTotalRunningTime = m_totalRunningTime; >+ AnimationState oldState = m_state; >+ >+ apply(applicationResults, time); >+ >+ m_lastRefreshedTime = oldLastRefreshedTime; >+ m_totalRunningTime = oldTotalRunningTime; >+ m_state = oldState; >+} >+ > void TextureMapperAnimation::pause(Seconds time) > { > m_state = AnimationState::Paused; >@@ -338,6 +351,12 @@ void TextureMapperAnimations::apply(TextureMapperAnimation::ApplicationResult& a > animation.apply(applicationResults, time); > } > >+void TextureMapperAnimations::applyKeepingInternalState(TextureMapperAnimation::ApplicationResult& applicationResults, MonotonicTime time) >+{ >+ for (auto& animation : m_animations) >+ animation.applyKeepingInternalState(applicationResults, time); >+} >+ > bool TextureMapperAnimations::hasActiveAnimationsOfType(AnimatedPropertyID type) const > { > return std::any_of(m_animations.begin(), m_animations.end(), >diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h b/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h >index 3fa913d2fbb38c9dafc464e9d31b268cfca9716d..2fa86a419811a15af4b983220368e06b280fe3b3 100644 >--- a/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h >+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h >@@ -44,6 +44,7 @@ public: > WEBCORE_EXPORT TextureMapperAnimation(const TextureMapperAnimation&); > > void apply(ApplicationResult&, MonotonicTime); >+ void applyKeepingInternalState(ApplicationResult&, MonotonicTime); > void pause(Seconds); > void resume(); > bool isActive() const; >@@ -81,6 +82,7 @@ public: > void resume(); > > void apply(TextureMapperAnimation::ApplicationResult&, MonotonicTime); >+ void applyKeepingInternalState(TextureMapperAnimation::ApplicationResult&, MonotonicTime); > > bool isEmpty() const { return m_animations.isEmpty(); } > size_t size() const { return m_animations.size(); } >diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp >index 5e9c56b5f30f0228bb87058fbf30b209fc939bd1..3428c674fc2668c4385b4d937439d30acf7191d4 100644 >--- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp >+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp >@@ -78,6 +78,28 @@ void TextureMapperLayer::computeTransformsRecursive() > m_layerTransforms.combinedForChildren = m_layerTransforms.combinedForChildren.to2dTransform(); > m_layerTransforms.combinedForChildren.multiply(m_state.childrenTransform); > m_layerTransforms.combinedForChildren.translate3d(-originX, -originY, -m_state.anchorPoint.z()); >+ >+#if USE(COORDINATED_GRAPHICS) >+ // Compute transforms for the future as well. >+ TransformationMatrix futureParentTransform; >+ if (m_parent) >+ futureParentTransform = m_parent->m_layerTransforms.futureCombinedForChildren; >+ else if (m_effectTarget) >+ futureParentTransform = m_effectTarget->m_layerTransforms.futureCombined; >+ >+ m_layerTransforms.futureCombined = futureParentTransform; >+ m_layerTransforms.futureCombined >+ .translate3d(originX + m_state.pos.x(), originY + m_state.pos.y(), m_state.anchorPoint.z()) >+ .multiply(m_layerTransforms.futureLocalTransform); >+ >+ m_layerTransforms.futureCombinedForChildren = m_layerTransforms.futureCombined; >+ m_layerTransforms.futureCombined.translate3d(-originX, -originY, -m_state.anchorPoint.z()); >+ >+ if (!m_state.preserves3D) >+ m_layerTransforms.futureCombinedForChildren = m_layerTransforms.futureCombinedForChildren.to2dTransform(); >+ m_layerTransforms.futureCombinedForChildren.multiply(m_state.childrenTransform); >+ m_layerTransforms.futureCombinedForChildren.translate3d(-originX, -originY, -m_state.anchorPoint.z()); >+#endif > } > > m_state.visible = m_state.backfaceVisibility || !m_layerTransforms.combined.isBackFaceVisible(); >@@ -97,6 +119,11 @@ void TextureMapperLayer::computeTransformsRecursive() > // Reorder children if needed on the way back up. > if (m_state.preserves3D) > sortByZOrder(m_children); >+ >+#if USE(COORDINATED_GRAPHICS) >+ if (m_backingStore && m_animatedBackingStoreClient) >+ m_animatedBackingStoreClient->requestBackingStoreUpdateIfNeeded(m_layerTransforms.futureCombined); >+#endif > } > > void TextureMapperLayer::paint() >@@ -623,6 +650,13 @@ void TextureMapperLayer::setBackingStore(TextureMapperBackingStore* backingStore > m_backingStore = backingStore; > } > >+#if USE(COORDINATED_GRAPHICS) >+void TextureMapperLayer::setAnimatedBackingStoreClient(Nicosia::AnimatedBackingStoreClient* client) >+{ >+ m_animatedBackingStoreClient = client; >+} >+#endif >+ > bool TextureMapperLayer::descendantsOrSelfHaveRunningAnimations() const > { > if (m_animations.hasRunningAnimations()) >@@ -651,6 +685,13 @@ bool TextureMapperLayer::syncAnimations(MonotonicTime time) > m_currentOpacity = applicationResults.opacity.valueOr(m_state.opacity); > m_currentFilters = applicationResults.filters.valueOr(m_state.filters); > >+#if USE(COORDINATED_GRAPHICS) >+ // Calculate localTransform 50ms in the future. >+ TextureMapperAnimation::ApplicationResult futureApplicationResults; >+ m_animations.applyKeepingInternalState(futureApplicationResults, time + 50_ms); >+ m_layerTransforms.futureLocalTransform = futureApplicationResults.transform.valueOr(m_layerTransforms.localTransform); >+#endif >+ > return applicationResults.hasRunningAnimations; > } > >diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h >index ea259ba1006b256eb1af8f699aee9322b1cc5eb2..50b24aa71e2dcae801623f0eb2de1b9304a14d81 100644 >--- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h >+++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h >@@ -27,6 +27,10 @@ > #include "TextureMapperBackingStore.h" > #include <wtf/WeakPtr.h> > >+#if USE(COORDINATED_GRAPHICS) >+#include "NicosiaAnimatedBackingStoreClient.h" >+#endif >+ > namespace WebCore { > > class GraphicsLayer; >@@ -88,6 +92,9 @@ public: > void setContentsLayer(TextureMapperPlatformLayer*); > void setAnimations(const TextureMapperAnimations&); > void setBackingStore(TextureMapperBackingStore*); >+#if USE(COORDINATED_GRAPHICS) >+ void setAnimatedBackingStoreClient(Nicosia::AnimatedBackingStoreClient*); >+#endif > > bool applyAnimationsRecursively(MonotonicTime); > bool syncAnimations(MonotonicTime); >@@ -197,12 +204,19 @@ private: > TextureMapper* m_textureMapper { nullptr }; > TextureMapperAnimations m_animations; > uint32_t m_id { 0 }; >+#if USE(COORDINATED_GRAPHICS) >+ RefPtr<Nicosia::AnimatedBackingStoreClient> m_animatedBackingStoreClient; >+#endif > > struct { > TransformationMatrix localTransform; >- > TransformationMatrix combined; > TransformationMatrix combinedForChildren; >+#if USE(COORDINATED_GRAPHICS) >+ TransformationMatrix futureLocalTransform; >+ TransformationMatrix futureCombined; >+ TransformationMatrix futureCombinedForChildren; >+#endif > } m_layerTransforms; > }; > >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >index a95382c9d747959cb0de24bbd9b261a1c1fc0e7d..0b051a9be58f9b01434535f691df9bf0800473e8 100644 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp >@@ -149,6 +149,8 @@ CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer() > } > ASSERT(!m_nicosia.imageBacking); > ASSERT(!m_nicosia.backingStore); >+ if (m_animatedBackingStoreHost) >+ m_animatedBackingStoreHost->layerWillBeDestroyed(); > willBeDestroyed(); > } > >@@ -631,6 +633,86 @@ void CoordinatedGraphicsLayer::updatePlatformLayer() > #endif > } > >+static void clampToContentsRectIfRectIsInfinite(FloatRect& rect, const FloatSize& contentsSize) >+{ >+ if (rect.width() >= LayoutUnit::nearlyMax() || rect.width() <= LayoutUnit::nearlyMin()) { >+ rect.setX(0); >+ rect.setWidth(contentsSize.width()); >+ } >+ >+ if (rect.height() >= LayoutUnit::nearlyMax() || rect.height() <= LayoutUnit::nearlyMin()) { >+ rect.setY(0); >+ rect.setHeight(contentsSize.height()); >+ } >+} >+ >+class CoordinatedAnimatedBackingStoreClient final : public Nicosia::AnimatedBackingStoreClient { >+public: >+ static Ref<CoordinatedAnimatedBackingStoreClient> create(RefPtr<CoordinatedGraphicsLayer::AnimatedBackingStoreHost>&& host, const FloatRect& visibleRect, const FloatRect& coverRect, const FloatSize& size, float contentsScale) >+ { >+ return adoptRef(*new CoordinatedAnimatedBackingStoreClient(WTFMove(host), visibleRect, coverRect, size, contentsScale)); >+ } >+ >+ ~CoordinatedAnimatedBackingStoreClient() = default; >+ >+ void setCoverRect(const IntRect& rect) { m_coverRect = rect; } >+ void requestBackingStoreUpdateIfNeeded(const TransformationMatrix& transform) final >+ { >+ ASSERT(!isMainThread()); >+ >+ // Calculate the contents rectangle of the layer in backingStore coordinates. >+ FloatRect contentsRect = { { 0, 0 }, m_size }; >+ contentsRect.scale(m_contentsScale); >+ >+ // If the area covered by tiles (the coverRect, already in backingStore coordinates) covers the whole >+ // layer contents then we don't need to do anything. >+ if (m_coverRect.contains(contentsRect)) >+ return; >+ >+ // Non-invertible layers are not visible. >+ if (!transform.isInvertible()) >+ return; >+ >+ // Calculate the inverse of the layer transformation. The inverse transform will have the inverse of the >+ // scaleFactor applied, so we need to scale it back. >+ TransformationMatrix inverse = transform.inverse().valueOr(TransformationMatrix()).scale(m_contentsScale); >+ >+ // Apply the inverse transform to the visible rectangle, so we have the visible rectangle in layer coordinates. >+ FloatRect rect = inverse.clampedBoundsOfProjectedQuad(FloatQuad(m_visibleRect)); >+ clampToContentsRectIfRectIsInfinite(rect, m_size); >+ FloatRect transformedVisibleRect = enclosingIntRect(rect); >+ >+ // Convert the calculated visible rectangle to backingStore coordinates. >+ transformedVisibleRect.scale(m_contentsScale); >+ >+ // Restrict the calculated visible rect to the contents rectangle of the layer. >+ transformedVisibleRect.intersect(contentsRect); >+ >+ // If the coverRect doesn't contain the calculated visible rectangle we need to request a backingStore >+ // update to render more tiles. >+ if (!m_coverRect.contains(transformedVisibleRect)) { >+ callOnMainThread([protectedHost = m_host.copyRef()]() { >+ protectedHost->requestBackingStoreUpdate(); >+ }); >+ } >+ } >+ >+private: >+ CoordinatedAnimatedBackingStoreClient(RefPtr<CoordinatedGraphicsLayer::AnimatedBackingStoreHost>&& host, const FloatRect& visibleRect, const FloatRect& coverRect, const FloatSize& size, float contentsScale) >+ : m_host(WTFMove(host)) >+ , m_visibleRect(visibleRect) >+ , m_coverRect(coverRect) >+ , m_size(size) >+ , m_contentsScale(contentsScale) >+ { } >+ >+ RefPtr<CoordinatedGraphicsLayer::AnimatedBackingStoreHost> m_host; >+ FloatRect m_visibleRect; >+ FloatRect m_coverRect; >+ FloatSize m_size; >+ float m_contentsScale; >+}; >+ > void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly() > { > // Whether it kicked or not, we don't need this timer running anymore. >@@ -666,6 +748,19 @@ void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly() > m_nicosia.delta.backingStoreChanged = true; > } > >+ if (hasActiveTransformAnimation && m_nicosia.backingStore) { >+ // The layer has a backingStore and a transformation animation. This means that we need to add an >+ // AnimatedBackingStoreClient to check whether we need to update the backingStore due to the animation. >+ // At this point we don't know the area covered by tiles available, so we just pass an empty rectangle >+ // for that. The call to updateContentBuffers will calculate the tile coverage and set the appropriate >+ // rectangle to the client. >+ if (!m_animatedBackingStoreHost) >+ m_animatedBackingStoreHost = AnimatedBackingStoreHost::create(*this); >+ m_nicosia.animatedBackingStoreClient = CoordinatedAnimatedBackingStoreClient::create(m_animatedBackingStoreHost.copyRef(), m_coordinator->visibleContentsRect(), { }, m_size, effectiveContentsScale()); >+ } >+ // Each layer flush changes the AnimatedBackingStoreClient, being it null or a real one. >+ m_nicosia.delta.animatedBackingStoreClientChanged = true; >+ > // Determine image backing presence according to the composited image source. > if (m_compositedNativeImagePtr) { > ASSERT(m_compositedImage); >@@ -787,6 +882,8 @@ void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly() > state.contentLayer = m_nicosia.contentLayer; > if (localDelta.imageBackingChanged) > state.imageBacking = m_nicosia.imageBacking; >+ if (localDelta.animatedBackingStoreClientChanged) >+ state.animatedBackingStoreClient = m_nicosia.animatedBackingStoreClient; > }); > m_nicosia.performLayerSync = !!m_nicosia.delta.value; > m_nicosia.delta = { }; >@@ -817,19 +914,6 @@ float CoordinatedGraphicsLayer::effectiveContentsScale() > return selfOrAncestorHaveNonAffineTransforms() ? 1 : deviceScaleFactor() * pageScaleFactor(); > } > >-static void clampToContentsRectIfRectIsInfinite(FloatRect& rect, const FloatSize& contentsSize) >-{ >- if (rect.width() >= LayoutUnit::nearlyMax() || rect.width() <= LayoutUnit::nearlyMin()) { >- rect.setX(0); >- rect.setWidth(contentsSize.width()); >- } >- >- if (rect.height() >= LayoutUnit::nearlyMax() || rect.height() <= LayoutUnit::nearlyMin()) { >- rect.setY(0); >- rect.setHeight(contentsSize.height()); >- } >-} >- > IntRect CoordinatedGraphicsLayer::transformedVisibleRect() > { > // Non-invertible layers are not visible. >@@ -845,6 +929,12 @@ IntRect CoordinatedGraphicsLayer::transformedVisibleRect() > return enclosingIntRect(rect); > } > >+void CoordinatedGraphicsLayer::requestBackingStoreUpdate() >+{ >+ setNeedsVisibleRectAdjustment(); >+ notifyFlushRequired(); >+} >+ > void CoordinatedGraphicsLayer::updateContentBuffersIncludingSubLayers() > { > if (CoordinatedGraphicsLayer* mask = downcast<CoordinatedGraphicsLayer>(maskLayer())) >@@ -914,6 +1004,11 @@ void CoordinatedGraphicsLayer::updateContentBuffers() > layerState.mainBackingStore->createTilesIfNeeded(transformedVisibleRect(), IntRect(0, 0, m_size.width(), m_size.height())); > } > >+ if (m_nicosia.animatedBackingStoreClient) { >+ // Determine the coverRect and set it to the client. >+ downcast<CoordinatedAnimatedBackingStoreClient>(m_nicosia.animatedBackingStoreClient.get())->setCoverRect(layerState.mainBackingStore->coverRect()); >+ } >+ > ASSERT(m_coordinator && m_coordinator->isFlushingLayerChanges()); > > // With all the affected tiles created and/or invalidated, we can finally paint them. >diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h >index b5177de8cec528866a1c80a8f69b5ca72dd2b2ec..e6c5866737daa31b7fd2a161bebcc1a4a8bb968e 100644 >--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h >+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h >@@ -29,6 +29,7 @@ > #include "GraphicsLayerTransform.h" > #include "Image.h" > #include "IntSize.h" >+#include "NicosiaAnimatedBackingStoreClient.h" > #include "NicosiaBuffer.h" > #include "NicosiaPlatformLayer.h" > #include "TextureMapperAnimation.h" >@@ -124,6 +125,30 @@ public: > > const RefPtr<Nicosia::CompositionLayer>& compositionLayer() const; > >+ class AnimatedBackingStoreHost : public ThreadSafeRefCounted<AnimatedBackingStoreHost> { >+ public: >+ static Ref<AnimatedBackingStoreHost> create(CoordinatedGraphicsLayer& layer) >+ { >+ return adoptRef(*new AnimatedBackingStoreHost(layer)); >+ } >+ >+ void requestBackingStoreUpdate() >+ { >+ if (m_layer) >+ m_layer->requestBackingStoreUpdate(); >+ } >+ >+ void layerWillBeDestroyed() { m_layer = nullptr; } >+ private: >+ explicit AnimatedBackingStoreHost(CoordinatedGraphicsLayer& layer) >+ : m_layer(&layer) >+ { } >+ >+ CoordinatedGraphicsLayer* m_layer; >+ }; >+ >+ void requestBackingStoreUpdate(); >+ > private: > bool isCoordinatedGraphicsLayer() const override; > >@@ -198,7 +223,10 @@ private: > RefPtr<Nicosia::BackingStore> backingStore; > RefPtr<Nicosia::ContentLayer> contentLayer; > RefPtr<Nicosia::ImageBacking> imageBacking; >+ RefPtr<Nicosia::AnimatedBackingStoreClient> animatedBackingStoreClient; > } m_nicosia; >+ >+ RefPtr<AnimatedBackingStoreHost> m_animatedBackingStoreHost; > }; > > } // namespace WebCore >diff --git a/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp b/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp >index eb6af9806244899e86c7c5789987f4b2a59a1bc0..18dc2fb8ed13d153412ea30e2911178eacefc5ae 100644 >--- a/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp >+++ b/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp >@@ -356,6 +356,11 @@ void CoordinatedGraphicsScene::updateSceneState() > { std::ref(layer), std::ref(impl), impl.takeUpdate() }); > } else > layer.setContentsLayer(nullptr); >+ >+ if (layerState.animatedBackingStoreClient) >+ layer.setAnimatedBackingStoreClient(layerState.animatedBackingStoreClient.get()); >+ else >+ layer.setAnimatedBackingStoreClient(nullptr); > }); > } > });
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 181757
:
333278
|
367306
|
367307
|
367319
| 372118