mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1055760 - Update some more bits of compositor layer code to deal with multiple FrameMetrics. r=BenWa,botond
This commit is contained in:
parent
30c7225718
commit
dd86fa4d26
@ -713,6 +713,15 @@ Layer::HasScrollableFrameMetrics() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
Layer::IsScrollInfoLayer() const
|
||||
{
|
||||
// A scrollable container layer with no children
|
||||
return AsContainerLayer()
|
||||
&& HasScrollableFrameMetrics()
|
||||
&& !GetFirstChild();
|
||||
}
|
||||
|
||||
const Matrix4x4
|
||||
Layer::GetTransform() const
|
||||
{
|
||||
|
@ -1203,6 +1203,7 @@ public:
|
||||
uint32_t GetFrameMetricsCount() const { return mFrameMetrics.Length(); }
|
||||
const nsTArray<FrameMetrics>& GetAllFrameMetrics() { return mFrameMetrics; }
|
||||
bool HasScrollableFrameMetrics() const;
|
||||
bool IsScrollInfoLayer() const;
|
||||
const EventRegions& GetEventRegions() const { return mEventRegions; }
|
||||
ContainerLayer* GetParent() { return mParent; }
|
||||
Layer* GetNextSibling() { return mNextSibling; }
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "mozilla/layers/TextureHost.h" // for CompositingRenderTarget
|
||||
#include "mozilla/layers/AsyncPanZoomController.h" // for AsyncPanZoomController
|
||||
#include "mozilla/layers/AsyncCompositionManager.h" // for ViewTransform
|
||||
#include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper
|
||||
#include "mozilla/mozalloc.h" // for operator delete, etc
|
||||
#include "nsAutoPtr.h" // for nsRefPtr
|
||||
#include "nsDebug.h" // for NS_ASSERTION
|
||||
@ -254,10 +255,18 @@ RenderLayers(ContainerT* aContainer,
|
||||
// composited area. If the layer has a background color, fill these areas
|
||||
// with the background color by drawing a rectangle of the background color
|
||||
// over the entire composited area before drawing the container contents.
|
||||
if (AsyncPanZoomController* apzc = aContainer->GetAsyncPanZoomController()) {
|
||||
// Make sure not to do this on a "scrollinfo" layer (one with an empty visible
|
||||
// region) because it's just a placeholder for APZ purposes.
|
||||
if (apzc->IsOverscrolled() && !aContainer->GetVisibleRegion().IsEmpty()) {
|
||||
// Make sure not to do this on a "scrollinfo" layer because it's just a
|
||||
// placeholder for APZ purposes.
|
||||
if (aContainer->HasScrollableFrameMetrics() && !aContainer->IsScrollInfoLayer()) {
|
||||
bool overscrolled = false;
|
||||
for (uint32_t i = 0; i < aContainer->GetFrameMetricsCount(); i++) {
|
||||
AsyncPanZoomController* apzc = aContainer->GetAsyncPanZoomController(i);
|
||||
if (apzc && apzc->IsOverscrolled()) {
|
||||
overscrolled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (overscrolled) {
|
||||
gfxRGBA color = aContainer->GetBackgroundColor();
|
||||
// If the background is completely transparent, there's no point in
|
||||
// drawing anything for it. Hopefully the layers behind, if any, will
|
||||
@ -421,8 +430,11 @@ ContainerRender(ContainerT* aContainer,
|
||||
}
|
||||
aContainer->mPrepared = nullptr;
|
||||
|
||||
if (aContainer->GetFrameMetrics().IsScrollable()) {
|
||||
const FrameMetrics& frame = aContainer->GetFrameMetrics();
|
||||
for (uint32_t i = 0; i < aContainer->GetFrameMetricsCount(); i++) {
|
||||
if (!aContainer->GetFrameMetrics(i).IsScrollable()) {
|
||||
continue;
|
||||
}
|
||||
const FrameMetrics& frame = aContainer->GetFrameMetrics(i);
|
||||
LayerRect layerBounds = frame.mCompositionBounds * ParentLayerToLayerScale(1.0);
|
||||
gfx::Rect rect(layerBounds.x, layerBounds.y, layerBounds.width, layerBounds.height);
|
||||
gfx::Rect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height);
|
||||
|
@ -797,7 +797,13 @@ LayerManagerComposite::ComputeRenderIntegrity()
|
||||
return 1.f;
|
||||
}
|
||||
|
||||
const FrameMetrics& rootMetrics = root->GetFrameMetrics();
|
||||
FrameMetrics rootMetrics = LayerMetricsWrapper::TopmostScrollableMetrics(root);
|
||||
if (!rootMetrics.IsScrollable()) {
|
||||
// The root may not have any scrollable metrics, in which case rootMetrics
|
||||
// will just be an empty FrameMetrics. Instead use the actual metrics from
|
||||
// the root layer.
|
||||
rootMetrics = LayerMetricsWrapper(root).Metrics();
|
||||
}
|
||||
ParentLayerIntRect bounds = RoundedToInt(rootMetrics.mCompositionBounds);
|
||||
nsIntRect screenRect(bounds.x,
|
||||
bounds.y,
|
||||
|
@ -172,19 +172,6 @@ ThebesLayerComposite::GenEffectChain(EffectChain& aEffect)
|
||||
aEffect.mPrimaryEffect = mBuffer->GenEffect(GetEffectFilter());
|
||||
}
|
||||
|
||||
CSSToScreenScale
|
||||
ThebesLayerComposite::GetEffectiveResolution()
|
||||
{
|
||||
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
|
||||
const FrameMetrics& metrics = parent->GetFrameMetrics();
|
||||
if (metrics.GetScrollId() != FrameMetrics::NULL_SCROLL_ID) {
|
||||
return metrics.GetZoom();
|
||||
}
|
||||
}
|
||||
|
||||
return CSSToScreenScale(1.0);
|
||||
}
|
||||
|
||||
void
|
||||
ThebesLayerComposite::PrintInfo(std::stringstream& aStream, const char* aPrefix)
|
||||
{
|
||||
|
@ -86,8 +86,6 @@ protected:
|
||||
private:
|
||||
gfx::Filter GetEffectFilter() { return gfx::Filter::LINEAR; }
|
||||
|
||||
CSSToScreenScale GetEffectiveResolution();
|
||||
|
||||
private:
|
||||
RefPtr<ContentHost> mBuffer;
|
||||
};
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
|
||||
#include "mozilla/layers/Compositor.h" // for Compositor
|
||||
#include "mozilla/layers/Effects.h" // for TexturedEffect, Effect, etc
|
||||
#include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper
|
||||
#include "mozilla/layers/TextureHostOGL.h" // for TextureHostOGL
|
||||
#include "nsAString.h"
|
||||
#include "nsDebug.h" // for NS_WARNING
|
||||
@ -367,7 +368,7 @@ TiledContentHost::Composite(EffectChain& aEffectChain,
|
||||
// Background colors are only stored on scrollable layers. Grab
|
||||
// the one from the nearest scrollable ancestor layer.
|
||||
for (Layer* ancestor = GetLayer(); ancestor; ancestor = ancestor->GetParent()) {
|
||||
if (ancestor->GetFrameMetrics().IsScrollable()) {
|
||||
if (ancestor->HasScrollableFrameMetrics()) {
|
||||
backgroundColor = ancestor->GetBackgroundColor();
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user