Merge mozilla-central to inbound. a=merge CLOSED TREE

This commit is contained in:
Gurzau Raul 2019-07-07 01:44:47 +03:00
Родитель 5f41be0510 f711552789
Коммит 93233f439a
170 изменённых файлов: 1458 добавлений и 2486 удалений

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

@ -131,7 +131,9 @@ class Toolbar extends PureComponent {
}),
dom.button({
id: "rotate-button",
className: "devtools-button",
className: `devtools-button viewport-orientation-${
viewport.width > viewport.height ? "landscape" : "portrait"
}`,
onClick: () => onRotateViewport(viewport.id),
title: getStr("responsive.rotate"),
}),

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

@ -1,6 +1,7 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- 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/. -->
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="context-fill #0b0b0b">
<path d="M3.8 13.4c-1.2 0-3.4-.6-3.7-2.8s1.3-3.3 2.1-3.5c.2-.1.4.1.5.3.1.2-.1.4-.3.5-.1 0-1.8.6-1.6 2.7.2 1.5 1.6 1.9 2.4 2l-.7-2.4c0-.2.2-.5.4-.5.2-.1.4 0 .5.2l.9 3c0 .1 0 .3-.1.4-.1.1-.2.1-.4.1zM12.3 1.7c1.2 0 3.4.6 3.7 2.8.3 2.2-1.3 3.3-2.1 3.5-.2.1-.4-.1-.5-.3s.1-.4.3-.5c.1 0 1.8-.6 1.6-2.7-.2-1.5-1.6-1.9-2.4-2l.7 2.4c.1.2-.1.4-.3.5s-.4-.1-.5-.3l-.9-3c0-.1 0-.3.1-.4h.3zM9.6 2.5L4.3 4.1c-.2.1-.4.4-.3.8l2.5 8c.1.3.4.6.8.5l5.2-1.6c.3-.1.6-.5.4-.8l-2.5-8c0-.1-.7-.6-.8-.5zm2.5 8.6l-5 1.5-.6-1.9 5-1.5.6 1.9zm-.8-2.6l-5 1.5-1.6-5.3 5-1.5 1.6 5.3z"/>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="context-fill" fill-rule="evenodd" d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H2zm6 2H2v10h6V3z"/>
<path fill="context-fill" d="M10.5 4c.62 0 1.07.03 1.4.11.34.08.53.2.66.34.14.16.25.4.33.83.08.42.11.98.11 1.72h-1.43a.2.2 0 0 0-.15.33l1.93 2.33c.08.1.22.1.3 0l1.93-2.33a.2.2 0 0 0-.15-.33H14c0-.76-.03-1.39-.13-1.9-.09-.52-.26-.96-.56-1.3-.3-.35-.7-.55-1.17-.66-.46-.1-1-.14-1.64-.14v1z"/>
</svg>

До

Ширина:  |  Высота:  |  Размер: 886 B

После

Ширина:  |  Высота:  |  Размер: 735 B

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

@ -1,6 +1,6 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- 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/. -->
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="context-fill #0b0b0b">
<path d="M12.5 5.3c-.2 0-.4 0-.6.1-.2-.6-.8-1-1.4-1-.3 0-.5.1-.8.2C9.4 4.2 9 4 8.6 4h-.4V1.5C8.2.7 7.5 0 6.7 0S5.2.7 5.2 1.5v6.6l-.7-.6c-.6-.6-1.6-.6-2.2 0-.5.6-.5 1.4-.1 2.1.3.4.6 1.1 1 1.8C4.2 13.6 5.3 16 7 16h3.9s3.1-1 3.1-4V6.7c.1-.8-.7-1.4-1.5-1.4zm.6 6.7c0 2-2.1 3-2.4 3H7c-1 0-2.1-2.4-2.9-4-.3-.8-.7-1.6-1-2-.2-.3-.2-.5-.1-.7.1-.1.2-.1.3-.1.1 0 .2 0 .3.1l1.5 1.5c.3.2.6.2.7.1.1 0 .4-.2.4-.5V1.5c0-.2.2-.4.5-.4s.5.2.5.4v5.3c0 .3.2.5.5.5s.5-.2.5-.5V5.5c0-.4.2-.5.5-.5.2 0 .5.2.5.4v2c-.1.3.2.6.4.6.3 0 .5-.2.5-.5V5.8c0-.2.2-.4.5-.4s.5.2.5.4v2.3c0 .3.2.5.5.5s.5-.2.5-.5V6.7c0-.2.2-.4.5-.4s.5.2.5.4V12z"/>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
<path fill="context-fill" d="M3.174 6.222A3.99 3.99 0 0 1 2.5 4a4 4 0 1 1 7.326 2.222l-.83-.556A2.99 2.99 0 0 0 9.5 4a3 3 0 1 0-5.495 1.666l-.831.556zM5 9.4V3.5a1.5 1.5 0 1 1 3 0v3.085a1.499 1.499 0 0 1 1.764.607 1.499 1.499 0 0 1 2 .5A1.5 1.5 0 0 1 14 9h-.004c0 .155-.023.313-.074.468l-1.791 5.494A1.5 1.5 0 0 1 10.739 16V16H6.695a2.5 2.5 0 0 1-2.202-1.315L1.975 10.01a1.5 1.5 0 0 1 .443-1.927l.04-.029c.04-.029.04-.029.083-.056a1.36 1.36 0 0 1 1.87.446L5 9.4zm6.18 5.253L12.97 9.16a.5.5 0 0 0-.847-.488A.498.498 0 0 0 12 9a.5.5 0 1 1-1 0v-.5a.5.5 0 1 0-1 0 .5.5 0 1 1-1 0V8a.5.5 0 1 0-1 0 .5.5 0 0 1-1 0V3.5a.5.5 0 0 0-1 0v7.667c0 .504-.662.691-.926.262L3.56 8.967a.36.36 0 0 0-.494-.118l-.007.004-.008.006-.007.005-.04.028a.5.5 0 0 0-.147.643l2.518 4.676a1.5 1.5 0 0 0 1.32.789h4.013v-.001a.5.5 0 0 0 .473-.346z"/>
</svg>

До

Ширина:  |  Высота:  |  Размер: 941 B

После

Ширина:  |  Высота:  |  Размер: 1.1 KiB

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

@ -225,6 +225,10 @@ input:-moz-focusring {
background-image: url("./images/rotate-viewport.svg");
}
#rotate-button.viewport-orientation-landscape::before {
transform: rotate(90deg) scaleX(-1);
}
#touch-simulation-button::before {
background-image: url("./images/touch-events.svg");
}

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

