зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1450134. Replace ToRelativeLayoutRect() with ToRoundedLayoutRect(). r=kats
This function doesn't use any StackingContextHelper state anymore. We should make what it does clearer and move it to a better place. --HG-- extra : rebase_source : 1727be9657169547d842ec9b6887837abedbefdf
This commit is contained in:
Родитель
04e6e86d0f
Коммит
7bd5060424
|
@ -349,7 +349,7 @@ ScrollingLayersHelper::RecurseAndDefineClip(nsDisplayItem* aItem,
|
|||
// Define the clip
|
||||
wr::WrClipId clipId = mBuilder->DefineClip(
|
||||
ancestorIds.first, ancestorIds.second,
|
||||
aSc.ToRelativeLayoutRect(clip), &wrRoundedRects);
|
||||
wr::ToRoundedLayoutRect(clip), &wrRoundedRects);
|
||||
if (!mBuilder->HasExtraClip()) {
|
||||
mCacheStack.back()[aChain] = clipId;
|
||||
}
|
||||
|
@ -456,8 +456,8 @@ ScrollingLayersHelper::RecurseAndDefineAsr(nsDisplayItem* aItem,
|
|||
auto scrollId = mBuilder->DefineScrollLayer(viewId,
|
||||
ancestorIds.first,
|
||||
ancestorIds.second,
|
||||
aSc.ToRelativeLayoutRect(contentRect),
|
||||
aSc.ToRelativeLayoutRect(clipBounds));
|
||||
wr::ToRoundedLayoutRect(contentRect),
|
||||
wr::ToRoundedLayoutRect(clipBounds));
|
||||
|
||||
ids.first = Some(scrollId);
|
||||
return ids;
|
||||
|
|
|
@ -74,14 +74,6 @@ StackingContextHelper::~StackingContextHelper()
|
|||
}
|
||||
}
|
||||
|
||||
wr::LayoutRect
|
||||
StackingContextHelper::ToRelativeLayoutRect(const LayoutDeviceRect& aRect) const
|
||||
{
|
||||
auto rect = aRect;
|
||||
rect.Round();
|
||||
return wr::ToLayoutRect(rect);
|
||||
}
|
||||
|
||||
const Maybe<gfx::Matrix4x4>&
|
||||
StackingContextHelper::GetTransformForScrollData() const
|
||||
{
|
||||
|
|
|
@ -49,18 +49,6 @@ public:
|
|||
// Pops the stacking context, if one was pushed during the constructor.
|
||||
~StackingContextHelper();
|
||||
|
||||
// When this StackingContextHelper is in scope, this function can be used
|
||||
// to convert a rect from the layer system's coordinate space to a LayoutRect
|
||||
// that is relative to the stacking context. This is useful because most
|
||||
// things that are pushed inside the stacking context need to be relative
|
||||
// to the stacking context.
|
||||
// We allow passing in a LayoutDeviceRect for convenience because in a lot of
|
||||
// cases with WebRender display item generate the layout device space is the
|
||||
// same as the layer space. (TODO: try to make this more explicit somehow).
|
||||
// We also round the rectangle to ints after transforming since the output
|
||||
// is the final destination rect.
|
||||
wr::LayoutRect ToRelativeLayoutRect(const LayoutDeviceRect& aRect) const;
|
||||
|
||||
// Export the inherited scale
|
||||
gfx::Size GetInheritedScale() const { return mScale; }
|
||||
|
||||
|
|
|
@ -1411,7 +1411,7 @@ WebRenderCommandBuilder::PushImage(nsDisplayItem* aItem,
|
|||
return false;
|
||||
}
|
||||
|
||||
auto r = aSc.ToRelativeLayoutRect(aRect);
|
||||
auto r = wr::ToRoundedLayoutRect(aRect);
|
||||
gfx::SamplingFilter sampleFilter = nsLayoutUtils::GetSamplingFilterForFrame(aItem->Frame());
|
||||
aBuilder.PushImage(r, r, !aItem->BackfaceIsHidden(), wr::ToImageRendering(sampleFilter), key.value());
|
||||
|
||||
|
@ -1764,7 +1764,7 @@ WebRenderCommandBuilder::BuildWrMaskImage(nsDisplayItem* aItem,
|
|||
|
||||
wr::WrImageMask imageMask;
|
||||
imageMask.image = fallbackData->GetKey().value();
|
||||
imageMask.rect = aSc.ToRelativeLayoutRect(aBounds);
|
||||
imageMask.rect = wr::ToRoundedLayoutRect(aBounds);
|
||||
imageMask.repeat = false;
|
||||
return Some(imageMask);
|
||||
}
|
||||
|
@ -1784,7 +1784,7 @@ WebRenderCommandBuilder::PushItemAsImage(nsDisplayItem* aItem,
|
|||
return false;
|
||||
}
|
||||
|
||||
wr::LayoutRect dest = aSc.ToRelativeLayoutRect(imageRect);
|
||||
wr::LayoutRect dest = wr::ToRoundedLayoutRect(imageRect);
|
||||
gfx::SamplingFilter sampleFilter = nsLayoutUtils::GetSamplingFilterForFrame(aItem->Frame());
|
||||
aBuilder.PushImage(dest,
|
||||
dest,
|
||||
|
|
|
@ -231,7 +231,7 @@ WebRenderImageData::CreateAsyncImageWebRenderCommands(mozilla::wr::DisplayListBu
|
|||
// context need to be done manually and pushed over to the parent side,
|
||||
// where it will be done when we build the display list for the iframe.
|
||||
// That happens in AsyncImagePipelineManager.
|
||||
wr::LayoutRect r = aSc.ToRelativeLayoutRect(aBounds);
|
||||
wr::LayoutRect r = wr::ToRoundedLayoutRect(aBounds);
|
||||
aBuilder.PushIFrame(r, aIsBackfaceVisible, mPipelineId.ref());
|
||||
|
||||
WrBridge()->AddWebRenderParentCommand(OpUpdateAsyncImagePipeline(mPipelineId.value(),
|
||||
|
|
|
@ -349,6 +349,12 @@ static inline wr::LayoutRect ToLayoutRect(const mozilla::LayoutDeviceIntRect& re
|
|||
return ToLayoutRect(IntRectToRect(rect));
|
||||
}
|
||||
|
||||
static inline wr::LayoutRect ToRoundedLayoutRect(const mozilla::LayoutDeviceRect& aRect) {
|
||||
auto rect = aRect;
|
||||
rect.Round();
|
||||
return wr::ToLayoutRect(rect);
|
||||
}
|
||||
|
||||
static inline wr::LayoutSize ToLayoutSize(const mozilla::LayoutDeviceSize& size)
|
||||
{
|
||||
wr::LayoutSize ls;
|
||||
|
|
|
@ -152,11 +152,11 @@ nsDisplayButtonBoxShadowOuter::CreateWebRenderCommands(
|
|||
nsRect shadowRect = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
LayoutDeviceRect deviceBox =
|
||||
LayoutDeviceRect::FromAppUnits(shadowRect, appUnitsPerDevPixel);
|
||||
wr::LayoutRect deviceBoxRect = aSc.ToRelativeLayoutRect(deviceBox);
|
||||
wr::LayoutRect deviceBoxRect = wr::ToRoundedLayoutRect(deviceBox);
|
||||
|
||||
LayoutDeviceRect clipRect =
|
||||
LayoutDeviceRect::FromAppUnits(mVisibleRect, appUnitsPerDevPixel);
|
||||
wr::LayoutRect deviceClipRect = aSc.ToRelativeLayoutRect(clipRect);
|
||||
wr::LayoutRect deviceClipRect = wr::ToRoundedLayoutRect(clipRect);
|
||||
|
||||
bool hasBorderRadius;
|
||||
Unused << nsCSSRendering::HasBoxShadowNativeTheme(mFrame, hasBorderRadius);
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
LayoutDeviceRect layoutBoundsRect = LayoutDeviceRect::FromAppUnits(
|
||||
aBounds, appUnitsPerDevPixel);
|
||||
LayoutDeviceRect layoutClipRect = layoutBoundsRect;
|
||||
mBoundsRect = aSc.ToRelativeLayoutRect(layoutBoundsRect);
|
||||
mBoundsRect = wr::ToRoundedLayoutRect(layoutBoundsRect);
|
||||
|
||||
// Add 1 pixel of dirty area around clip rect to allow us to paint
|
||||
// antialiased pixels beyond the measured text extents.
|
||||
|
@ -246,7 +246,7 @@ public:
|
|||
}
|
||||
|
||||
wr::Line decoration;
|
||||
decoration.bounds = mSc.ToRelativeLayoutRect(LayoutDeviceRect(pos, size));
|
||||
decoration.bounds = wr::ToRoundedLayoutRect(LayoutDeviceRect(pos, size));
|
||||
decoration.wavyLineThickness = 0; // dummy value, unused
|
||||
decoration.color = wr::ToColorF(aColor);
|
||||
decoration.orientation = aVertical
|
||||
|
@ -285,7 +285,7 @@ public:
|
|||
{
|
||||
wr::Line decoration;
|
||||
|
||||
decoration.bounds = mSc.ToRelativeLayoutRect(
|
||||
decoration.bounds = wr::ToRoundedLayoutRect(
|
||||
LayoutDeviceRect::FromUnknownRect(aBounds));
|
||||
decoration.wavyLineThickness = aThickness;
|
||||
decoration.color = wr::ToColorF(aColor);
|
||||
|
@ -300,7 +300,7 @@ public:
|
|||
private:
|
||||
wr::LayerRect ClipRect()
|
||||
{
|
||||
return mSc.ToRelativeLayoutRect(mClipStack.LastElement());
|
||||
return wr::ToRoundedLayoutRect(mClipStack.LastElement());
|
||||
}
|
||||
// Whether anything unsupported was encountered. Currently:
|
||||
//
|
||||
|
@ -405,7 +405,7 @@ public:
|
|||
const DrawOptions &aOptions = DrawOptions()) override {
|
||||
MOZ_RELEASE_ASSERT(aPattern.GetType() == PatternType::COLOR);
|
||||
|
||||
auto rect = mSc.ToRelativeLayoutRect(LayoutDeviceRect::FromUnknownRect(aRect));
|
||||
auto rect = wr::ToRoundedLayoutRect(LayoutDeviceRect::FromUnknownRect(aRect));
|
||||
auto color = wr::ToColorF(static_cast<const ColorPattern&>(aPattern).mColor);
|
||||
mBuilder.PushRect(rect, ClipRect(), mBackfaceVisible, color);
|
||||
}
|
||||
|
@ -425,25 +425,25 @@ public:
|
|||
// Top horizontal line
|
||||
LayoutDevicePoint top(aRect.x, aRect.y - aStrokeOptions.mLineWidth / 2);
|
||||
LayoutDeviceSize horiSize(aRect.width, aStrokeOptions.mLineWidth);
|
||||
line.bounds = mSc.ToRelativeLayoutRect(LayoutDeviceRect(top, horiSize));
|
||||
line.bounds = wr::ToRoundedLayoutRect(LayoutDeviceRect(top, horiSize));
|
||||
line.orientation = wr::LineOrientation::Horizontal;
|
||||
mBuilder.PushLine(ClipRect(), mBackfaceVisible, line);
|
||||
|
||||
// Bottom horizontal line
|
||||
LayoutDevicePoint bottom(aRect.x, aRect.YMost() - aStrokeOptions.mLineWidth / 2);
|
||||
line.bounds = mSc.ToRelativeLayoutRect(LayoutDeviceRect(bottom, horiSize));
|
||||
line.bounds = wr::ToRoundedLayoutRect(LayoutDeviceRect(bottom, horiSize));
|
||||
mBuilder.PushLine(ClipRect(), mBackfaceVisible, line);
|
||||
|
||||
// Left vertical line
|
||||
LayoutDevicePoint left(aRect.x + aStrokeOptions.mLineWidth / 2, aRect.y + aStrokeOptions.mLineWidth / 2);
|
||||
LayoutDeviceSize vertSize(aStrokeOptions.mLineWidth, aRect.height - aStrokeOptions.mLineWidth);
|
||||
line.bounds = mSc.ToRelativeLayoutRect(LayoutDeviceRect(left, vertSize));
|
||||
line.bounds = wr::ToRoundedLayoutRect(LayoutDeviceRect(left, vertSize));
|
||||
line.orientation = wr::LineOrientation::Vertical;
|
||||
mBuilder.PushLine(ClipRect(), mBackfaceVisible, line);
|
||||
|
||||
// Right vertical line
|
||||
LayoutDevicePoint right(aRect.XMost() - aStrokeOptions.mLineWidth / 2, aRect.y + aStrokeOptions.mLineWidth / 2);
|
||||
line.bounds = mSc.ToRelativeLayoutRect(LayoutDeviceRect(right, vertSize));
|
||||
line.bounds = wr::ToRoundedLayoutRect(LayoutDeviceRect(right, vertSize));
|
||||
mBuilder.PushLine(ClipRect(), mBackfaceVisible, line);
|
||||
}
|
||||
|
||||
|
|
|
@ -525,7 +525,7 @@ BulletRenderer::CreateWebRenderCommandsForImage(nsDisplayItem* aItem,
|
|||
return true; // Nothing to do
|
||||
}
|
||||
|
||||
wr::LayoutRect dest = aSc.ToRelativeLayoutRect(destRect);
|
||||
wr::LayoutRect dest = wr::ToRoundedLayoutRect(destRect);
|
||||
|
||||
aBuilder.PushImage(dest,
|
||||
dest,
|
||||
|
@ -545,7 +545,7 @@ BulletRenderer::CreateWebRenderCommandsForPath(nsDisplayItem* aItem,
|
|||
nsDisplayListBuilder* aDisplayListBuilder)
|
||||
{
|
||||
MOZ_ASSERT(IsPathType());
|
||||
wr::LayoutRect dest = aSc.ToRelativeLayoutRect(mPathRect);
|
||||
wr::LayoutRect dest = wr::ToRoundedLayoutRect(mPathRect);
|
||||
auto color = wr::ToColorF(ToDeviceColor(mColor));
|
||||
bool isBackfaceVisible = !aItem->BackfaceIsHidden();
|
||||
switch (mListStyleType) {
|
||||
|
|
|
@ -327,9 +327,9 @@ nsDisplayCanvasBackgroundColor::CreateWebRenderCommands(mozilla::wr::DisplayList
|
|||
LayoutDeviceRect rect = LayoutDeviceRect::FromAppUnits(
|
||||
bgClipRect, appUnitsPerDevPixel);
|
||||
|
||||
wr::LayoutRect transformedRect = aSc.ToRelativeLayoutRect(rect);
|
||||
aBuilder.PushRect(transformedRect,
|
||||
transformedRect,
|
||||
wr::LayoutRect roundedRect = wr::ToRoundedLayoutRect(rect);
|
||||
aBuilder.PushRect(roundedRect,
|
||||
roundedRect,
|
||||
!BackfaceIsHidden(),
|
||||
wr::ToColorF(ToDeviceColor(mColor)));
|
||||
return true;
|
||||
|
|
|
@ -2246,7 +2246,7 @@ nsDisplaySelectionOverlay::CreateWebRenderCommands(mozilla::wr::DisplayListBuild
|
|||
mozilla::layers::WebRenderLayerManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder)
|
||||
{
|
||||
wr::LayoutRect bounds = aSc.ToRelativeLayoutRect(
|
||||
wr::LayoutRect bounds = wr::ToRoundedLayoutRect(
|
||||
LayoutDeviceRect::FromAppUnits(nsRect(ToReferenceFrame(), Frame()->GetSize()),
|
||||
mFrame->PresContext()->AppUnitsPerDevPixel()));
|
||||
aBuilder.PushRect(bounds, bounds, !BackfaceIsHidden(),
|
||||
|
|
|
@ -173,7 +173,7 @@ public:
|
|||
// where it will be done when we build the display list for the iframe.
|
||||
// That happens in WebRenderCompositableHolder.
|
||||
|
||||
wr::LayoutRect r = aSc.ToRelativeLayoutRect(bounds);
|
||||
wr::LayoutRect r = wr::ToRoundedLayoutRect(bounds);
|
||||
aBuilder.PushIFrame(r, !BackfaceIsHidden(), data->GetPipelineId().ref());
|
||||
|
||||
gfx::Matrix4x4 scTransform;
|
||||
|
|
|
@ -391,7 +391,7 @@ nsDisplayRemote::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuild
|
|||
mFrame->GetContentRectRelativeToSelf(), mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
rect += mOffset;
|
||||
|
||||
aBuilder.PushIFrame(aSc.ToRelativeLayoutRect(rect),
|
||||
aBuilder.PushIFrame(mozilla::wr::ToRoundedLayoutRect(rect),
|
||||
!BackfaceIsHidden(),
|
||||
mozilla::wr::AsPipelineId(GetRemoteLayersId()));
|
||||
|
||||
|
|
|
@ -459,7 +459,7 @@ DisplayItemClip::ToComplexClipRegions(int32_t aAppUnitsPerDevPixel,
|
|||
{
|
||||
for (uint32_t i = 0; i < mRoundedClipRects.Length(); i++) {
|
||||
wr::ComplexClipRegion* region = aOutArray.AppendElement();
|
||||
region->rect = aSc.ToRelativeLayoutRect(LayoutDeviceRect::FromAppUnits(
|
||||
region->rect = wr::ToRoundedLayoutRect(LayoutDeviceRect::FromAppUnits(
|
||||
mRoundedClipRects[i].mRect, aAppUnitsPerDevPixel));
|
||||
const nscoord* radii = mRoundedClipRects[i].mRadii;
|
||||
region->radii = wr::ToBorderRadius(
|
||||
|
|
|
@ -3426,7 +3426,7 @@ nsCSSBorderRenderer::CreateWebRenderCommands(nsDisplayItem* aItem,
|
|||
const layers::StackingContextHelper& aSc)
|
||||
{
|
||||
LayoutDeviceRect outerRect = LayoutDeviceRect::FromUnknownRect(mOuterRect);
|
||||
wr::LayoutRect transformedRect = aSc.ToRelativeLayoutRect(outerRect);
|
||||
wr::LayoutRect roundedRect = wr::ToRoundedLayoutRect(outerRect);
|
||||
wr::BorderSide side[4];
|
||||
NS_FOR_CSS_SIDES(i) {
|
||||
side[i] = wr::ToBorderSide(ToDeviceColor(mBorderColors[i]), mBorderStyles[i]);
|
||||
|
@ -3439,14 +3439,14 @@ nsCSSBorderRenderer::CreateWebRenderCommands(nsDisplayItem* aItem,
|
|||
|
||||
if (mLocalClip) {
|
||||
LayoutDeviceRect clip = LayoutDeviceRect::FromUnknownRect(mLocalClip.value());
|
||||
wr::LayoutRect clipRect = aSc.ToRelativeLayoutRect(clip);
|
||||
wr::LayoutRect clipRect = wr::ToRoundedLayoutRect(clip);
|
||||
wr::WrClipId clipId = aBuilder.DefineClip(Nothing(), Nothing(), clipRect);
|
||||
aBuilder.PushClip(clipId, aItem->GetClipChain());
|
||||
}
|
||||
|
||||
Range<const wr::BorderSide> wrsides(side, 4);
|
||||
aBuilder.PushBorder(transformedRect,
|
||||
transformedRect,
|
||||
aBuilder.PushBorder(roundedRect,
|
||||
roundedRect,
|
||||
mBackfaceIsVisible,
|
||||
wr::ToBorderWidths(mBorderWidths[0], mBorderWidths[1], mBorderWidths[2], mBorderWidths[3]),
|
||||
wrsides,
|
||||
|
@ -3698,13 +3698,13 @@ nsCSSBorderImageRenderer::CreateWebRenderCommands(nsDisplayItem* aItem,
|
|||
|
||||
LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits(
|
||||
mArea, appUnitsPerDevPixel);
|
||||
wr::LayoutRect dest = aSc.ToRelativeLayoutRect(destRect);
|
||||
wr::LayoutRect dest = wr::ToRoundedLayoutRect(destRect);
|
||||
|
||||
wr::LayoutRect clip = dest;
|
||||
if (!mClip.IsEmpty()) {
|
||||
LayoutDeviceRect clipRect = LayoutDeviceRect::FromAppUnits(
|
||||
mClip, appUnitsPerDevPixel);
|
||||
clip = aSc.ToRelativeLayoutRect(clipRect);
|
||||
clip = wr::ToRoundedLayoutRect(clipRect);
|
||||
}
|
||||
|
||||
switch (mImageRenderer.GetType()) {
|
||||
|
|
|
@ -3360,10 +3360,10 @@ nsDisplaySolidColor::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aB
|
|||
{
|
||||
LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(
|
||||
mVisibleRect, mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
wr::LayoutRect transformedRect = aSc.ToRelativeLayoutRect(bounds);
|
||||
wr::LayoutRect roundedRect = wr::ToRoundedLayoutRect(bounds);
|
||||
|
||||
aBuilder.PushRect(transformedRect,
|
||||
transformedRect,
|
||||
aBuilder.PushRect(roundedRect,
|
||||
roundedRect,
|
||||
!BackfaceIsHidden(),
|
||||
wr::ToColorF(ToDeviceColor(mColor)));
|
||||
|
||||
|
@ -3413,9 +3413,9 @@ nsDisplaySolidColorRegion::CreateWebRenderCommands(mozilla::wr::DisplayListBuild
|
|||
nsRect rect = iter.Get();
|
||||
LayoutDeviceRect layerRects = LayoutDeviceRect::FromAppUnits(
|
||||
rect, mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
wr::LayoutRect transformedRect = aSc.ToRelativeLayoutRect(layerRects);
|
||||
aBuilder.PushRect(transformedRect,
|
||||
transformedRect,
|
||||
wr::LayoutRect roundedRect = wr::ToRoundedLayoutRect(layerRects);
|
||||
aBuilder.PushRect(roundedRect,
|
||||
roundedRect,
|
||||
!BackfaceIsHidden(),
|
||||
wr::ToColorF(ToDeviceColor(mColor)));
|
||||
}
|
||||
|
@ -4740,10 +4740,10 @@ nsDisplayBackgroundColor::CreateWebRenderCommands(mozilla::wr::DisplayListBuilde
|
|||
|
||||
LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(
|
||||
mBackgroundRect, mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
wr::LayoutRect transformedRect = aSc.ToRelativeLayoutRect(bounds);
|
||||
wr::LayoutRect roundedRect = wr::ToRoundedLayoutRect(bounds);
|
||||
|
||||
aBuilder.PushRect(transformedRect,
|
||||
transformedRect,
|
||||
aBuilder.PushRect(roundedRect,
|
||||
roundedRect,
|
||||
!BackfaceIsHidden(),
|
||||
wr::ToColorF(ToDeviceColor(mColor)));
|
||||
|
||||
|
@ -4887,7 +4887,7 @@ nsDisplayClearBackground::CreateWebRenderCommands(mozilla::wr::DisplayListBuilde
|
|||
nsRect(ToReferenceFrame(), mFrame->GetSize()),
|
||||
mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
|
||||
aBuilder.PushClearRect(aSc.ToRelativeLayoutRect(bounds));
|
||||
aBuilder.PushClearRect(wr::ToRoundedLayoutRect(bounds));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -5054,7 +5054,7 @@ nsDisplayCompositorHitTestInfo::CreateWebRenderCommands(mozilla::wr::DisplayList
|
|||
const LayoutDeviceRect devRect =
|
||||
LayoutDeviceRect::FromAppUnits(mArea, mAppUnitsPerDevPixel);
|
||||
|
||||
const wr::LayoutRect rect = aSc.ToRelativeLayoutRect(devRect);
|
||||
const wr::LayoutRect rect = wr::ToRoundedLayoutRect(devRect);
|
||||
|
||||
aBuilder.PushRect(rect, rect, true, wr::ToColorF(gfx::Color()));
|
||||
aBuilder.ClearHitTestInfo();
|
||||
|
@ -5344,8 +5344,8 @@ nsDisplayCaret::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilde
|
|||
LayoutDeviceRect devHookRect = LayoutDeviceRect::FromAppUnits(
|
||||
hookRect + ToReferenceFrame(), appUnitsPerDevPixel);
|
||||
|
||||
wr::LayoutRect caret = aSc.ToRelativeLayoutRect(devCaretRect);
|
||||
wr::LayoutRect hook = aSc.ToRelativeLayoutRect(devHookRect);
|
||||
wr::LayoutRect caret = wr::ToRoundedLayoutRect(devCaretRect);
|
||||
wr::LayoutRect hook = wr::ToRoundedLayoutRect(devHookRect);
|
||||
|
||||
// Note, WR will pixel snap anything that is layout aligned.
|
||||
aBuilder.PushRect(caret,
|
||||
|
@ -5552,13 +5552,13 @@ nsDisplayBorder::CreateBorderImageWebRenderCommands(mozilla::wr::DisplayListBuil
|
|||
|
||||
LayoutDeviceRect destRect = LayoutDeviceRect::FromAppUnits(
|
||||
mBorderImageRenderer->mArea, appUnitsPerDevPixel);
|
||||
wr::LayoutRect dest = aSc.ToRelativeLayoutRect(destRect);
|
||||
wr::LayoutRect dest = wr::ToRoundedLayoutRect(destRect);
|
||||
|
||||
wr::LayoutRect clip = dest;
|
||||
if (!mBorderImageRenderer->mClip.IsEmpty()) {
|
||||
LayoutDeviceRect clipRect = LayoutDeviceRect::FromAppUnits(
|
||||
mBorderImageRenderer->mClip, appUnitsPerDevPixel);
|
||||
clip = aSc.ToRelativeLayoutRect(clipRect);
|
||||
clip = wr::ToRoundedLayoutRect(clipRect);
|
||||
}
|
||||
|
||||
switch (mBorderImageRenderer->mImageRenderer.GetType()) {
|
||||
|
@ -5855,8 +5855,8 @@ nsDisplayBoxShadowOuter::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder
|
|||
|
||||
LayoutDeviceRect deviceBox = LayoutDeviceRect::FromAppUnits(
|
||||
shadowRect, appUnitsPerDevPixel);
|
||||
wr::LayoutRect deviceBoxRect = aSc.ToRelativeLayoutRect(deviceBox);
|
||||
wr::LayoutRect deviceClipRect = aSc.ToRelativeLayoutRect(clipRect);
|
||||
wr::LayoutRect deviceBoxRect = wr::ToRoundedLayoutRect(deviceBox);
|
||||
wr::LayoutRect deviceClipRect = wr::ToRoundedLayoutRect(clipRect);
|
||||
|
||||
LayoutDeviceSize zeroSize;
|
||||
wr::BorderRadius borderRadius = wr::ToBorderRadius(zeroSize, zeroSize,
|
||||
|
@ -5998,7 +5998,7 @@ nsDisplayBoxShadowInner::CreateInsetBoxShadowWebRenderCommands(mozilla::wr::Disp
|
|||
// Now translate everything to device pixels.
|
||||
LayoutDeviceRect deviceBoxRect = LayoutDeviceRect::FromAppUnits(
|
||||
shadowRect, appUnitsPerDevPixel);
|
||||
wr::LayoutRect deviceClipRect = aSc.ToRelativeLayoutRect(clipRect);
|
||||
wr::LayoutRect deviceClipRect = wr::ToRoundedLayoutRect(clipRect);
|
||||
Color shadowColor = nsCSSRendering::GetShadowColor(shadowItem, aFrame, 1.0);
|
||||
|
||||
LayoutDevicePoint shadowOffset = LayoutDevicePoint::FromAppUnits(
|
||||
|
@ -7607,7 +7607,7 @@ nsDisplayStickyPosition::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder
|
|||
NSAppUnitsToFloatPixels(appliedOffset.x, auPerDevPixel),
|
||||
NSAppUnitsToFloatPixels(appliedOffset.y, auPerDevPixel)
|
||||
};
|
||||
wr::WrStickyId id = aBuilder.DefineStickyFrame(aSc.ToRelativeLayoutRect(bounds),
|
||||
wr::WrStickyId id = aBuilder.DefineStickyFrame(wr::ToRoundedLayoutRect(bounds),
|
||||
topMargin.ptrOr(nullptr), rightMargin.ptrOr(nullptr),
|
||||
bottomMargin.ptrOr(nullptr), leftMargin.ptrOr(nullptr),
|
||||
vBounds, hBounds, applied);
|
||||
|
@ -9648,7 +9648,7 @@ nsDisplayMask::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuilder
|
|||
bounds);
|
||||
if (mask) {
|
||||
wr::WrClipId clipId = aBuilder.DefineClip(Nothing(), Nothing(),
|
||||
aSc.ToRelativeLayoutRect(bounds), nullptr, mask.ptr());
|
||||
wr::ToRoundedLayoutRect(bounds), nullptr, mask.ptr());
|
||||
// Don't record this clip push in aBuilder's internal clip stack, because
|
||||
// otherwise any nested ScrollingLayersHelper instances that are created
|
||||
// will get confused about which clips are pushed.
|
||||
|
|
|
@ -632,8 +632,8 @@ nsImageRenderer::BuildWebRenderDisplayItems(nsPresContext* aPresContext,
|
|||
nsRect(firstTilePos.x, firstTilePos.y,
|
||||
aFill.XMost() - firstTilePos.x, aFill.YMost() - firstTilePos.y),
|
||||
appUnitsPerDevPixel);
|
||||
wr::LayoutRect fill = aSc.ToRelativeLayoutRect(fillRect);
|
||||
wr::LayoutRect clip = aSc.ToRelativeLayoutRect(
|
||||
wr::LayoutRect fill = wr::ToRoundedLayoutRect(fillRect);
|
||||
wr::LayoutRect clip = wr::ToRoundedLayoutRect(
|
||||
LayoutDeviceRect::FromAppUnits(aFill, appUnitsPerDevPixel));
|
||||
|
||||
LayoutDeviceSize gapSize = LayoutDeviceSize::FromAppUnits(
|
||||
|
|
|
@ -7507,7 +7507,7 @@ BCBlockDirSeg::CreateWebRenderCommands(BCPaintBorderIterator& aIter,
|
|||
LayoutDeviceRect borderRect = LayoutDeviceRect::FromUnknownRect(NSRectToRect(param->mBorderRect + aOffset,
|
||||
param->mAppUnitsPerDevPixel));
|
||||
|
||||
wr::LayoutRect transformedRect = aSc.ToRelativeLayoutRect(borderRect);
|
||||
wr::LayoutRect roundedRect = wr::ToRoundedLayoutRect(borderRect);
|
||||
wr::BorderSide wrSide[4];
|
||||
NS_FOR_CSS_SIDES(i) {
|
||||
wrSide[i] = wr::ToBorderSide(ToDeviceColor(param->mBorderColor), NS_STYLE_BORDER_STYLE_NONE);
|
||||
|
@ -7518,13 +7518,13 @@ BCBlockDirSeg::CreateWebRenderCommands(BCPaintBorderIterator& aIter,
|
|||
|
||||
// All border style is set to none except left side. So setting the widths of
|
||||
// each side to width of rect is fine.
|
||||
wr::BorderWidths borderWidths = wr::ToBorderWidths(transformedRect.size.width,
|
||||
transformedRect.size.width,
|
||||
transformedRect.size.width,
|
||||
transformedRect.size.width);
|
||||
wr::BorderWidths borderWidths = wr::ToBorderWidths(roundedRect.size.width,
|
||||
roundedRect.size.width,
|
||||
roundedRect.size.width,
|
||||
roundedRect.size.width);
|
||||
Range<const wr::BorderSide> wrsides(wrSide, 4);
|
||||
aBuilder.PushBorder(transformedRect,
|
||||
transformedRect,
|
||||
aBuilder.PushBorder(roundedRect,
|
||||
roundedRect,
|
||||
param->mBackfaceIsVisible,
|
||||
borderWidths,
|
||||
wrsides,
|
||||
|
@ -7789,7 +7789,7 @@ BCInlineDirSeg::CreateWebRenderCommands(BCPaintBorderIterator& aIter,
|
|||
|
||||
LayoutDeviceRect borderRect = LayoutDeviceRect::FromUnknownRect(NSRectToRect(param->mBorderRect + aPt,
|
||||
param->mAppUnitsPerDevPixel));
|
||||
wr::LayoutRect transformedRect = aSc.ToRelativeLayoutRect(borderRect);
|
||||
wr::LayoutRect roundedRect = wr::ToRoundedLayoutRect(borderRect);
|
||||
wr::BorderSide wrSide[4];
|
||||
NS_FOR_CSS_SIDES(i) {
|
||||
wrSide[i] = wr::ToBorderSide(ToDeviceColor(param->mBorderColor), NS_STYLE_BORDER_STYLE_NONE);
|
||||
|
@ -7800,13 +7800,13 @@ BCInlineDirSeg::CreateWebRenderCommands(BCPaintBorderIterator& aIter,
|
|||
|
||||
// All border style is set to none except top side. So setting the widths of
|
||||
// each side to height of rect is fine.
|
||||
wr::BorderWidths borderWidths = wr::ToBorderWidths(transformedRect.size.height,
|
||||
transformedRect.size.height,
|
||||
transformedRect.size.height,
|
||||
transformedRect.size.height);
|
||||
wr::BorderWidths borderWidths = wr::ToBorderWidths(roundedRect.size.height,
|
||||
roundedRect.size.height,
|
||||
roundedRect.size.height,
|
||||
roundedRect.size.height);
|
||||
Range<const wr::BorderSide> wrsides(wrSide, 4);
|
||||
aBuilder.PushBorder(transformedRect,
|
||||
transformedRect,
|
||||
aBuilder.PushBorder(roundedRect,
|
||||
roundedRect,
|
||||
param->mBackfaceIsVisible,
|
||||
borderWidths,
|
||||
wrsides,
|
||||
|
@ -8060,30 +8060,30 @@ nsTableFrame::CreateWebRenderCommandsForBCBorders(wr::DisplayListBuilder& aBuild
|
|||
backfaceIsVisible |= param->mBackfaceIsVisible;
|
||||
}
|
||||
|
||||
wr::LayoutRect transformedRect = aSc.ToRelativeLayoutRect(borderRect);
|
||||
wr::LayoutRect roundedRect = wr::ToRoundedLayoutRect(borderRect);
|
||||
allBorderRect = allBorderRect.Union(borderRect);
|
||||
wrSide[side] = wr::ToBorderSide(ToDeviceColor(borderColor), borderStyle);
|
||||
switch (side) {
|
||||
case eSideTop:
|
||||
wrWidths.top = transformedRect.size.height;
|
||||
wrWidths.top = roundedRect.size.height;
|
||||
break;
|
||||
case eSideBottom:
|
||||
wrWidths.bottom = transformedRect.size.height;
|
||||
wrWidths.bottom = roundedRect.size.height;
|
||||
break;
|
||||
case eSideLeft:
|
||||
wrWidths.left = transformedRect.size.width;
|
||||
wrWidths.left = roundedRect.size.width;
|
||||
break;
|
||||
case eSideRight:
|
||||
wrWidths.right = transformedRect.size.width;
|
||||
wrWidths.right = roundedRect.size.width;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!allBorderRect.IsEmpty()) {
|
||||
Range<const wr::BorderSide> wrsides(wrSide, 4);
|
||||
wr::LayoutRect allTransformedRect = aSc.ToRelativeLayoutRect(allBorderRect);
|
||||
aBuilder.PushBorder(allTransformedRect,
|
||||
allTransformedRect,
|
||||
wr::LayoutRect allRoundedRect = wr::ToRoundedLayoutRect(allBorderRect);
|
||||
aBuilder.PushBorder(allRoundedRect,
|
||||
allRoundedRect,
|
||||
backfaceIsVisible,
|
||||
wrWidths,
|
||||
wrsides,
|
||||
|
|
|
@ -465,7 +465,7 @@ nsImageBoxFrame::CreateWebRenderCommands(mozilla::wr::DisplayListBuilder& aBuild
|
|||
if (key.isNothing()) {
|
||||
return ImgDrawResult::NOT_READY;
|
||||
}
|
||||
wr::LayoutRect fill = aSc.ToRelativeLayoutRect(fillRect);
|
||||
wr::LayoutRect fill = wr::ToRoundedLayoutRect(fillRect);
|
||||
|
||||
LayoutDeviceSize gapSize(0, 0);
|
||||
SamplingFilter sampleFilter = nsLayoutUtils::GetSamplingFilterForFrame(aItem->Frame());
|
||||
|
|
|
@ -2981,7 +2981,7 @@ nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(mozilla::wr::DisplayListBui
|
|||
const nsRect& aRect)
|
||||
{
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
wr::LayoutRect bounds = aSc.ToRelativeLayoutRect(
|
||||
wr::LayoutRect bounds = wr::ToRoundedLayoutRect(
|
||||
LayoutDeviceRect::FromAppUnits(aRect, presContext->AppUnitsPerDevPixel()));
|
||||
|
||||
EventStates eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
|
|
@ -1215,7 +1215,7 @@ nsNativeThemeGTK::CreateWebRenderCommandsForWidget(mozilla::wr::DisplayListBuild
|
|||
const nsRect& aRect)
|
||||
{
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
wr::LayoutRect bounds = aSc.ToRelativeLayoutRect(
|
||||
wr::LayoutRect bounds = wr::ToRoundedLayoutRect(
|
||||
LayoutDeviceRect::FromAppUnits(aRect, presContext->AppUnitsPerDevPixel()));
|
||||
|
||||
switch (aWidgetType) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче