зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1359842 - Do some cleanup of GetWrClipRect. r=nical
This extracts a strongly-typed ClipRect() function from GetWrClipRect. GetWrClipRect is left as a weakly-typed wrapper for existing call sites, and also does the necessary reference point conversions. MozReview-Commit-ID: EuyzYIYLR6S
This commit is contained in:
Родитель
72484c81d2
Коммит
0bb400298d
|
@ -131,18 +131,11 @@ WebRenderLayer::GetWrBoundsRect()
|
|||
gfx::Rect
|
||||
WebRenderLayer::GetWrClipRect(gfx::Rect& aRect)
|
||||
{
|
||||
gfx::Rect clip;
|
||||
Layer* layer = GetLayer();
|
||||
Matrix4x4 transform = layer->GetTransform();
|
||||
if (layer->GetClipRect().isSome()) {
|
||||
clip = RelativeToVisible(transform.Inverse().TransformBounds(
|
||||
IntRectToRect(layer->GetClipRect().ref().ToUnknownRect()))
|
||||
);
|
||||
} else {
|
||||
clip = aRect;
|
||||
Maybe<LayerRect> clip = ClipRect();
|
||||
if (clip) {
|
||||
return RelativeToVisible(clip.ref().ToUnknownRect());
|
||||
}
|
||||
|
||||
return clip;
|
||||
return aRect;
|
||||
}
|
||||
|
||||
LayerRect
|
||||
|
@ -174,6 +167,18 @@ WebRenderLayer::BoundsForStackingContext()
|
|||
return bounds;
|
||||
}
|
||||
|
||||
Maybe<LayerRect>
|
||||
WebRenderLayer::ClipRect()
|
||||
{
|
||||
Layer* layer = GetLayer();
|
||||
if (!layer->GetClipRect()) {
|
||||
return Nothing();
|
||||
}
|
||||
ParentLayerRect clip(layer->GetClipRect().ref());
|
||||
LayerToParentLayerMatrix4x4 transform = layer->GetLocalTransformTyped();
|
||||
return Some(transform.Inverse().TransformBounds(clip));
|
||||
}
|
||||
|
||||
gfx::Rect
|
||||
WebRenderLayer::GetWrRelBounds()
|
||||
{
|
||||
|
|
|
@ -57,6 +57,7 @@ protected:
|
|||
LayerRect Bounds();
|
||||
BoundsTransformMatrix BoundsTransform();
|
||||
LayerRect BoundsForStackingContext();
|
||||
Maybe<LayerRect> ClipRect();
|
||||
|
||||
gfx::Rect GetWrBoundsRect();
|
||||
gfx::Rect GetWrRelBounds();
|
||||
|
|
Загрузка…
Ссылка в новой задаче