@ -270,9 +270,10 @@ class nsDocShell final : public nsDocLoader,
LOCATION_CHANGE_SAME_DOCUMENT);
}
// This function is created exclusively for dom.background_loading_iframe is set.
// As soon as the current DocShell knows itself can be treated as background loading,
// it triggers the parent docshell to see if the parent document can fire load event earlier.
// This function is created exclusively for dom.background_loading_iframe is
// set. As soon as the current DocShell knows itself can be treated as
// background loading, it triggers the parent docshell to see if the parent
// document can fire load event earlier.
void TriggerParentCheckDocShellIsEmpty() {
RefPtr<nsDocShell> parent = GetParentDocshell();
if (parent) {

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

@ -113,7 +113,6 @@ struct MOZ_STACK_CLASS BindContext final {
}
private:
static bool IsLikelyUndisplayed(const nsINode& aParent) {
return aParent.IsAnyOfHTMLElements(nsGkAtoms::style, nsGkAtoms::script);
}

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

@ -147,19 +147,26 @@ void DOMMatrixReadOnly::SetDataFromMatrixInit(DOMMatrixInit& aMatrixInit) {
}
already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::FromMatrix(
const GlobalObject& aGlobal, const DOMMatrixInit& aMatrixInit,
ErrorResult& aRv) {
nsISupports* aParent, const DOMMatrixInit& aMatrixInit, ErrorResult& aRv) {
DOMMatrixInit matrixInit(aMatrixInit);
if (!ValidateAndFixupMatrixInit(matrixInit, aRv)) {
return nullptr;
};
RefPtr<DOMMatrixReadOnly> rval =
new DOMMatrixReadOnly(aGlobal.GetAsSupports(), matrixInit.mIs2D.Value());
new DOMMatrixReadOnly(aParent, matrixInit.mIs2D.Value());
rval->SetDataFromMatrixInit(matrixInit);
return rval.forget();
}
already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::FromMatrix(
const GlobalObject& aGlobal, const DOMMatrixInit& aMatrixInit,
ErrorResult& aRv) {
RefPtr<DOMMatrixReadOnly> matrix =
FromMatrix(aGlobal.GetAsSupports(), aMatrixInit, aRv);
return matrix.forget();
}
already_AddRefed<DOMMatrixReadOnly> DOMMatrixReadOnly::FromFloat32Array(
const GlobalObject& aGlobal, const Float32Array& aArray32,
ErrorResult& aRv) {

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

@ -56,6 +56,9 @@ class DOMMatrixReadOnly : public nsWrapperCache {
virtual JSObject* WrapObject(JSContext* cx,
JS::Handle<JSObject*> aGivenProto) override;
static already_AddRefed<DOMMatrixReadOnly> FromMatrix(
nsISupports* aParent, const DOMMatrixInit& aMatrixInit, ErrorResult& aRv);
static already_AddRefed<DOMMatrixReadOnly> FromMatrix(
const GlobalObject& aGlobal, const DOMMatrixInit& aMatrixInit,
ErrorResult& aRv);

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

@ -37,6 +37,22 @@ JSObject* DOMPointReadOnly::WrapObject(JSContext* aCx,
return DOMPointReadOnly_Binding::Wrap(aCx, this, aGivenProto);
}
already_AddRefed<DOMPoint> DOMPointReadOnly::MatrixTransform(
const DOMMatrixInit& aInit, ErrorResult& aRv) {
RefPtr<DOMMatrixReadOnly> matrix =
DOMMatrixReadOnly::FromMatrix(mParent, aInit, aRv);
if (aRv.Failed()) {
return nullptr;
}
DOMPointInit init;
init.mX = this->mX;
init.mY = this->mY;
init.mZ = this->mZ;
init.mW = this->mW;
RefPtr<DOMPoint> point = matrix->TransformPoint(init);
return point.forget();
}
// https://drafts.fxtf.org/geometry/#structured-serialization
bool DOMPointReadOnly::WriteStructuredClone(
JSContext* aCx, JSStructuredCloneWriter* aWriter) const {

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

@ -23,6 +23,7 @@ namespace dom {
class GlobalObject;
struct DOMPointInit;
struct DOMMatrixInit;
class DOMPointReadOnly : public nsWrapperCache {
public:
@ -44,6 +45,9 @@ class DOMPointReadOnly : public nsWrapperCache {
double Z() const { return mZ; }
double W() const { return mW; }
already_AddRefed<DOMPoint> MatrixTransform(const DOMMatrixInit& aInit,
ErrorResult& aRv);
nsISupports* GetParentObject() const { return mParent; }
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;

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

@ -194,14 +194,12 @@ void DocGroup::SignalSlotChange(HTMLSlotElement& aSlot) {
}
bool DocGroup::TryToLoadIframesInBackground() {
return
StaticPrefs::dom_separate_event_queue_for_post_message_enabled() &&
StaticPrefs::dom_cross_origin_iframes_loaded_in_background();
return StaticPrefs::dom_separate_event_queue_for_post_message_enabled() &&
StaticPrefs::dom_cross_origin_iframes_loaded_in_background();
}
nsresult DocGroup::QueueIframePostMessages(
already_AddRefed<nsIRunnable>&& aRunnable,
uint64_t aWindowId) {
already_AddRefed<nsIRunnable>&& aRunnable, uint64_t aWindowId) {
if (DocGroup::TryToLoadIframesInBackground()) {
if (!mIframePostMessageQueue) {
nsCOMPtr<nsISerialEventTarget> target = GetMainThreadSerialEventTarget();
@ -221,8 +219,7 @@ nsresult DocGroup::QueueIframePostMessages(
mIframesUsedPostMessageQueue.PutEntry(aWindowId);
mIframePostMessageQueue->Dispatch(std::move(aRunnable),
NS_DISPATCH_NORMAL);
mIframePostMessageQueue->Dispatch(std::move(aRunnable), NS_DISPATCH_NORMAL);
return NS_OK;
}
return NS_ERROR_FAILURE;
@ -231,8 +228,7 @@ nsresult DocGroup::QueueIframePostMessages(
void DocGroup::TryFlushIframePostMessages(uint64_t aWindowId) {
if (DocGroup::TryToLoadIframesInBackground()) {
mIframesUsedPostMessageQueue.RemoveEntry(aWindowId);
if (mIframePostMessageQueue &&
mIframesUsedPostMessageQueue.IsEmpty()) {
if (mIframePostMessageQueue && mIframesUsedPostMessageQueue.IsEmpty()) {
MOZ_ASSERT(mIframePostMessageQueue->IsPaused());
nsresult rv = mIframePostMessageQueue->SetIsPaused(true);
MOZ_ALWAYS_SUCCEEDS(rv);

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

@ -105,9 +105,8 @@ class DocGroup final {
// Returns true if any of its documents are active but not in the bfcache.
bool IsActive() const;
nsresult QueueIframePostMessages(
already_AddRefed<nsIRunnable>&& aRunnable,
uint64_t aWindowId);
nsresult QueueIframePostMessages(already_AddRefed<nsIRunnable>&& aRunnable,
uint64_t aWindowId);
void TryFlushIframePostMessages(uint64_t aWindowId);

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

@ -2211,7 +2211,7 @@ nsresult Document::Init() {
// we need to create a policy here so getting the policy within
// ::Policy() can *always* return a non null policy
mFeaturePolicy = new FeaturePolicy(this);
mFeaturePolicy = new mozilla::dom::FeaturePolicy(this);
mFeaturePolicy->SetDefaultOrigin(NodePrincipal());
mStyleSet = MakeUnique<ServoStyleSet>(*this);
@ -3275,14 +3275,14 @@ nsresult Document::InitFeaturePolicy(nsIChannel* aChannel) {
mFeaturePolicy->SetDefaultOrigin(NodePrincipal());
RefPtr<FeaturePolicy> parentPolicy = nullptr;
RefPtr<mozilla::dom::FeaturePolicy> parentPolicy = nullptr;
if (mDocumentContainer) {
nsPIDOMWindowOuter* containerWindow = mDocumentContainer->GetWindow();
if (containerWindow) {
nsCOMPtr<nsINode> node = containerWindow->GetFrameElementInternal();
HTMLIFrameElement* iframe = HTMLIFrameElement::FromNodeOrNull(node);
if (iframe) {
parentPolicy = iframe->Policy();
parentPolicy = iframe->FeaturePolicy();
}
}
}
@ -12573,10 +12573,10 @@ void Document::MaybeResolveReadyForIdle() {
}
}
FeaturePolicy* Document::Policy() const {
mozilla::dom::FeaturePolicy* Document::FeaturePolicy() const {
// The policy is created when the document is initialized. We _must_ have a
// policy here even if the featurePolicy pref is off. If this assertion fails,
// it means that ::Policy() is called before ::StartDocumentLoad().
// it means that ::FeaturePolicy() is called before ::StartDocumentLoad().
MOZ_ASSERT(mFeaturePolicy);
return mFeaturePolicy;
}

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

@ -4052,7 +4052,7 @@ class Document : public nsINode,
mAllowPaymentRequest = aAllowPaymentRequest;
}
FeaturePolicy* Policy() const;
mozilla::dom::FeaturePolicy* FeaturePolicy() const;
bool ModuleScriptsEnabled();
@ -4474,7 +4474,7 @@ class Document : public nsINode,
RefPtr<Promise> mReadyForIdle;
RefPtr<FeaturePolicy> mFeaturePolicy;
RefPtr<mozilla::dom::FeaturePolicy> mFeaturePolicy;
UniquePtr<ResizeObserverController> mResizeObserverController;

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

@ -161,9 +161,7 @@ class ShadowRoot final : public DocumentFragment,
void PartAdded(const Element&);
void PartRemoved(const Element&);
const nsTArray<const Element*>& Parts() const {
return mParts;
}
const nsTArray<const Element*>& Parts() const { return mParts; }
const RawServoAuthorStyles* GetServoStyles() const {
return mServoStyles.get();

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

@ -1443,7 +1443,7 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
: Runnable("DeprioritizedLoadRunner"), mInner(aInner) {}
NS_IMETHOD Run() override {
if (mInner) {;
if (mInner) {
RefPtr<nsIRunnable> inner = std::move(mInner);
inner->Run();
}

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

@ -541,6 +541,7 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
nsresult GetPrompter(nsIPrompt** aPrompt) override;
RefPtr<mozilla::ThrottledEventQueue> mPostMessageEventQueue;
protected:
nsPIDOMWindowOuter* GetOpenerWindowOuter();
// Initializes the mWasOffline member variable

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

@ -1146,7 +1146,6 @@ nsresult nsImageLoadingContent::LoadImage(nsIURI* aNewURI, bool aForce,
nsLoadFlags loadFlags =
aLoadFlags | nsContentUtils::CORSModeToLoadImageFlags(GetCORSMode());
RefPtr<imgRequestProxy>& req = PrepareNextRequest(aImageLoadType);
nsCOMPtr<nsIContent> content =
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));

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

@ -320,8 +320,9 @@ void nsNodeUtils::LastRelease(nsINode* aNode) {
aNode->UnsetFlags(NODE_HAS_LISTENERMANAGER);
}
NS_ASSERTION(!Element::FromNode(aNode) ||
!Element::FromNode(aNode)->GetXBLBinding(), "Node has binding on destruction");
NS_ASSERTION(
!Element::FromNode(aNode) || !Element::FromNode(aNode)->GetXBLBinding(),
"Node has binding on destruction");
aNode->ReleaseWrapper(aNode);

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

@ -172,8 +172,7 @@ class RemoteObjectProxy : public RemoteObjectProxyBase {
* represents an object implementing the WebIDL interface for
* aProtoID.
*/
inline bool IsRemoteObjectProxy(JSObject* aObj,
prototypes::ID aProtoID) {
inline bool IsRemoteObjectProxy(JSObject* aObj, prototypes::ID aProtoID) {
if (!js::IsProxy(aObj)) {
return false;
}

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

@ -13,7 +13,8 @@ void StartGamepadMonitoring() {}
void StopGamepadMonitoring() {}
void SetGamepadLightIndicatorColor(uint32_t, uint32_t, uint8_t, uint8_t, uint8_t) {}
void SetGamepadLightIndicatorColor(uint32_t, uint32_t, uint8_t, uint8_t,
uint8_t) {}
} // namespace dom
} // namespace mozilla

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

@ -54,7 +54,7 @@ HTMLIFrameElement::HTMLIFrameElement(
FromParser aFromParser)
: nsGenericHTMLFrameElement(std::move(aNodeInfo), aFromParser) {
// We always need a featurePolicy, even if not exposed.
mFeaturePolicy = new FeaturePolicy(this);
mFeaturePolicy = new mozilla::dom::FeaturePolicy(this);
nsCOMPtr<nsIPrincipal> origin = GetFeaturePolicyDefaultOrigin();
MOZ_ASSERT(origin);
@ -224,7 +224,9 @@ JSObject* HTMLIFrameElement::WrapNode(JSContext* aCx,
return HTMLIFrameElement_Binding::Wrap(aCx, this, aGivenProto);
}
FeaturePolicy* HTMLIFrameElement::Policy() const { return mFeaturePolicy; }
mozilla::dom::FeaturePolicy* HTMLIFrameElement::FeaturePolicy() const {
return mFeaturePolicy;
}
already_AddRefed<nsIPrincipal>
HTMLIFrameElement::GetFeaturePolicyDefaultOrigin() const {
@ -268,7 +270,7 @@ void HTMLIFrameElement::RefreshFeaturePolicy(bool aParseAllowAttribute) {
origin);
}
mFeaturePolicy->InheritPolicy(OwnerDoc()->Policy());
mFeaturePolicy->InheritPolicy(OwnerDoc()->FeaturePolicy());
}
if (AllowPaymentRequest()) {

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

@ -154,7 +154,7 @@ class HTMLIFrameElement final : public nsGenericHTMLFrameElement {
bool FullscreenFlag() const { return mFullscreenFlag; }
void SetFullscreenFlag(bool aValue) { mFullscreenFlag = aValue; }
FeaturePolicy* Policy() const;
mozilla::dom::FeaturePolicy* FeaturePolicy() const;
protected:
virtual ~HTMLIFrameElement();

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

@ -293,8 +293,8 @@ bool nsIFormControl::IsSingleLineTextControl(bool aExcludePassword,
bool nsIFormControl::IsSubmittableControl() const {
uint32_t type = ControlType();
return type == NS_FORM_OBJECT || type == NS_FORM_TEXTAREA ||
type == NS_FORM_SELECT ||
type & NS_FORM_BUTTON_ELEMENT || type & NS_FORM_INPUT_ELEMENT;
type == NS_FORM_SELECT || type & NS_FORM_BUTTON_ELEMENT ||
type & NS_FORM_INPUT_ELEMENT;
}
bool nsIFormControl::AllowDraggableChildren() const {

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

@ -256,9 +256,9 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
JS::Handle<JSObject*> aCpows,
nsIPrincipal* aPrincipal) override;
bool DoUpdateZoomConstraints(
const uint32_t& aPresShellId, const ViewID& aViewId,
const Maybe<ZoomConstraints>& aConstraints);
bool DoUpdateZoomConstraints(const uint32_t& aPresShellId,
const ViewID& aViewId,
const Maybe<ZoomConstraints>& aConstraints);
mozilla::ipc::IPCResult RecvLoadURL(const nsCString& aURI,
const ShowInfo& aInfo);

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

@ -4387,8 +4387,8 @@ nsresult Connection::BeginWriteTransaction() {
MOZ_ASSERT(mStorageConnection);
CachedStatement stmt;
nsresult rv = GetCachedStatement(NS_LITERAL_CSTRING("BEGIN IMMEDIATE;"),
&stmt);
nsresult rv =
GetCachedStatement(NS_LITERAL_CSTRING("BEGIN IMMEDIATE;"), &stmt);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
@ -9425,9 +9425,7 @@ QuotaClient::MatchFunction::OnFunctionCall(
******************************************************************************/
AutoWriteTransaction::AutoWriteTransaction(bool aShadowWrites)
: mConnection(nullptr)
, mShadowWrites(aShadowWrites)
{
: mConnection(nullptr), mShadowWrites(aShadowWrites) {
AssertIsOnConnectionThread();
MOZ_COUNT_CTOR(mozilla::dom::AutoWriteTransaction);
@ -9494,7 +9492,8 @@ nsresult AutoWriteTransaction::Commit() {
return NS_OK;
}
nsresult AutoWriteTransaction::LockAndAttachShadowDatabase(Connection* aConnection) {
nsresult AutoWriteTransaction::LockAndAttachShadowDatabase(
Connection* aConnection) {
AssertIsOnConnectionThread();
MOZ_ASSERT(aConnection);
MOZ_ASSERT(!mConnection);
@ -9511,7 +9510,8 @@ nsresult AutoWriteTransaction::LockAndAttachShadowDatabase(Connection* aConnecti
mShadowDatabaseLock.emplace(
aConnection->GetQuotaClient()->ShadowDatabaseMutex());
nsresult rv = AttachShadowDatabase(quotaManager->GetBasePath(), storageConnection);
nsresult rv =
AttachShadowDatabase(quotaManager->GetBasePath(), storageConnection);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}

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

@ -74,7 +74,8 @@ static uint32_t SiteAutoplayPerm(const Document* aDocument) {
NS_ENSURE_TRUE(permMgr, nsIPermissionManager::DENY_ACTION);
uint32_t perm;
nsresult rv = permMgr->TestExactPermissionFromPrincipal(principal, NS_LITERAL_CSTRING("autoplay-media"), &perm);
nsresult rv = permMgr->TestExactPermissionFromPrincipal(
principal, NS_LITERAL_CSTRING("autoplay-media"), &perm);
NS_ENSURE_SUCCESS(rv, nsIPermissionManager::DENY_ACTION);
return perm;
}
@ -187,9 +188,10 @@ static bool IsAllowedToPlayInternal(const HTMLMediaElement& aElement) {
uint32_t defaultBehaviour = DefaultAutoplayBehaviour();
uint32_t sitePermission = SiteAutoplayPerm(approver);
AUTOPLAY_LOG("IsAllowedToPlayInternal, isInaudible=%d,"
"isUsingAutoplayModel=%d, sitePermission=%d, defaultBehaviour=%d",
isInaudible, isUsingAutoplayModel, sitePermission, defaultBehaviour);
AUTOPLAY_LOG(
"IsAllowedToPlayInternal, isInaudible=%d,"
"isUsingAutoplayModel=%d, sitePermission=%d, defaultBehaviour=%d",
isInaudible, isUsingAutoplayModel, sitePermission, defaultBehaviour);
// For site permissions we store permissionManager values except
// for BLOCKED_ALL, for the default pref values we store

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

@ -13,6 +13,7 @@
#include "WebAudioUtils.h"
#include "blink/Biquad.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/ErrorResult.h"
#include "AudioParamTimeline.h"
namespace mozilla {
@ -299,16 +300,21 @@ void BiquadFilterNode::SetType(BiquadFilterType aType) {
static_cast<int32_t>(aType));
}
void BiquadFilterNode::GetFrequencyResponse(
const Float32Array& aFrequencyHz, const Float32Array& aMagResponse,
const Float32Array& aPhaseResponse) {
void BiquadFilterNode::GetFrequencyResponse(const Float32Array& aFrequencyHz,
const Float32Array& aMagResponse,
const Float32Array& aPhaseResponse,
ErrorResult& aRv) {
aFrequencyHz.ComputeLengthAndData();
aMagResponse.ComputeLengthAndData();
aPhaseResponse.ComputeLengthAndData();
uint32_t length =
std::min(std::min(aFrequencyHz.Length(), aMagResponse.Length()),
aPhaseResponse.Length());
if (!(aFrequencyHz.Length() == aMagResponse.Length() &&
aMagResponse.Length() == aPhaseResponse.Length())) {
aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
return;
}
uint32_t length = aFrequencyHz.Length();
if (!length) {
return;
}

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

@ -48,7 +48,8 @@ class BiquadFilterNode final : public AudioNode {
void GetFrequencyResponse(const Float32Array& aFrequencyHz,
const Float32Array& aMagResponse,
const Float32Array& aPhaseResponse);
const Float32Array& aPhaseResponse,
ErrorResult& aRv);
const char* NodeType() const override { return "BiquadFilterNode"; }

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

@ -90,7 +90,7 @@ void FeaturePolicy::ResetDeclaredPolicy() { mFeatures.Clear(); }
JSObject* FeaturePolicy::WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) {
return Policy_Binding::Wrap(aCx, this, aGivenProto);
return FeaturePolicy_Binding::Wrap(aCx, this, aGivenProto);
}
bool FeaturePolicy::AllowsFeature(const nsAString& aFeatureName,
@ -148,6 +148,16 @@ bool FeaturePolicy::AllowsFeatureInternal(const nsAString& aFeatureName,
return false;
}
void FeaturePolicy::Features(nsTArray<nsString>& aFeatures) {
RefPtr<FeaturePolicy> self = this;
FeaturePolicyUtils::ForEachFeature(
[self, &aFeatures](const char* aFeatureName) {
nsString featureName;
featureName.AppendASCII(aFeatureName);
aFeatures.AppendElement(featureName);
});
}
void FeaturePolicy::AllowedFeatures(nsTArray<nsString>& aAllowedFeatures) {
RefPtr<FeaturePolicy> self = this;
FeaturePolicyUtils::ForEachFeature(

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

@ -113,6 +113,8 @@ class FeaturePolicy final : public nsISupports, public nsWrapperCache {
bool AllowsFeature(const nsAString& aFeatureName,
const Optional<nsAString>& aOrigin) const;
void Features(nsTArray<nsString>& aFeatures);
void AllowedFeatures(nsTArray<nsString>& aAllowedFeatures);
void GetAllowlistForFeature(const nsAString& aFeatureName,

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

@ -92,7 +92,7 @@ bool FeaturePolicyUtils::IsFeatureAllowed(Document* aDocument,
return true;
}
FeaturePolicy* policy = aDocument->Policy();
FeaturePolicy* policy = aDocument->FeaturePolicy();
MOZ_ASSERT(policy);
if (policy->AllowsFeatureInternal(aFeatureName, policy->DefaultOrigin())) {

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

@ -8,3 +8,4 @@ support-files =
test_parser.html^headers^
[test_parser.html]
[test_featureList.html]

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

@ -0,0 +1,42 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test feature policy - list</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<iframe src="empty.html" id="ifr"></iframe>
<script type="text/javascript">
let supportedFeatures = [
"autoplay",
"camera",
"encrypted-media",
"fullscreen",
"geolocation",
"microphone",
"midi",
"payment",
"display-capture",
"document-domain",
"speaker",
"vr",
];
function checkFeatures(features) {
features.forEach(feature => {
ok(supportedFeatures.includes(feature), "Feature: " + feature);
});
}
ok("featurePolicy" in document, "We have document.featurePolicy");
checkFeatures(document.featurePolicy.features());
let ifr = document.getElementById("ifr");
ok("featurePolicy" in ifr, "We have HTMLIFrameElement.featurePolicy");
checkFeatures(ifr.featurePolicy.features());
</script>
</body>
</html>

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

@ -12,40 +12,40 @@
SimpleTest.waitForExplicitFinish();
function test_document() {
info("Checking document.policy");
ok("policy" in document, "We have document.policy");
info("Checking document.featurePolicy");
ok("featurePolicy" in document, "We have document.featurePolicy");
ok(!document.policy.allowsFeature("foobar"), "Random feature");
ok(!document.policy.allowsFeature("foobar", "http://www.something.net"), "Random feature");
ok(!document.featurePolicy.allowsFeature("foobar"), "Random feature");
ok(!document.featurePolicy.allowsFeature("foobar", "http://www.something.net"), "Random feature");
ok(document.policy.allowsFeature("camera"), "Camera is allowed for self");
ok(document.policy.allowsFeature("camera", "http://foo.bar"), "Camera is always allowed");
let allowed = document.policy.getAllowlistForFeature("camera");
ok(document.featurePolicy.allowsFeature("camera"), "Camera is allowed for self");
ok(document.featurePolicy.allowsFeature("camera", "http://foo.bar"), "Camera is always allowed");
let allowed = document.featurePolicy.getAllowlistForFeature("camera");
is(allowed.length, 1, "Only 1 entry in allowlist for camera");
is(allowed[0], "*", "allowlist is *");
ok(document.policy.allowsFeature("geolocation"), "Geolocation is allowed for self");
ok(document.policy.allowsFeature("geolocation", location.origin), "Geolocation is allowed for self");
ok(!document.policy.allowsFeature("geolocation", "http://foo.bar"), "Geolocation is not allowed for any random URL");
allowed = document.policy.getAllowlistForFeature("geolocation");
ok(document.featurePolicy.allowsFeature("geolocation"), "Geolocation is allowed for self");
ok(document.featurePolicy.allowsFeature("geolocation", location.origin), "Geolocation is allowed for self");
ok(!document.featurePolicy.allowsFeature("geolocation", "http://foo.bar"), "Geolocation is not allowed for any random URL");
allowed = document.featurePolicy.getAllowlistForFeature("geolocation");
is(allowed.length, 1, "Only 1 entry in allowlist for geolocation");
is(allowed[0], location.origin, "allowlist is self");
ok(!document.policy.allowsFeature("microphone"), "Microphone is disabled for self");
ok(!document.policy.allowsFeature("microphone", location.origin), "Microphone is disabled for self");
ok(!document.policy.allowsFeature("microphone", "http://foo.bar"), "Microphone is disabled for foo.bar");
ok(document.policy.allowsFeature("microphone", "http://example.com"), "Microphone is allowed for example.com");
ok(document.policy.allowsFeature("microphone", "http://example.org"), "Microphone is allowed for example.org");
allowed = document.policy.getAllowlistForFeature("microphone");
ok(!document.featurePolicy.allowsFeature("microphone"), "Microphone is disabled for self");
ok(!document.featurePolicy.allowsFeature("microphone", location.origin), "Microphone is disabled for self");
ok(!document.featurePolicy.allowsFeature("microphone", "http://foo.bar"), "Microphone is disabled for foo.bar");
ok(document.featurePolicy.allowsFeature("microphone", "http://example.com"), "Microphone is allowed for example.com");
ok(document.featurePolicy.allowsFeature("microphone", "http://example.org"), "Microphone is allowed for example.org");
allowed = document.featurePolicy.getAllowlistForFeature("microphone");
is(allowed.length, 0, "No allowlist for microphone");
ok(!document.policy.allowsFeature("vr"), "Vibrate is disabled for self");
ok(!document.policy.allowsFeature("vr", location.origin), "Vibrate is disabled for self");
ok(!document.policy.allowsFeature("vr", "http://foo.bar"), "Vibrate is disabled for foo.bar");
allowed = document.policy.getAllowlistForFeature("vr");
ok(!document.featurePolicy.allowsFeature("vr"), "Vibrate is disabled for self");
ok(!document.featurePolicy.allowsFeature("vr", location.origin), "Vibrate is disabled for self");
ok(!document.featurePolicy.allowsFeature("vr", "http://foo.bar"), "Vibrate is disabled for foo.bar");
allowed = document.featurePolicy.getAllowlistForFeature("vr");
is(allowed.length, 0, "No allowlist for vr");
allowed = document.policy.allowedFeatures();
allowed = document.featurePolicy.allowedFeatures();
// microphone is disabled for this origin, vr is disabled everywhere.
let camera = false;
let geolocation = false;
@ -61,136 +61,136 @@ function test_document() {
}
function test_iframe_without_allow() {
info("Checking HTMLIFrameElement.policy");
info("Checking HTMLIFrameElement.featurePolicy");
let ifr = document.getElementById("ifr");
ok("policy" in ifr, "HTMLIFrameElement.policy exists");
ok("featurePolicy" in ifr, "HTMLIFrameElement.featurePolicy exists");
ok(!ifr.policy.allowsFeature("foobar"), "Random feature");
ok(!ifr.policy.allowsFeature("foobar", "http://www.something.net"), "Random feature");
ok(!ifr.featurePolicy.allowsFeature("foobar"), "Random feature");
ok(!ifr.featurePolicy.allowsFeature("foobar", "http://www.something.net"), "Random feature");
ok(ifr.policy.allowsFeature("camera"), "Camera is allowed for self");
ok(ifr.policy.allowsFeature("camera", location.origin), "Camera is allowed for self");
ok(!ifr.policy.allowsFeature("camera", "http://foo.bar"), "Camera is not allowed for a random URL");
let allowed = ifr.policy.getAllowlistForFeature("camera");
ok(ifr.featurePolicy.allowsFeature("camera"), "Camera is allowed for self");
ok(ifr.featurePolicy.allowsFeature("camera", location.origin), "Camera is allowed for self");
ok(!ifr.featurePolicy.allowsFeature("camera", "http://foo.bar"), "Camera is not allowed for a random URL");
let allowed = ifr.featurePolicy.getAllowlistForFeature("camera");
is(allowed.length, 1, "Only 1 entry in allowlist for camera");
is(allowed[0], location.origin, "allowlist is 'self'");
ok(ifr.policy.allowsFeature("geolocation"), "Geolocation is allowed for all");
ok(ifr.policy.allowsFeature("geolocation", location.origin), "Geolocation is allowed for all");
ok(ifr.policy.allowsFeature("geolocation", "http://foo.bar"), "Geolocation is allowed for any random URL");
allowed = ifr.policy.getAllowlistForFeature("geolocation");
ok(ifr.featurePolicy.allowsFeature("geolocation"), "Geolocation is allowed for all");
ok(ifr.featurePolicy.allowsFeature("geolocation", location.origin), "Geolocation is allowed for all");
ok(ifr.featurePolicy.allowsFeature("geolocation", "http://foo.bar"), "Geolocation is allowed for any random URL");
allowed = ifr.featurePolicy.getAllowlistForFeature("geolocation");
is(allowed.length, 1, "Only 1 entry in allowlist for geolocation");
is(allowed[0], "*", "allowlist is '*'");
ok(!ifr.policy.allowsFeature("microphone"), "Microphone is disabled for self");
ok(!ifr.policy.allowsFeature("microphone", location.origin), "Microphone is disabled for self");
ok(!ifr.policy.allowsFeature("microphone", "http://foo.bar"), "Microphone is disabled for foo.bar");
ok(!ifr.policy.allowsFeature("microphone", "http://example.com"), "Microphone is disabled for example.com");
ok(!ifr.policy.allowsFeature("microphone", "http://example.org"), "Microphone is disabled for example.org");
allowed = ifr.policy.getAllowlistForFeature("microphone");
ok(!ifr.featurePolicy.allowsFeature("microphone"), "Microphone is disabled for self");
ok(!ifr.featurePolicy.allowsFeature("microphone", location.origin), "Microphone is disabled for self");
ok(!ifr.featurePolicy.allowsFeature("microphone", "http://foo.bar"), "Microphone is disabled for foo.bar");
ok(!ifr.featurePolicy.allowsFeature("microphone", "http://example.com"), "Microphone is disabled for example.com");
ok(!ifr.featurePolicy.allowsFeature("microphone", "http://example.org"), "Microphone is disabled for example.org");
allowed = ifr.featurePolicy.getAllowlistForFeature("microphone");
is(allowed.length, 0, "No allowlist for microphone");
ok(!ifr.policy.allowsFeature("vr"), "Vibrate is disabled for self");
ok(!ifr.policy.allowsFeature("vr", location.origin), "Vibrate is disabled for self");
ok(!ifr.policy.allowsFeature("vr", "http://foo.bar"), "Vibrate is disabled for foo.bar");
allowed = ifr.policy.getAllowlistForFeature("vr");
ok(!ifr.featurePolicy.allowsFeature("vr"), "Vibrate is disabled for self");
ok(!ifr.featurePolicy.allowsFeature("vr", location.origin), "Vibrate is disabled for self");
ok(!ifr.featurePolicy.allowsFeature("vr", "http://foo.bar"), "Vibrate is disabled for foo.bar");
allowed = ifr.featurePolicy.getAllowlistForFeature("vr");
is(allowed.length, 0, "No allowlist for vr");
ok(ifr.policy.allowedFeatures().includes("camera"), "Camera is allowed");
ok(ifr.policy.allowedFeatures().includes("geolocation"), "Geolocation is allowed");
ok(ifr.featurePolicy.allowedFeatures().includes("camera"), "Camera is allowed");
ok(ifr.featurePolicy.allowedFeatures().includes("geolocation"), "Geolocation is allowed");
// microphone is disabled for this origin
ok(!ifr.policy.allowedFeatures().includes("microphone"), "microphone is not allowed");
ok(!ifr.featurePolicy.allowedFeatures().includes("microphone"), "microphone is not allowed");
// vr is disabled everywhere.
ok(!ifr.policy.allowedFeatures().includes("vr"), "VR is not allowed");
ok(!ifr.featurePolicy.allowedFeatures().includes("vr"), "VR is not allowed");
next();
}
function test_iframe_with_allow() {
info("Checking HTMLIFrameElement.policy");
info("Checking HTMLIFrameElement.featurePolicy");
let ifr = document.getElementById("ifr");
ok("policy" in ifr, "HTMLIFrameElement.policy exists");
ok("featurePolicy" in ifr, "HTMLIFrameElement.featurePolicy exists");
ifr.setAttribute("allow", "camera 'none'");
ok(!ifr.policy.allowsFeature("foobar"), "Random feature");
ok(!ifr.policy.allowsFeature("foobar", "http://www.something.net"), "Random feature");
ok(!ifr.featurePolicy.allowsFeature("foobar"), "Random feature");
ok(!ifr.featurePolicy.allowsFeature("foobar", "http://www.something.net"), "Random feature");
ok(!ifr.policy.allowsFeature("camera"), "Camera is not allowed");
let allowed = ifr.policy.getAllowlistForFeature("camera");
ok(!ifr.featurePolicy.allowsFeature("camera"), "Camera is not allowed");
let allowed = ifr.featurePolicy.getAllowlistForFeature("camera");
is(allowed.length, 0, "Camera has an empty allowlist");
ok(ifr.policy.allowsFeature("geolocation"), "Geolocation is allowed for all");
ok(ifr.policy.allowsFeature("geolocation", location.origin), "Geolocation is allowed for all");
ok(ifr.policy.allowsFeature("geolocation", "http://foo.bar"), "Geolocation is allowed for all");
allowed = ifr.policy.getAllowlistForFeature("geolocation");
ok(ifr.featurePolicy.allowsFeature("geolocation"), "Geolocation is allowed for all");
ok(ifr.featurePolicy.allowsFeature("geolocation", location.origin), "Geolocation is allowed for all");
ok(ifr.featurePolicy.allowsFeature("geolocation", "http://foo.bar"), "Geolocation is allowed for all");
allowed = ifr.featurePolicy.getAllowlistForFeature("geolocation");
is(allowed.length, 1, "Only 1 entry in allowlist for geolocation");
is(allowed[0], "*", "allowlist is '*'");
ok(!ifr.policy.allowsFeature("microphone"), "Microphone is disabled for self");
ok(!ifr.policy.allowsFeature("microphone", location.origin), "Microphone is disabled for self");
ok(!ifr.policy.allowsFeature("microphone", "http://foo.bar"), "Microphone is disabled for foo.bar");
ok(!ifr.policy.allowsFeature("microphone", "http://example.com"), "Microphone is disabled for example.com");
ok(!ifr.policy.allowsFeature("microphone", "http://example.org"), "Microphone is disabled for example.org");
allowed = ifr.policy.getAllowlistForFeature("microphone");
ok(!ifr.featurePolicy.allowsFeature("microphone"), "Microphone is disabled for self");
ok(!ifr.featurePolicy.allowsFeature("microphone", location.origin), "Microphone is disabled for self");
ok(!ifr.featurePolicy.allowsFeature("microphone", "http://foo.bar"), "Microphone is disabled for foo.bar");
ok(!ifr.featurePolicy.allowsFeature("microphone", "http://example.com"), "Microphone is disabled for example.com");
ok(!ifr.featurePolicy.allowsFeature("microphone", "http://example.org"), "Microphone is disabled for example.org");
allowed = ifr.featurePolicy.getAllowlistForFeature("microphone");
is(allowed.length, 0, "No allowlist for microphone");
ok(!ifr.policy.allowsFeature("vr"), "Vibrate is disabled for self");
ok(!ifr.policy.allowsFeature("vr", location.origin), "Vibrate is disabled for self");
ok(!ifr.policy.allowsFeature("vr", "http://foo.bar"), "Vibrate is disabled for foo.bar");
allowed = ifr.policy.getAllowlistForFeature("vr");
ok(!ifr.featurePolicy.allowsFeature("vr"), "Vibrate is disabled for self");
ok(!ifr.featurePolicy.allowsFeature("vr", location.origin), "Vibrate is disabled for self");
ok(!ifr.featurePolicy.allowsFeature("vr", "http://foo.bar"), "Vibrate is disabled for foo.bar");
allowed = ifr.featurePolicy.getAllowlistForFeature("vr");
is(allowed.length, 0, "No allowlist for vr");
ok(ifr.policy.allowedFeatures().includes("geolocation"), "Geolocation is allowed only for self");
ok(ifr.featurePolicy.allowedFeatures().includes("geolocation"), "Geolocation is allowed only for self");
next();
}
function test_iframe_contentDocument() {
info("Checking iframe document.policy");
info("Checking iframe document.featurePolicy");
let ifr = document.createElement("iframe");
ifr.setAttribute("src", "empty.html");
ifr.onload = function() {
ok("policy" in ifr.contentDocument, "We have ifr.contentDocument.policy");
ok("featurePolicy" in ifr.contentDocument, "We have ifr.contentDocument.featurePolicy");
ok(!ifr.contentDocument.policy.allowsFeature("foobar"), "Random feature");
ok(!ifr.contentDocument.policy.allowsFeature("foobar", "http://www.something.net"), "Random feature");
ok(!ifr.contentDocument.featurePolicy.allowsFeature("foobar"), "Random feature");
ok(!ifr.contentDocument.featurePolicy.allowsFeature("foobar", "http://www.something.net"), "Random feature");
ok(ifr.contentDocument.policy.allowsFeature("camera"), "Camera is allowed for self");
ok(ifr.contentDocument.policy.allowsFeature("camera", location.origin), "Camera is allowed for self");
ok(!ifr.contentDocument.policy.allowsFeature("camera", "http://foo.bar"), "Camera is allowed for self");
let allowed = ifr.contentDocument.policy.getAllowlistForFeature("camera");
ok(ifr.contentDocument.featurePolicy.allowsFeature("camera"), "Camera is allowed for self");
ok(ifr.contentDocument.featurePolicy.allowsFeature("camera", location.origin), "Camera is allowed for self");
ok(!ifr.contentDocument.featurePolicy.allowsFeature("camera", "http://foo.bar"), "Camera is allowed for self");
let allowed = ifr.contentDocument.featurePolicy.getAllowlistForFeature("camera");
is(allowed.length, 1, "Only 1 entry in allowlist for camera");
is(allowed[0], location.origin, "allowlist is 'self'");
ok(ifr.contentDocument.policy.allowsFeature("geolocation"), "Geolocation is allowed for all");
ok(ifr.contentDocument.policy.allowsFeature("geolocation", location.origin), "Geolocation is allowed for all");
ok(ifr.contentDocument.policy.allowsFeature("geolocation", "http://foo.bar"), "Geolocation is allowed for any random URL");
allowed = ifr.contentDocument.policy.getAllowlistForFeature("geolocation");
ok(ifr.contentDocument.featurePolicy.allowsFeature("geolocation"), "Geolocation is allowed for all");
ok(ifr.contentDocument.featurePolicy.allowsFeature("geolocation", location.origin), "Geolocation is allowed for all");
ok(ifr.contentDocument.featurePolicy.allowsFeature("geolocation", "http://foo.bar"), "Geolocation is allowed for any random URL");
allowed = ifr.contentDocument.featurePolicy.getAllowlistForFeature("geolocation");
is(allowed.length, 1, "Only 1 entry in allowlist for geolocation");
is(allowed[0], "*", "allowlist is '*'");
ok(!ifr.contentDocument.policy.allowsFeature("microphone"), "Microphone is disabled for self");
ok(!ifr.contentDocument.policy.allowsFeature("microphone", location.origin), "Microphone is disabled for self");
ok(!ifr.contentDocument.policy.allowsFeature("microphone", "http://foo.bar"), "Microphone is disabled for foo.bar");
ok(!ifr.contentDocument.policy.allowsFeature("microphone", "http://example.com"), "Microphone is allowed for example.com");
ok(!ifr.contentDocument.policy.allowsFeature("microphone", "http://example.org"), "Microphone is allowed for example.org");
allowed = ifr.contentDocument.policy.getAllowlistForFeature("microphone");
ok(!ifr.contentDocument.featurePolicy.allowsFeature("microphone"), "Microphone is disabled for self");
ok(!ifr.contentDocument.featurePolicy.allowsFeature("microphone", location.origin), "Microphone is disabled for self");
ok(!ifr.contentDocument.featurePolicy.allowsFeature("microphone", "http://foo.bar"), "Microphone is disabled for foo.bar");
ok(!ifr.contentDocument.featurePolicy.allowsFeature("microphone", "http://example.com"), "Microphone is allowed for example.com");
ok(!ifr.contentDocument.featurePolicy.allowsFeature("microphone", "http://example.org"), "Microphone is allowed for example.org");
allowed = ifr.contentDocument.featurePolicy.getAllowlistForFeature("microphone");
is(allowed.length, 0, "No allowlist for microphone");
ok(!ifr.contentDocument.policy.allowsFeature("vr"), "Vibrate is disabled for self");
ok(!ifr.contentDocument.policy.allowsFeature("vr", location.origin), "Vibrate is disabled for self");
ok(!ifr.contentDocument.policy.allowsFeature("vr", "http://foo.bar"), "Vibrate is disabled for foo.bar");
allowed = ifr.contentDocument.policy.getAllowlistForFeature("vr");
ok(!ifr.contentDocument.featurePolicy.allowsFeature("vr"), "Vibrate is disabled for self");
ok(!ifr.contentDocument.featurePolicy.allowsFeature("vr", location.origin), "Vibrate is disabled for self");
ok(!ifr.contentDocument.featurePolicy.allowsFeature("vr", "http://foo.bar"), "Vibrate is disabled for foo.bar");
allowed = ifr.contentDocument.featurePolicy.getAllowlistForFeature("vr");
is(allowed.length, 0, "No allowlist for vr");
ok(ifr.contentDocument.policy.allowedFeatures().includes("camera"), "Camera is allowed");
ok(ifr.contentDocument.policy.allowedFeatures().includes("geolocation"), "Geolocation is allowed");
ok(ifr.contentDocument.featurePolicy.allowedFeatures().includes("camera"), "Camera is allowed");
ok(ifr.contentDocument.featurePolicy.allowedFeatures().includes("geolocation"), "Geolocation is allowed");
// microphone is disabled for this origin
ok(!ifr.contentDocument.policy.allowedFeatures().includes("microphone"), "Microphone is not allowed");
ok(!ifr.contentDocument.featurePolicy.allowedFeatures().includes("microphone"), "Microphone is not allowed");
// vr is disabled everywhere.
ok(!ifr.contentDocument.policy.allowedFeatures().includes("vr"), "VR is not allowed");
ok(!ifr.contentDocument.featurePolicy.allowedFeatures().includes("vr"), "VR is not allowed");
next();
};

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

@ -39,6 +39,7 @@ interface BiquadFilterNode : AudioNode {
readonly attribute AudioParam Q; // Quality factor
readonly attribute AudioParam gain; // in Decibels
[Throws]
void getFrequencyResponse(Float32Array frequencyHz,
Float32Array magResponse,
Float32Array phaseResponse);

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

@ -21,7 +21,9 @@ interface DOMPointReadOnly {
readonly attribute unrestricted double x;
readonly attribute unrestricted double y;
readonly attribute unrestricted double z;
readonly attribute unrestricted double w;
readonly attribute unrestricted double w;
[NewObject, Throws] DOMPoint matrixTransform(optional DOMMatrixInit matrix = {});
[Default] object toJSON();
};

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

@ -601,10 +601,10 @@ Document implements GeometryUtils;
Document implements FontFaceSource;
Document implements DocumentOrShadowRoot;
// https://wicg.github.io/feature-policy/#policy
// https://w3c.github.io/webappsec-feature-policy/#idl-index
partial interface Document {
[SameObject, Pref="dom.security.featurePolicy.webidl.enabled"]
readonly attribute Policy policy;
readonly attribute FeaturePolicy featurePolicy;
};
/**

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

@ -4,12 +4,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* For more information on this interface, please see
* https://wicg.github.io/feature-policy/#policy
* https://w3c.github.io/webappsec-feature-policy/#idl-index
*/
[NoInterfaceObject]
interface Policy {
interface FeaturePolicy {
boolean allowsFeature(DOMString feature, optional DOMString origin);
sequence<DOMString> features();
sequence<DOMString> allowedFeatures();
sequence<DOMString> getAllowlistForFeature(DOMString feature);
};

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

@ -70,10 +70,10 @@ partial interface HTMLIFrameElement {
HTMLIFrameElement implements MozFrameLoaderOwner;
HTMLIFrameElement implements BrowserElement;
// https://wicg.github.io/feature-policy/#policy
// https://w3c.github.io/webappsec-feature-policy/#idl-index
partial interface HTMLIFrameElement {
[SameObject, Pref="dom.security.featurePolicy.webidl.enabled"]
readonly attribute Policy policy;
readonly attribute FeaturePolicy featurePolicy;
[CEReactions, SetterThrows, Pure, Pref="dom.security.featurePolicy.enabled"]
attribute DOMString allow;

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

@ -2172,7 +2172,8 @@ already_AddRefed<ID2D1Image> DrawTargetD2D1::GetImageForSurface(
case SurfaceType::DUAL_DT: {
// Sometimes we have a dual drawtarget but the underlying targets
// are d2d surfaces. Let's not readback and reupload in those cases.
SourceSurfaceDual* dualSurface = static_cast<SourceSurfaceDual*>(surface.get());
SourceSurfaceDual* dualSurface =
static_cast<SourceSurfaceDual*>(surface.get());
SourceSurface* first = dualSurface->GetFirstSurface();
if (first->GetType() == SurfaceType::D2D1_1_IMAGE) {
MOZ_ASSERT(dualSurface->SameSurfaceTypes());

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

@ -103,13 +103,13 @@ void PathBuilderCairo::Arc(const Point& aOrigin, float aRadius,
}
already_AddRefed<Path> PathBuilderCairo::Finish() {
return MakeAndAddRef<PathCairo>(mFillRule, mPathData, mCurrentPoint, mBeginPoint);
return MakeAndAddRef<PathCairo>(mFillRule, mPathData, mCurrentPoint,
mBeginPoint);
}
PathCairo::PathCairo(FillRule aFillRule,
std::vector<cairo_path_data_t>& aPathData,
const Point& aCurrentPoint,
const Point& aBeginPoint)
const Point& aCurrentPoint, const Point& aBeginPoint)
: mFillRule(aFillRule),
mContainingContext(nullptr),
mCurrentPoint(aCurrentPoint),

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

@ -11,7 +11,7 @@
namespace mozilla {
namespace gfx {
#define NEXT_PARAMS(_type) \
#define NEXT_PARAMS(_type) \
const _type params = *reinterpret_cast<const _type*>(nextByte); \
nextByte += sizeof(_type);

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

@ -161,13 +161,9 @@ class PathBuilderRecording final : public PathBuilder {
/* Point the current subpath is at - or where the next subpath will start
* if there is no active subpath.
*/
Point CurrentPoint() const final {
return mPathBuilder->CurrentPoint();
}
Point CurrentPoint() const final { return mPathBuilder->CurrentPoint(); }
Point BeginPoint() const final {
return mPathBuilder->BeginPoint();
}
Point BeginPoint() const final { return mPathBuilder->BeginPoint(); }
void SetCurrentPoint(const Point& aPoint) final {
mPathBuilder->SetCurrentPoint(aPoint);
@ -193,8 +189,11 @@ class PathRecording final : public Path {
PathRecording(Path* aPath, PathOps&& aOps, FillRule aFillRule,
const Point& aCurrentPoint, const Point& aBeginPoint)
: mPath(aPath), mPathOps(std::move(aOps)), mFillRule(aFillRule),
mCurrentPoint(aCurrentPoint), mBeginPoint(aBeginPoint) {}
: mPath(aPath),
mPathOps(std::move(aOps)),
mFillRule(aFillRule),
mCurrentPoint(aCurrentPoint),
mBeginPoint(aBeginPoint) {}
~PathRecording();

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

@ -82,8 +82,8 @@ void PathBuilderSkia::Arc(const Point& aOrigin, float aRadius,
}
already_AddRefed<Path> PathBuilderSkia::Finish() {
RefPtr<Path> path = MakeAndAddRef<PathSkia>(mPath, mFillRule,
mCurrentPoint, mBeginPoint);
RefPtr<Path> path =
MakeAndAddRef<PathSkia>(mPath, mFillRule, mCurrentPoint, mBeginPoint);
mCurrentPoint = Point(0.0, 0.0);
mBeginPoint = Point(0.0, 0.0);
return path.forget();
@ -98,8 +98,8 @@ already_AddRefed<PathBuilder> PathSkia::CopyToBuilder(
already_AddRefed<PathBuilder> PathSkia::TransformedCopyToBuilder(
const Matrix& aTransform, FillRule aFillRule) const {
RefPtr<PathBuilderSkia> builder = MakeAndAddRef<PathBuilderSkia>(
aTransform, mPath, aFillRule);
RefPtr<PathBuilderSkia> builder =
MakeAndAddRef<PathBuilderSkia>(aTransform, mPath, aFillRule);
builder->mCurrentPoint = aTransform.TransformPoint(mCurrentPoint);
builder->mBeginPoint = aTransform.TransformPoint(mBeginPoint);

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

@ -50,13 +50,11 @@ class PathSkia : public Path {
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathSkia, override)
PathSkia(SkPath& aPath,
FillRule aFillRule,
Point aCurrentPoint = Point(),
PathSkia(SkPath& aPath, FillRule aFillRule, Point aCurrentPoint = Point(),
Point aBeginPoint = Point())
: mFillRule(aFillRule)
, mCurrentPoint(aCurrentPoint)
, mBeginPoint(aBeginPoint) {
: mFillRule(aFillRule),
mCurrentPoint(aCurrentPoint),
mBeginPoint(aBeginPoint) {
mPath.swap(aPath);
}

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

@ -306,7 +306,8 @@ bool UnscaledFontDWrite::GetFontFileData(FontFileDataOutput aDataCallback,
}
RefPtr<IDWriteFontFileStream> stream;
hr = loader->CreateStreamFromKey(referenceKey, refKeySize, getter_AddRefs(stream));
hr = loader->CreateStreamFromKey(referenceKey, refKeySize,
getter_AddRefs(stream));
if (FAILED(hr)) {
return false;
}

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

@ -51,7 +51,7 @@ class gfxVarReceiver;
_(AllowD3D11KeyedMutex, bool, false) \
_(SystemTextQuality, int32_t, 5 /* CLEARTYPE_QUALITY */) \
_(LayersWindowRecordingPath, nsCString, nsCString()) \
_(RemoteCanvasEnabled, bool, false) \
_(RemoteCanvasEnabled, bool, false)
/* Add new entries above this line. */

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

@ -62,8 +62,8 @@ class APZUpdater {
void UpdateFocusState(LayersId aRootLayerTreeId,
WRRootId aOriginatingWrRootId,
const FocusTarget& aFocusTarget);
void UpdateHitTestingTree(Layer* aRoot,
bool aIsFirstPaint, LayersId aOriginatingLayersId,
void UpdateHitTestingTree(Layer* aRoot, bool aIsFirstPaint,
LayersId aOriginatingLayersId,
uint32_t aPaintSequenceNumber);
/**
* This should be called (in the WR-enabled case) when the compositor receives

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

@ -185,7 +185,8 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
*
* @param aRoot The root of the (full) layer tree
* @param aOriginatingLayersId The layers id of the subtree that triggered
* this repaint, and to which aIsFirstPaint applies.
* this repaint, and to which aIsFirstPaint
* applies.
* @param aIsFirstPaint True if the layers update that this is called in
* response to included a first-paint. If this is true,
* the part of the tree that is affected by the
@ -196,8 +197,8 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
* process' layer subtree has its own sequence
* numbers.
*/
void UpdateHitTestingTree(Layer* aRoot,
bool aIsFirstPaint, LayersId aOriginatingLayersId,
void UpdateHitTestingTree(Layer* aRoot, bool aIsFirstPaint,
LayersId aOriginatingLayersId,
uint32_t aPaintSequenceNumber);
/**

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

@ -177,14 +177,13 @@ void APZUpdater::UpdateFocusState(LayersId aRootLayerTreeId,
aOriginatingWrRootId.mLayersId, aFocusTarget));
}
void APZUpdater::UpdateHitTestingTree(Layer* aRoot,
bool aIsFirstPaint,
void APZUpdater::UpdateHitTestingTree(Layer* aRoot, bool aIsFirstPaint,
LayersId aOriginatingWrRootId,
uint32_t aPaintSequenceNumber) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
AssertOnUpdaterThread();
mApz->UpdateHitTestingTree(aRoot, aIsFirstPaint,
aOriginatingWrRootId, aPaintSequenceNumber);
mApz->UpdateHitTestingTree(aRoot, aIsFirstPaint, aOriginatingWrRootId,
aPaintSequenceNumber);
}
void APZUpdater::UpdateScrollDataAndTreeState(

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

@ -2587,7 +2587,7 @@ nsEventStatus AsyncPanZoomController::OnPan(const PanGestureInput& aEvent,
physicalPanDisplacement.x * scrollUnitWidth,
physicalPanDisplacement.y * scrollUnitHeight);
physicalPanDisplacement = ToScreenCoordinates(physicalPanDisplacementPL,
aEvent.mLocalPanStartPoint);
aEvent.mLocalPanStartPoint);
logicalPanDisplacement.x *= scrollUnitWidth;
logicalPanDisplacement.y *= scrollUnitHeight;
}
@ -3967,8 +3967,7 @@ void AsyncPanZoomController::RequestContentRepaint(
NewRunnableMethod<AsyncPanZoomController*>(
"layers::APZCTreeManager::SendSubtreeTransformsToChromeMainThread",
GetApzcTreeManager(),
&APZCTreeManager::SendSubtreeTransformsToChromeMainThread,
this));
&APZCTreeManager::SendSubtreeTransformsToChromeMainThread, this));
}
bool AsyncPanZoomController::UpdateAnimation(

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

@ -4,8 +4,8 @@
#include "HitTestingTreeNode.h"
#include "AsyncPanZoomController.h" // for AsyncPanZoomController
#include "LayersLogging.h" // for Stringify
#include "AsyncPanZoomController.h" // for AsyncPanZoomController
#include "LayersLogging.h" // for Stringify
#include "mozilla/StaticPrefs.h"
#include "mozilla/gfx/Point.h" // for Point4D
#include "mozilla/layers/APZUtils.h" // for CompleteAsyncTransform
@ -322,9 +322,9 @@ LayerToScreenMatrix4x4 HitTestingTreeNode::GetTransformToGecko() const {
LayerToParentLayerMatrix4x4 thisToParent =
mTransform * AsyncTransformMatrix();
if (mApzc) {
thisToParent = thisToParent *
ViewAs<ParentLayerToParentLayerMatrix4x4>(
mApzc->GetTransformToLastDispatchedPaint());
thisToParent =
thisToParent * ViewAs<ParentLayerToParentLayerMatrix4x4>(
mApzc->GetTransformToLastDispatchedPaint());
}
ParentLayerToScreenMatrix4x4 parentToRoot =
ViewAs<ParentLayerToScreenMatrix4x4>(

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

@ -237,9 +237,8 @@ class TextureChild final : PTextureChild {
friend void DeallocateTextureClient(TextureDeallocParams params);
};
static inline gfx::BackendType
BackendTypeForBackendSelector(LayersBackend aLayersBackend, BackendSelector aSelector)
{
static inline gfx::BackendType BackendTypeForBackendSelector(
LayersBackend aLayersBackend, BackendSelector aSelector) {
switch (aSelector) {
case BackendSelector::Canvas:
return gfxPlatform::GetPlatform()->GetPreferredCanvasBackend();
@ -251,44 +250,41 @@ BackendTypeForBackendSelector(LayersBackend aLayersBackend, BackendSelector aSel
}
};
static TextureType
GetTextureType(gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
LayersBackend aLayersBackend, gfx::BackendType aBackendType,
int32_t aMaxTextureSize, TextureAllocationFlags aAllocFlags)
{
static TextureType GetTextureType(gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
LayersBackend aLayersBackend,
gfx::BackendType aBackendType,
int32_t aMaxTextureSize,
TextureAllocationFlags aAllocFlags) {
#ifdef XP_WIN
if ((aLayersBackend == LayersBackend::LAYERS_D3D11 ||
aLayersBackend == LayersBackend::LAYERS_WR) &&
(aBackendType == gfx::BackendType::DIRECT2D ||
aBackendType == gfx::BackendType::DIRECT2D1_1 ||
(!!(aAllocFlags & ALLOC_FOR_OUT_OF_BAND_CONTENT) &&
DeviceManagerDx::Get()->GetContentDevice())) &&
aSize.width <= aMaxTextureSize &&
aSize.height <= aMaxTextureSize &&
(aBackendType == gfx::BackendType::DIRECT2D ||
aBackendType == gfx::BackendType::DIRECT2D1_1 ||
(!!(aAllocFlags & ALLOC_FOR_OUT_OF_BAND_CONTENT) &&
DeviceManagerDx::Get()->GetContentDevice())) &&
aSize.width <= aMaxTextureSize && aSize.height <= aMaxTextureSize &&
!(aAllocFlags & ALLOC_UPDATE_FROM_SURFACE)) {
return TextureType::D3D11;
}
if (aLayersBackend != LayersBackend::LAYERS_WR &&
aFormat == SurfaceFormat::B8G8R8X8 &&
aBackendType == gfx::BackendType::CAIRO &&
NS_IsMainThread()) {
aBackendType == gfx::BackendType::CAIRO && NS_IsMainThread()) {
return TextureType::DIB;
}
#endif
#ifdef MOZ_X11
gfxSurfaceType type =
gfxPlatform::GetPlatform()->ScreenReferenceSurface()->GetType();
gfxPlatform::GetPlatform()->ScreenReferenceSurface()->GetType();
if (aLayersBackend == LayersBackend::LAYERS_BASIC &&
aBackendType == gfx::BackendType::CAIRO &&
type == gfxSurfaceType::Xlib) {
aBackendType == gfx::BackendType::CAIRO && type == gfxSurfaceType::Xlib) {
return TextureType::X11;
}
if (aLayersBackend == LayersBackend::LAYERS_OPENGL &&
type == gfxSurfaceType::Xlib &&
aFormat != SurfaceFormat::A8 &&
type == gfxSurfaceType::Xlib && aFormat != SurfaceFormat::A8 &&
gl::sGLXLibrary.UseTextureFromPixmap()) {
return TextureType::X11;
}
@ -309,9 +305,8 @@ GetTextureType(gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
return TextureType::Unknown;
}
static bool
ShouldRemoteTextureType(TextureType aTextureType, BackendSelector aSelector)
{
static bool ShouldRemoteTextureType(TextureType aTextureType,
BackendSelector aSelector) {
if (!XRE_IsContentProcess()) {
return false;
}
@ -329,19 +324,19 @@ ShouldRemoteTextureType(TextureType aTextureType, BackendSelector aSelector)
}
/* static */
TextureData*
TextureData::Create(TextureForwarder* aAllocator, gfx::SurfaceFormat aFormat,
gfx::IntSize aSize, LayersBackend aLayersBackend,
int32_t aMaxTextureSize, BackendSelector aSelector,
TextureFlags aTextureFlags,
TextureAllocationFlags aAllocFlags)
{
TextureData* TextureData::Create(TextureForwarder* aAllocator,
gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
LayersBackend aLayersBackend,
int32_t aMaxTextureSize,
BackendSelector aSelector,
TextureFlags aTextureFlags,
TextureAllocationFlags aAllocFlags) {
gfx::BackendType moz2DBackend =
BackendTypeForBackendSelector(aLayersBackend, aSelector);
BackendTypeForBackendSelector(aLayersBackend, aSelector);
TextureType textureType = GetTextureType(aFormat, aSize, aLayersBackend,
moz2DBackend, aMaxTextureSize,
aAllocFlags);
TextureType textureType =
GetTextureType(aFormat, aSize, aLayersBackend, moz2DBackend,
aMaxTextureSize, aAllocFlags);
if (ShouldRemoteTextureType(textureType, aSelector)) {
RefPtr<CanvasChild> canvasChild = aAllocator->GetCanvasChild();
@ -351,7 +346,7 @@ TextureData::Create(TextureForwarder* aAllocator, gfx::SurfaceFormat aFormat,
}
}
switch(textureType) {
switch (textureType) {
#ifdef XP_WIN
case TextureType::D3D11:
return D3D11TextureData::Create(aSize, aFormat, aAllocFlags);
@ -376,16 +371,14 @@ TextureData::Create(TextureForwarder* aAllocator, gfx::SurfaceFormat aFormat,
}
/* static */
bool
TextureData::IsRemote(LayersBackend aLayersBackend, BackendSelector aSelector)
{
bool TextureData::IsRemote(LayersBackend aLayersBackend,
BackendSelector aSelector) {
gfx::BackendType moz2DBackend =
BackendTypeForBackendSelector(aLayersBackend, aSelector);
BackendTypeForBackendSelector(aLayersBackend, aSelector);
TextureType textureType =
GetTextureType(gfx::SurfaceFormat::UNKNOWN, gfx::IntSize(1,1),
aLayersBackend, moz2DBackend, INT32_MAX,
TextureAllocationFlags::ALLOC_DEFAULT);
TextureType textureType = GetTextureType(
gfx::SurfaceFormat::UNKNOWN, gfx::IntSize(1, 1), aLayersBackend,
moz2DBackend, INT32_MAX, TextureAllocationFlags::ALLOC_DEFAULT);
return ShouldRemoteTextureType(textureType, aSelector);
}
@ -1196,9 +1189,9 @@ already_AddRefed<TextureClient> TextureClient::CreateForDrawing(
return nullptr;
}
TextureData* data =
TextureData::Create(aAllocator, aFormat, aSize, aLayersBackend,
aMaxTextureSize, aSelector, aTextureFlags, aAllocFlags);
TextureData* data = TextureData::Create(
aAllocator, aFormat, aSize, aLayersBackend, aMaxTextureSize, aSelector,
aTextureFlags, aAllocFlags);
if (data) {
return MakeAndAddRef<TextureClient>(data, aTextureFlags, aAllocator);

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

@ -246,11 +246,9 @@ class TextureData {
};
static TextureData* Create(TextureForwarder* aAllocator,
gfx::SurfaceFormat aFormat,
gfx::IntSize aSize,
gfx::SurfaceFormat aFormat, gfx::IntSize aSize,
LayersBackend aLayersBackend,
int32_t aMaxTextureSize,
BackendSelector aSelector,
int32_t aMaxTextureSize, BackendSelector aSelector,
TextureFlags aTextureFlags,
TextureAllocationFlags aAllocFlags);
@ -314,7 +312,7 @@ class TextureData {
virtual GPUVideoTextureData* AsGPUVideoTextureData() { return nullptr; }
protected:
protected:
TextureData() { MOZ_COUNT_CTOR(TextureData); }
};

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

@ -10,7 +10,7 @@
#include "ContentHost.h" // for ContentHostDoubleBuffered, etc
#include "Effects.h" // for EffectMask, Effect, etc
#include "gfxUtils.h"
#include "ImageHost.h" // for ImageHostBuffered, etc
#include "ImageHost.h" // for ImageHostBuffered, etc
#include "Layers.h"
#include "TiledContentHost.h" // for TiledContentHost
#include "mozilla/gfx/gfxVars.h"

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

@ -16,7 +16,7 @@
#include "mozilla/layers/Effects.h" // for TexturedEffect, Effect, etc
#include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper
#include "mozilla/layers/PTextureParent.h"
#include "mozilla/layers/TextureHostOGL.h" // for TextureHostOGL
#include "mozilla/layers/TextureHostOGL.h" // for TextureHostOGL
#ifdef XP_DARWIN
# include "mozilla/layers/TextureSync.h" // for TextureSync
#endif

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

@ -853,8 +853,7 @@ void CompositorBridgeParent::NotifyShadowTreeTransaction(
WRRootId::NonWebRender(aId), aFocusTarget);
if (aHitTestUpdate) {
mApzUpdater->UpdateHitTestingTree(
mLayerManager->GetRoot(), aIsFirstPaint, aId,
aPaintSequenceNumber);
mLayerManager->GetRoot(), aIsFirstPaint, aId, aPaintSequenceNumber);
}
}
@ -1248,8 +1247,8 @@ void CompositorBridgeParent::ShadowLayersUpdated(
if (aHitTestUpdate) {
AutoResolveRefLayers resolve(mCompositionManager);
mApzUpdater->UpdateHitTestingTree(root,
aInfo.isFirstPaint(), mRootLayerTreeID,
mApzUpdater->UpdateHitTestingTree(root, aInfo.isFirstPaint(),
mRootLayerTreeID,
aInfo.paintSequenceNumber());
}
}

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

@ -21,7 +21,7 @@
#include "mozilla/ipc/MessageChannel.h" // for MessageChannel, etc
#include "mozilla/ipc/Transport.h" // for Transport
#include "mozilla/gfx/gfxVars.h"
#include "mozilla/gfx/Point.h" // for IntSize
#include "mozilla/gfx/Point.h" // for IntSize
#include "mozilla/layers/AsyncCanvasRenderer.h"
#include "mozilla/media/MediaSystemResourceManager.h" // for MediaSystemResourceManager
#include "mozilla/media/MediaSystemResourceManagerChild.h" // for MediaSystemResourceManagerChild

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

@ -84,10 +84,9 @@ struct ParamTraits<mozilla::layers::LayersBackend>
template <>
struct ParamTraits<mozilla::layers::TextureType>
: public ContiguousEnumSerializer<
mozilla::layers::TextureType,
mozilla::layers::TextureType::Unknown,
mozilla::layers::TextureType::Last> {};
: public ContiguousEnumSerializer<mozilla::layers::TextureType,
mozilla::layers::TextureType::Unknown,
mozilla::layers::TextureType::Last> {};
template <>
struct ParamTraits<mozilla::layers::ScaleMode>

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

@ -718,8 +718,7 @@ void EGLImageTextureSource::BindTexture(GLenum aTextureUnit,
return egl->HasKHRImageBase() && egl->HasKHRImageTexture2D() &&
gl->IsExtensionSupported(GLContext::OES_EGL_image);
}();
MOZ_ASSERT(supportsEglImage,
"EGLImage not supported or disabled in runtime");
MOZ_ASSERT(supportsEglImage, "EGLImage not supported or disabled in runtime");
#endif
GLuint tex = mCompositor->GetTemporaryTexture(mTextureTarget, aTextureUnit);

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

@ -1073,7 +1073,8 @@ void WebRenderScrollDataCollection::AppendRoot(
// created above.
size_t rootMetadataTarget = layerScrollData.size() - 1;
for (size_t i = rootMetadataTarget; i > 0; i--) {
if (auto zoomContainerId = layerScrollData[i - 1].GetAsyncZoomContainerId()) {
if (auto zoomContainerId =
layerScrollData[i - 1].GetAsyncZoomContainerId()) {
if (*zoomContainerId == aRootMetadata->GetMetrics().GetScrollId()) {
rootMetadataTarget = i - 1;
break;

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

@ -1376,22 +1376,20 @@ gfxFontEntry* gfxMacPlatformFontList::LookupLocalFont(const nsACString& aFontNam
return nullptr;
}
newFontEntry = new MacOSFontEntry(aFontName, fontRef, aWeightForEntry,
aStretchForEntry, aStyleForEntry, false,
true);
newFontEntry = new MacOSFontEntry(aFontName, fontRef, aWeightForEntry, aStretchForEntry,
aStyleForEntry, false, true);
::CFRelease(fontRef);
return newFontEntry;
}
static void ReleaseData(void* info, const void* data, size_t size) {
free((void*)data);
}
static void ReleaseData(void* info, const void* data, size_t size) { free((void*)data); }
gfxFontEntry* gfxMacPlatformFontList::MakePlatformFont(
const nsACString& aFontName, WeightRange aWeightForEntry,
StretchRange aStretchForEntry, SlantStyleRange aStyleForEntry,
const uint8_t* aFontData, uint32_t aLength) {
gfxFontEntry* gfxMacPlatformFontList::MakePlatformFont(const nsACString& aFontName,
WeightRange aWeightForEntry,
StretchRange aStretchForEntry,
SlantStyleRange aStyleForEntry,
const uint8_t* aFontData, uint32_t aLength) {
NS_ASSERTION(aFontData, "MakePlatformFont called with null data");
// create the font entry
@ -1412,9 +1410,8 @@ gfxFontEntry* gfxMacPlatformFontList::MakePlatformFont(
}
auto newFontEntry =
MakeUnique<MacOSFontEntry>(NS_ConvertUTF16toUTF8(uniqueName), fontRef,
aWeightForEntry, aStretchForEntry,
aStyleForEntry, true, false);
MakeUnique<MacOSFontEntry>(NS_ConvertUTF16toUTF8(uniqueName), fontRef, aWeightForEntry,
aStretchForEntry, aStyleForEntry, true, false);
::CFRelease(fontRef);
return newFontEntry.release();
}

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

@ -283,7 +283,7 @@ static inline double CanonicalizeNaN(double d) {
// Some architectures (not to name names) generate NaNs with bit
// patterns that don't conform to JS::Value's bit pattern
// restrictions.
#define JS_NONCANONICAL_HARDWARE_NAN
# define JS_NONCANONICAL_HARDWARE_NAN
#endif
/**

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

@ -200,9 +200,6 @@ function treatAsSafeArgument(entry, varName, csuName)
["Gecko_SetStyleCoordCalcValue", null, null],
["Gecko_StyleClipPath_SetURLValue", "aClip", null],
["Gecko_nsStyleFilter_SetURLValue", "aEffects", null],
["Gecko_nsStyleSVGPaint_CopyFrom", "aDest", null],
["Gecko_nsStyleSVGPaint_SetURLValue", "aPaint", null],
["Gecko_nsStyleSVGPaint_Reset", "aPaint", null],
["Gecko_nsStyleSVG_SetDashArrayLength", "aSvg", null],
["Gecko_nsStyleSVG_CopyDashArray", "aDst", null],
["Gecko_nsStyleFont_SetLang", "aFont", null],

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

@ -1056,8 +1056,7 @@ void Statistics::endGC() {
runtime->addTelemetry(JS_TELEMETRY_GC_TIME_BETWEEN_S,
timeSinceLastGC.ToSeconds());
if (!nonincremental()) {
runtime->addTelemetry(JS_TELEMETRY_GC_SLICE_COUNT,
slices_.length());
runtime->addTelemetry(JS_TELEMETRY_GC_SLICE_COUNT, slices_.length());
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -256,6 +256,8 @@ namespace jit {
_(JSOP_INC) \
_(JSOP_DEC)
enum class ScriptGCThingType { RegExp, Function, Scope, BigInt };
// Base class for BaselineCompiler and BaselineInterpreterGenerator. The Handler
// template is a class storing fields/methods that are interpreter or compiler
// specific. This can be combined with template specialization of methods in
@ -318,10 +320,11 @@ class BaselineCodeGen {
// Pushes a name/object/scope associated with the current bytecode op (and
// stored in the script) as argument for a VM function.
enum class ScriptObjectType { RegExp, Function };
void pushScriptObjectArg(ScriptObjectType type);
void loadScriptGCThing(ScriptGCThingType type, Register dest,
Register scratch);
void pushScriptGCThingArg(ScriptGCThingType type, Register scratch1,
Register scratch2);
void pushScriptNameArg(Register scratch1, Register scratch2);
void pushScriptScopeArg();
// Pushes a bytecode operand as argument for a VM function.
void pushUint8BytecodeOperandArg(Register scratch);
@ -334,6 +337,9 @@ class BaselineCodeGen {
// Loads the current JSScript* in dest.
void loadScript(Register dest);
void saveInterpreterPCReg();
void restoreInterpreterPCReg();
// Subtracts |script->nslots() * sizeof(Value)| from reg.
void subtractScriptSlotsSize(Register reg, Register scratch);
@ -407,6 +413,8 @@ class BaselineCodeGen {
MOZ_MUST_USE bool emitEnterGeneratorCode(Register script,
Register resumeIndex,
Register scratch);
void emitInterpJumpToResumeEntry(Register script, Register resumeIndex,
Register scratch);
void emitJumpToInterpretOpLabel();
MOZ_MUST_USE bool emitIncExecutionProgressCounter(Register scratch);
@ -444,7 +452,8 @@ class BaselineCodeGen {
// Converts |val| to an index in the jump table and stores this in |dest|
// or branches to the default pc if not int32 or out-of-range.
void emitGetTableSwitchIndex(ValueOperand val, Register dest);
void emitGetTableSwitchIndex(ValueOperand val, Register dest,
Register scratch1, Register scratch2);
// Jumps to the target of a table switch based on |key| and the
// firstResumeIndex stored in JSOP_TABLESWITCH.
@ -661,7 +670,16 @@ class BaselineCompiler final : private BaselineCompilerCodeGen {
// Interface used by BaselineCodeGen for BaselineInterpreterGenerator.
class BaselineInterpreterHandler {
InterpreterFrameInfo frame_;
// Entry point to start interpreting a bytecode op. No registers are live. PC
// is loaded from the frame.
Label interpretOp_;
// Like interpretOp_ but at this point the PC is expected to be in
// InterpreterPCReg.
Label interpretOpWithPCReg_;
// Offset of toggled jump for prologue debugger instrumentation.
CodeOffset debuggeeCheckOffset_;
// Offsets of toggled jumps for code coverage instrumentation.
@ -678,6 +696,8 @@ class BaselineInterpreterHandler {
InterpreterFrameInfo& frame() { return frame_; }
Label* interpretOpLabel() { return &interpretOp_; }
Label* interpretOpWithPCRegLabel() { return &interpretOpWithPCReg_; }
Label* codeCoverageAtPrologueLabel() { return &codeCoverageAtPrologueLabel_; }
Label* codeCoverageAtPCLabel() { return &codeCoverageAtPCLabel_; }
@ -726,6 +746,9 @@ class BaselineInterpreterGenerator final : private BaselineInterpreterCodeGen {
// Offset of the code to start interpreting a bytecode op.
uint32_t interpretOpOffset_ = 0;
// Like interpretOpOffset_ but skips the debug trap for the current op.
uint32_t interpretOpNoDebugTrapOffset_ = 0;
public:
explicit BaselineInterpreterGenerator(JSContext* cx);

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

@ -1677,7 +1677,6 @@ class ICCall_Fallback : public ICMonitoredFallbackStub {
: ICMonitoredFallbackStub(ICStub::Call_Fallback, stubCode) {}
};
// IC for constructing an iterator from an input value.
class ICGetIterator_Fallback : public ICFallbackStub {
friend class ICStubSpace;

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

@ -150,13 +150,10 @@ JitExecStatus jit::EnterBaselineAtBranch(JSContext* cx, InterpreterFrame* fp,
data.jitcode += MacroAssembler::ToggledCallSize(data.jitcode);
}
} else {
// As above, use the entry point that skips the debug trap.
const BaselineInterpreter& interp =
cx->runtime()->jitRuntime()->baselineInterpreter();
data.jitcode = interp.interpretOpAddr().value;
if (fp->isDebuggee()) {
// Skip the debug trap emitted by emitInterpreterLoop.
data.jitcode += MacroAssembler::ToggledCallSize(data.jitcode);
}
data.jitcode = interp.interpretOpNoDebugTrapAddr().value;
}
// Note: keep this in sync with SetEnterJitData.
@ -1107,6 +1104,7 @@ void jit::ToggleBaselineTraceLoggerEngine(JSRuntime* runtime, bool enable) {
#endif
void BaselineInterpreter::init(JitCode* code, uint32_t interpretOpOffset,
uint32_t interpretOpNoDebugTrapOffset,
uint32_t profilerEnterToggleOffset,
uint32_t profilerExitToggleOffset,
uint32_t debuggeeCheckOffset,
@ -1114,6 +1112,7 @@ void BaselineInterpreter::init(JitCode* code, uint32_t interpretOpOffset,
CodeOffsetVector&& codeCoverageOffsets) {
code_ = code;
interpretOpOffset_ = interpretOpOffset;
interpretOpNoDebugTrapOffset_ = interpretOpNoDebugTrapOffset;
profilerEnterToggleOffset_ = profilerEnterToggleOffset;
profilerExitToggleOffset_ = profilerExitToggleOffset;
debuggeeCheckOffset_ = debuggeeCheckOffset;

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

@ -631,6 +631,9 @@ class BaselineInterpreter {
// Offset of the code to start interpreting a bytecode op.
uint32_t interpretOpOffset_ = 0;
// Like interpretOpOffset_ but skips the debug trap for the current op.
uint32_t interpretOpNoDebugTrapOffset_ = 0;
// The offsets for the toggledJump instructions for profiler instrumentation.
uint32_t profilerEnterToggleOffset_ = 0;
uint32_t profilerExitToggleOffset_ = 0;
@ -654,6 +657,7 @@ class BaselineInterpreter {
void operator=(const BaselineInterpreter&) = delete;
void init(JitCode* code, uint32_t interpretOpOffset,
uint32_t interpretOpNoDebugTrapOffset,
uint32_t profilerEnterToggleOffset,
uint32_t profilerExitToggleOffset, uint32_t debuggeeCheckOffset,
CodeOffsetVector&& debugTrapOffsets,
@ -664,6 +668,9 @@ class BaselineInterpreter {
TrampolinePtr interpretOpAddr() const {
return TrampolinePtr(codeRaw() + interpretOpOffset_);
}
TrampolinePtr interpretOpNoDebugTrapAddr() const {
return TrampolinePtr(codeRaw() + interpretOpNoDebugTrapOffset_);
}
void toggleProfilerInstrumentation(bool enable);
void toggleDebuggerInstrumentation(bool enable);

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

@ -185,6 +185,8 @@ static constexpr Register WasmTableCallIndexReg = ABINonArgReg3;
static constexpr Register PreBarrierReg = r1;
static constexpr Register InterpreterPCReg = r9;
static constexpr Register InvalidReg{Registers::invalid_reg};
static constexpr FloatRegister InvalidFloatReg;

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

@ -69,6 +69,8 @@ static constexpr Register CallTempReg5{Registers::x14};
static constexpr Register PreBarrierReg{Registers::x1};
static constexpr Register InterpreterPCReg{Registers::x9};
static constexpr Register ReturnReg{Registers::x0};
static constexpr Register64 ReturnReg64(ReturnReg);
static constexpr Register JSReturnReg{Registers::x2};

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

@ -37,6 +37,7 @@ struct ScratchDoubleScope : FloatRegister {
static constexpr Register OsrFrameReg{Registers::invalid_reg};
static constexpr Register PreBarrierReg{Registers::invalid_reg};
static constexpr Register InterpreterPCReg{Registers::invalid_reg};
static constexpr Register CallTempReg0{Registers::invalid_reg};
static constexpr Register CallTempReg1{Registers::invalid_reg};
static constexpr Register CallTempReg2{Registers::invalid_reg};

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

@ -235,6 +235,8 @@ static constexpr Register OsrFrameReg = IntArgReg3;
static constexpr Register PreBarrierReg = rdx;
static constexpr Register InterpreterPCReg = r14;
static constexpr uint32_t ABIStackAlignment = 16;
static constexpr uint32_t CodeAlignment = 16;
static constexpr uint32_t JitStackAlignment = 16;

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

@ -129,6 +129,9 @@ static constexpr Register WasmTableCallIndexReg = ABINonArgReg3;
static constexpr Register OsrFrameReg = edx;
static constexpr Register PreBarrierReg = edx;
// Not enough registers for a PC register (R0-R2 use 2 registers each).
static constexpr Register InterpreterPCReg = InvalidReg;
// Registerd used in RegExpMatcher instruction (do not use JSReturnOperand).
static constexpr Register RegExpMatcherRegExpReg = CallTempReg0;
static constexpr Register RegExpMatcherStringReg = CallTempReg1;

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

@ -68,9 +68,9 @@ static void CheckCanonicalNaN() {
// with our canonical NaN, we must canonicalize every double. This
// is implemented for C++ code in Value::bitsFromDouble, but is not
// implemented for JIT code.
#if !defined(JS_CODEGEN_NONE)
#error "No JIT support for non-canonical hardware NaN"
#endif
# if !defined(JS_CODEGEN_NONE)
# error "No JIT support for non-canonical hardware NaN"
# endif
#else
// Assert that the NaN generated by hardware operations is

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

@ -1474,9 +1474,13 @@ class alignas(uintptr_t) PrivateScriptData final {
explicit PrivateScriptData(uint32_t ngcthings);
public:
static constexpr size_t offsetOfGCThings() {
return sizeof(PrivateScriptData);
}
// Accessors for typed array spans.
mozilla::Span<JS::GCCellPtr> gcthings() {
size_t offset = sizeof(PrivateScriptData);
size_t offset = offsetOfGCThings();
return mozilla::MakeSpan(offsetToPointer<JS::GCCellPtr>(offset), ngcthings);
}
@ -1778,6 +1782,11 @@ class alignas(uintptr_t) SharedScriptData final {
static constexpr size_t offsetOfCodeOffset() {
return offsetof(SharedScriptData, codeOffset_);
}
static constexpr size_t offsetOfResumeOffsetsOffset() {
// Resume-offsets are the first optional array if they exist. Locate the
// array with the 'optArrayOffset_' field.
return offsetof(SharedScriptData, optArrayOffset_);
}
static constexpr size_t offsetOfNfixed() {
return offsetof(SharedScriptData, nfixed);
}
@ -2552,6 +2561,9 @@ class JSScript : public js::gc::TenuredCell {
static constexpr size_t offsetOfScriptData() {
return offsetof(JSScript, scriptData_);
}
static constexpr size_t offsetOfPrivateScriptData() {
return offsetof(JSScript, data_);
}
static constexpr size_t offsetOfJitScript() {
return offsetof(JSScript, jitScript_);
}

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

@ -48,10 +48,9 @@ enum RegExpRunStatus {
/*
* Layout of the reg exp bytecode header.
*/
struct RegExpByteCodeHeader
{
uint32_t length; // Number of instructions.
uint32_t numRegisters; // Number of registers used.
struct RegExpByteCodeHeader {
uint32_t length; // Number of instructions.
uint32_t numRegisters; // Number of registers used.
};
/*

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

@ -76,8 +76,8 @@ static void DisassembleCode(uint8_t* code, size_t codeLen) {
#if defined(JS_CODEGEN_X64) && defined(JS_JITSPEW) && \
defined(ENABLE_WASM_CRANELIFT)
zydisDisassemble(code, codeLen, [](const char* text) {
JitSpew(JitSpew_Codegen, "%s", text);
});
JitSpew(JitSpew_Codegen, "%s", text);
});
#else
JitSpew(JitSpew_Codegen, "*** No disassembly available ***");
#endif
@ -441,21 +441,21 @@ bool wasm::CraneliftCompileFunctions(const ModuleEnvironment& env,
uint32_t totalCodeSize = masm.currentOffset();
uint8_t* codeBuf = (uint8_t*)js_malloc(totalCodeSize);
if (codeBuf) {
masm.executableCopy(codeBuf, totalCodeSize);
masm.executableCopy(codeBuf, totalCodeSize);
for (const FuncCompileInput& func : inputs) {
JitSpew(JitSpew_Codegen, "# ========================================");
JitSpew(JitSpew_Codegen, "# Start of wasm cranelift code for index %d",
(int)func.index);
for (const FuncCompileInput& func : inputs) {
JitSpew(JitSpew_Codegen, "# ========================================");
JitSpew(JitSpew_Codegen, "# Start of wasm cranelift code for index %d",
(int)func.index);
uint32_t codeStart = code->codeRanges[func.index].begin();
uint32_t codeEnd = code->codeRanges[func.index].end();
DisassembleCode(codeBuf + codeStart, codeEnd - codeStart);
uint32_t codeStart = code->codeRanges[func.index].begin();
uint32_t codeEnd = code->codeRanges[func.index].end();
DisassembleCode(codeBuf + codeStart, codeEnd - codeStart);
JitSpew(JitSpew_Codegen, "# End of wasm cranelift code for index %d",
(int)func.index);
}
js_free(codeBuf);
JitSpew(JitSpew_Codegen, "# End of wasm cranelift code for index %d",
(int)func.index);
}
js_free(codeBuf);
}
}

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

@ -1124,7 +1124,7 @@ nsDocumentViewer::LoadComplete(nsresult aStatus) {
RefPtr<nsDocShell> docShell = nsDocShell::Cast(childIDocShell);
if (docShell && docShell->TreatAsBackgroundLoad() &&
docShell->GetDocument()->GetReadyStateEnum() <
Document::READYSTATE_COMPLETE) {
Document::READYSTATE_COMPLETE) {
docShells.AppendElement(childIDocShell);
}
}
@ -1134,7 +1134,7 @@ nsDocumentViewer::LoadComplete(nsresult aStatus) {
RefPtr<nsDocShell> docShell = nsDocShell::Cast(docShells[i]);
if (docShell && docShell->TreatAsBackgroundLoad() &&
docShell->GetDocument()->GetReadyStateEnum() <
Document::READYSTATE_COMPLETE) {
Document::READYSTATE_COMPLETE) {
nsEventStatus status = nsEventStatus_eIgnore;
WidgetEvent event(true, eLoad);
event.mFlags.mBubbles = false;
@ -1144,7 +1144,8 @@ nsDocumentViewer::LoadComplete(nsresult aStatus) {
nsCOMPtr<Element> element = win->GetFrameElementInternal();
docShell->SetFakeOnLoadDispatched();
EventDispatcher::Dispatch(element, nullptr, &event, nullptr, &status);
EventDispatcher::Dispatch(element, nullptr, &event, nullptr,
&status);
}
}
}

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

@ -835,7 +835,8 @@ struct nsGridContainerFrame::UsedTrackSizes {
/** Helper function for the above method */
void ResolveSubgridTrackSizesForAxis(nsGridContainerFrame* aFrame,
LogicalAxis aAxis, Subgrid* aSubgrid,
gfxContext& aRC, nscoord aContentBoxSize);
gfxContext& aRC,
nscoord aContentBoxSize);
// This only has valid sizes when mCanResolveLineRangeSize is true in
// the same axis. It may have zero tracks (a grid with only abs.pos.
@ -3011,9 +3012,11 @@ void nsGridContainerFrame::UsedTrackSizes::ResolveTrackSizesForAxis(
const auto& range = subgrid->mArea.LineRangeForAxis(parentAxis);
nscoord contentBoxSize = range.ToLength(parentSizes->mSizes[parentAxis]);
auto parentWM = aFrame->GetParent()->GetWritingMode();
contentBoxSize -= subgrid->mMarginBorderPadding.StartEnd(parentAxis, parentWM);
contentBoxSize -=
subgrid->mMarginBorderPadding.StartEnd(parentAxis, parentWM);
contentBoxSize = std::max(nscoord(0), contentBoxSize);
ResolveSubgridTrackSizesForAxis(aFrame, aAxis, subgrid, aRC, contentBoxSize);
ResolveSubgridTrackSizesForAxis(aFrame, aAxis, subgrid, aRC,
contentBoxSize);
}
}
@ -3050,7 +3053,8 @@ void nsGridContainerFrame::GridReflowInput::CalculateTrackSizesForAxis(
if (MOZ_LIKELY(!isSubgriddedAxis)) {
tracks.Initialize(sizingFunctions, gapStyle, gridEnd, aContentBoxSize);
} else {
tracks.mGridGap = nsLayoutUtils::ResolveGapToLength(gapStyle, aContentBoxSize);
tracks.mGridGap =
nsLayoutUtils::ResolveGapToLength(gapStyle, aContentBoxSize);
tracks.mContentBoxSize = aContentBoxSize;
const auto* subgrid = mFrame->GetProperty(Subgrid::Prop());
tracks.mSizes.SetLength(gridEnd);
@ -3097,7 +3101,8 @@ void nsGridContainerFrame::GridReflowInput::CalculateTrackSizesForAxis(
}
if (aContentBoxSize != NS_UNCONSTRAINEDSIZE) {
tracks.AlignJustifyContent(mGridStyle, mWM, aContentBoxSize, isSubgriddedAxis);
tracks.AlignJustifyContent(mGridStyle, mWM, aContentBoxSize,
isSubgriddedAxis);
} else if (!useParentGaps) {
const nscoord gridGap = tracks.mGridGap;
nscoord pos = 0;

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

@ -3853,10 +3853,10 @@ nscolor nsTextPaintStyle::GetTextColor() {
if (!mResolveColors) return NS_SAME_AS_FOREGROUND_COLOR;
const nsStyleSVG* style = mFrame->StyleSVG();
switch (style->mFill.Type()) {
case eStyleSVGPaintType_None:
switch (style->mFill.kind.tag) {
case StyleSVGPaintKind::Tag::None:
return NS_RGBA(0, 0, 0, 0);
case eStyleSVGPaintType_Color:
case StyleSVGPaintKind::Tag::Color:
return nsLayoutUtils::GetColor(mFrame, &nsStyleSVG::mFill);
default:
NS_ERROR("cannot resolve SVG paint to nscolor");
@ -6430,8 +6430,7 @@ nscolor nsTextFrame::GetCaretColorAt(int32_t aOffset) {
bool isSolidTextColor = true;
if (nsSVGUtils::IsInSVGTextSubtree(this)) {
const nsStyleSVG* style = StyleSVG();
if (style->mFill.Type() != eStyleSVGPaintType_None &&
style->mFill.Type() != eStyleSVGPaintType_Color) {
if (!style->mFill.kind.IsNone() && !style->mFill.kind.IsColor()) {
isSolidTextColor = false;
}
}

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

@ -3797,7 +3797,7 @@ UniquePtr<InactiveLayerData> PaintedLayerData::CreateInactiveLayerData(
FrameLayerBuilder* layerBuilder = new FrameLayerBuilder();
// Ownership of layerBuilder is passed to tempManager.
layerBuilder->Init(aState->Builder(), tempManager, this, true,
&aItem->GetClip());
&aItem->GetClip());
tempManager->BeginTransaction();
if (aState->LayerBuilder()->GetRetainingLayerManager()) {

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

@ -119,7 +119,6 @@ static Tuple<gfxPoint, gfxPoint> ComputeLinearGradientLine(
gfxPoint start(startX, startY);
gfxPoint end = gfxPoint(aBoxSize.width, aBoxSize.height) - start;
return MakeTuple(start, end);
}
default:
break;

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

@ -626,9 +626,7 @@ class nsDisplayListBuilder {
void SetPartialUpdate(bool aPartial) { mPartialUpdate = aPartial; }
bool IsBuilding() const { return mIsBuilding; }
void SetIsBuilding(bool aIsBuilding) {
mIsBuilding = aIsBuilding;
}
void SetIsBuilding(bool aIsBuilding) { mIsBuilding = aIsBuilding; }
bool InInvalidSubtree() const { return mInInvalidSubtree; }

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

@ -0,0 +1,4 @@
<!doctype html>
<div style="font: message-box">
System font text.
</div>

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

@ -0,0 +1,8 @@
<!doctype html>
<div style="font: message-box">
System font text.
</div>
<script>
let el = document.querySelector("div");
el.style.fontSize = (2 * parseFloat(getComputedStyle(el).fontSize)) + "px";
</script>

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

@ -0,0 +1,5 @@
<!doctype html>
<html reftest-text-zoom="2">
<div style="font: message-box">
System font text.
</div>

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

@ -2110,5 +2110,7 @@ skip-if(!asyncPan) == 1544895.html 1544895-ref.html
== 1548809.html 1548809-ref.html
!= 1552789-1.html 1552789-ref-1.html
== 1558937-1.html 1558937-1-ref.html
!= 1563484.html 1563484-notref.html
== 1563484.html 1563484-ref.html
fuzzy-if(!webrender||!winWidget,254-255,464-1613) fuzzy-if(geckoview&&webrender,253-253,1397-1397) == 1562733-rotated-nastaliq-1.html 1562733-rotated-nastaliq-1-ref.html
== 1562733-rotated-nastaliq-2.html 1562733-rotated-nastaliq-2-ref.html

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

@ -9,6 +9,9 @@
# test that zoom works (and really zooms, not just scales)
== test-zoom.html test-zoom-ref.html
== text-zoom.html text-zoom-ref.html
!= text-zoom.html text-zoom-notref.html
# make sure we don't fall over if the root is missing
== no-root.html about:blank

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

@ -0,0 +1,2 @@
<!doctype html>
<div style="font: 16px/1 monospace">Foo</div>

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

@ -0,0 +1,2 @@
<!doctype html>
<div style="font: 32px/1 monospace">Foo</div>

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

@ -0,0 +1,3 @@
<!doctype html>
<html reftest-text-zoom="2">
<div style="font: 16px/1 monospace">Foo</div>

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

@ -296,10 +296,10 @@ static nscolor ExtractColor(const ComputedStyle& aStyle,
return ExtractColor(aStyle, aColor.AsColor());
}
static nscolor ExtractColor(ComputedStyle& aStyle,
const nsStyleSVGPaint& aPaintServer) {
return aPaintServer.Type() == eStyleSVGPaintType_Color
? aPaintServer.GetColor(&aStyle)
static nscolor ExtractColor(const ComputedStyle& aStyle,
const StyleSVGPaint& aPaintServer) {
return aPaintServer.kind.IsColor()
? ExtractColor(aStyle, aPaintServer.kind.AsColor())
: NS_RGBA(0, 0, 0, 0);
}

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

@ -1496,18 +1496,6 @@ void Gecko_SetToSVGPath(StyleShapeSource* aShape,
aShape->SetPath(MakeUnique<StyleSVGPath>(aCommands, aFill));
}
void Gecko_nsStyleSVGPaint_CopyFrom(nsStyleSVGPaint* aDest,
const nsStyleSVGPaint* aSrc) {
*aDest = *aSrc;
}
void Gecko_nsStyleSVGPaint_SetURLValue(nsStyleSVGPaint* aPaint,
const StyleComputedUrl* aURL) {
aPaint->SetPaintServer(*aURL);
}
void Gecko_nsStyleSVGPaint_Reset(nsStyleSVGPaint* aPaint) { aPaint->SetNone(); }
void Gecko_nsStyleSVG_SetDashArrayLength(nsStyleSVG* aSvg, uint32_t aLen) {
aSvg->mStrokeDasharray.Clear();
aSvg->mStrokeDasharray.SetLength(aLen);

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

@ -520,14 +520,6 @@ void Gecko_ResetFilters(nsStyleEffects* effects, size_t new_len);
void Gecko_CopyFiltersFrom(nsStyleEffects* aSrc, nsStyleEffects* aDest);
void Gecko_nsStyleSVGPaint_CopyFrom(nsStyleSVGPaint* dest,
const nsStyleSVGPaint* src);
void Gecko_nsStyleSVGPaint_SetURLValue(nsStyleSVGPaint* paint,
const mozilla::StyleComputedUrl* url);
void Gecko_nsStyleSVGPaint_Reset(nsStyleSVGPaint* paint);
void Gecko_nsStyleSVG_SetDashArrayLength(nsStyleSVG* svg, uint32_t len);
void Gecko_nsStyleSVG_CopyDashArray(nsStyleSVG* dst, const nsStyleSVG* src);

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

@ -130,8 +130,6 @@ rusty-enums = [
"mozilla::StyleFlexDirection",
"mozilla::StyleTextDecorationSkipInk",
"nsStyleImageType",
"nsStyleSVGPaintType",
"nsStyleSVGFallbackType",
"nsINode_BooleanFlag",
"mozilla::PseudoStyleType",
"mozilla::LookAndFeel_ColorID",
@ -291,7 +289,6 @@ whitelist-types = [
"nsStyleSides",
"nsStyleSVG",
"nsStyleSVGOpacitySource",
"nsStyleSVGPaint",
"nsStyleSVGReset",
"nsStyleTable",
"nsStyleTableBorder",
@ -516,6 +513,7 @@ cbindgen-types = [
{ gecko = "StyleGenericTrackSize", servo = "values::generics::grid::TrackSize" },
{ gecko = "StyleGenericTrackBreadth", servo = "values::generics::grid::TrackBreadth" },
{ gecko = "StyleNumberOrPercentage", servo = "values::computed::NumberOrPercentage" },
{ gecko = "StyleGenericSVGPaint", servo = "values::generics::svg::SVGPaint" },
]
mapped-generic-types = [

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

@ -252,7 +252,7 @@ inline StyleAtom::StyleAtom(already_AddRefed<nsAtom> aAtom) {
nsAtom* atom = aAtom.take();
if (atom->IsStatic()) {
ptrdiff_t offset = reinterpret_cast<const uint8_t*>(atom->AsStatic()) -
reinterpret_cast<const uint8_t*>(&detail::gGkAtoms);
reinterpret_cast<const uint8_t*>(&detail::gGkAtoms);
_0 = (offset << 1) | 1;
} else {
_0 = reinterpret_cast<uintptr_t>(atom);

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

@ -729,12 +729,15 @@ nsChangeHint nsStyleColumn::CalcDifference(
return nsChangeHint(0);
}
using SVGPaintFallback = StyleGenericSVGPaintFallback<StyleColor>;
// --------------------
// nsStyleSVG
//
nsStyleSVG::nsStyleSVG(const Document& aDocument)
: mFill(eStyleSVGPaintType_Color), // Will be initialized to NS_RGB(0,0,0)
mStroke(eStyleSVGPaintType_None),
: mFill{StyleSVGPaintKind::Color(StyleColor::Black()),
SVGPaintFallback::Unset()},
mStroke{StyleSVGPaintKind::None(), SVGPaintFallback::Unset()},
mMarkerEnd(StyleUrlOrNone::None()),
mMarkerMid(StyleUrlOrNone::None()),
mMarkerStart(StyleUrlOrNone::None()),
@ -787,14 +790,13 @@ nsStyleSVG::nsStyleSVG(const nsStyleSVG& aSource)
MOZ_COUNT_CTOR(nsStyleSVG);
}
static bool PaintURIChanged(const nsStyleSVGPaint& aPaint1,
const nsStyleSVGPaint& aPaint2) {
if (aPaint1.Type() != aPaint2.Type()) {
return aPaint1.Type() == eStyleSVGPaintType_Server ||
aPaint2.Type() == eStyleSVGPaintType_Server;
static bool PaintURIChanged(const StyleSVGPaint& aPaint1,
const StyleSVGPaint& aPaint2) {
if (aPaint1.kind.IsPaintServer() != aPaint2.kind.IsPaintServer()) {
return true;
}
return aPaint1.Type() == eStyleSVGPaintType_Server &&
aPaint1.GetPaintServer() != aPaint2.GetPaintServer();
return aPaint1.kind.IsPaintServer() &&
aPaint1.kind.AsPaintServer() != aPaint2.kind.AsPaintServer();
}
nsChangeHint nsStyleSVG::CalcDifference(const nsStyleSVG& aNewData) const {
@ -1150,126 +1152,6 @@ bool nsStyleSVGReset::HasMask() const {
return false;
}
// nsStyleSVGPaint implementation
nsStyleSVGPaint::nsStyleSVGPaint(nsStyleSVGPaintType aType)
: mPaint(StyleColor::Black()),
mType(aType),
mFallbackType(eStyleSVGFallbackType_NotSet),
mFallbackColor(StyleColor::Black()) {
MOZ_ASSERT(aType == nsStyleSVGPaintType(0) ||
aType == eStyleSVGPaintType_None ||
aType == eStyleSVGPaintType_Color);
}
nsStyleSVGPaint::nsStyleSVGPaint(const nsStyleSVGPaint& aSource)
: nsStyleSVGPaint(nsStyleSVGPaintType(0)) {
Assign(aSource);
}
nsStyleSVGPaint::~nsStyleSVGPaint() { Reset(); }
void nsStyleSVGPaint::Reset() {
switch (mType) {
case eStyleSVGPaintType_None:
break;
case eStyleSVGPaintType_Color:
mPaint.mColor = StyleColor::Black();
break;
case eStyleSVGPaintType_Server:
mPaint.mPaintServer.~StyleComputedUrl();
MOZ_FALLTHROUGH;
case eStyleSVGPaintType_ContextFill:
case eStyleSVGPaintType_ContextStroke:
mFallbackType = eStyleSVGFallbackType_NotSet;
mFallbackColor = StyleColor::Black();
break;
}
mType = nsStyleSVGPaintType(0);
}
nsStyleSVGPaint& nsStyleSVGPaint::operator=(const nsStyleSVGPaint& aOther) {
if (this != &aOther) {
Assign(aOther);
}
return *this;
}
void nsStyleSVGPaint::Assign(const nsStyleSVGPaint& aOther) {
MOZ_ASSERT(aOther.mType != nsStyleSVGPaintType(0),
"shouldn't copy uninitialized nsStyleSVGPaint");
switch (aOther.mType) {
case eStyleSVGPaintType_None:
SetNone();
break;
case eStyleSVGPaintType_Color:
SetColor(aOther.mPaint.mColor);
break;
case eStyleSVGPaintType_Server:
SetPaintServer(aOther.mPaint.mPaintServer, aOther.mFallbackType,
aOther.mFallbackColor);
break;
case eStyleSVGPaintType_ContextFill:
case eStyleSVGPaintType_ContextStroke:
SetContextValue(aOther.mType, aOther.mFallbackType,
aOther.mFallbackColor);
break;
}
}
void nsStyleSVGPaint::SetNone() {
Reset();
mType = eStyleSVGPaintType_None;
}
void nsStyleSVGPaint::SetContextValue(nsStyleSVGPaintType aType,
nsStyleSVGFallbackType aFallbackType,
StyleColor aFallbackColor) {
MOZ_ASSERT(aType == eStyleSVGPaintType_ContextFill ||
aType == eStyleSVGPaintType_ContextStroke);
Reset();
mType = aType;
mFallbackType = aFallbackType;
mFallbackColor = aFallbackColor;
}
void nsStyleSVGPaint::SetColor(StyleColor aColor) {
Reset();
mType = eStyleSVGPaintType_Color;
mPaint.mColor = aColor;
}
void nsStyleSVGPaint::SetPaintServer(const StyleComputedUrl& aPaintServer,
nsStyleSVGFallbackType aFallbackType,
StyleColor aFallbackColor) {
Reset();
mType = eStyleSVGPaintType_Server;
new (&mPaint.mPaintServer) StyleComputedUrl(aPaintServer);
mFallbackType = aFallbackType;
mFallbackColor = aFallbackColor;
}
bool nsStyleSVGPaint::operator==(const nsStyleSVGPaint& aOther) const {
if (mType != aOther.mType) {
return false;
}
switch (mType) {
case eStyleSVGPaintType_Color:
return mPaint.mColor == aOther.mPaint.mColor;
case eStyleSVGPaintType_Server:
return mPaint.mPaintServer == aOther.mPaint.mPaintServer &&
mFallbackType == aOther.mFallbackType &&
mFallbackColor == aOther.mFallbackColor;
case eStyleSVGPaintType_ContextFill:
case eStyleSVGPaintType_ContextStroke:
return mFallbackType == aOther.mFallbackType &&
mFallbackColor == aOther.mFallbackColor;
default:
MOZ_ASSERT(mType == eStyleSVGPaintType_None, "Unexpected SVG paint type");
return true;
}
}
// --------------------
// nsStylePosition
//
@ -1520,7 +1402,8 @@ nsChangeHint nsStylePosition::CalcDifference(
hint |=
nsChangeHint_RecomputePosition | nsChangeHint_UpdateParentOverflow;
} else {
hint |= nsChangeHint_NeedReflow | nsChangeHint_ReflowChangesSizeOrPosition;
hint |=
nsChangeHint_NeedReflow | nsChangeHint_ReflowChangesSizeOrPosition;
}
}
return hint;
@ -3185,7 +3068,8 @@ nsChangeHint nsStyleDisplay::CalcDifference(
// reflow anyway.
if (IsAbsolutelyPositionedStyle() &&
aOldPosition.NeedsHypotheticalPositionIfAbsPos()) {
hint |= nsChangeHint_NeedReflow | nsChangeHint_ReflowChangesSizeOrPosition;
hint |=
nsChangeHint_NeedReflow | nsChangeHint_ReflowChangesSizeOrPosition;
} else {
hint |= nsChangeHint_NeutralChange;
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше