mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1350401: Cleanup outline-painting-related logic. r=mats
MozReview-Commit-ID: ggDzDRrPIm --HG-- extra : rebase_source : cf8a0e13778f7ce86a8c9fef447385cf32bb963e
This commit is contained in:
parent
e5f75b2640
commit
ca95409d9c
@ -2017,7 +2017,7 @@ void
|
||||
nsFrame::DisplayOutlineUnconditional(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists)
|
||||
{
|
||||
if (StyleOutline()->mOutlineStyle == NS_STYLE_BORDER_STYLE_NONE) {
|
||||
if (!StyleOutline()->ShouldPaintOutline()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5622,8 +5622,8 @@ nsIFrame::ComputeTightBounds(DrawTarget* aDrawTarget) const
|
||||
nsRect
|
||||
nsFrame::ComputeSimpleTightBounds(DrawTarget* aDrawTarget) const
|
||||
{
|
||||
if (StyleOutline()->mOutlineStyle != NS_STYLE_BORDER_STYLE_NONE ||
|
||||
StyleBorder()->HasBorder() || !StyleBackground()->IsTransparent(this) ||
|
||||
if (StyleOutline()->ShouldPaintOutline() || StyleBorder()->HasBorder() ||
|
||||
!StyleBackground()->IsTransparent(this) ||
|
||||
StyleDisplay()->UsedAppearance()) {
|
||||
// Not necessarily tight, due to clipping, negative
|
||||
// outline-offset, and lots of other issues, but that's OK
|
||||
@ -8813,13 +8813,7 @@ ComputeAndIncludeOutlineArea(nsIFrame* aFrame, nsOverflowAreas& aOverflowAreas,
|
||||
const nsSize& aNewSize)
|
||||
{
|
||||
const nsStyleOutline* outline = aFrame->StyleOutline();
|
||||
const uint8_t outlineStyle = outline->mOutlineStyle;
|
||||
if (outlineStyle == NS_STYLE_BORDER_STYLE_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
nscoord width = outline->GetOutlineWidth();
|
||||
if (width <= 0 && outlineStyle != NS_STYLE_BORDER_STYLE_AUTO) {
|
||||
if (!outline->ShouldPaintOutline()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -8881,7 +8875,7 @@ ComputeAndIncludeOutlineArea(nsIFrame* aFrame, nsOverflowAreas& aOverflowAreas,
|
||||
nsRect outerRect(innerRect);
|
||||
bool useOutlineAuto = false;
|
||||
if (nsLayoutUtils::IsOutlineStyleAutoEnabled()) {
|
||||
useOutlineAuto = outlineStyle == NS_STYLE_BORDER_STYLE_AUTO;
|
||||
useOutlineAuto = outline->mOutlineStyle == NS_STYLE_BORDER_STYLE_AUTO;
|
||||
if (MOZ_UNLIKELY(useOutlineAuto)) {
|
||||
nsPresContext* presContext = aFrame->PresContext();
|
||||
nsITheme* theme = presContext->GetTheme();
|
||||
@ -8896,6 +8890,7 @@ ComputeAndIncludeOutlineArea(nsIFrame* aFrame, nsOverflowAreas& aOverflowAreas,
|
||||
}
|
||||
}
|
||||
if (MOZ_LIKELY(!useOutlineAuto)) {
|
||||
nscoord width = outline->GetOutlineWidth();
|
||||
outerRect.Inflate(width + offset);
|
||||
}
|
||||
|
||||
|
@ -965,13 +965,8 @@ nsCSSRendering::CreateBorderRendererForOutline(nsPresContext* aPresContext,
|
||||
|
||||
// Get our style context's color struct.
|
||||
const nsStyleOutline* ourOutline = aStyleContext->StyleOutline();
|
||||
MOZ_ASSERT(ourOutline != NS_STYLE_BORDER_STYLE_NONE,
|
||||
"shouldn't have created nsDisplayOutline item");
|
||||
|
||||
uint8_t outlineStyle = ourOutline->mOutlineStyle;
|
||||
nscoord width = ourOutline->GetOutlineWidth();
|
||||
|
||||
if (width == 0 && outlineStyle != NS_STYLE_BORDER_STYLE_AUTO) {
|
||||
if (!ourOutline->ShouldPaintOutline()) {
|
||||
// Empty outline
|
||||
return Nothing();
|
||||
}
|
||||
@ -1004,6 +999,8 @@ nsCSSRendering::CreateBorderRendererForOutline(nsPresContext* aPresContext,
|
||||
if (innerRect.Contains(aDirtyRect))
|
||||
return Nothing();
|
||||
|
||||
nscoord width = ourOutline->GetOutlineWidth();
|
||||
|
||||
nsRect outerRect = innerRect;
|
||||
outerRect.Inflate(width, width);
|
||||
|
||||
@ -1022,6 +1019,7 @@ nsCSSRendering::CreateBorderRendererForOutline(nsPresContext* aPresContext,
|
||||
RectCornerRadii outlineRadii;
|
||||
ComputePixelRadii(twipsRadii, twipsPerPixel, &outlineRadii);
|
||||
|
||||
uint8_t outlineStyle = ourOutline->mOutlineStyle;
|
||||
if (outlineStyle == NS_STYLE_BORDER_STYLE_AUTO) {
|
||||
if (nsLayoutUtils::IsOutlineStyleAutoEnabled()) {
|
||||
nsITheme* theme = aPresContext->GetTheme();
|
||||
|
@ -4077,6 +4077,9 @@ void
|
||||
nsDisplayOutline::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsRenderingContext* aCtx) {
|
||||
// TODO join outlines together
|
||||
MOZ_ASSERT(mFrame->StyleOutline()->ShouldPaintOutline(),
|
||||
"Should have not created a nsDisplayOutline!");
|
||||
|
||||
nsPoint offset = ToReferenceFrame();
|
||||
nsCSSRendering::PaintOutline(mFrame->PresContext(), *aCtx, mFrame,
|
||||
mVisibleRect,
|
||||
|
@ -1392,6 +1392,13 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleOutline
|
||||
return mActualOutlineWidth;
|
||||
}
|
||||
|
||||
bool ShouldPaintOutline() const
|
||||
{
|
||||
return mOutlineStyle == NS_STYLE_BORDER_STYLE_AUTO ||
|
||||
(GetOutlineWidth() > 0 &&
|
||||
mOutlineStyle != NS_STYLE_BORDER_STYLE_NONE);
|
||||
}
|
||||
|
||||
protected:
|
||||
// The actual value of outline-width is the computed value (an absolute
|
||||
// length, forced to zero when outline-style is none) rounded to device
|
||||
|
Loading…
Reference in New Issue
Block a user