Files
tubestation/gfx/layers/wr/WebRenderTextLayer.cpp
Kartikaya Gupta 9ad40e6fb9 Bug 1372603 - Push the layer's local clip rect outside the stacking context. r=jrmuizel
For various reasons, we want to be pushing the layer's local clip rect
outside of the stacking context rather than inside it. Not only is this
more correct with respect to the semantics of the layer tree, we also
need it in order to properly handle fixed-positioning of layers with
async scrolling.

This patch does the bulk of the work to make this happen. Most of the code
in the individual layer classes to process the layer's local clip rect
is removed, and instead a function in ScrollingLayersHelper is added to
deal with it. There are a couple of places that individual layer classes
still handle this but those will be removed in future patches. Note that
the individual layer classes still need to provide a clip rect of some
sort in order to push their display items, and now they simply use their
visible region bounds for this purpose.

MozReview-Commit-ID: IBmfUdJwYx1
2017-06-14 15:43:16 -04:00

48 lines
1.6 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WebRenderTextLayer.h"
#include "gfxPrefs.h"
#include "LayersLogging.h"
#include "mozilla/webrender/WebRenderTypes.h"
#include "mozilla/layers/ScrollingLayersHelper.h"
#include "mozilla/layers/WebRenderBridgeChild.h"
#include "mozilla/gfx/2D.h"
namespace mozilla {
namespace layers {
using namespace mozilla::gfx;
void
WebRenderTextLayer::RenderLayer(wr::DisplayListBuilder& aBuilder,
const StackingContextHelper& aSc)
{
if (mBounds.IsEmpty()) {
return;
}
ScrollingLayersHelper scroller(this, aBuilder, aSc);
LayerRect rect = LayerRect::FromUnknownRect(
// I am not 100% sure this is correct, but it probably is. Because:
// the bounds are in layer space, and when gecko composites layers it
// applies the transform to the layer before compositing. However with
// WebRender compositing, we don't pass the transform on this layer to
// WR, so WR has no way of knowing about the transformed bounds unless
// we apply it here. The glyphs that we push to WR should already be
// taking the transform into account.
GetTransform().TransformBounds(IntRectToRect(mBounds))
);
DumpLayerInfo("TextLayer", rect);
WrBridge()->PushGlyphs(aBuilder, mGlyphs, mFont, aSc, rect, rect);
}
} // namespace layers
} // namespace mozilla