diff options
Diffstat (limited to 'layout/style')
82 files changed, 190 insertions, 173 deletions
diff --git a/layout/style/AnimationCollection.cpp b/layout/style/AnimationCollection.cpp index f7826f5ed..fc913f27f 100644 --- a/layout/style/AnimationCollection.cpp +++ b/layout/style/AnimationCollection.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/AnimationCollection.h b/layout/style/AnimationCollection.h index 96163fcc8..efab94bdc 100644 --- a/layout/style/AnimationCollection.h +++ b/layout/style/AnimationCollection.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/AnimationCommon.cpp b/layout/style/AnimationCommon.cpp index f4ebc2a93..27682e0ea 100644 --- a/layout/style/AnimationCommon.cpp +++ b/layout/style/AnimationCommon.cpp @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/AnimationCommon.h b/layout/style/AnimationCommon.h index 025c034a4..61a60a53e 100644 --- a/layout/style/AnimationCommon.h +++ b/layout/style/AnimationCommon.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/CSSCalc.h b/layout/style/CSSCalc.h index 141ca9c0a..06a570c73 100644 --- a/layout/style/CSSCalc.h +++ b/layout/style/CSSCalc.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/CSSEnabledState.h b/layout/style/CSSEnabledState.h index 650397072..da9a10fe0 100644 --- a/layout/style/CSSEnabledState.h +++ b/layout/style/CSSEnabledState.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/CSSRuleList.cpp b/layout/style/CSSRuleList.cpp index 8493e8a37..0e4df33d2 100644 --- a/layout/style/CSSRuleList.cpp +++ b/layout/style/CSSRuleList.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/CSSUnprefixingService.js b/layout/style/CSSUnprefixingService.js index 801ea198c..f6c63a023 100644 --- a/layout/style/CSSUnprefixingService.js +++ b/layout/style/CSSUnprefixingService.js @@ -1,5 +1,4 @@ /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- / -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/CSSValue.h b/layout/style/CSSValue.h index ecba05e84..c02341d01 100644 --- a/layout/style/CSSValue.h +++ b/layout/style/CSSValue.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/CSSVariableDeclarations.cpp b/layout/style/CSSVariableDeclarations.cpp index 67bb8d732..34a2bb035 100644 --- a/layout/style/CSSVariableDeclarations.cpp +++ b/layout/style/CSSVariableDeclarations.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/CSSVariableDeclarations.h b/layout/style/CSSVariableDeclarations.h index ebc17285b..294e71a00 100644 --- a/layout/style/CSSVariableDeclarations.h +++ b/layout/style/CSSVariableDeclarations.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/CSSVariableResolver.cpp b/layout/style/CSSVariableResolver.cpp index 0d25b747b..abf9fc12a 100644 --- a/layout/style/CSSVariableResolver.cpp +++ b/layout/style/CSSVariableResolver.cpp @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/CSSVariableResolver.h b/layout/style/CSSVariableResolver.h index f9758ca3a..ec7d1386f 100644 --- a/layout/style/CSSVariableResolver.h +++ b/layout/style/CSSVariableResolver.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/CSSVariableValues.h b/layout/style/CSSVariableValues.h index e26566be1..3e4c6d9d0 100644 --- a/layout/style/CSSVariableValues.h +++ b/layout/style/CSSVariableValues.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/CounterStyleManager.cpp b/layout/style/CounterStyleManager.cpp index bccc9b836..b36fe5021 100644 --- a/layout/style/CounterStyleManager.cpp +++ b/layout/style/CounterStyleManager.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/CounterStyleManager.h b/layout/style/CounterStyleManager.h index 2f760f340..8445562ef 100644 --- a/layout/style/CounterStyleManager.h +++ b/layout/style/CounterStyleManager.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/DeclarationBlock.h b/layout/style/DeclarationBlock.h index c3ed663b4..180b32cba 100644 --- a/layout/style/DeclarationBlock.h +++ b/layout/style/DeclarationBlock.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/DeclarationBlockInlines.h b/layout/style/DeclarationBlockInlines.h index 791d24498..e8ff3ebba 100644 --- a/layout/style/DeclarationBlockInlines.h +++ b/layout/style/DeclarationBlockInlines.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/DocumentStyleRootIterator.cpp b/layout/style/DocumentStyleRootIterator.cpp index af95c5c4f..d99454ee0 100644 --- a/layout/style/DocumentStyleRootIterator.cpp +++ b/layout/style/DocumentStyleRootIterator.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/DocumentStyleRootIterator.h b/layout/style/DocumentStyleRootIterator.h index 98d9fd32f..7c07d5c2c 100644 --- a/layout/style/DocumentStyleRootIterator.h +++ b/layout/style/DocumentStyleRootIterator.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/FontFaceSet.cpp b/layout/style/FontFaceSet.cpp index 81c5ede0e..7309ef3fb 100644 --- a/layout/style/FontFaceSet.cpp +++ b/layout/style/FontFaceSet.cpp @@ -1,5 +1,4 @@ /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/HandleRefPtr.h b/layout/style/HandleRefPtr.h index 0a73a4cf7..487634c47 100644 --- a/layout/style/HandleRefPtr.h +++ b/layout/style/HandleRefPtr.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * vim: set ts=2 sw=2 et tw=78: * 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/. diff --git a/layout/style/IncrementalClearCOMRuleArray.cpp b/layout/style/IncrementalClearCOMRuleArray.cpp index 92cdced22..76baec794 100644 --- a/layout/style/IncrementalClearCOMRuleArray.cpp +++ b/layout/style/IncrementalClearCOMRuleArray.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/IncrementalClearCOMRuleArray.h b/layout/style/IncrementalClearCOMRuleArray.h index 9934fd683..2b17b9163 100644 --- a/layout/style/IncrementalClearCOMRuleArray.h +++ b/layout/style/IncrementalClearCOMRuleArray.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/LayerAnimationInfo.cpp b/layout/style/LayerAnimationInfo.cpp index 8a119512b..035054eb4 100644 --- a/layout/style/LayerAnimationInfo.cpp +++ b/layout/style/LayerAnimationInfo.cpp @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/LayerAnimationInfo.h b/layout/style/LayerAnimationInfo.h index 53c5ae9bf..461695c63 100644 --- a/layout/style/LayerAnimationInfo.h +++ b/layout/style/LayerAnimationInfo.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/MediaQueryList.cpp b/layout/style/MediaQueryList.cpp index db3781b76..5838645be 100644 --- a/layout/style/MediaQueryList.cpp +++ b/layout/style/MediaQueryList.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ @@ -7,19 +6,26 @@ /* implements DOM interface for querying and observing media queries */ #include "mozilla/dom/MediaQueryList.h" +#include "mozilla/dom/MediaQueryListEvent.h" +#include "mozilla/dom/EventTarget.h" +#include "mozilla/dom/EventTargetBinding.h" #include "nsPresContext.h" #include "nsIMediaList.h" #include "nsCSSParser.h" #include "nsIDocument.h" +// Fixed event target type +#define ONCHANGE_STRING NS_LITERAL_STRING("change") + namespace mozilla { namespace dom { MediaQueryList::MediaQueryList(nsIDocument *aDocument, const nsAString &aMediaQueryList) - : mDocument(aDocument), - mMediaList(new nsMediaList), - mMatchesValid(false) + : mDocument(aDocument) + , mMediaList(new nsMediaList) + , mMatchesValid(false) + , mIsKeptAlive(false) { PR_INIT_CLIST(this); @@ -36,30 +42,24 @@ MediaQueryList::~MediaQueryList() NS_IMPL_CYCLE_COLLECTION_CLASS(MediaQueryList) -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(MediaQueryList) +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(MediaQueryList, DOMEventTargetHelper) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocument) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCallbacks) NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END -NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(MediaQueryList) +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(MediaQueryList, DOMEventTargetHelper) if (tmp->mDocument) { PR_REMOVE_LINK(tmp); NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocument) } - tmp->RemoveAllListeners(); + tmp->Disconnect(); NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER NS_IMPL_CYCLE_COLLECTION_UNLINK_END -NS_IMPL_CYCLE_COLLECTION_TRACE_WRAPPERCACHE(MediaQueryList) - -NS_INTERFACE_MAP_BEGIN(MediaQueryList) - NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY - NS_INTERFACE_MAP_ENTRY(nsISupports) - NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(MediaQueryList) -NS_INTERFACE_MAP_END +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(MediaQueryList) +NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper) -NS_IMPL_CYCLE_COLLECTING_ADDREF(MediaQueryList) -NS_IMPL_CYCLE_COLLECTING_RELEASE(MediaQueryList) +NS_IMPL_ADDREF_INHERITED(MediaQueryList, DOMEventTargetHelper) +NS_IMPL_RELEASE_INHERITED(MediaQueryList, DOMEventTargetHelper) void MediaQueryList::GetMedia(nsAString &aMedia) @@ -80,57 +80,124 @@ MediaQueryList::Matches() } void -MediaQueryList::AddListener(MediaQueryListListener& aListener) +MediaQueryList::AddListener(EventListener* aListener, ErrorResult& aRv) { - if (!HasListeners()) { - // When we have listeners, the pres context owns a reference to - // this. This is a cyclic reference that can only be broken by - // cycle collection. - NS_ADDREF_THIS(); + if (!aListener) { + return; } + AddEventListenerOptionsOrBoolean options; + options.SetAsBoolean() = false; + + AddEventListener(ONCHANGE_STRING, aListener, options, Nullable<bool>(), aRv); +} + +void +MediaQueryList::AddEventListener(const nsAString& aType, + EventListener* aCallback, + const AddEventListenerOptionsOrBoolean& aOptions, + const dom::Nullable<bool>& aWantsUntrusted, + ErrorResult& aRv) +{ if (!mMatchesValid) { MOZ_ASSERT(!HasListeners(), "when listeners present, must keep mMatches current"); RecomputeMatches(); } - for (uint32_t i = 0; i < mCallbacks.Length(); ++i) { - if (aListener == *mCallbacks[i]) { - // Already registered - return; - } + DOMEventTargetHelper::AddEventListener(aType, aCallback, aOptions, + aWantsUntrusted, aRv); + + if (aRv.Failed()) { + return; } - if (!mCallbacks.AppendElement(&aListener, fallible)) { - if (!HasListeners()) { - // Append failed; undo the AddRef above. - NS_RELEASE_THIS(); - } + UpdateMustKeepAlive(); +} + +void +MediaQueryList::RemoveListener(EventListener* aListener, ErrorResult& aRv) +{ + if (!aListener) { + return; } + + EventListenerOptionsOrBoolean options; + options.SetAsBoolean() = false; + + RemoveEventListener(ONCHANGE_STRING, aListener, options, aRv); } void -MediaQueryList::RemoveListener(MediaQueryListListener& aListener) -{ - for (uint32_t i = 0; i < mCallbacks.Length(); ++i) { - if (aListener == *mCallbacks[i]) { - mCallbacks.RemoveElementAt(i); - if (!HasListeners()) { - // See NS_ADDREF_THIS() in AddListener. - NS_RELEASE_THIS(); - } - break; - } +MediaQueryList::RemoveEventListener(const nsAString& aType, + EventListener* aCallback, + const EventListenerOptionsOrBoolean& aOptions, + ErrorResult& aRv) +{ + DOMEventTargetHelper::RemoveEventListener(aType, aCallback, aOptions, aRv); + + if (aRv.Failed()) { + return; + } + + UpdateMustKeepAlive(); +} + +EventHandlerNonNull* +MediaQueryList::GetOnchange() +{ + if (NS_IsMainThread()) { + return GetEventHandler(nsGkAtoms::onchange, EmptyString()); + } + return GetEventHandler(nullptr, ONCHANGE_STRING); +} + +void +MediaQueryList::SetOnchange(EventHandlerNonNull* aCallback) +{ + if (NS_IsMainThread()) { + SetEventHandler(nsGkAtoms::onchange, EmptyString(), aCallback); + } else { + SetEventHandler(nullptr, ONCHANGE_STRING, aCallback); } + + UpdateMustKeepAlive(); } void -MediaQueryList::RemoveAllListeners() +MediaQueryList::UpdateMustKeepAlive() { - bool hadListeners = HasListeners(); - mCallbacks.Clear(); - if (hadListeners) { + bool toKeepAlive = HasListeners(); + if (toKeepAlive == mIsKeptAlive) { + return; + } + + // When we have listeners, the pres context owns a reference to + // this. This is a cyclic reference that can only be broken by + // cycle collection. + + mIsKeptAlive = toKeepAlive; + + if (toKeepAlive) { + NS_ADDREF_THIS(); + } else { + NS_RELEASE_THIS(); + } +} + +bool +MediaQueryList::HasListeners() +{ + return HasListenersFor(ONCHANGE_STRING); +} + +void +MediaQueryList::Disconnect() +{ + DisconnectFromOwner(); + + if (mIsKeptAlive) { + mIsKeptAlive = false; // See NS_ADDREF_THIS() in AddListener. NS_RELEASE_THIS(); } @@ -169,27 +236,6 @@ MediaQueryList::RecomputeMatches() mMatchesValid = true; } -void -MediaQueryList::MediumFeaturesChanged( - nsTArray<HandleChangeData>& aListenersToNotify) -{ - mMatchesValid = false; - - if (HasListeners()) { - bool oldMatches = mMatches; - RecomputeMatches(); - if (mMatches != oldMatches) { - for (uint32_t i = 0, i_end = mCallbacks.Length(); i != i_end; ++i) { - HandleChangeData *d = aListenersToNotify.AppendElement(fallible); - if (d) { - d->mql = this; - d->callback = mCallbacks[i]; - } - } - } - } -} - nsISupports* MediaQueryList::GetParentObject() const { @@ -202,5 +248,36 @@ MediaQueryList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) return MediaQueryListBinding::Wrap(aCx, this, aGivenProto); } +void +MediaQueryList::MaybeNotify() +{ + mMatchesValid = false; + + if (!HasListeners()) { + return; + } + + bool oldMatches = mMatches; + RecomputeMatches(); + + // No need to notify the change. + if (mMatches == oldMatches) { + return; + } + + MediaQueryListEventInit init; + init.mBubbles = false; + init.mCancelable = false; + init.mMatches = mMatches; + mMediaList->GetText(init.mMedia); + + RefPtr<MediaQueryListEvent> event = + MediaQueryListEvent::Constructor(this, ONCHANGE_STRING, init); + event->SetTrusted(true); + + bool dummy; + DispatchEvent(event, &dummy); +} + } // namespace dom } // namespace mozilla diff --git a/layout/style/MediaQueryList.h b/layout/style/MediaQueryList.h index 5ba568528..b660d523e 100644 --- a/layout/style/MediaQueryList.h +++ b/layout/style/MediaQueryList.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ @@ -16,6 +15,7 @@ #include "prclist.h" #include "mozilla/Attributes.h" #include "nsWrapperCache.h" +#include "mozilla/DOMEventTargetHelper.h" #include "mozilla/dom/MediaQueryListBinding.h" class nsIDocument; @@ -24,8 +24,7 @@ class nsMediaList; namespace mozilla { namespace dom { -class MediaQueryList final : public nsISupports, - public nsWrapperCache, +class MediaQueryList final : public DOMEventTargetHelper, public PRCList { public: @@ -37,33 +36,45 @@ private: ~MediaQueryList(); public: - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MediaQueryList) + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MediaQueryList, DOMEventTargetHelper) nsISupports* GetParentObject() const; - struct HandleChangeData { - RefPtr<MediaQueryList> mql; - RefPtr<mozilla::dom::MediaQueryListListener> callback; - }; - - // Appends listeners that need notification to aListenersToNotify - void MediumFeaturesChanged(nsTArray<HandleChangeData>& aListenersToNotify); - - bool HasListeners() const { return !mCallbacks.IsEmpty(); } - - void RemoveAllListeners(); + void MaybeNotify(); JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override; // WebIDL methods void GetMedia(nsAString& aMedia); bool Matches(); - void AddListener(mozilla::dom::MediaQueryListListener& aListener); - void RemoveListener(mozilla::dom::MediaQueryListListener& aListener); + void AddListener(EventListener* aListener, ErrorResult& aRv); + void RemoveListener(EventListener* aListener, ErrorResult& aRv); + + EventHandlerNonNull* GetOnchange(); + void SetOnchange(EventHandlerNonNull* aCallback); + + using nsIDOMEventTarget::AddEventListener; + using nsIDOMEventTarget::RemoveEventListener; + + virtual void AddEventListener(const nsAString& aType, + EventListener* aCallback, + const AddEventListenerOptionsOrBoolean& aOptions, + const Nullable<bool>& aWantsUntrusted, + ErrorResult& aRv) override; + virtual void RemoveEventListener(const nsAString& aType, + EventListener* aCallback, + const EventListenerOptionsOrBoolean& aOptions, + ErrorResult& aRv) override; + + bool HasListeners(); + + void Disconnect(); private: void RecomputeMatches(); + + void UpdateMustKeepAlive(); // We only need a pointer to the document to support lazy // reevaluation following dynamic changes. However, this lazy @@ -84,7 +95,7 @@ private: RefPtr<nsMediaList> mMediaList; bool mMatches; bool mMatchesValid; - nsTArray<RefPtr<mozilla::dom::MediaQueryListListener>> mCallbacks; + bool mIsKeptAlive; }; } // namespace dom diff --git a/layout/style/RuleNodeCacheConditions.cpp b/layout/style/RuleNodeCacheConditions.cpp index 2dbb6c344..194b27591 100644 --- a/layout/style/RuleNodeCacheConditions.cpp +++ b/layout/style/RuleNodeCacheConditions.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=78: */ /* 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/. */ diff --git a/layout/style/RuleProcessorCache.cpp b/layout/style/RuleProcessorCache.cpp index e2e788c56..caaec4dde 100644 --- a/layout/style/RuleProcessorCache.cpp +++ b/layout/style/RuleProcessorCache.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/RuleProcessorCache.h b/layout/style/RuleProcessorCache.h index 7eb808fc9..8d43aed34 100644 --- a/layout/style/RuleProcessorCache.h +++ b/layout/style/RuleProcessorCache.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/ServoBindingList.h b/layout/style/ServoBindingList.h index 3badfc37f..ff0fba408 100644 --- a/layout/style/ServoBindingList.h +++ b/layout/style/ServoBindingList.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/ServoBindingTypes.h b/layout/style/ServoBindingTypes.h index b315d9b49..c1e25aad5 100644 --- a/layout/style/ServoBindingTypes.h +++ b/layout/style/ServoBindingTypes.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/ServoBindings.cpp b/layout/style/ServoBindings.cpp index ad34633e9..5f6842da6 100644 --- a/layout/style/ServoBindings.cpp +++ b/layout/style/ServoBindings.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/ServoBindings.h b/layout/style/ServoBindings.h index 81ea48d5b..a8a621467 100644 --- a/layout/style/ServoBindings.h +++ b/layout/style/ServoBindings.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/ServoElementSnapshot.cpp b/layout/style/ServoElementSnapshot.cpp index 2b1dd840d..ed40ea0f1 100644 --- a/layout/style/ServoElementSnapshot.cpp +++ b/layout/style/ServoElementSnapshot.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/ServoElementSnapshot.h b/layout/style/ServoElementSnapshot.h index 638b2fd31..5f157f817 100644 --- a/layout/style/ServoElementSnapshot.h +++ b/layout/style/ServoElementSnapshot.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/ServoStyleSet.cpp b/layout/style/ServoStyleSet.cpp index 38e02e66d..38752bcc9 100644 --- a/layout/style/ServoStyleSet.cpp +++ b/layout/style/ServoStyleSet.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/ServoStyleSet.h b/layout/style/ServoStyleSet.h index 26b515afd..eacb8378b 100644 --- a/layout/style/ServoStyleSet.h +++ b/layout/style/ServoStyleSet.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/ServoStyleSheet.cpp b/layout/style/ServoStyleSheet.cpp index e03ad2865..8b6decb4f 100644 --- a/layout/style/ServoStyleSheet.cpp +++ b/layout/style/ServoStyleSheet.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/ServoStyleSheet.h b/layout/style/ServoStyleSheet.h index c54c15e7d..d32d57674 100644 --- a/layout/style/ServoStyleSheet.h +++ b/layout/style/ServoStyleSheet.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/ServoTypes.h b/layout/style/ServoTypes.h index 6d1324b88..8bfed9b5a 100644 --- a/layout/style/ServoTypes.h +++ b/layout/style/ServoTypes.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/ServoUtils.h b/layout/style/ServoUtils.h index b116b9c4f..047cbb7a0 100644 --- a/layout/style/ServoUtils.h +++ b/layout/style/ServoUtils.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/SheetParsingMode.h b/layout/style/SheetParsingMode.h index 2eb6b2f64..132b99a79 100644 --- a/layout/style/SheetParsingMode.h +++ b/layout/style/SheetParsingMode.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/StyleAnimationValue.cpp b/layout/style/StyleAnimationValue.cpp index d931961d4..ff6783553 100644 --- a/layout/style/StyleAnimationValue.cpp +++ b/layout/style/StyleAnimationValue.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/StyleBackendType.h b/layout/style/StyleBackendType.h index f02b86213..99d5c154d 100644 --- a/layout/style/StyleBackendType.h +++ b/layout/style/StyleBackendType.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/StyleComplexColor.h b/layout/style/StyleComplexColor.h index 6385b57a1..f3ff126a4 100644 --- a/layout/style/StyleComplexColor.h +++ b/layout/style/StyleComplexColor.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/StyleSetHandle.h b/layout/style/StyleSetHandle.h index ad75f75ae..6c67a058d 100644 --- a/layout/style/StyleSetHandle.h +++ b/layout/style/StyleSetHandle.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/StyleSetHandleInlines.h b/layout/style/StyleSetHandleInlines.h index 2bb32101f..8cc1f53fe 100644 --- a/layout/style/StyleSetHandleInlines.h +++ b/layout/style/StyleSetHandleInlines.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/StyleSheet.cpp b/layout/style/StyleSheet.cpp index d4bc94186..03f8e19d8 100644 --- a/layout/style/StyleSheet.cpp +++ b/layout/style/StyleSheet.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/StyleSheet.h b/layout/style/StyleSheet.h index 7a1a71466..55d114700 100644 --- a/layout/style/StyleSheet.h +++ b/layout/style/StyleSheet.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/StyleSheetInfo.h b/layout/style/StyleSheetInfo.h index 9d085fa81..519222ab1 100644 --- a/layout/style/StyleSheetInfo.h +++ b/layout/style/StyleSheetInfo.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/StyleSheetInlines.h b/layout/style/StyleSheetInlines.h index c0b8495f8..6426ea5d7 100644 --- a/layout/style/StyleSheetInlines.h +++ b/layout/style/StyleSheetInlines.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/moz.build b/layout/style/moz.build index f17b27947..7f08fc236 100644 --- a/layout/style/moz.build +++ b/layout/style/moz.build @@ -1,5 +1,4 @@ # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: # 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/. diff --git a/layout/style/nsAnimationManager.cpp b/layout/style/nsAnimationManager.cpp index 04086a3ae..718870985 100644 --- a/layout/style/nsAnimationManager.cpp +++ b/layout/style/nsAnimationManager.cpp @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/nsAnimationManager.h b/layout/style/nsAnimationManager.h index d838d090a..a2846e5cc 100644 --- a/layout/style/nsAnimationManager.h +++ b/layout/style/nsAnimationManager.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/nsCSSDataBlock.cpp b/layout/style/nsCSSDataBlock.cpp index 1dfdaed0e..33c309dd4 100644 --- a/layout/style/nsCSSDataBlock.cpp +++ b/layout/style/nsCSSDataBlock.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/nsCSSDataBlock.h b/layout/style/nsCSSDataBlock.h index 76deaa911..b699c408b 100644 --- a/layout/style/nsCSSDataBlock.h +++ b/layout/style/nsCSSDataBlock.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index 9045da9ff..86ba59142 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -144,6 +144,7 @@ CSS_KEY(alternate, alternate) CSS_KEY(alternate-reverse, alternate_reverse) CSS_KEY(always, always) CSS_KEY(annotation, annotation) +CSS_KEY(anywhere, anywhere) CSS_KEY(appworkspace, appworkspace) CSS_KEY(auto, auto) CSS_KEY(auto-fill, auto_fill) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 89a8be5ec..0f1b04a17 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=78: */ /* 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/. */ @@ -1300,7 +1299,7 @@ protected: } bool ParseNonNegativeNumber(nsCSSValue& aValue) { - return ParseSingleTokenNonNegativeVariant(aValue, VARIANT_NUMBER | VARIANT_OPACITY, nullptr); + return ParseSingleTokenNonNegativeVariant(aValue, VARIANT_NUMBER, nullptr); } // Helpers for some common ParseSingleTokenOneOrLargerVariant calls. @@ -1310,7 +1309,7 @@ protected: } bool ParseOneOrLargerNumber(nsCSSValue& aValue) { - return ParseSingleTokenOneOrLargerVariant(aValue, VARIANT_NUMBER | VARIANT_OPACITY, nullptr); + return ParseSingleTokenOneOrLargerVariant(aValue, VARIANT_NUMBER, nullptr); } // http://dev.w3.org/csswg/css-values/#custom-idents @@ -8484,7 +8483,7 @@ CSSParserImpl::ParseImageRect(nsCSSValue& aImage) break; } - static const int32_t VARIANT_SIDE = VARIANT_NUMBER | VARIANT_PERCENT | VARIANT_OPACITY; + static const int32_t VARIANT_SIDE = VARIANT_NUMBER | VARIANT_PERCENT; if (!ParseSingleTokenNonNegativeVariant(top, VARIANT_SIDE, nullptr) || !ExpectSymbol(',', true) || !ParseSingleTokenNonNegativeVariant(right, VARIANT_SIDE, nullptr) || @@ -10893,7 +10892,7 @@ CSSParserImpl::ParseWebkitGradientColorStop(nsCSSValueGradient* aGradient) if (mToken.mIdent.LowerCaseEqualsLiteral("color-stop")) { // Parse stop location, followed by comma. if (!ParseSingleTokenVariant(stop->mLocation, - VARIANT_NUMBER | VARIANT_PERCENT | VARIANT_OPACITY, + VARIANT_NUMBER | VARIANT_PERCENT, nullptr) || !ExpectSymbol(',', true)) { SkipUntil(')'); // Skip to end of color-stop(...) expression. @@ -16056,7 +16055,7 @@ static bool GetFunctionParseInformation(nsCSSKeyword aToken, {VARIANT_LBCALC, VARIANT_LBCALC, VARIANT_LBCALC}, {VARIANT_ANGLE_OR_ZERO}, {VARIANT_ANGLE_OR_ZERO, VARIANT_ANGLE_OR_ZERO}, - {VARIANT_NUMBER|VARIANT_OPACITY}, + {VARIANT_NUMBER}, {VARIANT_LENGTH|VARIANT_NONNEGATIVE_DIMENSION}, {VARIANT_LB|VARIANT_NONNEGATIVE_DIMENSION}, {VARIANT_NUMBER, VARIANT_NUMBER}, @@ -17638,7 +17637,7 @@ CSSParserImpl::ParseScrollSnapPoints(nsCSSValue& aValue, nsCSSPropertyID aPropID nsCSSKeywords::LookupKeyword(mToken.mIdent) == eCSSKeyword_repeat) { nsCSSValue lengthValue; if (ParseNonNegativeVariant(lengthValue, - VARIANT_LENGTH | VARIANT_PERCENT | VARIANT_OPACITY | VARIANT_CALC, + VARIANT_LENGTH | VARIANT_PERCENT | VARIANT_CALC, nullptr) != CSSParseResult::Ok) { REPORT_UNEXPECTED(PEExpectedNonnegativeNP); SkipUntil(')'); diff --git a/layout/style/nsCSSPropAliasList.h b/layout/style/nsCSSPropAliasList.h index 9ec71b2cf..7025a25b5 100644 --- a/layout/style/nsCSSPropAliasList.h +++ b/layout/style/nsCSSPropAliasList.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 24c97cf33..e0cda2488 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -2284,6 +2284,7 @@ const KTableEntry nsCSSProps::kWordBreakKTable[] = { const KTableEntry nsCSSProps::kOverflowWrapKTable[] = { { eCSSKeyword_normal, NS_STYLE_OVERFLOWWRAP_NORMAL }, { eCSSKeyword_break_word, NS_STYLE_OVERFLOWWRAP_BREAK_WORD }, + { eCSSKeyword_anywhere, NS_STYLE_OVERFLOWWRAP_ANYWHERE }, { eCSSKeyword_UNKNOWN, -1 } }; diff --git a/layout/style/nsCSSValue.cpp b/layout/style/nsCSSValue.cpp index 0a905a055..40d804b02 100644 --- a/layout/style/nsCSSValue.cpp +++ b/layout/style/nsCSSValue.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index c0cc0f84b..080932af2 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/nsHTMLCSSStyleSheet.cpp b/layout/style/nsHTMLCSSStyleSheet.cpp index f5e8cde0b..9b3bd65fb 100644 --- a/layout/style/nsHTMLCSSStyleSheet.cpp +++ b/layout/style/nsHTMLCSSStyleSheet.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/nsLayoutStylesheetCache.cpp b/layout/style/nsLayoutStylesheetCache.cpp index 0e6bc35ee..bf87b006c 100644 --- a/layout/style/nsLayoutStylesheetCache.cpp +++ b/layout/style/nsLayoutStylesheetCache.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/nsLayoutStylesheetCache.h b/layout/style/nsLayoutStylesheetCache.h index 48391cc7a..70ab5e88d 100644 --- a/layout/style/nsLayoutStylesheetCache.h +++ b/layout/style/nsLayoutStylesheetCache.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/nsMediaFeatures.cpp b/layout/style/nsMediaFeatures.cpp index f33f8dd33..e44003ce4 100644 --- a/layout/style/nsMediaFeatures.cpp +++ b/layout/style/nsMediaFeatures.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/nsMediaFeatures.h b/layout/style/nsMediaFeatures.h index 76e94837d..f6c4b5806 100644 --- a/layout/style/nsMediaFeatures.h +++ b/layout/style/nsMediaFeatures.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/nsROCSSPrimitiveValue.cpp b/layout/style/nsROCSSPrimitiveValue.cpp index 2721bd609..e72c16b5f 100644 --- a/layout/style/nsROCSSPrimitiveValue.cpp +++ b/layout/style/nsROCSSPrimitiveValue.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/nsRuleNode.cpp b/layout/style/nsRuleNode.cpp index 1136edee2..c32369e9b 100644 --- a/layout/style/nsRuleNode.cpp +++ b/layout/style/nsRuleNode.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=2 et sw=2 tw=78: */ /* 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/. */ diff --git a/layout/style/nsStyleConsts.h b/layout/style/nsStyleConsts.h index f54387aa8..e6a0cc65a 100644 --- a/layout/style/nsStyleConsts.h +++ b/layout/style/nsStyleConsts.h @@ -997,6 +997,7 @@ enum class StyleDisplay : uint8_t { // See nsStyleText #define NS_STYLE_OVERFLOWWRAP_NORMAL 0 #define NS_STYLE_OVERFLOWWRAP_BREAK_WORD 1 +#define NS_STYLE_OVERFLOWWRAP_ANYWHERE 2 // See nsStyleText #define NS_STYLE_HYPHENS_NONE 0 diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp index 4c610cf08..c0ea9c256 100644 --- a/layout/style/nsStyleStruct.cpp +++ b/layout/style/nsStyleStruct.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h index d3fad3093..88000c722 100644 --- a/layout/style/nsStyleStruct.h +++ b/layout/style/nsStyleStruct.h @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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/. */ @@ -2134,8 +2133,11 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText } bool WordCanWrapStyle() const { - return WhiteSpaceCanWrapStyle() && - mOverflowWrap == NS_STYLE_OVERFLOWWRAP_BREAK_WORD; + if (!WhiteSpaceCanWrapStyle()) { + return false; + } + return (mOverflowWrap == NS_STYLE_OVERFLOWWRAP_BREAK_WORD || + mOverflowWrap == NS_STYLE_OVERFLOWWRAP_ANYWHERE); } bool HasTextEmphasis() const { diff --git a/layout/style/nsStyleStructInlines.h b/layout/style/nsStyleStructInlines.h index 9cb5e1a8a..63ad921ed 100644 --- a/layout/style/nsStyleStructInlines.h +++ b/layout/style/nsStyleStructInlines.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index ace215a9f..027ae8b38 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -1,5 +1,4 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/nsTransitionManager.h b/layout/style/nsTransitionManager.h index 1c48cc8cd..af7b6c611 100644 --- a/layout/style/nsTransitionManager.h +++ b/layout/style/nsTransitionManager.h @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/test/ListCSSProperties.cpp b/layout/style/test/ListCSSProperties.cpp index 9f727104b..5e0405bb5 100644 --- a/layout/style/test/ListCSSProperties.cpp +++ b/layout/style/test/ListCSSProperties.cpp @@ -1,4 +1,3 @@ -/* vim: set shiftwidth=4 tabstop=8 autoindent cindent expandtab: */ /* 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/. */ diff --git a/layout/style/test/descriptor_database.js b/layout/style/test/descriptor_database.js index da672d03b..2af5ef922 100644 --- a/layout/style/test/descriptor_database.js +++ b/layout/style/test/descriptor_database.js @@ -1,5 +1,4 @@ /* -*- tab-width: 4; indent-tabs-mode: nil; js-indent-level: 4 -*- */ -/* vim: set shiftwidth=4 tabstop=4 autoindent cindent noexpandtab: */ /* 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/. */ diff --git a/layout/style/test/flexbox_layout_testcases.js b/layout/style/test/flexbox_layout_testcases.js index 719583630..63adfe04a 100644 --- a/layout/style/test/flexbox_layout_testcases.js +++ b/layout/style/test/flexbox_layout_testcases.js @@ -1,5 +1,4 @@ /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 sw=2 sts=2 et: */ /* * This Source Code is subject to the terms of the Mozilla Public License diff --git a/layout/style/test/moz.build b/layout/style/test/moz.build index ca61f607a..4ae0e44b4 100644 --- a/layout/style/test/moz.build +++ b/layout/style/test/moz.build @@ -1,5 +1,4 @@ # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: # 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/. diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index a7014c043..d647b5716 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -1,5 +1,4 @@ /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ -/* vim: set ts=2 sw=2 sts=2 et: */ /* 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/. */ |