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:
@@ -886,19 +886,6 @@ RestyleManager::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
|
|||||||
hint |= nsChangeHint_RepaintFrame;
|
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 |
|
if (hint & (nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView |
|
||||||
nsChangeHint_UpdateOpacityLayer | nsChangeHint_UpdateTransformLayer |
|
nsChangeHint_UpdateOpacityLayer | nsChangeHint_UpdateTransformLayer |
|
||||||
nsChangeHint_ChildrenOnlyTransform | nsChangeHint_SchedulePaint)) {
|
nsChangeHint_ChildrenOnlyTransform | nsChangeHint_SchedulePaint)) {
|
||||||
|
|||||||
@@ -194,15 +194,6 @@ enum nsChangeHint {
|
|||||||
*/
|
*/
|
||||||
nsChangeHint_UpdateUsesOpacity = 1 << 25,
|
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
|
// IMPORTANT NOTE: When adding new hints, consider whether you need to
|
||||||
// add them to NS_HintsNotHandledForDescendantsIn() below. Please also
|
// add them to NS_HintsNotHandledForDescendantsIn() below. Please also
|
||||||
// add them to RestyleManager::ChangeHintToString.
|
// add them to RestyleManager::ChangeHintToString.
|
||||||
@@ -312,8 +303,7 @@ inline nsChangeHint operator^=(nsChangeHint& aLeft, nsChangeHint aRight)
|
|||||||
nsChangeHint_ReflowChangesSizeOrPosition | \
|
nsChangeHint_ReflowChangesSizeOrPosition | \
|
||||||
nsChangeHint_ClearAncestorIntrinsics | \
|
nsChangeHint_ClearAncestorIntrinsics | \
|
||||||
nsChangeHint_UpdateComputedBSize | \
|
nsChangeHint_UpdateComputedBSize | \
|
||||||
nsChangeHint_UpdateUsesOpacity | \
|
nsChangeHint_UpdateUsesOpacity)
|
||||||
nsChangeHint_UpdateBackgroundPosition)
|
|
||||||
|
|
||||||
inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint) {
|
inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint) {
|
||||||
nsChangeHint result = nsChangeHint(aChangeHint & (
|
nsChangeHint result = nsChangeHint(aChangeHint & (
|
||||||
@@ -329,8 +319,7 @@ inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint)
|
|||||||
nsChangeHint_UpdateContainingBlock |
|
nsChangeHint_UpdateContainingBlock |
|
||||||
nsChangeHint_BorderStyleNoneChange |
|
nsChangeHint_BorderStyleNoneChange |
|
||||||
nsChangeHint_UpdateComputedBSize |
|
nsChangeHint_UpdateComputedBSize |
|
||||||
nsChangeHint_UpdateUsesOpacity | \
|
nsChangeHint_UpdateUsesOpacity));
|
||||||
nsChangeHint_UpdateBackgroundPosition));
|
|
||||||
|
|
||||||
if (!NS_IsHintSubset(nsChangeHint_NeedDirtyReflow, aChangeHint)) {
|
if (!NS_IsHintSubset(nsChangeHint_NeedDirtyReflow, aChangeHint)) {
|
||||||
if (NS_IsHintSubset(nsChangeHint_NeedReflow, aChangeHint)) {
|
if (NS_IsHintSubset(nsChangeHint_NeedReflow, aChangeHint)) {
|
||||||
|
|||||||
@@ -2310,11 +2310,9 @@ RegisterThemeGeometry(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
|||||||
nsDisplayBackgroundImage::nsDisplayBackgroundImage(nsDisplayListBuilder* aBuilder,
|
nsDisplayBackgroundImage::nsDisplayBackgroundImage(nsDisplayListBuilder* aBuilder,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
uint32_t aLayer,
|
uint32_t aLayer,
|
||||||
const nsRect& aBackgroundRect,
|
|
||||||
const nsStyleBackground* aBackgroundStyle)
|
const nsStyleBackground* aBackgroundStyle)
|
||||||
: nsDisplayImageContainer(aBuilder, aFrame)
|
: nsDisplayImageContainer(aBuilder, aFrame)
|
||||||
, mBackgroundStyle(aBackgroundStyle)
|
, mBackgroundStyle(aBackgroundStyle)
|
||||||
, mBackgroundRect(aBackgroundRect)
|
|
||||||
, mLayer(aLayer)
|
, mLayer(aLayer)
|
||||||
, mIsRasterImage(false)
|
, mIsRasterImage(false)
|
||||||
{
|
{
|
||||||
@@ -2382,12 +2380,13 @@ static nsStyleContext* GetBackgroundStyleContext(nsIFrame* aFrame)
|
|||||||
SetBackgroundClipRegion(DisplayListClipState::AutoSaveRestore& aClipState,
|
SetBackgroundClipRegion(DisplayListClipState::AutoSaveRestore& aClipState,
|
||||||
nsIFrame* aFrame, const nsPoint& aToReferenceFrame,
|
nsIFrame* aFrame, const nsPoint& aToReferenceFrame,
|
||||||
const nsStyleImageLayers::Layer& aLayer,
|
const nsStyleImageLayers::Layer& aLayer,
|
||||||
const nsRect& aBackgroundRect,
|
|
||||||
bool aWillPaintBorder)
|
bool aWillPaintBorder)
|
||||||
{
|
{
|
||||||
|
nsRect borderBox = nsRect(aToReferenceFrame, aFrame->GetSize());
|
||||||
|
|
||||||
nsCSSRendering::ImageLayerClipState clip;
|
nsCSSRendering::ImageLayerClipState clip;
|
||||||
nsCSSRendering::GetImageLayerClip(aLayer, aFrame, *aFrame->StyleBorder(),
|
nsCSSRendering::GetImageLayerClip(aLayer, aFrame, *aFrame->StyleBorder(),
|
||||||
aBackgroundRect, aBackgroundRect, aWillPaintBorder,
|
borderBox, borderBox, aWillPaintBorder,
|
||||||
aFrame->PresContext()->AppUnitsPerDevPixel(),
|
aFrame->PresContext()->AppUnitsPerDevPixel(),
|
||||||
&clip);
|
&clip);
|
||||||
|
|
||||||
@@ -2403,13 +2402,10 @@ SetBackgroundClipRegion(DisplayListClipState::AutoSaveRestore& aClipState,
|
|||||||
/*static*/ bool
|
/*static*/ bool
|
||||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuilder,
|
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuilder,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
const nsRect& aBackgroundRect,
|
nsDisplayList* aList)
|
||||||
nsDisplayList* aList,
|
|
||||||
bool aAllowWillPaintBorderOptimization)
|
|
||||||
{
|
{
|
||||||
nsStyleContext* bgSC = nullptr;
|
nsStyleContext* bgSC = nullptr;
|
||||||
const nsStyleBackground* bg = nullptr;
|
const nsStyleBackground* bg = nullptr;
|
||||||
nsRect bgRect = aBackgroundRect + aBuilder->ToReferenceFrame(aFrame);
|
|
||||||
nsPresContext* presContext = aFrame->PresContext();
|
nsPresContext* presContext = aFrame->PresContext();
|
||||||
bool isThemed = aFrame->IsThemed();
|
bool isThemed = aFrame->IsThemed();
|
||||||
if (!isThemed) {
|
if (!isThemed) {
|
||||||
@@ -2434,8 +2430,7 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
|
|||||||
const nsStyleEffects* effectsStyle = aFrame->StyleEffects();
|
const nsStyleEffects* effectsStyle = aFrame->StyleEffects();
|
||||||
bool hasInsetShadow = effectsStyle->mBoxShadow &&
|
bool hasInsetShadow = effectsStyle->mBoxShadow &&
|
||||||
effectsStyle->mBoxShadow->HasShadowWithInset(true);
|
effectsStyle->mBoxShadow->HasShadowWithInset(true);
|
||||||
bool willPaintBorder = aAllowWillPaintBorderOptimization &&
|
bool willPaintBorder = !isThemed && !hasInsetShadow &&
|
||||||
!isThemed && !hasInsetShadow &&
|
|
||||||
borderStyle->HasBorder();
|
borderStyle->HasBorder();
|
||||||
|
|
||||||
nsPoint toRef = aBuilder->ToReferenceFrame(aFrame);
|
nsPoint toRef = aBuilder->ToReferenceFrame(aFrame);
|
||||||
@@ -2460,11 +2455,11 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
|
|||||||
bool useWillPaintBorderOptimization = willPaintBorder &&
|
bool useWillPaintBorderOptimization = willPaintBorder &&
|
||||||
nsLayoutUtils::HasNonZeroCorner(borderStyle->mBorderRadius);
|
nsLayoutUtils::HasNonZeroCorner(borderStyle->mBorderRadius);
|
||||||
SetBackgroundClipRegion(clipState, aFrame, toRef,
|
SetBackgroundClipRegion(clipState, aFrame, toRef,
|
||||||
bg->BottomLayer(), bgRect,
|
bg->BottomLayer(),
|
||||||
useWillPaintBorderOptimization);
|
useWillPaintBorderOptimization);
|
||||||
}
|
}
|
||||||
bgItemList.AppendNewToTop(
|
bgItemList.AppendNewToTop(
|
||||||
new (aBuilder) nsDisplayBackgroundColor(aBuilder, aFrame, bgRect, bg,
|
new (aBuilder) nsDisplayBackgroundColor(aBuilder, aFrame, bg,
|
||||||
drawBackgroundColor ? color : NS_RGBA(0, 0, 0, 0)));
|
drawBackgroundColor ? color : NS_RGBA(0, 0, 0, 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2476,7 +2471,7 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
|
|||||||
new (aBuilder) nsDisplayClearBackground(aBuilder, aFrame));
|
new (aBuilder) nsDisplayClearBackground(aBuilder, aFrame));
|
||||||
}
|
}
|
||||||
nsDisplayThemedBackground* bgItem =
|
nsDisplayThemedBackground* bgItem =
|
||||||
new (aBuilder) nsDisplayThemedBackground(aBuilder, aFrame, bgRect);
|
new (aBuilder) nsDisplayThemedBackground(aBuilder, aFrame);
|
||||||
bgItemList.AppendNewToTop(bgItem);
|
bgItemList.AppendNewToTop(bgItem);
|
||||||
aList->AppendToTop(&bgItemList);
|
aList->AppendToTop(&bgItemList);
|
||||||
return true;
|
return true;
|
||||||
@@ -2507,12 +2502,12 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
|
|||||||
if (!aBuilder->IsForEventDelivery()) {
|
if (!aBuilder->IsForEventDelivery()) {
|
||||||
const nsStyleImageLayers::Layer& layer = bg->mImage.mLayers[i];
|
const nsStyleImageLayers::Layer& layer = bg->mImage.mLayers[i];
|
||||||
SetBackgroundClipRegion(clipState, aFrame, toRef,
|
SetBackgroundClipRegion(clipState, aFrame, toRef,
|
||||||
layer, bgRect, willPaintBorder);
|
layer, willPaintBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDisplayList thisItemList;
|
nsDisplayList thisItemList;
|
||||||
nsDisplayBackgroundImage* bgItem =
|
nsDisplayBackgroundImage* bgItem =
|
||||||
new (aBuilder) nsDisplayBackgroundImage(aBuilder, aFrame, i, bgRect, bg);
|
new (aBuilder) nsDisplayBackgroundImage(aBuilder, aFrame, i, bg);
|
||||||
|
|
||||||
if (bgItem->ShouldFixToViewport(aBuilder)) {
|
if (bgItem->ShouldFixToViewport(aBuilder)) {
|
||||||
thisItemList.AppendNewToTop(
|
thisItemList.AppendNewToTop(
|
||||||
@@ -2779,8 +2774,7 @@ nsDisplayBackgroundImage::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
|||||||
/* static */ nsRegion
|
/* static */ nsRegion
|
||||||
nsDisplayBackgroundImage::GetInsideClipRegion(nsDisplayItem* aItem,
|
nsDisplayBackgroundImage::GetInsideClipRegion(nsDisplayItem* aItem,
|
||||||
uint8_t aClip,
|
uint8_t aClip,
|
||||||
const nsRect& aRect,
|
const nsRect& aRect)
|
||||||
const nsRect& aBackgroundRect)
|
|
||||||
{
|
{
|
||||||
nsRegion result;
|
nsRegion result;
|
||||||
if (aRect.IsEmpty())
|
if (aRect.IsEmpty())
|
||||||
@@ -2788,18 +2782,26 @@ nsDisplayBackgroundImage::GetInsideClipRegion(nsDisplayItem* aItem,
|
|||||||
|
|
||||||
nsIFrame *frame = aItem->Frame();
|
nsIFrame *frame = aItem->Frame();
|
||||||
|
|
||||||
nsRect clipRect = aBackgroundRect;
|
nsRect clipRect;
|
||||||
if (frame->GetType() == nsGkAtoms::canvasFrame) {
|
if (frame->GetType() == nsGkAtoms::canvasFrame) {
|
||||||
nsCanvasFrame* canvasFrame = static_cast<nsCanvasFrame*>(frame);
|
nsCanvasFrame* canvasFrame = static_cast<nsCanvasFrame*>(frame);
|
||||||
clipRect = canvasFrame->CanvasArea() + aItem->ToReferenceFrame();
|
clipRect = canvasFrame->CanvasArea() + aItem->ToReferenceFrame();
|
||||||
} else if (aClip == NS_STYLE_IMAGELAYER_CLIP_PADDING ||
|
} else {
|
||||||
aClip == NS_STYLE_IMAGELAYER_CLIP_CONTENT) {
|
switch (aClip) {
|
||||||
nsMargin border = frame->GetUsedBorder();
|
case NS_STYLE_IMAGELAYER_CLIP_BORDER:
|
||||||
if (aClip == NS_STYLE_IMAGELAYER_CLIP_CONTENT) {
|
case NS_STYLE_IMAGELAYER_CLIP_TEXT:
|
||||||
border += frame->GetUsedPadding();
|
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);
|
return clipRect.Intersect(aRect);
|
||||||
@@ -2827,7 +2829,7 @@ nsDisplayBackgroundImage::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
|||||||
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mImage.mLayers[mLayer];
|
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mImage.mLayers[mLayer];
|
||||||
if (layer.mImage.IsOpaque() && layer.mBlendMode == NS_STYLE_BLEND_NORMAL &&
|
if (layer.mImage.IsOpaque() && layer.mBlendMode == NS_STYLE_BLEND_NORMAL &&
|
||||||
layer.mClip != NS_STYLE_IMAGELAYER_CLIP_TEXT) {
|
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;
|
bool transformedFixed;
|
||||||
return nsCSSRendering::ComputeImageLayerPositioningArea(
|
return nsCSSRendering::ComputeImageLayerPositioningArea(
|
||||||
mFrame->PresContext(), mFrame,
|
mFrame->PresContext(), mFrame,
|
||||||
mBackgroundRect,
|
nsRect(ToReferenceFrame(), mFrame->GetSize()),
|
||||||
mBackgroundStyle->mImage.mLayers[mLayer],
|
mBackgroundStyle->mImage.mLayers[mLayer],
|
||||||
&attachedToFrame,
|
&attachedToFrame,
|
||||||
&transformedFixed) + ToReferenceFrame();
|
&transformedFixed) + ToReferenceFrame();
|
||||||
@@ -2905,18 +2907,19 @@ nsDisplayBackgroundImage::PaintInternal(nsDisplayListBuilder* aBuilder,
|
|||||||
uint32_t flags = aBuilder->GetBackgroundPaintFlags();
|
uint32_t flags = aBuilder->GetBackgroundPaintFlags();
|
||||||
CheckForBorderItem(this, flags);
|
CheckForBorderItem(this, flags);
|
||||||
|
|
||||||
|
nsRect borderBox = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||||
gfxContext* ctx = aCtx->ThebesContext();
|
gfxContext* ctx = aCtx->ThebesContext();
|
||||||
uint8_t clip = mBackgroundStyle->mImage.mLayers[mLayer].mClip;
|
uint8_t clip = mBackgroundStyle->mImage.mLayers[mLayer].mClip;
|
||||||
|
|
||||||
if (clip == NS_STYLE_IMAGELAYER_CLIP_TEXT) {
|
if (clip == NS_STYLE_IMAGELAYER_CLIP_TEXT) {
|
||||||
ctx->Save();
|
ctx->Save();
|
||||||
ClipBackgroundByText(mFrame, aCtx, mBackgroundRect);
|
ClipBackgroundByText(mFrame, aCtx, borderBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
image::DrawResult result =
|
image::DrawResult result =
|
||||||
nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
|
nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
|
||||||
aBounds,
|
aBounds,
|
||||||
mBackgroundRect,
|
borderBox,
|
||||||
flags, aClipRect, mLayer,
|
flags, aClipRect, mLayer,
|
||||||
CompositionOp::OP_OVER);
|
CompositionOp::OP_OVER);
|
||||||
|
|
||||||
@@ -2991,7 +2994,8 @@ nsDisplayBackgroundImage::GetBoundsInternal(nsDisplayListBuilder* aBuilder) {
|
|||||||
return nsRect();
|
return nsRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRect clipRect = mBackgroundRect;
|
nsRect borderBox = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||||
|
nsRect clipRect = borderBox;
|
||||||
if (mFrame->GetType() == nsGkAtoms::canvasFrame) {
|
if (mFrame->GetType() == nsGkAtoms::canvasFrame) {
|
||||||
nsCanvasFrame* frame = static_cast<nsCanvasFrame*>(mFrame);
|
nsCanvasFrame* frame = static_cast<nsCanvasFrame*>(mFrame);
|
||||||
clipRect = frame->CanvasArea() + ToReferenceFrame();
|
clipRect = frame->CanvasArea() + ToReferenceFrame();
|
||||||
@@ -3007,7 +3011,7 @@ nsDisplayBackgroundImage::GetBoundsInternal(nsDisplayListBuilder* aBuilder) {
|
|||||||
}
|
}
|
||||||
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mImage.mLayers[mLayer];
|
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mImage.mLayers[mLayer];
|
||||||
return nsCSSRendering::GetBackgroundLayerRect(presContext, mFrame,
|
return nsCSSRendering::GetBackgroundLayerRect(presContext, mFrame,
|
||||||
mBackgroundRect, clipRect, layer,
|
borderBox, clipRect, layer,
|
||||||
aBuilder->GetBackgroundPaintFlags());
|
aBuilder->GetBackgroundPaintFlags());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3019,10 +3023,8 @@ nsDisplayBackgroundImage::GetPerFrameKey()
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsDisplayThemedBackground::nsDisplayThemedBackground(nsDisplayListBuilder* aBuilder,
|
nsDisplayThemedBackground::nsDisplayThemedBackground(nsDisplayListBuilder* aBuilder,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame)
|
||||||
const nsRect& aBackgroundRect)
|
|
||||||
: nsDisplayItem(aBuilder, aFrame)
|
: nsDisplayItem(aBuilder, aFrame)
|
||||||
, mBackgroundRect(aBackgroundRect)
|
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(nsDisplayThemedBackground);
|
MOZ_COUNT_CTOR(nsDisplayThemedBackground);
|
||||||
|
|
||||||
@@ -3065,8 +3067,8 @@ nsDisplayThemedBackground::HitTest(nsDisplayListBuilder* aBuilder,
|
|||||||
HitTestState* aState,
|
HitTestState* aState,
|
||||||
nsTArray<nsIFrame*> *aOutFrames)
|
nsTArray<nsIFrame*> *aOutFrames)
|
||||||
{
|
{
|
||||||
// Assume that any point in our background rect is a hit.
|
// Assume that any point in our border rect is a hit.
|
||||||
if (mBackgroundRect.Intersects(aRect)) {
|
if (nsRect(ToReferenceFrame(), mFrame->GetSize()).Intersects(aRect)) {
|
||||||
aOutFrames->AppendElement(mFrame);
|
aOutFrames->AppendElement(mFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3078,7 +3080,7 @@ nsDisplayThemedBackground::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
|||||||
*aSnap = false;
|
*aSnap = false;
|
||||||
|
|
||||||
if (mThemeTransparency == nsITheme::eOpaque) {
|
if (mThemeTransparency == nsITheme::eOpaque) {
|
||||||
result = mBackgroundRect;
|
result = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -3103,7 +3105,7 @@ nsDisplayThemedBackground::ProvidesFontSmoothingBackgroundColor(nscolor* aColor)
|
|||||||
nsRect
|
nsRect
|
||||||
nsDisplayThemedBackground::GetPositioningArea()
|
nsDisplayThemedBackground::GetPositioningArea()
|
||||||
{
|
{
|
||||||
return mBackgroundRect;
|
return nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -3122,11 +3124,12 @@ nsDisplayThemedBackground::PaintInternal(nsDisplayListBuilder* aBuilder,
|
|||||||
// XXXzw this ignores aClipRect.
|
// XXXzw this ignores aClipRect.
|
||||||
nsPresContext* presContext = mFrame->PresContext();
|
nsPresContext* presContext = mFrame->PresContext();
|
||||||
nsITheme *theme = presContext->GetTheme();
|
nsITheme *theme = presContext->GetTheme();
|
||||||
nsRect drawing(mBackgroundRect);
|
nsRect borderArea(ToReferenceFrame(), mFrame->GetSize());
|
||||||
|
nsRect drawing(borderArea);
|
||||||
theme->GetWidgetOverflow(presContext->DeviceContext(), mFrame, mAppearance,
|
theme->GetWidgetOverflow(presContext->DeviceContext(), mFrame, mAppearance,
|
||||||
&drawing);
|
&drawing);
|
||||||
drawing.IntersectRect(drawing, aBounds);
|
drawing.IntersectRect(drawing, aBounds);
|
||||||
theme->DrawWidgetBackground(aCtx, mFrame, mAppearance, mBackgroundRect, drawing);
|
theme->DrawWidgetBackground(aCtx, mFrame, mAppearance, borderArea, drawing);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsDisplayThemedBackground::IsWindowActive()
|
bool nsDisplayThemedBackground::IsWindowActive()
|
||||||
@@ -3171,7 +3174,7 @@ nsRect
|
|||||||
nsDisplayThemedBackground::GetBoundsInternal() {
|
nsDisplayThemedBackground::GetBoundsInternal() {
|
||||||
nsPresContext* presContext = mFrame->PresContext();
|
nsPresContext* presContext = mFrame->PresContext();
|
||||||
|
|
||||||
nsRect r = mBackgroundRect - ToReferenceFrame();
|
nsRect r(nsPoint(0,0), mFrame->GetSize());
|
||||||
presContext->GetTheme()->
|
presContext->GetTheme()->
|
||||||
GetWidgetOverflow(presContext->DeviceContext(), mFrame,
|
GetWidgetOverflow(presContext->DeviceContext(), mFrame,
|
||||||
mFrame->StyleDisplay()->mAppearance, &r);
|
mFrame->StyleDisplay()->mAppearance, &r);
|
||||||
@@ -3316,6 +3319,8 @@ nsDisplayBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsRect borderBox = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1148418#c21 for why this
|
// 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
|
// results in a precision induced rounding issue that makes the rect one
|
||||||
@@ -3329,7 +3334,7 @@ nsDisplayBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,
|
|||||||
|
|
||||||
DrawTarget& aDrawTarget = *aCtx->GetDrawTarget();
|
DrawTarget& aDrawTarget = *aCtx->GetDrawTarget();
|
||||||
|
|
||||||
Rect rect = NSRectToSnappedRect(mBackgroundRect,
|
Rect rect = NSRectToSnappedRect(borderBox,
|
||||||
mFrame->PresContext()->AppUnitsPerDevPixel(),
|
mFrame->PresContext()->AppUnitsPerDevPixel(),
|
||||||
aDrawTarget);
|
aDrawTarget);
|
||||||
ColorPattern color(ToDeviceColor(mColor));
|
ColorPattern color(ToDeviceColor(mColor));
|
||||||
@@ -3341,7 +3346,7 @@ nsDisplayBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,
|
|||||||
if (clip == NS_STYLE_IMAGELAYER_CLIP_TEXT) {
|
if (clip == NS_STYLE_IMAGELAYER_CLIP_TEXT) {
|
||||||
gfxContextAutoSaveRestore save(ctx);
|
gfxContextAutoSaveRestore save(ctx);
|
||||||
|
|
||||||
ClipBackgroundByText(mFrame, aCtx, mBackgroundRect);
|
ClipBackgroundByText(mFrame, aCtx, borderBox);
|
||||||
ctx->SetColor(mColor);
|
ctx->SetColor(mColor);
|
||||||
ctx->Fill();
|
ctx->Fill();
|
||||||
|
|
||||||
@@ -3349,7 +3354,7 @@ nsDisplayBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,
|
|||||||
}
|
}
|
||||||
|
|
||||||
gfxRect bounds =
|
gfxRect bounds =
|
||||||
nsLayoutUtils::RectToGfxRect(mBackgroundRect, mFrame->PresContext()->AppUnitsPerDevPixel());
|
nsLayoutUtils::RectToGfxRect(borderBox, mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||||
|
|
||||||
ctx->SetColor(mColor);
|
ctx->SetColor(mColor);
|
||||||
ctx->NewPath();
|
ctx->NewPath();
|
||||||
@@ -3374,8 +3379,9 @@ nsDisplayBackgroundColor::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
|||||||
*aSnap = true;
|
*aSnap = true;
|
||||||
|
|
||||||
const nsStyleImageLayers::Layer& bottomLayer = mBackgroundStyle->BottomLayer();
|
const nsStyleImageLayers::Layer& bottomLayer = mBackgroundStyle->BottomLayer();
|
||||||
|
nsRect borderBox = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||||
return nsDisplayBackgroundImage::GetInsideClipRegion(this, bottomLayer.mClip,
|
return nsDisplayBackgroundImage::GetInsideClipRegion(this, bottomLayer.mClip,
|
||||||
mBackgroundRect, mBackgroundRect);
|
borderBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|||||||
@@ -2661,23 +2661,17 @@ public:
|
|||||||
* aIsThemed should be the value of aFrame->IsThemed.
|
* aIsThemed should be the value of aFrame->IsThemed.
|
||||||
* aBackgroundStyle should be the result of
|
* aBackgroundStyle should be the result of
|
||||||
* nsCSSRendering::FindBackground, or null if FindBackground returned false.
|
* nsCSSRendering::FindBackground, or null if FindBackground returned false.
|
||||||
* aBackgroundRect is relative to aFrame.
|
|
||||||
*/
|
*/
|
||||||
nsDisplayBackgroundImage(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
nsDisplayBackgroundImage(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||||
uint32_t aLayer, const nsRect& aBackgroundRect,
|
uint32_t aLayer,
|
||||||
const nsStyleBackground* aBackgroundStyle);
|
const nsStyleBackground* aBackgroundStyle);
|
||||||
virtual ~nsDisplayBackgroundImage();
|
virtual ~nsDisplayBackgroundImage();
|
||||||
|
|
||||||
// This will create and append new items for all the layers of the
|
// This will create and append new items for all the layers of the
|
||||||
// background. Returns whether we appended a themed background.
|
// 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,
|
static bool AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuilder,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
const nsRect& aBackgroundRect,
|
nsDisplayList* aList);
|
||||||
nsDisplayList* aList,
|
|
||||||
bool aAllowWillPaintBorderOptimization = true);
|
|
||||||
|
|
||||||
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
|
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||||
LayerManager* aManager,
|
LayerManager* aManager,
|
||||||
@@ -2733,7 +2727,7 @@ public:
|
|||||||
virtual nsRect GetDestRect() override;
|
virtual nsRect GetDestRect() override;
|
||||||
|
|
||||||
static nsRegion GetInsideClipRegion(nsDisplayItem* aItem, uint8_t aClip,
|
static nsRegion GetInsideClipRegion(nsDisplayItem* aItem, uint8_t aClip,
|
||||||
const nsRect& aRect, const nsRect& aBackgroundRect);
|
const nsRect& aRect);
|
||||||
|
|
||||||
virtual bool ShouldFixToViewport(nsDisplayListBuilder* aBuilder) override;
|
virtual bool ShouldFixToViewport(nsDisplayListBuilder* aBuilder) override;
|
||||||
|
|
||||||
@@ -2764,7 +2758,6 @@ protected:
|
|||||||
// mIsThemed is true or if FindBackground returned false.
|
// mIsThemed is true or if FindBackground returned false.
|
||||||
const nsStyleBackground* mBackgroundStyle;
|
const nsStyleBackground* mBackgroundStyle;
|
||||||
nsCOMPtr<imgIContainer> mImage;
|
nsCOMPtr<imgIContainer> mImage;
|
||||||
nsRect mBackgroundRect; // relative to the reference frame
|
|
||||||
nsRect mFillRect;
|
nsRect mFillRect;
|
||||||
nsRect mDestRect;
|
nsRect mDestRect;
|
||||||
/* Bounds of this display item */
|
/* Bounds of this display item */
|
||||||
@@ -2781,8 +2774,7 @@ protected:
|
|||||||
*/
|
*/
|
||||||
class nsDisplayThemedBackground : public nsDisplayItem {
|
class nsDisplayThemedBackground : public nsDisplayItem {
|
||||||
public:
|
public:
|
||||||
nsDisplayThemedBackground(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
nsDisplayThemedBackground(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame);
|
||||||
const nsRect& aBackgroundRect);
|
|
||||||
virtual ~nsDisplayThemedBackground();
|
virtual ~nsDisplayThemedBackground();
|
||||||
|
|
||||||
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
||||||
@@ -2828,7 +2820,6 @@ protected:
|
|||||||
void PaintInternal(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx,
|
void PaintInternal(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx,
|
||||||
const nsRect& aBounds, nsRect* aClipRect);
|
const nsRect& aBounds, nsRect* aClipRect);
|
||||||
|
|
||||||
nsRect mBackgroundRect;
|
|
||||||
nsRect mBounds;
|
nsRect mBounds;
|
||||||
nsITheme::Transparency mThemeTransparency;
|
nsITheme::Transparency mThemeTransparency;
|
||||||
uint8_t mAppearance;
|
uint8_t mAppearance;
|
||||||
@@ -2840,11 +2831,9 @@ class nsDisplayBackgroundColor : public nsDisplayItem
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
nsDisplayBackgroundColor(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
nsDisplayBackgroundColor(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||||
const nsRect& aBackgroundRect,
|
|
||||||
const nsStyleBackground* aBackgroundStyle,
|
const nsStyleBackground* aBackgroundStyle,
|
||||||
nscolor aColor)
|
nscolor aColor)
|
||||||
: nsDisplayItem(aBuilder, aFrame)
|
: nsDisplayItem(aBuilder, aFrame)
|
||||||
, mBackgroundRect(aBackgroundRect)
|
|
||||||
, mBackgroundStyle(aBackgroundStyle)
|
, mBackgroundStyle(aBackgroundStyle)
|
||||||
, mColor(Color::FromABGR(aColor))
|
, mColor(Color::FromABGR(aColor))
|
||||||
{ }
|
{ }
|
||||||
@@ -2865,7 +2854,7 @@ public:
|
|||||||
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) override
|
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) override
|
||||||
{
|
{
|
||||||
*aSnap = true;
|
*aSnap = true;
|
||||||
return mBackgroundRect;
|
return nsRect(ToReferenceFrame(), Frame()->GetSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override
|
virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override
|
||||||
@@ -2890,7 +2879,6 @@ public:
|
|||||||
virtual void WriteDebugInfo(std::stringstream& aStream) override;
|
virtual void WriteDebugInfo(std::stringstream& aStream) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const nsRect mBackgroundRect;
|
|
||||||
const nsStyleBackground* mBackgroundStyle;
|
const nsStyleBackground* mBackgroundStyle;
|
||||||
mozilla::gfx::Color mColor;
|
mozilla::gfx::Color mColor;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -112,18 +112,19 @@ nsDisplayButtonBoxShadowOuter::Paint(nsDisplayListBuilder* aBuilder,
|
|||||||
buttonRect, mVisibleRect);
|
buttonRect, mVisibleRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
class nsDisplayButtonBorder : public nsDisplayItem {
|
class nsDisplayButtonBorderBackground : public nsDisplayItem {
|
||||||
public:
|
public:
|
||||||
nsDisplayButtonBorder(nsDisplayListBuilder* aBuilder,
|
nsDisplayButtonBorderBackground(nsDisplayListBuilder* aBuilder,
|
||||||
nsButtonFrameRenderer* aRenderer)
|
nsButtonFrameRenderer* aRenderer)
|
||||||
: nsDisplayItem(aBuilder, aRenderer->GetFrame()), mBFR(aRenderer) {
|
: nsDisplayItem(aBuilder, aRenderer->GetFrame()), mBFR(aRenderer) {
|
||||||
MOZ_COUNT_CTOR(nsDisplayButtonBorder);
|
MOZ_COUNT_CTOR(nsDisplayButtonBorderBackground);
|
||||||
}
|
}
|
||||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||||
virtual ~nsDisplayButtonBorder() {
|
virtual ~nsDisplayButtonBorderBackground() {
|
||||||
MOZ_COUNT_DTOR(nsDisplayButtonBorder);
|
MOZ_COUNT_DTOR(nsDisplayButtonBorderBackground);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
||||||
HitTestState* aState,
|
HitTestState* aState,
|
||||||
nsTArray<nsIFrame*> *aOutFrames) override {
|
nsTArray<nsIFrame*> *aOutFrames) override {
|
||||||
@@ -143,13 +144,13 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
nsDisplayItemGeometry*
|
nsDisplayItemGeometry*
|
||||||
nsDisplayButtonBorder::AllocateGeometry(nsDisplayListBuilder* aBuilder)
|
nsDisplayButtonBorderBackground::AllocateGeometry(nsDisplayListBuilder* aBuilder)
|
||||||
{
|
{
|
||||||
return new nsDisplayItemGenericImageGeometry(this, aBuilder);
|
return new nsDisplayItemGenericImageGeometry(this, aBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsDisplayButtonBorder::ComputeInvalidationRegion(
|
nsDisplayButtonBorderBackground::ComputeInvalidationRegion(
|
||||||
nsDisplayListBuilder* aBuilder,
|
nsDisplayListBuilder* aBuilder,
|
||||||
const nsDisplayItemGeometry* aGeometry,
|
const nsDisplayItemGeometry* aGeometry,
|
||||||
nsRegion *aInvalidRegion)
|
nsRegion *aInvalidRegion)
|
||||||
@@ -166,22 +167,22 @@ nsDisplayButtonBorder::ComputeInvalidationRegion(
|
|||||||
nsDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
|
nsDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsDisplayButtonBorder::Paint(nsDisplayListBuilder* aBuilder,
|
void nsDisplayButtonBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
|
||||||
nsRenderingContext* aCtx)
|
nsRenderingContext* aCtx)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mFrame, "No frame?");
|
NS_ASSERTION(mFrame, "No frame?");
|
||||||
nsPresContext* pc = mFrame->PresContext();
|
nsPresContext* pc = mFrame->PresContext();
|
||||||
nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||||
|
|
||||||
// draw the border and background inside the focus and outline borders
|
// draw the border and background inside the focus and outline borders
|
||||||
DrawResult result =
|
DrawResult result =
|
||||||
mBFR->PaintBorder(aBuilder, pc, *aCtx, mVisibleRect, r);
|
mBFR->PaintBorderAndBackground(aBuilder, pc, *aCtx, mVisibleRect, r);
|
||||||
|
|
||||||
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRect
|
nsRect
|
||||||
nsDisplayButtonBorder::GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) {
|
nsDisplayButtonBorderBackground::GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) {
|
||||||
*aSnap = false;
|
*aSnap = false;
|
||||||
return aBuilder->IsForEventDelivery() ? nsRect(ToReferenceFrame(), mFrame->GetSize())
|
return aBuilder->IsForEventDelivery() ? nsRect(ToReferenceFrame(), mFrame->GetSize())
|
||||||
: mFrame->GetVisualOverflowRectRelativeToSelf() + ToReferenceFrame();
|
: mFrame->GetVisualOverflowRectRelativeToSelf() + ToReferenceFrame();
|
||||||
@@ -263,14 +264,10 @@ nsButtonFrameRenderer::DisplayButton(nsDisplayListBuilder* aBuilder,
|
|||||||
nsDisplayButtonBoxShadowOuter(aBuilder, this));
|
nsDisplayButtonBoxShadowOuter(aBuilder, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRect buttonRect;
|
// Almost all buttons draw some kind of background so there's not much
|
||||||
GetButtonRect(mFrame->GetRectRelativeToSelf(), buttonRect);
|
// point in checking whether we should create this item.
|
||||||
|
|
||||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
|
||||||
aBuilder, mFrame, buttonRect, aBackground);
|
|
||||||
|
|
||||||
aBackground->AppendNewToTop(new (aBuilder)
|
aBackground->AppendNewToTop(new (aBuilder)
|
||||||
nsDisplayButtonBorder(aBuilder, this));
|
nsDisplayButtonBorderBackground(aBuilder, this));
|
||||||
|
|
||||||
// Only display focus rings if we actually have them. Since at most one
|
// 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.
|
// button would normally display a focus ring, most buttons won't have them.
|
||||||
@@ -328,8 +325,9 @@ nsButtonFrameRenderer::PaintOutlineAndFocusBorders(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DrawResult
|
DrawResult
|
||||||
nsButtonFrameRenderer::PaintBorder(
|
nsButtonFrameRenderer::PaintBorderAndBackground(
|
||||||
nsDisplayListBuilder* aBuilder,
|
nsDisplayListBuilder* aBuilder,
|
||||||
nsPresContext* aPresContext,
|
nsPresContext* aPresContext,
|
||||||
nsRenderingContext& aRenderingContext,
|
nsRenderingContext& aRenderingContext,
|
||||||
@@ -342,14 +340,19 @@ nsButtonFrameRenderer::PaintBorder(
|
|||||||
|
|
||||||
nsStyleContext* context = mFrame->StyleContext();
|
nsStyleContext* context = mFrame->StyleContext();
|
||||||
|
|
||||||
|
uint32_t bgFlags = aBuilder->GetBackgroundPaintFlags();
|
||||||
PaintBorderFlags borderFlags = aBuilder->ShouldSyncDecodeImages()
|
PaintBorderFlags borderFlags = aBuilder->ShouldSyncDecodeImages()
|
||||||
? PaintBorderFlags::SYNC_DECODE_IMAGES
|
? PaintBorderFlags::SYNC_DECODE_IMAGES
|
||||||
: PaintBorderFlags();
|
: PaintBorderFlags();
|
||||||
|
|
||||||
|
DrawResult result =
|
||||||
|
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame,
|
||||||
|
aDirtyRect, buttonRect, bgFlags);
|
||||||
|
|
||||||
nsCSSRendering::PaintBoxShadowInner(aPresContext, aRenderingContext,
|
nsCSSRendering::PaintBoxShadowInner(aPresContext, aRenderingContext,
|
||||||
mFrame, buttonRect);
|
mFrame, buttonRect);
|
||||||
|
|
||||||
DrawResult result =
|
result &=
|
||||||
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
|
||||||
aDirtyRect, buttonRect, context, borderFlags);
|
aDirtyRect, buttonRect, context, borderFlags);
|
||||||
|
|
||||||
|
|||||||
@@ -45,11 +45,11 @@ public:
|
|||||||
const nsRect& aDirtyRect,
|
const nsRect& aDirtyRect,
|
||||||
const nsRect& aRect);
|
const nsRect& aRect);
|
||||||
|
|
||||||
DrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
|
DrawResult PaintBorderAndBackground(nsDisplayListBuilder* aBuilder,
|
||||||
nsPresContext* aPresContext,
|
nsPresContext* aPresContext,
|
||||||
nsRenderingContext& aRenderingContext,
|
nsRenderingContext& aRenderingContext,
|
||||||
const nsRect& aDirtyRect,
|
const nsRect& aDirtyRect,
|
||||||
const nsRect& aRect);
|
const nsRect& aRect);
|
||||||
|
|
||||||
void SetFrame(nsFrame* aFrame, nsPresContext* aPresContext);
|
void SetFrame(nsFrame* aFrame, nsPresContext* aPresContext);
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ public:
|
|||||||
MOZ_COUNT_DTOR(nsDisplayFieldSetBorderBackground);
|
MOZ_COUNT_DTOR(nsDisplayFieldSetBorderBackground);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
||||||
HitTestState* aState,
|
HitTestState* aState,
|
||||||
nsTArray<nsIFrame*> *aOutFrames) override;
|
nsTArray<nsIFrame*> *aOutFrames) override;
|
||||||
@@ -127,7 +128,7 @@ nsDisplayFieldSetBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
|
|||||||
nsRenderingContext* aCtx)
|
nsRenderingContext* aCtx)
|
||||||
{
|
{
|
||||||
DrawResult result = static_cast<nsFieldSetFrame*>(mFrame)->
|
DrawResult result = static_cast<nsFieldSetFrame*>(mFrame)->
|
||||||
PaintBorder(aBuilder, *aCtx, ToReferenceFrame(), mVisibleRect);
|
PaintBorderBackground(aBuilder, *aCtx, ToReferenceFrame(), mVisibleRect);
|
||||||
|
|
||||||
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
||||||
}
|
}
|
||||||
@@ -170,11 +171,8 @@ nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||||||
nsDisplayBoxShadowOuter(aBuilder, this));
|
nsDisplayBoxShadowOuter(aBuilder, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
// don't bother checking to see if we really have a border or background.
|
||||||
aBuilder, this, VisualBorderRectRelativeToSelf(),
|
// we usually will have a border.
|
||||||
aLists.BorderBackground(),
|
|
||||||
/* aAllowWillPaintBorderOptimization = */ false);
|
|
||||||
|
|
||||||
aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
|
aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
|
||||||
nsDisplayFieldSetBorderBackground(aBuilder, this));
|
nsDisplayFieldSetBorderBackground(aBuilder, this));
|
||||||
|
|
||||||
@@ -211,7 +209,7 @@ nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DrawResult
|
DrawResult
|
||||||
nsFieldSetFrame::PaintBorder(
|
nsFieldSetFrame::PaintBorderBackground(
|
||||||
nsDisplayListBuilder* aBuilder,
|
nsDisplayListBuilder* aBuilder,
|
||||||
nsRenderingContext& aRenderingContext,
|
nsRenderingContext& aRenderingContext,
|
||||||
nsPoint aPt,
|
nsPoint aPt,
|
||||||
@@ -227,11 +225,14 @@ nsFieldSetFrame::PaintBorder(
|
|||||||
rect += aPt;
|
rect += aPt;
|
||||||
nsPresContext* presContext = PresContext();
|
nsPresContext* presContext = PresContext();
|
||||||
|
|
||||||
|
uint32_t bgFlags = aBuilder->GetBackgroundPaintFlags();
|
||||||
PaintBorderFlags borderFlags = aBuilder->ShouldSyncDecodeImages()
|
PaintBorderFlags borderFlags = aBuilder->ShouldSyncDecodeImages()
|
||||||
? PaintBorderFlags::SYNC_DECODE_IMAGES
|
? PaintBorderFlags::SYNC_DECODE_IMAGES
|
||||||
: PaintBorderFlags();
|
: PaintBorderFlags();
|
||||||
|
|
||||||
DrawResult result = DrawResult::SUCCESS;
|
DrawResult result =
|
||||||
|
nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
|
||||||
|
aDirtyRect, rect, bgFlags);
|
||||||
|
|
||||||
nsCSSRendering::PaintBoxShadowInner(presContext, aRenderingContext,
|
nsCSSRendering::PaintBoxShadowInner(presContext, aRenderingContext,
|
||||||
this, rect);
|
this, rect);
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ public:
|
|||||||
const nsRect& aDirtyRect,
|
const nsRect& aDirtyRect,
|
||||||
const nsDisplayListSet& aLists) override;
|
const nsDisplayListSet& aLists) override;
|
||||||
|
|
||||||
DrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
|
DrawResult PaintBorderBackground(nsDisplayListBuilder* aBuilder,
|
||||||
nsRenderingContext& aRenderingContext,
|
nsRenderingContext& aRenderingContext,
|
||||||
nsPoint aPt, const nsRect& aDirtyRect);
|
nsPoint aPt, const nsRect& aDirtyRect);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
virtual void SetInitialChildList(ChildListID aListID,
|
virtual void SetInitialChildList(ChildListID aListID,
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ class nsDisplayCanvasBackgroundImage : public nsDisplayBackgroundImage {
|
|||||||
public:
|
public:
|
||||||
nsDisplayCanvasBackgroundImage(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
nsDisplayCanvasBackgroundImage(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
|
||||||
uint32_t aLayer, const nsStyleBackground* aBg)
|
uint32_t aLayer, const nsStyleBackground* aBg)
|
||||||
: nsDisplayBackgroundImage(aBuilder, aFrame, aLayer, aFrame->GetRectRelativeToSelf(), aBg)
|
: nsDisplayBackgroundImage(aBuilder, aFrame, aLayer, aBg)
|
||||||
{
|
{
|
||||||
if (ShouldFixToViewport(aBuilder)) {
|
if (ShouldFixToViewport(aBuilder)) {
|
||||||
mAnimatedGeometryRoot = aBuilder->FindAnimatedGeometryRootFor(this);
|
mAnimatedGeometryRoot = aBuilder->FindAnimatedGeometryRootFor(this);
|
||||||
@@ -239,7 +239,7 @@ public:
|
|||||||
class nsDisplayCanvasThemedBackground : public nsDisplayThemedBackground {
|
class nsDisplayCanvasThemedBackground : public nsDisplayThemedBackground {
|
||||||
public:
|
public:
|
||||||
nsDisplayCanvasThemedBackground(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
|
nsDisplayCanvasThemedBackground(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
|
||||||
: nsDisplayThemedBackground(aBuilder, aFrame, aFrame->GetRectRelativeToSelf())
|
: nsDisplayThemedBackground(aBuilder, aFrame)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) override;
|
virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) override;
|
||||||
|
|||||||
@@ -1875,7 +1875,7 @@ nsFrame::DisplayBackgroundUnconditional(nsDisplayListBuilder* aBuilder,
|
|||||||
if (aBuilder->IsForEventDelivery() || aForceBackground ||
|
if (aBuilder->IsForEventDelivery() || aForceBackground ||
|
||||||
!StyleBackground()->IsTransparent() || StyleDisplay()->mAppearance) {
|
!StyleBackground()->IsTransparent() || StyleDisplay()->mAppearance) {
|
||||||
return nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
return nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
||||||
aBuilder, this, GetRectRelativeToSelf(), aLists.BorderBackground());
|
aBuilder, this, aLists.BorderBackground());
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
<html>
|
<html>
|
||||||
<head><style>
|
<head><style>
|
||||||
button,span,fieldset { border-radius: 7px 3px; background-color: #0F0; }
|
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>
|
</style></head>
|
||||||
<body style="margin:30px">
|
<body style="margin:30px">
|
||||||
<div style="-moz-column-count:3">
|
<div style="-moz-column-count:3">
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
<html>
|
<html>
|
||||||
<head><style>
|
<head><style>
|
||||||
button,span,fieldset { border-radius: 7px 3px; background-color: #0F0; }
|
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>
|
</style></head>
|
||||||
<body style="margin:30px">
|
<body style="margin:30px">
|
||||||
<div style="-moz-column-count:3">
|
<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
|
!= image-scrolling-zoom-1-ref.html image-scrolling-zoom-1-notref.html
|
||||||
pref(layers.single-tile.enabled,false) != fast-scrolling.html about:blank
|
pref(layers.single-tile.enabled,false) != fast-scrolling.html about:blank
|
||||||
== background-position-1.html background-position-1-ref.html
|
== 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-animation.html about:blank
|
||||||
== zero-opacity-text.html about:blank
|
== zero-opacity-text.html about:blank
|
||||||
== negative-w-component.html negative-w-component-ref.html
|
== negative-w-component.html negative-w-component-ref.html
|
||||||
|
|||||||
@@ -2638,7 +2638,7 @@ nsStyleImageLayers::Layer::CalcDifference(const nsStyleImageLayers::Layer& aOthe
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mPosition != aOther.mPosition) {
|
if (mPosition != aOther.mPosition) {
|
||||||
hint |= nsChangeHint_UpdateBackgroundPosition;
|
hint |= nsChangeHint_SchedulePaint;
|
||||||
}
|
}
|
||||||
|
|
||||||
return hint;
|
return hint;
|
||||||
|
|||||||
@@ -801,7 +801,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBackground {
|
|||||||
static nsChangeHint MaxDifference() {
|
static nsChangeHint MaxDifference() {
|
||||||
return nsChangeHint_UpdateEffects |
|
return nsChangeHint_UpdateEffects |
|
||||||
nsChangeHint_RepaintFrame |
|
nsChangeHint_RepaintFrame |
|
||||||
nsChangeHint_UpdateBackgroundPosition |
|
nsChangeHint_SchedulePaint |
|
||||||
nsChangeHint_NeutralChange;
|
nsChangeHint_NeutralChange;
|
||||||
}
|
}
|
||||||
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
static nsChangeHint DifferenceAlwaysHandledForDescendants() {
|
||||||
|
|||||||
@@ -1253,7 +1253,6 @@ nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder,
|
|||||||
// XXX how to handle collapsed borders?
|
// XXX how to handle collapsed borders?
|
||||||
if (aBuilder->IsForEventDelivery()) {
|
if (aBuilder->IsForEventDelivery()) {
|
||||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(aBuilder, aFrame,
|
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(aBuilder, aFrame,
|
||||||
aFrame->GetRectRelativeToSelf(),
|
|
||||||
lists->BorderBackground());
|
lists->BorderBackground());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,10 +39,9 @@ public:
|
|||||||
|
|
||||||
virtual bool HonorPrintBackgroundSettings() override { return false; }
|
virtual bool HonorPrintBackgroundSettings() override { return false; }
|
||||||
|
|
||||||
DrawResult PaintBorder(nsRenderingContext& aRenderingContext,
|
DrawResult PaintBorderBackground(nsRenderingContext& aRenderingContext,
|
||||||
nsPoint aPt,
|
nsPoint aPt,
|
||||||
const nsRect& aDirtyRect);
|
const nsRect& aDirtyRect);
|
||||||
nsRect GetBackgroundRectRelativeToSelf(nscoord* aOutYOffset = nullptr, nsRect* aOutGroupRect = nullptr);
|
|
||||||
|
|
||||||
// make sure we our kids get our orient and align instead of us.
|
// 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.
|
// 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)
|
NS_IMPL_FRAMEARENA_HELPERS(nsGroupBoxFrame)
|
||||||
|
|
||||||
class nsDisplayXULGroupBorder : public nsDisplayItem {
|
class nsDisplayXULGroupBackground : public nsDisplayItem {
|
||||||
public:
|
public:
|
||||||
nsDisplayXULGroupBorder(nsDisplayListBuilder* aBuilder,
|
nsDisplayXULGroupBackground(nsDisplayListBuilder* aBuilder,
|
||||||
nsGroupBoxFrame* aFrame) :
|
nsGroupBoxFrame* aFrame) :
|
||||||
nsDisplayItem(aBuilder, aFrame) {
|
nsDisplayItem(aBuilder, aFrame) {
|
||||||
MOZ_COUNT_CTOR(nsDisplayXULGroupBorder);
|
MOZ_COUNT_CTOR(nsDisplayXULGroupBackground);
|
||||||
}
|
}
|
||||||
#ifdef NS_BUILD_REFCNT_LOGGING
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
||||||
virtual ~nsDisplayXULGroupBorder() {
|
virtual ~nsDisplayXULGroupBackground() {
|
||||||
MOZ_COUNT_DTOR(nsDisplayXULGroupBorder);
|
MOZ_COUNT_DTOR(nsDisplayXULGroupBackground);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -110,13 +109,13 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
nsDisplayItemGeometry*
|
nsDisplayItemGeometry*
|
||||||
nsDisplayXULGroupBorder::AllocateGeometry(nsDisplayListBuilder* aBuilder)
|
nsDisplayXULGroupBackground::AllocateGeometry(nsDisplayListBuilder* aBuilder)
|
||||||
{
|
{
|
||||||
return new nsDisplayItemGenericImageGeometry(this, aBuilder);
|
return new nsDisplayItemGenericImageGeometry(this, aBuilder);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsDisplayXULGroupBorder::ComputeInvalidationRegion(
|
nsDisplayXULGroupBackground::ComputeInvalidationRegion(
|
||||||
nsDisplayListBuilder* aBuilder,
|
nsDisplayListBuilder* aBuilder,
|
||||||
const nsDisplayItemGeometry* aGeometry,
|
const nsDisplayItemGeometry* aGeometry,
|
||||||
nsRegion* aInvalidRegion)
|
nsRegion* aInvalidRegion)
|
||||||
@@ -134,11 +133,11 @@ nsDisplayXULGroupBorder::ComputeInvalidationRegion(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsDisplayXULGroupBorder::Paint(nsDisplayListBuilder* aBuilder,
|
nsDisplayXULGroupBackground::Paint(nsDisplayListBuilder* aBuilder,
|
||||||
nsRenderingContext* aCtx)
|
nsRenderingContext* aCtx)
|
||||||
{
|
{
|
||||||
DrawResult result = static_cast<nsGroupBoxFrame*>(mFrame)
|
DrawResult result = static_cast<nsGroupBoxFrame*>(mFrame)
|
||||||
->PaintBorder(*aCtx, ToReferenceFrame(), mVisibleRect);
|
->PaintBorderBackground(*aCtx, ToReferenceFrame(), mVisibleRect);
|
||||||
|
|
||||||
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
||||||
}
|
}
|
||||||
@@ -150,11 +149,8 @@ nsGroupBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||||||
{
|
{
|
||||||
// Paint our background and border
|
// Paint our background and border
|
||||||
if (IsVisibleForPainting(aBuilder)) {
|
if (IsVisibleForPainting(aBuilder)) {
|
||||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
|
||||||
aBuilder, this, GetBackgroundRectRelativeToSelf(),
|
|
||||||
aLists.BorderBackground());
|
|
||||||
aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
|
aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
|
||||||
nsDisplayXULGroupBorder(aBuilder, this));
|
nsDisplayXULGroupBackground(aBuilder, this));
|
||||||
|
|
||||||
DisplayOutline(aBuilder, aLists);
|
DisplayOutline(aBuilder, aLists);
|
||||||
}
|
}
|
||||||
@@ -162,39 +158,8 @@ nsGroupBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||||||
BuildDisplayListForChildren(aBuilder, aDirtyRect, aLists);
|
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
|
DrawResult
|
||||||
nsGroupBoxFrame::PaintBorder(nsRenderingContext& aRenderingContext,
|
nsGroupBoxFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
|
||||||
nsPoint aPt, const nsRect& aDirtyRect) {
|
nsPoint aPt, const nsRect& aDirtyRect) {
|
||||||
|
|
||||||
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
|
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
|
||||||
@@ -203,16 +168,32 @@ nsGroupBoxFrame::PaintBorder(nsRenderingContext& aRenderingContext,
|
|||||||
Sides skipSides;
|
Sides skipSides;
|
||||||
const nsStyleBorder* borderStyleData = StyleBorder();
|
const nsStyleBorder* borderStyleData = StyleBorder();
|
||||||
const nsMargin& border = borderStyleData->GetComputedBorder();
|
const nsMargin& border = borderStyleData->GetComputedBorder();
|
||||||
|
nscoord yoff = 0;
|
||||||
nsPresContext* presContext = PresContext();
|
nsPresContext* presContext = PresContext();
|
||||||
|
|
||||||
nsRect groupRect;
|
nsRect groupRect;
|
||||||
nsIFrame* groupBox = GetCaptionBox(groupRect);
|
nsIFrame* groupBox = GetCaptionBox(groupRect);
|
||||||
|
|
||||||
nscoord yoff = 0;
|
if (groupBox) {
|
||||||
nsRect rect = GetBackgroundRectRelativeToSelf(&yoff, &groupRect) + aPt;
|
// 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;
|
groupRect += aPt;
|
||||||
|
|
||||||
DrawResult result = DrawResult::SUCCESS;
|
DrawResult result =
|
||||||
|
nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
|
||||||
|
aDirtyRect, rect,
|
||||||
|
nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES);
|
||||||
|
|
||||||
if (groupBox) {
|
if (groupBox) {
|
||||||
int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
|
int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user