mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 23:08:39 +09:00
Merge remote-tracking branch 'origin/master' into custom
This commit is contained in:
commit
041677fc4b
8 changed files with 270 additions and 4 deletions
|
|
@ -833,6 +833,14 @@ SVGContentUtils::CoordToFloat(nsSVGElement *aContent,
|
|||
SVGSVGElement* ctx = aContent->GetCtx();
|
||||
return ctx ? aCoord.GetPercentValue() * ctx->GetLength(SVGContentUtils::XY) : 0.0f;
|
||||
}
|
||||
case eStyleUnit_Calc: {
|
||||
MOZ_ASSERT(aCoord.GetCalcValue(), "Invalid calc value");
|
||||
nsStyleCoord::Calc* calc = aCoord.GetCalcValue();
|
||||
SVGSVGElement* ctx = aContent->GetCtx();
|
||||
float len = nsPresContext::AppUnitsToFloatCSSPixels(calc->mLength);
|
||||
return ctx ? len + calc->mPercent * ctx->GetLength(SVGContentUtils::XY)
|
||||
: len;
|
||||
}
|
||||
default:
|
||||
return 0.0f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
== background-image-gradient-1.html background-image-gradient-1-ref.html
|
||||
== line-height-1.html line-height-1-ref.html
|
||||
== stroke-dashoffset-1.html stroke-dashoffset-1-ref.html
|
||||
|
|
|
|||
63
layout/reftests/css-calc/stroke-dashoffset-1-ref.html
Normal file
63
layout/reftests/css-calc/stroke-dashoffset-1-ref.html
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
path {
|
||||
stroke-width: 2px;
|
||||
stroke-dasharray: 10;
|
||||
}
|
||||
path#path1 {
|
||||
stroke-dashoffset: 15%;
|
||||
}
|
||||
path#path2 {
|
||||
stroke-dashoffset: 10px;
|
||||
}
|
||||
path#path3 {
|
||||
stroke-dashoffset: 26px;
|
||||
}
|
||||
path#path4 {
|
||||
stroke-dashoffset: 6px;
|
||||
}
|
||||
path#path5 {
|
||||
stroke-dashoffset: 12px;
|
||||
}
|
||||
path#path6 {
|
||||
stroke-dashoffset: 27px;
|
||||
}
|
||||
path#path7 {
|
||||
stroke-dashoffset: 27px;
|
||||
}
|
||||
path#path8 {
|
||||
stroke-dashoffset: 27px;
|
||||
}
|
||||
path#path9 {
|
||||
stroke-dashoffset: 27px;
|
||||
}
|
||||
path#path10 {
|
||||
stroke-dashoffset: 27px;
|
||||
}
|
||||
path#path11 {
|
||||
stroke-dashoffset: 17.25px;
|
||||
}
|
||||
path#path12 {
|
||||
stroke-dashoffset: 16.5px;
|
||||
}
|
||||
path#path13 {
|
||||
stroke-dashoffset: 6.5;
|
||||
}
|
||||
</style>
|
||||
<svg height="300" width="300">
|
||||
<g fill="none" stroke="black">
|
||||
<path id="path1" d="M5 20 l250 0" />
|
||||
<path id="path2" d="M5 40 l250 0" />
|
||||
<path id="path3" d="M5 60 l250 0" />
|
||||
<path id="path4" d="M5 80 l250 0" />
|
||||
<path id="path5" d="M5 100 l250 0" />
|
||||
<path id="path6" d="M5 120 l250 0" />
|
||||
<path id="path7" d="M5 140 l250 0" />
|
||||
<path id="path8" d="M5 160 l250 0" />
|
||||
<path id="patn9" d="M5 180 l250 0" />
|
||||
<path id="patn10" d="M5 200 l250 0" />
|
||||
<path id="path11" d="M5 220 l250 0" />
|
||||
<path id="path12" d="M5 240 l250 0" />
|
||||
<path id="path13" d="M5 260 l250 0" />
|
||||
</g>
|
||||
</svg>
|
||||
63
layout/reftests/css-calc/stroke-dashoffset-1.html
Normal file
63
layout/reftests/css-calc/stroke-dashoffset-1.html
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
<!DOCTYPE html>
|
||||
<style>
|
||||
path {
|
||||
stroke-width: 2px;
|
||||
stroke-dasharray: 10;
|
||||
}
|
||||
path#path1 {
|
||||
stroke-dashoffset: calc(15%);
|
||||
}
|
||||
path#path2 {
|
||||
stroke-dashoffset: calc(10px);
|
||||
}
|
||||
path#path3 {
|
||||
stroke-dashoffset: calc(20px + 2%);
|
||||
}
|
||||
path#path4 {
|
||||
stroke-dashoffset: calc(3px * 2);
|
||||
}
|
||||
path#path5 {
|
||||
stroke-dashoffset: calc(5% - 3px);
|
||||
}
|
||||
path#path6 {
|
||||
stroke-dashoffset: calc(5% - 3px + 5%);
|
||||
}
|
||||
path#path7 {
|
||||
stroke-dashoffset: calc(5% - 3px + 2.5% * 2);
|
||||
}
|
||||
path#path8 {
|
||||
stroke-dashoffset: calc(5% - 3px + 2.5%*2);
|
||||
}
|
||||
path#path9 {
|
||||
stroke-dashoffset: calc(5% - 3px + 2 * 2.5%);
|
||||
}
|
||||
path#path10 {
|
||||
stroke-dashoffset: calc(5% - 3px + 2*2.5%);
|
||||
}
|
||||
path#path11 {
|
||||
stroke-dashoffset: calc(5% - 3px/2 + 2.5% / 2);
|
||||
}
|
||||
path#path12 {
|
||||
stroke-dashoffset: calc(3% + 2.5%);
|
||||
}
|
||||
path#path13 {
|
||||
stroke-dashoffset: calc(3 * 2 + 3 / 6);
|
||||
}
|
||||
</style>
|
||||
<svg height="300" width="300">
|
||||
<g fill="none" stroke="black">
|
||||
<path id="path1" d="M5 20 l250 0" />
|
||||
<path id="path2" d="M5 40 l250 0" />
|
||||
<path id="path3" d="M5 60 l250 0" />
|
||||
<path id="path4" d="M5 80 l250 0" />
|
||||
<path id="path5" d="M5 100 l250 0" />
|
||||
<path id="path6" d="M5 120 l250 0" />
|
||||
<path id="path7" d="M5 140 l250 0" />
|
||||
<path id="path8" d="M5 160 l250 0" />
|
||||
<path id="patn9" d="M5 180 l250 0" />
|
||||
<path id="patn10" d="M5 200 l250 0" />
|
||||
<path id="path11" d="M5 220 l250 0" />
|
||||
<path id="path12" d="M5 240 l250 0" />
|
||||
<path id="path13" d="M5 260 l250 0" />
|
||||
</g>
|
||||
</svg>
|
||||
|
|
@ -63,11 +63,15 @@ GetCommonUnit(nsCSSPropertyID aProperty,
|
|||
StyleAnimationValue::Unit aSecondUnit)
|
||||
{
|
||||
if (aFirstUnit != aSecondUnit) {
|
||||
bool numberAsPixel =
|
||||
nsCSSProps::PropHasFlags(aProperty, CSS_PROPERTY_NUMBERS_ARE_PIXELS);
|
||||
if (nsCSSProps::PropHasFlags(aProperty, CSS_PROPERTY_STORES_CALC) &&
|
||||
(aFirstUnit == StyleAnimationValue::eUnit_Coord ||
|
||||
((aFirstUnit == StyleAnimationValue::eUnit_Float && numberAsPixel) ||
|
||||
aFirstUnit == StyleAnimationValue::eUnit_Coord ||
|
||||
aFirstUnit == StyleAnimationValue::eUnit_Percent ||
|
||||
aFirstUnit == StyleAnimationValue::eUnit_Calc) &&
|
||||
(aSecondUnit == StyleAnimationValue::eUnit_Coord ||
|
||||
((aSecondUnit == StyleAnimationValue::eUnit_Float && numberAsPixel) ||
|
||||
aSecondUnit == StyleAnimationValue::eUnit_Coord ||
|
||||
aSecondUnit == StyleAnimationValue::eUnit_Percent ||
|
||||
aSecondUnit == StyleAnimationValue::eUnit_Calc)) {
|
||||
// We can use calc() as the common unit.
|
||||
|
|
@ -354,6 +358,12 @@ ExtractCalcValue(const StyleAnimationValue& aValue)
|
|||
result.mHasPercent = true;
|
||||
return result;
|
||||
}
|
||||
if (aValue.GetUnit() == StyleAnimationValue::eUnit_Float) {
|
||||
result.mLength = aValue.GetFloatValue();
|
||||
result.mPercent = 0.0f;
|
||||
result.mHasPercent = false;
|
||||
return result;
|
||||
}
|
||||
MOZ_ASSERT(aValue.GetUnit() == StyleAnimationValue::eUnit_Calc,
|
||||
"unexpected unit");
|
||||
nsCSSValue *val = aValue.GetCSSValueValue();
|
||||
|
|
|
|||
|
|
@ -3814,9 +3814,10 @@ CSS_PROP_SVG(
|
|||
stroke_dashoffset,
|
||||
StrokeDashoffset,
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_NUMBERS_ARE_PIXELS,
|
||||
CSS_PROPERTY_NUMBERS_ARE_PIXELS |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
"",
|
||||
VARIANT_HLPN | VARIANT_OPENTYPE_SVG_KEYWORD,
|
||||
VARIANT_HLPN | VARIANT_OPENTYPE_SVG_KEYWORD | VARIANT_CALC,
|
||||
kStrokeContextValueKTable,
|
||||
offsetof(nsStyleSVG, mStrokeDashoffset),
|
||||
eStyleAnimType_Coord)
|
||||
|
|
|
|||
|
|
@ -4492,6 +4492,15 @@ struct LengthNumberCalcObj
|
|||
bool mIsNumber;
|
||||
};
|
||||
|
||||
struct RealNumberComputedCalc
|
||||
{
|
||||
// We use float for mLength, so it can support real numbers.
|
||||
float mLength = 0.0f;
|
||||
float mPercent = 0.0f;
|
||||
bool mIsNumber = false;
|
||||
};
|
||||
|
||||
|
||||
struct LengthNumberCalcOps : public css::NumbersAlreadyNormalizedOps
|
||||
{
|
||||
typedef LengthNumberCalcObj result_type;
|
||||
|
|
@ -4574,6 +4583,96 @@ struct LengthNumberCalcOps : public css::NumbersAlreadyNormalizedOps
|
|||
}
|
||||
};
|
||||
|
||||
// This is like LengthNumberCalcOps, but then for real/float.
|
||||
struct LengthPercentNumberCalcOps : public css::NumbersAlreadyNormalizedOps
|
||||
{
|
||||
typedef RealNumberComputedCalc result_type;
|
||||
|
||||
nsStyleContext* const mContext;
|
||||
nsPresContext* const mPresContext;
|
||||
RuleNodeCacheConditions& mConditions;
|
||||
bool mHasPercent = false;
|
||||
|
||||
LengthPercentNumberCalcOps(nsStyleContext* aContext,
|
||||
nsPresContext* aPresContext,
|
||||
RuleNodeCacheConditions& aConditions)
|
||||
: mContext(aContext),
|
||||
mPresContext(aPresContext),
|
||||
mConditions(aConditions) { }
|
||||
|
||||
result_type
|
||||
MergeAdditive(nsCSSUnit aCalcFunction,
|
||||
result_type aValue1, result_type aValue2)
|
||||
{
|
||||
MOZ_ASSERT(aValue1.mIsNumber == aValue2.mIsNumber);
|
||||
MOZ_ASSERT(aCalcFunction == eCSSUnit_Calc_Plus ||
|
||||
aCalcFunction == eCSSUnit_Calc_Minus,
|
||||
"unexpected unit");
|
||||
|
||||
result_type result;
|
||||
result.mIsNumber = aValue1.mIsNumber;
|
||||
if (aCalcFunction == eCSSUnit_Calc_Plus) {
|
||||
result.mLength = aValue1.mLength + aValue2.mLength;
|
||||
result.mPercent = aValue1.mPercent + aValue2.mPercent;
|
||||
} else {
|
||||
result.mLength = aValue2.mLength == NS_IEEEPositiveInfinity() ?
|
||||
0.0f :
|
||||
aValue1.mLength - aValue2.mLength;
|
||||
result.mPercent = aValue1.mPercent - aValue2.mPercent;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
result_type
|
||||
MergeMultiplicativeL(nsCSSUnit aCalcFunction,
|
||||
float aValue1, result_type aValue2)
|
||||
{
|
||||
MOZ_ASSERT(aCalcFunction == eCSSUnit_Calc_Times_L,
|
||||
"unexpected unit");
|
||||
result_type result;
|
||||
result.mLength = aValue1 * aValue2.mLength;
|
||||
result.mPercent = aValue1 * aValue2.mPercent;
|
||||
result.mIsNumber = aValue2.mIsNumber;
|
||||
return result;
|
||||
}
|
||||
|
||||
result_type
|
||||
MergeMultiplicativeR(nsCSSUnit aCalcFunction,
|
||||
result_type aValue1, float aValue2)
|
||||
{
|
||||
MOZ_ASSERT(aCalcFunction == eCSSUnit_Calc_TimesR ||
|
||||
aCalcFunction == eCSSUnit_Divided,
|
||||
"unexpected unit");
|
||||
result_type result;
|
||||
if (aCalcFunction == eCSSUnit_Calc_Divided) {
|
||||
aValue2 = 1.0f / aValue2;
|
||||
}
|
||||
result.mLength = aValue1.mLength * aValue2;
|
||||
result.mPercent = aValue1.mPercent * aValue2;
|
||||
result.mIsNumber = aValue1.mIsNumber;
|
||||
return result;
|
||||
}
|
||||
|
||||
result_type
|
||||
ComputeLeafValue(const nsCSSValue& aValue)
|
||||
{
|
||||
result_type result;
|
||||
if (aValue.IsLengthUnit()) {
|
||||
result.mLength = CalcLength(aValue, mContext, mPresContext, mConditions);
|
||||
} else if (aValue.GetUnit() == eCSSUnit_Percent) {
|
||||
result.mPercent = aValue.GetPercentValue();
|
||||
mHasPercent = true;
|
||||
} else if (aValue.GetUnit() == eCSSUnit_Number) {
|
||||
result.mLength = aValue.GetFloatValue();
|
||||
result.mIsNumber = true;
|
||||
} else {
|
||||
MOZ_ASSERT_UNREACHABLE("unexpected unit");
|
||||
result.mLength = CalcLength(aValue, mContext, mPresContext, mConditions);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
struct SetLineHeightCalcOps : public LengthNumberCalcOps
|
||||
{
|
||||
SetLineHeightCalcOps(nsStyleContext* aStyleContext,
|
||||
|
|
@ -9626,6 +9725,18 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
|||
strokeDashoffsetValue->GetIntValue() == NS_STYLE_STROKE_PROP_CONTEXT_VALUE);
|
||||
if (svg->StrokeDashoffsetFromObject()) {
|
||||
svg->mStrokeDashoffset.SetCoordValue(0);
|
||||
} else if (strokeDashoffsetValue->IsCalcUnit()) {
|
||||
LengthPercentNumberCalcOps ops(aContext, mPresContext, conditions);
|
||||
RealNumberComputedCalc obj = css::ComputeCalc(*strokeDashoffsetValue, ops);
|
||||
if (obj.mIsNumber) {
|
||||
svg->mStrokeDashoffset.SetFactorValue(obj.mLength);
|
||||
} else {
|
||||
nsStyleCoord::Calc* calcObj = new nsStyleCoord::Calc;
|
||||
calcObj->mLength = NSToCoordRoundWithClamp(obj.mLength);
|
||||
calcObj->mPercent = obj.mPercent;
|
||||
calcObj->mHasPercent = ops.mHasPercent;
|
||||
svg->mStrokeDashoffset.SetCalcValue(calcObj);
|
||||
}
|
||||
} else {
|
||||
SetCoord(*aRuleData->ValueForStrokeDashoffset(),
|
||||
svg->mStrokeDashoffset, parentSVG->mStrokeDashoffset,
|
||||
|
|
|
|||
|
|
@ -17,6 +17,15 @@ toolbox {
|
|||
-moz-border-top-colors: ThreeDShadow ThreeDHighlight;
|
||||
}
|
||||
|
||||
@media (-moz-os-version: windows-win10) and (-moz-windows-theme: aero) {
|
||||
toolbox {
|
||||
/* Windows 10's "aero" msstyle sourced toolbox background is pure white
|
||||
so don't use the widget toolbox styling and fallback to -moz-Dialog's
|
||||
color which by default should be a non-blinding rgb(240, 240, 240) */
|
||||
-moz-appearance: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* ::::: toolbar & menubar ::::: */
|
||||
|
||||
toolbar, menubar {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue