Skip to content

Commit 8c2521e

Browse files
committed
Backed out 13 changesets (bug 1640839) for causing bustage on Element.cpp CLOSED TREE
Backed out changeset 179ceb82c9e5 (bug 1640839) Backed out changeset 73f498a821f0 (bug 1640839) Backed out changeset dc2d3d0e0365 (bug 1640839) Backed out changeset ddc989ac0509 (bug 1640839) Backed out changeset e595bb3feea8 (bug 1640839) Backed out changeset c85aca04e27f (bug 1640839) Backed out changeset 98e8e3a4047a (bug 1640839) Backed out changeset 59ef180517db (bug 1640839) Backed out changeset af2f5e293662 (bug 1640839) Backed out changeset 89aa6d9dc598 (bug 1640839) Backed out changeset 67b722a722f9 (bug 1640839) Backed out changeset 24a9665c6ced (bug 1640839) Backed out changeset d93f199385e9 (bug 1640839)
1 parent d8c28c2 commit 8c2521e

File tree

147 files changed

+862
-745
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+862
-745
lines changed

docshell/base/BrowsingContext.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#endif
2121
#include "mozilla/AppShutdown.h"
2222
#include "mozilla/dom/CanonicalBrowsingContext.h"
23-
#include "mozilla/dom/BindingIPCUtils.h"
2423
#include "mozilla/dom/BrowserHost.h"
2524
#include "mozilla/dom/BrowserChild.h"
2625
#include "mozilla/dom/BrowserParent.h"
@@ -97,17 +96,23 @@ namespace IPC {
9796
// Allow serialization and deserialization of OrientationType over IPC
9897
template <>
9998
struct ParamTraits<mozilla::dom::OrientationType>
100-
: public mozilla::dom::WebIDLEnumSerializer<mozilla::dom::OrientationType> {
101-
};
99+
: public ContiguousEnumSerializer<
100+
mozilla::dom::OrientationType,
101+
mozilla::dom::OrientationType::Portrait_primary,
102+
mozilla::dom::OrientationType::EndGuard_> {};
102103

103104
template <>
104105
struct ParamTraits<mozilla::dom::DisplayMode>
105-
: public mozilla::dom::WebIDLEnumSerializer<mozilla::dom::DisplayMode> {};
106+
: public ContiguousEnumSerializer<mozilla::dom::DisplayMode,
107+
mozilla::dom::DisplayMode::Browser,
108+
mozilla::dom::DisplayMode::EndGuard_> {};
106109

107110
template <>
108111
struct ParamTraits<mozilla::dom::PrefersColorSchemeOverride>
109-
: public mozilla::dom::WebIDLEnumSerializer<
110-
mozilla::dom::PrefersColorSchemeOverride> {};
112+
: public ContiguousEnumSerializer<
113+
mozilla::dom::PrefersColorSchemeOverride,
114+
mozilla::dom::PrefersColorSchemeOverride::None,
115+
mozilla::dom::PrefersColorSchemeOverride::EndGuard_> {};
111116

112117
template <>
113118
struct ParamTraits<mozilla::dom::ExplicitActiveStatus>
@@ -119,8 +124,10 @@ struct ParamTraits<mozilla::dom::ExplicitActiveStatus>
119124
// Allow serialization and deserialization of TouchEventsOverride over IPC
120125
template <>
121126
struct ParamTraits<mozilla::dom::TouchEventsOverride>
122-
: public mozilla::dom::WebIDLEnumSerializer<
123-
mozilla::dom::TouchEventsOverride> {};
127+
: public ContiguousEnumSerializer<
128+
mozilla::dom::TouchEventsOverride,
129+
mozilla::dom::TouchEventsOverride::Disabled,
130+
mozilla::dom::TouchEventsOverride::EndGuard_> {};
124131

125132
template <>
126133
struct ParamTraits<mozilla::dom::EmbedderColorSchemes> {

docshell/shistory/SessionHistoryEntry.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "nsXULAppAPI.h"
2121
#include "mozilla/PresState.h"
2222
#include "mozilla/StaticPrefs_fission.h"
23-
#include "mozilla/dom/BindingIPCUtils.h"
23+
2424
#include "mozilla/dom/BrowserParent.h"
2525
#include "mozilla/dom/CanonicalBrowsingContext.h"
2626
#include "mozilla/dom/ContentChild.h"
@@ -1797,8 +1797,10 @@ namespace IPC {
17971797
// Allow sending mozilla::dom::WireframeRectType enums over IPC.
17981798
template <>
17991799
struct ParamTraits<mozilla::dom::WireframeRectType>
1800-
: public mozilla::dom::WebIDLEnumSerializer<
1801-
mozilla::dom::WireframeRectType> {};
1800+
: public ContiguousEnumSerializer<
1801+
mozilla::dom::WireframeRectType,
1802+
mozilla::dom::WireframeRectType::Image,
1803+
mozilla::dom::WireframeRectType::EndGuard_> {};
18021804

18031805
template <>
18041806
struct ParamTraits<mozilla::dom::WireframeTaggedRect> {

dom/animation/EffectCompositor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ class EffectCompositor {
244244
// animations that can be throttled, we will add an entry to the hashtable to
245245
// indicate that the style rule on the element is out of date but without
246246
// posting a restyle to update it.
247-
EnumeratedArray<CascadeLevel, nsTHashMap<PseudoElementHashEntry, bool>,
248-
kCascadeLevelCount>
247+
EnumeratedArray<CascadeLevel, CascadeLevel(kCascadeLevelCount),
248+
nsTHashMap<PseudoElementHashEntry, bool>>
249249
mElementsToRestyle;
250250

251251
bool mIsInPreTraverse = false;

dom/base/ChromeUtils.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,8 +1368,7 @@ void ChromeUtils::ClearStyleSheetCache(GlobalObject&) {
13681368
static WebIDLProcType ProcTypeToWebIDL(mozilla::ProcType aType) {
13691369
// Max is the value of the last enum, not the length, so add one.
13701370
static_assert(
1371-
static_cast<size_t>(MaxContiguousEnumValue<WebIDLProcType>::value) ==
1372-
static_cast<size_t>(ProcType::Max),
1371+
WebIDLProcTypeValues::Count == static_cast<size_t>(ProcType::Max) + 1,
13731372
"In order for this static cast to be okay, "
13741373
"WebIDLProcType must match ProcType exactly");
13751374

@@ -2076,9 +2075,9 @@ unsigned ChromeUtils::AliveUtilityProcesses(const GlobalObject&) {
20762075
void ChromeUtils::GetAllPossibleUtilityActorNames(GlobalObject& aGlobal,
20772076
nsTArray<nsCString>& aNames) {
20782077
aNames.Clear();
2079-
for (UtilityActorName idlName :
2080-
MakeWebIDLEnumeratedRange<WebIDLUtilityActorName>()) {
2081-
aNames.AppendElement(GetEnumString(idlName));
2078+
for (size_t i = 0; i < WebIDLUtilityActorNameValues::Count; ++i) {
2079+
auto idlName = static_cast<UtilityActorName>(i);
2080+
aNames.AppendElement(WebIDLUtilityActorNameValues::GetString(idlName));
20822081
}
20832082
}
20842083

dom/base/DOMParser.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,12 @@ already_AddRefed<Document> DOMParser::ParseFromStream(nsIInputStream* aStream,
181181

182182
// Create a fake channel
183183
nsCOMPtr<nsIChannel> parserChannel;
184-
NS_NewInputStreamChannel(getter_AddRefs(parserChannel), mDocumentURI,
185-
nullptr, // aStream
186-
mPrincipal, nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL,
187-
nsIContentPolicy::TYPE_OTHER, GetEnumString(aType));
184+
NS_NewInputStreamChannel(
185+
getter_AddRefs(parserChannel), mDocumentURI,
186+
nullptr, // aStream
187+
mPrincipal, nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL,
188+
nsIContentPolicy::TYPE_OTHER,
189+
nsDependentCSubstring(SupportedTypeValues::GetString(aType)));
188190
if (NS_WARN_IF(!parserChannel)) {
189191
aRv.Throw(NS_ERROR_UNEXPECTED);
190192
return nullptr;

dom/base/Element.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,9 +781,12 @@ void Element::ScrollIntoView(const ScrollIntoViewOptions& aOptions) {
781781
return WhereToScroll::Center;
782782
case ScrollLogicalPosition::End:
783783
return WhereToScroll::End;
784+
case ScrollLogicalPosition::EndGuard_:
785+
MOZ_FALLTHROUGH_ASSERT("Unexpected block direction value");
784786
case ScrollLogicalPosition::Nearest:
785-
return WhereToScroll::Nearest;
787+
break;
786788
}
789+
return WhereToScroll::Nearest;
787790
};
788791

789792
const auto block = ToWhereToScroll(aOptions.mBlock);

dom/base/FlushType.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ enum class FlushType : uint8_t {
4040

4141
// Flush type strings that will be displayed in the profiler
4242
// clang-format off
43-
const EnumeratedArray<FlushType, const char*, size_t(FlushType::Count)>
43+
const EnumeratedArray<FlushType, FlushType::Count, const char*>
4444
kFlushTypeNames = {
4545
"",
4646
"Event",

dom/bindings/BindingDeclarations.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ template <class T>
131131
constexpr bool is_dom_union_with_typedarray_members =
132132
std::is_base_of_v<UnionWithTypedArraysBase, T>;
133133

134+
struct EnumEntry {
135+
const char* value;
136+
size_t length;
137+
};
138+
134139
enum class CallerType : uint32_t;
135140

136141
class MOZ_STACK_CLASS GlobalObject {
@@ -557,13 +562,6 @@ JS::Handle<JSObject*> GetPerInterfaceObjectHandle(
557562
JSContext* aCx, size_t aSlotId, CreateInterfaceObjectsMethod aCreator,
558563
bool aDefineOnGlobal);
559564

560-
namespace binding_detail {
561-
562-
template <typename Enum>
563-
struct EnumStrings;
564-
565-
} // namespace binding_detail
566-
567565
} // namespace dom
568566
} // namespace mozilla
569567

dom/bindings/BindingIPCUtils.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,9 @@
66
#ifndef _mozilla_dom_BindingIPCUtils_h
77
#define _mozilla_dom_BindingIPCUtils_h
88

9-
#include "mozilla/EnumTypeTraits.h"
109
#include "mozilla/dom/BindingDeclarations.h"
1110
#include "ipc/EnumSerializer.h"
1211

13-
namespace mozilla::dom {
14-
15-
template <class Enum>
16-
using WebIDLEnumSerializer = IPC::ContiguousEnumSerializerInclusive<
17-
Enum, ContiguousEnumValues<Enum>::min, ContiguousEnumValues<Enum>::max>;
18-
19-
} // namespace mozilla::dom
20-
2112
namespace IPC {
2213
template <>
2314
struct ParamTraits<mozilla::dom::CallerType>

dom/bindings/BindingUtils.h

Lines changed: 9 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
#include "mozilla/Array.h"
2525
#include "mozilla/Assertions.h"
2626
#include "mozilla/DeferredFinalize.h"
27-
#include "mozilla/EnumTypeTraits.h"
28-
#include "mozilla/EnumeratedRange.h"
2927
#include "mozilla/UniquePtr.h"
3028
#include "mozilla/dom/BindingCallContext.h"
3129
#include "mozilla/dom/BindingDeclarations.h"
@@ -1345,27 +1343,26 @@ inline bool EnumValueNotFound<true>(BindingCallContext& cx,
13451343
deflated.get(), type);
13461344
}
13471345

1348-
namespace binding_detail {
1349-
13501346
template <typename CharT>
13511347
inline int FindEnumStringIndexImpl(const CharT* chars, size_t length,
1352-
const Span<const nsLiteralCString>& values) {
1353-
for (size_t i = 0; i < values.Length(); ++i) {
1354-
const nsLiteralCString& value = values[i];
1355-
if (length != value.Length()) {
1348+
const EnumEntry* values) {
1349+
int i = 0;
1350+
for (const EnumEntry* value = values; value->value; ++value, ++i) {
1351+
if (length != value->length) {
13561352
continue;
13571353
}
13581354

13591355
bool equal = true;
1356+
const char* val = value->value;
13601357
for (size_t j = 0; j != length; ++j) {
1361-
if (unsigned(value.CharAt(j)) != unsigned(chars[j])) {
1358+
if (unsigned(val[j]) != unsigned(chars[j])) {
13621359
equal = false;
13631360
break;
13641361
}
13651362
}
13661363

13671364
if (equal) {
1368-
return (int)i;
1365+
return i;
13691366
}
13701367
}
13711368

@@ -1374,9 +1371,8 @@ inline int FindEnumStringIndexImpl(const CharT* chars, size_t length,
13741371

13751372
template <bool InvalidValueFatal>
13761373
inline bool FindEnumStringIndex(BindingCallContext& cx, JS::Handle<JS::Value> v,
1377-
const Span<const nsLiteralCString>& values,
1378-
const char* type, const char* sourceDescription,
1379-
int* index) {
1374+
const EnumEntry* values, const char* type,
1375+
const char* sourceDescription, int* index) {
13801376
// JS_StringEqualsAscii is slow as molasses, so don't use it here.
13811377
JS::Rooted<JSString*> str(cx, JS::ToString(cx, v));
13821378
if (!str) {
@@ -1409,31 +1405,6 @@ inline bool FindEnumStringIndex(BindingCallContext& cx, JS::Handle<JS::Value> v,
14091405
return EnumValueNotFound<InvalidValueFatal>(cx, str, type, sourceDescription);
14101406
}
14111407

1412-
} // namespace binding_detail
1413-
1414-
template <typename Enum, class StringT>
1415-
inline Maybe<Enum> StringToEnum(const StringT& aString) {
1416-
int index = binding_detail::FindEnumStringIndexImpl(
1417-
aString.BeginReading(), aString.Length(),
1418-
binding_detail::EnumStrings<Enum>::Values);
1419-
return index >= 0 ? Some(static_cast<Enum>(index)) : Nothing();
1420-
}
1421-
1422-
template <typename Enum>
1423-
inline const nsCString& GetEnumString(Enum stringId) {
1424-
MOZ_RELEASE_ASSERT(
1425-
static_cast<size_t>(stringId) <
1426-
mozilla::ArrayLength(binding_detail::EnumStrings<Enum>::Values));
1427-
return binding_detail::EnumStrings<Enum>::Values[static_cast<size_t>(
1428-
stringId)];
1429-
}
1430-
1431-
template <typename Enum>
1432-
constexpr mozilla::detail::EnumeratedRange<Enum> MakeWebIDLEnumeratedRange() {
1433-
return MakeInclusiveEnumeratedRange(ContiguousEnumValues<Enum>::min,
1434-
ContiguousEnumValues<Enum>::max);
1435-
}
1436-
14371408
inline nsWrapperCache* GetWrapperCache(const ParentObject& aParentObject) {
14381409
return aParentObject.mWrapperCache;
14391410
}
@@ -3284,7 +3255,6 @@ already_AddRefed<Promise> CreateRejectedPromiseFromThrownException(
32843255
} // namespace binding_detail
32853256

32863257
} // namespace dom
3287-
32883258
} // namespace mozilla
32893259

32903260
#endif /* mozilla_dom_BindingUtils_h__ */

0 commit comments

Comments
 (0)