Backed out changeset d292ce405097 (bug 1393189)

This commit is contained in:
Sebastian Hengst 2017-08-30 10:04:40 +02:00
parent b8848792ee
commit 08520511b8
6 changed files with 33 additions and 89 deletions

View File

@ -348,8 +348,6 @@ GK_ATOM(disabled, "disabled")
GK_ATOM(disableglobalhistory, "disableglobalhistory")
GK_ATOM(disablehistory, "disablehistory")
GK_ATOM(disablefullscreen, "disablefullscreen")
GK_ATOM(disclosure_closed, "disclosure-closed")
GK_ATOM(disclosure_open, "disclosure-open")
GK_ATOM(display, "display")
GK_ATOM(displayMode, "display-mode")
GK_ATOM(distinct, "distinct")
@ -444,7 +442,6 @@ GK_ATOM(end_after, "end_after")
GK_ATOM(end_before, "end_before")
GK_ATOM(equalsize, "equalsize")
GK_ATOM(error, "error")
GK_ATOM(ethiopic_numeric, "ethiopic-numeric")
GK_ATOM(even, "even")
GK_ATOM(event, "event")
GK_ATOM(events, "events")
@ -526,7 +523,6 @@ GK_ATOM(hbox, "hbox")
GK_ATOM(head, "head")
GK_ATOM(header, "header")
GK_ATOM(headers, "headers")
GK_ATOM(hebrew, "hebrew")
GK_ATOM(height, "height")
GK_ATOM(hgroup, "hgroup")
GK_ATOM(hidden, "hidden")
@ -591,8 +587,6 @@ GK_ATOM(itemprop, "itemprop")
GK_ATOM(itemref, "itemref")
GK_ATOM(itemscope, "itemscope")
GK_ATOM(itemtype, "itemtype")
GK_ATOM(japanese_formal, "japanese-formal")
GK_ATOM(japanese_informal, "japanese-informal")
GK_ATOM(kbd, "kbd")
GK_ATOM(keepcurrentinview, "keepcurrentinview")
GK_ATOM(keepobjectsalive, "keepobjectsalive")
@ -607,9 +601,6 @@ GK_ATOM(keysystem, "keysystem")
GK_ATOM(keytext, "keytext")
GK_ATOM(keyup, "keyup")
GK_ATOM(kind, "kind")
GK_ATOM(korean_hangul_formal, "korean-hangul-formal")
GK_ATOM(korean_hanja_formal, "korean-hanja-formal")
GK_ATOM(korean_hanja_informal, "korean-hanja-informal")
GK_ATOM(label, "label")
GK_ATOM(labels, "labels")
GK_ATOM(lang, "lang")
@ -1240,8 +1231,6 @@ GK_ATOM(show, "show")
GK_ATOM(showcaret, "showcaret")
GK_ATOM(showresizer, "showresizer")
GK_ATOM(simple, "simple")
GK_ATOM(simp_chinese_formal, "simp-chinese-formal")
GK_ATOM(simp_chinese_informal, "simp-chinese-informal")
GK_ATOM(single, "single")
GK_ATOM(size, "size")
GK_ATOM(sizes, "sizes")
@ -1356,8 +1345,6 @@ GK_ATOM(toppadding, "toppadding")
GK_ATOM(topright, "topright")
GK_ATOM(tr, "tr")
GK_ATOM(track, "track")
GK_ATOM(trad_chinese_formal, "trad-chinese-formal")
GK_ATOM(trad_chinese_informal, "trad-chinese-informal")
GK_ATOM(trailing, "trailing")
GK_ATOM(transform, "transform")
GK_ATOM(transform_3d, "transform-3d")

View File

@ -67,6 +67,7 @@
#include "CacheObserver.h"
#include "DisplayItemClip.h"
#include "ActiveLayerTracker.h"
#include "CounterStyleManager.h"
#include "FrameLayerBuilder.h"
#include "AnimationCommon.h"
#include "LayerAnimationInfo.h"
@ -285,6 +286,8 @@ nsLayoutStatics::Initialize()
CacheObserver::Init();
CounterStyleManager::InitializeBuiltinCounterStyles();
IMEStateManager::Init();
ServiceWorkerRegistrar::Initialize();

View File

@ -1,38 +0,0 @@
/* -*- 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/. */
/* a list of all builtin counter styles */
/* Each entry is defined as a BUILTIN_COUNTER_STYLE macro with the
* following parameters:
* - 'value_' which is final part of name of NS_STYLE_LIST_STYLE_* macros
* - 'atom_' which is the corresponding atom in nsGkAtoms table
*
* Users of this list should define the following macro before including
* this file: BUILTIN_COUNTER_STYLE(value_, atom_)
*/
// none and decimal are not redefinable, so they have to be builtin.
BUILTIN_COUNTER_STYLE(NONE, none)
BUILTIN_COUNTER_STYLE(DECIMAL, decimal)
// the following graphic styles are processed in a different way.
BUILTIN_COUNTER_STYLE(DISC, disc)
BUILTIN_COUNTER_STYLE(CIRCLE, circle)
BUILTIN_COUNTER_STYLE(SQUARE, square)
BUILTIN_COUNTER_STYLE(DISCLOSURE_CLOSED, disclosure_closed)
BUILTIN_COUNTER_STYLE(DISCLOSURE_OPEN, disclosure_open)
// the following counter styles require specific algorithms to generate.
BUILTIN_COUNTER_STYLE(HEBREW, hebrew)
BUILTIN_COUNTER_STYLE(JAPANESE_INFORMAL, japanese_informal)
BUILTIN_COUNTER_STYLE(JAPANESE_FORMAL, japanese_formal)
BUILTIN_COUNTER_STYLE(KOREAN_HANGUL_FORMAL, korean_hangul_formal)
BUILTIN_COUNTER_STYLE(KOREAN_HANJA_INFORMAL, korean_hanja_informal)
BUILTIN_COUNTER_STYLE(KOREAN_HANJA_FORMAL, korean_hanja_formal)
BUILTIN_COUNTER_STYLE(SIMP_CHINESE_INFORMAL, simp_chinese_informal)
BUILTIN_COUNTER_STYLE(SIMP_CHINESE_FORMAL, simp_chinese_formal)
BUILTIN_COUNTER_STYLE(TRAD_CHINESE_INFORMAL, trad_chinese_informal)
BUILTIN_COUNTER_STYLE(TRAD_CHINESE_FORMAL, trad_chinese_formal)
BUILTIN_COUNTER_STYLE(ETHIOPIC_NUMERIC, ethiopic_numeric)

View File

@ -575,12 +575,21 @@ SystemUsesNegativeSign(uint8_t aSystem)
class BuiltinCounterStyle : public CounterStyle
{
public:
constexpr BuiltinCounterStyle(int32_t aStyle, nsIAtom** aName)
: CounterStyle(aStyle)
, mName(aName)
friend class CounterStyleManager;
// will be initialized by CounterStyleManager::InitializeBuiltinCounterStyles
constexpr BuiltinCounterStyle()
: CounterStyle(NS_STYLE_LIST_STYLE_NONE)
{
}
protected:
constexpr explicit BuiltinCounterStyle(int32_t aStyle)
: CounterStyle(aStyle)
{
}
public:
virtual void GetStyleName(nsAString& aResult) override;
virtual void GetPrefix(nsAString& aResult) override;
virtual void GetSuffix(nsAString& aResult) override;
@ -602,20 +611,6 @@ public:
WritingMode aWritingMode,
nsAString& aResult,
bool& aIsRTL) override;
protected:
BuiltinCounterStyle(const BuiltinCounterStyle& aOther)
: CounterStyle(aOther.mStyle)
, mName(aOther.mName)
{
}
private:
// The atom for the name of the builtin counter style.
// Extra indirection to point to nsGkAtoms members rather than the
// nsIAtom, because members of nsGkAtoms are updated at runtime but
// we want to construct BuiltinCounterStyle at compile time.
nsIAtom** const mName;
};
/* virtual */ void
@ -961,25 +956,11 @@ BuiltinCounterStyle::GetInitialCounterText(CounterValue aOrdinal,
}
}
static constexpr BuiltinCounterStyle gBuiltinStyleTable[] = {
#define BUILTIN_COUNTER_STYLE(value_, atom_) \
{ NS_STYLE_LIST_STYLE_ ## value_, &nsGkAtoms::atom_ },
#include "BuiltinCounterStyleList.h"
#undef BUILTIN_COUNTER_STYLE
};
#define BUILTIN_COUNTER_STYLE(value_, atom_) \
static_assert(gBuiltinStyleTable[NS_STYLE_LIST_STYLE_ ## value_].GetStyle() \
== NS_STYLE_LIST_STYLE_ ## value_, "Builtin counter style " \
#atom_ " has unmatched index and value.");
#include "BuiltinCounterStyleList.h"
#undef BUILTIN_COUNTER_STYLE
class DependentBuiltinCounterStyle final : public BuiltinCounterStyle
{
public:
DependentBuiltinCounterStyle(int32_t aStyle, CounterStyleManager* aManager)
: BuiltinCounterStyle(gBuiltinStyleTable[aStyle]),
: BuiltinCounterStyle(aStyle),
mManager(aManager)
{
NS_ASSERTION(IsDependentStyle(), "Not a dependent builtin style");
@ -1988,6 +1969,8 @@ CounterStyle::CallFallbackStyle(CounterValue aOrdinal,
GetFallback()->GetCounterText(aOrdinal, aWritingMode, aResult, aIsRTL);
}
static BuiltinCounterStyle gBuiltinStyleTable[NS_STYLE_LIST_STYLE__MAX];
CounterStyleManager::CounterStyleManager(nsPresContext* aPresContext)
: mPresContext(aPresContext)
{
@ -2002,6 +1985,14 @@ CounterStyleManager::~CounterStyleManager()
MOZ_ASSERT(!mPresContext, "Disconnect should have been called");
}
/* static */ void
CounterStyleManager::InitializeBuiltinCounterStyles()
{
for (uint32_t i = 0; i < NS_STYLE_LIST_STYLE__MAX; ++i) {
gBuiltinStyleTable[i].mStyle = i;
}
}
void
CounterStyleManager::DestroyCounterStyle(CounterStyle* aCounterStyle)
{
@ -2068,13 +2059,11 @@ CounterStyleManager::BuildCounterStyle(nsIAtom* aName)
/* static */ CounterStyle*
CounterStyleManager::GetBuiltinStyle(int32_t aStyle)
{
MOZ_ASSERT(0 <= aStyle && size_t(aStyle) < sizeof(gBuiltinStyleTable),
MOZ_ASSERT(0 <= aStyle && aStyle < NS_STYLE_LIST_STYLE__MAX,
"Require a valid builtin style constant");
MOZ_ASSERT(!gBuiltinStyleTable[aStyle].IsDependentStyle(),
"Cannot get dependent builtin style");
// No method of BuiltinCounterStyle mutates the struct itself, so it
// should be fine to cast const away.
return const_cast<BuiltinCounterStyle*>(&gBuiltinStyleTable[aStyle]);
return &gBuiltinStyleTable[aStyle];
}
bool

View File

@ -44,7 +44,7 @@ private:
void operator=(const CounterStyle& other) = delete;
public:
constexpr int32_t GetStyle() const { return mStyle; }
int32_t GetStyle() const { return mStyle; }
bool IsNone() const { return mStyle == NS_STYLE_LIST_STYLE_NONE; }
bool IsCustomStyle() const { return mStyle == NS_STYLE_LIST_STYLE_CUSTOM; }
// A style is dependent if it depends on the counter style manager.
@ -98,7 +98,7 @@ public:
virtual AnonymousCounterStyle* AsAnonymous() { return nullptr; }
protected:
const int32_t mStyle;
int32_t mStyle;
};
class AnonymousCounterStyle final : public CounterStyle
@ -314,6 +314,8 @@ private:
public:
explicit CounterStyleManager(nsPresContext* aPresContext);
static void InitializeBuiltinCounterStyles();
void Disconnect();
bool IsInitial() const

View File

@ -795,6 +795,7 @@ enum class StyleGridTrackBreadth : uint8_t {
#define NS_STYLE_LIST_STYLE_TRAD_CHINESE_INFORMAL 15
#define NS_STYLE_LIST_STYLE_TRAD_CHINESE_FORMAL 16
#define NS_STYLE_LIST_STYLE_ETHIOPIC_NUMERIC 17
#define NS_STYLE_LIST_STYLE__MAX 18
// These styles are handled as custom styles defined in counterstyles.css.
// They are preserved here only for html attribute map.
#define NS_STYLE_LIST_STYLE_LOWER_ROMAN 100