зеркало из https://github.com/mozilla/gecko-dev.git
Back out 6 changesets (bug 1227327) for failures in est_fixed_bg_scrolling_repaints.html
Backed out changeset 529ff32ced48 (bug 1227327) Backed out changeset b726c30c4290 (bug 1227327) Backed out changeset 5453b1ce4e85 (bug 1227327) Backed out changeset 462dc0904d05 (bug 1227327) Backed out changeset 1515512d3731 (bug 1227327) Backed out changeset 2276fc059bf7 (bug 1227327)
This commit is contained in:
Родитель
3e68c8e1d2
Коммит
5387bf0160
|
@ -886,19 +886,6 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
|
|||
hint |= nsChangeHint_RepaintFrame;
|
||||
}
|
||||
|
||||
if (hint & nsChangeHint_UpdateBackgroundPosition) {
|
||||
// For most frame types, DLBI can detect background position changes,
|
||||
// so we only need to schedule a paint.
|
||||
hint |= nsChangeHint_SchedulePaint;
|
||||
if (frame->IsFrameOfType(nsIFrame::eTablePart) ||
|
||||
frame->IsFrameOfType(nsIFrame::eMathML)) {
|
||||
// Table parts and MathML frames don't build display items for their
|
||||
// backgrounds, so DLBI can't detect background-position changes for
|
||||
// these frames. Repaint the whole frame.
|
||||
hint |= nsChangeHint_RepaintFrame;
|
||||
}
|
||||
}
|
||||
|
||||
if (hint & (nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView |
|
||||
nsChangeHint_UpdateOpacityLayer | nsChangeHint_UpdateTransformLayer |
|
||||
nsChangeHint_ChildrenOnlyTransform | nsChangeHint_SchedulePaint)) {
|
||||
|
|
|
@ -194,15 +194,6 @@ enum nsChangeHint {
|
|||
*/
|
||||
nsChangeHint_UpdateUsesOpacity = 1 << 25,
|
||||
|
||||
/**
|
||||
* Indicates that the 'background-position' property changed.
|
||||
* Regular frames can invalidate these changes using DLBI, but
|
||||
* for some frame types we need to repaint the whole frame because
|
||||
* the frame does not build individual background image display items
|
||||
* for each background layer.
|
||||
*/
|
||||
nsChangeHint_UpdateBackgroundPosition = 1 << 26,
|
||||
|
||||
// IMPORTANT NOTE: When adding new hints, consider whether you need to
|
||||
// add them to NS_HintsNotHandledForDescendantsIn() below. Please also
|
||||
// add them to RestyleManager::ChangeHintToString.
|
||||
|
@ -312,8 +303,7 @@ inline nsChangeHint operator^=(nsChangeHint& aLeft, nsChangeHint aRight)
|
|||
nsChangeHint_ReflowChangesSizeOrPosition | \
|
||||
nsChangeHint_ClearAncestorIntrinsics | \
|
||||
nsChangeHint_UpdateComputedBSize | \
|
||||
nsChangeHint_UpdateUsesOpacity | \
|
||||
nsChangeHint_UpdateBackgroundPosition)
|
||||
nsChangeHint_UpdateUsesOpacity)
|
||||
|
||||
inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint) {
|
||||
nsChangeHint result = nsChangeHint(aChangeHint & (
|
||||
|
@ -329,8 +319,7 @@ inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint)
|
|||
nsChangeHint_UpdateContainingBlock |
|
||||
nsChangeHint_BorderStyleNoneChange |
|
||||
nsChangeHint_UpdateComputedBSize |
|
||||
nsChangeHint_UpdateUsesOpacity | \
|
||||
nsChangeHint_UpdateBackgroundPosition));
|
||||
nsChangeHint_UpdateUsesOpacity));
|
||||
|
||||
if (!NS_IsHintSubset(nsChangeHint_NeedDirtyReflow, aChangeHint)) {
|
||||
if (NS_IsHintSubset(nsChangeHint_NeedReflow, aChangeHint)) {
|
||||
|
|
|
@ -2310,11 +2310,9 @@ RegisterThemeGeometry(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
|||
nsDisplayBackgroundImage::nsDisplayBackgroundImage(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
uint32_t aLayer,
|
||||
const nsRect& aBackgroundRect,
|
||||
const nsStyleBackground* aBackgroundStyle)
|
||||
: nsDisplayImageContainer(aBuilder, aFrame)
|
||||
, mBackgroundStyle(aBackgroundStyle)
|
||||
, mBackgroundRect(aBackgroundRect)
|
||||
, mLayer(aLayer)
|
||||
, mIsRasterImage(false)
|
||||
{
|
||||
|
@ -2382,12 +2380,13 @@ static nsStyleContext* GetBackgroundStyleContext(nsIFrame* aFrame)
|
|||
SetBackgroundClipRegion(DisplayListClipState::AutoSaveRestore& aClipState,
|
||||
nsIFrame* aFrame, const nsPoint& aToReferenceFrame,
|
||||
const nsStyleImageLayers::Layer& aLayer,
|
||||
const nsRect& aBackgroundRect,
|
||||
bool aWillPaintBorder)
|
||||
{
|
||||
nsRect borderBox = nsRect(aToReferenceFrame, aFrame->GetSize());
|
||||
|
||||
nsCSSRendering::ImageLayerClipState clip;
|
||||
nsCSSRendering::GetImageLayerClip(aLayer, aFrame, *aFrame->StyleBorder(),
|
||||
aBackgroundRect, aBackgroundRect, aWillPaintBorder,
|
||||
borderBox, borderBox, aWillPaintBorder,
|
||||
aFrame->PresContext()->AppUnitsPerDevPixel(),
|
||||
&clip);
|
||||
|
||||
|
@ -2403,13 +2402,10 @@ SetBackgroundClipRegion(DisplayListClipState::AutoSaveRestore& aClipState,
|
|||
/*static*/ bool
|
||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
const nsRect& aBackgroundRect,
|
||||
nsDisplayList* aList,
|
||||
bool aAllowWillPaintBorderOptimization)
|
||||
nsDisplayList* aList)
|
||||
{
|
||||
nsStyleContext* bgSC = nullptr;
|
||||
const nsStyleBackground* bg = nullptr;
|
||||
nsRect bgRect = aBackgroundRect + aBuilder->ToReferenceFrame(aFrame);
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
bool isThemed = aFrame->IsThemed();
|
||||
if (!isThemed) {
|
||||
|
@ -2434,8 +2430,7 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
|
|||
const nsStyleEffects* effectsStyle = aFrame->StyleEffects();
|
||||
bool hasInsetShadow = effectsStyle->mBoxShadow &&
|
||||
effectsStyle->mBoxShadow->HasShadowWithInset(true);
|
||||
bool willPaintBorder = aAllowWillPaintBorderOptimization &&
|
||||
!isThemed && !hasInsetShadow &&
|
||||
bool willPaintBorder = !isThemed && !hasInsetShadow &&
|
||||
borderStyle->HasBorder();
|
||||
|
||||
nsPoint toRef = aBuilder->ToReferenceFrame(aFrame);
|
||||
|
@ -2460,11 +2455,11 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
|
|||
bool useWillPaintBorderOptimization = willPaintBorder &&
|
||||
nsLayoutUtils::HasNonZeroCorner(borderStyle->mBorderRadius);
|
||||
SetBackgroundClipRegion(clipState, aFrame, toRef,
|
||||
bg->BottomLayer(), bgRect,
|
||||
bg->BottomLayer(),
|
||||
useWillPaintBorderOptimization);
|
||||
}
|
||||
bgItemList.AppendNewToTop(
|
||||
new (aBuilder) nsDisplayBackgroundColor(aBuilder, aFrame, bgRect, bg,
|
||||
new (aBuilder) nsDisplayBackgroundColor(aBuilder, aFrame, bg,
|
||||
drawBackgroundColor ? color : NS_RGBA(0, 0, 0, 0)));
|
||||
}
|
||||
|
||||
|
@ -2476,7 +2471,7 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
|
|||
new (aBuilder) nsDisplayClearBackground(aBuilder, aFrame));
|
||||
}
|
||||
nsDisplayThemedBackground* bgItem =
|
||||
new (aBuilder) nsDisplayThemedBackground(aBuilder, aFrame, bgRect);
|
||||
new (aBuilder) nsDisplayThemedBackground(aBuilder, aFrame);
|
||||
bgItemList.AppendNewToTop(bgItem);
|
||||
aList->AppendToTop(&bgItemList);
|
||||
return true;
|
||||
|
@ -2507,12 +2502,12 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
|
|||
if (!aBuilder->IsForEventDelivery()) {
|
||||
const nsStyleImageLayers::Layer& layer = bg->mImage.mLayers[i];
|
||||
SetBackgroundClipRegion(clipState, aFrame, toRef,
|
||||
layer, bgRect, willPaintBorder);
|
||||
layer, willPaintBorder);
|
||||
}
|
||||
|
||||
nsDisplayList thisItemList;
|
||||
nsDisplayBackgroundImage* bgItem =
|
||||
new (aBuilder) nsDisplayBackgroundImage(aBuilder, aFrame, i, bgRect, bg);
|
||||
new (aBuilder) nsDisplayBackgroundImage(aBuilder, aFrame, i, bg);
|
||||
|
||||
if (bgItem->ShouldFixToViewport(aBuilder)) {
|
||||
thisItemList.AppendNewToTop(
|
||||
|
@ -2779,8 +2774,7 @@ nsDisplayBackgroundImage::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
|||
/* static */ nsRegion
|
||||
nsDisplayBackgroundImage::GetInsideClipRegion(nsDisplayItem* aItem,
|
||||
uint8_t aClip,
|
||||
const nsRect& aRect,
|
||||
const nsRect& aBackgroundRect)
|
||||
const nsRect& aRect)
|
||||
{
|
||||
nsRegion result;
|
||||
if (aRect.IsEmpty())
|
||||
|
@ -2788,18 +2782,26 @@ nsDisplayBackgroundImage::GetInsideClipRegion(nsDisplayItem* aItem,
|
|||
|
||||
nsIFrame *frame = aItem->Frame();
|
||||
|
||||
nsRect clipRect = aBackgroundRect;
|
||||
nsRect clipRect;
|
||||
if (frame->GetType() == nsGkAtoms::canvasFrame) {
|
||||
nsCanvasFrame* canvasFrame = static_cast<nsCanvasFrame*>(frame);
|
||||
clipRect = canvasFrame->CanvasArea() + aItem->ToReferenceFrame();
|
||||
} else if (aClip == NS_STYLE_IMAGELAYER_CLIP_PADDING ||
|
||||
aClip == NS_STYLE_IMAGELAYER_CLIP_CONTENT) {
|
||||
nsMargin border = frame->GetUsedBorder();
|
||||
if (aClip == NS_STYLE_IMAGELAYER_CLIP_CONTENT) {
|
||||
border += frame->GetUsedPadding();
|
||||
} else {
|
||||
switch (aClip) {
|
||||
case NS_STYLE_IMAGELAYER_CLIP_BORDER:
|
||||
case NS_STYLE_IMAGELAYER_CLIP_TEXT:
|
||||
clipRect = nsRect(aItem->ToReferenceFrame(), frame->GetSize());
|
||||
break;
|
||||
case NS_STYLE_IMAGELAYER_CLIP_PADDING:
|
||||
clipRect = frame->GetPaddingRect() - frame->GetPosition() + aItem->ToReferenceFrame();
|
||||
break;
|
||||
case NS_STYLE_IMAGELAYER_CLIP_CONTENT:
|
||||
clipRect = frame->GetContentRectRelativeToSelf() + aItem->ToReferenceFrame();
|
||||
break;
|
||||
default:
|
||||
NS_NOTREACHED("Unknown clip type");
|
||||
return result;
|
||||
}
|
||||
border.ApplySkipSides(frame->GetSkipSides());
|
||||
clipRect.Deflate(border);
|
||||
}
|
||||
|
||||
return clipRect.Intersect(aRect);
|
||||
|
@ -2827,7 +2829,7 @@ nsDisplayBackgroundImage::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
|||
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mImage.mLayers[mLayer];
|
||||
if (layer.mImage.IsOpaque() && layer.mBlendMode == NS_STYLE_BLEND_NORMAL &&
|
||||
layer.mClip != NS_STYLE_IMAGELAYER_CLIP_TEXT) {
|
||||
result = GetInsideClipRegion(this, layer.mClip, mBounds, mBackgroundRect);
|
||||
result = GetInsideClipRegion(this, layer.mClip, mBounds);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2853,7 +2855,7 @@ nsDisplayBackgroundImage::GetPositioningArea()
|
|||
bool transformedFixed;
|
||||
return nsCSSRendering::ComputeImageLayerPositioningArea(
|
||||
mFrame->PresContext(), mFrame,
|
||||
mBackgroundRect,
|
||||
nsRect(ToReferenceFrame(), mFrame->GetSize()),
|
||||
mBackgroundStyle->mImage.mLayers[mLayer],
|
||||
&attachedToFrame,
|
||||
&transformedFixed) + ToReferenceFrame();
|
||||
|
@ -2905,18 +2907,19 @@ nsDisplayBackgroundImage::PaintInternal(nsDisplayListBuilder* aBuilder,
|
|||
uint32_t flags = aBuilder->GetBackgroundPaintFlags();
|
||||
CheckForBorderItem(this, flags);
|
||||
|
||||
nsRect borderBox = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
gfxContext* ctx = aCtx->ThebesContext();
|
||||
uint8_t clip = mBackgroundStyle->mImage.mLayers[mLayer].mClip;
|
||||
|
||||
if (clip == NS_STYLE_IMAGELAYER_CLIP_TEXT) {
|
||||
ctx->Save();
|
||||
ClipBackgroundByText(mFrame, aCtx, mBackgroundRect);
|
||||
ClipBackgroundByText(mFrame, aCtx, borderBox);
|
||||
}
|
||||
|
||||
image::DrawResult result =
|
||||
nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
|
||||
aBounds,
|
||||
mBackgroundRect,
|
||||
borderBox,
|
||||
flags, aClipRect, mLayer,
|
||||
CompositionOp::OP_OVER);
|
||||
|
||||
|
@ -2991,7 +2994,8 @@ nsDisplayBackgroundImage::GetBoundsInternal(nsDisplayListBuilder* aBuilder) {
|
|||
return nsRect();
|
||||
}
|
||||
|
||||
nsRect clipRect = mBackgroundRect;
|
||||
nsRect borderBox = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
nsRect clipRect = borderBox;
|
||||
if (mFrame->GetType() == nsGkAtoms::canvasFrame) {
|
||||
nsCanvasFrame* frame = static_cast<nsCanvasFrame*>(mFrame);
|
||||
clipRect = frame->CanvasArea() + ToReferenceFrame();
|
||||
|
@ -3007,7 +3011,7 @@ nsDisplayBackgroundImage::GetBoundsInternal(nsDisplayListBuilder* aBuilder) {
|
|||
}
|
||||
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mImage.mLayers[mLayer];
|
||||
return nsCSSRendering::GetBackgroundLayerRect(presContext, mFrame,
|
||||
mBackgroundRect, clipRect, layer,
|
||||
borderBox, clipRect, layer,
|
||||
aBuilder->GetBackgroundPaintFlags());
|
||||
}
|
||||
|
||||
|
@ -3019,10 +3023,8 @@ nsDisplayBackgroundImage::GetPerFrameKey()
|
|||
}
|
||||
|
||||
nsDisplayThemedBackground::nsDisplayThemedBackground(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
const nsRect& aBackgroundRect)
|
||||
nsIFrame* aFrame)
|
||||
: nsDisplayItem(aBuilder, aFrame)
|
||||
, mBackgroundRect(aBackgroundRect)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsDisplayThemedBackground);
|
||||
|
||||
|
@ -3065,8 +3067,8 @@ nsDisplayThemedBackground::HitTest(nsDisplayListBuilder* aBuilder,
|
|||
HitTestState* aState,
|
||||
nsTArray<nsIFrame*> *aOutFrames)
|
||||
{
|
||||
// Assume that any point in our background rect is a hit.
|
||||
if (mBackgroundRect.Intersects(aRect)) {
|
||||
// Assume that any point in our border rect is a hit.
|
||||
if (nsRect(ToReferenceFrame(), mFrame->GetSize()).Intersects(aRect)) {
|
||||
aOutFrames->AppendElement(mFrame);
|
||||
}
|
||||
}
|
||||
|
@ -3078,7 +3080,7 @@ nsDisplayThemedBackground::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
|||
*aSnap = false;
|
||||
|
||||
if (mThemeTransparency == nsITheme::eOpaque) {
|
||||
result = mBackgroundRect;
|
||||
result = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -3103,7 +3105,7 @@ nsDisplayThemedBackground::ProvidesFontSmoothingBackgroundColor(nscolor* aColor)
|
|||
nsRect
|
||||
nsDisplayThemedBackground::GetPositioningArea()
|
||||
{
|
||||
return mBackgroundRect;
|
||||
return nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3122,11 +3124,12 @@ nsDisplayThemedBackground::PaintInternal(nsDisplayListBuilder* aBuilder,
|
|||
// XXXzw this ignores aClipRect.
|
||||
nsPresContext* presContext = mFrame->PresContext();
|
||||
nsITheme *theme = presContext->GetTheme();
|
||||
nsRect drawing(mBackgroundRect);
|
||||
nsRect borderArea(ToReferenceFrame(), mFrame->GetSize());
|
||||
nsRect drawing(borderArea);
|
||||
theme->GetWidgetOverflow(presContext->DeviceContext(), mFrame, mAppearance,
|
||||
&drawing);
|
||||
drawing.IntersectRect(drawing, aBounds);
|
||||
theme->DrawWidgetBackground(aCtx, mFrame, mAppearance, mBackgroundRect, drawing);
|
||||
theme->DrawWidgetBackground(aCtx, mFrame, mAppearance, borderArea, drawing);
|
||||
}
|
||||
|
||||
bool nsDisplayThemedBackground::IsWindowActive()
|
||||
|
@ -3171,7 +3174,7 @@ nsRect
|
|||
nsDisplayThemedBackground::GetBoundsInternal() {
|
||||
nsPresContext* presContext = mFrame->PresContext();
|
||||
|
||||
nsRect r = mBackgroundRect - ToReferenceFrame();
|
||||
nsRect r(nsPoint(0,0), mFrame->GetSize());
|
||||
presContext->GetTheme()->
|
||||
GetWidgetOverflow(presContext->DeviceContext(), mFrame,
|
||||
mFrame->StyleDisplay()->mAppearance, &r);
|
||||
|
@ -3316,6 +3319,8 @@ nsDisplayBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,
|
|||
return;
|
||||
}
|
||||
|
||||
nsRect borderBox = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
|
||||
#if 0
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1148418#c21 for why this
|
||||
// results in a precision induced rounding issue that makes the rect one
|
||||
|
@ -3329,7 +3334,7 @@ nsDisplayBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
DrawTarget& aDrawTarget = *aCtx->GetDrawTarget();
|
||||
|
||||
Rect rect = NSRectToSnappedRect(mBackgroundRect,
|
||||
Rect rect = NSRectToSnappedRect(borderBox,
|
||||
mFrame->PresContext()->AppUnitsPerDevPixel(),
|
||||
aDrawTarget);
|
||||
ColorPattern color(ToDeviceColor(mColor));
|
||||
|
@ -3341,7 +3346,7 @@ nsDisplayBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,
|
|||
if (clip == NS_STYLE_IMAGELAYER_CLIP_TEXT) {
|
||||
gfxContextAutoSaveRestore save(ctx);
|
||||
|
||||
ClipBackgroundByText(mFrame, aCtx, mBackgroundRect);
|
||||
ClipBackgroundByText(mFrame, aCtx, borderBox);
|
||||
ctx->SetColor(mColor);
|
||||
ctx->Fill();
|
||||
|
||||
|
@ -3349,7 +3354,7 @@ nsDisplayBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,
|
|||
}
|
||||
|
||||
gfxRect bounds =
|
||||
nsLayoutUtils::RectToGfxRect(mBackgroundRect, mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
nsLayoutUtils::RectToGfxRect(borderBox, mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
|
||||
ctx->SetColor(mColor);
|
||||
ctx->NewPath();
|
||||
|
@ -3374,8 +3379,9 @@ nsDisplayBackgroundColor::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
|||
*aSnap = true;
|
||||
|
||||
const nsStyleImageLayers::Layer& bottomLayer = mBackgroundStyle->BottomLayer();
|
||||
nsRect borderBox = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
return nsDisplayBackgroundImage::GetInsideClipRegion(this, bottomLayer.mClip,
|
||||
mBackgroundRect, mBackgroundRect);
|
||||
borderBox);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -2661,23 +2661,17 @@ public:
|
|||
* aIsThemed should be the value of aFrame->IsThemed.
|
||||
* aBackgroundStyle should be the result of
|
||||
* nsCSSRendering::FindBackground, or null if FindBackground returned false.
|
||||
* aBackgroundRect is relative to aFrame.
|
||||
*/
|
||||
nsDisplayBackgroundImage(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
uint32_t aLayer, const nsRect& aBackgroundRect,
|
||||
uint32_t aLayer,
|
||||
const nsStyleBackground* aBackgroundStyle);
|
||||
virtual ~nsDisplayBackgroundImage();
|
||||
|
||||
// This will create and append new items for all the layers of the
|
||||
// background. Returns whether we appended a themed background.
|
||||
// aAllowWillPaintBorderOptimization should usually be left at true, unless
|
||||
// aFrame has special border drawing that causes opaque borders to not
|
||||
// actually be opaque.
|
||||
static bool AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame,
|
||||
const nsRect& aBackgroundRect,
|
||||
nsDisplayList* aList,
|
||||
bool aAllowWillPaintBorderOptimization = true);
|
||||
nsDisplayList* aList);
|
||||
|
||||
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager,
|
||||
|
@ -2733,7 +2727,7 @@ public:
|
|||
virtual nsRect GetDestRect() override;
|
||||
|
||||
static nsRegion GetInsideClipRegion(nsDisplayItem* aItem, uint8_t aClip,
|
||||
const nsRect& aRect, const nsRect& aBackgroundRect);
|
||||
const nsRect& aRect);
|
||||
|
||||
virtual bool ShouldFixToViewport(nsDisplayListBuilder* aBuilder) override;
|
||||
|
||||
|
@ -2764,7 +2758,6 @@ protected:
|
|||
// mIsThemed is true or if FindBackground returned false.
|
||||
const nsStyleBackground* mBackgroundStyle;
|
||||
nsCOMPtr<imgIContainer> mImage;
|
||||
nsRect mBackgroundRect; // relative to the reference frame
|
||||
nsRect mFillRect;
|
||||
nsRect mDestRect;
|
||||
/* Bounds of this display item */
|
||||
|
@ -2781,8 +2774,7 @@ protected:
|
|||
*/
|
||||
class nsDisplayThemedBackground : public nsDisplayItem {
|
||||
public:
|
||||
nsDisplayThemedBackground(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
const nsRect& aBackgroundRect);
|
||||
nsDisplayThemedBackground(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame);
|
||||
virtual ~nsDisplayThemedBackground();
|
||||
|
||||
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
||||
|
@ -2828,7 +2820,6 @@ protected:
|
|||
void PaintInternal(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx,
|
||||
const nsRect& aBounds, nsRect* aClipRect);
|
||||
|
||||
nsRect mBackgroundRect;
|
||||
nsRect mBounds;
|
||||
nsITheme::Transparency mThemeTransparency;
|
||||
uint8_t mAppearance;
|
||||
|
@ -2840,11 +2831,9 @@ class nsDisplayBackgroundColor : public nsDisplayItem
|
|||
|
||||
public:
|
||||
nsDisplayBackgroundColor(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
const nsRect& aBackgroundRect,
|
||||
const nsStyleBackground* aBackgroundStyle,
|
||||
nscolor aColor)
|
||||
: nsDisplayItem(aBuilder, aFrame)
|
||||
, mBackgroundRect(aBackgroundRect)
|
||||
, mBackgroundStyle(aBackgroundStyle)
|
||||
, mColor(Color::FromABGR(aColor))
|
||||
{ }
|
||||
|
@ -2865,7 +2854,7 @@ public:
|
|||
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) override
|
||||
{
|
||||
*aSnap = true;
|
||||
return mBackgroundRect;
|
||||
return nsRect(ToReferenceFrame(), Frame()->GetSize());
|
||||
}
|
||||
|
||||
virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override
|
||||
|
@ -2890,7 +2879,6 @@ public:
|
|||
virtual void WriteDebugInfo(std::stringstream& aStream) override;
|
||||
|
||||
protected:
|
||||
const nsRect mBackgroundRect;
|
||||
const nsStyleBackground* mBackgroundStyle;
|
||||
mozilla::gfx::Color mColor;
|
||||
};
|
||||
|
|
|
@ -112,18 +112,19 @@ nsDisplayButtonBoxShadowOuter::Paint(nsDisplayListBuilder* aBuilder,
|
|||
buttonRect, mVisibleRect);
|
||||
}
|
||||
|
||||
class nsDisplayButtonBorder : public nsDisplayItem {
|
||||
class nsDisplayButtonBorderBackground : public nsDisplayItem {
|
||||
public:
|
||||
nsDisplayButtonBorder(nsDisplayListBuilder* aBuilder,
|
||||
nsDisplayButtonBorderBackground(nsDisplayListBuilder* aBuilder,
|
||||
nsButtonFrameRenderer* aRenderer)
|
||||
: nsDisplayItem(aBuilder, aRenderer->GetFrame()), mBFR(aRenderer) {
|
||||
MOZ_COUNT_CTOR(nsDisplayButtonBorder);
|
||||
MOZ_COUNT_CTOR(nsDisplayButtonBorderBackground);
|
||||
}
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
virtual ~nsDisplayButtonBorder() {
|
||||
MOZ_COUNT_DTOR(nsDisplayButtonBorder);
|
||||
virtual ~nsDisplayButtonBorderBackground() {
|
||||
MOZ_COUNT_DTOR(nsDisplayButtonBorderBackground);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
||||
HitTestState* aState,
|
||||
nsTArray<nsIFrame*> *aOutFrames) override {
|
||||
|
@ -143,13 +144,13 @@ private:
|
|||
};
|
||||
|
||||
nsDisplayItemGeometry*
|
||||
nsDisplayButtonBorder::AllocateGeometry(nsDisplayListBuilder* aBuilder)
|
||||
nsDisplayButtonBorderBackground::AllocateGeometry(nsDisplayListBuilder* aBuilder)
|
||||
{
|
||||
return new nsDisplayItemGenericImageGeometry(this, aBuilder);
|
||||
}
|
||||
|
||||
void
|
||||
nsDisplayButtonBorder::ComputeInvalidationRegion(
|
||||
nsDisplayButtonBorderBackground::ComputeInvalidationRegion(
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayItemGeometry* aGeometry,
|
||||
nsRegion *aInvalidRegion)
|
||||
|
@ -166,22 +167,22 @@ nsDisplayButtonBorder::ComputeInvalidationRegion(
|
|||
nsDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
|
||||
}
|
||||
|
||||
void nsDisplayButtonBorder::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsRenderingContext* aCtx)
|
||||
void nsDisplayButtonBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsRenderingContext* aCtx)
|
||||
{
|
||||
NS_ASSERTION(mFrame, "No frame?");
|
||||
nsPresContext* pc = mFrame->PresContext();
|
||||
nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
|
||||
|
||||
// draw the border and background inside the focus and outline borders
|
||||
DrawResult result =
|
||||
mBFR->PaintBorder(aBuilder, pc, *aCtx, mVisibleRect, r);
|
||||
mBFR->PaintBorderAndBackground(aBuilder, pc, *aCtx, mVisibleRect, r);
|
||||
|
||||
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
||||
}
|
||||
|
||||
nsRect
|
||||
nsDisplayButtonBorder::GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) {
|
||||
nsDisplayButtonBorderBackground::GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) {
|
||||
*aSnap = false;
|
||||
return aBuilder->IsForEventDelivery() ? nsRect(ToReferenceFrame(), mFrame->GetSize())
|
||||
: mFrame->GetVisualOverflowRectRelativeToSelf() + ToReferenceFrame();
|
||||
|
@ -263,14 +264,10 @@ nsButtonFrameRenderer::DisplayButton(nsDisplayListBuilder* aBuilder,
|
|||
nsDisplayButtonBoxShadowOuter(aBuilder, this));
|
||||
}
|
||||
|
||||
nsRect buttonRect;
|
||||
GetButtonRect(mFrame->GetRectRelativeToSelf(), buttonRect);
|
||||
|
||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
||||
aBuilder, mFrame, buttonRect, aBackground);
|
||||
|
||||
// Almost all buttons draw some kind of background so there's not much
|
||||
// point in checking whether we should create this item.
|
||||
aBackground->AppendNewToTop(new (aBuilder)
|
||||
nsDisplayButtonBorder(aBuilder, this));
|
||||
nsDisplayButtonBorderBackground(aBuilder, this));
|
||||
|
||||
// Only display focus rings if we actually have them. Since at most one
|
||||
// button would normally display a focus ring, most buttons won't have them.
|
||||
|
@ -328,8 +325,9 @@ nsButtonFrameRenderer::PaintOutlineAndFocusBorders(
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
DrawResult
|
||||
nsButtonFrameRenderer::PaintBorder(
|
||||
nsButtonFrameRenderer::PaintBorderAndBackground(
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
nsPresContext* aPresContext,
|
||||
nsRenderingContext& aRenderingContext,
|
||||
|
@ -342,14 +340,19 @@ nsButtonFrameRenderer::PaintBorder(
|
|||
|
||||
nsStyleContext* context = mFrame->StyleContext();
|
||||
|
||||
uint32_t bgFlags = aBuilder->GetBackgroundPaintFlags();
|
||||
PaintBorderFlags borderFlags = aBuilder->ShouldSyncDecodeImages()
|
||||
? PaintBorderFlags::SYNC_DECODE_IMAGES
|
||||
: PaintBorderFlags();
|
||||
|
||||
DrawResult result =
|
||||
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, buttonRect, bgFlags);
|
||||
|
||||
nsCSSRendering::PaintBoxShadowInner(aPresContext, aRenderingContext,
|
||||
mFrame, buttonRect);
|
||||
|
||||
DrawResult result =
|
||||
result &=
|
||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
||||
aDirtyRect, buttonRect, context, borderFlags);
|
||||
|
||||
|
|
|
@ -45,11 +45,11 @@ public:
|
|||
const nsRect& aDirtyRect,
|
||||
const nsRect& aRect);
|
||||
|
||||
DrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
|
||||
nsPresContext* aPresContext,
|
||||
nsRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aRect);
|
||||
DrawResult PaintBorderAndBackground(nsDisplayListBuilder* aBuilder,
|
||||
nsPresContext* aPresContext,
|
||||
nsRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aRect);
|
||||
|
||||
void SetFrame(nsFrame* aFrame, nsPresContext* aPresContext);
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ public:
|
|||
MOZ_COUNT_DTOR(nsDisplayFieldSetBorderBackground);
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
||||
HitTestState* aState,
|
||||
nsTArray<nsIFrame*> *aOutFrames) override;
|
||||
|
@ -127,7 +128,7 @@ nsDisplayFieldSetBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
|
|||
nsRenderingContext* aCtx)
|
||||
{
|
||||
DrawResult result = static_cast<nsFieldSetFrame*>(mFrame)->
|
||||
PaintBorder(aBuilder, *aCtx, ToReferenceFrame(), mVisibleRect);
|
||||
PaintBorderBackground(aBuilder, *aCtx, ToReferenceFrame(), mVisibleRect);
|
||||
|
||||
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
||||
}
|
||||
|
@ -170,11 +171,8 @@ nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
nsDisplayBoxShadowOuter(aBuilder, this));
|
||||
}
|
||||
|
||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
||||
aBuilder, this, VisualBorderRectRelativeToSelf(),
|
||||
aLists.BorderBackground(),
|
||||
/* aAllowWillPaintBorderOptimization = */ false);
|
||||
|
||||
// don't bother checking to see if we really have a border or background.
|
||||
// we usually will have a border.
|
||||
aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
|
||||
nsDisplayFieldSetBorderBackground(aBuilder, this));
|
||||
|
||||
|
@ -211,7 +209,7 @@ nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
}
|
||||
|
||||
DrawResult
|
||||
nsFieldSetFrame::PaintBorder(
|
||||
nsFieldSetFrame::PaintBorderBackground(
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
nsRenderingContext& aRenderingContext,
|
||||
nsPoint aPt,
|
||||
|
@ -227,11 +225,14 @@ nsFieldSetFrame::PaintBorder(
|
|||
rect += aPt;
|
||||
nsPresContext* presContext = PresContext();
|
||||
|
||||
uint32_t bgFlags = aBuilder->GetBackgroundPaintFlags();
|
||||
PaintBorderFlags borderFlags = aBuilder->ShouldSyncDecodeImages()
|
||||
? PaintBorderFlags::SYNC_DECODE_IMAGES
|
||||
: PaintBorderFlags();
|
||||
|
||||
DrawResult result = DrawResult::SUCCESS;
|
||||
DrawResult result =
|
||||
nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect, bgFlags);
|
||||
|
||||
nsCSSRendering::PaintBoxShadowInner(presContext, aRenderingContext,
|
||||
this, rect);
|
||||
|
|
|
@ -50,9 +50,9 @@ public:
|
|||
const nsRect& aDirtyRect,
|
||||
const nsDisplayListSet& aLists) override;
|
||||
|
||||
DrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
|
||||
nsRenderingContext& aRenderingContext,
|
||||
nsPoint aPt, const nsRect& aDirtyRect);
|
||||
DrawResult PaintBorderBackground(nsDisplayListBuilder* aBuilder,
|
||||
nsRenderingContext& aRenderingContext,
|
||||
nsPoint aPt, const nsRect& aDirtyRect);
|
||||
|
||||
#ifdef DEBUG
|
||||
virtual void SetInitialChildList(ChildListID aListID,
|
||||
|
|
|
@ -199,7 +199,7 @@ class nsDisplayCanvasBackgroundImage : public nsDisplayBackgroundImage {
|
|||
public:
|
||||
nsDisplayCanvasBackgroundImage(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||
uint32_t aLayer, const nsStyleBackground* aBg)
|
||||
: nsDisplayBackgroundImage(aBuilder, aFrame, aLayer, aFrame->GetRectRelativeToSelf(), aBg)
|
||||
: nsDisplayBackgroundImage(aBuilder, aFrame, aLayer, aBg)
|
||||
{
|
||||
if (ShouldFixToViewport(aBuilder)) {
|
||||
mAnimatedGeometryRoot = aBuilder->FindAnimatedGeometryRootFor(this);
|
||||
|
@ -239,7 +239,7 @@ public:
|
|||
class nsDisplayCanvasThemedBackground : public nsDisplayThemedBackground {
|
||||
public:
|
||||
nsDisplayCanvasThemedBackground(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
|
||||
: nsDisplayThemedBackground(aBuilder, aFrame, aFrame->GetRectRelativeToSelf())
|
||||
: nsDisplayThemedBackground(aBuilder, aFrame)
|
||||
{}
|
||||
|
||||
virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) override;
|
||||
|
|
|
@ -1875,7 +1875,7 @@ nsFrame::DisplayBackgroundUnconditional(nsDisplayListBuilder* aBuilder,
|
|||
if (aBuilder->IsForEventDelivery() || aForceBackground ||
|
||||
!StyleBackground()->IsTransparent() || StyleDisplay()->mAppearance) {
|
||||
return nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
||||
aBuilder, this, GetRectRelativeToSelf(), aLists.BorderBackground());
|
||||
aBuilder, this, aLists.BorderBackground());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<html>
|
||||
<head><style>
|
||||
button,span,fieldset { border-radius: 7px 3px; background-color: #0F0; }
|
||||
button { border: none; outline: 3px solid black; -moz-outline-radius: 7px 3px; outline-offset: -2px; }
|
||||
</style></head>
|
||||
<body style="margin:30px">
|
||||
<div style="-moz-column-count:3">
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
<html>
|
||||
<head><style>
|
||||
button,span,fieldset { border-radius: 7px 3px; background-color: #0F0; }
|
||||
button { border: none; outline: 3px solid black; -moz-outline-radius: 7px 3px; outline-offset: -2px; }
|
||||
</style></head>
|
||||
<body style="margin:30px">
|
||||
<div style="-moz-column-count:3">
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>Reference for properly handled background-position changes.</title>
|
||||
|
||||
<style>
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#background {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color: lime;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="background"></div>
|
|
@ -1,32 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" class="reftest-wait">
|
||||
<meta charset="utf-8">
|
||||
<title>Changes to background-position should invalidate properly.</title>
|
||||
|
||||
<style>
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#background {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-image: url(image_rgrg-256x256.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="background"></div>
|
||||
|
||||
<script>
|
||||
|
||||
function doTest() {
|
||||
document.querySelector("#background").style.backgroundPosition = "-140px 0";
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
document.addEventListener("MozReftestInvalidate", doTest);
|
||||
|
||||
</script>
|
|
@ -1,35 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" class="reftest-wait">
|
||||
<meta charset="utf-8">
|
||||
<title>Changes to background-position should invalidate properly for input type=text.</title>
|
||||
|
||||
<style>
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#background {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-image: url(image_rgrg-256x256.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 0;
|
||||
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<input type="text" id="background"></div>
|
||||
|
||||
<script>
|
||||
|
||||
function doTest() {
|
||||
document.querySelector("#background").style.backgroundPosition = "-140px 0";
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
document.addEventListener("MozReftestInvalidate", doTest);
|
||||
|
||||
</script>
|
|
@ -1,35 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" class="reftest-wait">
|
||||
<meta charset="utf-8">
|
||||
<title>Changes to background-position should invalidate properly for input type=button.</title>
|
||||
|
||||
<style>
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#background {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-image: url(image_rgrg-256x256.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 0;
|
||||
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<input type="button" id="background"></div>
|
||||
|
||||
<script>
|
||||
|
||||
function doTest() {
|
||||
document.querySelector("#background").style.backgroundPosition = "-140px 0";
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
document.addEventListener("MozReftestInvalidate", doTest);
|
||||
|
||||
</script>
|
|
@ -1,43 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" class="reftest-wait">
|
||||
<meta charset="utf-8">
|
||||
<title>Changes to background-position should invalidate properly for table rows.</title>
|
||||
|
||||
<style>
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#background {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-image: url(image_rgrg-256x256.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 0;
|
||||
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table, tr, td {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<table><tr id="background"><td></td></table>
|
||||
|
||||
<script>
|
||||
|
||||
function doTest() {
|
||||
document.querySelector("#background").style.backgroundPosition = "-140px 0";
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
document.addEventListener("MozReftestInvalidate", doTest);
|
||||
|
||||
</script>
|
|
@ -1,43 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" class="reftest-wait">
|
||||
<meta charset="utf-8">
|
||||
<title>Changes to background-position should invalidate properly for table cells.</title>
|
||||
|
||||
<style>
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#background {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-image: url(image_rgrg-256x256.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 0;
|
||||
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table, tr, td {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<table><tr><td id="background"></td></table>
|
||||
|
||||
<script>
|
||||
|
||||
function doTest() {
|
||||
document.querySelector("#background").style.backgroundPosition = "-140px 0";
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
document.addEventListener("MozReftestInvalidate", doTest);
|
||||
|
||||
</script>
|
|
@ -1,36 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en" class="reftest-wait">
|
||||
<meta charset="utf-8">
|
||||
<title>Changes to background-position should invalidate properly for fieldsets.</title>
|
||||
|
||||
<style>
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#background {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-image: url(image_rgrg-256x256.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0 0;
|
||||
|
||||
border: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<fieldset id="background"><legend></legend></fieldset>
|
||||
|
||||
<script>
|
||||
|
||||
function doTest() {
|
||||
document.querySelector("#background").style.backgroundPosition = "-140px 0";
|
||||
document.documentElement.removeAttribute("class");
|
||||
}
|
||||
document.addEventListener("MozReftestInvalidate", doTest);
|
||||
|
||||
</script>
|
|
@ -69,12 +69,6 @@ fuzzy-if(gtkWidget,2,4) fuzzy-if(asyncPan,2,3955) fuzzy-if(OSX,179,30) fuzzy-if(
|
|||
!= image-scrolling-zoom-1-ref.html image-scrolling-zoom-1-notref.html
|
||||
pref(layers.single-tile.enabled,false) != fast-scrolling.html about:blank
|
||||
== background-position-1.html background-position-1-ref.html
|
||||
== background-position-2a.html background-position-2-ref.html
|
||||
== background-position-2b.html background-position-2-ref.html
|
||||
== background-position-2c.html background-position-2-ref.html
|
||||
== background-position-2d.html background-position-2-ref.html
|
||||
== background-position-2e.html background-position-2-ref.html
|
||||
== background-position-2f.html background-position-2-ref.html
|
||||
== zero-opacity-animation.html about:blank
|
||||
== zero-opacity-text.html about:blank
|
||||
== negative-w-component.html negative-w-component-ref.html
|
||||
|
|
|
@ -2638,7 +2638,7 @@ nsStyleImageLayers::Layer::CalcDifference(const nsStyleImageLayers::Layer& aOthe
|
|||
}
|
||||
|
||||
if (mPosition != aOther.mPosition) {
|
||||
hint |= nsChangeHint_UpdateBackgroundPosition;
|
||||
hint |= nsChangeHint_SchedulePaint;
|
||||
}
|
||||
|
||||
return hint;
|
||||
|
|
|
@ -801,7 +801,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBackground {
|
|||
static nsChangeHint MaxDifference() {
|
||||
return nsChangeHint_UpdateEffects |
|
||||
nsChangeHint_RepaintFrame |
|
||||
nsChangeHint_UpdateBackgroundPosition |
|
||||
nsChangeHint_SchedulePaint |
|
||||
nsChangeHint_NeutralChange;
|
||||
}
|
||||
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
||||
|
|
|
@ -1253,7 +1253,6 @@ nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder,
|
|||
// XXX how to handle collapsed borders?
|
||||
if (aBuilder->IsForEventDelivery()) {
|
||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(aBuilder, aFrame,
|
||||
aFrame->GetRectRelativeToSelf(),
|
||||
lists->BorderBackground());
|
||||
}
|
||||
|
||||
|
|
|
@ -39,10 +39,9 @@ public:
|
|||
|
||||
virtual bool HonorPrintBackgroundSettings() override { return false; }
|
||||
|
||||
DrawResult PaintBorder(nsRenderingContext& aRenderingContext,
|
||||
DrawResult PaintBorderBackground(nsRenderingContext& aRenderingContext,
|
||||
nsPoint aPt,
|
||||
const nsRect& aDirtyRect);
|
||||
nsRect GetBackgroundRectRelativeToSelf(nscoord* aOutYOffset = nullptr, nsRect* aOutGroupRect = nullptr);
|
||||
|
||||
// make sure we our kids get our orient and align instead of us.
|
||||
// our child box has no content node so it will search for a parent with one.
|
||||
|
@ -83,16 +82,16 @@ NS_NewGroupBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
|||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsGroupBoxFrame)
|
||||
|
||||
class nsDisplayXULGroupBorder : public nsDisplayItem {
|
||||
class nsDisplayXULGroupBackground : public nsDisplayItem {
|
||||
public:
|
||||
nsDisplayXULGroupBorder(nsDisplayListBuilder* aBuilder,
|
||||
nsDisplayXULGroupBackground(nsDisplayListBuilder* aBuilder,
|
||||
nsGroupBoxFrame* aFrame) :
|
||||
nsDisplayItem(aBuilder, aFrame) {
|
||||
MOZ_COUNT_CTOR(nsDisplayXULGroupBorder);
|
||||
MOZ_COUNT_CTOR(nsDisplayXULGroupBackground);
|
||||
}
|
||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||
virtual ~nsDisplayXULGroupBorder() {
|
||||
MOZ_COUNT_DTOR(nsDisplayXULGroupBorder);
|
||||
virtual ~nsDisplayXULGroupBackground() {
|
||||
MOZ_COUNT_DTOR(nsDisplayXULGroupBackground);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -110,13 +109,13 @@ public:
|
|||
};
|
||||
|
||||
nsDisplayItemGeometry*
|
||||
nsDisplayXULGroupBorder::AllocateGeometry(nsDisplayListBuilder* aBuilder)
|
||||
nsDisplayXULGroupBackground::AllocateGeometry(nsDisplayListBuilder* aBuilder)
|
||||
{
|
||||
return new nsDisplayItemGenericImageGeometry(this, aBuilder);
|
||||
}
|
||||
|
||||
void
|
||||
nsDisplayXULGroupBorder::ComputeInvalidationRegion(
|
||||
nsDisplayXULGroupBackground::ComputeInvalidationRegion(
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayItemGeometry* aGeometry,
|
||||
nsRegion* aInvalidRegion)
|
||||
|
@ -134,11 +133,11 @@ nsDisplayXULGroupBorder::ComputeInvalidationRegion(
|
|||
}
|
||||
|
||||
void
|
||||
nsDisplayXULGroupBorder::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsDisplayXULGroupBackground::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsRenderingContext* aCtx)
|
||||
{
|
||||
DrawResult result = static_cast<nsGroupBoxFrame*>(mFrame)
|
||||
->PaintBorder(*aCtx, ToReferenceFrame(), mVisibleRect);
|
||||
->PaintBorderBackground(*aCtx, ToReferenceFrame(), mVisibleRect);
|
||||
|
||||
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
||||
}
|
||||
|
@ -150,11 +149,8 @@ nsGroupBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
{
|
||||
// Paint our background and border
|
||||
if (IsVisibleForPainting(aBuilder)) {
|
||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
||||
aBuilder, this, GetBackgroundRectRelativeToSelf(),
|
||||
aLists.BorderBackground());
|
||||
aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
|
||||
nsDisplayXULGroupBorder(aBuilder, this));
|
||||
nsDisplayXULGroupBackground(aBuilder, this));
|
||||
|
||||
DisplayOutline(aBuilder, aLists);
|
||||
}
|
||||
|
@ -162,39 +158,8 @@ nsGroupBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
BuildDisplayListForChildren(aBuilder, aDirtyRect, aLists);
|
||||
}
|
||||
|
||||
nsRect
|
||||
nsGroupBoxFrame::GetBackgroundRectRelativeToSelf(nscoord* aOutYOffset, nsRect* aOutGroupRect)
|
||||
{
|
||||
const nsMargin& border = StyleBorder()->GetComputedBorder();
|
||||
|
||||
nsRect groupRect;
|
||||
nsIFrame* groupBox = GetCaptionBox(groupRect);
|
||||
|
||||
nscoord yoff = 0;
|
||||
if (groupBox) {
|
||||
// If the border is smaller than the legend, move the border down
|
||||
// to be centered on the legend.
|
||||
nsMargin groupMargin;
|
||||
groupBox->StyleMargin()->GetMargin(groupMargin);
|
||||
groupRect.Inflate(groupMargin);
|
||||
|
||||
if (border.top < groupRect.height) {
|
||||
yoff = (groupRect.height - border.top) / 2 + groupRect.y;
|
||||
}
|
||||
}
|
||||
|
||||
if (aOutYOffset) {
|
||||
*aOutYOffset = yoff;
|
||||
}
|
||||
if (aOutGroupRect) {
|
||||
*aOutGroupRect = groupRect;
|
||||
}
|
||||
|
||||
return nsRect(0, yoff, mRect.width, mRect.height - yoff);
|
||||
}
|
||||
|
||||
DrawResult
|
||||
nsGroupBoxFrame::PaintBorder(nsRenderingContext& aRenderingContext,
|
||||
nsGroupBoxFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
|
||||
nsPoint aPt, const nsRect& aDirtyRect) {
|
||||
|
||||
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
|
||||
|
@ -203,16 +168,32 @@ nsGroupBoxFrame::PaintBorder(nsRenderingContext& aRenderingContext,
|
|||
Sides skipSides;
|
||||
const nsStyleBorder* borderStyleData = StyleBorder();
|
||||
const nsMargin& border = borderStyleData->GetComputedBorder();
|
||||
nscoord yoff = 0;
|
||||
nsPresContext* presContext = PresContext();
|
||||
|
||||
nsRect groupRect;
|
||||
nsIFrame* groupBox = GetCaptionBox(groupRect);
|
||||
|
||||
nscoord yoff = 0;
|
||||
nsRect rect = GetBackgroundRectRelativeToSelf(&yoff, &groupRect) + aPt;
|
||||
if (groupBox) {
|
||||
// if the border is smaller than the legend. Move the border down
|
||||
// to be centered on the legend.
|
||||
nsMargin groupMargin;
|
||||
groupBox->StyleMargin()->GetMargin(groupMargin);
|
||||
groupRect.Inflate(groupMargin);
|
||||
|
||||
if (border.top < groupRect.height)
|
||||
yoff = (groupRect.height - border.top)/2 + groupRect.y;
|
||||
}
|
||||
|
||||
nsRect rect(aPt.x, aPt.y + yoff, mRect.width, mRect.height - yoff);
|
||||
|
||||
groupRect += aPt;
|
||||
|
||||
DrawResult result = DrawResult::SUCCESS;
|
||||
DrawResult result =
|
||||
nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
|
||||
aDirtyRect, rect,
|
||||
nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES);
|
||||
|
||||
if (groupBox) {
|
||||
int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче