diff --git a/browser/devtools/layoutview/view.js b/browser/devtools/layoutview/view.js index cb0b365a3ce..36584e63e00 100644 --- a/browser/devtools/layoutview/view.js +++ b/browser/devtools/layoutview/view.js @@ -174,17 +174,11 @@ LayoutView.prototype = { marginBottom: {selector: ".margin.bottom > span", property: "margin-bottom", value: undefined}, - // margin-left is a shorthand for some internal properties, - // margin-left-ltr-source and margin-left-rtl-source for example. The - // real margin value we want is in margin-left-value marginLeft: {selector: ".margin.left > span", property: "margin-left", - realProperty: "margin-left-value", value: undefined}, - // margin-right behaves the same as margin-left marginRight: {selector: ".margin.right > span", property: "margin-right", - realProperty: "margin-right-value", value: undefined}, paddingTop: {selector: ".padding.top > span", property: "padding-top", @@ -261,11 +255,9 @@ LayoutView.prototype = { * Called when the user clicks on one of the editable values in the layoutview */ initEditor: function(element, event, dimension) { - let { property, realProperty } = dimension; - if (!realProperty) - realProperty = property; + let { property } = dimension; let session = new EditingSession(document, this.elementRules); - let initialValue = session.getProperty(realProperty); + let initialValue = session.getProperty(property); let editor = new InplaceEditor({ element: element, diff --git a/dom/html/HTMLBodyElement.cpp b/dom/html/HTMLBodyElement.cpp index 191db08d75f..f62217beb98 100644 --- a/dom/html/HTMLBodyElement.cpp +++ b/dom/html/HTMLBodyElement.cpp @@ -62,10 +62,10 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData) if (value && value->Type() == nsAttrValue::eInteger) { bodyMarginWidth = value->GetIntegerValue(); if (bodyMarginWidth < 0) bodyMarginWidth = 0; - nsCSSValue* marginLeft = aData->ValueForMarginLeftValue(); + nsCSSValue* marginLeft = aData->ValueForMarginLeft(); if (marginLeft->GetUnit() == eCSSUnit_Null) marginLeft->SetFloatValue((float)bodyMarginWidth, eCSSUnit_Pixel); - nsCSSValue* marginRight = aData->ValueForMarginRightValue(); + nsCSSValue* marginRight = aData->ValueForMarginRight(); if (marginRight->GetUnit() == eCSSUnit_Null) marginRight->SetFloatValue((float)bodyMarginWidth, eCSSUnit_Pixel); } @@ -107,7 +107,7 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData) if (value && value->Type() == nsAttrValue::eInteger) { bodyLeftMargin = value->GetIntegerValue(); if (bodyLeftMargin < 0) bodyLeftMargin = 0; - nsCSSValue* marginLeft = aData->ValueForMarginLeftValue(); + nsCSSValue* marginLeft = aData->ValueForMarginLeft(); if (marginLeft->GetUnit() == eCSSUnit_Null) marginLeft->SetFloatValue((float)bodyLeftMargin, eCSSUnit_Pixel); } @@ -117,7 +117,7 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData) if (value && value->Type() == nsAttrValue::eInteger) { bodyRightMargin = value->GetIntegerValue(); if (bodyRightMargin < 0) bodyRightMargin = 0; - nsCSSValue* marginRight = aData->ValueForMarginRightValue(); + nsCSSValue* marginRight = aData->ValueForMarginRight(); if (marginRight->GetUnit() == eCSSUnit_Null) marginRight->SetFloatValue((float)bodyRightMargin, eCSSUnit_Pixel); } @@ -147,10 +147,10 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData) } if ((bodyMarginWidth == -1) && (frameMarginWidth >= 0)) { - nsCSSValue* marginLeft = aData->ValueForMarginLeftValue(); + nsCSSValue* marginLeft = aData->ValueForMarginLeft(); if (marginLeft->GetUnit() == eCSSUnit_Null) marginLeft->SetFloatValue((float)frameMarginWidth, eCSSUnit_Pixel); - nsCSSValue* marginRight = aData->ValueForMarginRightValue(); + nsCSSValue* marginRight = aData->ValueForMarginRight(); if (marginRight->GetUnit() == eCSSUnit_Null) marginRight->SetFloatValue((float)frameMarginWidth, eCSSUnit_Pixel); } diff --git a/dom/html/HTMLHRElement.cpp b/dom/html/HTMLHRElement.cpp index 42670386940..552917750c6 100644 --- a/dom/html/HTMLHRElement.cpp +++ b/dom/html/HTMLHRElement.cpp @@ -88,8 +88,8 @@ HTMLHRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes, const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::align); if (value && value->Type() == nsAttrValue::eEnum) { // Map align attribute into auto side margins - nsCSSValue* marginLeft = aData->ValueForMarginLeftValue(); - nsCSSValue* marginRight = aData->ValueForMarginRightValue(); + nsCSSValue* marginLeft = aData->ValueForMarginLeft(); + nsCSSValue* marginRight = aData->ValueForMarginRight(); switch (value->GetEnumValue()) { case NS_STYLE_TEXT_ALIGN_LEFT: if (marginLeft->GetUnit() == eCSSUnit_Null) diff --git a/dom/html/HTMLTableElement.cpp b/dom/html/HTMLTableElement.cpp index 639472041fc..7745058824b 100644 --- a/dom/html/HTMLTableElement.cpp +++ b/dom/html/HTMLTableElement.cpp @@ -705,10 +705,10 @@ HTMLTableElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes, if (value && value->Type() == nsAttrValue::eEnum) { if (value->GetEnumValue() == NS_STYLE_TEXT_ALIGN_CENTER || value->GetEnumValue() == NS_STYLE_TEXT_ALIGN_MOZ_CENTER) { - nsCSSValue* marginLeft = aData->ValueForMarginLeftValue(); + nsCSSValue* marginLeft = aData->ValueForMarginLeft(); if (marginLeft->GetUnit() == eCSSUnit_Null) marginLeft->SetAutoValue(); - nsCSSValue* marginRight = aData->ValueForMarginRightValue(); + nsCSSValue* marginRight = aData->ValueForMarginRight(); if (marginRight->GetUnit() == eCSSUnit_Null) marginRight->SetAutoValue(); } @@ -721,10 +721,10 @@ HTMLTableElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes, value = aAttributes->GetAttr(nsGkAtoms::hspace); if (value && value->Type() == nsAttrValue::eInteger) { - nsCSSValue* marginLeft = aData->ValueForMarginLeftValue(); + nsCSSValue* marginLeft = aData->ValueForMarginLeft(); if (marginLeft->GetUnit() == eCSSUnit_Null) marginLeft->SetFloatValue((float)value->GetIntegerValue(), eCSSUnit_Pixel); - nsCSSValue* marginRight = aData->ValueForMarginRightValue(); + nsCSSValue* marginRight = aData->ValueForMarginRight(); if (marginRight->GetUnit() == eCSSUnit_Null) marginRight->SetFloatValue((float)value->GetIntegerValue(), eCSSUnit_Pixel); } diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index 205c46faef5..eff70b06a78 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -1444,10 +1444,10 @@ nsGenericHTMLElement::MapImageMarginAttributeInto(const nsMappedAttributes* aAtt hval.SetPercentValue(value->GetPercentValue()); if (hval.GetUnit() != eCSSUnit_Null) { - nsCSSValue* left = aData->ValueForMarginLeftValue(); + nsCSSValue* left = aData->ValueForMarginLeft(); if (left->GetUnit() == eCSSUnit_Null) *left = hval; - nsCSSValue* right = aData->ValueForMarginRightValue(); + nsCSSValue* right = aData->ValueForMarginRight(); if (right->GetUnit() == eCSSUnit_Null) *right = hval; } diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp index 883d51b6557..c957ec6c905 100644 --- a/layout/style/Declaration.cpp +++ b/layout/style/Declaration.cpp @@ -396,10 +396,6 @@ Declaration::GetValue(nsCSSProperty aProperty, nsAString& aValue, } break; } - case eCSSProperty_margin_left: - case eCSSProperty_margin_right: - case eCSSProperty_margin_start: - case eCSSProperty_margin_end: case eCSSProperty_border_left_color: case eCSSProperty_border_left_style: case eCSSProperty_border_left_width: diff --git a/layout/style/nsCSSDataBlock.cpp b/layout/style/nsCSSDataBlock.cpp index 7754a37c2cc..39c2d957754 100644 --- a/layout/style/nsCSSDataBlock.cpp +++ b/layout/style/nsCSSDataBlock.cpp @@ -175,6 +175,12 @@ EnsurePhysicalProperty(nsCSSProperty& aProperty, nsRuleData* aRuleData) bool ltr = direction == NS_STYLE_DIRECTION_LTR; switch (aProperty) { + case eCSSProperty_margin_end: + aProperty = ltr ? eCSSProperty_margin_right : eCSSProperty_margin_left; + break; + case eCSSProperty_margin_start: + aProperty = ltr ? eCSSProperty_margin_left : eCSSProperty_margin_right; + break; case eCSSProperty_padding_end: aProperty = ltr ? eCSSProperty_padding_right : eCSSProperty_padding_left; break; diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index adfb7ac1309..0723c68a693 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -9879,18 +9879,6 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSProperty aPropID) return ParseListStyle(); case eCSSProperty_margin: return ParseMargin(); - case eCSSProperty_margin_end: - return ParseDirectionalBoxProperty(eCSSProperty_margin_end, - NS_BOXPROP_SOURCE_LOGICAL); - case eCSSProperty_margin_left: - return ParseDirectionalBoxProperty(eCSSProperty_margin_left, - NS_BOXPROP_SOURCE_PHYSICAL); - case eCSSProperty_margin_right: - return ParseDirectionalBoxProperty(eCSSProperty_margin_right, - NS_BOXPROP_SOURCE_PHYSICAL); - case eCSSProperty_margin_start: - return ParseDirectionalBoxProperty(eCSSProperty_margin_start, - NS_BOXPROP_SOURCE_LOGICAL); case eCSSProperty_object_position: return ParseObjectPosition(); case eCSSProperty_outline: @@ -12947,20 +12935,11 @@ CSSParserImpl::ParseMargin() { static const nsCSSProperty kMarginSideIDs[] = { eCSSProperty_margin_top, - eCSSProperty_margin_right_value, + eCSSProperty_margin_right, eCSSProperty_margin_bottom, - eCSSProperty_margin_left_value - }; - static const nsCSSProperty kMarginSources[] = { - eCSSProperty_margin_left_ltr_source, - eCSSProperty_margin_left_rtl_source, - eCSSProperty_margin_right_ltr_source, - eCSSProperty_margin_right_rtl_source, - eCSSProperty_UNKNOWN + eCSSProperty_margin_left }; - // do this now, in case 4 values weren't specified - InitBoxPropsAsPhysical(kMarginSources); return ParseBoxProperties(kMarginSideIDs); } diff --git a/layout/style/nsCSSPropAliasList.h b/layout/style/nsCSSPropAliasList.h index d2ba9544049..ffde58e2369 100644 --- a/layout/style/nsCSSPropAliasList.h +++ b/layout/style/nsCSSPropAliasList.h @@ -147,3 +147,11 @@ CSS_PROP_ALIAS(padding-inline-start, padding_start, PaddingInlineStart, "layout.css.vertical-text.enabled") +CSS_PROP_ALIAS(margin-inline-end, + margin_end, + MarginInlineEnd, + "layout.css.vertical-text.enabled") +CSS_PROP_ALIAS(margin-inline-start, + margin_start, + MarginInlineStart, + "layout.css.vertical-text.enabled") diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 2d213b1ac5f..52831ff3591 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -2333,152 +2333,66 @@ CSS_PROP_MARGIN( nullptr, offsetof(nsStyleMargin, mMargin), eStyleAnimType_Sides_Bottom) -CSS_PROP_SHORTHAND( +CSS_PROP_LOGICAL( -moz-margin-end, margin_end, CSS_PROP_DOMPROP_PREFIXED(MarginEnd), - CSS_PROPERTY_PARSE_FUNCTION | - CSS_PROPERTY_APPLIES_TO_PAGE_RULE, - "") -#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL -CSS_PROP_MARGIN( - margin-end-value, - margin_end_value, - MarginEndValue, - CSS_PROPERTY_PARSE_INACCESSIBLE | + CSS_PROPERTY_PARSE_VALUE | CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | CSS_PROPERTY_STORES_CALC | - CSS_PROPERTY_APPLIES_TO_PAGE_RULE, + CSS_PROPERTY_APPLIES_TO_PAGE_RULE | + CSS_PROPERTY_LOGICAL, "", - VARIANT_AHLP | VARIANT_CALC, // for internal use + VARIANT_AHLP | VARIANT_CALC, nullptr, + Margin, CSS_PROP_NO_OFFSET, eStyleAnimType_None) -#endif -CSS_PROP_SHORTHAND( +CSS_PROP_LOGICAL( + -moz-margin-start, + margin_start, + CSS_PROP_DOMPROP_PREFIXED(MarginStart), + CSS_PROPERTY_PARSE_VALUE | + CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | + CSS_PROPERTY_STORES_CALC | + CSS_PROPERTY_APPLIES_TO_PAGE_RULE | + CSS_PROPERTY_LOGICAL, + "", + VARIANT_AHLP | VARIANT_CALC, + nullptr, + Margin, + CSS_PROP_NO_OFFSET, + eStyleAnimType_None) +CSS_PROP_MARGIN( margin-left, margin_left, MarginLeft, - CSS_PROPERTY_PARSE_FUNCTION | + CSS_PROPERTY_PARSE_VALUE | CSS_PROPERTY_UNITLESS_LENGTH_QUIRK | + CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | + CSS_PROPERTY_STORES_CALC | CSS_PROPERTY_APPLIES_TO_PAGE_RULE | CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH, - "") -#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL -CSS_PROP_MARGIN( - margin-left-value, - margin_left_value, - MarginLeftValue, - CSS_PROPERTY_PARSE_INACCESSIBLE | - CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_REPORT_OTHER_NAME | - CSS_PROPERTY_STORES_CALC | - CSS_PROPERTY_APPLIES_TO_PAGE_RULE, "", - VARIANT_AHLP | VARIANT_CALC, // for internal use + VARIANT_AHLP | VARIANT_CALC, nullptr, offsetof(nsStyleMargin, mMargin), eStyleAnimType_Sides_Left) CSS_PROP_MARGIN( - margin-left-ltr-source, - margin_left_ltr_source, - MarginLeftLTRSource, - CSS_PROPERTY_PARSE_INACCESSIBLE | - CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_DIRECTIONAL_SOURCE | - CSS_PROPERTY_APPLIES_TO_PAGE_RULE, - "", - 0, - kBoxPropSourceKTable, - CSS_PROP_NO_OFFSET, - eStyleAnimType_None) -CSS_PROP_MARGIN( - margin-left-rtl-source, - margin_left_rtl_source, - MarginLeftRTLSource, - CSS_PROPERTY_PARSE_INACCESSIBLE | - CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_DIRECTIONAL_SOURCE | - CSS_PROPERTY_APPLIES_TO_PAGE_RULE, - "", - 0, - kBoxPropSourceKTable, - CSS_PROP_NO_OFFSET, - eStyleAnimType_None) -#endif -CSS_PROP_SHORTHAND( margin-right, margin_right, MarginRight, - CSS_PROPERTY_PARSE_FUNCTION | + CSS_PROPERTY_PARSE_VALUE | CSS_PROPERTY_UNITLESS_LENGTH_QUIRK | + CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | + CSS_PROPERTY_STORES_CALC | CSS_PROPERTY_APPLIES_TO_PAGE_RULE | CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH, - "") -#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL -CSS_PROP_MARGIN( - margin-right-value, - margin_right_value, - MarginRightValue, - CSS_PROPERTY_PARSE_INACCESSIBLE | - CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_REPORT_OTHER_NAME | - CSS_PROPERTY_STORES_CALC | - CSS_PROPERTY_APPLIES_TO_PAGE_RULE, "", - VARIANT_AHLP | VARIANT_CALC, // for internal use + VARIANT_AHLP | VARIANT_CALC, nullptr, offsetof(nsStyleMargin, mMargin), eStyleAnimType_Sides_Right) -CSS_PROP_MARGIN( - margin-right-ltr-source, - margin_right_ltr_source, - MarginRightLTRSource, - CSS_PROPERTY_PARSE_INACCESSIBLE | - CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_DIRECTIONAL_SOURCE | - CSS_PROPERTY_APPLIES_TO_PAGE_RULE, - "", - 0, - kBoxPropSourceKTable, - CSS_PROP_NO_OFFSET, - eStyleAnimType_None) -CSS_PROP_MARGIN( - margin-right-rtl-source, - margin_right_rtl_source, - MarginRightRTLSource, - CSS_PROPERTY_PARSE_INACCESSIBLE | - CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_DIRECTIONAL_SOURCE | - CSS_PROPERTY_APPLIES_TO_PAGE_RULE, - "", - 0, - kBoxPropSourceKTable, - CSS_PROP_NO_OFFSET, - eStyleAnimType_None) -#endif -CSS_PROP_SHORTHAND( - -moz-margin-start, - margin_start, - CSS_PROP_DOMPROP_PREFIXED(MarginStart), - CSS_PROPERTY_PARSE_FUNCTION | - CSS_PROPERTY_APPLIES_TO_PAGE_RULE, - "") -#ifndef CSS_PROP_LIST_EXCLUDE_INTERNAL -CSS_PROP_MARGIN( - margin-start-value, - margin_start_value, - MarginStartValue, - CSS_PROPERTY_PARSE_INACCESSIBLE | - CSS_PROPERTY_APPLIES_TO_FIRST_LETTER | - CSS_PROPERTY_STORES_CALC | - CSS_PROPERTY_APPLIES_TO_PAGE_RULE, - "", - VARIANT_AHLP | VARIANT_CALC, // for internal use - nullptr, - CSS_PROP_NO_OFFSET, - eStyleAnimType_None) -#endif CSS_PROP_MARGIN( margin-top, margin_top, diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 0a085462d0a..934d86e2169 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -574,10 +574,6 @@ nsCSSProps::OtherNameFor(nsCSSProperty aProperty) return eCSSProperty_border_right_style; case eCSSProperty_border_right_width_value: return eCSSProperty_border_right_width; - case eCSSProperty_margin_left_value: - return eCSSProperty_margin_left; - case eCSSProperty_margin_right_value: - return eCSSProperty_margin_right; default: NS_ABORT_IF_FALSE(false, "bad caller"); } @@ -2572,46 +2568,9 @@ static const nsCSSProperty gListStyleSubpropTable[] = { static const nsCSSProperty gMarginSubpropTable[] = { // Code relies on these being in top-right-bottom-left order. eCSSProperty_margin_top, - eCSSProperty_margin_right_value, + eCSSProperty_margin_right, eCSSProperty_margin_bottom, - eCSSProperty_margin_left_value, - // extras: - eCSSProperty_margin_left_ltr_source, - eCSSProperty_margin_left_rtl_source, - eCSSProperty_margin_right_ltr_source, - eCSSProperty_margin_right_rtl_source, - eCSSProperty_UNKNOWN -}; - -static const nsCSSProperty gMarginLeftSubpropTable[] = { - // nsCSSParser::ParseDirectionalBoxProperty depends on this order - eCSSProperty_margin_left_value, - eCSSProperty_margin_left_ltr_source, - eCSSProperty_margin_left_rtl_source, - eCSSProperty_UNKNOWN -}; - -static const nsCSSProperty gMarginRightSubpropTable[] = { - // nsCSSParser::ParseDirectionalBoxProperty depends on this order - eCSSProperty_margin_right_value, - eCSSProperty_margin_right_ltr_source, - eCSSProperty_margin_right_rtl_source, - eCSSProperty_UNKNOWN -}; - -static const nsCSSProperty gMarginStartSubpropTable[] = { - // nsCSSParser::ParseDirectionalBoxProperty depends on this order - eCSSProperty_margin_start_value, - eCSSProperty_margin_left_ltr_source, - eCSSProperty_margin_right_rtl_source, - eCSSProperty_UNKNOWN -}; - -static const nsCSSProperty gMarginEndSubpropTable[] = { - // nsCSSParser::ParseDirectionalBoxProperty depends on this order - eCSSProperty_margin_end_value, - eCSSProperty_margin_right_ltr_source, - eCSSProperty_margin_left_rtl_source, + eCSSProperty_margin_left, eCSSProperty_UNKNOWN }; diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index ba68149e6f3..4742ac120a2 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -6499,28 +6499,13 @@ nsRuleNode::ComputeMarginData(void* aStartStruct, { COMPUTE_START_RESET(Margin, (), margin, parentMargin) - // margin: length, percent, auto, inherit - nsStyleCoord coord; - nsCSSRect ourMargin; - ourMargin.mTop = *aRuleData->ValueForMarginTop(); - ourMargin.mRight = *aRuleData->ValueForMarginRightValue(); - ourMargin.mBottom = *aRuleData->ValueForMarginBottom(); - ourMargin.mLeft = *aRuleData->ValueForMarginLeftValue(); - AdjustLogicalBoxProp(aContext, - *aRuleData->ValueForMarginLeftLTRSource(), - *aRuleData->ValueForMarginLeftRTLSource(), - *aRuleData->ValueForMarginStartValue(), - *aRuleData->ValueForMarginEndValue(), - NS_SIDE_LEFT, ourMargin, canStoreInRuleTree); - AdjustLogicalBoxProp(aContext, - *aRuleData->ValueForMarginRightLTRSource(), - *aRuleData->ValueForMarginRightRTLSource(), - *aRuleData->ValueForMarginEndValue(), - *aRuleData->ValueForMarginStartValue(), - NS_SIDE_RIGHT, ourMargin, canStoreInRuleTree); + // margin: length, percent, calc, inherit + const nsCSSProperty* subprops = + nsCSSProps::SubpropertyEntryFor(eCSSProperty_margin); + nsStyleCoord coord; NS_FOR_CSS_SIDES(side) { nsStyleCoord parentCoord = parentMargin->mMargin.Get(side); - if (SetCoord(ourMargin.*(nsCSSRect::sides[side]), + if (SetCoord(*aRuleData->ValueFor(subprops[side]), coord, parentCoord, SETCOORD_LPAH | SETCOORD_INITIAL_ZERO | SETCOORD_STORE_CALC | SETCOORD_UNSET_INITIAL, diff --git a/layout/style/test/ListCSSProperties.cpp b/layout/style/test/ListCSSProperties.cpp index f8a7c6b6302..007e82b2933 100644 --- a/layout/style/test/ListCSSProperties.cpp +++ b/layout/style/test/ListCSSProperties.cpp @@ -132,14 +132,6 @@ const char *gInaccessibleProperties[] = { "border-start-color-value", "border-start-style-value", "border-start-width-value", - "margin-end-value", - "margin-left-value", - "margin-right-value", - "margin-start-value", - "margin-left-ltr-source", - "margin-left-rtl-source", - "margin-right-ltr-source", - "margin-right-rtl-source", "-moz-control-character-visibility", "-moz-script-level", // parsed by UA sheets only "-moz-script-size-multiplier", diff --git a/layout/style/test/css_properties_like_longhand.js b/layout/style/test/css_properties_like_longhand.js index 55e9082db79..60b8fd5832c 100644 --- a/layout/style/test/css_properties_like_longhand.js +++ b/layout/style/test/css_properties_like_longhand.js @@ -1,7 +1,3 @@ var gShorthandPropertiesLikeLonghand = [ - { name: "-moz-margin-end", prop: "MozMarginEnd"}, - { name: "margin-left", prop: "marginLeft"}, - { name: "margin-right", prop: "marginRight"}, - { name: "-moz-margin-start", prop: "MozMarginStart"}, { name: "overflow", prop: "overflow"}, ]; diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 23132b6309d..9c63c725c20 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -1432,7 +1432,8 @@ var gCSSProperties = { "-moz-margin-end": { domProp: "MozMarginEnd", inherited: false, - type: CSS_TYPE_SHORTHAND_AND_LONGHAND, + type: CSS_TYPE_LONGHAND, + logical: true, get_computed: logical_box_prop_get_computed, /* no subproperties */ /* auto may or may not be initial */ @@ -1450,7 +1451,8 @@ var gCSSProperties = { "-moz-margin-start": { domProp: "MozMarginStart", inherited: false, - type: CSS_TYPE_SHORTHAND_AND_LONGHAND, + type: CSS_TYPE_LONGHAND, + logical: true, get_computed: logical_box_prop_get_computed, /* no subproperties */ /* auto may or may not be initial */ @@ -2861,8 +2863,7 @@ var gCSSProperties = { "margin-left": { domProp: "marginLeft", inherited: false, - type: CSS_TYPE_SHORTHAND_AND_LONGHAND, - /* no subproperties */ + type: CSS_TYPE_LONGHAND, /* XXX testing auto has prerequisites */ initial_values: [ "0", "0px", "0%", "calc(0pt)", "calc(0% + 0px)" ], other_values: [ "1px", "2em", "5%", ".5px", "+32px", "+.789px", "-.328px", "+0.56px", "-0.974px", "237px", "-289px", "-056px", "1987.45px", "-84.32px", @@ -2879,8 +2880,7 @@ var gCSSProperties = { "margin-right": { domProp: "marginRight", inherited: false, - type: CSS_TYPE_SHORTHAND_AND_LONGHAND, - /* no subproperties */ + type: CSS_TYPE_LONGHAND, /* XXX testing auto has prerequisites */ initial_values: [ "0", "0px", "0%", "calc(0pt)", "calc(0% + 0px)" ], other_values: [ "1px", "2em", "5%", @@ -4628,6 +4628,42 @@ if (SpecialPowers.getBoolPref("layout.css.vertical-text.enabled")) { "digits 12", "none 3", "digits 3.1415", "digits3", "digits 1", "digits 3 all", "digits foo", "digits all", "digits 3.0" ] }, + "margin-inline-end": { + domProp: "marginInlineEnd", + inherited: false, + type: CSS_TYPE_SHORTHAND_AND_LONGHAND, + alias_for: "-moz-margin-end", + get_computed: logical_box_prop_get_computed, + /* XXX testing auto has prerequisites */ + initial_values: [ "0", "0px", "0%", "calc(0pt)", "calc(0% + 0px)" ], + other_values: [ "1px", "2em", "5%", + "calc(2px)", + "calc(-2px)", + "calc(50%)", + "calc(3*25px)", + "calc(25px*3)", + "calc(3*25px + 50%)", + ], + invalid_values: [ "..25px", ".+5px", ".px", "-.px", "++5px", "-+4px", "+-3px", "--7px", "+-.6px", "-+.5px", "++.7px", "--.4px" ], + }, + "margin-inline-start": { + domProp: "marginInlineStart", + inherited: false, + type: CSS_TYPE_SHORTHAND_AND_LONGHAND, + alias_for: "-moz-margin-start", + get_computed: logical_box_prop_get_computed, + /* XXX testing auto has prerequisites */ + initial_values: [ "0", "0px", "0%", "calc(0pt)", "calc(0% + 0px)" ], + other_values: [ "1px", "2em", "5%", + "calc(2px)", + "calc(-2px)", + "calc(50%)", + "calc(3*25px)", + "calc(25px*3)", + "calc(3*25px + 50%)", + ], + invalid_values: [ "..25px", ".+5px", ".px", "-.px", "++5px", "-+4px", "+-3px", "--7px", "+-.6px", "-+.5px", "++.7px", "--.4px" ], + }, "padding-inline-end": { domProp: "paddingInlineEnd", inherited: false, diff --git a/layout/style/test/test_page_parser.html b/layout/style/test/test_page_parser.html index d887cc090c0..8c94be0bf17 100644 --- a/layout/style/test/test_page_parser.html +++ b/layout/style/test/test_page_parser.html @@ -26,13 +26,9 @@ // Check good properties with invalid units. { rule: _("margin: 2in; margin: 2vw;"), expected: { "margin-top": "2in", - "margin-right-value": "2in", + "margin-right": "2in", "margin-bottom": "2in", - "margin-left-value": "2in", - "margin-left-ltr-source": "physical", - "margin-left-rtl-source": "physical", - "margin-right-ltr-source": "physical", - "margin-right-rtl-source": "physical" + "margin-left": "2in" }}, { rule: _("margin-top: 2in; margin-top: 2vw;"), expected: {"margin-top": "2in"}}, { rule: _("margin-top: 2in; margin-top: 2vh;"), expected: {"margin-top": "2in"}}, @@ -40,30 +36,16 @@ { rule: _("margin-top: 2in; margin-top: 2vmin;"), expected: {"margin-top": "2in"}}, // Check good properties. - // NOTE: The margin-*-value and margin-*-source properties are not really - // expected and will need to be removed once bug 241234 is addressed. { rule: _("margin: 2in;"), expected: { "margin-top": "2in", - "margin-right-value": "2in", + "margin-right": "2in", "margin-bottom": "2in", - "margin-left-value": "2in", - "margin-left-ltr-source": "physical", - "margin-left-rtl-source": "physical", - "margin-right-ltr-source": "physical", - "margin-right-rtl-source": "physical" + "margin-left": "2in" }}, { rule: _("margin-top: 2in;"), expected: {"margin-top": "2in"}}, - { rule: _("margin-left: 2in;"), expected: { - "margin-left-value": "2in", - "margin-left-ltr-source": "physical", - "margin-left-rtl-source": "physical", - }}, + { rule: _("margin-left: 2in;"), expected: {"margin-left": "2in"}}, { rule: _("margin-bottom: 2in;"), expected: {"margin-bottom": "2in"}}, - { rule: _("margin-right: 2in;"), expected: { - "margin-right-value": "2in", - "margin-right-ltr-source": "physical", - "margin-right-rtl-source": "physical", - }} + { rule: _("margin-right: 2in;"), expected: {"margin-right": "2in"}} ]; var display = document.getElementById("display"); diff --git a/layout/style/test/test_value_computation.html b/layout/style/test/test_value_computation.html index a9214c98b89..cd48dfe6bf8 100644 --- a/layout/style/test/test_value_computation.html +++ b/layout/style/test/test_value_computation.html @@ -13,7 +13,12 @@