Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D28948

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Sylvestre Ledru 2019-04-28 09:30:05 +00:00
Родитель 77f5f31a5e
Коммит 96da5036ad
48 изменённых файлов: 236 добавлений и 247 удалений

Просмотреть файл

@ -1848,10 +1848,10 @@ nsresult HyperTextAccessible::ContentToRenderedOffset(
NS_ASSERTION(aFrame->GetPrevContinuation() == nullptr,
"Call on primary frame only");
nsIFrame::RenderedText text = aFrame->GetRenderedText(
aContentOffset, aContentOffset + 1,
nsIFrame::TextOffsetType::OffsetsInContentText,
nsIFrame::TrailingWhitespace::DontTrim);
nsIFrame::RenderedText text =
aFrame->GetRenderedText(aContentOffset, aContentOffset + 1,
nsIFrame::TextOffsetType::OffsetsInContentText,
nsIFrame::TrailingWhitespace::DontTrim);
*aRenderedOffset = text.mOffsetWithinNodeRenderedText;
return NS_OK;
@ -1871,10 +1871,10 @@ nsresult HyperTextAccessible::RenderedToContentOffset(
NS_ASSERTION(aFrame->GetPrevContinuation() == nullptr,
"Call on primary frame only");
nsIFrame::RenderedText text = aFrame->GetRenderedText(
aRenderedOffset, aRenderedOffset + 1,
nsIFrame::TextOffsetType::OffsetsInRenderedText,
nsIFrame::TrailingWhitespace::DontTrim);
nsIFrame::RenderedText text =
aFrame->GetRenderedText(aRenderedOffset, aRenderedOffset + 1,
nsIFrame::TextOffsetType::OffsetsInRenderedText,
nsIFrame::TrailingWhitespace::DontTrim);
*aContentOffset = text.mOffsetWithinNodeText;
return NS_OK;

Просмотреть файл

@ -272,7 +272,6 @@ nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURI, nsIURI** aResult) {
////////////////////////////////////////////////////////////////////////
void nsChromeRegistry::FlushAllCaches() {
nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
NS_ASSERTION(obsSvc, "Couldn't get observer service.");

Просмотреть файл

@ -2406,7 +2406,6 @@ class Document : public nsINode,
nsAtom* aAttrName,
const nsAString& aAttrValue) const;
/**
* To batch DOMSubtreeModified, document needs to be informed when
* a mutation event might be dispatched, even if the event isn't actually

Просмотреть файл

@ -2795,10 +2795,10 @@ static nsresult GetPartialTextRect(nsLayoutUtils::RectCallback* aCallback,
// Finally capture the text, if requested.
if (aTextList) {
nsIFrame::RenderedText renderedText = f->GetRenderedText(
textContentStart, textContentEnd,
nsIFrame::TextOffsetType::OffsetsInContentText,
nsIFrame::TrailingWhitespace::DontTrim);
nsIFrame::RenderedText renderedText =
f->GetRenderedText(textContentStart, textContentEnd,
nsIFrame::TextOffsetType::OffsetsInContentText,
nsIFrame::TrailingWhitespace::DontTrim);
aTextList->AppendElement(renderedText.mString, fallible);
}

Просмотреть файл

@ -819,7 +819,8 @@ UniquePtr<FormatUsageAuthority> FormatUsageAuthority::CreateForWebGL1(
fnSet(EffectiveFormat::Alpha8, false, true);
fnSet(EffectiveFormat::DEPTH_COMPONENT16, true, true);
fnSet(EffectiveFormat::DEPTH_COMPONENT24, true, true); // Requires WEBGL_depth_texture.
fnSet(EffectiveFormat::DEPTH_COMPONENT24, true,
true); // Requires WEBGL_depth_texture.
fnSet(EffectiveFormat::STENCIL_INDEX8, true, false);
// Added in WebGL 1.0 spec:

Просмотреть файл

@ -123,8 +123,7 @@ class Gamepad {
double value;
bool active;
axisValue()
: value(0.0f), active(false) {}
axisValue() : value(0.0f), active(false) {}
explicit axisValue(const HIDP_VALUE_CAPS& aCaps)
: caps(aCaps), value(0.0f), active(true) {}
};

Просмотреть файл

@ -1187,7 +1187,7 @@ BrowserParent* ContentParent::CreateBrowser(const TabContext& aContext,
RefPtr<BrowserParent> browserParent =
new BrowserParent(constructorSender, tabId, aContext,
aBrowsingContext->Canonical(), chromeFlags);
aBrowsingContext->Canonical(), chromeFlags);
// Open a remote endpoint for our PBrowser actor. DeallocPBrowserParent
// releases the ref taken.

Просмотреть файл

@ -459,9 +459,9 @@ void DOMOverlays::TranslateElement(Element& aElement,
// sanitize it and replace the element's content.
RefPtr<DocumentFragment> fragment =
new DocumentFragment(aElement.OwnerDoc()->NodeInfoManager());
nsContentUtils::ParseFragmentHTML(
aTranslation.mValue, fragment, nsGkAtoms::_template,
kNameSpaceID_XHTML, false, true);
nsContentUtils::ParseFragmentHTML(aTranslation.mValue, fragment,
nsGkAtoms::_template,
kNameSpaceID_XHTML, false, true);
if (NS_WARN_IF(aRv.Failed())) {
return;
}

Просмотреть файл

@ -5518,7 +5518,8 @@ nsresult QuotaManager::EnsureStorageIsInitialized() {
rv = UpgradeLocalStorageArchiveFrom0To1(connection);
} /* else if (version == 1) {
rv = UpgradeLocalStorageArchiveFrom1To2(connection);
} */ else {
} */
else {
QM_WARNING(
"Unable to initialize LocalStorage archive, no upgrade path is "
"available!");

Просмотреть файл

@ -440,10 +440,10 @@ class QuotaManager final : public BackgroundThreadObject {
nsresult UpgradeLocalStorageArchiveFrom0To1(
nsCOMPtr<mozIStorageConnection>& aConnection);
/*
nsresult UpgradeLocalStorageArchiveFrom1To2(
nsCOMPtr<mozIStorageConnection>& aConnection);
*/
/*
nsresult UpgradeLocalStorageArchiveFrom1To2(
nsCOMPtr<mozIStorageConnection>& aConnection);
*/
nsresult InitializeRepository(PersistenceType aPersistenceType);

Просмотреть файл

@ -609,18 +609,19 @@ nsresult PersistentStoragePermissionRequest::Start() {
MOZ_ASSERT(NS_IsMainThread());
PromptResult pr;
#ifdef MOZ_WIDGET_ANDROID
// on Android calling `ShowPrompt` here calls `nsContentPermissionUtils::AskPermission`
// once, and a response of `PromptResult::Pending` calls it again. This results in
// multiple requests for storage access, so we check the prompt prefs only to ensure we
// only request it once.
#ifdef MOZ_WIDGET_ANDROID
// on Android calling `ShowPrompt` here calls
// `nsContentPermissionUtils::AskPermission` once, and a response of
// `PromptResult::Pending` calls it again. This results in multiple requests
// for storage access, so we check the prompt prefs only to ensure we only
// request it once.
pr = CheckPromptPrefs();
#else
#else
nsresult rv = ShowPrompt(pr);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
#endif
#endif
if (pr == PromptResult::Granted) {
return Allow(JS::UndefinedHandleValue);
}

Просмотреть файл

@ -36,7 +36,8 @@ nsEventStatus InputQueue::ReceiveInputEvent(
switch (aEvent.mInputType) {
case MULTITOUCH_INPUT: {
const MultiTouchInput& event = aEvent.AsMultiTouchInput();
return ReceiveTouchInput(aTarget, aFlags, event, aOutInputBlockId, aTouchBehaviors);
return ReceiveTouchInput(aTarget, aFlags, event, aOutInputBlockId,
aTouchBehaviors);
}
case SCROLLWHEEL_INPUT: {
@ -431,7 +432,8 @@ void InputQueue::MaybeRequestContentResponse(
} else {
waitForMainThread = true;
}
if (aBlock->AsTouchBlock() && !aBlock->AsTouchBlock()->HasAllowedTouchBehaviors()) {
if (aBlock->AsTouchBlock() &&
!aBlock->AsTouchBlock()->HasAllowedTouchBehaviors()) {
INPQ_LOG("waiting for main thread touch-action info on block %p\n", aBlock);
waitForMainThread = true;
}

Просмотреть файл

@ -51,11 +51,11 @@ class InputQueue {
* See the documentation on APZCTreeManager::ReceiveInputEvent for info on
* return values from this function, including |aOutInputBlockId|.
*/
nsEventStatus ReceiveInputEvent(const RefPtr<AsyncPanZoomController>& aTarget,
TargetConfirmationFlags aFlags,
const InputData& aEvent,
uint64_t* aOutInputBlockId,
const Maybe<nsTArray<TouchBehaviorFlags>>& aTouchBehaviors = Nothing());
nsEventStatus ReceiveInputEvent(
const RefPtr<AsyncPanZoomController>& aTarget,
TargetConfirmationFlags aFlags, const InputData& aEvent,
uint64_t* aOutInputBlockId,
const Maybe<nsTArray<TouchBehaviorFlags>>& aTouchBehaviors = Nothing());
/**
* This function should be invoked to notify the InputQueue when web content
* decides whether or not it wants to cancel a block of events. The block
@ -172,11 +172,11 @@ class InputQueue {
const RefPtr<AsyncPanZoomController>& aTarget,
CancelableBlockState* aBlock);
nsEventStatus ReceiveTouchInput(const RefPtr<AsyncPanZoomController>& aTarget,
TargetConfirmationFlags aFlags,
const MultiTouchInput& aEvent,
uint64_t* aOutInputBlockId,
const Maybe<nsTArray<TouchBehaviorFlags>>& aTouchBehaviors);
nsEventStatus ReceiveTouchInput(
const RefPtr<AsyncPanZoomController>& aTarget,
TargetConfirmationFlags aFlags, const MultiTouchInput& aEvent,
uint64_t* aOutInputBlockId,
const Maybe<nsTArray<TouchBehaviorFlags>>& aTouchBehaviors);
nsEventStatus ReceiveMouseInput(const RefPtr<AsyncPanZoomController>& aTarget,
TargetConfirmationFlags aFlags,
const MouseInput& aEvent,

Просмотреть файл

@ -571,11 +571,13 @@ static void WebRenderDebugPrefChangeCallback(const char* aPrefName, void*) {
// Bit 18 is for the zoom display, which requires the mouse position and thus
// currently only works in wrench.
GFX_WEBRENDER_DEBUG(".small-screen", wr::DebugFlags_SMALL_SCREEN)
GFX_WEBRENDER_DEBUG(".disable-opaque-pass", wr::DebugFlags_DISABLE_OPAQUE_PASS)
GFX_WEBRENDER_DEBUG(".disable-opaque-pass",
wr::DebugFlags_DISABLE_OPAQUE_PASS)
GFX_WEBRENDER_DEBUG(".disable-alpha-pass", wr::DebugFlags_DISABLE_ALPHA_PASS)
GFX_WEBRENDER_DEBUG(".disable-clip-masks", wr::DebugFlags_DISABLE_CLIP_MASKS)
GFX_WEBRENDER_DEBUG(".disable-text-prims", wr::DebugFlags_DISABLE_TEXT_PRIMS)
GFX_WEBRENDER_DEBUG(".disable-gradient-prims", wr::DebugFlags_DISABLE_GRADIENT_PRIMS)
GFX_WEBRENDER_DEBUG(".disable-gradient-prims",
wr::DebugFlags_DISABLE_GRADIENT_PRIMS)
#undef GFX_WEBRENDER_DEBUG
gfx::gfxVars::SetWebRenderDebugFlags(flags.bits);

Просмотреть файл

@ -219,7 +219,8 @@ bool GenerateTempFileName(nsCString& aPath) {
umask(prevMask);
if (fd == -1) {
NS_WARNING(nsPrintfCString("OpenVR - Creating temp file failed: %s",
strerror(errno)).get());
strerror(errno))
.get());
return false;
}
close(fd);

Просмотреть файл

@ -78,8 +78,7 @@ class NewRenderer : public RendererEvent {
aWindowId, mSize.width, mSize.height,
supportLowPriorityTransactions,
gfxPrefs::WebRenderPictureCaching() && supportPictureCaching,
gfxPrefs::WebRenderStartDebugServer(),
compositor->gl(),
gfxPrefs::WebRenderStartDebugServer(), compositor->gl(),
aRenderThread.GetProgramCache()
? aRenderThread.GetProgramCache()->Raw()
: nullptr,

Просмотреть файл

@ -179,8 +179,9 @@ struct JSPropertySpec {
name, flags | JSPROP_GETTER | (setterName ? JSPROP_SETTER : 0),
AccessorsOrValue::fromAccessors(
JSPropertySpec::Accessor::selfHostedAccessor(getterName),
setterName ? JSPropertySpec::Accessor::selfHostedAccessor(setterName)
: JSPropertySpec::Accessor::noAccessor()));
setterName
? JSPropertySpec::Accessor::selfHostedAccessor(setterName)
: JSPropertySpec::Accessor::noAccessor()));
}
static constexpr JSPropertySpec int32Value(const char* name, uint8_t flags,
@ -232,9 +233,9 @@ struct JSPropertySpec {
static_assert(sizeof(SelfHostedWrapper) == sizeof(JSNativeWrapper),
"JSPropertySpec::getter/setter must be compact");
static_assert(offsetof(SelfHostedWrapper, unused) ==
offsetof(JSNativeWrapper, op) &&
offsetof(SelfHostedWrapper, funname) ==
offsetof(JSNativeWrapper, info),
offsetof(JSNativeWrapper, op) &&
offsetof(SelfHostedWrapper, funname) ==
offsetof(JSNativeWrapper, info),
"checkAccessorsAreNative below require that "
"SelfHostedWrapper::funname overlay "
"JSNativeWrapper::info and "

Просмотреть файл

@ -365,12 +365,10 @@ JS::Result<FunctionNode*> BinASTParserPerTokenizer<Tok>::buildFunction(
// Check all our bindings after maybe adding function metavars.
MOZ_TRY(checkFunctionClosedVars());
BINJS_TRY_DECL(
bindings,
NewFunctionScopeData(cx_, pc_->functionScope(),
/* hasParameterExprs = */ false,
IsFieldInitializer::No,
alloc_, pc_));
BINJS_TRY_DECL(bindings,
NewFunctionScopeData(cx_, pc_->functionScope(),
/* hasParameterExprs = */ false,
IsFieldInitializer::No, alloc_, pc_));
funbox->functionScopeBindings().set(*bindings);

Просмотреть файл

@ -14031,8 +14031,8 @@ void CodeGenerator::visitWasmCompareAndSelect(LWasmCompareAndSelect* ins) {
MOZ_ASSERT(ToRegister(ins->ifTrueExpr()) == out,
"true expr input is reused for output");
Assembler::Condition cond = Assembler::InvertCondition(JSOpToCondition(
ins->compareType(), ins->jsop()));
Assembler::Condition cond = Assembler::InvertCondition(
JSOpToCondition(ins->compareType(), ins->jsop()));
const LAllocation* rhs = ins->rightExpr();
const LAllocation* falseExpr = ins->ifFalseExpr();
Register lhs = ToRegister(ins->leftExpr());
@ -14043,7 +14043,8 @@ void CodeGenerator::visitWasmCompareAndSelect(LWasmCompareAndSelect* ins) {
// happen, since |rhs| and |falseExpr| are marked useAny() by
// LIRGenerator::visitWasmSelect, and useAny() means "register only"
// on arm32.
masm.cmp32Move32(cond, lhs, ToRegister(rhs), ToRegister(falseExpr), out);
masm.cmp32Move32(cond, lhs, ToRegister(rhs), ToRegister(falseExpr),
out);
} else {
masm.cmp32Load32(cond, lhs, ToRegister(rhs), ToAddress(falseExpr), out);
}

Просмотреть файл

@ -5073,11 +5073,9 @@ void LIRGenerator::visitWasmSelect(MWasmSelect* ins) {
jsop == JSOP_GT || jsop == JSOP_LE || jsop == JSOP_GE);
if (compTy == MCompare::Compare_Int32 ||
compTy == MCompare::Compare_UInt32) {
auto* lir = new (alloc())
LWasmCompareAndSelect(useRegister(comp->lhs()), useAny(comp->rhs()),
compTy, jsop,
useRegisterAtStart(ins->trueExpr()),
useAny(ins->falseExpr()));
auto* lir = new (alloc()) LWasmCompareAndSelect(
useRegister(comp->lhs()), useAny(comp->rhs()), compTy, jsop,
useRegisterAtStart(ins->trueExpr()), useAny(ins->falseExpr()));
defineReuseInput(lir, ins, LWasmCompareAndSelect::IfTrueExprIndex);
return;

Просмотреть файл

@ -1906,9 +1906,8 @@ void MacroAssembler::cmp32Load32(Condition cond, Register lhs,
MOZ_CRASH("No known use cases");
}
void MacroAssembler::cmp32Load32(Condition cond, Register lhs,
Register rhs, const Address& src,
Register dest) {
void MacroAssembler::cmp32Load32(Condition cond, Register lhs, Register rhs,
const Address& src, Register dest) {
// This is never used, but must be present to facilitate linking on arm.
MOZ_CRASH("No known use cases");
}

Просмотреть файл

@ -1595,9 +1595,8 @@ void MacroAssembler::cmp32Load32(Condition cond, Register lhs,
MOZ_CRASH("NYI");
}
void MacroAssembler::cmp32Load32(Condition cond, Register lhs,
Register rhs, const Address& src,
Register dest) {
void MacroAssembler::cmp32Load32(Condition cond, Register lhs, Register rhs,
const Address& src, Register dest) {
MOZ_CRASH("NYI");
}

Просмотреть файл

@ -999,9 +999,8 @@ void MacroAssembler::cmp32Load32(Condition cond, Register lhs,
cmovCCl(cond, Operand(src), dest);
}
void MacroAssembler::cmp32Load32(Condition cond, Register lhs,
Register rhs, const Address& src,
Register dest) {
void MacroAssembler::cmp32Load32(Condition cond, Register lhs, Register rhs,
const Address& src, Register dest) {
cmp32(lhs, rhs);
cmovCCl(cond, Operand(src), dest);
}

Просмотреть файл

@ -250,28 +250,28 @@ static int64_t PRMJ_NowImpl() {
#endif
#if !ENABLE_INTL_API || MOZ_SYSTEM_ICU
#ifdef XP_WIN
# ifdef XP_WIN
static void PRMJ_InvalidParameterHandler(const wchar_t* expression,
const wchar_t* function,
const wchar_t* file, unsigned int line,
uintptr_t pReserved) {
/* empty */
}
#endif
# endif
/* Format a time value into a buffer. Same semantics as strftime() */
size_t PRMJ_FormatTime(char* buf, size_t buflen, const char* fmt,
const PRMJTime* prtm, int timeZoneYear,
int offsetInSeconds) {
size_t result = 0;
#if defined(XP_UNIX) || defined(XP_WIN)
# if defined(XP_UNIX) || defined(XP_WIN)
struct tm a;
# ifdef XP_WIN
# ifdef XP_WIN
_invalid_parameter_handler oldHandler;
# ifndef __MINGW32__
# ifndef __MINGW32__
int oldReportMode;
# endif // __MINGW32__
# endif // XP_WIN
# endif // __MINGW32__
# endif // XP_WIN
memset(&a, 0, sizeof(struct tm));
@ -287,7 +287,7 @@ size_t PRMJ_FormatTime(char* buf, size_t buflen, const char* fmt,
* must fill in those values, or else strftime will return wrong results
* (e.g., bug 511726, bug 554338).
*/
# if defined(HAVE_LOCALTIME_R) && defined(HAVE_TM_ZONE_TM_GMTOFF)
# if defined(HAVE_LOCALTIME_R) && defined(HAVE_TM_ZONE_TM_GMTOFF)
char emptyTimeZoneId[] = "";
{
/*
@ -322,7 +322,7 @@ size_t PRMJ_FormatTime(char* buf, size_t buflen, const char* fmt,
a.tm_zone = emptyTimeZoneId;
}
}
# endif
# endif
/*
* Years before 1900 and after 9999 cause strftime() to abort on Windows.
@ -350,25 +350,25 @@ size_t PRMJ_FormatTime(char* buf, size_t buflen, const char* fmt,
* changeover time.)
*/
# ifdef XP_WIN
# ifdef XP_WIN
oldHandler = _set_invalid_parameter_handler(PRMJ_InvalidParameterHandler);
# ifndef __MINGW32__
# ifndef __MINGW32__
/*
* MinGW doesn't have _CrtSetReportMode and defines it to be a no-op.
* We ifdef it off to avoid warnings about unused variables
*/
oldReportMode = _CrtSetReportMode(_CRT_ASSERT, 0);
# endif // __MINGW32__
# endif // XP_WIN
# endif // __MINGW32__
# endif // XP_WIN
result = strftime(buf, buflen, fmt, &a);
# ifdef XP_WIN
# ifdef XP_WIN
_set_invalid_parameter_handler(oldHandler);
# ifndef __MINGW32__
# ifndef __MINGW32__
_CrtSetReportMode(_CRT_ASSERT, oldReportMode);
# endif // __MINGW32__
# endif // XP_WIN
# endif // __MINGW32__
# endif // XP_WIN
if (fake_tm_year && result) {
char real_year[16];
@ -394,7 +394,7 @@ size_t PRMJ_FormatTime(char* buf, size_t buflen, const char* fmt,
*(buf + result) = '\0';
}
}
#endif
# endif
return result;
}
#endif /* !ENABLE_INTL_API || MOZ_SYSTEM_ICU */

Просмотреть файл

@ -928,10 +928,13 @@ class AstTableFill : public AstExpr {
public:
static const AstExprKind Kind = AstExprKind::TableFill;
explicit AstTableFill(AstRef targetTable,
AstExpr* start, AstExpr* val, AstExpr* len)
: AstExpr(Kind, ExprType::Void), targetTable_(targetTable),
start_(start), val_(val), len_(len) {}
explicit AstTableFill(AstRef targetTable, AstExpr* start, AstExpr* val,
AstExpr* len)
: AstExpr(Kind, ExprType::Void),
targetTable_(targetTable),
start_(start),
val_(val),
len_(len) {}
AstRef& targetTable() { return targetTable_; }
AstExpr& start() const { return *start_; }

Просмотреть файл

@ -4162,8 +4162,8 @@ class BaseCompiler final : public BaseCompilerInterface {
if (l.type == MIRType::RefOrNull) {
uint32_t offs = fr.localOffset(l);
MOZ_ASSERT(0 == (offs % sizeof(void*)));
stackMapGenerator_.machineStackTracker
.setGCPointer(offs / sizeof(void*));
stackMapGenerator_.machineStackTracker.setGCPointer(offs /
sizeof(void*));
}
}
@ -4185,8 +4185,8 @@ class BaseCompiler final : public BaseCompilerInterface {
MOZ_ASSERT(0 == (offs % sizeof(void*)));
fr.storeLocalPtr(RegPtr(i->gpr()), l);
// We should have just visited this local in the preceding loop.
MOZ_ASSERT(stackMapGenerator_.machineStackTracker
.isGCPointer(offs / sizeof(void*)));
MOZ_ASSERT(stackMapGenerator_.machineStackTracker.isGCPointer(
offs / sizeof(void*)));
break;
}
case MIRType::Double:

Просмотреть файл

@ -853,8 +853,7 @@ Instance::tableInit(Instance* instance, uint32_t dstOffset, uint32_t srcOffset,
/* static */ int32_t /* -1 to signal trap; 0 for ok */
Instance::tableFill(Instance* instance, uint32_t start, void* value,
uint32_t len, uint32_t tableIndex)
{
uint32_t len, uint32_t tableIndex) {
Table& table = *instance->tables()[tableIndex];
MOZ_RELEASE_ASSERT(table.kind() == TableKind::AnyRef);

Просмотреть файл

@ -2033,8 +2033,8 @@ inline bool OpIter<Policy>::readTableGet(uint32_t* tableIndex, Value* index) {
}
template <typename Policy>
inline bool OpIter<Policy>::readTableGrow(uint32_t* tableIndex, Value* initValue,
Value* delta) {
inline bool OpIter<Policy>::readTableGrow(uint32_t* tableIndex,
Value* initValue, Value* delta) {
MOZ_ASSERT(Classify(op_) == OpKind::TableGrow);
if (!popWithType(ValType::I32, delta)) {

Просмотреть файл

@ -872,8 +872,8 @@ static bool DecodeFunctionBodyExprs(const ModuleEnvironment& env,
#ifdef ENABLE_WASM_REFTYPES
case uint32_t(MiscOp::TableFill): {
uint32_t unusedTableIndex;
CHECK(iter.readTableFill(&unusedTableIndex,
&nothing, &nothing, &nothing));
CHECK(iter.readTableFill(&unusedTableIndex, &nothing, &nothing,
&nothing));
}
case uint32_t(MiscOp::TableGrow): {
uint32_t unusedTableIndex;

Просмотреть файл

@ -257,11 +257,11 @@ void ScriptPreloader::Cleanup() {
void ScriptPreloader::StartCacheWrite() {
MOZ_ASSERT(!mSaveThread);
Unused << NS_NewNamedThread("SaveScripts", getter_AddRefs(mSaveThread),
this);
Unused << NS_NewNamedThread("SaveScripts", getter_AddRefs(mSaveThread), this);
nsCOMPtr<nsIAsyncShutdownClient> barrier = GetShutdownBarrier();
barrier->AddBlocker(this, NS_LITERAL_STRING(__FILE__), __LINE__, EmptyString());
barrier->AddBlocker(this, NS_LITERAL_STRING(__FILE__), __LINE__,
EmptyString());
}
void ScriptPreloader::InvalidateCache() {
@ -1157,7 +1157,8 @@ nsresult ScriptPreloader::GetState(nsIPropertyBag** aState) {
return NS_OK;
}
nsresult ScriptPreloader::BlockShutdown(nsIAsyncShutdownClient* aBarrierClient) {
nsresult ScriptPreloader::BlockShutdown(
nsIAsyncShutdownClient* aBarrierClient) {
// If we're waiting on a timeout to finish saving, interrupt it and just save
// immediately.
mSaveMonitor.NotifyAll();

Просмотреть файл

@ -26,7 +26,7 @@
#include "Units.h"
#include "mozilla/ToString.h"
#include "mozilla/ReflowOutput.h"
#include "ImageContainer.h" // for layers::Image
#include "ImageContainer.h" // for layers::Image
#include "gfx2DGlue.h"
#include "SVGImageContext.h"
#include <limits>

Просмотреть файл

@ -25,7 +25,7 @@
#include "gfxFontConstants.h"
#include "nsAtom.h"
#include "nsCRT.h"
#include "nsIWidgetListener.h" // for nsSizeMode
#include "nsIWidgetListener.h" // for nsSizeMode
#include "nsGkAtoms.h"
#include "nsCycleCollectionParticipant.h"
#include "nsChangeHint.h"

Просмотреть файл

@ -92,10 +92,12 @@ class nsGridContainerFrame final : public nsContainerFrame {
using BaselineSharingGroup = mozilla::BaselineSharingGroup;
template <typename T>
using PerBaseline = mozilla::EnumeratedArray<BaselineSharingGroup, BaselineSharingGroup(2), T>;
using PerBaseline = mozilla::EnumeratedArray<BaselineSharingGroup,
BaselineSharingGroup(2), T>;
template <typename T>
using PerLogicalAxis = mozilla::EnumeratedArray<LogicalAxis, LogicalAxis(2), T>;
using PerLogicalAxis =
mozilla::EnumeratedArray<LogicalAxis, LogicalAxis(2), T>;
// nsIFrame overrides
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,

Просмотреть файл

@ -975,9 +975,8 @@ nscoord nsImageFrame::GetMinISize(gfxContext* aRenderingContext) {
DebugOnly<nscoord> result;
DISPLAY_MIN_INLINE_SIZE(this, result);
EnsureIntrinsicSizeAndRatio();
const auto& iSize = GetWritingMode().IsVertical()
? mIntrinsicSize.height
: mIntrinsicSize.width;
const auto& iSize = GetWritingMode().IsVertical() ? mIntrinsicSize.height
: mIntrinsicSize.width;
return iSize.valueOr(0);
}
@ -988,9 +987,8 @@ nscoord nsImageFrame::GetPrefISize(gfxContext* aRenderingContext) {
DebugOnly<nscoord> result;
DISPLAY_PREF_INLINE_SIZE(this, result);
EnsureIntrinsicSizeAndRatio();
const auto& iSize = GetWritingMode().IsVertical()
? mIntrinsicSize.height
: mIntrinsicSize.width;
const auto& iSize = GetWritingMode().IsVertical() ? mIntrinsicSize.height
: mIntrinsicSize.width;
// convert from normal twips to scaled twips (printing...)
return iSize.valueOr(0);
}

Просмотреть файл

@ -267,7 +267,8 @@ class nsTextFrame : public nsFrame {
RenderedText GetRenderedText(
uint32_t aStartOffset = 0, uint32_t aEndOffset = UINT32_MAX,
TextOffsetType aOffsetType = TextOffsetType::OffsetsInContentText,
TrailingWhitespace aTrimTrailingWhitespace = TrailingWhitespace::Trim) final;
TrailingWhitespace aTrimTrailingWhitespace =
TrailingWhitespace::Trim) final;
nsOverflowAreas RecomputeOverflow(nsIFrame* aBlockFrame,
bool aIncludeShadows = true);

Просмотреть файл

@ -196,8 +196,8 @@ nsresult CSSStyleRule::SelectorMatchesElement(Element* aElement,
PseudoStyleType pseudoType = PseudoStyleType::NotPseudo;
if (!aPseudo.IsEmpty()) {
RefPtr<nsAtom> pseudoElt = NS_Atomize(aPseudo);
pseudoType =
nsCSSPseudoElements::GetPseudoType(pseudoElt, CSSEnabledState::IgnoreEnabledState);
pseudoType = nsCSSPseudoElements::GetPseudoType(
pseudoElt, CSSEnabledState::IgnoreEnabledState);
if (pseudoType == PseudoStyleType::NotPseudo) {
*aMatches = false;

Просмотреть файл

@ -44,10 +44,11 @@ bool nsCSSPseudoElements::IsCSS2PseudoElement(nsAtom* aAtom) {
aAtom == nsCSSPseudoElements::before() ||
aAtom == nsCSSPseudoElements::firstLetter() ||
aAtom == nsCSSPseudoElements::firstLine();
NS_ASSERTION(result == PseudoElementHasFlags(
GetPseudoType(aAtom, EnabledState::IgnoreEnabledState),
CSS_PSEUDO_ELEMENT_IS_CSS2),
"result doesn't match flags");
NS_ASSERTION(
result == PseudoElementHasFlags(
GetPseudoType(aAtom, EnabledState::IgnoreEnabledState),
CSS_PSEUDO_ELEMENT_IS_CSS2),
"result doesn't match flags");
return result;
}

Просмотреть файл

@ -473,7 +473,8 @@ nsRect nsImageBoxFrame::GetDestRect(const nsPoint& aOffset,
nsSize intrinsicRatio;
if (mIntrinsicSize.width > 0 && mIntrinsicSize.height > 0) {
// Image has a valid size; use it as intrinsic size & ratio.
intrinsicSize = IntrinsicSize(mIntrinsicSize.width, mIntrinsicSize.height);
intrinsicSize =
IntrinsicSize(mIntrinsicSize.width, mIntrinsicSize.height);
intrinsicRatio = mIntrinsicSize;
} else {
// Image doesn't have a (valid) intrinsic size.

Просмотреть файл

@ -1509,10 +1509,9 @@ nsresult nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame,
// However, if a panel is already constrained or flipped (mIsOffset), then we
// want to continue to calculate this. Also, always do this for content
// shells, so that the popup doesn't extend outside the containing frame.
if (!inWayland &&
(mInContentShell ||
(mFlip != FlipType_None &&
(!aIsMove || mIsOffset || mPopupType != ePopupTypePanel)))) {
if (!inWayland && (mInContentShell || (mFlip != FlipType_None &&
(!aIsMove || mIsOffset ||
mPopupType != ePopupTypePanel)))) {
int32_t appPerDev = presContext->AppUnitsPerDevPixel();
LayoutDeviceIntRect anchorRectDevPix =
LayoutDeviceIntRect::FromAppUnitsToNearest(anchorRect, appPerDev);

Просмотреть файл

@ -1439,8 +1439,8 @@ void nsXULPopupManager::FirePopupHidingEvent(
// you won't be able to see it. If there is a next popup, indicating that
// mutliple popups are rolling up, don't wait and hide the popup right
// away since the effect would likely be undesirable.
if (StaticPrefs::xul_panel_animations_enabled() &&
!aNextPopup && aPopup->IsElement() &&
if (StaticPrefs::xul_panel_animations_enabled() && !aNextPopup &&
aPopup->IsElement() &&
aPopup->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::animate)) {
// If animate="false" then don't transition at all. If animate="cancel",
// only show the transition if cancelling the popup or rolling up.

Просмотреть файл

@ -65,7 +65,7 @@ TEST(Zip, TestZip)
{
Zip::Stream s;
RefPtr<Zip> z = Zip::Create((void *)TEST_ZIP, TEST_ZIP_SIZE);
for (auto& entry : test_entries) {
for (auto &entry : test_entries) {
ASSERT_TRUE(z->GetStream(entry, &s))
<< "Could not get entry \"" << entry << "\"";
}
@ -76,7 +76,7 @@ TEST(Zip, NoCentralDir)
Zip::Stream s;
RefPtr<Zip> z =
Zip::Create((void *)NO_CENTRAL_DIR_ZIP, NO_CENTRAL_DIR_ZIP_SIZE);
for (auto& entry : no_central_dir_entries) {
for (auto &entry : no_central_dir_entries) {
ASSERT_TRUE(z->GetStream(entry, &s))
<< "Could not get entry \"" << entry << "\"";
}

Просмотреть файл

@ -523,7 +523,7 @@ class MOZ_RAII PEHeaders final {
// There may be other code sections in the binary besides .text
Maybe<Span<const uint8_t>> GetTextSectionInfo() const {
return FindSection(".text", IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE |
IMAGE_SCN_MEM_READ);
IMAGE_SCN_MEM_READ);
}
static bool IsValid(PIMAGE_IMPORT_DESCRIPTOR aImpDesc) {
@ -554,11 +554,11 @@ class MOZ_RAII PEHeaders final {
Span<IMAGE_SECTION_HEADER> GetSectionTable() const {
MOZ_ASSERT(*this);
auto base = RVAToPtr<PIMAGE_SECTION_HEADER>(&mPeHeader->OptionalHeader,
mPeHeader->FileHeader.SizeOfOptionalHeader);
auto base = RVAToPtr<PIMAGE_SECTION_HEADER>(
&mPeHeader->OptionalHeader, mPeHeader->FileHeader.SizeOfOptionalHeader);
// The Windows loader has an internal limit of 96 sections (per PE spec)
auto numSections = std::min(mPeHeader->FileHeader.NumberOfSections,
WORD(96));
auto numSections =
std::min(mPeHeader->FileHeader.NumberOfSections, WORD(96));
return MakeSpan(base, numSections);
}

Просмотреть файл

@ -16,4 +16,3 @@ MFBT_API bool IsWin32kLockedDown();
} // namespace mozilla
#endif // mozilla_WindowsProcessMitigations_h

Просмотреть файл

@ -69,7 +69,6 @@ void remoteClientNotificationCallback(CFNotificationCenterRef aCenter, void* aOb
NSDictionary* userInfoDict = (__bridge NSDictionary*)aUserInfo;
if (userInfoDict && [userInfoDict objectForKey:@"commandLineArgs"] &&
[userInfoDict objectForKey:@"senderPath"]) {
NSString* senderPath = [userInfoDict objectForKey:@"senderPath"];
if (![senderPath isEqual:[[NSBundle mainBundle] bundlePath]]) {
// The caller is not the process at the same path as we are at. Skipping.
@ -209,13 +208,12 @@ NS_IMETHODIMP nsNativeAppSupportCocoa::Start(bool* _retval) {
if (!shallProceedLikeNoRemote) {
// We check for other running instances only if -no-remote was not specified.
// The check is needed so the marAppApplyUpdateSuccess.js test doesn't fail on next call.
NSArray* appsWithMatchingId = [NSRunningApplication runningApplicationsWithBundleIdentifier:
[[NSBundle mainBundle] bundleIdentifier]];
NSArray* appsWithMatchingId = [NSRunningApplication
runningApplicationsWithBundleIdentifier:[[NSBundle mainBundle] bundleIdentifier]];
NSString* currentAppBundlePath = [[NSBundle mainBundle] bundlePath];
NSRunningApplication* currentApp = [NSRunningApplication currentApplication];
for (NSRunningApplication* app in appsWithMatchingId) {
if ([currentAppBundlePath isEqual:[[app bundleURL] path]] &&
![currentApp isEqual:app]) {
if ([currentAppBundlePath isEqual:[[app bundleURL] path]] && ![currentApp isEqual:app]) {
runningInstanceFound = YES;
break;
}
@ -226,11 +224,8 @@ NS_IMETHODIMP nsNativeAppSupportCocoa::Start(bool* _retval) {
// There is another instance of this app already running!
NSArray* arguments = [[NSProcessInfo processInfo] arguments];
NSString* senderPath = [[NSBundle mainBundle] bundlePath];
CFDictionaryRef userInfoDict = (__bridge CFDictionaryRef) @{@"commandLineArgs" :
arguments,
@"senderPath":
senderPath
};
CFDictionaryRef userInfoDict =
(__bridge CFDictionaryRef) @{@"commandLineArgs" : arguments, @"senderPath" : senderPath};
// This code is shared between Firefox, Thunderbird and other Mozilla products.
// So we need a notification name that is unique to the product, so we

Просмотреть файл

@ -1412,8 +1412,8 @@ GtkStyleContext* CreateStyleContextWithStates(WidgetNodeType aNodeType,
int aScale,
GtkTextDirection aDirection,
GtkStateFlags aStateFlags) {
GtkStyleContext* style = GetStyleContext(aNodeType, aScale, aDirection,
aStateFlags);
GtkStyleContext* style =
GetStyleContext(aNodeType, aScale, aDirection, aStateFlags);
GtkWidgetPath* path = gtk_widget_path_copy(gtk_style_context_get_path(style));
if (gtk_check_version(3, 14, 0) == nullptr) {
@ -1438,10 +1438,10 @@ GtkStyleContext* CreateStyleContextWithStates(WidgetNodeType aNodeType,
return style;
}
void StyleContextSetScale(GtkStyleContext *style, gint aScaleFactor) {
void StyleContextSetScale(GtkStyleContext* style, gint aScaleFactor) {
// Support HiDPI styles on Gtk 3.20+
static auto sGtkStyleContextSetScalePtr =
(void (*)(GtkStyleContext *, gint))dlsym(
RTLD_DEFAULT, "gtk_style_context_set_scale");
(void (*)(GtkStyleContext*, gint))dlsym(RTLD_DEFAULT,
"gtk_style_context_set_scale");
sGtkStyleContextSetScalePtr(style, aScaleFactor);
}

Просмотреть файл

@ -52,6 +52,6 @@ GtkStyleContext* CreateStyleContextWithStates(
void ResetWidgetCache(void);
void StyleContextSetScale(GtkStyleContext *style, gint aScaleFactor);
void StyleContextSetScale(GtkStyleContext* style, gint aScaleFactor);
#endif // WidgetStyleCache_h

Просмотреть файл

@ -953,8 +953,8 @@ static gint moz_gtk_scrollbar_paint(WidgetNodeType widget, cairo_t* cr,
GtkWidgetState* state,
GtkTextDirection direction) {
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
GtkStyleContext* style = GetStyleContext(widget, state->scale, direction,
state_flags);
GtkStyleContext* style =
GetStyleContext(widget, state->scale, direction, state_flags);
moz_gtk_update_scrollbar_style(style, widget, direction);
@ -974,8 +974,8 @@ static gint moz_gtk_scrollbar_thumb_paint(WidgetNodeType widget, cairo_t* cr,
GtkWidgetState* state,
GtkTextDirection direction) {
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
GtkStyleContext* style = GetStyleContext(widget, state->scale, direction,
state_flags);
GtkStyleContext* style =
GetStyleContext(widget, state->scale, direction, state_flags);
GtkOrientation orientation = (widget == MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL)
? GTK_ORIENTATION_HORIZONTAL
@ -998,9 +998,9 @@ static gint moz_gtk_scrollbar_thumb_paint(WidgetNodeType widget, cairo_t* cr,
static gint moz_gtk_inner_spin_paint(cairo_t* cr, GdkRectangle* rect,
GtkWidgetState* state,
GtkTextDirection direction) {
GtkStyleContext* style = GetStyleContext(
MOZ_GTK_SPINBUTTON, state->scale, direction,
GetStateFlagsFromGtkWidgetState(state));
GtkStyleContext* style =
GetStyleContext(MOZ_GTK_SPINBUTTON, state->scale, direction,
GetStateFlagsFromGtkWidgetState(state));
gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
@ -1029,8 +1029,8 @@ static gint moz_gtk_inner_spin_paint(cairo_t* cr, GdkRectangle* rect,
static gint moz_gtk_spin_paint(cairo_t* cr, GdkRectangle* rect,
GtkWidgetState* state,
GtkTextDirection direction) {
GtkStyleContext* style = GetStyleContext(MOZ_GTK_SPINBUTTON, state->scale,
direction);
GtkStyleContext* style =
GetStyleContext(MOZ_GTK_SPINBUTTON, state->scale, direction);
gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
return MOZ_GTK_SUCCESS;
@ -1039,9 +1039,9 @@ static gint moz_gtk_spin_paint(cairo_t* cr, GdkRectangle* rect,
static gint moz_gtk_spin_updown_paint(cairo_t* cr, GdkRectangle* rect,
gboolean isDown, GtkWidgetState* state,
GtkTextDirection direction) {
GtkStyleContext* style = GetStyleContext(
MOZ_GTK_SPINBUTTON, state->scale, direction,
GetStateFlagsFromGtkWidgetState(state));
GtkStyleContext* style =
GetStyleContext(MOZ_GTK_SPINBUTTON, state->scale, direction,
GetStateFlagsFromGtkWidgetState(state));
gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
@ -1136,9 +1136,9 @@ static gint moz_gtk_scale_thumb_paint(cairo_t* cr, GdkRectangle* rect,
static gint moz_gtk_gripper_paint(cairo_t* cr, GdkRectangle* rect,
GtkWidgetState* state,
GtkTextDirection direction) {
GtkStyleContext* style = GetStyleContext(
MOZ_GTK_GRIPPER, state->scale, direction,
GetStateFlagsFromGtkWidgetState(state));
GtkStyleContext* style =
GetStyleContext(MOZ_GTK_GRIPPER, state->scale, direction,
GetStateFlagsFromGtkWidgetState(state));
gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
return MOZ_GTK_SUCCESS;
@ -1148,8 +1148,7 @@ static gint moz_gtk_hpaned_paint(cairo_t* cr, GdkRectangle* rect,
GtkWidgetState* state) {
GtkStyleContext* style =
GetStyleContext(MOZ_GTK_SPLITTER_SEPARATOR_HORIZONTAL, state->scale,
GTK_TEXT_DIR_LTR,
GetStateFlagsFromGtkWidgetState(state));
GTK_TEXT_DIR_LTR, GetStateFlagsFromGtkWidgetState(state));
gtk_render_handle(style, cr, rect->x, rect->y, rect->width, rect->height);
return MOZ_GTK_SUCCESS;
}
@ -1158,8 +1157,7 @@ static gint moz_gtk_vpaned_paint(cairo_t* cr, GdkRectangle* rect,
GtkWidgetState* state) {
GtkStyleContext* style =
GetStyleContext(MOZ_GTK_SPLITTER_SEPARATOR_VERTICAL, state->scale,
GTK_TEXT_DIR_LTR,
GetStateFlagsFromGtkWidgetState(state));
GTK_TEXT_DIR_LTR, GetStateFlagsFromGtkWidgetState(state));
gtk_render_handle(style, cr, rect->x, rect->y, rect->width, rect->height);
return MOZ_GTK_SUCCESS;
}
@ -1208,9 +1206,8 @@ static gint moz_gtk_text_view_paint(cairo_t* cr, GdkRectangle* aRect,
? GTK_STATE_FLAG_INSENSITIVE
: state->focused ? GTK_STATE_FLAG_FOCUSED : GTK_STATE_FLAG_NORMAL;
GtkStyleContext* style_frame =
GetStyleContext(MOZ_GTK_SCROLLED_WINDOW, state->scale, direction,
state_flags);
GtkStyleContext* style_frame = GetStyleContext(
MOZ_GTK_SCROLLED_WINDOW, state->scale, direction, state_flags);
gtk_render_frame(style_frame, cr, aRect->x, aRect->y, aRect->width,
aRect->height);
@ -1284,8 +1281,7 @@ static gint moz_gtk_tree_header_sort_arrow_paint(cairo_t* cr,
arrow_rect.x = rect->x + (rect->width - arrow_rect.width) / 2;
arrow_rect.y = rect->y + (rect->height - arrow_rect.height) / 2;
style = GetStyleContext(MOZ_GTK_TREE_HEADER_SORTARROW, state->scale,
direction,
GetStateFlagsFromGtkWidgetState(state));
direction, GetStateFlagsFromGtkWidgetState(state));
switch (arrow_type) {
case GTK_ARROW_LEFT:
arrow_angle = ARROW_LEFT;
@ -1335,9 +1331,8 @@ static gint moz_gtk_treeview_expander_paint(cairo_t* cr, GdkRectangle* rect,
state_flags =
static_cast<GtkStateFlags>(state_flags & ~(checkbox_check_state));
GtkStyleContext* style =
GetStyleContext(MOZ_GTK_TREEVIEW_EXPANDER, state->scale, direction,
state_flags);
GtkStyleContext* style = GetStyleContext(
MOZ_GTK_TREEVIEW_EXPANDER, state->scale, direction, state_flags);
gtk_render_expander(style, cr, rect->x, rect->y, rect->width, rect->height);
return MOZ_GTK_SUCCESS;
@ -1439,9 +1434,8 @@ static gint moz_gtk_arrow_paint(cairo_t* cr, GdkRectangle* rect,
calculate_arrow_rect(GetWidget(MOZ_GTK_BUTTON_ARROW), rect, &arrow_rect,
direction);
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
GtkStyleContext* style =
GetStyleContext(MOZ_GTK_BUTTON_ARROW, state->scale, direction,
state_flags);
GtkStyleContext* style = GetStyleContext(MOZ_GTK_BUTTON_ARROW, state->scale,
direction, state_flags);
gtk_render_arrow(style, cr, arrow_angle, arrow_rect.x, arrow_rect.y,
arrow_rect.width);
return MOZ_GTK_SUCCESS;
@ -1484,8 +1478,8 @@ static gint moz_gtk_container_paint(cairo_t* cr, GdkRectangle* rect,
WidgetNodeType widget_type,
GtkTextDirection direction) {
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
GtkStyleContext* style = GetStyleContext(widget_type, state->scale,
direction, state_flags);
GtkStyleContext* style =
GetStyleContext(widget_type, state->scale, direction, state_flags);
/* this is for drawing a prelight box */
if (state_flags & GTK_STATE_FLAG_PRELIGHT) {
gtk_render_background(style, cr, rect->x, rect->y, rect->width,
@ -1511,8 +1505,8 @@ static gint moz_gtk_toggle_label_paint(cairo_t* cr, GdkRectangle* rect,
static gint moz_gtk_toolbar_paint(cairo_t* cr, GdkRectangle* rect,
GtkWidgetState* state,
GtkTextDirection direction) {
GtkStyleContext* style = GetStyleContext(MOZ_GTK_TOOLBAR, state->scale,
direction);
GtkStyleContext* style =
GetStyleContext(MOZ_GTK_TOOLBAR, state->scale, direction);
gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
return MOZ_GTK_SUCCESS;
@ -1570,8 +1564,8 @@ static gint moz_gtk_tooltip_paint(cairo_t* cr, const GdkRectangle* aRect,
// We have to draw all elements with appropriate offset and right dimensions.
// Tooltip drawing
GtkStyleContext* style = GetStyleContext(MOZ_GTK_TOOLTIP, state->scale,
direction);
GtkStyleContext* style =
GetStyleContext(MOZ_GTK_TOOLTIP, state->scale, direction);
GdkRectangle rect = *aRect;
gtk_render_background(style, cr, rect.x, rect.y, rect.width, rect.height);
gtk_render_frame(style, cr, rect.x, rect.y, rect.width, rect.height);
@ -1584,8 +1578,8 @@ static gint moz_gtk_tooltip_paint(cairo_t* cr, const GdkRectangle* aRect,
// 6px margin.
// For drawing Horizontal Box we have to inset drawing area by that 6px
// plus its CSS margin.
GtkStyleContext* boxStyle = GetStyleContext(MOZ_GTK_TOOLTIP_BOX,
state->scale, direction);
GtkStyleContext* boxStyle =
GetStyleContext(MOZ_GTK_TOOLTIP_BOX, state->scale, direction);
rect.x += 6;
rect.y += 6;
@ -1632,8 +1626,8 @@ static gint moz_gtk_resizer_paint(cairo_t* cr, GdkRectangle* rect,
static gint moz_gtk_frame_paint(cairo_t* cr, GdkRectangle* rect,
GtkWidgetState* state,
GtkTextDirection direction) {
GtkStyleContext* style = GetStyleContext(MOZ_GTK_FRAME, state->scale,
direction);
GtkStyleContext* style =
GetStyleContext(MOZ_GTK_FRAME, state->scale, direction);
gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
return MOZ_GTK_SUCCESS;
}
@ -1641,8 +1635,8 @@ static gint moz_gtk_frame_paint(cairo_t* cr, GdkRectangle* rect,
static gint moz_gtk_progressbar_paint(cairo_t* cr, GdkRectangle* rect,
GtkWidgetState* state,
GtkTextDirection direction) {
GtkStyleContext* style = GetStyleContext(MOZ_GTK_PROGRESS_TROUGH,
state->scale, direction);
GtkStyleContext* style =
GetStyleContext(MOZ_GTK_PROGRESS_TROUGH, state->scale, direction);
gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
gtk_render_frame(style, cr, rect->x, rect->y, rect->width, rect->height);
@ -1653,8 +1647,8 @@ static gint moz_gtk_progress_chunk_paint(cairo_t* cr, GdkRectangle* rect,
GtkWidgetState* state,
GtkTextDirection direction,
WidgetNodeType widget) {
GtkStyleContext* style = GetStyleContext(MOZ_GTK_PROGRESS_CHUNK,
state->scale, direction);
GtkStyleContext* style =
GetStyleContext(MOZ_GTK_PROGRESS_CHUNK, state->scale, direction);
if (widget == MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE ||
widget == MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE) {
@ -1739,8 +1733,8 @@ static gint moz_gtk_tab_paint(cairo_t* cr, GdkRectangle* rect,
int initial_gap = 0;
bool isBottomTab = (widget == MOZ_GTK_TAB_BOTTOM);
style =
GetStyleContext(widget, state->scale, direction, GetStateFlagsFromGtkTabFlags(flags));
style = GetStyleContext(widget, state->scale, direction,
GetStateFlagsFromGtkTabFlags(flags));
tabRect = *rect;
if (flags & MOZ_GTK_TAB_FIRST) {
@ -1901,8 +1895,8 @@ static gint moz_gtk_tab_paint(cairo_t* cr, GdkRectangle* rect,
static gint moz_gtk_tabpanels_paint(cairo_t* cr, GdkRectangle* rect,
GtkWidgetState* state,
GtkTextDirection direction) {
GtkStyleContext* style = GetStyleContext(MOZ_GTK_TABPANELS, state->scale,
direction);
GtkStyleContext* style =
GetStyleContext(MOZ_GTK_TABPANELS, state->scale, direction);
gtk_render_background(style, cr, rect->x, rect->y, rect->width, rect->height);
/*
* The gap size is not needed in moz_gtk_tabpanels_paint because
@ -2079,8 +2073,8 @@ static gint moz_gtk_menu_item_paint(WidgetNodeType widget, cairo_t* cr,
!(state_flags & GTK_STATE_FLAG_PRELIGHT)))
return MOZ_GTK_SUCCESS;
GtkStyleContext* style = GetStyleContext(widget, state->scale,
direction, state_flags);
GtkStyleContext* style =
GetStyleContext(widget, state->scale, direction, state_flags);
if (minorVersion < 6) {
// GTK+ 3.4 saves the style context and adds the menubar class to
@ -2196,8 +2190,7 @@ static gint moz_gtk_header_bar_paint(WidgetNodeType widgetType, cairo_t* cr,
GtkWidgetState* state) {
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
GtkStyleContext* style =
GetStyleContext(widgetType, state->scale, GTK_TEXT_DIR_NONE,
state_flags);
GetStyleContext(widgetType, state->scale, GTK_TEXT_DIR_NONE, state_flags);
// Some themes (Adwaita for instance) draws bold dark line at
// titlebar bottom. It does not fit well with Firefox tabs so
@ -2207,7 +2200,8 @@ static gint moz_gtk_header_bar_paint(WidgetNodeType widgetType, cairo_t* cr,
// We don't need to draw window decoration for MOZ_GTK_HEADER_BAR_MAXIMIZED,
// i.e. when main window is maximized.
if (widgetType == MOZ_GTK_HEADER_BAR) {
GtkStyleContext* windowStyle = GetStyleContext(MOZ_GTK_WINDOW, state->scale);
GtkStyleContext* windowStyle =
GetStyleContext(MOZ_GTK_WINDOW, state->scale);
bool solidDecorations =
gtk_style_context_has_class(windowStyle, "solid-csd");
GtkStyleContext* decorationStyle =
@ -2479,9 +2473,8 @@ gint moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
gint moz_gtk_get_tab_border(gint* left, gint* top, gint* right, gint* bottom,
GtkTextDirection direction, GtkTabFlags flags,
WidgetNodeType widget) {
GtkStyleContext* style =
GetStyleContext(widget, 1, direction,
GetStateFlagsFromGtkTabFlags(flags));
GtkStyleContext* style = GetStyleContext(widget, 1, direction,
GetStateFlagsFromGtkTabFlags(flags));
*left = *top = *right = *bottom = 0;
moz_gtk_add_style_padding(style, left, top, right, bottom);
@ -2855,14 +2848,16 @@ static void InitScrollbarMetrics(ScrollbarGTKMetrics* aMetrics,
*/
// thumb
style = CreateStyleContextWithStates(thumb, 1, GTK_TEXT_DIR_NONE, aStateFlags);
style =
CreateStyleContextWithStates(thumb, 1, GTK_TEXT_DIR_NONE, aStateFlags);
aMetrics->size.thumb = GetMinMarginBox(style);
gtk_style_context_get_margin(style, gtk_style_context_get_state(style),
&aMetrics->margin.thumb);
g_object_unref(style);
// track
style = CreateStyleContextWithStates(track, 1, GTK_TEXT_DIR_NONE, aStateFlags);
style =
CreateStyleContextWithStates(track, 1, GTK_TEXT_DIR_NONE, aStateFlags);
aMetrics->border.track = GetMarginBorderPadding(style);
MozGtkSize trackMinSize = GetMinContentBox(style) + aMetrics->border.track;
MozGtkSize trackSizeForThumb = aMetrics->size.thumb + aMetrics->border.track;
@ -3115,9 +3110,9 @@ gint moz_gtk_widget_paint(WidgetNodeType widget, cairo_t* cr,
break;
case MOZ_GTK_ENTRY:
case MOZ_GTK_DROPDOWN_ENTRY: {
GtkStyleContext* style = GetStyleContext(
widget, state->scale, direction,
GetStateFlagsFromGtkWidgetState(state));
GtkStyleContext* style =
GetStyleContext(widget, state->scale, direction,
GetStateFlagsFromGtkWidgetState(state));
gint ret = moz_gtk_entry_paint(cr, rect, state, style, widget);
return ret;
}

Просмотреть файл

@ -796,7 +796,7 @@ bool nsNativeThemeGTK::GetGtkWidgetAndState(StyleAppearance aAppearance,
class SystemCairoClipper : public ClipExporter {
public:
explicit SystemCairoClipper(cairo_t* aContext, gint aScaleFactor = 1)
: mContext(aContext), mScaleFactor(aScaleFactor) {}
: mContext(aContext), mScaleFactor(aScaleFactor) {}
void BeginClip(const Matrix& aTransform) override {
cairo_matrix_t mat;
@ -818,8 +818,7 @@ class SystemCairoClipper : public ClipExporter {
void BezierTo(const Point& aCP1, const Point& aCP2,
const Point& aCP3) override {
cairo_curve_to(mContext,
aCP1.x / mScaleFactor, aCP1.y / mScaleFactor,
cairo_curve_to(mContext, aCP1.x / mScaleFactor, aCP1.y / mScaleFactor,
aCP2.x / mScaleFactor, aCP2.y / mScaleFactor,
aCP3.x / mScaleFactor, aCP3.y / mScaleFactor);
mCurrentPoint = aCP3;
@ -851,7 +850,7 @@ class SystemCairoClipper : public ClipExporter {
private:
cairo_t* mContext;
Point mCurrentPoint;
gint mScaleFactor;
gint mScaleFactor;
};
static void DrawThemeWithCairo(gfxContext* aContext, DrawTarget* aDrawTarget,
@ -864,11 +863,10 @@ static void DrawThemeWithCairo(gfxContext* aContext, DrawTarget* aDrawTarget,
nsITheme::Transparency aTransparency) {
bool isX11Display = GDK_IS_X11_DISPLAY(gdk_display_get_default());
static auto sCairoSurfaceSetDeviceScalePtr =
(void (*)(cairo_surface_t *, double, double))dlsym(
RTLD_DEFAULT, "cairo_surface_set_device_scale");
(void (*)(cairo_surface_t*, double, double))dlsym(
RTLD_DEFAULT, "cairo_surface_set_device_scale");
// Support HiDPI widget styles on Wayland only for now.
bool useHiDPIWidgets = !isX11Display &&
(aScaleFactor != 1) &&
bool useHiDPIWidgets = !isX11Display && (aScaleFactor != 1) &&
(sCairoSurfaceSetDeviceScalePtr != nullptr);
Point drawOffsetScaled;
@ -877,14 +875,14 @@ static void DrawThemeWithCairo(gfxContext* aContext, DrawTarget* aDrawTarget,
if (!aSnapped) {
// If we are not snapped, we depend on the DT for translation.
drawOffsetOriginal = aDrawOrigin;
drawOffsetScaled = useHiDPIWidgets ? drawOffsetOriginal / aScaleFactor :
drawOffsetOriginal;
drawOffsetScaled = useHiDPIWidgets ? drawOffsetOriginal / aScaleFactor
: drawOffsetOriginal;
transform = aDrawTarget->GetTransform().PreTranslate(drawOffsetScaled);
} else {
// Otherwise, we only need to take the device offset into account.
drawOffsetOriginal = aDrawOrigin - aContext->GetDeviceOffset();
drawOffsetScaled = useHiDPIWidgets ? drawOffsetOriginal / aScaleFactor :
drawOffsetOriginal;
drawOffsetScaled = useHiDPIWidgets ? drawOffsetOriginal / aScaleFactor
: drawOffsetOriginal;
transform = Matrix::Translation(drawOffsetScaled);
}
@ -917,10 +915,9 @@ static void DrawThemeWithCairo(gfxContext* aContext, DrawTarget* aDrawTarget,
# else
if (!borrow.GetXRenderFormat()) {
# endif
surf = cairo_xlib_surface_create(borrow.GetDisplay(),
borrow.GetDrawable(),
borrow.GetVisual(),
size.width, size.height);
surf = cairo_xlib_surface_create(
borrow.GetDisplay(), borrow.GetDrawable(), borrow.GetVisual(),
size.width, size.height);
}
if (!NS_WARN_IF(!surf)) {
Point offset = borrow.GetOffset();
@ -972,7 +969,7 @@ static void DrawThemeWithCairo(gfxContext* aContext, DrawTarget* aDrawTarget,
cairo_t* cr = cairo_create(surf);
if (!NS_WARN_IF(!cr)) {
RefPtr<SystemCairoClipper> clipper =
new SystemCairoClipper(cr, useHiDPIWidgets ? aScaleFactor : 1);
new SystemCairoClipper(cr, useHiDPIWidgets ? aScaleFactor : 1);
aContext->ExportClip(*clipper);
cairo_set_matrix(cr, &mat);
@ -1028,13 +1025,12 @@ static void DrawThemeWithCairo(gfxContext* aContext, DrawTarget* aDrawTarget,
// The widget either needs to be masked or has transparency, so use the
// slower drawing path.
aDrawTarget->DrawSurface(
dataSurface,
Rect(aSnapped
? drawOffsetOriginal -
aDrawTarget->GetTransform().GetTranslation()
: drawOffsetOriginal,
Size(aDrawSize)),
Rect(0, 0, aDrawSize.width, aDrawSize.height));
dataSurface,
Rect(aSnapped ? drawOffsetOriginal -
aDrawTarget->GetTransform().GetTranslation()
: drawOffsetOriginal,
Size(aDrawSize)),
Rect(0, 0, aDrawSize.width, aDrawSize.height));
cairo_destroy(cr);
}