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:
@@ -2404,7 +2404,8 @@ SetBackgroundClipRegion(DisplayListClipState::AutoSaveRestore& aClipState,
|
|||||||
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuilder,
|
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuilder,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
const nsRect& aBackgroundRect,
|
const nsRect& aBackgroundRect,
|
||||||
nsDisplayList* aList)
|
nsDisplayList* aList,
|
||||||
|
bool aAllowWillPaintBorderOptimization)
|
||||||
{
|
{
|
||||||
nsStyleContext* bgSC = nullptr;
|
nsStyleContext* bgSC = nullptr;
|
||||||
const nsStyleBackground* bg = nullptr;
|
const nsStyleBackground* bg = nullptr;
|
||||||
@@ -2433,7 +2434,8 @@ 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 = !isThemed && !hasInsetShadow &&
|
bool willPaintBorder = aAllowWillPaintBorderOptimization &&
|
||||||
|
!isThemed && !hasInsetShadow &&
|
||||||
borderStyle->HasBorder();
|
borderStyle->HasBorder();
|
||||||
|
|
||||||
nsPoint toRef = aBuilder->ToReferenceFrame(aFrame);
|
nsPoint toRef = aBuilder->ToReferenceFrame(aFrame);
|
||||||
|
|||||||
@@ -2670,10 +2670,14 @@ public:
|
|||||||
|
|
||||||
// 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,
|
const nsRect& aBackgroundRect,
|
||||||
nsDisplayList* aList);
|
nsDisplayList* aList,
|
||||||
|
bool aAllowWillPaintBorderOptimization = true);
|
||||||
|
|
||||||
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
|
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||||
LayerManager* aManager,
|
LayerManager* aManager,
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ 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;
|
||||||
@@ -128,7 +127,7 @@ nsDisplayFieldSetBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
|
|||||||
nsRenderingContext* aCtx)
|
nsRenderingContext* aCtx)
|
||||||
{
|
{
|
||||||
DrawResult result = static_cast<nsFieldSetFrame*>(mFrame)->
|
DrawResult result = static_cast<nsFieldSetFrame*>(mFrame)->
|
||||||
PaintBorderBackground(aBuilder, *aCtx, ToReferenceFrame(), mVisibleRect);
|
PaintBorder(aBuilder, *aCtx, ToReferenceFrame(), mVisibleRect);
|
||||||
|
|
||||||
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
|
||||||
}
|
}
|
||||||
@@ -171,8 +170,11 @@ nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||||||
nsDisplayBoxShadowOuter(aBuilder, this));
|
nsDisplayBoxShadowOuter(aBuilder, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't bother checking to see if we really have a border or background.
|
nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
|
||||||
// we usually will have a border.
|
aBuilder, this, VisualBorderRectRelativeToSelf(),
|
||||||
|
aLists.BorderBackground(),
|
||||||
|
/* aAllowWillPaintBorderOptimization = */ false);
|
||||||
|
|
||||||
aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
|
aLists.BorderBackground()->AppendNewToTop(new (aBuilder)
|
||||||
nsDisplayFieldSetBorderBackground(aBuilder, this));
|
nsDisplayFieldSetBorderBackground(aBuilder, this));
|
||||||
|
|
||||||
@@ -209,7 +211,7 @@ nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DrawResult
|
DrawResult
|
||||||
nsFieldSetFrame::PaintBorderBackground(
|
nsFieldSetFrame::PaintBorder(
|
||||||
nsDisplayListBuilder* aBuilder,
|
nsDisplayListBuilder* aBuilder,
|
||||||
nsRenderingContext& aRenderingContext,
|
nsRenderingContext& aRenderingContext,
|
||||||
nsPoint aPt,
|
nsPoint aPt,
|
||||||
@@ -225,14 +227,11 @@ nsFieldSetFrame::PaintBorderBackground(
|
|||||||
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 result = DrawResult::SUCCESS;
|
||||||
nsCSSRendering::PaintBackground(presContext, aRenderingContext, this,
|
|
||||||
aDirtyRect, rect, bgFlags);
|
|
||||||
|
|
||||||
nsCSSRendering::PaintBoxShadowInner(presContext, aRenderingContext,
|
nsCSSRendering::PaintBoxShadowInner(presContext, aRenderingContext,
|
||||||
this, rect);
|
this, rect);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
const nsRect& aDirtyRect,
|
const nsRect& aDirtyRect,
|
||||||
const nsDisplayListSet& aLists) override;
|
const nsDisplayListSet& aLists) override;
|
||||||
|
|
||||||
DrawResult PaintBorderBackground(nsDisplayListBuilder* aBuilder,
|
DrawResult PaintBorder(nsDisplayListBuilder* aBuilder,
|
||||||
nsRenderingContext& aRenderingContext,
|
nsRenderingContext& aRenderingContext,
|
||||||
nsPoint aPt, const nsRect& aDirtyRect);
|
nsPoint aPt, const nsRect& aDirtyRect);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user