mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 1459367 - Convert NS_STYLE_IMAGELAYER_ATTACHMENT_* to enum class. r=manishearth
Converted NS_STYLE_IMAGELAYER_ATTATCHMENT_* vals to enum class, StyleImageLayerAttachment.
This commit is contained in:
parent
7edaccb568
commit
031610cc8e
@ -375,7 +375,7 @@ nsDisplayCanvasBackgroundImage::IsSingleFixedPositionImage(nsDisplayListBuilder*
|
||||
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
const nsStyleImageLayers::Layer &layer = mBackgroundStyle->StyleBackground()->mImage.mLayers[mLayer];
|
||||
|
||||
if (layer.mAttachment != NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED)
|
||||
if (layer.mAttachment != StyleImageLayerAttachment::Fixed)
|
||||
return false;
|
||||
|
||||
nsBackgroundLayerState state =
|
||||
|
@ -2334,7 +2334,7 @@ nsCSSRendering::GetImageLayerClip(const nsStyleImageLayers::Layer& aLayer,
|
||||
aClipState->mBGClipArea = clipBorderArea;
|
||||
|
||||
if (aForFrame->IsScrollFrame() &&
|
||||
NS_STYLE_IMAGELAYER_ATTACHMENT_LOCAL == aLayer.mAttachment) {
|
||||
StyleImageLayerAttachment::Local == aLayer.mAttachment) {
|
||||
// As of this writing, this is still in discussion in the CSS Working Group
|
||||
// http://lists.w3.org/Archives/Public/www-style/2013Jul/0250.html
|
||||
|
||||
@ -2947,7 +2947,7 @@ nsCSSRendering::ComputeImageLayerPositioningArea(nsPresContext* aPresContext,
|
||||
LayoutFrameType frameType = aForFrame->Type();
|
||||
nsIFrame* geometryFrame = aForFrame;
|
||||
if (MOZ_UNLIKELY(frameType == LayoutFrameType::Scroll &&
|
||||
NS_STYLE_IMAGELAYER_ATTACHMENT_LOCAL == aLayer.mAttachment)) {
|
||||
StyleImageLayerAttachment::Local == aLayer.mAttachment)) {
|
||||
nsIScrollableFrame* scrollableFrame = do_QueryFrame(aForFrame);
|
||||
positionArea = nsRect(
|
||||
scrollableFrame->GetScrolledFrame()->GetPosition()
|
||||
@ -3008,7 +3008,7 @@ nsCSSRendering::ComputeImageLayerPositioningArea(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
nsIFrame* attachedToFrame = aForFrame;
|
||||
if (NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED == aLayer.mAttachment) {
|
||||
if (StyleImageLayerAttachment::Fixed == aLayer.mAttachment) {
|
||||
// If it's a fixed background attachment, then the image is placed
|
||||
// relative to the viewport, which is the area of the root frame
|
||||
// in a screen context or the page content frame in a print context.
|
||||
@ -3283,7 +3283,7 @@ nsCSSRendering::PrepareImageLayer(nsPresContext* aPresContext,
|
||||
// where the background can be drawn to the viewport.
|
||||
nsRect bgClipRect = aBGClipRect;
|
||||
|
||||
if (NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED == aLayer.mAttachment &&
|
||||
if (StyleImageLayerAttachment::Fixed == aLayer.mAttachment &&
|
||||
!transformedFixed &&
|
||||
(aFlags & nsCSSRendering::PAINTBG_TO_WINDOW)) {
|
||||
bgClipRect = positionArea + aBorderArea.TopLeft();
|
||||
|
@ -3501,7 +3501,7 @@ nsDisplayBackgroundImage::GetInitData(nsDisplayListBuilder* aBuilder,
|
||||
// if it's affected by a transform.
|
||||
// See https://www.w3.org/Bugs/Public/show_bug.cgi?id=17521.
|
||||
bool shouldTreatAsFixed =
|
||||
layer.mAttachment == NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED && !isTransformedFixed;
|
||||
layer.mAttachment == StyleImageLayerAttachment::Fixed && !isTransformedFixed;
|
||||
|
||||
bool shouldFixToViewport = shouldTreatAsFixed && !layer.mImage.IsEmpty();
|
||||
bool isRasterImage = state.mImageRenderer.IsRasterImage();
|
||||
|
@ -173,6 +173,7 @@ rusty-enums = [
|
||||
"mozilla::StyleUserFocus",
|
||||
"mozilla::StyleUserSelect",
|
||||
"mozilla::StyleImageLayerRepeat",
|
||||
"mozilla::StyleImageLayerAttachment",
|
||||
"mozilla::StyleBoxDecorationBreak",
|
||||
"mozilla::StyleRuleInclusion",
|
||||
"mozilla::StyleGridTrackBreadth",
|
||||
@ -243,6 +244,7 @@ whitelist-types = [
|
||||
"mozilla::LookAndFeel",
|
||||
"mozilla::gfx::Float",
|
||||
"mozilla::gfx::FontVariation",
|
||||
"mozilla::StyleImageLayerAttachment",
|
||||
".*ThreadSafe.*Holder",
|
||||
"AnonymousContent",
|
||||
"AudioContext",
|
||||
|
@ -447,9 +447,9 @@ const KTableEntry nsCSSProps::kTransformStyleKTable[] = {
|
||||
};
|
||||
|
||||
const KTableEntry nsCSSProps::kImageLayerAttachmentKTable[] = {
|
||||
{ eCSSKeyword_fixed, NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED },
|
||||
{ eCSSKeyword_scroll, NS_STYLE_IMAGELAYER_ATTACHMENT_SCROLL },
|
||||
{ eCSSKeyword_local, NS_STYLE_IMAGELAYER_ATTACHMENT_LOCAL },
|
||||
{ eCSSKeyword_fixed, StyleImageLayerAttachment::Fixed },
|
||||
{ eCSSKeyword_scroll, StyleImageLayerAttachment::Scroll },
|
||||
{ eCSSKeyword_local, StyleImageLayerAttachment::Local },
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
};
|
||||
|
||||
|
@ -254,9 +254,11 @@ enum class FillMode : uint8_t;
|
||||
#define NS_STYLE_ANIMATION_PLAY_STATE_PAUSED 1
|
||||
|
||||
// See nsStyleImageLayers
|
||||
#define NS_STYLE_IMAGELAYER_ATTACHMENT_SCROLL 0
|
||||
#define NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED 1
|
||||
#define NS_STYLE_IMAGELAYER_ATTACHMENT_LOCAL 2
|
||||
enum class StyleImageLayerAttachment : uint8_t {
|
||||
Scroll,
|
||||
Fixed,
|
||||
Local
|
||||
};
|
||||
|
||||
// A magic value that we use for our "pretend that background-clip is
|
||||
// 'padding' when we have a solid border" optimization. This isn't
|
||||
|
@ -3111,7 +3111,7 @@ nsStyleImageLayers::Size::operator==(const Size& aOther) const
|
||||
|
||||
nsStyleImageLayers::Layer::Layer()
|
||||
: mClip(StyleGeometryBox::BorderBox)
|
||||
, mAttachment(NS_STYLE_IMAGELAYER_ATTACHMENT_SCROLL)
|
||||
, mAttachment(StyleImageLayerAttachment::Scroll)
|
||||
, mBlendMode(NS_STYLE_BLEND_NORMAL)
|
||||
, mComposite(NS_STYLE_MASK_COMPOSITE_ADD)
|
||||
, mMaskMode(NS_STYLE_MASK_MODE_MATCH_SOURCE)
|
||||
@ -3350,7 +3350,7 @@ nsStyleBackground::HasFixedBackground(nsIFrame* aFrame) const
|
||||
{
|
||||
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 &&
|
||||
if (layer.mAttachment == StyleImageLayerAttachment::Fixed &&
|
||||
!layer.mImage.IsEmpty() &&
|
||||
!nsLayoutUtils::IsTransformed(aFrame)) {
|
||||
return true;
|
||||
|
@ -653,6 +653,7 @@ struct nsStyleImageLayers {
|
||||
|
||||
struct Layer {
|
||||
typedef mozilla::StyleGeometryBox StyleGeometryBox;
|
||||
typedef mozilla::StyleImageLayerAttachment StyleImageLayerAttachment;
|
||||
|
||||
nsStyleImage mImage; // [reset]
|
||||
mozilla::Position mPosition; // [reset]
|
||||
@ -660,12 +661,13 @@ struct nsStyleImageLayers {
|
||||
StyleGeometryBox mClip; // [reset] See nsStyleConsts.h
|
||||
MOZ_INIT_OUTSIDE_CTOR
|
||||
StyleGeometryBox mOrigin; // [reset] See nsStyleConsts.h
|
||||
uint8_t mAttachment; // [reset] See nsStyleConsts.h
|
||||
StyleImageLayerAttachment mAttachment;
|
||||
// [reset] See nsStyleConsts.h
|
||||
// background-only property
|
||||
// This property is used for background layer
|
||||
// only. For a mask layer, it should always
|
||||
// be the initial value, which is
|
||||
// NS_STYLE_IMAGELAYER_ATTACHMENT_SCROLL.
|
||||
// StyleImageLayerAttachment::Scroll.
|
||||
uint8_t mBlendMode; // [reset] See nsStyleConsts.h
|
||||
// background-only property
|
||||
// This property is used for background layer
|
||||
|
@ -266,7 +266,7 @@ nsStyleBackground::HasLocalBackground() const
|
||||
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, mImage) {
|
||||
const nsStyleImageLayers::Layer& layer = mImage.mLayers[i];
|
||||
if (!layer.mImage.IsEmpty() &&
|
||||
layer.mAttachment == NS_STYLE_IMAGELAYER_ATTACHMENT_LOCAL) {
|
||||
layer.mAttachment == mozilla::StyleImageLayerAttachment::Local) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ ${helpers.predefined_type(
|
||||
${helpers.single_keyword("background-attachment",
|
||||
"scroll fixed" + (" local" if product == "gecko" else ""),
|
||||
vector=True,
|
||||
gecko_constant_prefix="NS_STYLE_IMAGELAYER_ATTACHMENT",
|
||||
gecko_enum_prefix="StyleImageLayerAttachment",
|
||||
spec="https://drafts.csswg.org/css-backgrounds/#the-background-attachment",
|
||||
animation_value_type="discrete",
|
||||
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")}
|
||||
|
Loading…
Reference in New Issue
Block a user