Bug 1265343 Part 1 - Add shape-image-threshold to style system. r=heycam

devtools/shared/css/generated/properties-db.js is generated by running
"./mach devtools-css-db"

MozReview-Commit-ID: 1U4yoQTDwxi

--HG--
extra : rebase_source : 16049b4253ae9a3f6e24cc30896ed53f65ebaf7a
This commit is contained in:
Ting-Yu Lin 2017-11-27 15:01:25 +08:00
Родитель dd31a370eb
Коммит b1efbfb25a
8 изменённых файлов: 45 добавлений и 5 удалений

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

@ -3086,6 +3086,7 @@ exports.CSS_PROPERTIES = {
"scroll-snap-points-y",
"scroll-snap-type-x",
"scroll-snap-type-y",
"shape-image-threshold",
"shape-outside",
"shape-rendering",
"-moz-stack-sizing",
@ -3371,6 +3372,7 @@ exports.CSS_PROPERTIES = {
"geometricprecision",
"grab",
"grabbing",
"grayscale",
"grid",
"groove",
"groupbox",
@ -10000,6 +10002,10 @@ exports.PREFERENCES = [
"scroll-snap-type-y",
"layout.css.scroll-snap.enabled"
],
[
"shape-image-threshold",
"layout.css.shape-outside.enabled"
],
[
"shape-outside",
"layout.css.shape-outside.enabled"

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

@ -3774,6 +3774,16 @@ CSS_PROP_DISPLAY(
kScrollSnapTypeKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_Discrete)
CSS_PROP_DISPLAY(
shape-image-threshold,
shape_image_threshold,
ShapeImageThreshold,
CSS_PROPERTY_PARSE_VALUE,
"layout.css.shape-outside.enabled",
VARIANT_HN,
nullptr,
offsetof(nsStyleDisplay, mShapeImageThreshold),
eStyleAnimType_float)
CSS_PROP_DISPLAY(
shape-outside,
shape_outside,

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

@ -6569,6 +6569,14 @@ nsComputedDOMStyle::DoGetClipPath()
nsCSSProps::kClipPathGeometryBoxKTable);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetShapeImageThreshold()
{
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetNumber(StyleDisplay()->mShapeImageThreshold);
return val.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetShapeOutside()
{

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

@ -525,6 +525,7 @@ private:
already_AddRefed<CSSValue> DoGetScrollSnapPointsY();
already_AddRefed<CSSValue> DoGetScrollSnapDestination();
already_AddRefed<CSSValue> DoGetScrollSnapCoordinate();
already_AddRefed<CSSValue> DoGetShapeImageThreshold();
already_AddRefed<CSSValue> DoGetShapeOutside();
/* User interface properties */

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

@ -230,6 +230,7 @@ COMPUTED_STYLE_PROP(scroll_snap_points_x, ScrollSnapPointsX)
COMPUTED_STYLE_PROP(scroll_snap_points_y, ScrollSnapPointsY)
COMPUTED_STYLE_PROP(scroll_snap_type_x, ScrollSnapTypeX)
COMPUTED_STYLE_PROP(scroll_snap_type_y, ScrollSnapTypeY)
COMPUTED_STYLE_PROP(shape_image_threshold, ShapeImageThreshold)
COMPUTED_STYLE_PROP(shape_outside, ShapeOutside)
//// COMPUTED_STYLE_PROP(size, Size)
COMPUTED_STYLE_PROP(table_layout, TableLayout)

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

@ -6420,6 +6420,12 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
parentDisplay->mOrient,
StyleOrient::Inline);
// shape-image-threshold: number, inherit, initial
SetFactor(*aRuleData->ValueForShapeImageThreshold(),
display->mShapeImageThreshold, conditions,
parentDisplay->mShapeImageThreshold, 0.0f,
SETFCT_OPACITY | SETFCT_UNSET_INITIAL);
// shape-outside: none | [ <basic-shape> || <shape-box> ] | <image>
const nsCSSValue* shapeOutsideValue = aRuleData->ValueForShapeOutside();
switch (shapeOutsideValue->GetUnit()) {

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

@ -3684,6 +3684,7 @@ nsStyleDisplay::nsStyleDisplay(const nsStyleDisplay& aSource)
, mAnimationFillModeCount(aSource.mAnimationFillModeCount)
, mAnimationPlayStateCount(aSource.mAnimationPlayStateCount)
, mAnimationIterationCountCount(aSource.mAnimationIterationCountCount)
, mShapeImageThreshold(aSource.mShapeImageThreshold)
, mShapeOutside(aSource.mShapeOutside)
{
MOZ_COUNT_CTOR(nsStyleDisplay);
@ -3786,10 +3787,13 @@ nsStyleDisplay::CalcDifference(const nsStyleDisplay& aNewData) const
hint |= nsChangeHint_ReflowHintsForFloatAreaChange;
}
if (mShapeOutside != aNewData.mShapeOutside) {
if (mShapeOutside != aNewData.mShapeOutside ||
mShapeImageThreshold != aNewData.mShapeImageThreshold) {
if (aNewData.mFloat != StyleFloat::None) {
// If we are floating, and our shape-outside property changes, our
// descendants are not impacted, but our ancestor and siblings are.
// If we are floating, and our shape-outside or shape-image-threshold
// are changed, our descendants are not impacted, but our ancestor and
// siblings are.
//
// This is similar to a float-only change, but since the ISize of the
// float area changes arbitrarily along its block axis, more is required
// to get the siblings to adjust properly. Hinting overflow change is
@ -3801,8 +3805,8 @@ nsStyleDisplay::CalcDifference(const nsStyleDisplay& aNewData) const
hint |= nsChangeHint_ReflowHintsForFloatAreaChange |
nsChangeHint_CSSOverflowChange;
} else {
// shape-outside changed, but we don't need to reflow because we're not
// floating.
// shape-outside or shape-image-threshold changed, but we don't need
// to reflow because we're not floating.
hint |= nsChangeHint_NeutralChange;
}
}

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

@ -2622,6 +2622,10 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay
mAnimationPlayStateCount,
mAnimationIterationCountCount;
// The threshold used for extracting a shape from shape-outside: <image>.
float mShapeImageThreshold = 0.0f; // [reset]
mozilla::StyleShapeSource mShapeOutside; // [reset]
bool IsBlockInsideStyle() const {