Merge autoland to m-c, a=merge

This commit is contained in:
Phil Ringnalda 2016-09-10 00:12:38 -07:00
commit 0e0c8bd1b1
88 changed files with 831 additions and 477 deletions

View File

@ -635,6 +635,8 @@ pref("accessibility.typeaheadfind", false);
pref("accessibility.typeaheadfind.timeout", 5000);
pref("accessibility.typeaheadfind.linksonly", false);
pref("accessibility.typeaheadfind.flashBar", 1);
pref("findbar.highlightAll", true);
pref("findbar.modalHighlight", true);
// Tracks when accessibility is loaded into the previous session.
pref("accessibility.loadedInLastSession", false);

View File

@ -213,19 +213,19 @@ def get_compiler_info(compiler, language):
check = dedent('''\
#if defined(_MSC_VER)
#if defined(__clang__)
%COMPILER clang-cl
%COMPILER "clang-cl"
%VERSION _MSC_FULL_VER
#else
%COMPILER msvc
%COMPILER "msvc"
%VERSION _MSC_FULL_VER
#endif
#elif defined(__clang__)
%COMPILER clang
%COMPILER "clang"
# if !__cplusplus || __has_feature(cxx_alignof)
%VERSION __clang_major__.__clang_minor__.__clang_patchlevel__
# endif
#elif defined(__GNUC__)
%COMPILER gcc
%COMPILER "gcc"
%VERSION __GNUC__.__GNUC_MINOR__.__GNUC_PATCHLEVEL__
#endif
@ -248,7 +248,7 @@ def get_compiler_info(compiler, language):
for n, (value, condition) in enumerate(preprocessor_checks.iteritems()):
check += dedent('''\
#%(if)s %(condition)s
%%%(name)s %(value)s
%%%(name)s "%(value)s"
''' % {
'if': 'elif' if n else 'if',
'condition': condition,
@ -262,9 +262,9 @@ def get_compiler_info(compiler, language):
# by the preprocessor, except MSVC, which only supports little endian.
check += dedent('''\
#if _MSC_VER || __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
%ENDIANNESS little
%ENDIANNESS "little"
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
%ENDIANNESS big
%ENDIANNESS "big"
#endif
''')
@ -279,7 +279,7 @@ def get_compiler_info(compiler, language):
if line.startswith('%'):
k, _, v = line.partition(' ')
k = k.lstrip('%')
data[k] = v.replace(' ', '')
data[k] = v.replace(' ', '').lstrip('"').rstrip('"')
log.debug('%s = %s', k, data[k])
try:

View File

@ -38,12 +38,13 @@ var tests = {
},
check: {
input: "listen",
hints: " [port]",
hints: " [port] [protocol]",
markup: "VVVVVV",
status: "VALID"
},
exec: {
output: "Listening on port 6080"
output: "Listening on port " + Services.prefs
.getIntPref("devtools.debugger.remote-port")
}
},
{

View File

@ -4,7 +4,7 @@
"use strict";
const { Cc, Ci, Cu } = require("chrome");
const { Cc, Ci } = require("chrome");
const Services = require("Services");
const l10n = require("gcli/l10n");
const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
@ -44,18 +44,45 @@ exports.items = [
name: "port",
type: "number",
get defaultValue() {
return Services.prefs.getIntPref("devtools.debugger.chrome-debugging-port");
return Services.prefs.getIntPref("devtools.debugger.remote-port");
},
description: l10n.lookup("listenPortDesc"),
}
},
{
name: "protocol",
get defaultValue() {
let webSocket = Services.prefs
.getBoolPref("devtools.debugger.remote-websocket");
let protocol;
if (webSocket === true) {
protocol = "websocket";
} else {
protocol = "mozilla-rdp";
}
return protocol;
},
type: {
name: "selection",
data: [ "mozilla-rdp", "websocket"],
},
description: l10n.lookup("listenProtocolDesc"),
},
],
exec: function(args, context) {
exec: function (args, context) {
var listener = debuggerServer.createListener();
if (!listener) {
throw new Error(l10n.lookup("listenDisabledOutput"));
}
let webSocket = false;
if (args.protocol === "websocket") {
webSocket = true;
} else if (args.protocol === "mozilla-rdp") {
webSocket = false;
}
listener.portOrPath = args.port;
listener.webSocket = webSocket;
listener.open();
if (debuggerServer.initialized) {
@ -71,7 +98,7 @@ exports.items = [
name: "unlisten",
description: l10n.lookup("unlistenDesc"),
manual: l10n.lookup("unlistenManual"),
exec: function(args, context) {
exec: function (args, context) {
debuggerServer.closeAllListeners();
return l10n.lookup("unlistenOutput");
}

View File

@ -1389,6 +1389,10 @@ listenManual2=%1$S can allow remote debugging over a TCP/IP connection. For secu
# function of 'port' parameter to the 'listen' command.
listenPortDesc=The TCP port to listen on
# LOCALIZATION NOTE (listenProtocolDesc) A very short string used to describe the
# function of 'protocol' parameter to the 'listen' command.
listenProtocolDesc=The protocol to be used
# LOCALIZATION NOTE (listenDisabledOutput) Text of a message output during the
# execution of the 'listen' command.
listenDisabledOutput=Listen is disabled by the devtools.debugger.remote-enabled preference

View File

@ -1577,7 +1577,7 @@ nsFocusManager::CheckIfFocusable(nsIContent* aContent, uint32_t aFlags)
if (subdoc && IsWindowVisible(subdoc->GetWindow())) {
const nsStyleUserInterface* ui = frame->StyleUserInterface();
int32_t tabIndex = (ui->mUserFocus == StyleUserFocus::Ignore ||
ui->mUserFocus == StyleUserFocus::None_) ? -1 : 0;
ui->mUserFocus == StyleUserFocus::None) ? -1 : 0;
return aContent->IsFocusable(&tabIndex, aFlags & FLAG_BYMOUSE) ? aContent : nullptr;
}

View File

@ -314,8 +314,18 @@ public:
JS::Handle<JSObject*> aModuleRecord);
nsScriptLoader* Loader() const { return mLoader; }
JSObject* ModuleRecord() const { return mModuleRecord; }
JS::Value Exception() const { return mException; }
JSObject* ModuleRecord() const
{
if (mModuleRecord) {
JS::ExposeObjectToActiveJS(mModuleRecord);
}
return mModuleRecord;
}
JS::Value Exception() const
{
JS::ExposeValueToActiveJS(mException);
return mException;
}
nsIURI* BaseURL() const { return mBaseURL; }
void SetInstantiationResult(JS::Handle<JS::Value> aMaybeException);

View File

@ -1290,7 +1290,7 @@ nsGenericHTMLElement::MapCommonAttributesInto(const nsMappedAttributes* aAttribu
nsCSSValue* display = aData->ValueForDisplay();
if (display->GetUnit() == eCSSUnit_Null) {
if (aAttributes->IndexOfAttr(nsGkAtoms::hidden) >= 0) {
display->SetIntValue(StyleDisplay::None_, eCSSUnit_Enumerated);
display->SetIntValue(StyleDisplay::None, eCSSUnit_Enumerated);
}
}
}
@ -3097,7 +3097,7 @@ IsOrHasAncestorWithDisplayNone(Element* aElement, nsIPresShell* aPresShell)
sc = nsComputedDOMStyle::GetStyleContextForElementNoFlush(elementsToCheck[i],
nullptr, aPresShell);
}
if (sc->StyleDisplay()->mDisplay == StyleDisplay::None_) {
if (sc->StyleDisplay()->mDisplay == StyleDisplay::None) {
return true;
}
}

View File

@ -69,6 +69,9 @@ using namespace mozilla::media;
#undef SAMPLE_LOG
#undef DECODER_WARN
#undef DUMP_LOG
#undef SFMT
#undef SLOG
#undef SWARN
#define FMT(x, ...) "Decoder=%p " x, mDecoderID, ##__VA_ARGS__
#define DECODER_LOG(...) MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, (FMT(__VA_ARGS__)))
@ -77,6 +80,11 @@ using namespace mozilla::media;
#define DECODER_WARN(...) NS_WARNING(nsPrintfCString(FMT(__VA_ARGS__)).get())
#define DUMP_LOG(...) NS_DebugBreak(NS_DEBUG_WARNING, nsPrintfCString(FMT(__VA_ARGS__)).get(), nullptr, nullptr, -1)
// Used by StateObject and its sub-classes
#define SFMT(x, ...) "Decoder=%p state=%s " x, mMaster->mDecoderID, ToStateStr(GetState()), ##__VA_ARGS__
#define SLOG(...) MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, (SFMT(__VA_ARGS__)))
#define SWARN(...) NS_WARNING(nsPrintfCString(SFMT(__VA_ARGS__)).get())
// Certain constants get stored as member variables and then adjusted by various
// scale factors on a per-decoder basis. We want to make sure to avoid using these
// constants directly, so we put them in a namespace.
@ -213,9 +221,20 @@ public:
virtual void Step() {} // Perform a 'cycle' of this state object.
virtual State GetState() const = 0;
// Event handlers for various events.
// Return true if the event is handled by this state object.
virtual bool HandleDormant(bool aDormant) { return false; }
protected:
using Master = MediaDecoderStateMachine;
explicit StateObject(Master* aPtr) : mMaster(aPtr) {}
TaskQueue* OwnerThread() const { return mMaster->mTaskQueue; }
MediaResource* Resource() const { return mMaster->mResource; }
MediaDecoderReaderWrapper* Reader() const { return mMaster->mReader; }
// Note this function will delete the current state object.
// Don't access members to avoid UAF after this call.
void SetState(State aState) { mMaster->SetState(aState); }
// Take a raw pointer in order not to change the life cycle of MDSM.
// It is guaranteed to be valid by MDSM.
@ -230,13 +249,124 @@ public:
void Enter() override
{
mMaster->ReadMetadata();
MOZ_ASSERT(!mMetadataRequest.Exists());
SLOG("Dispatching AsyncReadMetadata");
// Set mode to METADATA since we are about to read metadata.
Resource()->SetReadMode(MediaCacheStream::MODE_METADATA);
// We disconnect mMetadataRequest in Exit() so it is fine to capture
// a raw pointer here.
mMetadataRequest.Begin(Reader()->ReadMetadata()
->Then(OwnerThread(), __func__,
[this] (MetadataHolder* aMetadata) {
OnMetadataRead(aMetadata);
},
[this] (ReadMetadataFailureReason aReason) {
OnMetadataNotRead(aReason);
}));
}
void Exit() override
{
mMetadataRequest.DisconnectIfExists();
}
State GetState() const override
{
return DECODER_STATE_DECODING_METADATA;
}
bool HandleDormant(bool aDormant) override
{
mPendingDormant = aDormant;
return true;
}
private:
void OnMetadataRead(MetadataHolder* aMetadata)
{
mMetadataRequest.Complete();
if (mPendingDormant) {
// No need to store mQueuedSeek because we are at position 0.
SetState(DECODER_STATE_DORMANT);
return;
}
// Set mode to PLAYBACK after reading metadata.
Resource()->SetReadMode(MediaCacheStream::MODE_PLAYBACK);
mMaster->mInfo = aMetadata->mInfo;
mMaster->mMetadataTags = aMetadata->mTags.forget();
if (mMaster->mInfo.mMetadataDuration.isSome()) {
mMaster->RecomputeDuration();
} else if (mMaster->mInfo.mUnadjustedMetadataEndTime.isSome()) {
RefPtr<Master> master = mMaster;
Reader()->AwaitStartTime()->Then(OwnerThread(), __func__,
[master] () {
NS_ENSURE_TRUE_VOID(!master->IsShutdown());
TimeUnit unadjusted = master->mInfo.mUnadjustedMetadataEndTime.ref();
TimeUnit adjustment = master->mReader->StartTime();
master->mInfo.mMetadataDuration.emplace(unadjusted - adjustment);
master->RecomputeDuration();
}, [master, this] () {
SWARN("Adjusting metadata end time failed");
}
);
}
if (mMaster->HasVideo()) {
SLOG("Video decode isAsync=%d HWAccel=%d videoQueueSize=%d",
Reader()->IsAsync(),
Reader()->VideoIsHardwareAccelerated(),
mMaster->GetAmpleVideoFrames());
}
// In general, we wait until we know the duration before notifying the decoder.
// However, we notify unconditionally in this case without waiting for the start
// time, since the caller might be waiting on metadataloaded to be fired before
// feeding in the CDM, which we need to decode the first frame (and
// thus get the metadata). We could fix this if we could compute the start
// time by demuxing without necessaring decoding.
bool waitingForCDM =
#ifdef MOZ_EME
mMaster->mInfo.IsEncrypted() && !mMaster->mCDMProxy;
#else
false;
#endif
mMaster->mNotifyMetadataBeforeFirstFrame =
mMaster->mDuration.Ref().isSome() || waitingForCDM;
if (mMaster->mNotifyMetadataBeforeFirstFrame) {
mMaster->EnqueueLoadedMetadataEvent();
}
if (waitingForCDM) {
// Metadata parsing was successful but we're still waiting for CDM caps
// to become available so that we can build the correct decryptor/decoder.
SetState(DECODER_STATE_WAIT_FOR_CDM);
return;
}
SetState(DECODER_STATE_DECODING_FIRSTFRAME);
}
void OnMetadataNotRead(ReadMetadataFailureReason aReason)
{
mMetadataRequest.Complete();
SWARN("Decode metadata failed, shutting down decoder");
mMaster->DecodeError();
}
MozPromiseRequestHolder<MediaDecoderReader::MetadataPromise> mMetadataRequest;
// True if we need to enter dormant state after reading metadata. Note that
// we can't enter dormant state until reading metadata is done for some
// limitations of the reader.
bool mPendingDormant = false;
};
class MediaDecoderStateMachine::WaitForCDMState
@ -1357,13 +1487,12 @@ MediaDecoderStateMachine::SetDormant(bool aDormant)
return;
}
bool wasDormant = mState == DECODER_STATE_DORMANT;
if (wasDormant == aDormant) {
if (mStateObj->HandleDormant(aDormant)) {
return;
}
if (mMetadataRequest.Exists()) {
mPendingDormant = aDormant;
bool wasDormant = mState == DECODER_STATE_DORMANT;
if (wasDormant == aDormant) {
return;
}
@ -1711,23 +1840,6 @@ void MediaDecoderStateMachine::ReaderSuspendedChanged()
SetDormant(mIsReaderSuspended);
}
void
MediaDecoderStateMachine::ReadMetadata()
{
MOZ_ASSERT(OnTaskQueue());
MOZ_ASSERT(!IsShutdown());
MOZ_ASSERT(mState == DECODER_STATE_DECODING_METADATA);
MOZ_ASSERT(!mMetadataRequest.Exists());
DECODER_LOG("Dispatching AsyncReadMetadata");
// Set mode to METADATA since we are about to read metadata.
mResource->SetReadMode(MediaCacheStream::MODE_METADATA);
mMetadataRequest.Begin(mReader->ReadMetadata()
->Then(OwnerThread(), __func__, this,
&MediaDecoderStateMachine::OnMetadataRead,
&MediaDecoderStateMachine::OnMetadataNotRead));
}
RefPtr<MediaDecoder::SeekPromise>
MediaDecoderStateMachine::Seek(SeekTarget aTarget)
{
@ -2182,83 +2294,6 @@ MediaDecoderStateMachine::DecodeError()
mOnPlaybackEvent.Notify(MediaEventType::DecodeError);
}
void
MediaDecoderStateMachine::OnMetadataRead(MetadataHolder* aMetadata)
{
MOZ_ASSERT(OnTaskQueue());
MOZ_ASSERT(mState == DECODER_STATE_DECODING_METADATA);
mMetadataRequest.Complete();
if (mPendingDormant) {
mPendingDormant = false;
SetDormant(true);
return;
}
// Set mode to PLAYBACK after reading metadata.
mResource->SetReadMode(MediaCacheStream::MODE_PLAYBACK);
mInfo = aMetadata->mInfo;
mMetadataTags = aMetadata->mTags.forget();
RefPtr<MediaDecoderStateMachine> self = this;
if (mInfo.mMetadataDuration.isSome()) {
RecomputeDuration();
} else if (mInfo.mUnadjustedMetadataEndTime.isSome()) {
mReader->AwaitStartTime()->Then(OwnerThread(), __func__,
[self] () -> void {
NS_ENSURE_TRUE_VOID(!self->IsShutdown());
TimeUnit unadjusted = self->mInfo.mUnadjustedMetadataEndTime.ref();
TimeUnit adjustment = self->mReader->StartTime();
self->mInfo.mMetadataDuration.emplace(unadjusted - adjustment);
self->RecomputeDuration();
}, [] () -> void { NS_WARNING("Adjusting metadata end time failed"); }
);
}
if (HasVideo()) {
DECODER_LOG("Video decode isAsync=%d HWAccel=%d videoQueueSize=%d",
mReader->IsAsync(),
mReader->VideoIsHardwareAccelerated(),
GetAmpleVideoFrames());
}
// In general, we wait until we know the duration before notifying the decoder.
// However, we notify unconditionally in this case without waiting for the start
// time, since the caller might be waiting on metadataloaded to be fired before
// feeding in the CDM, which we need to decode the first frame (and
// thus get the metadata). We could fix this if we could compute the start
// time by demuxing without necessaring decoding.
bool waitingForCDM =
#ifdef MOZ_EME
mInfo.IsEncrypted() && !mCDMProxy;
#else
false;
#endif
mNotifyMetadataBeforeFirstFrame = mDuration.Ref().isSome() || waitingForCDM;
if (mNotifyMetadataBeforeFirstFrame) {
EnqueueLoadedMetadataEvent();
}
if (waitingForCDM) {
// Metadata parsing was successful but we're still waiting for CDM caps
// to become available so that we can build the correct decryptor/decoder.
SetState(DECODER_STATE_WAIT_FOR_CDM);
return;
}
SetState(DECODER_STATE_DECODING_FIRSTFRAME);
}
void
MediaDecoderStateMachine::OnMetadataNotRead(ReadMetadataFailureReason aReason)
{
MOZ_ASSERT(OnTaskQueue());
MOZ_ASSERT(mState == DECODER_STATE_DECODING_METADATA);
mMetadataRequest.Complete();
DECODER_WARN("Decode metadata failed, shutting down decoder");
DecodeError();
}
void
MediaDecoderStateMachine::EnqueueLoadedMetadataEvent()
{
@ -2593,7 +2628,6 @@ MediaDecoderStateMachine::Reset(TrackSet aTracks)
AudioQueue().Reset();
}
mMetadataRequest.DisconnectIfExists();
mSeekTaskRequest.DisconnectIfExists();
mPlaybackOffset = 0;

View File

@ -278,8 +278,6 @@ private:
void SetAudioCaptured(bool aCaptured);
void ReadMetadata();
RefPtr<MediaDecoder::SeekPromise> Seek(SeekTarget aTarget);
RefPtr<ShutdownPromise> Shutdown();
@ -537,10 +535,6 @@ protected:
// must be held when calling this. Called on the decode thread.
int64_t GetDecodedAudioDuration();
// Promise callbacks for metadata reading.
void OnMetadataRead(MetadataHolder* aMetadata);
void OnMetadataNotRead(ReadMetadataFailureReason aReason);
// Notify FirstFrameLoaded if having decoded first frames and
// transition to SEEKING if there is any pending seek, or DECODING otherwise.
void MaybeFinishDecodeFirstFrame();
@ -816,11 +810,6 @@ private:
// True if all video frames are already rendered.
Watchable<bool> mVideoCompleted;
// True if we need to enter dormant state after reading metadata. Note that
// we can't enter dormant state until reading metadata is done for some
// limitations of the reader.
bool mPendingDormant = false;
// Flag whether we notify metadata before decoding the first frame or after.
//
// Note that the odd semantics here are designed to replicate the current
@ -853,9 +842,6 @@ private:
// by the decoder monitor.
bool mDecodeThreadWaiting;
// Track our request for metadata from the reader.
MozPromiseRequestHolder<MediaDecoderReader::MetadataPromise> mMetadataRequest;
// Stores presentation info required for playback. The decoder monitor
// must be held when accessing this.
MediaInfo mInfo;

View File

@ -279,6 +279,8 @@ PluginPRLibrary::IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing)
*aDrawing = false;
return NS_OK;
}
#endif
#if defined(XP_MACOSX) || defined(XP_WIN)
nsresult
PluginPRLibrary::ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor)
{

View File

@ -114,6 +114,8 @@ public:
virtual bool IsOOP() override { return false; }
#if defined(XP_MACOSX)
virtual nsresult IsRemoteDrawingCoreAnimation(NPP aInstance, bool* aDrawing) override;
#endif
#if defined(XP_MACOSX) || defined(XP_WIN)
virtual nsresult ContentsScaleFactorChanged(NPP aInstance, double aContentsScaleFactor) override;
#endif
virtual nsresult SetBackgroundUnknown(NPP instance) override;

View File

@ -416,8 +416,10 @@ typedef enum {
NPNVCSSZoomFactor = 23,
NPNVpluginDrawingModel = 1000 /* Get the current drawing model (NPDrawingModel) */
#if defined(XP_MACOSX)
#if defined(XP_MACOSX) || defined(XP_WIN)
, NPNVcontentsScaleFactor = 1001
#endif
#if defined(XP_MACOSX)
#ifndef NP_NO_QUICKDRAW
, NPNVsupportsQuickDrawBool = 2000
#endif

View File

@ -2013,7 +2013,9 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
*(NPBool*)result = true;
return NPERR_NO_ERROR;
}
#endif
#if defined(XP_MACOSX) || defined(XP_WIN)
case NPNVcontentsScaleFactor: {
nsNPAPIPluginInstance *inst =
(nsNPAPIPluginInstance *) (npp ? npp->ndata : nullptr);

View File

@ -1005,7 +1005,7 @@ nsresult nsNPAPIPluginInstance::IsRemoteDrawingCoreAnimation(bool* aDrawing)
nsresult
nsNPAPIPluginInstance::ContentsScaleFactorChanged(double aContentsScaleFactor)
{
#ifdef XP_MACOSX
#if defined(XP_MACOSX) || defined(XP_WIN)
if (!mPlugin)
return NS_ERROR_FAILURE;

View File

@ -1353,14 +1353,6 @@ bool nsPluginInstanceOwner::IsRemoteDrawingCoreAnimation()
return coreAnimation;
}
nsresult nsPluginInstanceOwner::ContentsScaleFactorChanged(double aContentsScaleFactor)
{
if (!mInstance) {
return NS_ERROR_NULL_POINTER;
}
return mInstance->ContentsScaleFactorChanged(aContentsScaleFactor);
}
NPEventModel nsPluginInstanceOwner::GetEventModel()
{
return mEventModel;
@ -1451,6 +1443,16 @@ void nsPluginInstanceOwner::SetPluginPort()
mPluginWindow->window = pluginPort;
}
#endif
#if defined(XP_MACOSX) || defined(XP_WIN)
nsresult nsPluginInstanceOwner::ContentsScaleFactorChanged(double aContentsScaleFactor)
{
if (!mInstance) {
return NS_ERROR_NULL_POINTER;
}
return mInstance->ContentsScaleFactorChanged(aContentsScaleFactor);
}
#endif
// static
uint32_t
@ -3623,7 +3625,7 @@ nsPluginInstanceOwner::UpdateWindowVisibility(bool aVisible)
void
nsPluginInstanceOwner::ResolutionMayHaveChanged()
{
#ifdef XP_MACOSX
#if defined(XP_MACOSX) || defined(XP_WIN)
double scaleFactor = 1.0;
GetContentsScaleFactor(&scaleFactor);
if (scaleFactor != mLastScaleFactor) {
@ -3709,7 +3711,7 @@ nsPluginInstanceOwner::GetContentsScaleFactor(double *result)
// On Mac, device pixels need to be translated to (and from) "display pixels"
// for plugins. On other platforms, plugin coordinates are always in device
// pixels.
#if defined(XP_MACOSX)
#if defined(XP_MACOSX) || defined(XP_WIN)
nsCOMPtr<nsIContent> content = do_QueryReferent(mContent);
nsIPresShell* presShell = nsContentUtils::FindPresShellForDocument(content->OwnerDoc());
if (presShell) {

View File

@ -141,7 +141,7 @@ public:
void SendWindowFocusChanged(bool aIsActive);
NPDrawingModel GetDrawingModel();
bool IsRemoteDrawingCoreAnimation();
nsresult ContentsScaleFactorChanged(double aContentsScaleFactor);
NPEventModel GetEventModel();
static void CARefresh(nsITimer *aTimer, void *aClosure);
void AddToCARefreshTimer();
@ -158,6 +158,10 @@ public:
#endif // XP_MACOSX
void ResolutionMayHaveChanged();
#if defined(XP_MACOSX) || defined(XP_WIN)
nsresult ContentsScaleFactorChanged(double aContentsScaleFactor);
#endif
void UpdateDocumentActiveState(bool aIsActive);
void SetFrame(nsPluginFrame *aFrame);
@ -337,10 +341,10 @@ private:
bool mSentInitialTopLevelWindowEvent;
bool mLastWindowIsActive;
bool mLastContentFocused;
double mLastScaleFactor;
// True if, the next time the window is activated, we should blur ourselves.
bool mShouldBlurOnActivate;
#endif
double mLastScaleFactor;
double mLastCSSZoomFactor;
// Initially, the event loop nesting level we were created on, it's updated
// if we detect the appshell is on a lower level as long as we're not stopped.

View File

@ -25,6 +25,7 @@ struct NPRemoteEvent
RECT rect;
WINDOWPOS windowpos;
} lParamData;
double contentsScaleFactor;
};
}

View File

@ -63,6 +63,7 @@ using namespace std;
#include "mozilla/widget/WinModifierKeyState.h"
#include "mozilla/widget/WinNativeEventData.h"
#include "nsWindowsDllInterceptor.h"
#include "X11UndefineNone.h"
typedef BOOL (WINAPI *User32TrackPopupMenu)(HMENU hMenu,
UINT uFlags,
@ -140,7 +141,7 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface,
, mMode(aMode)
, mNames(aNames)
, mValues(aValues)
#if defined(XP_DARWIN)
#if defined(XP_DARWIN) || defined (XP_WIN)
, mContentsScaleFactor(1.0)
#endif
, mPostingKeyEvents(0)
@ -533,12 +534,14 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar,
return NPERR_NO_ERROR;
}
#endif /* NP_NO_QUICKDRAW */
#endif /* XP_MACOSX */
#if defined(XP_MACOSX) || defined(XP_WIN)
case NPNVcontentsScaleFactor: {
*static_cast<double*>(aValue) = mContentsScaleFactor;
return NPERR_NO_ERROR;
}
#endif /* XP_MACOSX */
#endif /* defined(XP_MACOSX) || defined(XP_WIN) */
case NPNVCSSZoomFactor: {
*static_cast<double*>(aValue) = mCSSZoomFactor;
@ -870,12 +873,6 @@ PluginInstanceChild::AnswerNPP_HandleEvent(const NPRemoteEvent& event,
#ifdef XP_MACOSX
// Mac OS X does not define an NPEvent structure. It defines more specific types.
NPCocoaEvent evcopy = event.event;
// event.contentsScaleFactor <= 0 is a signal we shouldn't use it,
// for example when AnswerNPP_HandleEvent() is called from elsewhere
// in the child process (not via rpc code from the parent process).
if (event.contentsScaleFactor > 0) {
mContentsScaleFactor = event.contentsScaleFactor;
}
// Make sure we reset mCurrentEvent in case of an exception
AutoRestore<const NPCocoaEvent*> savePreviousEvent(mCurrentEvent);
@ -887,6 +884,15 @@ PluginInstanceChild::AnswerNPP_HandleEvent(const NPRemoteEvent& event,
NPEvent evcopy = event.event;
#endif
#if defined(XP_MACOSX) || defined(XP_WIN)
// event.contentsScaleFactor <= 0 is a signal we shouldn't use it,
// for example when AnswerNPP_HandleEvent() is called from elsewhere
// in the child process (not via rpc code from the parent process).
if (event.contentsScaleFactor > 0) {
mContentsScaleFactor = event.contentsScaleFactor;
}
#endif
#ifdef OS_WIN
// FIXME/bug 567645: temporarily drop the "dummy event" on the floor
if (WM_NULL == evcopy.event)
@ -1132,17 +1138,19 @@ PluginInstanceChild::RecvWindowPosChanged(const NPRemoteEvent& event)
bool
PluginInstanceChild::RecvContentsScaleFactorChanged(const double& aContentsScaleFactor)
{
#ifdef XP_MACOSX
#if defined(XP_MACOSX) || defined(XP_WIN)
mContentsScaleFactor = aContentsScaleFactor;
#if defined(XP_MACOSX)
if (mShContext) {
// Release the shared context so that it is reallocated
// with the new size.
::CGContextRelease(mShContext);
mShContext = nullptr;
}
#endif
return true;
#else
NS_RUNTIMEABORT("ContentsScaleFactorChanged is an OSX-only message");
NS_RUNTIMEABORT("ContentsScaleFactorChanged is an Windows or OSX only message");
return false;
#endif
}
@ -1337,6 +1345,7 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
mWindow.width = aWindow.width;
mWindow.height = aWindow.height;
mWindow.type = aWindow.type;
mContentsScaleFactor = aWindow.contentsScaleFactor;
if (mPluginIface->setwindow) {
SetProp(mPluginWindowHWND, kPluginIgnoreSubclassProperty, (HANDLE)1);
@ -3328,7 +3337,7 @@ PluginInstanceChild::DoAsyncSetWindow(const gfxSurfaceType& aSurfaceType,
mWindow.height = aWindow.height;
mWindow.clipRect = aWindow.clipRect;
mWindow.type = aWindow.type;
#ifdef XP_MACOSX
#if defined(XP_MACOSX) || defined(XP_WIN)
mContentsScaleFactor = aWindow.contentsScaleFactor;
#endif

View File

@ -410,7 +410,7 @@ private:
InfallibleTArray<nsCString> mValues;
NPP_t mData;
NPWindow mWindow;
#if defined(XP_DARWIN)
#if defined(XP_DARWIN) || defined(XP_WIN)
double mContentsScaleFactor;
#endif
double mCSSZoomFactor;

View File

@ -992,7 +992,7 @@ PluginInstanceParent::AsyncSetWindow(NPWindow* aWindow)
window.height = aWindow->height;
window.clipRect = aWindow->clipRect;
window.type = aWindow->type;
#ifdef XP_MACOSX
#if defined(XP_MACOSX) || defined(XP_WIN)
double scaleFactor = 1.0;
mNPNIface->getvalue(mNPP, NPNVcontentsScaleFactor, &scaleFactor);
window.contentsScaleFactor = scaleFactor;
@ -1106,7 +1106,8 @@ PluginInstanceParent::IsRemoteDrawingCoreAnimation(bool *aDrawing)
NPDrawingModelInvalidatingCoreAnimation == (NPDrawingModel)mDrawingModel);
return NS_OK;
}
#endif
#if defined(XP_MACOSX) || defined(XP_WIN)
nsresult
PluginInstanceParent::ContentsScaleFactorChanged(double aContentsScaleFactor)
{
@ -1365,12 +1366,13 @@ PluginInstanceParent::NPP_SetWindow(const NPWindow* aWindow)
window.type = aWindow->type;
#endif
#if defined(XP_MACOSX)
#if defined(XP_MACOSX) || defined(XP_WIN)
double floatScaleFactor = 1.0;
mNPNIface->getvalue(mNPP, NPNVcontentsScaleFactor, &floatScaleFactor);
int scaleFactor = ceil(floatScaleFactor);
window.contentsScaleFactor = floatScaleFactor;
#endif
#if defined(XP_MACOSX)
if (mShWidth != window.width * scaleFactor || mShHeight != window.height * scaleFactor) {
if (mDrawingModel == NPDrawingModelCoreAnimation ||
mDrawingModel == NPDrawingModelInvalidatingCoreAnimation) {
@ -1565,7 +1567,7 @@ PluginInstanceParent::NPP_HandleEvent(void* event)
#endif
NPRemoteEvent npremoteevent;
npremoteevent.event = *npevent;
#if defined(XP_MACOSX)
#if defined(XP_MACOSX) || defined(XP_WIN)
double scaleFactor = 1.0;
mNPNIface->getvalue(mNPP, NPNVcontentsScaleFactor, &scaleFactor);
npremoteevent.contentsScaleFactor = scaleFactor;

View File

@ -324,6 +324,8 @@ public:
nsresult GetImageSize(nsIntSize* aSize);
#ifdef XP_MACOSX
nsresult IsRemoteDrawingCoreAnimation(bool *aDrawing);
#endif
#if defined(XP_MACOSX) || defined(XP_WIN)
nsresult ContentsScaleFactorChanged(double aContentsScaleFactor);
#endif
nsresult SetBackgroundUnknown();

View File

@ -85,6 +85,8 @@ public:
virtual bool IsOOP() = 0;
#if defined(XP_MACOSX)
virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing) = 0;
#endif
#if defined(XP_MACOSX) || defined(XP_WIN)
virtual nsresult ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor) = 0;
#endif
#if defined(XP_WIN)

View File

@ -93,7 +93,7 @@ struct NPRemoteWindow
VisualID visualID;
Colormap colormap;
#endif /* XP_UNIX */
#if defined(XP_MACOSX)
#if defined(XP_MACOSX) || defined(XP_WIN)
double contentsScaleFactor;
#endif
};
@ -346,7 +346,7 @@ struct ParamTraits<mozilla::plugins::NPRemoteWindow>
aMsg->WriteULong(aParam.visualID);
aMsg->WriteULong(aParam.colormap);
#endif
#if defined(XP_MACOSX)
#if defined(XP_MACOSX) || defined(XP_WIN)
aMsg->WriteDouble(aParam.contentsScaleFactor);
#endif
}
@ -375,7 +375,7 @@ struct ParamTraits<mozilla::plugins::NPRemoteWindow>
return false;
#endif
#if defined(XP_MACOSX)
#if defined(XP_MACOSX) || defined(XP_WIN)
double contentsScaleFactor;
if (!aMsg->ReadDouble(aIter, &contentsScaleFactor))
return false;
@ -392,7 +392,7 @@ struct ParamTraits<mozilla::plugins::NPRemoteWindow>
aResult->visualID = visualID;
aResult->colormap = colormap;
#endif
#if defined(XP_MACOSX)
#if defined(XP_MACOSX) || defined(XP_WIN)
aResult->contentsScaleFactor = contentsScaleFactor;
#endif
return true;

View File

@ -2855,7 +2855,8 @@ PluginModuleParent::IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing)
return i->IsRemoteDrawingCoreAnimation(aDrawing);
}
#endif
#if defined(XP_MACOSX) || defined(XP_WIN)
nsresult
PluginModuleParent::ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor)
{

View File

@ -305,6 +305,8 @@ public:
#if defined(XP_MACOSX)
virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing) override;
#endif
#if defined(XP_MACOSX) || defined(XP_WIN)
virtual nsresult ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor) override;
#endif

View File

@ -124,7 +124,9 @@ skip-if = true # disabled due to oddness, perhaps scrolling of the mochitest win
[test_propertyAndMethod.html]
[test_queryCSSZoomFactor.html]
[test_queryContentsScaleFactor.html]
skip-if = toolkit != "cocoa"
skip-if = (toolkit != "cocoa") || (os != "win")
[test_queryContentsScaleFactorWindowed.html]
skip-if = (toolkit != "cocoa") || (os != "win")
[test_redirect_handling.html]
[test_secondPlugin.html]
[test_src_url_change.html]

View File

@ -21,6 +21,7 @@
}
is(exceptionThrown, false, "Exception thrown getting contents scale factor.");
is(isNaN(contentsScaleFactor), false, "Invalid return getting contents scale factor");
ok(true, "Got Scale Factor of " + contentsScaleFactor);
SimpleTest.finish();
}
</script>

View File

@ -0,0 +1,31 @@
<html>
<head>
<title>NPAPI NPNVcontentsScaleFactor Test</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="utils.js"></script>
</head>
<body onload="runTests()">
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED);
function runTests() {
var pluginElement = document.getElementById("plugin");
var contentsScaleFactor;
var exceptionThrown = false;
try {
contentsScaleFactor = pluginElement.queryContentsScaleFactor();
} catch (e) {
exceptionThrown = true;
}
is(exceptionThrown, false, "Exception thrown getting contents scale factor.");
is(isNaN(contentsScaleFactor), false, "Invalid return getting contents scale factor");
ok(true, "Got Scale Factor of " + contentsScaleFactor);
SimpleTest.finish();
}
</script>
<embed id="plugin" type="application/x-test" width="400" height="400" wmode="window"></embed>
</body>
</html>

View File

@ -3921,7 +3921,7 @@ bool queryContentsScaleFactor(NPObject* npobj, const NPVariant* args, uint32_t a
return false;
double scaleFactor = 1.0;
#if defined(XP_MACOSX)
#if defined(XP_MACOSX) || defined(XP_WIN)
NPError err = NPN_GetValue(static_cast<TestNPObject*>(npobj)->npp,
NPNVcontentsScaleFactor, &scaleFactor);
if (err != NPERR_NO_ERROR) {

View File

@ -3437,7 +3437,7 @@ IsElementVisible(Element* aElement)
nsComputedDOMStyle::GetStyleContextForElementNoFlush(aElement,
nullptr, nullptr);
if (styleContext) {
return styleContext->StyleDisplay()->mDisplay != StyleDisplay::None_;
return styleContext->StyleDisplay()->mDisplay != StyleDisplay::None;
}
return false;
}

View File

@ -4,9 +4,6 @@
* 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/. */
#ifndef MOZILLA_GFX_X11UNDEFINENONE_H_
#define MOZILLA_GFX_X11UNDEFINENONE_H_
// The header <X11/X.h> defines "None" as a macro that expands to "0L".
// This is terrible because many enumerations have an enumerator named "None".
// To work around this, we undefine the macro "None", and define a replacement
@ -24,4 +21,3 @@
# endif
#endif
#endif /* MOZILLA_GFX_X11UNDEFINENONE_H_ */

View File

@ -1787,7 +1787,7 @@ ElementRestyler::DoConditionallyRestyleUndisplayedDescendants(
nsCSSFrameConstructor* fc = mPresContext->FrameConstructor();
UndisplayedNode* nodes = fc->GetAllUndisplayedContentIn(aParent);
ConditionallyRestyleUndisplayedNodes(nodes, aParent,
StyleDisplay::None_, aRestyleRoot);
StyleDisplay::None, aRestyleRoot);
nodes = fc->GetAllDisplayContentsIn(aParent);
ConditionallyRestyleUndisplayedNodes(nodes, aParent,
StyleDisplay::Contents, aRestyleRoot);
@ -1802,7 +1802,7 @@ ElementRestyler::ConditionallyRestyleUndisplayedNodes(
const StyleDisplay aDisplay,
Element* aRestyleRoot)
{
MOZ_ASSERT(aDisplay == StyleDisplay::None_ ||
MOZ_ASSERT(aDisplay == StyleDisplay::None ||
aDisplay == StyleDisplay::Contents);
if (!aUndisplayed) {
return;
@ -1825,7 +1825,7 @@ ElementRestyler::ConditionallyRestyleUndisplayedNodes(
Element* element = undisplayed->mContent->AsElement();
if (!ConditionallyRestyle(element, aRestyleRoot)) {
if (aDisplay == StyleDisplay::None_) {
if (aDisplay == StyleDisplay::None) {
ConditionallyRestyleContentDescendants(element, aRestyleRoot);
} else { // StyleDisplay::Contents
DoConditionallyRestyleUndisplayedDescendants(element, aRestyleRoot);
@ -3425,7 +3425,7 @@ ElementRestyler::DoRestyleUndisplayedDescendants(nsRestyleHint aChildRestyleHint
nsCSSFrameConstructor* fc = mPresContext->FrameConstructor();
UndisplayedNode* nodes = fc->GetAllUndisplayedContentIn(aParent);
RestyleUndisplayedNodes(aChildRestyleHint, nodes, aParent,
aParentContext, StyleDisplay::None_);
aParentContext, StyleDisplay::None);
nodes = fc->GetAllDisplayContentsIn(aParent);
RestyleUndisplayedNodes(aChildRestyleHint, nodes, aParent,
aParentContext, StyleDisplay::Contents);

View File

@ -104,7 +104,7 @@ ServoRestyleManager::RecreateStyleContexts(nsIContent* aContent,
} else {
const nsStyleDisplay* currentDisplay =
Servo_GetStyleDisplay(computedValues);
if (currentDisplay->mDisplay != StyleDisplay::None_) {
if (currentDisplay->mDisplay != StyleDisplay::None) {
changeHint |= nsChangeHint_ReconstructFrame;
}
}

View File

@ -2485,7 +2485,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
propagatedScrollFrom == aDocElement,
"Scrollbars should have been propagated to the viewport");
if (MOZ_UNLIKELY(display->mDisplay == StyleDisplay::None_)) {
if (MOZ_UNLIKELY(display->mDisplay == StyleDisplay::None)) {
SetUndisplayedContent(aDocElement, styleContext);
return nullptr;
}
@ -4706,7 +4706,7 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay,
// NOTE: Make sure to keep this up to date with the StyleDisplay definition!
static const FrameConstructionDataByDisplay sDisplayData[] = {
FCDATA_FOR_DISPLAY(StyleDisplay::None_, UNREACHABLE_FCDATA()),
FCDATA_FOR_DISPLAY(StyleDisplay::None, UNREACHABLE_FCDATA()),
FCDATA_FOR_DISPLAY(StyleDisplay::Block, UNREACHABLE_FCDATA()),
// To keep the hash table small don't add inline frames (they're
// typically things like FONT and B), because we can quickly
@ -5702,7 +5702,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
// Pre-check for display "none" - if we find that, don't create
// any frame at all
if (StyleDisplay::None_ == display->mDisplay) {
if (StyleDisplay::None == display->mDisplay) {
SetAsUndisplayedContent(aState, aItems, aContent, styleContext, isGeneratedContent);
return;
}
@ -9200,7 +9200,7 @@ nsStyleContext*
nsCSSFrameConstructor::MaybeRecreateFramesForElement(Element* aElement)
{
RefPtr<nsStyleContext> oldContext = GetUndisplayedContent(aElement);
StyleDisplay oldDisplay = StyleDisplay::None_;
StyleDisplay oldDisplay = StyleDisplay::None;
if (!oldContext) {
oldContext = GetDisplayContentsStyleFor(aElement);
if (!oldContext) {
@ -9213,7 +9213,7 @@ nsCSSFrameConstructor::MaybeRecreateFramesForElement(Element* aElement)
RefPtr<nsStyleContext> newContext = mPresShell->StyleSet()->
ResolveStyleFor(aElement, oldContext->GetParent());
if (oldDisplay == StyleDisplay::None_) {
if (oldDisplay == StyleDisplay::None) {
ChangeUndisplayedContent(aElement, newContext);
} else {
ChangeDisplayContents(aElement, newContext);
@ -11653,7 +11653,7 @@ nsCSSFrameConstructor::CreateListBoxContent(nsContainerFrame* aParentFrame,
// any frame at all
const nsStyleDisplay* display = styleContext->StyleDisplay();
if (StyleDisplay::None_ == display->mDisplay) {
if (StyleDisplay::None == display->mDisplay) {
*aNewFrame = nullptr;
return NS_OK;
}

View File

@ -3069,7 +3069,7 @@ nsLayoutUtils::CombineBreakType(StyleClear aOrigBreakType,
breakType = StyleClear::Both;
}
break;
case StyleClear::None_:
case StyleClear::None:
if (StyleClear::Left == aNewBreakType ||
StyleClear::Right == aNewBreakType ||
StyleClear::Both == aNewBreakType) {

View File

@ -44,7 +44,7 @@ BlockReflowInput::BlockReflowInput(const ReflowInput& aReflowInput,
mBorderPadding(mReflowInput.ComputedLogicalBorderPadding()),
mPrevBEndMargin(),
mLineNumber(0),
mFloatBreakType(StyleClear::None_),
mFloatBreakType(StyleClear::None),
mConsumedBSize(aConsumedBSize)
{
if (!sFloatFragmentsInsideColumnPrefCached) {
@ -732,7 +732,7 @@ BlockReflowInput::FlowAndPlaceFloat(nsIFrame* aFloat)
// See if the float should clear any preceding floats...
// XXX We need to mark this float somehow so that it gets reflowed
// when floats are inserted before it.
if (StyleClear::None_ != floatDisplay->mBreakType) {
if (StyleClear::None != floatDisplay->mBreakType) {
// XXXldb Does this handle vertical margins correctly?
mBCoord = ClearFloats(mBCoord, floatDisplay->PhysicalBreakType(wm));
}
@ -1103,7 +1103,7 @@ BlockReflowInput::ClearFloats(nscoord aBCoord, StyleClear aBreakType,
nscoord newBCoord = aBCoord;
if (aBreakType != StyleClear::None_) {
if (aBreakType != StyleClear::None) {
newBCoord = mFloatManager->ClearFloats(newBCoord, aBreakType, aFlags);
}

View File

@ -844,7 +844,7 @@ ReflowInput::InitFrameType(nsIAtom* aFrameType)
frameType = NS_CSS_FRAME_TYPE_INTERNAL_TABLE;
break;
case StyleDisplay::None_:
case StyleDisplay::None:
default:
frameType = NS_CSS_FRAME_TYPE_UNKNOWN;
break;
@ -1213,7 +1213,7 @@ ReflowInput::CalculateHypotheticalPosition
nsHypotheticalPosition& aHypotheticalPos,
nsIAtom* aFrameType) const
{
NS_ASSERTION(mStyleDisplay->mOriginalDisplay != StyleDisplay::None_,
NS_ASSERTION(mStyleDisplay->mOriginalDisplay != StyleDisplay::None,
"mOriginalDisplay has not been properly initialized");
// Find the nearest containing block frame to the placeholder frame,

View File

@ -145,7 +145,7 @@ BRFrame::Reflow(nsPresContext* aPresContext,
// Return our reflow status
StyleClear breakType = aReflowInput.mStyleDisplay->PhysicalBreakType(wm);
if (StyleClear::None_ == breakType) {
if (StyleClear::None == breakType) {
breakType = StyleClear::Line;
}

View File

@ -47,7 +47,7 @@ nsBackdropFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// none or contents so that we can respond to style change on it. To
// support those values, we skip painting ourselves in those cases.
auto display = StyleDisplay()->mDisplay;
if (display == mozilla::StyleDisplay::None_ ||
if (display == mozilla::StyleDisplay::None ||
display == mozilla::StyleDisplay::Contents) {
return;
}

View File

@ -2037,7 +2037,7 @@ nsBlockFrame::PropagateFloatDamage(BlockReflowInput& aState,
static bool LineHasClear(nsLineBox* aLine) {
return aLine->IsBlock()
? (aLine->GetBreakTypeBefore() != StyleClear::None_ ||
? (aLine->GetBreakTypeBefore() != StyleClear::None ||
(aLine->mFirstChild->GetStateBits() & NS_BLOCK_HAS_CLEAR_CHILDREN) ||
!nsBlockFrame::BlockCanIntersectFloats(aLine->mFirstChild))
: aLine->HasFloatBreakAfter();
@ -2088,7 +2088,7 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
{
bool keepGoing = true;
bool repositionViews = false; // should we really need this?
bool foundAnyClears = aState.mFloatBreakType != StyleClear::None_;
bool foundAnyClears = aState.mFloatBreakType != StyleClear::None;
bool willReflowAgain = false;
#ifdef DEBUG
@ -2160,12 +2160,12 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
// We have to reflow the line if it's a block whose clearance
// might have changed, so detect that.
if (!line->IsDirty() &&
(line->GetBreakTypeBefore() != StyleClear::None_ ||
(line->GetBreakTypeBefore() != StyleClear::None ||
replacedBlock)) {
nscoord curBCoord = aState.mBCoord;
// See where we would be after applying any clearance due to
// BRs.
if (inlineFloatBreakType != StyleClear::None_) {
if (inlineFloatBreakType != StyleClear::None) {
curBCoord = aState.ClearFloats(curBCoord, inlineFloatBreakType);
}
@ -2191,14 +2191,14 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
}
// We might have to reflow a line that is after a clearing BR.
if (inlineFloatBreakType != StyleClear::None_) {
if (inlineFloatBreakType != StyleClear::None) {
aState.mBCoord = aState.ClearFloats(aState.mBCoord, inlineFloatBreakType);
if (aState.mBCoord != line->BStart() + deltaBCoord) {
// SlideLine is not going to put the line where the clearance
// put it. Reflow the line to be sure.
line->MarkDirty();
}
inlineFloatBreakType = StyleClear::None_;
inlineFloatBreakType = StyleClear::None;
}
bool previousMarginWasDirty = line->IsPreviousMarginDirty();
@ -2451,7 +2451,7 @@ nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState)
}
// Handle BR-clearance from the last line of the block
if (inlineFloatBreakType != StyleClear::None_) {
if (inlineFloatBreakType != StyleClear::None) {
aState.mBCoord = aState.ClearFloats(aState.mBCoord, inlineFloatBreakType);
}
@ -3136,10 +3136,10 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
StyleClear breakType = frame->StyleDisplay()->
PhysicalBreakType(aState.mReflowInput.GetWritingMode());
if (StyleClear::None_ != aState.mFloatBreakType) {
if (StyleClear::None != aState.mFloatBreakType) {
breakType = nsLayoutUtils::CombineBreakType(breakType,
aState.mFloatBreakType);
aState.mFloatBreakType = StyleClear::None_;
aState.mFloatBreakType = StyleClear::None;
}
// Clear past floats before the block if the clear style is not none
@ -3162,7 +3162,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
}
bool treatWithClearance = aLine->HasClearance();
bool mightClearFloats = breakType != StyleClear::None_;
bool mightClearFloats = breakType != StyleClear::None;
nsIFrame *replacedBlock = nullptr;
if (!nsBlockFrame::BlockCanIntersectFloats(frame)) {
mightClearFloats = true;
@ -3441,7 +3441,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
}
// ClearFloats might be able to advance us further once we're there.
aState.mBCoord =
aState.ClearFloats(newBCoord, StyleClear::None_, replacedBlock);
aState.ClearFloats(newBCoord, StyleClear::None, replacedBlock);
// Start over with a new available space rect at the new height.
floatAvailableSpace =
aState.GetFloatAvailableSpaceWithState(aState.mBCoord,
@ -4062,7 +4062,7 @@ nsBlockFrame::DoReflowInlineFrames(BlockReflowInput& aState,
* The line reflow status is simple: true means keep placing frames
* on the line; false means don't (the line is done). If the line
* has some sort of breaking affect then aLine's break-type will be set
* to something other than StyleClear::None_.
* to something other than StyleClear::None.
*/
void
nsBlockFrame::ReflowInlineFrame(BlockReflowInput& aState,
@ -4119,17 +4119,17 @@ nsBlockFrame::ReflowInlineFrame(BlockReflowInput& aState,
// break-after-not-complete. There are two situations: we are a
// block or we are an inline. This makes a total of 10 cases
// (fortunately, there is some overlap).
aLine->SetBreakTypeAfter(StyleClear::None_);
aLine->SetBreakTypeAfter(StyleClear::None);
if (NS_INLINE_IS_BREAK(frameReflowStatus) ||
StyleClear::None_ != aState.mFloatBreakType) {
StyleClear::None != aState.mFloatBreakType) {
// Always abort the line reflow (because a line break is the
// minimal amount of break we do).
*aLineReflowStatus = LINE_REFLOW_STOP;
// XXX what should aLine's break-type be set to in all these cases?
StyleClear breakType = NS_INLINE_GET_BREAK_TYPE(frameReflowStatus);
MOZ_ASSERT(StyleClear::None_ != breakType ||
StyleClear::None_ != aState.mFloatBreakType, "bad break type");
MOZ_ASSERT(StyleClear::None != breakType ||
StyleClear::None != aState.mFloatBreakType, "bad break type");
if (NS_INLINE_IS_BREAK_BEFORE(frameReflowStatus)) {
// Break-before cases.
@ -4157,15 +4157,15 @@ nsBlockFrame::ReflowInlineFrame(BlockReflowInput& aState,
// If a float split and its prev-in-flow was followed by a <BR>, then combine
// the <BR>'s break type with the inline's break type (the inline will be the very
// next frame after the split float).
if (StyleClear::None_ != aState.mFloatBreakType) {
if (StyleClear::None != aState.mFloatBreakType) {
breakType = nsLayoutUtils::CombineBreakType(breakType,
aState.mFloatBreakType);
aState.mFloatBreakType = StyleClear::None_;
aState.mFloatBreakType = StyleClear::None;
}
// Break-after cases
if (breakType == StyleClear::Line) {
if (!aLineLayout.GetLineEndsInBR()) {
breakType = StyleClear::None_;
breakType = StyleClear::None;
}
}
aLine->SetBreakTypeAfter(breakType);
@ -6245,7 +6245,7 @@ nsBlockFrame::FindTrailingClear()
return endLine->GetBreakTypeAfter();
}
}
return StyleClear::None_;
return StyleClear::None;
}
void

View File

@ -168,7 +168,7 @@ nsBlockReflowContext::ComputeCollapsedBStartMargin(const ReflowInput& aRI,
availSpace);
// Record that we're being optimistic by assuming the kid
// has no clearance
if (kid->StyleDisplay()->mBreakType != StyleClear::None_ ||
if (kid->StyleDisplay()->mBreakType != StyleClear::None ||
!nsBlockFrame::BlockCanIntersectFloats(kid)) {
*aMayNeedRetry = true;
}

View File

@ -3228,7 +3228,7 @@ nsFrame::IsSelectable(bool* aSelectable, StyleUserSelect* aSelectStyle) const
if (mState & NS_FRAME_GENERATED_CONTENT) {
*aSelectable = false;
} else {
*aSelectable = allowSelection && (selectStyle != StyleUserSelect::None_);
*aSelectable = allowSelection && (selectStyle != StyleUserSelect::None);
}
return NS_OK;
@ -3944,7 +3944,7 @@ static bool SelfIsSelectable(nsIFrame* aFrame, uint32_t aFlags)
return false;
}
return !aFrame->IsGeneratedContentFrame() &&
aFrame->StyleUIReset()->mUserSelect != StyleUserSelect::None_;
aFrame->StyleUIReset()->mUserSelect != StyleUserSelect::None;
}
static bool SelectionDescendToKids(nsIFrame* aFrame) {
@ -3960,7 +3960,7 @@ static bool SelectionDescendToKids(nsIFrame* aFrame) {
// they can at the moment)
return !aFrame->IsGeneratedContentFrame() &&
style != StyleUserSelect::All &&
style != StyleUserSelect::None_ &&
style != StyleUserSelect::None &&
((parent->GetStateBits() & NS_FRAME_INDEPENDENT_SELECTION) ||
!(aFrame->GetStateBits() & NS_FRAME_INDEPENDENT_SELECTION));
}
@ -8610,7 +8610,7 @@ nsIFrame::IsFocusable(int32_t *aTabIndex, bool aWithMouse)
StyleContext()->GetPseudo() != nsCSSAnonBoxes::anonymousGridItem) {
const nsStyleUserInterface* ui = StyleUserInterface();
if (ui->mUserFocus != StyleUserFocus::Ignore &&
ui->mUserFocus != StyleUserFocus::None_) {
ui->mUserFocus != StyleUserFocus::None) {
// Pass in default tabindex of -1 for nonfocusable and 0 for focusable
tabIndex = 0;
}

View File

@ -195,7 +195,7 @@ const char*
nsLineBox::BreakTypeToString(StyleClear aBreakType) const
{
switch (aBreakType) {
case StyleClear::None_: return "nobr";
case StyleClear::None: return "nobr";
case StyleClear::Left: return "leftbr";
case StyleClear::Right: return "rightbr";
case StyleClear::InlineStart: return "inlinestartbr";

View File

@ -395,11 +395,11 @@ public:
// using different names should help.
using StyleClear = mozilla::StyleClear;
bool HasBreakBefore() const {
return IsBlock() && StyleClear::None_ != BreakType();
return IsBlock() && StyleClear::None != BreakType();
}
void SetBreakTypeBefore(StyleClear aBreakType) {
MOZ_ASSERT(IsBlock(), "Only blocks have break-before");
MOZ_ASSERT(aBreakType == StyleClear::None_ ||
MOZ_ASSERT(aBreakType == StyleClear::None ||
aBreakType == StyleClear::Left ||
aBreakType == StyleClear::Right ||
aBreakType == StyleClear::Both,
@ -407,11 +407,11 @@ public:
mFlags.mBreakType = static_cast<int>(aBreakType);
}
StyleClear GetBreakTypeBefore() const {
return IsBlock() ? BreakType() : StyleClear::None_;
return IsBlock() ? BreakType() : StyleClear::None;
}
bool HasBreakAfter() const {
return !IsBlock() && StyleClear::None_ != BreakType();
return !IsBlock() && StyleClear::None != BreakType();
}
void SetBreakTypeAfter(StyleClear aBreakType) {
MOZ_ASSERT(!IsBlock(), "Only inlines have break-after");
@ -424,7 +424,7 @@ public:
StyleClear::Both == BreakType());
}
StyleClear GetBreakTypeAfter() const {
return !IsBlock() ? BreakType() : StyleClear::None_;
return !IsBlock() ? BreakType() : StyleClear::None;
}
// mCarriedOutBEndMargin value

View File

@ -570,6 +570,8 @@ nsPluginFrame::FixupWindow(const nsSize& aSize)
nsIntPoint origin = GetWindowOriginInPixels(windowless);
// window must be in "display pixels"
#if defined(XP_MACOSX)
// window must be in "display pixels"
double scaleFactor = 1.0;
if (NS_FAILED(mInstanceOwner->GetContentsScaleFactor(&scaleFactor))) {
scaleFactor = 1.0;
@ -579,6 +581,12 @@ nsPluginFrame::FixupWindow(const nsSize& aSize)
window->y = origin.y / intScaleFactor;
window->width = presContext->AppUnitsToDevPixels(aSize.width) / intScaleFactor;
window->height = presContext->AppUnitsToDevPixels(aSize.height) / intScaleFactor;
#else
window->x = origin.x;
window->y = origin.y;
window->width = presContext->AppUnitsToDevPixels(aSize.width);
window->height = presContext->AppUnitsToDevPixels(aSize.height);
#endif
#ifndef XP_MACOSX
mInstanceOwner->UpdateWindowPositionAndClipRect(false);
@ -639,17 +647,24 @@ nsPluginFrame::CallSetWindow(bool aCheckIsHidden)
intBounds.x += intOffset.x;
intBounds.y += intOffset.y;
#if defined(XP_MACOSX)
// window must be in "display pixels"
double scaleFactor = 1.0;
if (NS_FAILED(instanceOwnerRef->GetContentsScaleFactor(&scaleFactor))) {
scaleFactor = 1.0;
}
size_t intScaleFactor = ceil(scaleFactor);
window->x = intBounds.x / intScaleFactor;
window->y = intBounds.y / intScaleFactor;
window->width = intBounds.width / intScaleFactor;
window->height = intBounds.height / intScaleFactor;
#else
window->x = intBounds.x;
window->y = intBounds.y;
window->width = intBounds.width;
window->height = intBounds.height;
#endif
// BE CAREFUL: By the time we get here the PluginFrame is sometimes destroyed
// and poisoned. If we reference local fields (implicit this deref),
// we will crash.
@ -1442,12 +1457,19 @@ nsPluginFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
if (window->width <= 0 || window->height <= 0)
return nullptr;
#if defined(XP_MACOSX)
// window is in "display pixels", but size needs to be in device pixels
// window must be in "display pixels"
double scaleFactor = 1.0;
if (NS_FAILED(mInstanceOwner->GetContentsScaleFactor(&scaleFactor))) {
scaleFactor = 1.0;
}
int intScaleFactor = ceil(scaleFactor);
size_t intScaleFactor = ceil(scaleFactor);
#else
size_t intScaleFactor = 1;
#endif
IntSize size(window->width * intScaleFactor, window->height * intScaleFactor);
nsRect area = GetContentRectRelativeToSelf() + aItem->ToReferenceFrame();

View File

@ -328,6 +328,12 @@ Gecko_FillAllBackgroundLists(nsStyleImageLayers* aLayers, uint32_t aMaxLen)
nsRuleNode::FillAllBackgroundLists(*aLayers, aMaxLen);
}
void
Gecko_FillAllMaskLists(nsStyleImageLayers* aLayers, uint32_t aMaxLen)
{
nsRuleNode::FillAllMaskLists(*aLayers, aMaxLen);
}
template <typename Implementor>
static nsIAtom*
AtomAttrValue(Implementor* aElement, nsIAtom* aName)

View File

@ -321,6 +321,7 @@ void Gecko_DestroyClipPath(mozilla::StyleClipPath* clip);
mozilla::StyleBasicShape* Gecko_NewBasicShape(mozilla::StyleBasicShapeType type);
void Gecko_FillAllBackgroundLists(nsStyleImageLayers* layers, uint32_t max_len);
void Gecko_FillAllMaskLists(nsStyleImageLayers* layers, uint32_t max_len);
NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsStyleCoord::Calc, Calc);
nsCSSShadowArray* Gecko_NewCSSShadowArray(uint32_t len);

View File

@ -400,7 +400,7 @@ ServoStyleSet::ProbePseudoElementStyle(Element* aParentElement,
const nsStyleDisplay *display = Servo_GetStyleDisplay(computedValues);
const nsStyleContent *content = Servo_GetStyleContent(computedValues);
// XXXldb What is contentCount for |content: ""|?
if (display->mDisplay == StyleDisplay::None_ ||
if (display->mDisplay == StyleDisplay::None ||
content->ContentCount() == 0) {
return nullptr;
}

View File

@ -4029,7 +4029,7 @@ StyleAnimationValue::ExtractComputedValue(nsCSSPropertyID aProperty,
aComputedValue.SetCSSValueArrayValue(result, eUnit_Shape);
} else {
MOZ_ASSERT(type == StyleShapeSourceType::None_, "unknown type");
MOZ_ASSERT(type == StyleShapeSourceType::None, "unknown type");
aComputedValue.SetNoneValue();
}
break;

View File

@ -1058,7 +1058,7 @@ const KTableEntry nsCSSProps::kCaptionSideKTable[] = {
};
KTableEntry nsCSSProps::kClearKTable[] = {
{ eCSSKeyword_none, StyleClear::None_ },
{ eCSSKeyword_none, StyleClear::None },
{ eCSSKeyword_left, StyleClear::Left },
{ eCSSKeyword_right, StyleClear::Right },
{ eCSSKeyword_inline_start, StyleClear::InlineStart },
@ -1244,7 +1244,7 @@ const KTableEntry nsCSSProps::kDirectionKTable[] = {
};
KTableEntry nsCSSProps::kDisplayKTable[] = {
{ eCSSKeyword_none, StyleDisplay::None_ },
{ eCSSKeyword_none, StyleDisplay::None },
{ eCSSKeyword_inline, StyleDisplay::Inline },
{ eCSSKeyword_block, StyleDisplay::Block },
{ eCSSKeyword_inline_block, StyleDisplay::InlineBlock },
@ -1479,7 +1479,7 @@ const KTableEntry nsCSSProps::kHyphensKTable[] = {
};
KTableEntry nsCSSProps::kFloatKTable[] = {
{ eCSSKeyword_none, StyleFloat::None_ },
{ eCSSKeyword_none, StyleFloat::None },
{ eCSSKeyword_left, StyleFloat::Left },
{ eCSSKeyword_right, StyleFloat::Right },
{ eCSSKeyword_inline_start, StyleFloat::InlineStart },
@ -2117,7 +2117,7 @@ const KTableEntry nsCSSProps::kUnicodeBidiKTable[] = {
};
const KTableEntry nsCSSProps::kUserFocusKTable[] = {
{ eCSSKeyword_none, uint8_t(StyleUserFocus::None_) },
{ eCSSKeyword_none, uint8_t(StyleUserFocus::None) },
{ eCSSKeyword_normal, uint8_t(StyleUserFocus::Normal) },
{ eCSSKeyword_ignore, uint8_t(StyleUserFocus::Ignore) },
{ eCSSKeyword_select_all, uint8_t(StyleUserFocus::SelectAll) },
@ -2144,7 +2144,7 @@ const KTableEntry nsCSSProps::kUserModifyKTable[] = {
};
const KTableEntry nsCSSProps::kUserSelectKTable[] = {
{ eCSSKeyword_none, StyleUserSelect::None_ },
{ eCSSKeyword_none, StyleUserSelect::None },
{ eCSSKeyword_auto, StyleUserSelect::Auto },
{ eCSSKeyword_text, StyleUserSelect::Text },
{ eCSSKeyword_element, StyleUserSelect::Element },
@ -2153,7 +2153,7 @@ const KTableEntry nsCSSProps::kUserSelectKTable[] = {
{ eCSSKeyword_toggle, StyleUserSelect::Toggle },
{ eCSSKeyword_tri_state, StyleUserSelect::TriState },
{ eCSSKeyword__moz_all, StyleUserSelect::MozAll },
{ eCSSKeyword__moz_none, StyleUserSelect::None_ },
{ eCSSKeyword__moz_none, StyleUserSelect::None },
{ eCSSKeyword__moz_text, StyleUserSelect::MozText },
{ eCSSKeyword_UNKNOWN, -1 }
};

View File

@ -6099,7 +6099,7 @@ nsComputedDOMStyle::GetShapeSource(
SetValueToFragmentOrURL(aShapeSource.GetURL(), val);
return val.forget();
}
case StyleShapeSourceType::None_: {
case StyleShapeSourceType::None: {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetIdent(eCSSKeyword_none);
return val.forget();

View File

@ -205,7 +205,7 @@ nsRuleNode::EnsureBlockDisplay(StyleDisplay& display,
break;
} // else, fall through to share the 'break' for non-changing display vals
MOZ_FALLTHROUGH;
case StyleDisplay::None_:
case StyleDisplay::None:
case StyleDisplay::Contents:
// never change display:none or display:contents *ever*
case StyleDisplay::Table:
@ -1342,16 +1342,16 @@ struct SetEnumValueHelper
DEFINE_ENUM_CLASS_SETTER(StyleBoxOrient, Horizontal, Vertical)
DEFINE_ENUM_CLASS_SETTER(StyleBoxPack, Start, Justify)
DEFINE_ENUM_CLASS_SETTER(StyleBoxSizing, Content, Border)
DEFINE_ENUM_CLASS_SETTER(StyleClear, None_, Both)
DEFINE_ENUM_CLASS_SETTER(StyleClear, None, Both)
DEFINE_ENUM_CLASS_SETTER(StyleFillRule, Nonzero, Evenodd)
DEFINE_ENUM_CLASS_SETTER(StyleFloat, None_, InlineEnd)
DEFINE_ENUM_CLASS_SETTER(StyleFloat, None, InlineEnd)
DEFINE_ENUM_CLASS_SETTER(StyleFloatEdge, ContentBox, MarginBox)
DEFINE_ENUM_CLASS_SETTER(StyleUserFocus, None_, SelectMenu)
DEFINE_ENUM_CLASS_SETTER(StyleUserSelect, None_, MozText)
DEFINE_ENUM_CLASS_SETTER(StyleUserFocus, None, SelectMenu)
DEFINE_ENUM_CLASS_SETTER(StyleUserSelect, None, MozText)
#ifdef MOZ_XUL
DEFINE_ENUM_CLASS_SETTER(StyleDisplay, None_, Popup)
DEFINE_ENUM_CLASS_SETTER(StyleDisplay, None, Popup)
#else
DEFINE_ENUM_CLASS_SETTER(StyleDisplay, None_, InlineBox)
DEFINE_ENUM_CLASS_SETTER(StyleDisplay, None, InlineBox)
#endif
#undef DEF_SET_ENUMERATED_VALUE
@ -5149,7 +5149,7 @@ nsRuleNode::ComputeUserInterfaceData(void* aStartStruct,
ui->mUserFocus, conditions,
SETVAL_ENUMERATED | SETVAL_UNSET_INHERIT,
parentUI->mUserFocus,
StyleUserFocus::None_);
StyleUserFocus::None);
// pointer-events: enum, inherit, initial
SetValue(*aRuleData->ValueForPointerEvents(), ui->mPointerEvents,
@ -6045,7 +6045,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
SetValue(*aRuleData->ValueForClear(), display->mBreakType, conditions,
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
parentDisplay->mBreakType,
StyleClear::None_);
StyleClear::None);
// temp fix for bug 24000
// Map 'auto' and 'avoid' to false, and 'always', 'left', and
@ -6104,7 +6104,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
display->mFloat, conditions,
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
parentDisplay->mFloat,
StyleFloat::None_);
StyleFloat::None);
// Save mFloat in mOriginalFloat in case we need it later
display->mOriginalFloat = display->mFloat;
@ -6175,7 +6175,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
parentDisplay->mResize,
NS_STYLE_RESIZE_NONE);
if (display->mDisplay != StyleDisplay::None_) {
if (display->mDisplay != StyleDisplay::None) {
// CSS2 9.7 specifies display type corrections dealing with 'float'
// and 'position'. Since generated content can't be floated or
// positioned, we can deal with it here.
@ -6231,7 +6231,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
// 1) if position is 'absolute' or 'fixed' then display must be
// block-level and float must be 'none'
EnsureBlockDisplay(display->mDisplay);
display->mFloat = StyleFloat::None_;
display->mFloat = StyleFloat::None;
// Note that it's OK to cache this struct in the ruletree
// because it's fine as-is for any style context that points to
@ -6239,7 +6239,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
// more specific rule sets "position: static") will use
// mOriginalDisplay and mOriginalFloat, which we have carefully
// not changed.
} else if (display->mFloat != StyleFloat::None_) {
} else if (display->mFloat != StyleFloat::None) {
// 2) if float is not none, and display is not none, then we must
// set a block-level 'display' type per CSS2.1 section 9.7.
EnsureBlockDisplay(display->mDisplay);
@ -7166,7 +7166,7 @@ SetImageLayerPairList(nsStyleContext* aStyleContext,
template <class ComputedValueItem>
static void
FillBackgroundList(
FillImageLayerList(
nsStyleAutoArray<nsStyleImageLayers::Layer>& aLayers,
ComputedValueItem nsStyleImageLayers::Layer::* aResultLocation,
uint32_t aItemCount, uint32_t aFillCount)
@ -7180,10 +7180,10 @@ FillBackgroundList(
}
}
// The same as FillBackgroundList, but for values stored in
// The same as FillImageLayerList, but for values stored in
// layer.mPosition.*aResultLocation instead of layer.*aResultLocation.
static void
FillBackgroundPositionCoordList(
FillImageLayerPositionCoordList(
nsStyleAutoArray<nsStyleImageLayers::Layer>& aLayers,
Position::Coord
Position::* aResultLocation,
@ -7208,31 +7208,31 @@ nsRuleNode::FillAllBackgroundLists(nsStyleImageLayers& aImage,
aImage.mLayers.TruncateLengthNonZero(aMaxItemCount);
uint32_t fillCount = aImage.mImageCount;
FillBackgroundList(aImage.mLayers,
FillImageLayerList(aImage.mLayers,
&nsStyleImageLayers::Layer::mImage,
aImage.mImageCount, fillCount);
FillBackgroundList(aImage.mLayers,
FillImageLayerList(aImage.mLayers,
&nsStyleImageLayers::Layer::mRepeat,
aImage.mRepeatCount, fillCount);
FillBackgroundList(aImage.mLayers,
FillImageLayerList(aImage.mLayers,
&nsStyleImageLayers::Layer::mAttachment,
aImage.mAttachmentCount, fillCount);
FillBackgroundList(aImage.mLayers,
FillImageLayerList(aImage.mLayers,
&nsStyleImageLayers::Layer::mClip,
aImage.mClipCount, fillCount);
FillBackgroundList(aImage.mLayers,
FillImageLayerList(aImage.mLayers,
&nsStyleImageLayers::Layer::mBlendMode,
aImage.mBlendModeCount, fillCount);
FillBackgroundList(aImage.mLayers,
FillImageLayerList(aImage.mLayers,
&nsStyleImageLayers::Layer::mOrigin,
aImage.mOriginCount, fillCount);
FillBackgroundPositionCoordList(aImage.mLayers,
FillImageLayerPositionCoordList(aImage.mLayers,
&Position::mXPosition,
aImage.mPositionXCount, fillCount);
FillBackgroundPositionCoordList(aImage.mLayers,
FillImageLayerPositionCoordList(aImage.mLayers,
&Position::mYPosition,
aImage.mPositionYCount, fillCount);
FillBackgroundList(aImage.mLayers,
FillImageLayerList(aImage.mLayers,
&nsStyleImageLayers::Layer::mSize,
aImage.mSizeCount, fillCount);
}
@ -9396,6 +9396,50 @@ SetSVGOpacity(const nsCSSValue& aValue,
}
}
/* static */
void
nsRuleNode::FillAllMaskLists(nsStyleImageLayers& aMask,
uint32_t aMaxItemCount)
{
// Delete any extra items. We need to keep layers in which any
// property was specified.
aMask.mLayers.TruncateLengthNonZero(aMaxItemCount);
uint32_t fillCount = aMask.mImageCount;
FillImageLayerList(aMask.mLayers,
&nsStyleImageLayers::Layer::mImage,
aMask.mImageCount, fillCount);
FillImageLayerList(aMask.mLayers,
&nsStyleImageLayers::Layer::mSourceURI,
aMask.mImageCount, fillCount);
FillImageLayerList(aMask.mLayers,
&nsStyleImageLayers::Layer::mRepeat,
aMask.mRepeatCount, fillCount);
FillImageLayerList(aMask.mLayers,
&nsStyleImageLayers::Layer::mClip,
aMask.mClipCount, fillCount);
FillImageLayerList(aMask.mLayers,
&nsStyleImageLayers::Layer::mOrigin,
aMask.mOriginCount, fillCount);
FillImageLayerPositionCoordList(aMask.mLayers,
&Position::mXPosition,
aMask.mPositionXCount, fillCount);
FillImageLayerPositionCoordList(aMask.mLayers,
&Position::mYPosition,
aMask.mPositionYCount, fillCount);
FillImageLayerList(aMask.mLayers,
&nsStyleImageLayers::Layer::mSize,
aMask.mSizeCount, fillCount);
FillImageLayerList(aMask.mLayers,
&nsStyleImageLayers::Layer::mMaskMode,
aMask.mMaskModeCount, fillCount);
FillImageLayerList(aMask.mLayers,
&nsStyleImageLayers::Layer::mComposite,
aMask.mCompositeCount, fillCount);
}
const void*
nsRuleNode::ComputeSVGData(void* aStartStruct,
const nsRuleData* aRuleData,
@ -10120,42 +10164,7 @@ nsRuleNode::ComputeSVGResetData(void* aStartStruct,
svgReset->mMask.mCompositeCount, maxItemCount, rebuild, conditions);
if (rebuild) {
// Delete any extra items. We need to keep layers in which any
// property was specified.
svgReset->mMask.mLayers.TruncateLengthNonZero(maxItemCount);
uint32_t fillCount = svgReset->mMask.mImageCount;
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mImage,
svgReset->mMask.mImageCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mSourceURI,
svgReset->mMask.mImageCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mRepeat,
svgReset->mMask.mRepeatCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mClip,
svgReset->mMask.mClipCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mOrigin,
svgReset->mMask.mOriginCount, fillCount);
FillBackgroundPositionCoordList(svgReset->mMask.mLayers,
&Position::mXPosition,
svgReset->mMask.mPositionXCount, fillCount);
FillBackgroundPositionCoordList(svgReset->mMask.mLayers,
&Position::mYPosition,
svgReset->mMask.mPositionYCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mSize,
svgReset->mMask.mSizeCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mMaskMode,
svgReset->mMask.mMaskModeCount, fillCount);
FillBackgroundList(svgReset->mMask.mLayers,
&nsStyleImageLayers::Layer::mComposite,
svgReset->mMask.mCompositeCount, fillCount);
FillAllBackgroundLists(svgReset->mMask, maxItemCount);
}
#else
// mask: none | <url>

View File

@ -1060,10 +1060,13 @@ public:
nsTimingFunction& aResult);
// Fill unspecified layers by cycling through their values
// till they all are of lenght aMaxItemCount
// till they all are of length aMaxItemCount
static void FillAllBackgroundLists(nsStyleImageLayers& aLayers,
uint32_t aMaxItemCount);
static void FillAllMaskLists(nsStyleImageLayers& aLayers,
uint32_t aMaxItemCount);
private:
#ifdef DEBUG
// non-inline helper function to allow assertions without incomplete

View File

@ -10,6 +10,7 @@
#include "gfxRect.h"
#include "nsFont.h"
#include "X11UndefineNone.h"
// XXX fold this into nsStyleContext and group by nsStyleXXX struct
@ -110,7 +111,7 @@ enum class StyleBoxShadowType : uint8_t {
// clear
enum class StyleClear : uint8_t {
None_ = 0,
None = 0,
Left,
Right,
InlineStart,
@ -143,7 +144,7 @@ enum class StyleFillRule : uint8_t {
// float
// https://developer.mozilla.org/en-US/docs/Web/CSS/float
enum class StyleFloat : uint8_t {
None_,
None,
Left,
Right,
InlineStart,
@ -166,18 +167,16 @@ enum class StyleShapeOutsideShapeBox : uint8_t {
};
// Shape source type
// X11 has a #define for None causing conflicts, so we use None_ here
enum class StyleShapeSourceType : uint8_t {
None_,
None,
URL,
Shape,
Box,
};
// user-focus
// X11 has a #define for None causing conflicts, so we use None_ here
enum class StyleUserFocus : uint8_t {
None_,
None,
Ignore,
Normal,
SelectAll,
@ -189,7 +188,7 @@ enum class StyleUserFocus : uint8_t {
// user-select
enum class StyleUserSelect : uint8_t {
None_,
None,
Text,
Element,
Elements,
@ -492,7 +491,7 @@ enum class FillMode : uint32_t;
// the FrameConstructorDataByDisplay stuff (both the XUL and non-XUL version),
// and ensure it's still correct!
enum class StyleDisplay : uint8_t {
None_ = 0,
None = 0,
Block,
Inline,
InlineBlock,

View File

@ -696,7 +696,7 @@ nsStyleContext::SetStyleBits()
// Set the NS_STYLE_IN_DISPLAY_NONE_SUBTREE bit
const nsStyleDisplay* disp = StyleDisplay();
if ((mParent && mParent->IsInDisplayNoneSubtree()) ||
disp->mDisplay == mozilla::StyleDisplay::None_) {
disp->mDisplay == mozilla::StyleDisplay::None) {
mBits |= NS_STYLE_IN_DISPLAY_NONE_SUBTREE;
}
}

View File

@ -1952,7 +1952,7 @@ nsStyleSet::ProbePseudoElementStyle(Element* aParentElement,
const nsStyleDisplay *display = result->StyleDisplay();
const nsStyleContent *content = result->StyleContent();
// XXXldb What is contentCount for |content: ""|?
if (display->mDisplay == StyleDisplay::None_ ||
if (display->mDisplay == StyleDisplay::None ||
content->ContentCount() == 0) {
result = nullptr;
}

View File

@ -2991,9 +2991,9 @@ nsStyleDisplay::nsStyleDisplay(StyleStructContext aContext)
, mContain(NS_STYLE_CONTAIN_NONE)
, mAppearance(NS_THEME_NONE)
, mPosition(NS_STYLE_POSITION_STATIC)
, mFloat(StyleFloat::None_)
, mOriginalFloat(StyleFloat::None_)
, mBreakType(StyleClear::None_)
, mFloat(StyleFloat::None)
, mOriginalFloat(StyleFloat::None)
, mBreakType(StyleClear::None)
, mBreakInside(NS_STYLE_PAGE_BREAK_AUTO)
, mBreakBefore(false)
, mBreakAfter(false)
@ -3117,7 +3117,7 @@ nsStyleDisplay::CalcDifference(const nsStyleDisplay& aNewData) const
|| mPosition != aNewData.mPosition
|| mDisplay != aNewData.mDisplay
|| mContain != aNewData.mContain
|| (mFloat == StyleFloat::None_) != (aNewData.mFloat == StyleFloat::None_)
|| (mFloat == StyleFloat::None) != (aNewData.mFloat == StyleFloat::None)
|| mOverflowX != aNewData.mOverflowX
|| mOverflowY != aNewData.mOverflowY
|| mScrollBehavior != aNewData.mScrollBehavior
@ -3902,7 +3902,7 @@ nsCursorImage::operator=(const nsCursorImage& aOther)
nsStyleUserInterface::nsStyleUserInterface(StyleStructContext aContext)
: mUserInput(NS_STYLE_USER_INPUT_AUTO)
, mUserModify(NS_STYLE_USER_MODIFY_READ_ONLY)
, mUserFocus(StyleUserFocus::None_)
, mUserFocus(StyleUserFocus::None)
, mPointerEvents(NS_STYLE_POINTER_EVENTS_AUTO)
, mCursor(NS_STYLE_CURSOR_AUTO)
, mCursorArrayLength(0)

View File

@ -37,6 +37,7 @@
#include "CounterStyleManager.h"
#include <cstddef> // offsetof()
#include <utility>
#include "X11UndefineNone.h"
class nsIFrame;
class nsIURI;
@ -2662,7 +2663,7 @@ struct StyleShapeSource
} else {
ReleaseRef();
mReferenceBox = ReferenceBox::NoBox;
mType = StyleShapeSourceType::None_;
mType = StyleShapeSourceType::None;
}
return *this;
}
@ -2776,7 +2777,7 @@ private:
StyleBasicShape* mBasicShape;
FragmentOrURL* mURL;
};
StyleShapeSourceType mType = StyleShapeSourceType::None_;
StyleShapeSourceType mType = StyleShapeSourceType::None;
ReferenceBox mReferenceBox = ReferenceBox::NoBox;
};
@ -2963,7 +2964,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleDisplay
}
bool IsFloatingStyle() const {
return mozilla::StyleFloat::None_ != mFloat;
return mozilla::StyleFloat::None != mFloat;
}
bool IsAbsolutelyPositionedStyle() const {
@ -3794,7 +3795,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVGReset
}
bool HasClipPath() const {
return mClipPath.GetType() != mozilla::StyleShapeSourceType::None_;
return mClipPath.GetType() != mozilla::StyleShapeSourceType::None;
}
bool HasNonScalingStroke() const {

View File

@ -118,7 +118,7 @@ mozilla::StyleDisplay
nsStyleDisplay::GetDisplay(const nsIFrame* aContextFrame) const
{
NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
if (aContextFrame->IsSVGText() && mDisplay != mozilla::StyleDisplay::None_) {
if (aContextFrame->IsSVGText() && mDisplay != mozilla::StyleDisplay::None) {
return aContextFrame->GetType() == nsGkAtoms::blockFrame ?
mozilla::StyleDisplay::Block : mozilla::StyleDisplay::Inline;
}

View File

@ -24,7 +24,7 @@ nsCSSClipPathInstance::ApplyBasicShapeClip(gfxContext& aContext,
{
auto& clipPathStyle = aFrame->StyleSVGReset()->mClipPath;
StyleShapeSourceType type = clipPathStyle.GetType();
MOZ_ASSERT(type != StyleShapeSourceType::None_, "unexpected none value");
MOZ_ASSERT(type != StyleShapeSourceType::None, "unexpected none value");
// In the future nsCSSClipPathInstance may handle <clipPath> references as
// well. For the time being return early.
if (type == StyleShapeSourceType::URL) {
@ -45,7 +45,7 @@ nsCSSClipPathInstance::HitTestBasicShapeClip(nsIFrame* aFrame,
{
auto& clipPathStyle = aFrame->StyleSVGReset()->mClipPath;
StyleShapeSourceType type = clipPathStyle.GetType();
MOZ_ASSERT(type != StyleShapeSourceType::None_, "unexpected none value");
MOZ_ASSERT(type != StyleShapeSourceType::None, "unexpected none value");
// In the future nsCSSClipPathInstance may handle <clipPath> references as
// well. For the time being return early.
if (type == StyleShapeSourceType::URL) {

View File

@ -1331,6 +1331,7 @@ int NrUdpSocketIpc::create(nr_transport_addr *addr) {
mon.Wait();
if (err_) {
close();
ABORT(R_INTERNAL);
}

View File

@ -510,19 +510,16 @@ NrIceCtx::GetNewPwd()
}
bool
NrIceCtx::Initialize(bool hide_non_default)
NrIceCtx::Initialize()
{
std::string ufrag = GetNewUfrag();
std::string pwd = GetNewPwd();
return Initialize(hide_non_default,
ufrag,
pwd);
return Initialize(ufrag, pwd);
}
bool
NrIceCtx::Initialize(bool hide_non_default,
const std::string& ufrag,
NrIceCtx::Initialize(const std::string& ufrag,
const std::string& pwd)
{
MOZ_ASSERT(!ufrag.empty());
@ -537,13 +534,20 @@ NrIceCtx::Initialize(bool hide_non_default,
UINT4 flags = offerer_ ? NR_ICE_CTX_FLAGS_OFFERER:
NR_ICE_CTX_FLAGS_ANSWERER;
flags |= NR_ICE_CTX_FLAGS_AGGRESSIVE_NOMINATION;
if (policy_ == ICE_POLICY_RELAY) {
flags |= NR_ICE_CTX_FLAGS_RELAY_ONLY;
switch (policy_) {
case ICE_POLICY_NONE:
MOZ_CRASH();
break;
case ICE_POLICY_RELAY:
flags |= NR_ICE_CTX_FLAGS_RELAY_ONLY;
break;
case ICE_POLICY_NO_HOST:
flags |= NR_ICE_CTX_FLAGS_HIDE_HOST_CANDIDATES;
break;
case ICE_POLICY_ALL:
break;
}
if (hide_non_default)
flags |= NR_ICE_CTX_FLAGS_ONLY_DEFAULT_ADDRS;
r = nr_ice_ctx_create_with_credentials(const_cast<char *>(name_.c_str()),
flags,
const_cast<char *>(ufrag.c_str()),
@ -831,12 +835,25 @@ abort:
return NS_OK;
}
nsresult NrIceCtx::StartGathering() {
nsresult NrIceCtx::StartGathering(bool default_route_only, bool proxy_only) {
ASSERT_ON_THREAD(sts_target_);
if (policy_ == ICE_POLICY_NONE) {
return NS_OK;
}
SetGatheringState(ICE_CTX_GATHER_STARTED);
if (default_route_only) {
nr_ice_ctx_add_flags(ctx_, NR_ICE_CTX_FLAGS_ONLY_DEFAULT_ADDRS);
} else {
nr_ice_ctx_remove_flags(ctx_, NR_ICE_CTX_FLAGS_ONLY_DEFAULT_ADDRS);
}
if (proxy_only) {
nr_ice_ctx_add_flags(ctx_, NR_ICE_CTX_FLAGS_ONLY_PROXY);
} else {
nr_ice_ctx_remove_flags(ctx_, NR_ICE_CTX_FLAGS_ONLY_PROXY);
}
// This might start gathering for the first time, or again after
// renegotiation, or might do nothing at all if gathering has already
// finished.

View File

@ -211,6 +211,7 @@ class NrIceCtx {
enum Policy { ICE_POLICY_NONE,
ICE_POLICY_RELAY,
ICE_POLICY_NO_HOST,
ICE_POLICY_ALL
};
@ -221,10 +222,8 @@ class NrIceCtx {
static std::string GetNewUfrag();
static std::string GetNewPwd();
bool Initialize(bool hide_non_default);
bool Initialize(bool hide_non_default,
const std::string& ufrag,
const std::string& pwd);
bool Initialize();
bool Initialize(const std::string& ufrag, const std::string& pwd);
int SetNat(const RefPtr<TestNat>& aNat);
@ -308,7 +307,7 @@ class NrIceCtx {
nsresult SetProxyServer(const NrIceProxyServer& proxy_server);
// Start ICE gathering
nsresult StartGathering();
nsresult StartGathering(bool default_route_only, bool proxy_only);
// Start checking
nsresult StartChecks();

View File

@ -32,7 +32,6 @@ NrIceCtxHandler::Create(const std::string& name,
bool allow_loopback,
bool tcp_enabled,
bool allow_link_local,
bool hide_non_default,
NrIceCtx::Policy policy)
{
// InitializeGlobals only executes once
@ -42,7 +41,7 @@ NrIceCtxHandler::Create(const std::string& name,
if (ctx == nullptr ||
ctx->current_ctx == nullptr ||
!ctx->current_ctx->Initialize(hide_non_default)) {
!ctx->current_ctx->Initialize()) {
return nullptr;
}
@ -62,18 +61,15 @@ NrIceCtxHandler::CreateStream(const std::string& name, int components)
RefPtr<NrIceCtx>
NrIceCtxHandler::CreateCtx(bool hide_non_default) const
NrIceCtxHandler::CreateCtx() const
{
return CreateCtx(NrIceCtx::GetNewUfrag(),
NrIceCtx::GetNewPwd(),
hide_non_default);
return CreateCtx(NrIceCtx::GetNewUfrag(), NrIceCtx::GetNewPwd());
}
RefPtr<NrIceCtx>
NrIceCtxHandler::CreateCtx(const std::string& ufrag,
const std::string& pwd,
bool hide_non_default) const
const std::string& pwd) const
{
RefPtr<NrIceCtx> new_ctx = new NrIceCtx(this->current_ctx->name(),
true, // offerer (hardcoded per bwc)
@ -82,7 +78,7 @@ NrIceCtxHandler::CreateCtx(const std::string& ufrag,
return nullptr;
}
if (!new_ctx->Initialize(hide_non_default, ufrag, pwd)) {
if (!new_ctx->Initialize(ufrag, pwd)) {
return nullptr;
}

View File

@ -13,7 +13,6 @@ public:
bool allow_loopback = false,
bool tcp_enabled = true,
bool allow_link_local = false,
bool hide_non_default = false,
NrIceCtx::Policy policy =
NrIceCtx::ICE_POLICY_ALL);
@ -21,10 +20,9 @@ public:
int components);
// CreateCtx is necessary so we can create and initialize the context
// on main thread, but begin the ice restart mechanics on STS thread
RefPtr<NrIceCtx> CreateCtx(bool hide_non_default = false) const; // for test
RefPtr<NrIceCtx> CreateCtx() const; // for test
RefPtr<NrIceCtx> CreateCtx(const std::string& ufrag,
const std::string& pwd,
bool hide_non_default) const;
const std::string& pwd) const;
RefPtr<NrIceCtx> ctx() { return current_ctx; }

View File

@ -185,7 +185,6 @@ const unsigned int ICE_TEST_PEER_OFFERER = (1 << 0);
const unsigned int ICE_TEST_PEER_ALLOW_LOOPBACK = (1 << 1);
const unsigned int ICE_TEST_PEER_ENABLED_TCP = (1 << 2);
const unsigned int ICE_TEST_PEER_ALLOW_LINK_LOCAL = (1 << 3);
const unsigned int ICE_TEST_PEER_HIDE_NON_DEFAULT = (1 << 4);
typedef std::string (*CandidateFilter)(const std::string& candidate);
@ -384,11 +383,12 @@ class IceTestPeer : public sigslot::has_slots<> {
IceTestPeer(const std::string& name, MtransportTestUtils* utils,
bool offerer,
bool allow_loopback = false, bool enable_tcp = true,
bool allow_link_local = false, bool hide_non_default = false) :
bool allow_link_local = false,
NrIceCtx::Policy ice_policy = NrIceCtx::ICE_POLICY_ALL) :
name_(name),
ice_ctx_(NrIceCtxHandler::Create(name, offerer, allow_loopback,
enable_tcp, allow_link_local,
hide_non_default)),
ice_policy)),
candidates_(),
shutting_down_(false),
gathering_complete_(false),
@ -533,11 +533,15 @@ class IceTestPeer : public sigslot::has_slots<> {
dns_resolver_->AllocateResolver())));
}
void Gather() {
void Gather(bool default_route_only = false) {
nsresult res;
test_utils_->sts_target()->Dispatch(
WrapRunnableRet(&res, ice_ctx_->ctx(), &NrIceCtx::StartGathering),
WrapRunnableRet(&res,
ice_ctx_->ctx(),
&NrIceCtx::StartGathering,
default_route_only,
false),
NS_DISPATCH_SYNC);
ASSERT_TRUE(NS_SUCCEEDED(res));
@ -1462,8 +1466,7 @@ class WebRtcIceGatherTest : public StunTest {
flags & ICE_TEST_PEER_OFFERER,
flags & ICE_TEST_PEER_ALLOW_LOOPBACK,
flags & ICE_TEST_PEER_ENABLED_TCP,
flags & ICE_TEST_PEER_ALLOW_LINK_LOCAL,
flags & ICE_TEST_PEER_HIDE_NON_DEFAULT);
flags & ICE_TEST_PEER_ALLOW_LINK_LOCAL);
peer_->AddStream(1);
}
}
@ -1637,16 +1640,16 @@ class WebRtcIceConnectTest : public StunTest {
void Init(bool allow_loopback,
bool enable_tcp,
bool default_only = false,
bool setup_stun_servers = true) {
bool setup_stun_servers = true,
NrIceCtx::Policy ice_policy = NrIceCtx::ICE_POLICY_ALL) {
if (initted_) {
return;
}
p1_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, allow_loopback,
enable_tcp, false, default_only);
enable_tcp, false, ice_policy);
p2_ = MakeUnique<IceTestPeer>("P2", test_utils_, false, allow_loopback,
enable_tcp, false, default_only);
enable_tcp, false, ice_policy);
InitPeer(p1_.get(), setup_stun_servers);
InitPeer(p2_.get(), setup_stun_servers);
@ -1679,17 +1682,22 @@ class WebRtcIceConnectTest : public StunTest {
}
}
bool Gather(unsigned int waitTime = kDefaultTimeout) {
bool Gather(unsigned int waitTime = kDefaultTimeout,
bool default_route_only = false) {
Init(false, false);
return GatherCallerAndCallee(p1_.get(), p2_.get(), waitTime);
return GatherCallerAndCallee(p1_.get(),
p2_.get(),
waitTime,
default_route_only);
}
bool GatherCallerAndCallee(IceTestPeer* caller,
IceTestPeer* callee,
unsigned int waitTime = kDefaultTimeout) {
caller->Gather();
callee->Gather();
unsigned int waitTime = kDefaultTimeout,
bool default_route_only = false) {
caller->Gather(default_route_only);
callee->Gather(default_route_only);
if (waitTime) {
EXPECT_TRUE_WAIT(caller->gathering_complete(), waitTime);
@ -2144,12 +2152,12 @@ TEST_F(WebRtcIceGatherTest, TestGatherFakeStunServerIpAddress) {
Gather();
}
TEST_F(WebRtcIceGatherTest, TestGatherStunServerIpAddressDefaultRouteOnly) {
TEST_F(WebRtcIceGatherTest, TestGatherStunServerIpAddressNoHost) {
if (stun_server_address_.empty()) {
return;
}
peer_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, false, false, false, true);
peer_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, false, false, false, NrIceCtx::ICE_POLICY_NO_HOST);
peer_->AddStream(1);
peer_->SetStunServer(stun_server_address_, kDefaultStunServerPort);
peer_->SetFakeResolver(stun_server_address_, stun_server_hostname_);
@ -2446,10 +2454,9 @@ TEST_F(WebRtcIceGatherTest, TestStunServerTrickle) {
ASSERT_TRUE(StreamHasMatchingCandidate(0, "192.0.2.1"));
}
// Test default route only with our fake STUN server and
// apparently NATted.
TEST_F(WebRtcIceGatherTest, TestFakeStunServerNatedDefaultRouteOnly) {
peer_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, false, false, false, true);
// Test no host with our fake STUN server and apparently NATted.
TEST_F(WebRtcIceGatherTest, TestFakeStunServerNatedNoHost) {
peer_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, false, false, false, NrIceCtx::ICE_POLICY_NO_HOST);
peer_->AddStream(1);
UseFakeStunUdpServerWithResponse("192.0.2.1", 3333);
Gather(0);
@ -2464,10 +2471,9 @@ TEST_F(WebRtcIceGatherTest, TestFakeStunServerNatedDefaultRouteOnly) {
}
}
// Test default route only with our fake STUN server and
// apparently non-NATted.
TEST_F(WebRtcIceGatherTest, TestFakeStunServerNoNatDefaultRouteOnly) {
peer_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, false, false, false, true);
// Test no host with our fake STUN server and apparently non-NATted.
TEST_F(WebRtcIceGatherTest, TestFakeStunServerNoNatNoHost) {
peer_ = MakeUnique<IceTestPeer>("P1", test_utils_, true, false, false, false, NrIceCtx::ICE_POLICY_NO_HOST);
peer_->AddStream(1);
UseTestStunServer();
Gather(0);
@ -2558,8 +2564,7 @@ TEST_F(WebRtcIceConnectTest, TestConnectRestartIce) {
SendReceive(p1_.get(), p2_.get());
mozilla::UniquePtr<IceTestPeer> p3_;
p3_ = MakeUnique<IceTestPeer>("P3", test_utils_, true, false,
false, false, false);
p3_ = MakeUnique<IceTestPeer>("P3", test_utils_, true, false, false, false);
InitPeer(p3_.get());
p3_->AddStream(1);
@ -2591,8 +2596,7 @@ TEST_F(WebRtcIceConnectTest, TestConnectRestartIceThenAbort) {
SendReceive(p1_.get(), p2_.get());
mozilla::UniquePtr<IceTestPeer> p3_;
p3_ = MakeUnique<IceTestPeer>("P3", test_utils_, true, false,
false, false, false);
p3_ = MakeUnique<IceTestPeer>("P3", test_utils_, true, false, false, false);
InitPeer(p3_.get());
p3_->AddStream(1);
@ -2633,8 +2637,7 @@ TEST_F(WebRtcIceConnectTest, TestConnectSetControllingAfterIceRestart) {
ASSERT_EQ(NrIceCtx::ICE_CONTROLLED, p2_->GetControlling());
mozilla::UniquePtr<IceTestPeer> p3_;
p3_ = MakeUnique<IceTestPeer>("P3", test_utils_, true, false,
false, false, false);
p3_ = MakeUnique<IceTestPeer>("P3", test_utils_, true, false, false, false);
InitPeer(p3_.get());
p3_->AddStream(1);
// Set control role for p3 accordingly (w/o role conflict)
@ -2682,8 +2685,8 @@ TEST_F(WebRtcIceConnectTest, DISABLED_TestConnectTcpSo) {
}
// Disabled because this breaks with hairpinning.
TEST_F(WebRtcIceConnectTest, DISABLED_TestConnectDefaultRouteOnly) {
Init(false, false, true);
TEST_F(WebRtcIceConnectTest, DISABLED_TestConnectNoHost) {
Init(false, false, false, NrIceCtx::ICE_POLICY_NO_HOST);
AddStream(1);
ASSERT_TRUE(Gather());
SetExpectedTypes(NrIceCandidate::Type::ICE_SERVER_REFLEXIVE,
@ -2692,7 +2695,7 @@ TEST_F(WebRtcIceConnectTest, DISABLED_TestConnectDefaultRouteOnly) {
}
TEST_F(WebRtcIceConnectTest, TestLoopbackOnlySortOf) {
Init(true, false, false, false);
Init(true, false, false);
AddStream(1);
SetCandidateFilter(IsLoopbackCandidate);
ASSERT_TRUE(Gather());
@ -2789,8 +2792,8 @@ TEST_F(WebRtcIceConnectTest, TestConnectFullCone) {
Connect();
}
TEST_F(WebRtcIceConnectTest, TestConnectNoNatRouteOnly) {
Init(false, false, true, false);
TEST_F(WebRtcIceConnectTest, TestConnectNoNatNoHost) {
Init(false, false, false, NrIceCtx::ICE_POLICY_NO_HOST);
AddStream(1);
UseTestStunServer();
// Because we are connecting from our host candidate to the
@ -2802,10 +2805,11 @@ TEST_F(WebRtcIceConnectTest, TestConnectNoNatRouteOnly) {
Connect();
}
TEST_F(WebRtcIceConnectTest, TestConnectFullConeDefaultRouteOnly) {
TEST_F(WebRtcIceConnectTest, TestConnectFullConeNoHost) {
UseNat();
Init(false, false, true);
Init(false, false, false, NrIceCtx::ICE_POLICY_NO_HOST);
AddStream(1);
UseTestStunServer();
SetExpectedTypes(NrIceCandidate::Type::ICE_SERVER_REFLEXIVE,
NrIceCandidate::Type::ICE_SERVER_REFLEXIVE);
ASSERT_TRUE(Gather());
@ -3527,7 +3531,7 @@ TEST_F(WebRtcIceConnectTest, TestPollCandPairsAfterConnect) {
// TODO Bug 1259842 - disabled until we find a better way to handle two
// candidates from different RFC1918 ranges
TEST_F(WebRtcIceConnectTest, DISABLED_TestHostCandPairingFilter) {
Init(false, false, false, false);
Init(false, false, false);
AddStream(1);
ASSERT_TRUE(Gather());
SetCandidateFilter(IsIpv4Candidate);
@ -3561,7 +3565,7 @@ TEST_F(WebRtcIceConnectTest, DISABLED_TestSrflxCandPairingFilter) {
return;
}
Init(false, false, false, false);
Init(false, false, false);
AddStream(1);
ASSERT_TRUE(Gather());
SetCandidateFilter(IsSrflxCandidate);

View File

@ -640,7 +640,11 @@ class TransportTestPeer : public sigslot::has_slots<> {
// Start gathering
test_utils_->sts_target()->Dispatch(
WrapRunnableRet(&res, ice_ctx_->ctx(), &NrIceCtx::StartGathering),
WrapRunnableRet(&res,
ice_ctx_->ctx(),
&NrIceCtx::StartGathering,
false,
false),
NS_DISPATCH_SYNC);
ASSERT_TRUE(NS_SUCCEEDED(res));
}
@ -1208,7 +1212,7 @@ TEST_F(TransportTest, TestTransferIceMaxSize) {
* of 9216 bytes, which then results in the DTLS layer discarding the packet.
* Therefore we leave some headroom (according to
* https://bugzilla.mozilla.org/show_bug.cgi?id=1214269#c29 256 bytes should
* be save choice) here for the DTLS bytes to make it safely into the
* be save choice) here for the DTLS bytes to make it safely into the
* receiving buffer in nICEr. */
TransferTest(1, 8960);
}

View File

@ -936,7 +936,7 @@ int nr_ice_format_candidate_attribute(nr_ice_candidate *cand, char *attr, int ma
/* raddr, rport */
raddr = (cand->stream->ctx->flags &
(NR_ICE_CTX_FLAGS_RELAY_ONLY |
NR_ICE_CTX_FLAGS_ONLY_DEFAULT_ADDRS)) ?
NR_ICE_CTX_FLAGS_HIDE_HOST_CANDIDATES)) ?
&cand->addr : &cand->base;
switch(cand->type){

View File

@ -207,6 +207,11 @@ static int nr_ice_component_initialize_udp(struct nr_ice_ctx_ *ctx,nr_ice_compon
int j;
int r,_status;
if(ctx->flags & NR_ICE_CTX_FLAGS_ONLY_PROXY) {
/* No UDP support if we must use a proxy */
return 0;
}
/* Now one ice_socket for each address */
for(i=0;i<addr_ct;i++){
char suppress;
@ -429,8 +434,9 @@ static int nr_ice_component_initialize_tcp(struct nr_ice_ctx_ *ctx,nr_ice_compon
if (r != R_NOT_FOUND)
ABORT(r);
}
if (ctx->flags & NR_ICE_CTX_FLAGS_RELAY_ONLY) {
r_log(LOG_ICE,LOG_WARNING,"ICE(%s): relay only option results in ICE TCP being disabled",ctx->label);
if ((ctx->flags & NR_ICE_CTX_FLAGS_RELAY_ONLY) ||
(ctx->flags & NR_ICE_CTX_FLAGS_ONLY_PROXY)) {
r_log(LOG_ICE,LOG_WARNING,"ICE(%s): relay/proxy only option results in ICE TCP being disabled",ctx->label);
ice_tcp_disabled = 1;
}
@ -693,7 +699,7 @@ int nr_ice_component_maybe_prune_candidate(nr_ice_ctx *ctx, nr_ice_component *co
!nr_transport_addr_cmp(&c1->addr,&c2->addr,NR_TRANSPORT_ADDR_CMP_MODE_ALL)){
if((c1->type == c2->type) ||
(!(ctx->flags & NR_ICE_CTX_FLAGS_ONLY_DEFAULT_ADDRS) &&
(!(ctx->flags & NR_ICE_CTX_FLAGS_HIDE_HOST_CANDIDATES) &&
((c1->type==HOST && c2->type == SERVER_REFLEXIVE) ||
(c2->type==HOST && c1->type == SERVER_REFLEXIVE)))){
@ -1089,6 +1095,12 @@ int nr_ice_component_pair_candidates(nr_ice_peer_ctx *pctx, nr_ice_component *lc
/* Create the candidate pairs */
lcand=TAILQ_FIRST(&lcomp->candidates);
if (!lcand) {
/* No local candidates, initialized or not! */
ABORT(R_FAILED);
}
while(lcand){
if (lcand->state == NR_ICE_CAND_STATE_INITIALIZED) {
if ((r = nr_ice_component_pair_candidate(pctx, pcomp, lcand, 0)))

View File

@ -514,6 +514,16 @@ static void nr_ice_ctx_destroy_cb(NR_SOCKET s, int how, void *cb_arg)
RFREE(ctx);
}
void nr_ice_ctx_add_flags(nr_ice_ctx *ctx, UINT4 flags)
{
ctx->flags |= flags;
}
void nr_ice_ctx_remove_flags(nr_ice_ctx *ctx, UINT4 flags)
{
ctx->flags &= ~flags;
}
int nr_ice_ctx_destroy(nr_ice_ctx **ctxp)
{
if(!ctxp || !*ctxp)
@ -992,7 +1002,7 @@ int nr_ice_ctx_hide_candidate(nr_ice_ctx *ctx, nr_ice_candidate *cand)
return 1;
}
if (ctx->flags & NR_ICE_CTX_FLAGS_ONLY_DEFAULT_ADDRS) {
if (ctx->flags & NR_ICE_CTX_FLAGS_HIDE_HOST_CANDIDATES) {
if (cand->type == HOST)
return 1;
}

View File

@ -163,8 +163,12 @@ int nr_ice_ctx_create_with_credentials(char *label, UINT4 flags, char* ufrag, ch
#define NR_ICE_CTX_FLAGS_AGGRESSIVE_NOMINATION (1<<2)
#define NR_ICE_CTX_FLAGS_LITE (1<<3)
#define NR_ICE_CTX_FLAGS_RELAY_ONLY (1<<4)
#define NR_ICE_CTX_FLAGS_ONLY_DEFAULT_ADDRS (1<<5)
#define NR_ICE_CTX_FLAGS_HIDE_HOST_CANDIDATES (1<<5)
#define NR_ICE_CTX_FLAGS_ONLY_DEFAULT_ADDRS (1<<6)
#define NR_ICE_CTX_FLAGS_ONLY_PROXY (1<<7)
void nr_ice_ctx_add_flags(nr_ice_ctx *ctx, UINT4 flags);
void nr_ice_ctx_remove_flags(nr_ice_ctx *ctx, UINT4 flags);
int nr_ice_ctx_destroy(nr_ice_ctx **ctxp);
int nr_ice_gather(nr_ice_ctx *ctx, NR_async_cb done_cb, void *cb_arg);
int nr_ice_add_candidate(nr_ice_ctx *ctx, nr_ice_candidate *cand);

View File

@ -482,7 +482,11 @@ PeerConnectionConfiguration::Init(const RTCConfiguration& aSrc)
setIceTransportPolicy(NrIceCtx::ICE_POLICY_RELAY);
break;
case dom::RTCIceTransportPolicy::All:
setIceTransportPolicy(NrIceCtx::ICE_POLICY_ALL);
if (Preferences::GetBool("media.peerconnection.ice.no_host", false)) {
setIceTransportPolicy(NrIceCtx::ICE_POLICY_NO_HOST);
} else {
setIceTransportPolicy(NrIceCtx::ICE_POLICY_ALL);
}
break;
default:
MOZ_CRASH();

View File

@ -57,6 +57,7 @@
#include "MediaStreamTrack.h"
#include "VideoStreamTrack.h"
#include "MediaStreamError.h"
#include "MediaManager.h"
#endif
@ -362,7 +363,6 @@ nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_serv
#else
bool ice_tcp = false;
#endif
bool default_address_only = GetPrefDefaultAddressOnly();
// TODO(ekr@rtfm.com): need some way to set not offerer later
// Looks like a bug in the NrIceCtx API.
@ -371,7 +371,6 @@ nsresult PeerConnectionMedia::Init(const std::vector<NrIceStunServer>& stun_serv
mParent->GetAllowIceLoopback(),
ice_tcp,
mParent->GetAllowIceLinkLocal(),
default_address_only,
policy);
if(!mIceCtxHdlr) {
CSFLogError(logTag, "%s: Failed to create Ice Context", __FUNCTION__);
@ -661,10 +660,7 @@ PeerConnectionMedia::BeginIceRestart(const std::string& ufrag,
return;
}
bool default_address_only = GetPrefDefaultAddressOnly();
RefPtr<NrIceCtx> new_ctx = mIceCtxHdlr->CreateCtx(ufrag,
pwd,
default_address_only);
RefPtr<NrIceCtx> new_ctx = mIceCtxHdlr->CreateCtx(ufrag, pwd);
RUN_ON_THREAD(GetSTSThread(),
WrapRunnable(
@ -782,14 +778,30 @@ PeerConnectionMedia::GetPrefDefaultAddressOnly() const
ASSERT_ON_THREAD(mMainThread); // will crash on STS thread
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
uint64_t winId = mParent->GetWindow()->WindowID();
bool default_address_only = Preferences::GetBool(
"media.peerconnection.ice.default_address_only", false);
default_address_only |=
!MediaManager::Get()->IsActivelyCapturingOrHasAPermission(winId);
#else
bool default_address_only = false;
bool default_address_only = true;
#endif
return default_address_only;
}
bool
PeerConnectionMedia::GetPrefProxyOnly() const
{
ASSERT_ON_THREAD(mMainThread); // will crash on STS thread
#if !defined(MOZILLA_EXTERNAL_LINKAGE)
return Preferences::GetBool("media.peerconnection.ice.proxy_only", false);
#else
return false;
#endif
}
void
PeerConnectionMedia::ConnectSignals(NrIceCtx *aCtx, NrIceCtx *aOldCtx)
{
@ -886,21 +898,28 @@ PeerConnectionMedia::GatherIfReady() {
nsCOMPtr<nsIRunnable> runnable(WrapRunnable(
RefPtr<PeerConnectionMedia>(this),
&PeerConnectionMedia::EnsureIceGathering_s));
&PeerConnectionMedia::EnsureIceGathering_s,
GetPrefDefaultAddressOnly(),
GetPrefProxyOnly()));
PerformOrEnqueueIceCtxOperation(runnable);
}
void
PeerConnectionMedia::EnsureIceGathering_s() {
PeerConnectionMedia::EnsureIceGathering_s(bool aDefaultRouteOnly,
bool aProxyOnly) {
if (mProxyServer) {
mIceCtxHdlr->ctx()->SetProxyServer(*mProxyServer);
} else if (aProxyOnly) {
IceGatheringStateChange_s(mIceCtxHdlr->ctx().get(),
NrIceCtx::ICE_CTX_GATHER_COMPLETE);
return;
}
// Start gathering, but only if there are streams
for (size_t i = 0; i < mIceCtxHdlr->ctx()->GetStreamCount(); ++i) {
if (mIceCtxHdlr->ctx()->GetStream(i)) {
mIceCtxHdlr->ctx()->StartGathering();
mIceCtxHdlr->ctx()->StartGathering(aDefaultRouteOnly, aProxyOnly);
return;
}
}

View File

@ -474,7 +474,7 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
void GatherIfReady();
void FlushIceCtxOperationQueueIfReady();
void PerformOrEnqueueIceCtxOperation(nsIRunnable* runnable);
void EnsureIceGathering_s();
void EnsureIceGathering_s(bool aDefaultRouteOnly, bool aProxyOnly);
void StartIceChecks_s(bool aIsControlling,
bool aIsIceLite,
const std::vector<std::string>& aIceOptionsList);
@ -483,6 +483,7 @@ class PeerConnectionMedia : public sigslot::has_slots<> {
void FinalizeIceRestart_s();
void RollbackIceRestart_s();
bool GetPrefDefaultAddressOnly() const;
bool GetPrefProxyOnly() const;
void ConnectSignals(NrIceCtx *aCtx, NrIceCtx *aOldCtx=nullptr);

View File

@ -471,7 +471,9 @@ pref("media.peerconnection.identity.enabled", true);
pref("media.peerconnection.identity.timeout", 10000);
pref("media.peerconnection.ice.stun_client_maximum_transmits", 7);
pref("media.peerconnection.ice.trickle_grace_period", 5000);
pref("media.peerconnection.ice.no_host", false);
pref("media.peerconnection.ice.default_address_only", false);
pref("media.peerconnection.ice.proxy_only", false);
// These values (aec, agc, and noice) are from media/webrtc/trunk/webrtc/common_types.h
// kXxxUnchanged = 0, kXxxDefault = 1, and higher values are specific to each

View File

@ -118,6 +118,7 @@ GCC_PLATFORM_DARWIN = {
GCC_PLATFORM_WIN = {
'_WIN32': 1,
'WINNT': 1,
}
GCC_PLATFORM_X86_LINUX = FakeCompiler(GCC_PLATFORM_X86, GCC_PLATFORM_LINUX)

View File

@ -24,7 +24,11 @@ from mozpack import path as mozpath
class CompilerPreprocessor(Preprocessor):
VARSUBST = re.compile('(?P<VAR>\w+)', re.U)
# The C preprocessor only expands macros when they are not in C strings.
# For now, we don't look very hard for C strings because they don't matter
# that much for our unit tests, but we at least avoid expanding in the
# simple "FOO" case.
VARSUBST = re.compile('(?<!")(?P<VAR>\w+)(?!")', re.U)
NON_WHITESPACE = re.compile('\S')
HAS_FEATURE = re.compile('(__has_feature)\(([^\)]*)\)')
@ -84,13 +88,14 @@ class TestCompilerPreprocessor(unittest.TestCase):
'A': 1,
'B': '2',
'C': 'c',
'D': 'd'
})
pp.out = StringIO()
input = StringIO('A.B.C')
input = StringIO('A.B.C "D"')
input.name = 'foo'
pp.do_include(input)
self.assertEquals(pp.out.getvalue(), '1 . 2 . c')
self.assertEquals(pp.out.getvalue(), '1 . 2 . c "D"')
def test_condition(self):
pp = CompilerPreprocessor({

View File

@ -49,5 +49,5 @@ class TestSSLDisabledErrorPage(FirefoxTestCase):
reset_button.click()
# With the preferences reset, the page has to load correctly
Wait(self.marionette).until(expected.element_present(By.LINK_TEXT,
'http://quality.mozilla.org'))
Wait(self.marionette, timeout=self.browser.timeout_page_load).until(
expected.element_present(By.LINK_TEXT, 'http://quality.mozilla.org'))

View File

@ -55,7 +55,7 @@ class TestSetWindowSize(MarionetteTestCase):
"New height is %s but should be %s" % (size['height'], height))
def test_possible_to_request_window_larger_than_screen(self):
self.marionette.set_window_size(100000, 100000)
self.marionette.set_window_size(4 * self.max_width, 4 * self.max_height)
size = self.marionette.window_size
# In X the window size may be greater than the bounds of the screen

View File

@ -516,7 +516,19 @@ class BaseConfig(object):
self.volatile_config[key] = self._config[key]
del(self._config[key])
"""Actions.
self.update_actions()
if options.list_actions:
self.list_actions()
# Keep? This is for saving the volatile config in the dump_config
self._config['volatile_config'] = self.volatile_config
self.options = options
self.args = args
return (self.options, self.args)
def update_actions(self):
""" Update actions after reading in config.
Seems a little complex, but the logic goes:
@ -538,8 +550,6 @@ class BaseConfig(object):
default_actions = self.verify_actions(self._config['default_actions'])
self.default_actions = default_actions
self.verify_actions_order(self.default_actions)
if options.list_actions:
self.list_actions()
self.actions = self.default_actions[:]
if self.volatile_config['actions']:
actions = self.verify_actions(self.volatile_config['actions'])
@ -553,13 +563,6 @@ class BaseConfig(object):
if action in self.actions:
self.actions.remove(action)
# Keep? This is for saving the volatile config in the dump_config
self._config['volatile_config'] = self.volatile_config
self.options = options
self.args = args
return (self.options, self.args)
# __main__ {{{1
if __name__ == '__main__':

View File

@ -366,7 +366,8 @@ class BuildOptionParser(object):
'android-test': 'builds/releng_sub_%s_configs/%s_test.py',
'android-checkstyle': 'builds/releng_sub_%s_configs/%s_checkstyle.py',
'android-lint': 'builds/releng_sub_%s_configs/%s_lint.py',
'valgrind' : 'builds/releng_sub_%s_configs/%s_valgrind.py'
'valgrind' : 'builds/releng_sub_%s_configs/%s_valgrind.py',
'artifact': 'builds/releng_sub_%s_configs/%s_artifact.py',
}
build_pool_cfg_file = 'builds/build_pool_specifics.py'
branch_cfg_file = 'builds/branch_specifics.py'
@ -422,13 +423,7 @@ class BuildOptionParser(object):
return cls.bits, cls.platform
@classmethod
def set_build_variant(cls, option, opt, value, parser):
""" sets an extra config file.
This is done by either taking an existing filepath or by taking a valid
shortname coupled with known platform/bits.
"""
def find_variant_cfg_path(cls, opt, value, parser):
valid_variant_cfg_path = None
# first let's see if we were given a valid short-name
if cls.build_variants.get(value):
@ -451,6 +446,17 @@ class BuildOptionParser(object):
valid_variant_cfg_path = os.path.join(path,
prospective_cfg_path)
break
return valid_variant_cfg_path, prospective_cfg_path
@classmethod
def set_build_variant(cls, option, opt, value, parser):
""" sets an extra config file.
This is done by either taking an existing filepath or by taking a valid
shortname coupled with known platform/bits.
"""
valid_variant_cfg_path, prospective_cfg_path = cls.find_variant_cfg_path(
'--custom-build-variant-cfg', value, parser)
if not valid_variant_cfg_path:
# either the value was an indeterminable path or an invalid short
@ -880,6 +886,11 @@ or run without that action (ie: --no-{action})"
env['MOZ_SIGN_CMD'] = moz_sign_cmd.replace('\\', '\\\\\\\\')
else:
self.warning("signing disabled because MOZ_SIGNING_SERVERS is not set")
elif 'MOZ_SIGN_CMD' in env:
# Ensure that signing is truly disabled
# MOZ_SIGN_CMD may be defined by default in buildbot (see MozillaBuildFactory)
self.warning("Clearing MOZ_SIGN_CMD because we don't have config['enable_signing']")
del env['MOZ_SIGN_CMD']
# to activate the right behaviour in mozonfigs while we transition
if c.get('enable_release_promotion'):

View File

@ -78,17 +78,32 @@ class TryToolsMixin(TransferMixin):
msg = None
if "try_message" in self.config and self.config["try_message"]:
msg = self.config["try_message"]
else:
elif self._is_try():
if self.buildbot_config['sourcestamp']['changes']:
msg = self.buildbot_config['sourcestamp']['changes'][-1]['comments']
if msg is None or len(msg) == 1024:
# This commit message was potentially truncated, get the full message
# This commit message was potentially truncated or not available in
# buildbot_config (e.g. if running in TaskCluster), get the full message
# from hg.
props = self.buildbot_config['properties']
rev = props['revision']
repo = props['repo_path']
url = 'https://hg.mozilla.org/%s/json-pushes?changeset=%s&full=1' % (repo, rev)
repo_url = 'https://hg.mozilla.org/%s/'
if 'revision' in props and 'repo_path' in props:
rev = props['revision']
repo_path = props['repo_path']
else:
# In TaskCluster we have no buildbot props, rely on env vars instead
rev = os.environ.get('GECKO_HEAD_REV')
repo_path = self.config.get('branch')
if repo_path:
repo_url = repo_url % repo_path
else:
repo_url = os.environ.get('GECKO_HEAD_REPOSITORY',
repo_url % 'try')
if not repo_url.endswith('/'):
repo_url += '/'
url = '{}json-pushes?changeset={}&full=1'.format(repo_url, rev)
pushinfo = self.load_json_from_url(url)
for k, v in pushinfo.items():
@ -99,24 +114,14 @@ class TryToolsMixin(TransferMixin):
# If we don't find try syntax in the usual place, check for it in an
# alternate property available to tools using self-serve.
msg = self.buildbot_config['properties']['try_syntax']
if not msg:
self.warning('Try message not found.')
return msg
@PostScriptAction('download-and-extract')
def set_extra_try_arguments(self, action, success=None):
"""Finds a commit message and parses it for extra arguments to pass to the test
harness command line and test paths used to filter manifests.
Extracting arguments from a commit message taken directly from the try_parser.
"""
if (not self.buildbot_config or 'properties' not in self.buildbot_config or
self.buildbot_config['properties'].get('branch') != 'try'):
return
msg = self._extract_try_message()
def _extract_try_args(self, msg):
""" Returns a list of args from a try message, for parsing """
if not msg:
return
return None
all_try_args = None
for line in msg.splitlines():
if 'try: ' in line:
@ -128,12 +133,46 @@ class TryToolsMixin(TransferMixin):
try_message = line.strip().split('try: ', 1)
all_try_args = re.findall(r'(?:\[.*?\]|\S)+', try_message[1])
break
if not all_try_args:
self.warning('Try syntax not found in buildbot config, unable to append '
'arguments from try.')
self.warning('Try syntax not found in: %s.' % msg )
return all_try_args
def try_message_has_flag(self, flag, message=None):
"""
Returns True if --`flag` is present in message.
"""
parser = argparse.ArgumentParser()
parser.add_argument('--' + flag, action='store_true')
message = message or self._extract_try_message()
if not message:
return False
msg_list = self._extract_try_args(message)
args, _ = parser.parse_known_args(msg_list)
return getattr(args, flag, False)
def _is_try(self):
repo_path = None
if self.buildbot_config and 'properties' in self.buildbot_config:
repo_path = self.buildbot_config['properties'].get('branch')
return self.config.get('branch', repo_path) == 'try'
@PostScriptAction('download-and-extract')
def set_extra_try_arguments(self, action, success=None):
"""Finds a commit message and parses it for extra arguments to pass to the test
harness command line and test paths used to filter manifests.
Extracting arguments from a commit message taken directly from the try_parser.
"""
if not self._is_try():
return
msg = self._extract_try_message()
if not msg:
return
all_try_args = self._extract_try_args(msg)
if not all_try_args:
return
parser = argparse.ArgumentParser(
description=('Parse an additional subset of arguments passed to try syntax'

View File

@ -13,6 +13,8 @@ author: Jordan Lund
"""
import copy
import pprint
import sys
import os
@ -20,13 +22,15 @@ import os
sys.path.insert(1, os.path.dirname(sys.path[0]))
from mozharness.mozilla.building.buildbase import BUILD_BASE_CONFIG_OPTIONS, \
BuildingConfig, BuildScript
BuildingConfig, BuildOptionParser, BuildScript
from mozharness.base.config import parse_config_file
from mozharness.mozilla.testing.try_tools import TryToolsMixin, try_config_options
class FxDesktopBuild(BuildScript, object):
class FxDesktopBuild(BuildScript, TryToolsMixin, object):
def __init__(self):
buildscript_kwargs = {
'config_options': BUILD_BASE_CONFIG_OPTIONS,
'config_options': BUILD_BASE_CONFIG_OPTIONS + copy.deepcopy(try_config_options),
'all_actions': [
'get-secrets',
'clobber',
@ -120,8 +124,44 @@ class FxDesktopBuild(BuildScript, object):
else:
self.fatal("'stage_platform' not determined and is required in your config")
if self.try_message_has_flag('artifact'):
self.info('Artifact build requested in try syntax.')
self._update_build_variant(rw_config)
# helpers
def _update_build_variant(self, rw_config, variant='artifact'):
""" Intended for use in _pre_config_lock """
c = self.config
variant_cfg_path, _ = BuildOptionParser.find_variant_cfg_path(
'--custom-build-variant-cfg',
variant,
rw_config.config_parser
)
if not variant_cfg_path:
self.fatal('Could not find appropriate config file for variant %s' % variant)
# Update other parts of config to keep dump-config accurate
# Only dump-config is affected because most config info is set during
# initial parsing
variant_cfg_dict = parse_config_file(variant_cfg_path)
rw_config.all_cfg_files_and_dicts.append((variant_cfg_path, variant_cfg_dict))
c.update({
'build_variant': variant,
'config_files': c['config_files'] + [variant_cfg_path]
})
self.info("Updating self.config with the following from {}:".format(variant_cfg_path))
self.info(pprint.pformat(variant_cfg_dict))
c.update(variant_cfg_dict)
# Bug 1231320 adds MOZHARNESS_ACTIONS in TaskCluster tasks to override default_actions
# We don't want that when forcing an artifact build.
self.info("Clearing actions from volatile_config to use default_actions.")
rw_config.volatile_config['actions'] = None
# replace rw_config as well to set actions as in BaseScript
rw_config.set_config(c, overwrite=True)
rw_config.update_actions()
self.actions = tuple(rw_config.actions)
self.all_actions = tuple(rw_config.all_actions)
def query_abs_dirs(self):
if self.abs_dirs:
@ -163,6 +203,9 @@ class FxDesktopBuild(BuildScript, object):
# reset_mock in BuildingMixing -> MockMixin
# setup_mock in BuildingMixing (overrides MockMixin.mock_setup)
def set_extra_try_arguments(self, action, success=None):
""" Override unneeded method from TryToolsMixin """
pass
if __name__ == '__main__':
fx_desktop_build = FxDesktopBuild()

View File

@ -182,6 +182,10 @@ ifndef EN_US_BINARY_URL
EN_US_BINARY_URL = $(error You must set EN_US_BINARY_URL)
endif
# Allow the overriding of PACKAGE format so we can get an EN_US build with a different
# PACKAGE format than we are creating l10n packages with.
EN_US_PACKAGE_NAME ?= $(PACKAGE)
# This make target allows us to wget the latest en-US binary from a specified website
# The make installers-% target needs the en-US binary in dist/
# and for the windows repackages we need the .installer.exe in dist/sea
@ -190,12 +194,14 @@ ifndef WGET
$(error Wget not installed)
endif
$(NSINSTALL) -D $(ABS_DIST)/$(PKG_PATH)
(cd $(ABS_DIST)/$(PKG_PATH) && $(WGET) --no-cache -nv --no-iri -N '$(EN_US_BINARY_URL)/$(PACKAGE)')
@echo 'Downloaded $(EN_US_BINARY_URL)/$(PACKAGE) to $(ABS_DIST)/$(PKG_PATH)/$(PACKAGE)'
(cd $(ABS_DIST)/$(PKG_PATH) && \
$(WGET) --no-cache -nv --no-iri -N -O $(PACKAGE) '$(EN_US_BINARY_URL)/$(EN_US_PACKAGE_NAME)')
@echo 'Downloaded $(EN_US_BINARY_URL)/$(EN_US_PACKAGE_NAME) to $(ABS_DIST)/$(PKG_PATH)/$(PACKAGE)'
ifdef RETRIEVE_WINDOWS_INSTALLER
ifeq ($(OS_ARCH), WINNT)
$(NSINSTALL) -D $(ABS_DIST)/$(PKG_INST_PATH)
(cd $(ABS_DIST)/$(PKG_INST_PATH) && $(WGET) --no-cache -nv --no-iri -N '$(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe')
(cd $(ABS_DIST)/$(PKG_INST_PATH) && \
$(WGET) --no-cache -nv --no-iri -N '$(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe')
@echo 'Downloaded $(EN_US_BINARY_URL)/$(PKG_PATH)$(PKG_INST_BASENAME).exe to $(ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe'
endif
endif

View File

@ -88,6 +88,7 @@ const kModalOutlineAnim = {
],
duration: 50,
};
const kNSHTML = "http://www.w3.org/1999/xhtml";
function mockAnonymousContentNode(domNode) {
return {
@ -901,14 +902,14 @@ FinderHighlighter.prototype = {
// The outline needs to be sitting inside a container, otherwise the anonymous
// content API won't find it by its ID later...
let container = document.createElement("div");
let container = document.createElementNS(kNSHTML, "div");
// Create the main (yellow) highlight outline box.
let outlineBox = document.createElement("div");
let outlineBox = document.createElementNS(kNSHTML, "div");
outlineBox.setAttribute("id", kModalOutlineId);
outlineBox.setAttribute("style", this._getStyleString(kModalStyles.outlineNode,
kDebug ? kModalStyles.outlineNodeDebug : []));
let outlineBoxText = document.createElement("span");
let outlineBoxText = document.createElementNS(kNSHTML, "span");
let attrValue = kModalOutlineId + "-text";
outlineBoxText.setAttribute("id", attrValue);
outlineBoxText.setAttribute("style", this._getStyleString(kModalStyles.outlineText));
@ -916,7 +917,7 @@ FinderHighlighter.prototype = {
container.appendChild(outlineBox);
dict.modalHighlightOutline = kDebug ?
mockAnonymousContentNode(document.body.appendChild(container.firstChild)) :
mockAnonymousContentNode((document.body || document.documentElement).appendChild(container.firstChild)) :
document.insertAnonymousContent(container);
// Make sure to at least show the dimmed background.
@ -937,7 +938,7 @@ FinderHighlighter.prototype = {
let document = window.document;
const kMaskId = kModalIdPrefix + "-findbar-modalHighlight-outlineMask";
let maskNode = document.createElement("div");
let maskNode = document.createElementNS(kNSHTML, "div");
// Make sure the dimmed mask node takes the full width and height that's available.
let {width, height} = dict.lastWindowDimensions = this._getWindowDimensions(window);
@ -960,7 +961,7 @@ FinderHighlighter.prototype = {
if (dict.updateAllRanges)
rects = this._updateRangeRects(range);
for (let rect of rects) {
maskContent.push(`<div style="${rectStyle}; top: ${rect.y}px;
maskContent.push(`<div xmlns="${kNSHTML}" style="${rectStyle}; top: ${rect.y}px;
left: ${rect.x}px; height: ${rect.height}px; width: ${rect.width}px;"></div>`);
}
}
@ -973,7 +974,7 @@ FinderHighlighter.prototype = {
this._removeHighlightAllMask(window);
dict.modalHighlightAllMask = kDebug ?
mockAnonymousContentNode(document.body.appendChild(maskNode)) :
mockAnonymousContentNode((document.body || document.documentElement).appendChild(maskNode)) :
document.insertAnonymousContent(maskNode);
},

View File

@ -37,6 +37,7 @@
#include "nsIWidgetListener.h"
#include "nsIGfxInfo.h"
#include "npapi.h"
#include "X11UndefineNone.h"
#include "base/thread.h"
#include "prdtoa.h"
#include "prenv.h"

View File

@ -931,15 +931,20 @@ GfxInfo::GetGfxDriverInfo()
GfxDriverInfo::allFeatures, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_EQUAL, V(8,783,2,2000), "FEATURE_FAILURE_BUG_1118695");
// Bug 1198815 and 1267970
// Bug 1198815
APPEND_TO_DRIVER_BLOCKLIST_RANGE(OperatingSystem::Windows,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorATI), GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_BETWEEN_INCLUSIVE, V(15,200,0,0), V(15,301,2301,1002),
"FEATURE_FAILURE_BUG_1198815_1267970", "15.200.0.0-15.301.2301.1002");
DRIVER_BETWEEN_INCLUSIVE, V(15,200,0,0), V(15,200,1062,1004),
"FEATURE_FAILURE_BUG_1198815", "15.200.0.0-15.200.1062.1004");
// Bug 1267970
APPEND_TO_DRIVER_BLOCKLIST_RANGE(OperatingSystem::Windows,
APPEND_TO_DRIVER_BLOCKLIST_RANGE(OperatingSystem::Windows10,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorATI), GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_BETWEEN_INCLUSIVE, V(15,200,0,0), V(15,301,2301,1002),
"FEATURE_FAILURE_BUG_1267970", "15.200.0.0-15.301.2301.1002");
APPEND_TO_DRIVER_BLOCKLIST_RANGE(OperatingSystem::Windows10,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorATI), GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION,
DRIVER_BETWEEN_INCLUSIVE, V(16,100,0,0), V(16,300,2311,0),