diff --git a/devtools/client/shared/widgets/VariablesView.jsm b/devtools/client/shared/widgets/VariablesView.jsm index 2ba8d74916..fc9d084363 100644 --- a/devtools/client/shared/widgets/VariablesView.jsm +++ b/devtools/client/shared/widgets/VariablesView.jsm @@ -908,6 +908,10 @@ VariablesView.prototype = { // Copy current selection to clipboard. if (e.ctrlKey || e.metaKey) { let item = this.getFocusedItem(); + if (!item) { + // No item is selected; do nothing. + return; + } clipboardHelper.copyString( item._nameString + item.separatorStr + item._valueString ); diff --git a/devtools/shared/css/generated/properties-db.js b/devtools/shared/css/generated/properties-db.js index d9b5ee65b7..fb95ffd1f1 100644 --- a/devtools/shared/css/generated/properties-db.js +++ b/devtools/shared/css/generated/properties-db.js @@ -7257,6 +7257,25 @@ exports.CSS_PROPERTIES = { "unset" ] }, + "margin-block": { + "isInherited": false, + "subproperties": [ + "margin-block-start", + "margin-block-end" + ], + "supports": [ + 6, + 8 + ], + "values": [ + "-moz-calc", + "auto", + "calc", + "inherit", + "initial", + "unset" + ] + }, "margin-block-end": { "isInherited": false, "subproperties": [ @@ -7311,6 +7330,25 @@ exports.CSS_PROPERTIES = { "unset" ] }, + "margin-inline": { + "isInherited": false, + "subproperties": [ + "margin-inline-start", + "margin-inline-end" + ], + "supports": [ + 6, + 8 + ], + "values": [ + "-moz-calc", + "auto", + "calc", + "inherit", + "initial", + "unset" + ] + }, "margin-inline-end": { "isInherited": false, "subproperties": [ @@ -8246,6 +8284,24 @@ exports.CSS_PROPERTIES = { "unset" ] }, + "padding-block": { + "isInherited": false, + "subproperties": [ + "padding-block-start", + "padding-block-end" + ], + "supports": [ + 6, + 8 + ], + "values": [ + "-moz-calc", + "calc", + "inherit", + "initial", + "unset" + ] + }, "padding-block-end": { "isInherited": false, "subproperties": [ @@ -8297,6 +8353,24 @@ exports.CSS_PROPERTIES = { "unset" ] }, + "padding-inline": { + "isInherited": false, + "subproperties": [ + "padding-inline-start", + "padding-inline-end" + ], + "supports": [ + 6, + 8 + ], + "values": [ + "-moz-calc", + "calc", + "inherit", + "initial", + "unset" + ] + }, "padding-inline-end": { "isInherited": false, "subproperties": [ diff --git a/dom/workers/WorkerRunnable.cpp b/dom/workers/WorkerRunnable.cpp index eb56650b51..9049878710 100644 --- a/dom/workers/WorkerRunnable.cpp +++ b/dom/workers/WorkerRunnable.cpp @@ -231,8 +231,13 @@ WorkerRunnable::Run() { bool targetIsWorkerThread = mBehavior == WorkerThreadModifyBusyCount || mBehavior == WorkerThreadUnchangedBusyCount; + bool alreadyCanceled = IsCanceled() && !mCallingCancelWithinRun; + bool shouldCancelWorker = targetIsWorkerThread && + mWorkerPrivate->AllPendingRunnablesShouldBeCanceled() && + !IsCanceled() && !mCallingCancelWithinRun; + bool runnableWillRun = !alreadyCanceled && !shouldCancelWorker; - if (targetIsWorkerThread) { + if (targetIsWorkerThread && runnableWillRun) { // On a worker thread, a WorkerRunnable should only run when there is an // underlying WorkerThreadPrimaryRunnable active, which means we should // find a CycleCollectedJSContext. @@ -256,14 +261,11 @@ WorkerRunnable::Run() } #endif - if (IsCanceled() && !mCallingCancelWithinRun) { + if (alreadyCanceled) { return NS_OK; } - if (targetIsWorkerThread && - mWorkerPrivate->AllPendingRunnablesShouldBeCanceled() && - !IsCanceled() && !mCallingCancelWithinRun) { - + if (shouldCancelWorker) { // Prevent recursion. mCallingCancelWithinRun = true; diff --git a/layout/style/Declaration.cpp b/layout/style/Declaration.cpp index ab2def15fa..989e45765c 100644 --- a/layout/style/Declaration.cpp +++ b/layout/style/Declaration.cpp @@ -1474,6 +1474,10 @@ Declaration::GetPropertyValueInternal( } MOZ_FALLTHROUGH; } + case eCSSProperty_margin_block: + case eCSSProperty_margin_inline: + case eCSSProperty_padding_block: + case eCSSProperty_padding_inline: case eCSSProperty_gap: { const nsCSSPropertyID* subprops = nsCSSProps::SubpropertyEntryFor(aProperty); diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 494d8f6aa6..2cb6e3ec13 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -1084,12 +1084,16 @@ protected: bool ParseListStyle(); bool ParseListStyleType(nsCSSValue& aValue); bool ParseMargin(); + bool ParseMarginBlock(); + bool ParseMarginInline(); bool ParseClipPath(nsCSSValue& aValue); bool ParseTransform(bool aIsPrefixed, bool aDisallowRelativeValues = false); bool ParseObjectPosition(); bool ParseOutline(); bool ParseOverflow(); bool ParsePadding(); + bool ParsePaddingBlock(); + bool ParsePaddingInline(); bool ParseQuotes(); bool ParseTextAlign(nsCSSValue& aValue, const KTableEntry aTable[]); @@ -1188,6 +1192,10 @@ protected: // Reused utility parsing routines void AppendValue(nsCSSPropertyID aPropID, const nsCSSValue& aValue); bool ParseBoxProperties(const nsCSSPropertyID aPropIDs[]); + bool ParseBoxPairProperties(int32_t aSingleVariantMask, + int32_t aPairVariantMask, + nsCSSPropertyID aStart, + nsCSSPropertyID aEnd); bool ParseGroupedBoxProperty(int32_t aVariantMask, nsCSSValue& aValue, uint32_t aRestrictions); @@ -10107,25 +10115,10 @@ CSSParserImpl::ParseGridArea() bool CSSParserImpl::ParseGap() { - nsCSSValue first; - if (ParseSingleTokenVariant(first, VARIANT_INHERIT, nullptr)) { - AppendValue(eCSSProperty_row_gap, first); - AppendValue(eCSSProperty_column_gap, first); - return true; - } - if (ParseNonNegativeVariant(first, VARIANT_LPCALC, nullptr) != - CSSParseResult::Ok) { - return false; - } - nsCSSValue second; - auto result = ParseNonNegativeVariant(second, VARIANT_LPCALC, nullptr); - if (result == CSSParseResult::Error) { - return false; - } - AppendValue(eCSSProperty_row_gap, first); - AppendValue(eCSSProperty_column_gap, - result == CSSParseResult::NotFound ? first : second); - return true; + return ParseBoxPairProperties(VARIANT_INHERIT, + VARIANT_LPCALC, + eCSSProperty_row_gap, + eCSSProperty_column_gap); } // normal | [ ?] @@ -11448,6 +11441,33 @@ CSSParserImpl::ParseBoxProperties(const nsCSSPropertyID aPropIDs[]) return true; } +bool +CSSParserImpl::ParseBoxPairProperties(int32_t aSingleVariantMask, + int32_t aPairVariantMask, + nsCSSPropertyID aStart, + nsCSSPropertyID aEnd) +{ + nsCSSValue first; + if (ParseSingleTokenVariant(first, aSingleVariantMask, nullptr)) { + AppendValue(aStart, first); + AppendValue(aEnd, first); + return true; + } + if (ParseNonNegativeVariant(first, aPairVariantMask, nullptr) != + CSSParseResult::Ok) { + return false; + } + nsCSSValue second; + auto result = ParseNonNegativeVariant(second, aPairVariantMask, nullptr); + if (result == CSSParseResult::Error) { + return false; + } + AppendValue(aStart, first); + AppendValue(aEnd, + result == CSSParseResult::NotFound ? first : second); + return true; +} + // Similar to ParseBoxProperties, except there is only one property // with the result as its value, not four. bool @@ -12045,6 +12065,10 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSPropertyID aPropID) return ParseListStyle(); case eCSSProperty_margin: return ParseMargin(); + case eCSSProperty_margin_block: + return ParseMarginBlock(); + case eCSSProperty_margin_inline: + return ParseMarginInline(); case eCSSProperty_object_position: return ParseObjectPosition(); case eCSSProperty_outline: @@ -12053,6 +12077,10 @@ CSSParserImpl::ParsePropertyByFunction(nsCSSPropertyID aPropID) return ParseOverflow(); case eCSSProperty_padding: return ParsePadding(); + case eCSSProperty_padding_block: + return ParsePaddingBlock(); + case eCSSProperty_padding_inline: + return ParsePaddingInline(); case eCSSProperty_quotes: return ParseQuotes(); case eCSSProperty_text_decoration: @@ -15503,6 +15531,24 @@ CSSParserImpl::ParseMargin() return ParseBoxProperties(kMarginSideIDs); } +bool +CSSParserImpl::ParseMarginBlock() +{ + return ParseBoxPairProperties(VARIANT_AUTO | VARIANT_INHERIT, + VARIANT_AUTO | VARIANT_LPCALC, + eCSSProperty_margin_block_start, + eCSSProperty_margin_block_end); +} + +bool +CSSParserImpl::ParseMarginInline() +{ + return ParseBoxPairProperties(VARIANT_AUTO | VARIANT_INHERIT, + VARIANT_AUTO | VARIANT_LPCALC, + eCSSProperty_margin_inline_start, + eCSSProperty_margin_inline_end); +} + bool CSSParserImpl::ParseObjectPosition() { @@ -15589,6 +15635,24 @@ CSSParserImpl::ParsePadding() return ParseBoxProperties(kPaddingSideIDs); } +bool +CSSParserImpl::ParsePaddingBlock() +{ + return ParseBoxPairProperties(VARIANT_AUTO | VARIANT_INHERIT, + VARIANT_AUTO | VARIANT_LPCALC, + eCSSProperty_padding_block_start, + eCSSProperty_padding_block_end); +} + +bool +CSSParserImpl::ParsePaddingInline() +{ + return ParseBoxPairProperties(VARIANT_AUTO | VARIANT_INHERIT, + VARIANT_AUTO | VARIANT_LPCALC, + eCSSProperty_padding_inline_start, + eCSSProperty_padding_inline_end); +} + bool CSSParserImpl::ParseQuotes() { diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index f78dd0103c..141e8e3125 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -2494,6 +2494,13 @@ CSS_PROP_SHORTHAND( CSS_PROPERTY_UNITLESS_LENGTH_QUIRK | CSS_PROPERTY_APPLIES_TO_PAGE_RULE, "") +CSS_PROP_SHORTHAND( + margin-block, + margin_block, + MarginBlock, + CSS_PROPERTY_PARSE_FUNCTION | + CSS_PROPERTY_APPLIES_TO_PAGE_RULE, + "") CSS_PROP_LOGICAL( margin-block-end, margin_block_end, @@ -2546,6 +2553,13 @@ CSS_PROP_MARGIN( nullptr, offsetof(nsStyleMargin, mMargin), eStyleAnimType_Sides_Bottom) +CSS_PROP_SHORTHAND( + margin-inline, + margin_inline, + MarginInline, + CSS_PROPERTY_PARSE_FUNCTION | + CSS_PROPERTY_APPLIES_TO_PAGE_RULE, + "") CSS_PROP_LOGICAL( margin-inline-end, margin_inline_end, @@ -3245,6 +3259,12 @@ CSS_PROP_SHORTHAND( CSS_PROPERTY_PARSE_FUNCTION | CSS_PROPERTY_UNITLESS_LENGTH_QUIRK, "") +CSS_PROP_SHORTHAND( + padding-block, + padding_block, + PaddingBlock, + CSS_PROPERTY_PARSE_FUNCTION, + "") CSS_PROP_LOGICAL( padding-block-end, padding_block_end, @@ -3303,6 +3323,12 @@ CSS_PROP_PADDING( nullptr, offsetof(nsStylePadding, mPadding), eStyleAnimType_Sides_Bottom) +CSS_PROP_SHORTHAND( + padding-inline, + padding_inline, + PaddingInline, + CSS_PROPERTY_PARSE_FUNCTION, + "") CSS_PROP_LOGICAL( padding-inline-end, padding_inline_end, diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 0f3a1daeda..7f1fe2c18f 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -2927,6 +2927,17 @@ static const nsCSSPropertyID gMarginSubpropTable[] = { eCSSProperty_UNKNOWN }; +static const nsCSSPropertyID gMarginBlockSubpropTable[] = { + eCSSProperty_margin_block_start, + eCSSProperty_margin_block_end, + eCSSProperty_UNKNOWN +}; + +static const nsCSSPropertyID gMarginInlineSubpropTable[] = { + eCSSProperty_margin_inline_start, + eCSSProperty_margin_inline_end, + eCSSProperty_UNKNOWN +}; static const nsCSSPropertyID gOutlineSubpropTable[] = { // nsCSSDeclaration.cpp outputs the subproperties in this order. @@ -3023,6 +3034,18 @@ static const nsCSSPropertyID gPaddingSubpropTable[] = { eCSSProperty_UNKNOWN }; +static const nsCSSPropertyID gPaddingBlockSubpropTable[] = { + eCSSProperty_padding_block_start, + eCSSProperty_padding_block_end, + eCSSProperty_UNKNOWN +}; + +static const nsCSSPropertyID gPaddingInlineSubpropTable[] = { + eCSSProperty_padding_inline_start, + eCSSProperty_padding_inline_end, + eCSSProperty_UNKNOWN +}; + static const nsCSSPropertyID gTextDecorationSubpropTable[] = { eCSSProperty_text_decoration_color, eCSSProperty_text_decoration_line, diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index 46ef89ba0c..e8ce0190f1 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -1810,6 +1810,22 @@ var gCSSProperties = { other_values: [ "rect(3px 20px 15px 4px)", "rect(17px, 21px, 33px, 2px)" ], invalid_values: [ "rect(17px, 21px, 33, 2px)" ] }, + "margin-inline": { + domProp: "marginInline", + inherited: false, + type: CSS_TYPE_TRUE_SHORTHAND, + subproperties: [ "margin-inline-start", "margin-inline-end" ], + initial_values: [ "0", "0px 0em" ], + other_values: [ "1px", "3em 1%", "5%", + "calc(2px) 1%", + "calc(-2px) 1%", + "calc(50%) 1%", + "calc(3*25px) calc(2px)", + "calc(25px*3) 1em", + "calc(3*25px + 50%) calc(3*25px - 50%)", + ], + invalid_values: [ "5", "..25px", ".+5px", ".px", "-.px", "++5px", "-+4px", "+-3px", "--7px", "+-.6px", "-+.5px", "++.7px", "--.4px" ], + }, "margin-inline-end": { domProp: "marginInlineEnd", inherited: false, @@ -1959,6 +1975,22 @@ var gCSSProperties = { ], invalid_values: [ "-1px", "4px -2px", "inherit 2px", "2px inherit", "2", "2px 2", "2 2px" ] }, + "padding-inline": { + domProp: "paddingInline", + inherited: false, + type: CSS_TYPE_TRUE_SHORTHAND, + subproperties: [ "padding-inline-start", "padding-inline-end" ], + initial_values: [ "0", "0px 0em" ], + other_values: [ "1px", "3em 1%", "5%", + "calc(2px) 1%", + "calc(-2px) 1%", + "calc(50%) 1%", + "calc(3*25px) calc(2px)", + "calc(25px*3) 1em", + "calc(3*25px + 50%) calc(3*25px - 50%)", + ], + invalid_values: [ "5", "..25px", ".+5px", ".px", "-.px", "++5px", "-+4px", "+-3px", "--7px", "+-.6px", "-+.5px", "++.7px", "--.4px" ], + }, "padding-inline-end": { domProp: "paddingInlineEnd", inherited: false, @@ -5269,6 +5301,22 @@ var gCSSProperties = { ], invalid_values: [ "none" ], }, + "margin-block": { + domProp: "marginBlock", + inherited: false, + type: CSS_TYPE_TRUE_SHORTHAND, + subproperties: [ "margin-block-start", "margin-block-end" ], + initial_values: [ "0", "0px 0em" ], + other_values: [ "1px", "3em 1%", "5%", + "calc(2px) 1%", + "calc(-2px) 1%", + "calc(50%) 1%", + "calc(3*25px) calc(2px)", + "calc(25px*3) 1em", + "calc(3*25px + 50%) calc(3*25px - 50%)", + ], + invalid_values: [ "5", "..25px", ".+5px", ".px", "-.px", "++5px", "-+4px", "+-3px", "--7px", "+-.6px", "-+.5px", "++.7px", "--.4px" ], + }, "margin-block-end": { domProp: "marginBlockEnd", inherited: false, @@ -5531,6 +5579,22 @@ var gCSSProperties = { alias_for: "inset-inline-end", subproperties: [ "inset-inline-end" ], }, + "padding-block": { + domProp: "paddingBlock", + inherited: false, + type: CSS_TYPE_TRUE_SHORTHAND, + subproperties: [ "padding-block-start", "padding-block-end" ], + initial_values: [ "0", "0px 0em" ], + other_values: [ "1px", "3em 1%", "5%", + "calc(2px) 1%", + "calc(-2px) 1%", + "calc(50%) 1%", + "calc(3*25px) calc(2px)", + "calc(25px*3) 1em", + "calc(3*25px + 50%) calc(3*25px - 50%)", + ], + invalid_values: [ "5", "..25px", ".+5px", ".px", "-.px", "++5px", "-+4px", "+-3px", "--7px", "+-.6px", "-+.5px", "++.7px", "--.4px" ], + }, "padding-block-end": { domProp: "paddingBlockEnd", inherited: false,