Merge remote-tracking branch 'origin/master' into custom

This commit is contained in:
Roy Tam 2020-02-13 07:18:44 +08:00
commit 46f3d1d2a3
15 changed files with 144 additions and 52 deletions

View file

@ -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)):

View file

@ -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"

View file

@ -8,6 +8,7 @@
#define mozilla_dom_WebIDLGlobalNameHash_h__
#include "js/RootingAPI.h"
#include "nsString.h"
#include "nsTArray.h"
namespace mozilla {

View file

@ -89,7 +89,7 @@ LOCAL_INCLUDES += [
'/media/webrtc/signaling/src/peerconnection',
]
UNIFIED_SOURCES += [
SOURCES += [
'BindingUtils.cpp',
'CallbackInterface.cpp',
'CallbackObject.cpp',

View file

@ -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:

View file

@ -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);

View file

@ -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

View file

@ -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<nsCSSValue>& 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()
{

View file

@ -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,

View file

@ -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<CSSValue>
nsComputedDOMStyle::DoGetFontVariationSettings()
{
// TODO: This is still a stub, always returning "normal"
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetIdent(eCSSKeyword_normal);
return val.forget();
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetFontKerning()
{

View file

@ -251,6 +251,7 @@ private:
already_AddRefed<CSSValue> DoGetColor();
already_AddRefed<CSSValue> DoGetFontFamily();
already_AddRefed<CSSValue> DoGetFontFeatureSettings();
already_AddRefed<CSSValue> DoGetFontVariationSettings();
already_AddRefed<CSSValue> DoGetFontKerning();
already_AddRefed<CSSValue> DoGetFontLanguageOverride();
already_AddRefed<CSSValue> DoGetFontSize();

View file

@ -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)

View file

@ -1237,19 +1237,29 @@ PaintRowGroupBackgroundByColIdx(nsTableRowGroupFrame* aRowGroup,
const nsTArray<int32_t>& 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<int32_t, 1> 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.

View file

@ -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);

View file

@ -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();