Backed out changeset a035c2b6ae72 (bug 1325940)

This commit is contained in:
Carsten "Tomcat" Book 2017-03-13 11:38:36 +01:00
Родитель ca8371df56
Коммит b8ac5ccfac
9 изменённых файлов: 64 добавлений и 65 удалений

Просмотреть файл

@ -4322,7 +4322,7 @@ DrawBorderImage(nsPresContext* aPresContext,
for (int i = LEFT; i <= RIGHT; i++) {
for (int j = TOP; j <= BOTTOM; j++) {
StyleBorderImageRepeat fillStyleH, fillStyleV;
uint8_t fillStyleH, fillStyleV;
nsSize unitSize;
if (i == MIDDLE && j == MIDDLE) {
@ -4378,7 +4378,7 @@ DrawBorderImage(nsPresContext* aPresContext,
unitSize.width = sliceWidth[i]*factor;
unitSize.height = borderHeight[j];
fillStyleH = aStyleBorder.mBorderImageRepeatH;
fillStyleV = StyleBorderImageRepeat::Stretch;
fillStyleV = NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH;
} else if (j == MIDDLE) { // left, right
gfxFloat factor;
@ -4389,15 +4389,15 @@ DrawBorderImage(nsPresContext* aPresContext,
unitSize.width = borderWidth[i];
unitSize.height = sliceHeight[j]*factor;
fillStyleH = StyleBorderImageRepeat::Stretch;
fillStyleH = NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH;
fillStyleV = aStyleBorder.mBorderImageRepeatV;
} else {
// Corners are always stretched to fit the corner.
unitSize.width = borderWidth[i];
unitSize.height = borderHeight[j];
fillStyleH = StyleBorderImageRepeat::Stretch;
fillStyleV = StyleBorderImageRepeat::Stretch;
fillStyleH = NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH;
fillStyleV = NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH;
}
nsRect destArea(borderX[i], borderY[j], borderWidth[i], borderHeight[j]);
@ -5970,30 +5970,30 @@ nsImageRenderer::DrawLayer(nsPresContext* aPresContext,
* aUnitSize The size of the source rect in dest coords.
*/
static nsRect
ComputeTile(nsRect& aFill,
StyleBorderImageRepeat aHFill,
StyleBorderImageRepeat aVFill,
const nsSize& aUnitSize,
nsSize& aRepeatSize)
ComputeTile(nsRect& aFill,
uint8_t aHFill,
uint8_t aVFill,
const nsSize& aUnitSize,
nsSize& aRepeatSize)
{
nsRect tile;
switch (aHFill) {
case StyleBorderImageRepeat::Stretch:
case NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH:
tile.x = aFill.x;
tile.width = aFill.width;
aRepeatSize.width = tile.width;
break;
case StyleBorderImageRepeat::Repeat:
case NS_STYLE_BORDER_IMAGE_REPEAT_REPEAT:
tile.x = aFill.x + aFill.width/2 - aUnitSize.width/2;
tile.width = aUnitSize.width;
aRepeatSize.width = tile.width;
break;
case StyleBorderImageRepeat::Round:
case NS_STYLE_BORDER_IMAGE_REPEAT_ROUND:
tile.x = aFill.x;
tile.width = ComputeRoundedSize(aUnitSize.width, aFill.width);
aRepeatSize.width = tile.width;
break;
case StyleBorderImageRepeat::Space:
case NS_STYLE_BORDER_IMAGE_REPEAT_SPACE:
{
nscoord space;
aRepeatSize.width =
@ -6009,22 +6009,22 @@ ComputeTile(nsRect& aFill,
}
switch (aVFill) {
case StyleBorderImageRepeat::Stretch:
case NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH:
tile.y = aFill.y;
tile.height = aFill.height;
aRepeatSize.height = tile.height;
break;
case StyleBorderImageRepeat::Repeat:
case NS_STYLE_BORDER_IMAGE_REPEAT_REPEAT:
tile.y = aFill.y + aFill.height/2 - aUnitSize.height/2;
tile.height = aUnitSize.height;
aRepeatSize.height = tile.height;
break;
case StyleBorderImageRepeat::Round:
case NS_STYLE_BORDER_IMAGE_REPEAT_ROUND:
tile.y = aFill.y;
tile.height = ComputeRoundedSize(aUnitSize.height, aFill.height);
aRepeatSize.height = tile.height;
break;
case StyleBorderImageRepeat::Space:
case NS_STYLE_BORDER_IMAGE_REPEAT_SPACE:
{
nscoord space;
aRepeatSize.height =
@ -6048,31 +6048,31 @@ ComputeTile(nsRect& aFill,
* for argument descriptions.
*/
static bool
RequiresScaling(const nsRect& aFill,
StyleBorderImageRepeat aHFill,
StyleBorderImageRepeat aVFill,
const nsSize& aUnitSize)
RequiresScaling(const nsRect& aFill,
uint8_t aHFill,
uint8_t aVFill,
const nsSize& aUnitSize)
{
// If we have no tiling in either direction, we can skip the intermediate
// scaling step.
return (aHFill != StyleBorderImageRepeat::Stretch ||
aVFill != StyleBorderImageRepeat::Stretch) &&
return (aHFill != NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH ||
aVFill != NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH) &&
(aUnitSize.width != aFill.width ||
aUnitSize.height != aFill.height);
}
DrawResult
nsImageRenderer::DrawBorderImageComponent(nsPresContext* aPresContext,
nsRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
const nsRect& aFill,
const CSSIntRect& aSrc,
StyleBorderImageRepeat aHFill,
StyleBorderImageRepeat aVFill,
const nsSize& aUnitSize,
uint8_t aIndex,
nsImageRenderer::DrawBorderImageComponent(nsPresContext* aPresContext,
nsRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
const nsRect& aFill,
const CSSIntRect& aSrc,
uint8_t aHFill,
uint8_t aVFill,
const nsSize& aUnitSize,
uint8_t aIndex,
const Maybe<nsSize>& aSVGViewportSize,
const bool aHasIntrinsicRatio)
const bool aHasIntrinsicRatio)
{
if (!IsReady()) {
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");

Просмотреть файл

@ -242,17 +242,17 @@ public:
* intrinsic ratio.
*/
DrawResult
DrawBorderImageComponent(nsPresContext* aPresContext,
nsRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
const nsRect& aFill,
const mozilla::CSSIntRect& aSrc,
mozilla::StyleBorderImageRepeat aHFill,
mozilla::StyleBorderImageRepeat aVFill,
const nsSize& aUnitSize,
uint8_t aIndex,
const mozilla::Maybe<nsSize>& aSVGViewportSize,
const bool aHasIntrinsicRatio);
DrawBorderImageComponent(nsPresContext* aPresContext,
nsRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
const nsRect& aFill,
const mozilla::CSSIntRect& aSrc,
uint8_t aHFill,
uint8_t aVFill,
const nsSize& aUnitSize,
uint8_t aIndex,
const mozilla::Maybe<nsSize>& aSVGViewportSize,
const bool aHasIntrinsicRatio);
bool IsRasterImage();
bool IsAnimatedImage();

Просмотреть файл

@ -455,7 +455,8 @@ nsCSSCompressedDataBlock::HasDefaultBorderImageRepeat() const
{
const nsCSSValuePair &repeat =
ValueFor(eCSSProperty_border_image_repeat)->GetPairValue();
return repeat.BothValuesEqualTo(nsCSSValue(StyleBorderImageRepeat::Stretch));
return repeat.BothValuesEqualTo(
nsCSSValue(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH, eCSSUnit_Enumerated));
}
/*****************************************************************************/

Просмотреть файл

@ -13146,7 +13146,8 @@ CSSParserImpl::SetBorderImageInitialValues()
// border-image-repeat: repeat
nsCSSValue repeat;
nsCSSValuePair repeatPair;
repeatPair.SetBothValuesTo(nsCSSValue(StyleBorderImageRepeat::Stretch));
repeatPair.SetBothValuesTo(nsCSSValue(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH,
eCSSUnit_Enumerated));
repeat.SetPairValue(&repeatPair);
AppendValue(eCSSProperty_border_image_repeat, repeat);
}

Просмотреть файл

@ -1005,10 +1005,10 @@ const KTableEntry nsCSSProps::kBorderCollapseKTable[] = {
};
const KTableEntry nsCSSProps::kBorderImageRepeatKTable[] = {
{ eCSSKeyword_stretch, StyleBorderImageRepeat::Stretch },
{ eCSSKeyword_repeat, StyleBorderImageRepeat::Repeat },
{ eCSSKeyword_round, StyleBorderImageRepeat::Round },
{ eCSSKeyword_space, StyleBorderImageRepeat::Space },
{ eCSSKeyword_stretch, NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH },
{ eCSSKeyword_repeat, NS_STYLE_BORDER_IMAGE_REPEAT_REPEAT },
{ eCSSKeyword_round, NS_STYLE_BORDER_IMAGE_REPEAT_ROUND },
{ eCSSKeyword_space, NS_STYLE_BORDER_IMAGE_REPEAT_SPACE },
{ eCSSKeyword_UNKNOWN, -1 }
};

Просмотреть файл

@ -1456,7 +1456,6 @@ struct SetEnumValueHelper
DEFINE_ENUM_CLASS_SETTER(StyleUserModify, ReadOnly, WriteOnly)
DEFINE_ENUM_CLASS_SETTER(StyleWindowDragging, Default, NoDrag)
DEFINE_ENUM_CLASS_SETTER(StyleOrient, Inline, Vertical)
DEFINE_ENUM_CLASS_SETTER(StyleBorderImageRepeat, Stretch, Space)
#ifdef MOZ_XUL
DEFINE_ENUM_CLASS_SETTER(StyleDisplay, None, MozPopup)
#else
@ -7884,14 +7883,14 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
conditions,
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
parentBorder->mBorderImageRepeatH,
StyleBorderImageRepeat::Stretch);
NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH);
SetValue(borderImageRepeat.mYValue,
border->mBorderImageRepeatV,
conditions,
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
parentBorder->mBorderImageRepeatV,
StyleBorderImageRepeat::Stretch);
NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH);
COMPUTE_END_RESET(Border, border)
}

Просмотреть файл

@ -389,13 +389,11 @@ enum class FillMode : uint8_t;
#define NS_STYLE_BORDER_STYLE_HIDDEN 9
#define NS_STYLE_BORDER_STYLE_AUTO 10 // for outline-style only
// border-image-repeat
enum class StyleBorderImageRepeat : uint8_t {
Stretch,
Repeat,
Round,
Space
};
// See nsStyleBorder mBorderImage
#define NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH 0
#define NS_STYLE_BORDER_IMAGE_REPEAT_REPEAT 1
#define NS_STYLE_BORDER_IMAGE_REPEAT_ROUND 2
#define NS_STYLE_BORDER_IMAGE_REPEAT_SPACE 3
#define NS_STYLE_BORDER_IMAGE_SLICE_NOFILL 0
#define NS_STYLE_BORDER_IMAGE_SLICE_FILL 1

Просмотреть файл

@ -302,8 +302,8 @@ nsStylePadding::CalcDifference(const nsStylePadding& aNewData) const
nsStyleBorder::nsStyleBorder(const nsPresContext* aContext)
: mBorderColors(nullptr)
, mBorderImageFill(NS_STYLE_BORDER_IMAGE_SLICE_NOFILL)
, mBorderImageRepeatH(StyleBorderImageRepeat::Stretch)
, mBorderImageRepeatV(StyleBorderImageRepeat::Stretch)
, mBorderImageRepeatH(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH)
, mBorderImageRepeatV(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH)
, mFloatEdge(StyleFloatEdge::ContentBox)
, mBoxDecorationBreak(StyleBoxDecorationBreak::Slice)
, mComputedBorder(0, 0, 0, 0)

Просмотреть файл

@ -1337,8 +1337,8 @@ public:
nsStyleSides mBorderImageOutset; // [reset] length, factor
uint8_t mBorderImageFill; // [reset]
mozilla::StyleBorderImageRepeat mBorderImageRepeatH; // [reset]
mozilla::StyleBorderImageRepeat mBorderImageRepeatV; // [reset]
uint8_t mBorderImageRepeatH; // [reset] see nsStyleConsts.h
uint8_t mBorderImageRepeatV; // [reset]
mozilla::StyleFloatEdge mFloatEdge; // [reset]
mozilla::StyleBoxDecorationBreak mBoxDecorationBreak; // [reset]