mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Backed out changeset 6a2e62e8c861 (bug 759568)
This commit is contained in:
parent
9447faf13b
commit
48bbe10c12
@ -1814,8 +1814,7 @@ nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer,
|
||||
backgroundClip = NS_STYLE_IMAGELAYER_CLIP_PADDING;
|
||||
}
|
||||
|
||||
if (backgroundClip != NS_STYLE_IMAGELAYER_CLIP_BORDER &&
|
||||
backgroundClip != NS_STYLE_IMAGELAYER_CLIP_TEXT) {
|
||||
if (backgroundClip != NS_STYLE_IMAGELAYER_CLIP_BORDER) {
|
||||
nsMargin border = aForFrame->GetUsedBorder();
|
||||
if (backgroundClip == NS_STYLE_IMAGELAYER_CLIP_MOZ_ALMOST_PADDING) {
|
||||
// Reduce |border| by 1px (device pixels) on all sides, if
|
||||
|
@ -491,46 +491,6 @@ AddAnimationsForProperty(nsIFrame* aFrame, nsCSSProperty aProperty,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ClipBackgroundByText(nsIFrame* aFrame, nsRenderingContext* aContext,
|
||||
const gfxRect& aFillRect)
|
||||
{
|
||||
// The main function of enabling background-clip:text property value.
|
||||
// When a nsDisplayBackgroundImage detects "text" bg-clip style, it will call
|
||||
// this function to
|
||||
// 1. Ask every text frame objects in aFrame puts glyph paths into aContext.
|
||||
// 2. Then, clip aContext.
|
||||
//
|
||||
// Then, nsDisplayBackgroundImage paints bg-images into this clipped region,
|
||||
// so we get images embedded in text shape!
|
||||
|
||||
nsDisplayListBuilder builder(aFrame, nsDisplayListBuilder::GENERATE_GLYPH, false);
|
||||
|
||||
builder.EnterPresShell(aFrame);
|
||||
nsDisplayList list;
|
||||
aFrame->BuildDisplayListForStackingContext(&builder,
|
||||
nsRect(nsPoint(0, 0), aFrame->GetSize()),
|
||||
&list);
|
||||
builder.LeavePresShell(aFrame);
|
||||
|
||||
#ifdef DEBUG
|
||||
for (nsDisplayItem* i = list.GetBottom(); i; i = i->GetAbove()) {
|
||||
MOZ_ASSERT(nsDisplayItem::TYPE_TEXT == i->GetType());
|
||||
}
|
||||
#endif
|
||||
|
||||
gfxContext* ctx = aContext->ThebesContext();
|
||||
gfxContextMatrixAutoSaveRestore save(ctx);
|
||||
ctx->SetMatrix(ctx->CurrentMatrix().Translate(aFillRect.TopLeft()));
|
||||
ctx->NewPath();
|
||||
|
||||
RefPtr<LayerManager> layerManager =
|
||||
list.PaintRoot(&builder, aContext, nsDisplayList::PAINT_DEFAULT);
|
||||
|
||||
ctx->Clip();
|
||||
list.DeleteAll();
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer(Layer* aLayer,
|
||||
nsDisplayListBuilder* aBuilder,
|
||||
@ -2824,7 +2784,6 @@ nsDisplayBackgroundImage::GetInsideClipRegion(nsDisplayItem* aItem,
|
||||
} else {
|
||||
switch (aClip) {
|
||||
case NS_STYLE_IMAGELAYER_CLIP_BORDER:
|
||||
case NS_STYLE_IMAGELAYER_CLIP_TEXT:
|
||||
clipRect = nsRect(aItem->ToReferenceFrame(), frame->GetSize());
|
||||
break;
|
||||
case NS_STYLE_IMAGELAYER_CLIP_PADDING:
|
||||
@ -2862,8 +2821,7 @@ nsDisplayBackgroundImage::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE ||
|
||||
(!mFrame->GetPrevContinuation() && !mFrame->GetNextContinuation())) {
|
||||
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mImage.mLayers[mLayer];
|
||||
if (layer.mImage.IsOpaque() && layer.mBlendMode == NS_STYLE_BLEND_NORMAL &&
|
||||
layer.mClip != NS_STYLE_IMAGELAYER_CLIP_TEXT) {
|
||||
if (layer.mImage.IsOpaque() && layer.mBlendMode == NS_STYLE_BLEND_NORMAL) {
|
||||
result = GetInsideClipRegion(this, layer.mClip, mBounds);
|
||||
}
|
||||
}
|
||||
@ -2937,30 +2895,17 @@ void
|
||||
nsDisplayBackgroundImage::PaintInternal(nsDisplayListBuilder* aBuilder,
|
||||
nsRenderingContext* aCtx, const nsRect& aBounds,
|
||||
nsRect* aClipRect) {
|
||||
nsPoint offset = ToReferenceFrame();
|
||||
uint32_t flags = aBuilder->GetBackgroundPaintFlags();
|
||||
CheckForBorderItem(this, flags);
|
||||
|
||||
nsRect borderBox = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
gfxContext* ctx = aCtx->ThebesContext();
|
||||
uint8_t clip = mBackgroundStyle->mImage.mLayers[mLayer].mClip;
|
||||
|
||||
if (clip == NS_STYLE_IMAGELAYER_CLIP_TEXT) {
|
||||
gfxRect bounds = nsLayoutUtils::RectToGfxRect(borderBox, mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
ctx->Save();
|
||||
ClipBackgroundByText(mFrame, aCtx, bounds);
|
||||
}
|
||||
|
||||
image::DrawResult result =
|
||||
nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
|
||||
aBounds,
|
||||
borderBox,
|
||||
nsRect(offset, mFrame->GetSize()),
|
||||
flags, aClipRect, mLayer,
|
||||
CompositionOp::OP_OVER);
|
||||
|
||||
if (clip == NS_STYLE_IMAGELAYER_CLIP_TEXT) {
|
||||
ctx->Restore();
|
||||
}
|
||||
|
||||
nsDisplayBackgroundGeometry::UpdateDrawResult(this, result);
|
||||
}
|
||||
|
||||
@ -3361,11 +3306,6 @@ nsDisplayBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,
|
||||
// pixel shorter in rare cases. Disabled in favor of the old code for now.
|
||||
// Note that the pref layout.css.devPixelsPerPx needs to be set to 1 to
|
||||
// reproduce the bug.
|
||||
//
|
||||
// TODO:
|
||||
// This new path does not include support for background-clip:text; need to
|
||||
// be fixed if/when we switch to this new code path.
|
||||
|
||||
DrawTarget& aDrawTarget = *aCtx->GetDrawTarget();
|
||||
|
||||
Rect rect = NSRectToSnappedRect(borderBox,
|
||||
@ -3379,17 +3319,6 @@ nsDisplayBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,
|
||||
gfxRect bounds =
|
||||
nsLayoutUtils::RectToGfxRect(borderBox, mFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
|
||||
uint8_t clip = mBackgroundStyle->mImage.mLayers[0].mClip;
|
||||
if (clip == NS_STYLE_IMAGELAYER_CLIP_TEXT) {
|
||||
gfxContextAutoSaveRestore save(ctx);
|
||||
|
||||
ClipBackgroundByText(mFrame, aCtx, bounds);
|
||||
ctx->SetColor(mColor);
|
||||
ctx->Fill();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
ctx->SetColor(mColor);
|
||||
ctx->NewPath();
|
||||
ctx->Rectangle(bounds, true);
|
||||
|
@ -226,8 +226,7 @@ public:
|
||||
EVENT_DELIVERY,
|
||||
PLUGIN_GEOMETRY,
|
||||
FRAME_VISIBILITY,
|
||||
TRANSFORM_COMPUTATION,
|
||||
GENERATE_GLYPH
|
||||
TRANSFORM_COMPUTATION
|
||||
};
|
||||
nsDisplayListBuilder(nsIFrame* aReferenceFrame, Mode aMode, bool aBuildCaret);
|
||||
~nsDisplayListBuilder();
|
||||
@ -269,14 +268,6 @@ public:
|
||||
*/
|
||||
bool IsForFrameVisibility() { return mMode == FRAME_VISIBILITY; }
|
||||
|
||||
/**
|
||||
* @return true if the display list is being built for creating the glyph
|
||||
* path from text items. While painting the display list, all text display
|
||||
* items should only create glyph paths in target context, instead of
|
||||
* drawing text into it.
|
||||
*/
|
||||
bool IsForGenerateGlyphPath() { return mMode == GENERATE_GLYPH; }
|
||||
|
||||
bool WillComputePluginGeometry() { return mWillComputePluginGeometry; }
|
||||
/**
|
||||
* @return true if "painting is suppressed" during page load and we
|
||||
|
@ -1857,13 +1857,8 @@ nsFrame::DisplayBorderBackgroundOutline(nsDisplayListBuilder* aBuilder,
|
||||
// The visibility check belongs here since child elements have the
|
||||
// opportunity to override the visibility property and display even if
|
||||
// their parent is hidden.
|
||||
if (!IsVisibleForPainting(aBuilder)) {
|
||||
if (!IsVisibleForPainting(aBuilder))
|
||||
return;
|
||||
}
|
||||
|
||||
if (aBuilder->IsForGenerateGlyphPath()) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCSSShadowArray* shadows = StyleEffects()->mBoxShadow;
|
||||
if (shadows && shadows->HasShadowWithInset(false)) {
|
||||
@ -2559,16 +2554,10 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
|
||||
if (aBuilder->IsBackgroundOnly())
|
||||
return;
|
||||
|
||||
if (aBuilder->IsForGenerateGlyphPath()) {
|
||||
if (nsGkAtoms::textFrame != aChild->GetType() && aChild->IsLeaf()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsIFrame* child = aChild;
|
||||
if (child->GetStateBits() & NS_FRAME_TOO_DEEP_IN_FRAME_TREE)
|
||||
return;
|
||||
|
||||
|
||||
bool isSVG = (child->GetStateBits() & NS_FRAME_SVG_LAYOUT);
|
||||
|
||||
// true if this is a real or pseudo stacking context
|
||||
|
@ -281,6 +281,8 @@ public:
|
||||
explicit nsTextPaintStyle(nsTextFrame* aFrame);
|
||||
|
||||
void SetResolveColors(bool aResolveColors) {
|
||||
NS_ASSERTION(mFrame->IsSVGText() || aResolveColors,
|
||||
"must resolve colors is frame is not for SVG text");
|
||||
mResolveColors = aResolveColors;
|
||||
}
|
||||
|
||||
@ -4797,11 +4799,9 @@ nsDisplayText::Paint(nsDisplayListBuilder* aBuilder,
|
||||
pixelVisible.Inflate(2);
|
||||
pixelVisible.RoundOut();
|
||||
|
||||
if (!aBuilder->IsForGenerateGlyphPath()) {
|
||||
ctx->NewPath();
|
||||
ctx->Rectangle(pixelVisible);
|
||||
ctx->Clip();
|
||||
}
|
||||
ctx->NewPath();
|
||||
ctx->Rectangle(pixelVisible);
|
||||
ctx->Clip();
|
||||
|
||||
NS_ASSERTION(mVisIStartEdge >= 0, "illegal start edge");
|
||||
NS_ASSERTION(mVisIEndEdge >= 0, "illegal end edge");
|
||||
@ -4809,13 +4809,7 @@ nsDisplayText::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsPoint framePt = ToReferenceFrame();
|
||||
nsTextFrame::PaintTextParams params(aCtx->ThebesContext());
|
||||
params.framePt = gfxPoint(framePt.x, framePt.y);
|
||||
|
||||
params.dirtyRect = extraVisible;
|
||||
nsTextFrame::DrawPathCallbacks callbacks;
|
||||
if (aBuilder->IsForGenerateGlyphPath()) {
|
||||
params.callbacks = &callbacks;
|
||||
}
|
||||
|
||||
f->PaintText(params, *this, mOpacity);
|
||||
}
|
||||
|
||||
|
@ -387,8 +387,6 @@ public:
|
||||
* has been emitted to the gfxContext.
|
||||
*/
|
||||
virtual void NotifySelectionDecorationLinePathEmitted() { }
|
||||
|
||||
virtual void NotifyGlyphPathEmitted() override {}
|
||||
};
|
||||
|
||||
struct PaintTextParams
|
||||
|
Loading…
Reference in New Issue
Block a user