merge mozilla-central to mozilla-inbound. r=merge a=merge

This commit is contained in:
Sebastian Hengst 2017-04-16 20:03:00 +02:00
commit 4743dbe1d9
25 changed files with 248 additions and 174 deletions

View File

@ -20,6 +20,44 @@ XPCOMUtils.defineLazyModuleGetter(this, "WebNavigationFrames",
var gContextMenuContentData = null;
function openContextMenu(aMessage) {
let data = aMessage.data;
let browser = aMessage.target;
let spellInfo = data.spellInfo;
if (spellInfo)
spellInfo.target = aMessage.target.messageManager;
let documentURIObject = makeURI(data.docLocation,
data.charSet,
makeURI(data.baseURI));
gContextMenuContentData = { isRemote: true,
event: aMessage.objects.event,
popupNode: aMessage.objects.popupNode,
browser,
editFlags: data.editFlags,
spellInfo,
principal: data.principal,
customMenuItems: data.customMenuItems,
addonInfo: data.addonInfo,
documentURIObject,
docLocation: data.docLocation,
charSet: data.charSet,
referrer: data.referrer,
referrerPolicy: data.referrerPolicy,
contentType: data.contentType,
contentDisposition: data.contentDisposition,
frameOuterWindowID: data.frameOuterWindowID,
selectionInfo: data.selectionInfo,
disableSetDesktopBackground: data.disableSetDesktopBg,
loginFillInfo: data.loginFillInfo,
parentAllowsMixedContent: data.parentAllowsMixedContent,
userContextId: data.userContextId,
};
let popup = browser.ownerDocument.getElementById("contentAreaContextMenu");
let event = gContextMenuContentData.event;
popup.openPopupAtScreen(event.screenX, event.screenY, true);
}
function nsContextMenu(aXulMenu, aIsShift) {
this.shouldDisplay = true;
this.initMenu(aXulMenu, aIsShift);

View File

@ -4955,38 +4955,7 @@
break;
}
case "contextmenu": {
let spellInfo = data.spellInfo;
if (spellInfo)
spellInfo.target = aMessage.target.messageManager;
let documentURIObject = makeURI(data.docLocation,
data.charSet,
makeURI(data.baseURI));
gContextMenuContentData = { isRemote: true,
event: aMessage.objects.event,
popupNode: aMessage.objects.popupNode,
browser,
editFlags: data.editFlags,
spellInfo,
principal: data.principal,
customMenuItems: data.customMenuItems,
addonInfo: data.addonInfo,
documentURIObject,
docLocation: data.docLocation,
charSet: data.charSet,
referrer: data.referrer,
referrerPolicy: data.referrerPolicy,
contentType: data.contentType,
contentDisposition: data.contentDisposition,
frameOuterWindowID: data.frameOuterWindowID,
selectionInfo: data.selectionInfo,
disableSetDesktopBackground: data.disableSetDesktopBg,
loginFillInfo: data.loginFillInfo,
parentAllowsMixedContent: data.parentAllowsMixedContent,
userContextId: data.userContextId,
};
let popup = browser.ownerDocument.getElementById("contentAreaContextMenu");
let event = gContextMenuContentData.event;
popup.openPopupAtScreen(event.screenX, event.screenY, true);
openContextMenu(aMessage);
break;
}
case "DOMWindowFocus": {

View File

@ -5,6 +5,7 @@
// Via webext-panels.xul
/* import-globals-from browser.js */
/* import-globals-from nsContextMenu.js */
XPCOMUtils.defineLazyModuleGetter(this, "ExtensionParent",
"resource://gre/modules/ExtensionParent.jsm");
@ -16,6 +17,7 @@ var {
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
function getBrowser(sidebar) {
let browser = document.getElementById("webext-panels-browser");
if (browser) {
@ -39,6 +41,11 @@ function getBrowser(sidebar) {
E10SUtils.getRemoteTypeForURI(sidebar.uri, true,
E10SUtils.EXTENSION_REMOTE_TYPE));
readyPromise = promiseEvent(browser, "XULFrameLoaderCreated");
window.messageManager.addMessageListener("contextmenu", openContextMenu);
window.addEventListener("unload", () => {
window.messageManager.removeMessageListener("contextmenu", openContextMenu);
}, {once: true});
} else {
readyPromise = Promise.resolve();
}

View File

@ -4,6 +4,7 @@
let extData = {
manifest: {
"permissions": ["contextMenus"],
"sidebar_action": {
"default_panel": "sidebar.html",
},
@ -30,6 +31,12 @@ let extData = {
},
background: function() {
browser.contextMenus.create({
id: "clickme-page",
title: "Click me!",
contexts: ["all"],
});
browser.test.onMessage.addListener(msg => {
if (msg === "set-panel") {
browser.sidebarAction.setPanel({panel: ""}).then(() => {
@ -96,6 +103,20 @@ add_task(function* sidebar_empty_panel() {
yield extension.unload();
});
add_task(function* sidebar_contextmenu() {
let extension = ExtensionTestUtils.loadExtension(extData);
yield extension.startup();
// Test sidebar is opened on install
yield extension.awaitMessage("sidebar");
let contentAreaContextMenu = yield openContextMenuInSidebar();
let item = contentAreaContextMenu.getElementsByAttribute("label", "Click me!");
is(item.length, 1, "contextMenu item for page was found");
yield closeContextMenu(contentAreaContextMenu);
yield extension.unload();
});
add_task(function* cleanup() {
// This is set on initial sidebar install.
Services.prefs.clearUserPref("extensions.sidebar-button.shown");

View File

@ -8,7 +8,7 @@
* getBrowserActionPopup getPageActionPopup
* closeBrowserAction closePageAction
* promisePopupShown promisePopupHidden
* openContextMenu closeContextMenu
* openContextMenu closeContextMenu openContextMenuInSidebar
* openExtensionContextMenu closeExtensionContextMenu
* openActionContextMenu openSubmenu closeActionContextMenu
* openTabContextMenu closeTabContextMenu
@ -232,6 +232,16 @@ function closeBrowserAction(extension, win = window) {
return Promise.resolve();
}
async function openContextMenuInSidebar(selector = "body") {
let contentAreaContextMenu = SidebarUI.browser.contentDocument.getElementById("contentAreaContextMenu");
let browser = SidebarUI.browser.contentDocument.getElementById("webext-panels-browser");
let popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown");
await BrowserTestUtils.synthesizeMouseAtCenter(selector, {type: "mousedown", button: 2}, browser);
await BrowserTestUtils.synthesizeMouseAtCenter(selector, {type: "contextmenu"}, browser);
await popupShownPromise;
return contentAreaContextMenu;
}
async function openContextMenuInFrame(frameId) {
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
let popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown");
@ -251,8 +261,8 @@ async function openContextMenu(selector = "#img1") {
return contentAreaContextMenu;
}
async function closeContextMenu() {
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
async function closeContextMenu(contextMenu) {
let contentAreaContextMenu = contextMenu || document.getElementById("contentAreaContextMenu");
let popupHiddenPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popuphidden");
contentAreaContextMenu.hidePopup();
await popupHiddenPromise;

View File

@ -521,6 +521,14 @@ ContentChild::RecvSetXPCOMProcessAttributes(const XPCOMInitData& aXPCOMInit,
mLookAndFeelCache = aLookAndFeelIntCache;
InitXPCOM(aXPCOMInit, aInitialData);
InitGraphicsDeviceData(aXPCOMInit.contentDeviceData());
#ifdef NS_PRINTING
// Force the creation of the nsPrintingProxy so that it's IPC counterpart,
// PrintingParent, is always available for printing initiated from the parent.
// Create nsPrintingProxy instance later than the SystemGroup initialization.
RefPtr<nsPrintingProxy> printingProxy = nsPrintingProxy::GetInstance();
#endif
return IPC_OK();
}
@ -602,12 +610,6 @@ ContentChild::Init(MessageLoop* aIOLoop,
mID = aChildID;
mIsForBrowser = aIsForBrowser;
#ifdef NS_PRINTING
// Force the creation of the nsPrintingProxy so that it's IPC counterpart,
// PrintingParent, is always available for printing initiated from the parent.
RefPtr<nsPrintingProxy> printingProxy = nsPrintingProxy::GetInstance();
#endif
SetProcessName(NS_LITERAL_STRING("Web Content"), true);
return true;

View File

@ -89,6 +89,7 @@ Http2Session::Http2Session(nsISocketTransport *aSocketTransport, uint32_t versio
, mShouldGoAway(false)
, mClosed(false)
, mCleanShutdown(false)
, mReceivedSettings(false)
, mTLSProfileConfirmed(false)
, mGoAwayReason(NO_HTTP_ERROR)
, mClientGoAwayReason(UNASSIGNED)
@ -1504,6 +1505,8 @@ Http2Session::RecvSettings(Http2Session *self)
RETURN_SESSION_ERROR(self, PROTOCOL_ERROR);
}
self->mReceivedSettings = true;
uint32_t numEntries = self->mInputFrameDataSize / 6;
LOG3(("Http2Session::RecvSettings %p SETTINGS Control Frame "
"with %d entries ack=%X", self, numEntries,
@ -4153,51 +4156,32 @@ Http2Session::TestOriginFrame(const nsACString &hostname, int32_t port)
bool
Http2Session::TestJoinConnection(const nsACString &hostname, int32_t port)
{
if (!mConnection || mClosed || mShouldGoAway) {
return false;
}
if (mOriginFrameActivated) {
bool originFrameResult = TestOriginFrame(hostname, port);
if (!originFrameResult) {
return false;
}
} else {
LOG3(("TestJoinConnection %p no origin frame check used.\n", this));
}
nsresult rv;
bool isJoined = false;
nsCOMPtr<nsISupports> securityInfo;
nsCOMPtr<nsISSLSocketControl> sslSocketControl;
mConnection->GetSecurityInfo(getter_AddRefs(securityInfo));
sslSocketControl = do_QueryInterface(securityInfo, &rv);
if (NS_FAILED(rv) || !sslSocketControl) {
return false;
}
// try all the coalescable versions we support.
const SpdyInformation *info = gHttpHandler->SpdyInfo();
for (uint32_t index = SpdyInformation::kCount; index > 0; --index) {
if (info->ProtocolEnabled(index - 1)) {
rv = sslSocketControl->TestJoinConnection(info->VersionString[index - 1],
hostname, port, &isJoined);
if (NS_SUCCEEDED(rv) && isJoined) {
return true;
}
}
}
return false;
return RealJoinConnection(hostname, port, true);
}
bool
Http2Session::JoinConnection(const nsACString &hostname, int32_t port)
{
return RealJoinConnection(hostname, port, false);
}
bool
Http2Session::RealJoinConnection(const nsACString &hostname, int32_t port,
bool justKidding)
{
if (!mConnection || mClosed || mShouldGoAway) {
return false;
}
nsHttpConnectionInfo *ci = ConnectionInfo();
if (nsCString(hostname).EqualsIgnoreCase(ci->Origin()) && (port == ci->OriginPort())) {
return true;
}
if (!mReceivedSettings) {
return false;
}
if (mOriginFrameActivated) {
bool originFrameResult = TestOriginFrame(hostname, port);
if (!originFrameResult) {
@ -4207,6 +4191,18 @@ Http2Session::JoinConnection(const nsACString &hostname, int32_t port)
LOG3(("JoinConnection %p no origin frame check used.\n", this));
}
nsAutoCString key(hostname);
key.Append(':');
key.Append(justKidding ? 'k' : '.');
key.AppendInt(port);
bool cachedResult;
if (mJoinConnectionCache.Get(key, &cachedResult)) {
LOG(("joinconnection [%p %s] %s result=%d cache\n",
this, ConnectionInfo()->HashKey().get(), key.get(),
cachedResult));
return cachedResult;
}
nsresult rv;
bool isJoined = false;
@ -4221,16 +4217,35 @@ Http2Session::JoinConnection(const nsACString &hostname, int32_t port)
// try all the coalescable versions we support.
const SpdyInformation *info = gHttpHandler->SpdyInfo();
for (uint32_t index = SpdyInformation::kCount; index > 0; --index) {
if (info->ProtocolEnabled(index - 1)) {
rv = sslSocketControl->JoinConnection(info->VersionString[index - 1],
static_assert(SpdyInformation::kCount == 1, "assume 1 alpn version");
bool joinedReturn = false;
if (info->ProtocolEnabled(0)) {
if (justKidding) {
rv = sslSocketControl->TestJoinConnection(info->VersionString[0],
hostname, port, &isJoined);
} else {
rv = sslSocketControl->JoinConnection(info->VersionString[0],
hostname, port, &isJoined);
if (NS_SUCCEEDED(rv) && isJoined) {
return true;
}
}
if (NS_SUCCEEDED(rv) && isJoined) {
joinedReturn = true;
}
}
return false;
LOG(("joinconnection [%p %s] %s result=%d lookup\n",
this, ConnectionInfo()->HashKey().get(), key.get(), joinedReturn));
mJoinConnectionCache.Put(key, joinedReturn);
if (!justKidding) {
// cache a kidding entry too as this one is good for both
nsAutoCString key2(hostname);
key2.Append(':');
key2.Append('k');
key2.AppendInt(port);
if (!mJoinConnectionCache.Get(key2)) {
mJoinConnectionCache.Put(key2, joinedReturn);
}
}
return joinedReturn;
}
void

View File

@ -427,6 +427,9 @@ private:
// the session received a GoAway frame with a valid GoAwayID
bool mCleanShutdown;
// the session received the opening SETTINGS frame from the server
bool mReceivedSettings;
// The TLS comlpiance checks are not done in the ctor beacuse of bad
// exception handling - so we do them at IO time and cache the result
bool mTLSProfileConfirmed;
@ -518,10 +521,13 @@ private:
// The ID(s) of the stream(s) that we are getting 0RTT data from.
nsTArray<uint32_t> m0RTTStreams;
bool RealJoinConnection(const nsACString &hostname, int32_t port, bool jk);
bool TestOriginFrame(const nsACString &name, int32_t port);
bool mOriginFrameActivated;
nsDataHashtable<nsCStringHashKey, bool> mOriginFrame;
nsDataHashtable<nsCStringHashKey, bool> mJoinConnectionCache;
private:
/// connect tunnels
void DispatchOnTunnel(nsAHttpTransaction *, nsIInterfaceRequestor *);

View File

@ -72,7 +72,7 @@ sudo dnf install curl freeglut-devel libtool gcc-c++ libXi-devel \
freetype-devel mesa-libGL-devel mesa-libEGL-devel glib2-devel libX11-devel libXrandr-devel gperf \
fontconfig-devel cabextract ttmkfdir python python-virtualenv python-pip expat-devel \
rpm-build openssl-devel cmake bzip2-devel libXcursor-devel libXmu-devel mesa-libOSMesa-devel \
dbus-devel
dbus-devel ncurses-devel
```
#### On openSUSE Linux
``` sh

View File

@ -649,16 +649,16 @@ impl LayoutElementHelpers for LayoutJS<Element> {
let width_value = specified::BorderWidth::from_length(specified::Length::from_px(border as f32));
hints.push(from_declaration(
shared_lock,
PropertyDeclaration::BorderTopWidth(Box::new(width_value.clone()))));
PropertyDeclaration::BorderTopWidth(width_value.clone())));
hints.push(from_declaration(
shared_lock,
PropertyDeclaration::BorderLeftWidth(Box::new(width_value.clone()))));
PropertyDeclaration::BorderLeftWidth(width_value.clone())));
hints.push(from_declaration(
shared_lock,
PropertyDeclaration::BorderBottomWidth(Box::new(width_value.clone()))));
PropertyDeclaration::BorderBottomWidth(width_value.clone())));
hints.push(from_declaration(
shared_lock,
PropertyDeclaration::BorderRightWidth(Box::new(width_value))));
PropertyDeclaration::BorderRightWidth(width_value)));
}
}

View File

@ -36,7 +36,7 @@ ${helpers.gecko_keyword_conversion(Keyword('border-style',
"none solid double dotted dashed hidden groove ridge inset outset"),
type="::values::specified::BorderStyle")}
% for side in ALL_SIDES:
<%helpers:longhand name="border-${side[0]}-width" boxed="True" animation_type="normal" logical="${side[1]}"
<%helpers:longhand name="border-${side[0]}-width" animation_type="normal" logical="${side[1]}"
alias="${maybe_moz_logical_alias(product, side, '-moz-border-%s-width')}"
spec="${maybe_logical_spec(side, 'width')}">
use app_units::Au;

View File

@ -1864,7 +1864,6 @@ ${helpers.predefined_type("perspective",
gecko_ffi_name="mChildPerspective",
spec="https://drafts.csswg.org/css-transforms/#perspective",
extra_prefixes="moz webkit",
boxed=True,
creates_stacking_context=True,
fixpos_cb=True,
animation_type="normal")}

View File

@ -13,7 +13,6 @@ ${helpers.predefined_type("column-width",
initial_specified_value="Either::Second(Auto)",
parse_method="parse_non_negative_length",
extra_prefixes="moz",
boxed=True,
animation_type="none",
experimental=True,
spec="https://drafts.csswg.org/css-multicol/#propdef-column-width")}
@ -36,7 +35,6 @@ ${helpers.predefined_type("column-gap",
parse_method='parse_non_negative_length',
extra_prefixes="moz",
experimental=True,
boxed=True,
animation_type="none",
spec="https://drafts.csswg.org/css-multicol/#propdef-column-gap")}
@ -45,7 +43,7 @@ ${helpers.single_keyword("column-fill", "balance auto", extra_prefixes="moz",
spec="https://drafts.csswg.org/css-multicol/#propdef-column-fill")}
// https://drafts.csswg.org/css-multicol-1/#propdef-column-rule-width
<%helpers:longhand name="column-rule-width" products="gecko" boxed="True" animation_type="normal" extra_prefixes="moz"
<%helpers:longhand name="column-rule-width" products="gecko" animation_type="normal" extra_prefixes="moz"
spec="https://drafts.csswg.org/css-multicol/#propdef-column-rule-width">
use app_units::Au;
use std::fmt;

View File

@ -406,7 +406,7 @@ ${helpers.single_keyword("text-align-last",
% endif
</%helpers:longhand>
<%helpers:longhand name="letter-spacing" boxed="True" animation_type="normal"
<%helpers:longhand name="letter-spacing" animation_type="normal"
spec="https://drafts.csswg.org/css-text/#propdef-letter-spacing">
use std::fmt;
use style_traits::ToCss;
@ -1211,7 +1211,7 @@ ${helpers.predefined_type(
"-moz-tab-size", "LengthOrNumber",
"::values::Either::Second(8.0)",
"parse_non_negative",
products="gecko", boxed=True, animation_type="none",
products="gecko", animation_type="none",
spec="https://drafts.csswg.org/css-text-3/#tab-size-property")}
@ -1232,7 +1232,7 @@ ${helpers.predefined_type(
complex_color=True, need_clone=True,
spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-color")}
<%helpers:longhand products="gecko" name="-webkit-text-stroke-width" boxed="True" animation_type="none"
<%helpers:longhand products="gecko" name="-webkit-text-stroke-width" animation_type="none"
spec="https://compat.spec.whatwg.org/#the-webkit-text-stroke-width">
use app_units::Au;
use std::fmt;

View File

@ -46,7 +46,7 @@ impl ToComputedValue for specified::Length {
fn to_computed_value(&self, context: &Context) -> Au {
match *self {
specified::Length::NoCalc(l) => l.to_computed_value(context),
specified::Length::Calc(ref calc, range) => range.clamp(calc.to_computed_value(context).length()),
specified::Length::Calc(range, ref calc) => range.clamp(calc.to_computed_value(context).length()),
}
}

View File

@ -465,7 +465,7 @@ pub enum Length {
/// A calc expression.
///
/// https://drafts.csswg.org/css-values/#calc-notation
Calc(Box<CalcLengthOrPercentage>, AllowedLengthType),
Calc(AllowedLengthType, Box<CalcLengthOrPercentage>),
}
impl From<NoCalcLength> for Length {
@ -479,7 +479,7 @@ impl HasViewportPercentage for Length {
fn has_viewport_percentage(&self) -> bool {
match *self {
Length::NoCalc(ref inner) => inner.has_viewport_percentage(),
Length::Calc(ref calc, _) => calc.has_viewport_percentage(),
Length::Calc(_, ref calc) => calc.has_viewport_percentage(),
}
}
}
@ -488,7 +488,7 @@ impl ToCss for Length {
fn to_css<W>(&self, dest: &mut W) -> fmt::Result where W: fmt::Write {
match *self {
Length::NoCalc(ref inner) => inner.to_css(dest),
Length::Calc(ref calc, _) => calc.to_css(dest),
Length::Calc(_, ref calc) => calc.to_css(dest),
}
}
}
@ -592,34 +592,12 @@ impl Parse for Length {
}
}
impl Either<Length, None_> {
/// Parse a non-negative length or none
impl<T: Parse> Either<Length, T> {
/// Parse a non-negative length
#[inline]
pub fn parse_non_negative_length(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
if input.try(|input| None_::parse(context, input)).is_ok() {
return Ok(Either::Second(None_));
}
Length::parse_non_negative(context, input).map(Either::First)
}
}
impl Either<Length, Normal> {
#[inline]
#[allow(missing_docs)]
pub fn parse_non_negative_length(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
if input.try(|input| Normal::parse(context, input)).is_ok() {
return Ok(Either::Second(Normal));
}
Length::parse_internal(context, input, AllowedLengthType::NonNegative).map(Either::First)
}
}
impl Either<Length, Auto> {
#[inline]
#[allow(missing_docs)]
pub fn parse_non_negative_length(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
if input.try(|input| Auto::parse(context, input)).is_ok() {
return Ok(Either::Second(Auto));
if let Ok(v) = input.try(|input| T::parse(context, input)) {
return Ok(Either::Second(v));
}
Length::parse_internal(context, input, AllowedLengthType::NonNegative).map(Either::First)
}
@ -850,7 +828,7 @@ impl CalcLengthOrPercentage {
input: &mut Parser,
num_context: AllowedLengthType) -> Result<Length, ()> {
CalcLengthOrPercentage::parse(context, input, CalcUnit::Length).map(|calc| {
Length::Calc(Box::new(calc), num_context)
Length::Calc(num_context, Box::new(calc))
})
}
@ -1113,7 +1091,7 @@ impl From<Length> for LengthOrPercentage {
fn from(len: Length) -> LengthOrPercentage {
match len {
Length::NoCalc(l) => LengthOrPercentage::Length(l),
Length::Calc(l, _) => LengthOrPercentage::Calc(l),
Length::Calc(_, l) => LengthOrPercentage::Calc(l),
}
}
}

View File

@ -1444,10 +1444,10 @@ pub extern "C" fn Servo_DeclarationBlock_SetPixelValue(declarations:
let prop = match_wrap_declared! { long,
Height => nocalc.into(),
Width => nocalc.into(),
BorderTopWidth => Box::new(BorderWidth::Width(nocalc.into())),
BorderRightWidth => Box::new(BorderWidth::Width(nocalc.into())),
BorderBottomWidth => Box::new(BorderWidth::Width(nocalc.into())),
BorderLeftWidth => Box::new(BorderWidth::Width(nocalc.into())),
BorderTopWidth => BorderWidth::Width(nocalc.into()),
BorderRightWidth => BorderWidth::Width(nocalc.into()),
BorderBottomWidth => BorderWidth::Width(nocalc.into()),
BorderLeftWidth => BorderWidth::Width(nocalc.into()),
MarginTop => nocalc.into(),
MarginRight => nocalc.into(),
MarginBottom => nocalc.into(),

View File

@ -1 +1 @@
474f7a91eec8cba83b7eb7a578a7adb70614f877
5f13a3b540ab6024665322d716e487c800645f24

View File

@ -225,10 +225,10 @@ mod shorthand_serialization {
let px_30 = BorderWidth::from_length(Length::from_px(30f32));
let px_10 = BorderWidth::from_length(Length::from_px(10f32));
properties.push(PropertyDeclaration::BorderTopWidth(Box::new(px_30.clone())));
properties.push(PropertyDeclaration::BorderRightWidth(Box::new(px_30.clone())));
properties.push(PropertyDeclaration::BorderBottomWidth(Box::new(px_30.clone())));
properties.push(PropertyDeclaration::BorderLeftWidth(Box::new(px_10.clone())));
properties.push(PropertyDeclaration::BorderTopWidth(px_30.clone()));
properties.push(PropertyDeclaration::BorderRightWidth(px_30.clone()));
properties.push(PropertyDeclaration::BorderBottomWidth(px_30.clone()));
properties.push(PropertyDeclaration::BorderLeftWidth(px_10.clone()));
let blue = CSSColor {
parsed: ComputedColor::RGBA(RGBA::new(0, 0, 255, 255)),
@ -258,10 +258,10 @@ mod shorthand_serialization {
let px_30 = BorderWidth::from_length(Length::from_px(30f32));
properties.push(PropertyDeclaration::BorderTopWidth(Box::new(px_30.clone())));
properties.push(PropertyDeclaration::BorderRightWidth(Box::new(px_30.clone())));
properties.push(PropertyDeclaration::BorderBottomWidth(Box::new(px_30.clone())));
properties.push(PropertyDeclaration::BorderLeftWidth(Box::new(px_30.clone())));
properties.push(PropertyDeclaration::BorderTopWidth(px_30.clone()));
properties.push(PropertyDeclaration::BorderRightWidth(px_30.clone()));
properties.push(PropertyDeclaration::BorderBottomWidth(px_30.clone()));
properties.push(PropertyDeclaration::BorderLeftWidth(px_30.clone()));
let blue = CSSColor {
parsed: ComputedColor::RGBA(RGBA::new(0, 0, 255, 255)),
@ -302,10 +302,10 @@ mod shorthand_serialization {
let right_px = BorderWidth::from_length(Length::from_px(15f32));
let left_px = BorderWidth::from_length(Length::from_px(15f32));
properties.push(PropertyDeclaration::BorderTopWidth(Box::new(top_px)));
properties.push(PropertyDeclaration::BorderRightWidth(Box::new(right_px)));
properties.push(PropertyDeclaration::BorderBottomWidth(Box::new(bottom_px)));
properties.push(PropertyDeclaration::BorderLeftWidth(Box::new(left_px)));
properties.push(PropertyDeclaration::BorderTopWidth(top_px));
properties.push(PropertyDeclaration::BorderRightWidth(right_px));
properties.push(PropertyDeclaration::BorderBottomWidth(bottom_px));
properties.push(PropertyDeclaration::BorderLeftWidth(left_px));
let serialization = shorthand_properties_to_string(properties);
assert_eq!(serialization, "border-width: 10px 15px;");
@ -320,10 +320,10 @@ mod shorthand_serialization {
let bottom_px = BorderWidth::Thick;
let left_px = BorderWidth::from_length(Length::from_px(15f32));
properties.push(PropertyDeclaration::BorderTopWidth(Box::new(top_px)));
properties.push(PropertyDeclaration::BorderRightWidth(Box::new(right_px)));
properties.push(PropertyDeclaration::BorderBottomWidth(Box::new(bottom_px)));
properties.push(PropertyDeclaration::BorderLeftWidth(Box::new(left_px)));
properties.push(PropertyDeclaration::BorderTopWidth(top_px));
properties.push(PropertyDeclaration::BorderRightWidth(right_px));
properties.push(PropertyDeclaration::BorderBottomWidth(bottom_px));
properties.push(PropertyDeclaration::BorderLeftWidth(left_px));
let serialization = shorthand_properties_to_string(properties);
assert_eq!(serialization, "border-width: thin medium thick 15px;");
@ -411,7 +411,7 @@ mod shorthand_serialization {
authored: None
};
properties.push(PropertyDeclaration::BorderTopWidth(Box::new(width)));
properties.push(PropertyDeclaration::BorderTopWidth(width));
properties.push(PropertyDeclaration::BorderTopStyle(style));
properties.push(PropertyDeclaration::BorderTopColor(color));
@ -429,7 +429,7 @@ mod shorthand_serialization {
fn border_top_should_serialize_correctly() {
let mut properties = Vec::new();
let (width, style, color) = get_border_property_values();
properties.push(PropertyDeclaration::BorderTopWidth(Box::new(width)));
properties.push(PropertyDeclaration::BorderTopWidth(width));
properties.push(PropertyDeclaration::BorderTopStyle(style));
properties.push(PropertyDeclaration::BorderTopColor(color));
@ -441,7 +441,7 @@ mod shorthand_serialization {
fn border_right_should_serialize_correctly() {
let mut properties = Vec::new();
let (width, style, color) = get_border_property_values();
properties.push(PropertyDeclaration::BorderRightWidth(Box::new(width)));
properties.push(PropertyDeclaration::BorderRightWidth(width));
properties.push(PropertyDeclaration::BorderRightStyle(style));
properties.push(PropertyDeclaration::BorderRightColor(color));
@ -453,7 +453,7 @@ mod shorthand_serialization {
fn border_bottom_should_serialize_correctly() {
let mut properties = Vec::new();
let (width, style, color) = get_border_property_values();
properties.push(PropertyDeclaration::BorderBottomWidth(Box::new(width)));
properties.push(PropertyDeclaration::BorderBottomWidth(width));
properties.push(PropertyDeclaration::BorderBottomStyle(style));
properties.push(PropertyDeclaration::BorderBottomColor(color));
@ -465,7 +465,7 @@ mod shorthand_serialization {
fn border_left_should_serialize_correctly() {
let mut properties = Vec::new();
let (width, style, color) = get_border_property_values();
properties.push(PropertyDeclaration::BorderLeftWidth(Box::new(width)));
properties.push(PropertyDeclaration::BorderLeftWidth(width));
properties.push(PropertyDeclaration::BorderLeftStyle(style));
properties.push(PropertyDeclaration::BorderLeftColor(color));
@ -478,19 +478,19 @@ mod shorthand_serialization {
let mut properties = Vec::new();
let (width, style, color) = get_border_property_values();
properties.push(PropertyDeclaration::BorderTopWidth(Box::new(width.clone())));
properties.push(PropertyDeclaration::BorderTopWidth(width.clone()));
properties.push(PropertyDeclaration::BorderTopStyle(style.clone()));
properties.push(PropertyDeclaration::BorderTopColor(color.clone()));
properties.push(PropertyDeclaration::BorderRightWidth(Box::new(width.clone())));
properties.push(PropertyDeclaration::BorderRightWidth(width.clone()));
properties.push(PropertyDeclaration::BorderRightStyle(style.clone()));
properties.push(PropertyDeclaration::BorderRightColor(color.clone()));
properties.push(PropertyDeclaration::BorderBottomWidth(Box::new(width.clone())));
properties.push(PropertyDeclaration::BorderBottomWidth(width.clone()));
properties.push(PropertyDeclaration::BorderBottomStyle(style.clone()));
properties.push(PropertyDeclaration::BorderBottomColor(color.clone()));
properties.push(PropertyDeclaration::BorderLeftWidth(Box::new(width.clone())));
properties.push(PropertyDeclaration::BorderLeftWidth(width.clone()));
properties.push(PropertyDeclaration::BorderLeftStyle(style.clone()));
properties.push(PropertyDeclaration::BorderLeftColor(color.clone()));
@ -575,7 +575,7 @@ mod shorthand_serialization {
let width = Either::Second(Auto);
let count = Either::Second(Auto);
properties.push(PropertyDeclaration::ColumnWidth(Box::new(width)));
properties.push(PropertyDeclaration::ColumnWidth(width));
properties.push(PropertyDeclaration::ColumnCount(count));
let serialization = shorthand_properties_to_string(properties);

View File

@ -11,17 +11,17 @@ use style::values::specified::{AbsoluteLength, Length, NoCalcLength, ViewportPer
#[test]
fn has_viewport_percentage_for_specified_value() {
//TODO: test all specified value with a HasViewportPercentage impl
let pvw = PropertyDeclaration::BorderTopWidth(Box::new(
let pvw = PropertyDeclaration::BorderTopWidth(
border_top_width::SpecifiedValue::from_length(
Length::NoCalc(NoCalcLength::ViewportPercentage(ViewportPercentageLength::Vw(100.)))
)
));
);
assert!(pvw.has_viewport_percentage());
let pabs = PropertyDeclaration::BorderTopWidth(Box::new(
let pabs = PropertyDeclaration::BorderTopWidth(
border_top_width::SpecifiedValue::from_length(
Length::NoCalc(NoCalcLength::Absolute(AbsoluteLength::Px(Au(100).to_f32_px())))
)
));
);
assert!(!pabs.has_viewport_percentage());
}

View File

@ -63,6 +63,10 @@ nsPrintingProxy::GetInstance()
nsresult
nsPrintingProxy::Init()
{
ContentChild::GetSingleton()->SetEventTargetForActor(this,
SystemGroup::EventTargetFor(mozilla::TaskCategory::Other));
MOZ_ASSERT(this->GetActorEventTarget());
mozilla::Unused << ContentChild::GetSingleton()->SendPPrintingConstructor(this);
return NS_OK;
}

View File

@ -61,9 +61,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "isAddonPartOfE10SRollout",
XPCOMUtils.defineLazyModuleGetter(this, "LegacyExtensionsUtils",
"resource://gre/modules/LegacyExtensionsUtils.jsm");
const {nsIBlocklistService} = Ci;
XPCOMUtils.defineLazyServiceGetter(this, "Blocklist",
"@mozilla.org/extensions/blocklist;1",
Ci.nsIBlocklistService);
"nsIBlocklistService");
XPCOMUtils.defineLazyServiceGetter(this,
"ChromeRegistry",
"@mozilla.org/chrome/chrome-registry;1",
@ -204,10 +205,10 @@ const PENDING_INSTALL_METADATA =
// DB schema version to ensure changes are picked up ASAP.
const STATIC_BLOCKLIST_PATTERNS = [
{ creator: "Mozilla Corp.",
level: Blocklist.STATE_BLOCKED,
level: nsIBlocklistService.STATE_BLOCKED,
blockID: "i162" },
{ creator: "Mozilla.org",
level: Blocklist.STATE_BLOCKED,
level: nsIBlocklistService.STATE_BLOCKED,
blockID: "i162" }
];
@ -768,7 +769,7 @@ function isUsableAddon(aAddon) {
return false;
}
if (aAddon.blocklistState == Blocklist.STATE_BLOCKED) {
if (aAddon.blocklistState == nsIBlocklistService.STATE_BLOCKED) {
logger.warn(`Add-on ${aAddon.id} is blocklisted.`);
return false;
}
@ -1074,7 +1075,7 @@ var loadManifestFromWebManifest = Task.async(function*(aUri) {
addon.targetPlatforms = [];
// Themes are disabled by default, except when they're installed from a web page.
addon.userDisabled = theme;
addon.softDisabled = addon.blocklistState == Blocklist.STATE_SOFTBLOCKED;
addon.softDisabled = addon.blocklistState == nsIBlocklistService.STATE_SOFTBLOCKED;
return addon;
});
@ -1347,7 +1348,7 @@ let loadManifestFromRDF = Task.async(function*(aUri, aStream) {
addon.userDisabled = false;
}
addon.softDisabled = addon.blocklistState == Blocklist.STATE_SOFTBLOCKED;
addon.softDisabled = addon.blocklistState == nsIBlocklistService.STATE_SOFTBLOCKED;
addon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT;
// Experiments are managed and updated through an external "experiments
@ -4832,8 +4833,9 @@ this.XPIProvider = {
activeAddon.bootstrapScope[feature] = gGlobalScope[feature];
// Define a console for the add-on
activeAddon.bootstrapScope["console"] = new ConsoleAPI(
{ consoleID: "addon/" + aId });
XPCOMUtils.defineLazyGetter(
activeAddon.bootstrapScope, "console",
() => new ConsoleAPI({ consoleID: "addon/" + aId }));
// As we don't want our caller to control the JS version used for the
// bootstrap file, we run loadSubScript within the context of the

View File

@ -494,6 +494,9 @@ public:
LayoutDeviceIntPoint CocoaPointsToDevPixels(const NSPoint& aPt) const {
return nsCocoaUtils::CocoaPointsToDevPixels(aPt, BackingScaleFactor());
}
LayoutDeviceIntPoint CocoaPointsToDevPixelsRoundDown(const NSPoint& aPt) const {
return nsCocoaUtils::CocoaPointsToDevPixelsRoundDown(aPt, BackingScaleFactor());
}
LayoutDeviceIntRect CocoaPointsToDevPixels(const NSRect& aRect) const {
return nsCocoaUtils::CocoaPointsToDevPixels(aRect, BackingScaleFactor());
}

View File

@ -201,6 +201,7 @@ static bool sIsTabletPointerActivated = false;
#endif
- (LayoutDeviceIntPoint)convertWindowCoordinates:(NSPoint)aPoint;
- (LayoutDeviceIntPoint)convertWindowCoordinatesRoundDown:(NSPoint)aPoint;
- (IAPZCTreeManager*)apzctm;
- (BOOL)inactiveWindowAcceptsMouseEvent:(NSEvent*)aEvent;
@ -4896,8 +4897,12 @@ GetIntegerDeltaForEvent(NSEvent* aEvent)
NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(theEvent, [self window]);
// Use convertWindowCoordinatesRoundDown when converting the position to
// integer screen pixels in order to ensure that coordinates which are just
// inside the right / bottom edges of the window don't end up outside of the
// window after rounding.
ScreenPoint position = ViewAs<ScreenPixel>(
[self convertWindowCoordinates:locationInWindow],
[self convertWindowCoordinatesRoundDown:locationInWindow],
PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent);
bool usePreciseDeltas = nsCocoaUtils::HasPreciseScrollingDeltas(theEvent) &&
@ -5654,6 +5659,16 @@ GetIntegerDeltaForEvent(NSEvent* aEvent)
return mGeckoChild->CocoaPointsToDevPixels(localPoint);
}
- (LayoutDeviceIntPoint)convertWindowCoordinatesRoundDown:(NSPoint)aPoint
{
if (!mGeckoChild) {
return LayoutDeviceIntPoint(0, 0);
}
NSPoint localPoint = [self convertPoint:aPoint fromView:nil];
return mGeckoChild->CocoaPointsToDevPixelsRoundDown(localPoint);
}
- (IAPZCTreeManager*)apzctm
{
return mGeckoChild ? mGeckoChild->APZCTM() : nullptr;

View File

@ -144,6 +144,13 @@ public:
NSToIntRound(aPt.y * aBackingScale));
}
static LayoutDeviceIntPoint
CocoaPointsToDevPixelsRoundDown(const NSPoint& aPt, CGFloat aBackingScale)
{
return LayoutDeviceIntPoint(NSToIntFloor(aPt.x * aBackingScale),
NSToIntFloor(aPt.y * aBackingScale));
}
static LayoutDeviceIntRect
CocoaPointsToDevPixels(const NSRect& aRect, CGFloat aBackingScale)
{