Skip to content

Commit

Permalink
Bug 1359584 - Part 1: Move mDisableSubpixelAA to nsDisplayItem r=mstange
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 70169AFRmjq

--HG--
extra : rebase_source : 9c46e40700430e8286ab8e5b2f986e660c293101
  • Loading branch information
mikokm committed Aug 24, 2017
1 parent b79277b commit ce08697
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 47 deletions.
6 changes: 0 additions & 6 deletions layout/generic/nsBulletFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,6 @@ class nsDisplayBullet final : public nsDisplayItem {
public:
nsDisplayBullet(nsDisplayListBuilder* aBuilder, nsBulletFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame)
, mDisableSubpixelAA(false)
{
MOZ_COUNT_CTOR(nsDisplayBullet);
}
Expand Down Expand Up @@ -576,10 +575,6 @@ class nsDisplayBullet final : public nsDisplayItem {
return GetBounds(aBuilder, &snap);
}

virtual void DisableComponentAlpha() override {
mDisableSubpixelAA = true;
}

virtual nsDisplayItemGeometry* AllocateGeometry(nsDisplayListBuilder* aBuilder) override
{
return new nsDisplayBulletGeometry(this, aBuilder);
Expand Down Expand Up @@ -609,7 +604,6 @@ class nsDisplayBullet final : public nsDisplayItem {
}

protected:
bool mDisableSubpixelAA;
Maybe<BulletRenderer> mBulletRenderer;
};

Expand Down
7 changes: 0 additions & 7 deletions layout/generic/nsPageFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@ class nsDisplayHeaderFooter : public nsDisplayItem {
public:
nsDisplayHeaderFooter(nsDisplayListBuilder* aBuilder, nsPageFrame *aFrame)
: nsDisplayItem(aBuilder, aFrame)
, mDisableSubpixelAA(false)
{
MOZ_COUNT_CTOR(nsDisplayHeaderFooter);
}
Expand All @@ -502,12 +501,6 @@ class nsDisplayHeaderFooter : public nsDisplayItem {
bool snap;
return GetBounds(aBuilder, &snap);
}

virtual void DisableComponentAlpha() override {
mDisableSubpixelAA = true;
}
protected:
bool mDisableSubpixelAA;
};

//------------------------------------------------------------------------------
Expand Down
6 changes: 0 additions & 6 deletions layout/generic/nsTextFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5001,10 +5001,6 @@ class nsDisplayText : public nsCharClipDisplayItem {
const nsDisplayItemGeometry* aGeometry,
nsRegion *aInvalidRegion) override;

virtual void DisableComponentAlpha() override {
mDisableSubpixelAA = true;
}

void RenderToContext(gfxContext* aCtx, TextDrawTarget* aTextDrawer, nsDisplayListBuilder* aBuilder, bool aIsRecording = false);

bool CanApplyOpacity() const override
Expand Down Expand Up @@ -5056,7 +5052,6 @@ class nsDisplayText : public nsCharClipDisplayItem {
nsRect mBounds;

float mOpacity;
bool mDisableSubpixelAA;
};

class nsDisplayTextGeometry : public nsCharClipGeometry
Expand Down Expand Up @@ -5122,7 +5117,6 @@ nsDisplayText::nsDisplayText(nsDisplayListBuilder* aBuilder, nsTextFrame* aFrame
const Maybe<bool>& aIsSelected)
: nsCharClipDisplayItem(aBuilder, aFrame)
, mOpacity(1.0f)
, mDisableSubpixelAA(false)
{
MOZ_COUNT_CTOR(nsDisplayText);
mIsFrameSelected = aIsSelected;
Expand Down
1 change: 1 addition & 0 deletions layout/painting/nsDisplayList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2619,6 +2619,7 @@ nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
, mActiveScrolledRoot(aActiveScrolledRoot)
, mAnimatedGeometryRoot(nullptr)
, mForceNotVisible(aBuilder->IsBuildingInvisibleItems())
, mDisableSubpixelAA(false)
#ifdef MOZ_DUMP_PAINTING
, mPainted(false)
#endif
Expand Down
7 changes: 6 additions & 1 deletion layout/painting/nsDisplayList.h
Original file line number Diff line number Diff line change
Expand Up @@ -1655,6 +1655,7 @@ class nsDisplayItem : public nsDisplayItemLink {
, mReferenceFrame(nullptr)
, mAnimatedGeometryRoot(nullptr)
, mForceNotVisible(false)
, mDisableSubpixelAA(false)
#ifdef MOZ_DUMP_PAINTING
, mPainted(false)
#endif
Expand Down Expand Up @@ -2191,7 +2192,10 @@ class nsDisplayItem : public nsDisplayItemLink {
/**
* Disable usage of component alpha. Currently only relevant for items that have text.
*/
virtual void DisableComponentAlpha() {}
void DisableComponentAlpha()
{
mDisableSubpixelAA = true;
}

/**
* Check if we can add async animations to the layer for this display item.
Expand Down Expand Up @@ -2251,6 +2255,7 @@ class nsDisplayItem : public nsDisplayItemLink {
// Guaranteed to be contained in GetBounds().
nsRect mVisibleRect;
bool mForceNotVisible;
bool mDisableSubpixelAA;
#ifdef MOZ_DUMP_PAINTING
// True if this frame has been painted.
bool mPainted;
Expand Down
11 changes: 2 additions & 9 deletions layout/svg/SVGTextFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3067,10 +3067,8 @@ SVGTextDrawPathCallbacks::StrokeGeometry()

class nsDisplaySVGText : public nsDisplayItem {
public:
nsDisplaySVGText(nsDisplayListBuilder* aBuilder,
SVGTextFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame),
mDisableSubpixelAA(false)
nsDisplaySVGText(nsDisplayListBuilder* aBuilder, SVGTextFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame)
{
MOZ_COUNT_CTOR(nsDisplaySVGText);
MOZ_ASSERT(aFrame, "Must have a frame!");
Expand All @@ -3083,9 +3081,6 @@ class nsDisplaySVGText : public nsDisplayItem {

NS_DISPLAY_DECL_NAME("nsDisplaySVGText", TYPE_SVG_TEXT)

virtual void DisableComponentAlpha() override {
mDisableSubpixelAA = true;
}
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState,
nsTArray<nsIFrame*> *aOutFrames) override;
Expand All @@ -3099,8 +3094,6 @@ class nsDisplaySVGText : public nsDisplayItem {
bool snap;
return GetBounds(aBuilder, &snap);
}
private:
bool mDisableSubpixelAA;
};

void
Expand Down
12 changes: 2 additions & 10 deletions layout/xul/nsTextBoxFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,8 @@ nsTextBoxFrame::UpdateAttributes(nsIAtom* aAttribute,
class nsDisplayXULTextBox final : public nsDisplayItem
{
public:
nsDisplayXULTextBox(nsDisplayListBuilder* aBuilder,
nsTextBoxFrame* aFrame) :
nsDisplayItem(aBuilder, aFrame),
mDisableSubpixelAA(false)
nsDisplayXULTextBox(nsDisplayListBuilder* aBuilder, nsTextBoxFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame)
{
MOZ_COUNT_CTOR(nsDisplayXULTextBox);
}
Expand All @@ -306,15 +304,9 @@ class nsDisplayXULTextBox final : public nsDisplayItem

virtual nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder) override;

virtual void DisableComponentAlpha() override {
mDisableSubpixelAA = true;
}

void PaintTextToContext(gfxContext* aCtx,
nsPoint aOffset,
const nscolor* aColor);

bool mDisableSubpixelAA;
};

static void
Expand Down
11 changes: 3 additions & 8 deletions layout/xul/tree/nsTreeBodyFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2774,9 +2774,9 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext,

class nsDisplayTreeBody final : public nsDisplayItem {
public:
nsDisplayTreeBody(nsDisplayListBuilder* aBuilder, nsFrame* aFrame) :
nsDisplayItem(aBuilder, aFrame),
mDisableSubpixelAA(false) {
nsDisplayTreeBody(nsDisplayListBuilder* aBuilder, nsFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame)
{
MOZ_COUNT_CTOR(nsDisplayTreeBody);
}
#ifdef NS_BUILD_REFCNT_LOGGING
Expand Down Expand Up @@ -2826,11 +2826,6 @@ class nsDisplayTreeBody final : public nsDisplayItem {
bool snap;
return GetBounds(aBuilder, &snap);
}
virtual void DisableComponentAlpha() override {
mDisableSubpixelAA = true;
}

bool mDisableSubpixelAA;
};

// Painting routines
Expand Down

0 comments on commit ce08697

Please sign in to comment.