diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 8ee732cca3..8985863e8f 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -1109,6 +1109,12 @@ class CGHeaders(CGWrapper): # Now find all the things we'll need as arguments because we # need to wrap or unwrap them. bindingHeaders = set() + + # KeyframeAnimationOptions.webidl is doing something VERY screwy and + # Unified Building really sucks so directly include this + if prefix == "KeyframeAnimationOptionsBinding": + bindingHeaders.add("mozilla/dom/PrimitiveConversions.h") + declareIncludes = set(declareIncludes) def addHeadersForType((t, dictionary)): diff --git a/dom/bindings/WebIDLGlobalNameHash.cpp b/dom/bindings/WebIDLGlobalNameHash.cpp index 7477b52e7a..981a1a3953 100644 --- a/dom/bindings/WebIDLGlobalNameHash.cpp +++ b/dom/bindings/WebIDLGlobalNameHash.cpp @@ -4,8 +4,12 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include "jswrapper.h" #include "WebIDLGlobalNameHash.h" #include "js/GCAPI.h" +#include "XrayWrapper.h" +#include "XPCWrapper.h" +#include "mozilla/dom/Selection.h" #include "mozilla/HashFunctions.h" #include "mozilla/Maybe.h" #include "mozilla/dom/DOMJSProxyHandler.h" diff --git a/dom/bindings/WebIDLGlobalNameHash.h b/dom/bindings/WebIDLGlobalNameHash.h index bbe0153950..cd7be2c699 100644 --- a/dom/bindings/WebIDLGlobalNameHash.h +++ b/dom/bindings/WebIDLGlobalNameHash.h @@ -8,6 +8,7 @@ #define mozilla_dom_WebIDLGlobalNameHash_h__ #include "js/RootingAPI.h" +#include "nsString.h" #include "nsTArray.h" namespace mozilla { diff --git a/dom/bindings/moz.build b/dom/bindings/moz.build index ed8a4d37e5..ca82b48a8f 100644 --- a/dom/bindings/moz.build +++ b/dom/bindings/moz.build @@ -89,7 +89,7 @@ LOCAL_INCLUDES += [ '/media/webrtc/signaling/src/peerconnection', ] -UNIFIED_SOURCES += [ +SOURCES += [ 'BindingUtils.cpp', 'CallbackInterface.cpp', 'CallbackObject.cpp', diff --git a/dom/bindings/nsScriptError.h b/dom/bindings/nsScriptError.h index b8049d0a00..ac8099c1c3 100644 --- a/dom/bindings/nsScriptError.h +++ b/dom/bindings/nsScriptError.h @@ -14,8 +14,13 @@ #include "jsapi.h" #include "js/RootingAPI.h" +#include "jswrapper.h" +#include "nsCOMArray.h" +#include "nsContentUtils.h" +#include "nsCycleCollectionParticipant.h" #include "nsIScriptError.h" #include "nsString.h" +#include "nsStringFwd.h" class nsScriptErrorNote final : public nsIScriptErrorNote { public: diff --git a/dom/bindings/nsScriptErrorWithStack.cpp b/dom/bindings/nsScriptErrorWithStack.cpp index 74c00999fd..0a8df38b36 100644 --- a/dom/bindings/nsScriptErrorWithStack.cpp +++ b/dom/bindings/nsScriptErrorWithStack.cpp @@ -22,7 +22,7 @@ using namespace mozilla::dom; namespace { static nsCString -FormatStackString(JSContext* cx, HandleObject aStack) { +FormatStackString(JSContext* cx, JS::HandleObject aStack) { JS::RootedString formattedStack(cx); if (!JS::BuildStackString(cx, aStack, &formattedStack)) { @@ -111,7 +111,7 @@ nsScriptErrorWithStack::ToString(nsACString& /*UTF8*/ aResult) } JSContext* cx = jsapi.cx(); - RootedObject stack(cx, mStack); + JS::RootedObject stack(cx, mStack); nsCString stackString = FormatStackString(cx, stack); nsCString combined = message + NS_LITERAL_CSTRING("\n") + stackString; aResult.Assign(combined); diff --git a/dom/security/nsCSPUtils.cpp b/dom/security/nsCSPUtils.cpp index d07ad79457..6d4f297d6d 100644 --- a/dom/security/nsCSPUtils.cpp +++ b/dom/security/nsCSPUtils.cpp @@ -555,7 +555,21 @@ permitsPort(const nsAString& aEnforcementScheme, int32_t resourcePort; nsresult rv = aResourceURI->GetPort(&resourcePort); - NS_ENSURE_SUCCESS(rv, false); + if (NS_FAILED(rv) && aEnforcementPort.IsEmpty()) { + // If we cannot get a Port (e.g. because of an Custom Protocol handler) + // we need to check if a default port is associated with the Scheme + if (aEnforcementScheme.IsEmpty()) { + return false; + } + int defaultPortforScheme = + NS_GetDefaultPort(NS_ConvertUTF16toUTF8(aEnforcementScheme).get()); + + // If there is no default port associated with the Scheme ( + // defaultPortforScheme == -1) or it is an externally handled protocol ( + // defaultPortforScheme == 0 ) and the csp does not enforce a port - we can + // allow not having a port + return (defaultPortforScheme == -1 || defaultPortforScheme == 0); + } // Avoid unnecessary string creation/manipulation and don't block the // load if the resource to be loaded uses the default port for that diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index a8309314f8..556e35406a 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -1056,6 +1056,7 @@ protected: bool ParseOneFamily(nsAString& aFamily, bool& aOneKeyword, bool& aQuoted); bool ParseFamily(nsCSSValue& aValue); bool ParseFontFeatureSettings(nsCSSValue& aValue); + bool ParseFontVariationSettings(nsCSSValue& aValue); bool ParseFontSrc(nsCSSValue& aValue); bool ParseFontSrcFormat(InfallibleTArray& values); bool ParseFontRanges(nsCSSValue& aValue); @@ -12092,6 +12093,8 @@ CSSParserImpl::ParseSingleValuePropertyByFunction(nsCSSValue& aValue, return ParseFontVariantNumeric(aValue); case eCSSProperty_font_feature_settings: return ParseFontFeatureSettings(aValue); + case eCSSProperty_font_variation_settings: + return ParseFontVariationSettings(aValue); case eCSSProperty_font_weight: return ParseFontWeight(aValue); case eCSSProperty_image_orientation: @@ -15315,6 +15318,19 @@ CSSParserImpl::ParseFontFeatureSettings(nsCSSValue& aValue) return true; } +bool +CSSParserImpl::ParseFontVariationSettings(nsCSSValue& aValue) +{ + // TODO: Actually implement this. + + // This stub is here because websites insist on considering this + // very hardware-dependent and O.S.-variable low-level font-control + // as a "critical feature" which it isn't as there is 0 guarantee + // that font variation settings are supported or honored by any + // operating system used by the client. + return true; +} + bool CSSParserImpl::ParseListStyle() { diff --git a/layout/style/nsCSSPropList.h b/layout/style/nsCSSPropList.h index 07db6d3ddc..411f982a4e 100644 --- a/layout/style/nsCSSPropList.h +++ b/layout/style/nsCSSPropList.h @@ -2036,6 +2036,20 @@ CSS_PROP_FONT( kFontVariantPositionKTable, CSS_PROP_NO_OFFSET, eStyleAnimType_Discrete) +CSS_PROP_FONT( + font-variation-settings, + font_variation_settings, + FontVariationSettings, + CSS_PROPERTY_PARSE_VALUE | + CSS_PROPERTY_VALUE_PARSER_FUNCTION | + CSS_PROPERTY_VALUE_LIST_USES_COMMAS | + CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE | + CSS_PROPERTY_APPLIES_TO_PLACEHOLDER, + "layout.css.font-variations.stub", + 0, + nullptr, + CSS_PROP_NO_OFFSET, + eStyleAnimType_Discrete) CSS_PROP_FONT( font-weight, font_weight, diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 647f7f6dc5..910c1de8ae 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -674,9 +674,9 @@ nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush) mPresShell->GetPresContext()->GetRestyleGeneration(); if (mStyleContext) { - // We can't rely on the undisplayed restyle generation if mElement is - // out-of-document, since that generation is not incremented for DOM changes - // on out-of-document elements. + // We can't rely on the undisplayed restyle generation if mElement is + // out-of-document, since that generation is not incremented for DOM changes + // on out-of-document elements. if (mStyleContextGeneration == currentGeneration && mElement->IsInComposedDoc()) { // Our cached style context is still valid. @@ -1619,6 +1619,16 @@ nsComputedDOMStyle::DoGetFontFeatureSettings() return val.forget(); } +already_AddRefed +nsComputedDOMStyle::DoGetFontVariationSettings() +{ + // TODO: This is still a stub, always returning "normal" + RefPtr val = new nsROCSSPrimitiveValue; + + val->SetIdent(eCSSKeyword_normal); + return val.forget(); +} + already_AddRefed nsComputedDOMStyle::DoGetFontKerning() { diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index 7fbf49afe7..e94d8dbf64 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -251,6 +251,7 @@ private: already_AddRefed DoGetColor(); already_AddRefed DoGetFontFamily(); already_AddRefed DoGetFontFeatureSettings(); + already_AddRefed DoGetFontVariationSettings(); already_AddRefed DoGetFontKerning(); already_AddRefed DoGetFontLanguageOverride(); already_AddRefed DoGetFontSize(); diff --git a/layout/style/nsComputedDOMStylePropertyList.h b/layout/style/nsComputedDOMStylePropertyList.h index 825976b583..5572818105 100644 --- a/layout/style/nsComputedDOMStylePropertyList.h +++ b/layout/style/nsComputedDOMStylePropertyList.h @@ -144,6 +144,7 @@ COMPUTED_STYLE_PROP(font_variant_east_asian, FontVariantEastAsian) COMPUTED_STYLE_PROP(font_variant_ligatures, FontVariantLigatures) COMPUTED_STYLE_PROP(font_variant_numeric, FontVariantNumeric) COMPUTED_STYLE_PROP(font_variant_position, FontVariantPosition) +COMPUTED_STYLE_PROP(font_variation_settings, FontVariationSettings) COMPUTED_STYLE_PROP(font_weight, FontWeight) COMPUTED_STYLE_PROP(grid_auto_columns, GridAutoColumns) COMPUTED_STYLE_PROP(grid_auto_flow, GridAutoFlow) diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index 0e54fd093e..868f83bda2 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -1237,19 +1237,29 @@ PaintRowGroupBackgroundByColIdx(nsTableRowGroupFrame* aRowGroup, const nsTArray& aColIdx, const nsPoint& aOffset) { + MOZ_DIAGNOSTIC_ASSERT(!aColIdx.IsEmpty(), + "Must be painting backgrounds for something"); for (nsTableRowFrame* row = aRowGroup->GetFirstRow(); row; row = row->GetNextRow()) { auto rowPos = row->GetNormalPosition() + aOffset; if (!aDirtyRect.Intersects(nsRect(rowPos, row->GetSize()))) { continue; } for (nsTableCellFrame* cell = row->GetFirstCell(); cell; cell = cell->GetNextCell()) { + + int32_t curColIdx; + cell->GetColIndex(curColIdx); + if (!aColIdx.Contains(curColIdx)) { + if (curColIdx > aColIdx.LastElement()) { + // We can just stop looking at this row. + break; + } + continue; + } + if (!cell->ShouldPaintBackground(aBuilder)) { continue; } - int32_t curColIdx; - cell->GetColIndex(curColIdx); - if (aColIdx.Contains(curColIdx)) { auto cellPos = cell->GetNormalPosition() + rowPos; auto cellRect = nsRect(cellPos, cell->GetSize()); if (!aDirtyRect.Intersects(cellRect)) { @@ -1260,7 +1270,6 @@ PaintRowGroupBackgroundByColIdx(nsTableRowGroupFrame* aRowGroup, true, nullptr, aFrame->GetRectRelativeToSelf(), cell); - } } } } @@ -1311,18 +1320,23 @@ nsTableFrame::DisplayGenericTablePart(nsDisplayListBuilder* aBuilder, // Collecting column index. AutoTArray colIdx; for (nsTableColFrame* col = colGroup->GetFirstColumn(); col; col = col->GetNextCol()) { + MOZ_ASSERT(colIdx.IsEmpty() || + col->GetColIndex() > colIdx.LastElement()); colIdx.AppendElement(col->GetColIndex()); } - nsTableFrame* table = colGroup->GetTableFrame(); - RowGroupArray rowGroups; - table->OrderRowGroups(rowGroups); - for (nsTableRowGroupFrame* rowGroup : rowGroups) { - auto offset = rowGroup->GetNormalPosition() - colGroup->GetNormalPosition(); - if (!aDirtyRect.Intersects(nsRect(offset, rowGroup->GetSize()))) { - continue; - } + if (!colIdx.IsEmpty()) { + // We have some actual cells that live inside this rowgroup. + nsTableFrame* table = colGroup->GetTableFrame(); + RowGroupArray rowGroups; + table->OrderRowGroups(rowGroups); + for (nsTableRowGroupFrame* rowGroup : rowGroups) { + auto offset = rowGroup->GetNormalPosition() - colGroup->GetNormalPosition(); + if (!aDirtyRect.Intersects(nsRect(offset, rowGroup->GetSize()))) { + continue; + } PaintRowGroupBackgroundByColIdx(rowGroup, aFrame, aBuilder, aLists, aDirtyRect, colIdx, offset); + } } } else if (aFrame->GetType() == nsGkAtoms::tableColFrame) { // Compute background rect by iterating all cell frame. diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 2d9dae7cec..d695a6adcc 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -2528,6 +2528,9 @@ pref("layout.css.image-orientation.enabled", true); // Is support for the font-display @font-face descriptor enabled? pref("layout.css.font-display.enabled", false); +// Enable the font variation stub code? +pref("layout.css.font-variations.stub", true); + // Are sets of prefixed properties supported? pref("layout.css.prefixes.border-image", true); pref("layout.css.prefixes.transforms", true); diff --git a/toolkit/mozapps/downloads/nsHelperAppDlg.js b/toolkit/mozapps/downloads/nsHelperAppDlg.js index 52d8b4f900..90d38c90b0 100644 --- a/toolkit/mozapps/downloads/nsHelperAppDlg.js +++ b/toolkit/mozapps/downloads/nsHelperAppDlg.js @@ -638,6 +638,7 @@ nsUnknownContentTypeDialog.prototype = { // Returns true if opening the default application makes sense. openWithDefaultOK: function() { + // The checking is different on Windows... #ifdef XP_WIN // Windows presents some special cases. // We need to prevent use of "system default" when the file is @@ -675,7 +676,7 @@ nsUnknownContentTypeDialog.prototype = { // getPath: getPath: function (aFile) { #ifdef XP_MACOSX - return aFile.leafName || aFile.path; + return aFile.leafName || aFile.path; #else return aFile.path; #endif @@ -1007,11 +1008,13 @@ nsUnknownContentTypeDialog.prototype = { var otherHandler = this.dialogElement("otherHandler"); otherHandler.removeAttribute("hidden"); otherHandler.setAttribute("path", this.getPath(this.chosenApp.executable)); + #ifdef XP_WIN otherHandler.label = this.getFileDisplayName(this.chosenApp.executable); #else otherHandler.label = this.chosenApp.name; #endif + this.dialogElement("openHandler").selectedIndex = 1; this.dialogElement("openHandler").setAttribute("lastSelectedItemID", "otherHandler"); @@ -1069,40 +1072,40 @@ nsUnknownContentTypeDialog.prototype = { // Remember the file they chose to run. this.chosenApp = params.handlerApp; } -#else +#else // XP_WIN #if MOZ_WIDGET_GTK == 3 - var nsIApplicationChooser = Components.interfaces.nsIApplicationChooser; - var appChooser = Components.classes["@mozilla.org/applicationchooser;1"] - .createInstance(nsIApplicationChooser); - appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle")); - var contentTypeDialogObj = this; - let appChooserCallback = function appChooserCallback_done(aResult) { - if (aResult) { - contentTypeDialogObj.chosenApp = aResult.QueryInterface(Components.interfaces.nsILocalHandlerApp); - } - contentTypeDialogObj.finishChooseApp(); - }; - appChooser.open(this.mLauncher.MIMEInfo.MIMEType, appChooserCallback); - // The finishChooseApp is called from appChooserCallback - return; -#else - var nsIFilePicker = Components.interfaces.nsIFilePicker; - var fp = Components.classes["@mozilla.org/filepicker;1"] - .createInstance(nsIFilePicker); - fp.init(this.mDialog, - this.dialogElement("strings").getString("chooseAppFilePickerTitle"), - nsIFilePicker.modeOpen); - - fp.appendFilters(nsIFilePicker.filterApps); - - if (fp.show() == nsIFilePicker.returnOK && fp.file) { - // Remember the file they chose to run. - var localHandlerApp = - Components.classes["@mozilla.org/uriloader/local-handler-app;1"]. - createInstance(Components.interfaces.nsILocalHandlerApp); - localHandlerApp.executable = fp.file; - this.chosenApp = localHandlerApp; + var nsIApplicationChooser = Components.interfaces.nsIApplicationChooser; + var appChooser = Components.classes["@mozilla.org/applicationchooser;1"] + .createInstance(nsIApplicationChooser); + appChooser.init(this.mDialog, this.dialogElement("strings").getString("chooseAppFilePickerTitle")); + var contentTypeDialogObj = this; + let appChooserCallback = function appChooserCallback_done(aResult) { + if (aResult) { + contentTypeDialogObj.chosenApp = aResult.QueryInterface(Components.interfaces.nsILocalHandlerApp); } + contentTypeDialogObj.finishChooseApp(); + }; + appChooser.open(this.mLauncher.MIMEInfo.MIMEType, appChooserCallback); + // The finishChooseApp is called from appChooserCallback + return; +#else // MOZ_WIDGET_GTK == 3 + var nsIFilePicker = Components.interfaces.nsIFilePicker; + var fp = Components.classes["@mozilla.org/filepicker;1"] + .createInstance(nsIFilePicker); + fp.init(this.mDialog, + this.dialogElement("strings").getString("chooseAppFilePickerTitle"), + nsIFilePicker.modeOpen); + + fp.appendFilters(nsIFilePicker.filterApps); + + if (fp.show() == nsIFilePicker.returnOK && fp.file) { + // Remember the file they chose to run. + var localHandlerApp = + Components.classes["@mozilla.org/uriloader/local-handler-app;1"]. + createInstance(Components.interfaces.nsILocalHandlerApp); + localHandlerApp.executable = fp.file; + this.chosenApp = localHandlerApp; + } #endif // MOZ_WIDGET_GTK == 3 #endif // XP_WIN this.finishChooseApp();