Bug 686281 - Rename nsStyleSVGReset::mLayers to nsStyleSVGReset::mMask; Rename nsStyleBackground::mLayers to nsStyleBackground::mImage. r=dbaron

This commit is contained in:
CJKu 2016-01-28 06:39:00 +01:00
parent e66751c486
commit d3d316c489
13 changed files with 172 additions and 171 deletions

View File

@ -2903,8 +2903,8 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
bool paintMask = (aFlags & PAINTBG_MASK_IMAGE);
const nsStyleImageLayers& layers = paintMask ?
aBackgroundSC->StyleSVGReset()->mLayers :
aBackgroundSC->StyleBackground()->mLayers;
aBackgroundSC->StyleSVGReset()->mMask :
aBackgroundSC->StyleBackground()->mImage;
// If we're drawing a specific layer, we don't want to draw the
// background color.
if ((drawBackgroundColor && aLayer >= 0) || paintMask) {

View File

@ -2270,7 +2270,7 @@ nsDisplayBackgroundImage::GetDestAreaInternal(nsDisplayListBuilder* aBuilder)
nsPresContext* presContext = mFrame->PresContext();
uint32_t flags = aBuilder->GetBackgroundPaintFlags();
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mLayers.mLayers[mLayer];
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mImage.mLayers[mLayer];
nsBackgroundLayerState state =
nsCSSRendering::PrepareImageLayer(presContext, mFrame, flags,
@ -2417,18 +2417,18 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
// Passing bg == nullptr in this macro will result in one iteration with
// i = 0.
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, bg->mLayers) {
if (bg->mLayers.mLayers[i].mImage.IsEmpty()) {
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, bg->mImage) {
if (bg->mImage.mLayers[i].mImage.IsEmpty()) {
continue;
}
if (bg->mLayers.mLayers[i].mBlendMode != NS_STYLE_BLEND_NORMAL) {
if (bg->mImage.mLayers[i].mBlendMode != NS_STYLE_BLEND_NORMAL) {
needBlendContainer = true;
}
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
if (!aBuilder->IsForEventDelivery()) {
const nsStyleImageLayers::Layer& layer = bg->mLayers.mLayers[i];
const nsStyleImageLayers::Layer& layer = bg->mImage.mLayers[i];
SetBackgroundClipRegion(clipState, aFrame, toRef,
layer, willPaintBorder);
}
@ -2492,13 +2492,13 @@ nsDisplayBackgroundImage::IsSingleFixedPositionImage(nsDisplayListBuilder* aBuil
if (!mBackgroundStyle)
return false;
if (mBackgroundStyle->mLayers.mLayers.Length() != 1)
if (mBackgroundStyle->mImage.mLayers.Length() != 1)
return false;
nsPresContext* presContext = mFrame->PresContext();
uint32_t flags = aBuilder->GetBackgroundPaintFlags();
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
const nsStyleImageLayers::Layer &layer = mBackgroundStyle->mLayers.mLayers[mLayer];
const nsStyleImageLayers::Layer &layer = mBackgroundStyle->mImage.mLayers[mLayer];
if (layer.mAttachment != NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED)
return false;
@ -2520,8 +2520,8 @@ nsDisplayBackgroundImage::IsSingleFixedPositionImage(nsDisplayListBuilder* aBuil
bool
nsDisplayBackgroundImage::IsNonEmptyFixedImage() const
{
return mBackgroundStyle->mLayers.mLayers[mLayer].mAttachment == NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED &&
!mBackgroundStyle->mLayers.mLayers[mLayer].mImage.IsEmpty();
return mBackgroundStyle->mImage.mLayers[mLayer].mAttachment == NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED &&
!mBackgroundStyle->mImage.mLayers[mLayer].mImage.IsEmpty();
}
bool
@ -2550,7 +2550,7 @@ nsDisplayBackgroundImage::CanOptimizeToImageLayer(LayerManager* aManager,
nsPresContext* presContext = mFrame->PresContext();
uint32_t flags = aBuilder->GetBackgroundPaintFlags();
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
const nsStyleImageLayers::Layer &layer = mBackgroundStyle->mLayers.mLayers[mLayer];
const nsStyleImageLayers::Layer &layer = mBackgroundStyle->mImage.mLayers[mLayer];
nsBackgroundLayerState state =
nsCSSRendering::PrepareImageLayer(presContext, mFrame, flags,
@ -2629,7 +2629,7 @@ nsDisplayBackgroundImage::ShouldCreateOwnLayer(nsDisplayListBuilder* aBuilder,
}
if (nsLayoutUtils::AnimatedImageLayersEnabled() && mBackgroundStyle) {
const nsStyleImageLayers::Layer &layer = mBackgroundStyle->mLayers.mLayers[mLayer];
const nsStyleImageLayers::Layer &layer = mBackgroundStyle->mImage.mLayers[mLayer];
const nsStyleImage* image = &layer.mImage;
if (image->GetType() == eStyleImageType_Image) {
imgIRequest* imgreq = image->GetImageData();
@ -2825,7 +2825,7 @@ nsDisplayBackgroundImage::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
if (mFrame->StyleBorder()->mBoxDecorationBreak ==
NS_STYLE_BOX_DECORATION_BREAK_CLONE ||
(!mFrame->GetPrevContinuation() && !mFrame->GetNextContinuation())) {
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mLayers.mLayers[mLayer];
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mImage.mLayers[mLayer];
if (layer.mImage.IsOpaque() && layer.mBlendMode == NS_STYLE_BLEND_NORMAL) {
result = GetInsideClipRegion(this, layer.mClip, mBounds);
}
@ -2853,7 +2853,7 @@ nsDisplayBackgroundImage::GetPositioningArea()
return nsCSSRendering::ComputeImageLayerPositioningArea(
mFrame->PresContext(), mFrame,
nsRect(ToReferenceFrame(), mFrame->GetSize()),
mBackgroundStyle->mLayers.mLayers[mLayer],
mBackgroundStyle->mImage.mLayers[mLayer],
&attachedToFrame) + ToReferenceFrame();
}
@ -2870,7 +2870,7 @@ nsDisplayBackgroundImage::RenderingMightDependOnPositioningAreaSizeChange()
return true;
}
const nsStyleImageLayers::Layer &layer = mBackgroundStyle->mLayers.mLayers[mLayer];
const nsStyleImageLayers::Layer &layer = mBackgroundStyle->mImage.mLayers[mLayer];
if (layer.RenderingMightDependOnPositioningAreaSizeChange()) {
return true;
}
@ -2946,7 +2946,7 @@ void nsDisplayBackgroundImage::ComputeInvalidationRegion(nsDisplayListBuilder* a
return;
}
if (aBuilder->ShouldSyncDecodeImages()) {
const nsStyleImage& image = mBackgroundStyle->mLayers.mLayers[mLayer].mImage;
const nsStyleImage& image = mBackgroundStyle->mImage.mLayers[mLayer].mImage;
if (image.GetType() == eStyleImageType_Image &&
geometry->ShouldInvalidateToSyncDecodeImages()) {
aInvalidRegion->Or(*aInvalidRegion, bounds);
@ -2992,7 +2992,7 @@ nsDisplayBackgroundImage::GetBoundsInternal(nsDisplayListBuilder* aBuilder) {
clipRect = clipRect.Union(rootRect + aBuilder->ToReferenceFrame(mFrame));
}
}
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mLayers.mLayers[mLayer];
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mImage.mLayers[mLayer];
return nsCSSRendering::GetBackgroundLayerRect(presContext, mFrame,
borderBox, clipRect, layer,
aBuilder->GetBackgroundPaintFlags());

View File

@ -410,7 +410,7 @@ nsCanvasFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
bool needBlendContainer = false;
// Create separate items for each background layer.
const nsStyleImageLayers& layers = bg->mLayers;
const nsStyleImageLayers& layers = bg->mImage;
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, layers) {
if (layers.mLayers[i].mImage.IsEmpty()) {
continue;

View File

@ -220,8 +220,8 @@ public:
// compositing layer. Since we know their background painting area can't
// change (unless the viewport size itself changes), async scrolling
// will work well.
return mBackgroundStyle->mLayers.mLayers[mLayer].mAttachment == NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED &&
!mBackgroundStyle->mLayers.mLayers[mLayer].mImage.IsEmpty();
return mBackgroundStyle->mImage.mLayers[mLayer].mAttachment == NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED &&
!mBackgroundStyle->mImage.mLayers[mLayer].mImage.IsEmpty();
}
// We still need to paint a background color as well as an image for this item,

View File

@ -807,14 +807,14 @@ nsFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext)
}
const nsStyleImageLayers *oldLayers = aOldStyleContext ?
&aOldStyleContext->StyleBackground()->mLayers :
&aOldStyleContext->StyleBackground()->mImage :
nullptr;
const nsStyleImageLayers *newLayers = &StyleBackground()->mLayers;
const nsStyleImageLayers *newLayers = &StyleBackground()->mImage;
AddAndRemoveImageAssociations(this, oldLayers, newLayers);
oldLayers = aOldStyleContext ? &aOldStyleContext->StyleSVGReset()->mLayers :
oldLayers = aOldStyleContext ? &aOldStyleContext->StyleSVGReset()->mMask :
nullptr;
newLayers = &StyleSVGReset()->mLayers;
newLayers = &StyleSVGReset()->mMask;
AddAndRemoveImageAssociations(this, oldLayers, newLayers);
if (aOldStyleContext) {

View File

@ -3381,28 +3381,28 @@ StyleAnimationValue::ExtractComputedValue(nsCSSProperty aProperty,
case eCSSProperty_background_position: {
const nsStyleImageLayers& layers =
static_cast<const nsStyleBackground*>(styleStruct)->mLayers;
static_cast<const nsStyleBackground*>(styleStruct)->mImage;
ExtractImageLayerPositionList(layers, aComputedValue);
break;
}
case eCSSProperty_mask_position: {
const nsStyleImageLayers& layers =
static_cast<const nsStyleSVGReset*>(styleStruct)->mLayers;
static_cast<const nsStyleSVGReset*>(styleStruct)->mMask;
ExtractImageLayerPositionList(layers, aComputedValue);
break;
}
case eCSSProperty_background_size: {
const nsStyleImageLayers& layers =
static_cast<const nsStyleBackground*>(styleStruct)->mLayers;
static_cast<const nsStyleBackground*>(styleStruct)->mImage;
ExtractImageLayerSizePairList(layers, aComputedValue);
break;
}
case eCSSProperty_mask_size: {
const nsStyleImageLayers& layers =
static_cast<const nsStyleSVGReset*>(styleStruct)->mLayers;
static_cast<const nsStyleSVGReset*>(styleStruct)->mMask;
ExtractImageLayerSizePairList(layers, aComputedValue);
break;
}

View File

@ -1818,7 +1818,7 @@ nsComputedDOMStyle::DoGetBackgroundAttachment()
{
return GetBackgroundList(&nsStyleImageLayers::Layer::mAttachment,
&nsStyleImageLayers::mAttachmentCount,
StyleBackground()->mLayers,
StyleBackground()->mImage,
nsCSSProps::kImageLayerAttachmentKTable);
}
@ -1827,7 +1827,7 @@ nsComputedDOMStyle::DoGetBackgroundClip()
{
return GetBackgroundList(&nsStyleImageLayers::Layer::mClip,
&nsStyleImageLayers::mClipCount,
StyleBackground()->mLayers,
StyleBackground()->mImage,
nsCSSProps::kImageLayerOriginKTable);
}
@ -2284,7 +2284,7 @@ nsComputedDOMStyle::DoGetImageLayerSize(const nsStyleImageLayers& aLayers)
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBackgroundImage()
{
const nsStyleImageLayers& layers = StyleBackground()->mLayers;
const nsStyleImageLayers& layers = StyleBackground()->mImage;
return DoGetImageLayerImage(layers);
}
@ -2293,7 +2293,7 @@ nsComputedDOMStyle::DoGetBackgroundBlendMode()
{
return GetBackgroundList(&nsStyleImageLayers::Layer::mBlendMode,
&nsStyleImageLayers::mBlendModeCount,
StyleBackground()->mLayers,
StyleBackground()->mImage,
nsCSSProps::kBlendModeKTable);
}
@ -2302,7 +2302,7 @@ nsComputedDOMStyle::DoGetBackgroundOrigin()
{
return GetBackgroundList(&nsStyleImageLayers::Layer::mOrigin,
&nsStyleImageLayers::mOriginCount,
StyleBackground()->mLayers,
StyleBackground()->mImage,
nsCSSProps::kImageLayerOriginKTable);
}
@ -2339,21 +2339,21 @@ nsComputedDOMStyle::SetValueToPosition(
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBackgroundPosition()
{
const nsStyleImageLayers& layers = StyleBackground()->mLayers;
const nsStyleImageLayers& layers = StyleBackground()->mImage;
return DoGetImageLayerPosition(layers);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBackgroundRepeat()
{
const nsStyleImageLayers& layers = StyleBackground()->mLayers;
const nsStyleImageLayers& layers = StyleBackground()->mImage;
return DoGetImageLayerRepeat(layers);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBackgroundSize()
{
const nsStyleImageLayers& layers = StyleBackground()->mLayers;
const nsStyleImageLayers& layers = StyleBackground()->mImage;
return DoGetImageLayerSize(layers);
}
@ -6024,12 +6024,12 @@ already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMask()
{
const nsStyleSVGReset* svg = StyleSVGReset();
const nsStyleImageLayers::Layer& firstLayer = svg->mLayers.mLayers[0];
const nsStyleImageLayers::Layer& firstLayer = svg->mMask.mLayers[0];
// Mask is now a shorthand, but it used to be a longhand, so that we
// need to support computed style for the cases where it used to be
// a longhand.
if (svg->mLayers.mImageCount > 1 ||
if (svg->mMask.mImageCount > 1 ||
firstLayer.mClip != NS_STYLE_IMAGELAYER_CLIP_BORDER ||
firstLayer.mOrigin != NS_STYLE_IMAGELAYER_ORIGIN_PADDING ||
firstLayer.mComposite != NS_STYLE_MASK_COMPOSITE_ADD ||
@ -6058,7 +6058,7 @@ nsComputedDOMStyle::DoGetMaskClip()
{
return GetBackgroundList(&nsStyleImageLayers::Layer::mClip,
&nsStyleImageLayers::mClipCount,
StyleSVGReset()->mLayers,
StyleSVGReset()->mMask,
nsCSSProps::kImageLayerOriginKTable);
}
@ -6067,14 +6067,14 @@ nsComputedDOMStyle::DoGetMaskComposite()
{
return GetBackgroundList(&nsStyleImageLayers::Layer::mComposite,
&nsStyleImageLayers::mCompositeCount,
StyleSVGReset()->mLayers,
StyleSVGReset()->mMask,
nsCSSProps::kImageLayerCompositeKTable);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMaskImage()
{
const nsStyleImageLayers& layers = StyleSVGReset()->mLayers;
const nsStyleImageLayers& layers = StyleSVGReset()->mMask;
return DoGetImageLayerImage(layers);
}
@ -6083,7 +6083,7 @@ nsComputedDOMStyle::DoGetMaskMode()
{
return GetBackgroundList(&nsStyleImageLayers::Layer::mMaskMode,
&nsStyleImageLayers::mMaskModeCount,
StyleSVGReset()->mLayers,
StyleSVGReset()->mMask,
nsCSSProps::kImageLayerModeKTable);
}
@ -6092,28 +6092,28 @@ nsComputedDOMStyle::DoGetMaskOrigin()
{
return GetBackgroundList(&nsStyleImageLayers::Layer::mOrigin,
&nsStyleImageLayers::mOriginCount,
StyleSVGReset()->mLayers,
StyleSVGReset()->mMask,
nsCSSProps::kImageLayerOriginKTable);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMaskPosition()
{
const nsStyleImageLayers& layers = StyleSVGReset()->mLayers;
const nsStyleImageLayers& layers = StyleSVGReset()->mMask;
return DoGetImageLayerPosition(layers);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMaskRepeat()
{
const nsStyleImageLayers& layers = StyleSVGReset()->mLayers;
const nsStyleImageLayers& layers = StyleSVGReset()->mMask;
return DoGetImageLayerRepeat(layers);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMaskSize()
{
const nsStyleImageLayers& layers = StyleSVGReset()->mLayers;
const nsStyleImageLayers& layers = StyleSVGReset()->mMask;
return DoGetImageLayerSize(layers);
}

View File

@ -6859,118 +6859,118 @@ nsRuleNode::ComputeBackgroundData(void* aStartStruct,
// background-image: url (stored as image), none, inherit [list]
nsStyleImage initialImage;
SetImageLayerList(aContext, *aRuleData->ValueForBackgroundImage(),
bg->mLayers.mLayers,
parentBG->mLayers.mLayers,
bg->mImage.mLayers,
parentBG->mImage.mLayers,
&nsStyleImageLayers::Layer::mImage,
initialImage, parentBG->mLayers.mImageCount,
bg->mLayers.mImageCount,
initialImage, parentBG->mImage.mImageCount,
bg->mImage.mImageCount,
maxItemCount, rebuild, conditions);
// background-repeat: enum, inherit, initial [pair list]
nsStyleImageLayers::Repeat initialRepeat;
initialRepeat.SetInitialValues();
SetImageLayerPairList(aContext, *aRuleData->ValueForBackgroundRepeat(),
bg->mLayers.mLayers,
parentBG->mLayers.mLayers,
bg->mImage.mLayers,
parentBG->mImage.mLayers,
&nsStyleImageLayers::Layer::mRepeat,
initialRepeat, parentBG->mLayers.mRepeatCount,
bg->mLayers.mRepeatCount, maxItemCount, rebuild,
initialRepeat, parentBG->mImage.mRepeatCount,
bg->mImage.mRepeatCount, maxItemCount, rebuild,
conditions);
// background-attachment: enum, inherit, initial [list]
SetImageLayerList(aContext, *aRuleData->ValueForBackgroundAttachment(),
bg->mLayers.mLayers, parentBG->mLayers.mLayers,
bg->mImage.mLayers, parentBG->mImage.mLayers,
&nsStyleImageLayers::Layer::mAttachment,
uint8_t(NS_STYLE_IMAGELAYER_ATTACHMENT_SCROLL),
parentBG->mLayers.mAttachmentCount,
bg->mLayers.mAttachmentCount, maxItemCount, rebuild,
parentBG->mImage.mAttachmentCount,
bg->mImage.mAttachmentCount, maxItemCount, rebuild,
conditions);
// background-clip: enum, inherit, initial [list]
SetImageLayerList(aContext, *aRuleData->ValueForBackgroundClip(),
bg->mLayers.mLayers,
parentBG->mLayers.mLayers,
bg->mImage.mLayers,
parentBG->mImage.mLayers,
&nsStyleImageLayers::Layer::mClip,
uint8_t(NS_STYLE_IMAGELAYER_CLIP_BORDER),
parentBG->mLayers.mClipCount,
bg->mLayers.mClipCount, maxItemCount, rebuild, conditions);
parentBG->mImage.mClipCount,
bg->mImage.mClipCount, maxItemCount, rebuild, conditions);
// background-blend-mode: enum, inherit, initial [list]
SetImageLayerList(aContext, *aRuleData->ValueForBackgroundBlendMode(),
bg->mLayers.mLayers,
parentBG->mLayers.mLayers,
bg->mImage.mLayers,
parentBG->mImage.mLayers,
&nsStyleImageLayers::Layer::mBlendMode,
uint8_t(NS_STYLE_BLEND_NORMAL),
parentBG->mLayers.mBlendModeCount,
bg->mLayers.mBlendModeCount, maxItemCount, rebuild,
parentBG->mImage.mBlendModeCount,
bg->mImage.mBlendModeCount, maxItemCount, rebuild,
conditions);
// background-origin: enum, inherit, initial [list]
SetImageLayerList(aContext, *aRuleData->ValueForBackgroundOrigin(),
bg->mLayers.mLayers,
parentBG->mLayers.mLayers,
bg->mImage.mLayers,
parentBG->mImage.mLayers,
&nsStyleImageLayers::Layer::mOrigin,
uint8_t(NS_STYLE_IMAGELAYER_ORIGIN_PADDING),
parentBG->mLayers.mOriginCount,
bg->mLayers.mOriginCount, maxItemCount, rebuild,
parentBG->mImage.mOriginCount,
bg->mImage.mOriginCount, maxItemCount, rebuild,
conditions);
// background-position: enum, length, percent (flags), inherit [pair list]
nsStyleImageLayers::Position initialPosition;
initialPosition.SetInitialPercentValues(0.0f);
SetImageLayerList(aContext, *aRuleData->ValueForBackgroundPosition(),
bg->mLayers.mLayers,
parentBG->mLayers.mLayers,
bg->mImage.mLayers,
parentBG->mImage.mLayers,
&nsStyleImageLayers::Layer::mPosition,
initialPosition, parentBG->mLayers.mPositionCount,
bg->mLayers.mPositionCount, maxItemCount, rebuild,
initialPosition, parentBG->mImage.mPositionCount,
bg->mImage.mPositionCount, maxItemCount, rebuild,
conditions);
// background-size: enum, length, auto, inherit, initial [pair list]
nsStyleImageLayers::Size initialSize;
initialSize.SetInitialValues();
SetImageLayerPairList(aContext, *aRuleData->ValueForBackgroundSize(),
bg->mLayers.mLayers,
parentBG->mLayers.mLayers,
bg->mImage.mLayers,
parentBG->mImage.mLayers,
&nsStyleImageLayers::Layer::mSize,
initialSize, parentBG->mLayers.mSizeCount,
bg->mLayers.mSizeCount, maxItemCount, rebuild,
initialSize, parentBG->mImage.mSizeCount,
bg->mImage.mSizeCount, maxItemCount, rebuild,
conditions);
if (rebuild) {
// Delete any extra items. We need to keep layers in which any
// property was specified.
bg->mLayers.mLayers.TruncateLength(maxItemCount);
bg->mImage.mLayers.TruncateLength(maxItemCount);
uint32_t fillCount = bg->mLayers.mImageCount;
FillBackgroundList(bg->mLayers.mLayers,
uint32_t fillCount = bg->mImage.mImageCount;
FillBackgroundList(bg->mImage.mLayers,
&nsStyleImageLayers::Layer::mImage,
bg->mLayers.mImageCount, fillCount);
FillBackgroundList(bg->mLayers.mLayers,
bg->mImage.mImageCount, fillCount);
FillBackgroundList(bg->mImage.mLayers,
&nsStyleImageLayers::Layer::mRepeat,
bg->mLayers.mRepeatCount, fillCount);
FillBackgroundList(bg->mLayers.mLayers,
bg->mImage.mRepeatCount, fillCount);
FillBackgroundList(bg->mImage.mLayers,
&nsStyleImageLayers::Layer::mAttachment,
bg->mLayers.mAttachmentCount, fillCount);
FillBackgroundList(bg->mLayers.mLayers,
bg->mImage.mAttachmentCount, fillCount);
FillBackgroundList(bg->mImage.mLayers,
&nsStyleImageLayers::Layer::mClip,
bg->mLayers.mClipCount, fillCount);
FillBackgroundList(bg->mLayers.mLayers,
bg->mImage.mClipCount, fillCount);
FillBackgroundList(bg->mImage.mLayers,
&nsStyleImageLayers::Layer::mBlendMode,
bg->mLayers.mBlendModeCount, fillCount);
FillBackgroundList(bg->mLayers.mLayers,
bg->mImage.mBlendModeCount, fillCount);
FillBackgroundList(bg->mImage.mLayers,
&nsStyleImageLayers::Layer::mOrigin,
bg->mLayers.mOriginCount, fillCount);
FillBackgroundList(bg->mLayers.mLayers,
bg->mImage.mOriginCount, fillCount);
FillBackgroundList(bg->mImage.mLayers,
&nsStyleImageLayers::Layer::mPosition,
bg->mLayers.mPositionCount, fillCount);
FillBackgroundList(bg->mLayers.mLayers,
bg->mImage.mPositionCount, fillCount);
FillBackgroundList(bg->mImage.mLayers,
&nsStyleImageLayers::Layer::mSize,
bg->mLayers.mSizeCount, fillCount);
bg->mImage.mSizeCount, fillCount);
}
// Now that the dust has settled, register the images with the document
bg->mLayers.TrackImages(aContext->PresContext());
bg->mImage.TrackImages(aContext->PresContext());
COMPUTE_END_RESET(Background, bg)
}
@ -9761,128 +9761,128 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
// mask-image: none | <url> | <image-list> | <element-reference> | <gradient>
nsStyleImage initialImage;
SetImageLayerList(aContext, *aRuleData->ValueForMaskImage(),
svgReset->mLayers.mLayers,
parentSVGReset->mLayers.mLayers,
svgReset->mMask.mLayers,
parentSVGReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mImage,
initialImage, parentSVGReset->mLayers.mImageCount,
svgReset->mLayers.mImageCount,
initialImage, parentSVGReset->mMask.mImageCount,
svgReset->mMask.mImageCount,
maxItemCount, rebuild, conditions);
SetImageLayerList(aContext, *aRuleData->ValueForMaskImage(),
svgReset->mLayers.mLayers,
parentSVGReset->mLayers.mLayers,
svgReset->mMask.mLayers,
parentSVGReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mSourceURI,
nsCOMPtr<nsIURI>(), parentSVGReset->mLayers.mImageCount,
svgReset->mLayers.mImageCount,
nsCOMPtr<nsIURI>(), parentSVGReset->mMask.mImageCount,
svgReset->mMask.mImageCount,
maxItemCount, rebuild, conditions);
// mask-repeat: enum, inherit, initial [pair list]
nsStyleImageLayers::Repeat initialRepeat;
initialRepeat.SetInitialValues();
SetImageLayerPairList(aContext, *aRuleData->ValueForMaskRepeat(),
svgReset->mLayers.mLayers,
parentSVGReset->mLayers.mLayers,
svgReset->mMask.mLayers,
parentSVGReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mRepeat,
initialRepeat, parentSVGReset->mLayers.mRepeatCount,
svgReset->mLayers.mRepeatCount, maxItemCount, rebuild,
initialRepeat, parentSVGReset->mMask.mRepeatCount,
svgReset->mMask.mRepeatCount, maxItemCount, rebuild,
conditions);
// mask-clip: enum, inherit, initial [list]
SetImageLayerList(aContext, *aRuleData->ValueForMaskClip(),
svgReset->mLayers.mLayers,
parentSVGReset->mLayers.mLayers,
svgReset->mMask.mLayers,
parentSVGReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mClip,
uint8_t(NS_STYLE_IMAGELAYER_CLIP_BORDER),
parentSVGReset->mLayers.mClipCount,
svgReset->mLayers.mClipCount, maxItemCount, rebuild,
parentSVGReset->mMask.mClipCount,
svgReset->mMask.mClipCount, maxItemCount, rebuild,
conditions);
// mask-origin: enum, inherit, initial [list]
SetImageLayerList(aContext, *aRuleData->ValueForMaskOrigin(),
svgReset->mLayers.mLayers,
parentSVGReset->mLayers.mLayers,
svgReset->mMask.mLayers,
parentSVGReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mOrigin,
uint8_t(NS_STYLE_IMAGELAYER_ORIGIN_PADDING),
parentSVGReset->mLayers.mOriginCount,
svgReset->mLayers.mOriginCount, maxItemCount, rebuild,
parentSVGReset->mMask.mOriginCount,
svgReset->mMask.mOriginCount, maxItemCount, rebuild,
conditions);
// mask-position: enum, length, percent (flags), inherit [pair list]
nsStyleImageLayers::Position initialPosition;
initialPosition.SetInitialPercentValues(0.0f);
SetImageLayerList(aContext, *aRuleData->ValueForMaskPosition(),
svgReset->mLayers.mLayers,
parentSVGReset->mLayers.mLayers,
svgReset->mMask.mLayers,
parentSVGReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mPosition,
initialPosition, parentSVGReset->mLayers.mPositionCount,
svgReset->mLayers.mPositionCount, maxItemCount, rebuild,
initialPosition, parentSVGReset->mMask.mPositionCount,
svgReset->mMask.mPositionCount, maxItemCount, rebuild,
conditions);
// mask-size: enum, length, auto, inherit, initial [pair list]
nsStyleImageLayers::Size initialSize;
initialSize.SetInitialValues();
SetImageLayerPairList(aContext, *aRuleData->ValueForMaskSize(),
svgReset->mLayers.mLayers,
parentSVGReset->mLayers.mLayers,
svgReset->mMask.mLayers,
parentSVGReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mSize,
initialSize, parentSVGReset->mLayers.mSizeCount,
svgReset->mLayers.mSizeCount, maxItemCount, rebuild,
initialSize, parentSVGReset->mMask.mSizeCount,
svgReset->mMask.mSizeCount, maxItemCount, rebuild,
conditions);
// mask-mode: enum, inherit, initial [list]
SetImageLayerList(aContext, *aRuleData->ValueForMaskMode(),
svgReset->mLayers.mLayers,
parentSVGReset->mLayers.mLayers,
svgReset->mMask.mLayers,
parentSVGReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mMaskMode,
uint8_t(NS_STYLE_MASK_MODE_AUTO),
parentSVGReset->mLayers.mMaskModeCount,
svgReset->mLayers.mMaskModeCount, maxItemCount, rebuild, conditions);
parentSVGReset->mMask.mMaskModeCount,
svgReset->mMask.mMaskModeCount, maxItemCount, rebuild, conditions);
// mask-composite: enum, inherit, initial [list]
SetImageLayerList(aContext, *aRuleData->ValueForMaskComposite(),
svgReset->mLayers.mLayers,
parentSVGReset->mLayers.mLayers,
svgReset->mMask.mLayers,
parentSVGReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mComposite,
uint8_t(NS_STYLE_MASK_COMPOSITE_ADD),
parentSVGReset->mLayers.mCompositeCount,
svgReset->mLayers.mCompositeCount, maxItemCount, rebuild, conditions);
parentSVGReset->mMask.mCompositeCount,
svgReset->mMask.mCompositeCount, maxItemCount, rebuild, conditions);
if (rebuild) {
// Delete any extra items. We need to keep layers in which any
// property was specified.
svgReset->mLayers.mLayers.TruncateLength(maxItemCount);
svgReset->mMask.mLayers.TruncateLength(maxItemCount);
uint32_t fillCount = svgReset->mLayers.mImageCount;
uint32_t fillCount = svgReset->mMask.mImageCount;
FillBackgroundList(svgReset->mLayers.mLayers,
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mImage,
svgReset->mLayers.mImageCount, fillCount);
FillBackgroundList(svgReset->mLayers.mLayers,
svgReset->mMask.mImageCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mSourceURI,
svgReset->mLayers.mImageCount, fillCount);
FillBackgroundList(svgReset->mLayers.mLayers,
svgReset->mMask.mImageCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mRepeat,
svgReset->mLayers.mRepeatCount, fillCount);
FillBackgroundList(svgReset->mLayers.mLayers,
svgReset->mMask.mRepeatCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mClip,
svgReset->mLayers.mClipCount, fillCount);
FillBackgroundList(svgReset->mLayers.mLayers,
svgReset->mMask.mClipCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mOrigin,
svgReset->mLayers.mOriginCount, fillCount);
FillBackgroundList(svgReset->mLayers.mLayers,
svgReset->mMask.mOriginCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mPosition,
svgReset->mLayers.mPositionCount, fillCount);
FillBackgroundList(svgReset->mLayers.mLayers,
svgReset->mMask.mPositionCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mSize,
svgReset->mLayers.mSizeCount, fillCount);
FillBackgroundList(svgReset->mLayers.mLayers,
svgReset->mMask.mSizeCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mMaskMode,
svgReset->mLayers.mMaskModeCount, fillCount);
FillBackgroundList(svgReset->mLayers.mLayers,
svgReset->mMask.mMaskModeCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mComposite,
svgReset->mLayers.mCompositeCount, fillCount);
svgReset->mMask.mCompositeCount, fillCount);
}
svgReset->mLayers.TrackImages(aContext->PresContext());
svgReset->mMask.TrackImages(aContext->PresContext());
COMPUTE_END_RESET(SVGReset, svgReset)
}

View File

@ -1259,7 +1259,7 @@ nsStyleSVGReset::~nsStyleSVGReset()
}
nsStyleSVGReset::nsStyleSVGReset(const nsStyleSVGReset& aSource)
: mLayers(aSource.mLayers)
: mMask(aSource.mMask)
{
MOZ_COUNT_CTOR(nsStyleSVGReset);
mStopColor = aSource.mStopColor;
@ -1275,7 +1275,7 @@ nsStyleSVGReset::nsStyleSVGReset(const nsStyleSVGReset& aSource)
}
void nsStyleSVGReset::Destroy(nsPresContext* aContext) {
mLayers.UntrackImages(aContext);
mMask.UntrackImages(aContext);
this->~nsStyleSVGReset();
aContext->PresShell()->
@ -1318,7 +1318,7 @@ nsChangeHint nsStyleSVGReset::CalcDifference(const nsStyleSVGReset& aOther) cons
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
}
hint |= mLayers.CalcDifference(aOther.mLayers);
hint |= mMask.CalcDifference(aOther.mMask);
return hint;
}
@ -2577,7 +2577,7 @@ nsStyleBackground::nsStyleBackground()
}
nsStyleBackground::nsStyleBackground(const nsStyleBackground& aSource)
: mLayers(aSource.mLayers)
: mImage(aSource.mImage)
, mBackgroundColor(aSource.mBackgroundColor)
{
MOZ_COUNT_CTOR(nsStyleBackground);
@ -2593,7 +2593,7 @@ void
nsStyleBackground::Destroy(nsPresContext* aContext)
{
// Untrack all the images stored in our layers
mLayers.UntrackImages(aContext);
mImage.UntrackImages(aContext);
this->~nsStyleBackground();
aContext->PresShell()->
@ -2607,15 +2607,15 @@ nsChangeHint nsStyleBackground::CalcDifference(const nsStyleBackground& aOther)
hint |= nsChangeHint_RepaintFrame;
}
hint |= mLayers.CalcDifference(aOther.mLayers);
hint |= mImage.CalcDifference(aOther.mImage);
return hint;
}
bool nsStyleBackground::HasFixedBackground() const
{
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, mLayers) {
const nsStyleImageLayers::Layer &layer = mLayers.mLayers[i];
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, mImage) {
const nsStyleImageLayers::Layer &layer = mImage.mLayers[i];
if (layer.mAttachment == NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED &&
!layer.mImage.IsEmpty()) {
return true;
@ -2627,7 +2627,7 @@ bool nsStyleBackground::HasFixedBackground() const
bool nsStyleBackground::IsTransparent() const
{
return BottomLayer().mImage.IsEmpty() &&
mLayers.mImageCount == 1 &&
mImage.mImageCount == 1 &&
NS_GET_A(mBackgroundColor) == 0;
}

View File

@ -360,6 +360,7 @@ private:
nsStyleGradient* mGradient;
char16_t* mElementId;
};
// This is _currently_ used only in conjunction with eStyleImageType_Image.
nsAutoPtr<nsStyleSides> mCropRect;
#ifdef DEBUG
@ -702,9 +703,9 @@ struct nsStyleBackground {
// FIXME: Should be in nsStyleStructInlines.h.
bool HasFixedBackground() const;
const nsStyleImageLayers::Layer& BottomLayer() const { return mLayers.BottomLayer(); }
const nsStyleImageLayers::Layer& BottomLayer() const { return mImage.BottomLayer(); }
nsStyleImageLayers mLayers;
nsStyleImageLayers mImage;
nscolor mBackgroundColor; // [reset]
};
@ -3483,7 +3484,7 @@ struct nsStyleSVGReset
return mVectorEffect == NS_STYLE_VECTOR_EFFECT_NON_SCALING_STROKE;
}
nsStyleImageLayers mLayers;
nsStyleImageLayers mMask;
nsStyleClipPath mClipPath; // [reset]
nsTArray<nsStyleFilter> mFilters; // [reset]
nscolor mStopColor; // [reset]

View File

@ -562,8 +562,8 @@ nsSVGEffects::GetEffectProperties(nsIFrame *aFrame)
// FIXME: Bug 1228280.
// Before fixing bug 1228280, we support only single svg mask as before.
MOZ_ASSERT(style->mLayers.mImageCount > 0);
nsCOMPtr<nsIURI> uri = style->mLayers.mLayers[0].mSourceURI;
MOZ_ASSERT(style->mMask.mImageCount > 0);
nsCOMPtr<nsIURI> uri = style->mMask.mLayers[0].mSourceURI;
result.mMask = uri ? GetPaintingProperty(uri, aFrame, MaskProperty()) :
nullptr;

View File

@ -153,7 +153,7 @@ nsSVGIntegrationUtils::UsingEffectsForFrame(const nsIFrame* aFrame)
// checking the SDL prefs here, since we don't know if we're being called for
// painting or hit-testing anyway.
const nsStyleSVGReset *style = aFrame->StyleSVGReset();
bool hasValidLayers = style->mLayers.HasLayerWithImage();
bool hasValidLayers = style->mMask.HasLayerWithImage();
return (style->HasFilters() || hasValidLayers ||
(style->mClipPath.GetType() != NS_STYLE_CLIP_PATH_NONE));
@ -516,7 +516,7 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(gfxContext& aContext,
nsSVGMaskFrame *svgMaskFrame = effectProperties.GetMaskFrame(&isOK);
bool complexEffects = false;
bool hasValidLayers = svgReset->mLayers.HasLayerWithImage();
bool hasValidLayers = svgReset->mMask.HasLayerWithImage();
// These are used if we require a temporary surface for a custom blend mode.
RefPtr<gfxContext> target = &aContext;

View File

@ -122,7 +122,7 @@ TableBackgroundPainter::TableBackgroundData::ShouldSetBCBorder() const
return false;
}
const nsStyleImageLayers& layers = mFrame->StyleBackground()->mLayers;
const nsStyleImageLayers& layers = mFrame->StyleBackground()->mImage;
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, layers) {
if (!layers.mLayers[i].mImage.IsEmpty())
return true;