Bug 1227327 - Make fieldset frames build nsDisplayBackgroundImage items. r=mattwoodrow

Fieldsets break up their border so we need to disable the willPaintBorder optimization for them.

MozReview-Commit-ID: 2zmlxVRLIqe
***
This commit is contained in:
Markus Stange
2016-04-28 14:09:06 -04:00
parent a04dd1c4bc
commit 8e07cf1036
4 changed files with 20 additions and 15 deletions

View File

@@ -2404,7 +2404,8 @@ SetBackgroundClipRegion(DisplayListClipState::AutoSaveRestore& aClipState,
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame,
const nsRect& aBackgroundRect,
nsDisplayList* aList)
nsDisplayList* aList,
bool aAllowWillPaintBorderOptimization)
{
nsStyleContext* bgSC = nullptr;
const nsStyleBackground* bg = nullptr;
@@ -2433,7 +2434,8 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
const nsStyleEffects* effectsStyle = aFrame->StyleEffects();
bool hasInsetShadow = effectsStyle->mBoxShadow &&
effectsStyle->mBoxShadow->HasShadowWithInset(true);
bool willPaintBorder = !isThemed && !hasInsetShadow &&
bool willPaintBorder = aAllowWillPaintBorderOptimization &&
!isThemed && !hasInsetShadow &&
borderStyle->HasBorder();
nsPoint toRef = aBuilder->ToReferenceFrame(aFrame);

View File

@@ -2670,10 +2670,14 @@ public:
// 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);
nsDisplayList* aList,
bool aAllowWillPaintBorderOptimization = true);
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,

View File

@@ -101,7 +101,6 @@ public:
MOZ_COUNT_DTOR(nsDisplayFieldSetBorderBackground);
}
#endif
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState,
nsTArray<nsIFrame*> *aOutFrames) override;
@@ -128,7 +127,7 @@ nsDisplayFieldSetBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx)
{
DrawResult result = static_cast<nsFieldSetFrame*>(mFrame)->
PaintBorderBackground(aBuilder, *aCtx, ToReferenceFrame(), mVisibleRect);
PaintBorder(aBuilder, *aCtx, ToReferenceFrame(), mVisibleRect);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
}
@@ -171,8 +170,11 @@ nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsDisplayBoxShadowOuter(aBuilder, this));
}
// don't bother checking to see if we really have a border or background.
// we usually will have a border.
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
aBuilder, this, VisualBorderRectRelativeToSelf(),
aLists.BorderBackground(),
/* aAllowWillPaintBorderOptimization = */ false);
aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
nsDisplayFieldSetBorderBackground(aBuilder, this));
@@ -209,7 +211,7 @@ nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
DrawResult
nsFieldSetFrame::PaintBorderBackground(
nsFieldSetFrame::PaintBorder(
nsDisplayListBuilder* aBuilder,
nsRenderingContext& aRenderingContext,
nsPoint aPt,
@@ -225,14 +227,11 @@ nsFieldSetFrame::PaintBorderBackground(
rect += aPt;
nsPresContext* presContext = PresContext();
uint32_t bgFlags = aBuilder->GetBackgroundPaintFlags();
PaintBorderFlags borderFlags = aBuilder->ShouldSyncDecodeImages()
? PaintBorderFlags::SYNC_DECODE_IMAGES
: PaintBorderFlags();
DrawResult result =
nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
aDirtyRect, rect, bgFlags);
DrawResult result = DrawResult::SUCCESS;
nsCSSRendering::PaintBoxShadowInner(presContext, aRenderingContext,
this, rect);

View File

@@ -50,9 +50,9 @@ public:
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
DrawResult PaintBorderBackground(nsDisplayListBuilder* aBuilder,
nsRenderingContext& aRenderingContext,
nsPoint aPt, const nsRect& aDirtyRect);
DrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
nsRenderingContext& aRenderingContext,
nsPoint aPt, const nsRect& aDirtyRect);
#ifdef DEBUG
virtual void SetInitialChildList(ChildListID aListID,