mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 05:48:26 +00:00
merge mozilla-inbound to mozilla-central a=merge
This commit is contained in:
commit
fb4da9c2a5
@ -7,8 +7,6 @@
|
||||
#ifndef mozilla_a11y_relationtype_h_
|
||||
#define mozilla_a11y_relationtype_h_
|
||||
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
|
@ -84,6 +84,8 @@ const IDB = {
|
||||
add: function(project) {
|
||||
let deferred = promise.defer();
|
||||
|
||||
project = JSON.parse(JSON.stringify(project));
|
||||
|
||||
if (!project.location) {
|
||||
// We need to make sure this object has a `.location` property.
|
||||
deferred.reject("Missing location property on project object.");
|
||||
|
@ -52,7 +52,7 @@ dnl ========================================================
|
||||
MOZJPEG=62
|
||||
MOZPNG=10616
|
||||
NSPR_VERSION=4
|
||||
NSPR_MINVER=4.10.3
|
||||
NSPR_MINVER=4.10.8
|
||||
NSS_VERSION=3
|
||||
|
||||
dnl Set the minimum version of toolkit libs used by mozilla
|
||||
|
@ -4713,7 +4713,23 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
||||
// still test false at this point and no state change will happen) or we're
|
||||
// doing the initial document load and don't want to fire the event for this
|
||||
// change.
|
||||
dom::VisibilityState oldState = mVisibilityState;
|
||||
mVisibilityState = GetVisibilityState();
|
||||
// When the visibility is changed, notify it to observers.
|
||||
// Some observers need the notification, for example HTMLMediaElement uses
|
||||
// it to update internal media resource allocation.
|
||||
// When video is loaded via VideoDocument, HTMLMediaElement and MediaDecoder
|
||||
// creation are already done before nsDocument::SetScriptGlobalObject() call.
|
||||
// MediaDecoder decides whether starting decoding is decided based on
|
||||
// document's visibility. When the MediaDecoder is created,
|
||||
// nsDocument::SetScriptGlobalObject() is not yet called and document is
|
||||
// hidden state. Therefore the MediaDecoder decides that decoding is
|
||||
// not yet necessary. But soon after nsDocument::SetScriptGlobalObject()
|
||||
// call, the document becomes not hidden. At the time, MediaDecoder needs
|
||||
// to know it and needs to start updating decoding.
|
||||
if (oldState != mVisibilityState) {
|
||||
EnumerateActivityObservers(NotifyActivityChanged, nullptr);
|
||||
}
|
||||
|
||||
// The global in the template contents owner document should be the same.
|
||||
if (mTemplateContentsOwner && mTemplateContentsOwner != this) {
|
||||
|
@ -8440,10 +8440,10 @@ class CGEnum(CGThing):
|
||||
def declare(self):
|
||||
decl = fill(
|
||||
"""
|
||||
MOZ_BEGIN_ENUM_CLASS(${name}, uint32_t)
|
||||
enum class ${name} : uint32_t {
|
||||
$*{enums}
|
||||
EndGuard_
|
||||
MOZ_END_ENUM_CLASS(${name})
|
||||
};
|
||||
""",
|
||||
name=self.enum.identifier.name,
|
||||
enums=",\n".join(map(getEnumValueName, self.enum.values())) + ",\n")
|
||||
|
@ -23,10 +23,10 @@ public:
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasGradient)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasGradient)
|
||||
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS(Type, uint8_t)
|
||||
enum class Type : uint8_t {
|
||||
LINEAR = 0,
|
||||
RADIAL
|
||||
MOZ_END_NESTED_ENUM_CLASS(Type)
|
||||
};
|
||||
|
||||
Type GetType()
|
||||
{
|
||||
@ -75,8 +75,6 @@ protected:
|
||||
virtual ~CanvasGradient() {}
|
||||
};
|
||||
|
||||
MOZ_FINISH_NESTED_ENUM_CLASS(CanvasGradient::Type)
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -29,12 +29,12 @@ public:
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(CanvasPattern)
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(CanvasPattern)
|
||||
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS(RepeatMode, uint8_t)
|
||||
enum class RepeatMode : uint8_t {
|
||||
REPEAT,
|
||||
REPEATX,
|
||||
REPEATY,
|
||||
NOREPEAT
|
||||
MOZ_END_NESTED_ENUM_CLASS(RepeatMode)
|
||||
};
|
||||
|
||||
CanvasPattern(CanvasRenderingContext2D* aContext,
|
||||
gfx::SourceSurface* aSurface,
|
||||
@ -74,8 +74,6 @@ public:
|
||||
const RepeatMode mRepeat;
|
||||
};
|
||||
|
||||
MOZ_FINISH_NESTED_ENUM_CLASS(CanvasPattern::RepeatMode)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -543,17 +543,17 @@ public:
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(CanvasRenderingContext2D)
|
||||
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS(CanvasMultiGetterType, uint8_t)
|
||||
enum class CanvasMultiGetterType : uint8_t {
|
||||
STRING = 0,
|
||||
PATTERN = 1,
|
||||
GRADIENT = 2
|
||||
MOZ_END_NESTED_ENUM_CLASS(CanvasMultiGetterType)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS(Style, uint8_t)
|
||||
enum class Style : uint8_t {
|
||||
STROKE = 0,
|
||||
FILL,
|
||||
MAX
|
||||
MOZ_END_NESTED_ENUM_CLASS(Style)
|
||||
};
|
||||
|
||||
nsINode* GetParentObject()
|
||||
{
|
||||
@ -891,31 +891,29 @@ protected:
|
||||
|
||||
// text
|
||||
|
||||
public: // These enums are public only to accomodate non-C++11 legacy path of
|
||||
// MOZ_FINISH_NESTED_ENUM_CLASS. Can move back to protected as soon
|
||||
// as that legacy path is dropped.
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS(TextAlign, uint8_t)
|
||||
protected:
|
||||
enum class TextAlign : uint8_t {
|
||||
START,
|
||||
END,
|
||||
LEFT,
|
||||
RIGHT,
|
||||
CENTER
|
||||
MOZ_END_NESTED_ENUM_CLASS(TextAlign)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS(TextBaseline, uint8_t)
|
||||
enum class TextBaseline : uint8_t {
|
||||
TOP,
|
||||
HANGING,
|
||||
MIDDLE,
|
||||
ALPHABETIC,
|
||||
IDEOGRAPHIC,
|
||||
BOTTOM
|
||||
MOZ_END_NESTED_ENUM_CLASS(TextBaseline)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS(TextDrawOperation, uint8_t)
|
||||
enum class TextDrawOperation : uint8_t {
|
||||
FILL,
|
||||
STROKE,
|
||||
MEASURE
|
||||
MOZ_END_NESTED_ENUM_CLASS(TextDrawOperation)
|
||||
};
|
||||
|
||||
protected:
|
||||
gfxFontGroup *GetCurrentFontStyle();
|
||||
@ -1104,12 +1102,6 @@ protected:
|
||||
friend class CanvasDrawObserver;
|
||||
};
|
||||
|
||||
MOZ_FINISH_NESTED_ENUM_CLASS(CanvasRenderingContext2D::CanvasMultiGetterType)
|
||||
MOZ_FINISH_NESTED_ENUM_CLASS(CanvasRenderingContext2D::Style)
|
||||
MOZ_FINISH_NESTED_ENUM_CLASS(CanvasRenderingContext2D::TextAlign)
|
||||
MOZ_FINISH_NESTED_ENUM_CLASS(CanvasRenderingContext2D::TextBaseline)
|
||||
MOZ_FINISH_NESTED_ENUM_CLASS(CanvasRenderingContext2D::TextDrawOperation)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ class WebGLImageConverter
|
||||
* texels with typed pointers and this value will tell us by how much we need
|
||||
* to increment these pointers to advance to the next texel.
|
||||
*/
|
||||
template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
|
||||
template<WebGLTexelFormat Format>
|
||||
static size_t NumElementsPerTexelForFormat() {
|
||||
switch (Format) {
|
||||
case WebGLTexelFormat::R8:
|
||||
@ -78,9 +78,9 @@ class WebGLImageConverter
|
||||
* to return immediately in these cases to allow the compiler to avoid generating
|
||||
* useless code.
|
||||
*/
|
||||
template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) SrcFormat,
|
||||
MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) DstFormat,
|
||||
MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelPremultiplicationOp) PremultiplicationOp>
|
||||
template<WebGLTexelFormat SrcFormat,
|
||||
WebGLTexelFormat DstFormat,
|
||||
WebGLTexelPremultiplicationOp PremultiplicationOp>
|
||||
void run()
|
||||
{
|
||||
// check for never-called cases. We early-return to allow the compiler
|
||||
@ -151,9 +151,9 @@ class WebGLImageConverter
|
||||
typename DataTypeForFormat<DstFormat>::Type
|
||||
DstType;
|
||||
|
||||
const MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) IntermediateSrcFormat
|
||||
const WebGLTexelFormat IntermediateSrcFormat
|
||||
= IntermediateFormat<SrcFormat>::Value;
|
||||
const MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) IntermediateDstFormat
|
||||
const WebGLTexelFormat IntermediateDstFormat
|
||||
= IntermediateFormat<DstFormat>::Value;
|
||||
typedef
|
||||
typename DataTypeForFormat<IntermediateSrcFormat>::Type
|
||||
@ -218,8 +218,8 @@ class WebGLImageConverter
|
||||
return;
|
||||
}
|
||||
|
||||
template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) SrcFormat,
|
||||
MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) DstFormat>
|
||||
template<WebGLTexelFormat SrcFormat,
|
||||
WebGLTexelFormat DstFormat>
|
||||
void run(WebGLTexelPremultiplicationOp premultiplicationOp)
|
||||
{
|
||||
#define WEBGLIMAGECONVERTER_CASE_PREMULTIPLICATIONOP(PremultiplicationOp) \
|
||||
@ -237,7 +237,7 @@ class WebGLImageConverter
|
||||
#undef WEBGLIMAGECONVERTER_CASE_PREMULTIPLICATIONOP
|
||||
}
|
||||
|
||||
template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) SrcFormat>
|
||||
template<WebGLTexelFormat SrcFormat>
|
||||
void run(WebGLTexelFormat dstFormat,
|
||||
WebGLTexelPremultiplicationOp premultiplicationOp)
|
||||
{
|
||||
|
@ -147,15 +147,15 @@ unpackFromFloat16(uint16_t v)
|
||||
return f32Value;
|
||||
}
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(WebGLTexelPremultiplicationOp, int)
|
||||
enum class WebGLTexelPremultiplicationOp : int {
|
||||
None,
|
||||
Premultiply,
|
||||
Unpremultiply
|
||||
MOZ_END_ENUM_CLASS(WebGLTexelPremultiplicationOp)
|
||||
};
|
||||
|
||||
namespace WebGLTexelConversions {
|
||||
|
||||
template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
|
||||
template<WebGLTexelFormat Format>
|
||||
struct IsFloatFormat
|
||||
{
|
||||
static const bool Value =
|
||||
@ -166,7 +166,7 @@ struct IsFloatFormat
|
||||
Format == WebGLTexelFormat::A32F;
|
||||
};
|
||||
|
||||
template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
|
||||
template<WebGLTexelFormat Format>
|
||||
struct IsHalfFloatFormat
|
||||
{
|
||||
static const bool Value =
|
||||
@ -177,7 +177,7 @@ struct IsHalfFloatFormat
|
||||
Format == WebGLTexelFormat::A16F;
|
||||
};
|
||||
|
||||
template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
|
||||
template<WebGLTexelFormat Format>
|
||||
struct Is16bppFormat
|
||||
{
|
||||
static const bool Value =
|
||||
@ -186,7 +186,7 @@ struct Is16bppFormat
|
||||
Format == WebGLTexelFormat::RGB565;
|
||||
};
|
||||
|
||||
template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format,
|
||||
template<WebGLTexelFormat Format,
|
||||
bool IsFloat = IsFloatFormat<Format>::Value,
|
||||
bool Is16bpp = Is16bppFormat<Format>::Value,
|
||||
bool IsHalfFloat = IsHalfFloatFormat<Format>::Value>
|
||||
@ -195,28 +195,28 @@ struct DataTypeForFormat
|
||||
typedef uint8_t Type;
|
||||
};
|
||||
|
||||
template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
|
||||
template<WebGLTexelFormat Format>
|
||||
struct DataTypeForFormat<Format, true, false, false>
|
||||
{
|
||||
typedef float Type;
|
||||
};
|
||||
|
||||
template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
|
||||
template<WebGLTexelFormat Format>
|
||||
struct DataTypeForFormat<Format, false, true, false>
|
||||
{
|
||||
typedef uint16_t Type;
|
||||
};
|
||||
|
||||
template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
|
||||
template<WebGLTexelFormat Format>
|
||||
struct DataTypeForFormat<Format, false, false, true>
|
||||
{
|
||||
typedef uint16_t Type;
|
||||
};
|
||||
|
||||
template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
|
||||
template<WebGLTexelFormat Format>
|
||||
struct IntermediateFormat
|
||||
{
|
||||
static const MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Value
|
||||
static const WebGLTexelFormat Value
|
||||
= IsFloatFormat<Format>::Value
|
||||
? WebGLTexelFormat::RGBA32F
|
||||
: IsHalfFloatFormat<Format>::Value ? WebGLTexelFormat::RGBA16F
|
||||
@ -332,7 +332,7 @@ MOZ_ALWAYS_INLINE bool HasColor(WebGLTexelFormat format) {
|
||||
//----------------------------------------------------------------------
|
||||
// Pixel unpacking routines.
|
||||
|
||||
template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format, typename SrcType, typename DstType>
|
||||
template<WebGLTexelFormat Format, typename SrcType, typename DstType>
|
||||
MOZ_ALWAYS_INLINE void
|
||||
unpack(const SrcType* __restrict src,
|
||||
DstType* __restrict dst)
|
||||
@ -537,8 +537,8 @@ unpack<WebGLTexelFormat::A16F, uint16_t, uint16_t>(const uint16_t* __restrict sr
|
||||
// Pixel packing routines.
|
||||
//
|
||||
|
||||
template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format,
|
||||
MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelPremultiplicationOp) PremultiplicationOp,
|
||||
template<WebGLTexelFormat Format,
|
||||
WebGLTexelPremultiplicationOp PremultiplicationOp,
|
||||
typename SrcType,
|
||||
typename DstType>
|
||||
MOZ_ALWAYS_INLINE void
|
||||
|
@ -6,8 +6,6 @@
|
||||
#ifndef WEBGLTYPES_H_
|
||||
#define WEBGLTYPES_H_
|
||||
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
// Most WebIDL typedefs are identical to their OpenGL counterparts.
|
||||
#include "GLTypes.h"
|
||||
|
||||
@ -46,18 +44,18 @@ namespace mozilla {
|
||||
* reason why it needs to be faked (incomplete texture vs. uninitialized image data),
|
||||
* whereas the WebGL context can only know whether _any_ faking is currently needed at all.
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(WebGLContextFakeBlackStatus, uint8_t)
|
||||
enum class WebGLContextFakeBlackStatus : uint8_t {
|
||||
Unknown,
|
||||
NotNeeded,
|
||||
Needed
|
||||
MOZ_END_ENUM_CLASS(WebGLContextFakeBlackStatus)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(WebGLTextureFakeBlackStatus, uint8_t)
|
||||
enum class WebGLTextureFakeBlackStatus : uint8_t {
|
||||
Unknown,
|
||||
NotNeeded,
|
||||
IncompleteTexture,
|
||||
UninitializedImageData
|
||||
MOZ_END_ENUM_CLASS(WebGLTextureFakeBlackStatus)
|
||||
};
|
||||
|
||||
/*
|
||||
* Implementing WebGL (or OpenGL ES 2.0) on top of desktop OpenGL requires
|
||||
@ -65,11 +63,11 @@ MOZ_END_ENUM_CLASS(WebGLTextureFakeBlackStatus)
|
||||
* OpenGL ES 2.0 allows drawing without vertex attrib 0 array enabled, but
|
||||
* desktop OpenGL does not allow that.
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(WebGLVertexAttrib0Status, uint8_t)
|
||||
enum class WebGLVertexAttrib0Status : uint8_t {
|
||||
Default, // default status - no emulation needed
|
||||
EmulatedUninitializedArray, // need an artificial attrib 0 array, but contents may be left uninitialized
|
||||
EmulatedInitializedArray // need an artificial attrib 0 array, and contents must be initialized
|
||||
MOZ_END_ENUM_CLASS(WebGLVertexAttrib0Status)
|
||||
};
|
||||
|
||||
/*
|
||||
* Enum to track the status of image data (renderbuffer or texture image) presence
|
||||
@ -81,11 +79,11 @@ MOZ_END_ENUM_CLASS(WebGLVertexAttrib0Status)
|
||||
* initialized. It is the state that renderbuffers are in after a renderbufferStorage call,
|
||||
* and it is the state that texture images are in after a texImage2D call with null data.
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(WebGLImageDataStatus, uint8_t)
|
||||
enum class WebGLImageDataStatus : uint8_t {
|
||||
NoImageData,
|
||||
UninitializedImageData,
|
||||
InitializedImageData
|
||||
MOZ_END_ENUM_CLASS(WebGLImageDataStatus)
|
||||
};
|
||||
|
||||
/*
|
||||
* The formats that may participate, either as source or destination formats,
|
||||
@ -95,7 +93,7 @@ MOZ_END_ENUM_CLASS(WebGLImageDataStatus)
|
||||
* - additional source formats, depending on browser details, used when uploading
|
||||
* textures from DOM elements. See gfxImageSurface::Format().
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(WebGLTexelFormat, uint8_t)
|
||||
enum class WebGLTexelFormat : uint8_t {
|
||||
// returned by SurfaceFromElementResultToImageSurface to indicate absence of image data
|
||||
None,
|
||||
// common value for formats for which format conversions are not supported
|
||||
@ -128,24 +126,24 @@ MOZ_BEGIN_ENUM_CLASS(WebGLTexelFormat, uint8_t)
|
||||
RGBA4444,
|
||||
RGBA16F, // OES_texture_half_float
|
||||
RGBA32F // OES_texture_float
|
||||
MOZ_END_ENUM_CLASS(WebGLTexelFormat)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(WebGLTexImageFunc, uint8_t)
|
||||
enum class WebGLTexImageFunc : uint8_t {
|
||||
TexImage,
|
||||
TexSubImage,
|
||||
CopyTexImage,
|
||||
CopyTexSubImage,
|
||||
CompTexImage,
|
||||
CompTexSubImage,
|
||||
MOZ_END_ENUM_CLASS(WebGLTexImageFunc)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(WebGLTexDimensions, uint8_t)
|
||||
enum class WebGLTexDimensions : uint8_t {
|
||||
Tex2D,
|
||||
Tex3D
|
||||
MOZ_END_ENUM_CLASS(WebGLTexDimensions)
|
||||
};
|
||||
|
||||
// Please keep extensions in alphabetic order.
|
||||
MOZ_BEGIN_ENUM_CLASS(WebGLExtensionID, uint8_t)
|
||||
enum class WebGLExtensionID : uint8_t {
|
||||
ANGLE_instanced_arrays,
|
||||
EXT_blend_minmax,
|
||||
EXT_color_buffer_half_float,
|
||||
@ -172,7 +170,7 @@ MOZ_BEGIN_ENUM_CLASS(WebGLExtensionID, uint8_t)
|
||||
WEBGL_lose_context,
|
||||
Max,
|
||||
Unknown
|
||||
MOZ_END_ENUM_CLASS(WebGLExtensionID)
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define mozilla_EventStateManager_h_
|
||||
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
#include "nsIObserver.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define mozilla_dom_HTMLCanvasElement_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "nsIDOMHTMLCanvasElement.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsGkAtoms.h"
|
||||
@ -36,11 +35,11 @@ class FileCallback;
|
||||
class HTMLCanvasPrintState;
|
||||
class PrintCallback;
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(CanvasContextType, uint8_t)
|
||||
enum class CanvasContextType : uint8_t {
|
||||
Canvas2D,
|
||||
WebGL1,
|
||||
WebGL2
|
||||
MOZ_END_ENUM_CLASS(CanvasContextType)
|
||||
};
|
||||
|
||||
class HTMLCanvasElement MOZ_FINAL : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLCanvasElement
|
||||
|
@ -13,8 +13,6 @@
|
||||
#include "MediaQueue.h"
|
||||
#include "AudioCompactor.h"
|
||||
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
|
@ -1025,11 +1025,11 @@ protected:
|
||||
bool mIsAudioPrerolling;
|
||||
bool mIsVideoPrerolling;
|
||||
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS(RequestStatus)
|
||||
enum class RequestStatus {
|
||||
Idle,
|
||||
Pending,
|
||||
Waiting
|
||||
MOZ_END_NESTED_ENUM_CLASS(RequestStatus)
|
||||
};
|
||||
|
||||
// True when we have dispatched a task to the decode task queue to request
|
||||
// decoded audio/video, and/or we are waiting for the requested sample to be
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include <algorithm>
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "mozilla/PodOperations.h"
|
||||
|
||||
#include "nsTArray.h"
|
||||
|
@ -82,11 +82,11 @@ private:
|
||||
WebAudioDecodeJob::ErrorCode mErrorCode;
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(PhaseEnum, int)
|
||||
enum class PhaseEnum : int {
|
||||
Decode,
|
||||
AllocateBuffer,
|
||||
Done
|
||||
MOZ_END_ENUM_CLASS(PhaseEnum)
|
||||
};
|
||||
|
||||
class MediaDecodeTask : public nsRunnable
|
||||
{
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define MOZILLA_CONTENT_SVGPRESERVEASPECTRATIO_H_
|
||||
|
||||
#include "mozilla/HashFunctions.h" // for HashGeneric
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
#include "nsWrapperCache.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
@ -12,11 +12,11 @@ namespace dom {
|
||||
|
||||
// Use multiples of 2 since they can be bitwise ORed when calling
|
||||
// InvalidateServiceWorkerRegistrationWorker.
|
||||
MOZ_BEGIN_ENUM_CLASS(WhichServiceWorker)
|
||||
enum class WhichServiceWorker {
|
||||
INSTALLING_WORKER = 1,
|
||||
WAITING_WORKER = 2,
|
||||
ACTIVE_WORKER = 4,
|
||||
MOZ_END_ENUM_CLASS(WhichServiceWorker)
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(WhichServiceWorker)
|
||||
|
||||
} // dom namespace
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "mozilla/TypedEnumBits.h"
|
||||
#include "mozilla/WeakPtr.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define __editor_h__
|
||||
|
||||
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc.
|
||||
#include "mozilla/TypedEnum.h" // for MOZ_BEGIN_ENUM_CLASS, etc.
|
||||
#include "mozilla/dom/Text.h"
|
||||
#include "nsAutoPtr.h" // for nsRefPtr
|
||||
#include "nsCOMArray.h" // for nsCOMArray
|
||||
@ -90,7 +89,7 @@ struct IMEState;
|
||||
|
||||
// This is int32_t instead of int16_t because nsIInlineSpellChecker.idl's
|
||||
// spellCheckAfterEditorChange is defined to take it as a long.
|
||||
MOZ_BEGIN_ENUM_CLASS(EditAction, int32_t)
|
||||
enum class EditAction : int32_t {
|
||||
ignore = -1,
|
||||
none = 0,
|
||||
undo,
|
||||
@ -128,7 +127,7 @@ MOZ_BEGIN_ENUM_CLASS(EditAction, int32_t)
|
||||
removeAbsolutePosition = 3016,
|
||||
decreaseZIndex = 3017,
|
||||
increaseZIndex = 3018
|
||||
MOZ_END_ENUM_CLASS(EditAction)
|
||||
};
|
||||
|
||||
inline bool operator!(const EditAction& aOp)
|
||||
{
|
||||
|
@ -17,6 +17,10 @@
|
||||
#include "DataSurfaceHelpers.h"
|
||||
#include "Tools.h"
|
||||
|
||||
#ifdef BUILD_ARM_NEON
|
||||
#include "mozilla/arm.h"
|
||||
#endif
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace mozilla {
|
||||
@ -544,6 +548,7 @@ AlphaBoxBlur::Blur(uint8_t* aData)
|
||||
if (!integralImage) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef USE_SSE2
|
||||
if (Factory::HasSSE2()) {
|
||||
BoxBlur_SSE2(aData, horizontalLobes[0][0], horizontalLobes[0][1], verticalLobes[0][0],
|
||||
@ -553,6 +558,16 @@ AlphaBoxBlur::Blur(uint8_t* aData)
|
||||
BoxBlur_SSE2(aData, horizontalLobes[2][0], horizontalLobes[2][1], verticalLobes[2][0],
|
||||
verticalLobes[2][1], integralImage, integralImageStride);
|
||||
} else
|
||||
#endif
|
||||
#ifdef BUILD_ARM_NEON
|
||||
if (mozilla::supports_neon()) {
|
||||
BoxBlur_NEON(aData, horizontalLobes[0][0], horizontalLobes[0][1], verticalLobes[0][0],
|
||||
verticalLobes[0][1], integralImage, integralImageStride);
|
||||
BoxBlur_NEON(aData, horizontalLobes[1][0], horizontalLobes[1][1], verticalLobes[1][0],
|
||||
verticalLobes[1][1], integralImage, integralImageStride);
|
||||
BoxBlur_NEON(aData, horizontalLobes[2][0], horizontalLobes[2][1], verticalLobes[2][0],
|
||||
verticalLobes[2][1], integralImage, integralImageStride);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
BoxBlur_C(aData, horizontalLobes[0][0], horizontalLobes[0][1], verticalLobes[0][0],
|
||||
|
@ -124,6 +124,11 @@ private:
|
||||
void BoxBlur_SSE2(uint8_t* aData,
|
||||
int32_t aLeftLobe, int32_t aRightLobe, int32_t aTopLobe,
|
||||
int32_t aBottomLobe, uint32_t *aIntegralImage, size_t aIntegralImageStride);
|
||||
#ifdef BUILD_ARM_NEON
|
||||
void BoxBlur_NEON(uint8_t* aData,
|
||||
int32_t aLeftLobe, int32_t aRightLobe, int32_t aTopLobe,
|
||||
int32_t aBottomLobe, uint32_t *aIntegralImage, size_t aIntegralImageStride);
|
||||
#endif
|
||||
|
||||
static CheckedInt<int32_t> RoundUpToMultipleOf4(int32_t aVal);
|
||||
|
||||
|
288
gfx/2d/BlurNEON.cpp
Normal file
288
gfx/2d/BlurNEON.cpp
Normal file
@ -0,0 +1,288 @@
|
||||
/* 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/. */
|
||||
|
||||
#include "Blur.h"
|
||||
#include <arm_neon.h>
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
||||
MOZ_ALWAYS_INLINE
|
||||
uint16x4_t Divide(uint32x4_t aValues, uint32x2_t aDivisor)
|
||||
{
|
||||
uint64x2_t roundingAddition = vdupq_n_u64(int64_t(1) << 31);
|
||||
uint64x2_t multiplied21 = vmull_u32(vget_low_u32(aValues), aDivisor);
|
||||
uint64x2_t multiplied43 = vmull_u32(vget_high_u32(aValues), aDivisor);
|
||||
return vqmovn_u32(vcombine_u32(vshrn_n_u64(vaddq_u64(multiplied21, roundingAddition), 32),
|
||||
vshrn_n_u64(vaddq_u64(multiplied43, roundingAddition), 32)));
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE
|
||||
uint16x4_t BlurFourPixels(const uint32x4_t& aTopLeft, const uint32x4_t& aTopRight,
|
||||
const uint32x4_t& aBottomRight, const uint32x4_t& aBottomLeft,
|
||||
const uint32x2_t& aDivisor)
|
||||
{
|
||||
uint32x4_t values = vaddq_u32(vsubq_u32(vsubq_u32(aBottomRight, aTopRight), aBottomLeft), aTopLeft);
|
||||
return Divide(values, aDivisor);
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE
|
||||
void LoadIntegralRowFromRow(uint32_t *aDest, const uint8_t *aSource,
|
||||
int32_t aSourceWidth, int32_t aLeftInflation,
|
||||
int32_t aRightInflation)
|
||||
{
|
||||
int32_t currentRowSum = 0;
|
||||
|
||||
for (int x = 0; x < aLeftInflation; x++) {
|
||||
currentRowSum += aSource[0];
|
||||
aDest[x] = currentRowSum;
|
||||
}
|
||||
for (int x = aLeftInflation; x < (aSourceWidth + aLeftInflation); x++) {
|
||||
currentRowSum += aSource[(x - aLeftInflation)];
|
||||
aDest[x] = currentRowSum;
|
||||
}
|
||||
for (int x = (aSourceWidth + aLeftInflation); x < (aSourceWidth + aLeftInflation + aRightInflation); x++) {
|
||||
currentRowSum += aSource[aSourceWidth - 1];
|
||||
aDest[x] = currentRowSum;
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_INLINE void
|
||||
GenerateIntegralImage_NEON(int32_t aLeftInflation, int32_t aRightInflation,
|
||||
int32_t aTopInflation, int32_t aBottomInflation,
|
||||
uint32_t *aIntegralImage, size_t aIntegralImageStride,
|
||||
uint8_t *aSource, int32_t aSourceStride, const IntSize &aSize)
|
||||
{
|
||||
MOZ_ASSERT(!(aLeftInflation & 3));
|
||||
|
||||
uint32_t stride32bit = aIntegralImageStride / 4;
|
||||
IntSize integralImageSize(aSize.width + aLeftInflation + aRightInflation,
|
||||
aSize.height + aTopInflation + aBottomInflation);
|
||||
|
||||
LoadIntegralRowFromRow(aIntegralImage, aSource, aSize.width, aLeftInflation, aRightInflation);
|
||||
|
||||
for (int y = 1; y < aTopInflation + 1; y++) {
|
||||
uint32_t *intRow = aIntegralImage + (y * stride32bit);
|
||||
uint32_t *intPrevRow = aIntegralImage + (y - 1) * stride32bit;
|
||||
uint32_t *intFirstRow = aIntegralImage;
|
||||
|
||||
for (int x = 0; x < integralImageSize.width; x += 4) {
|
||||
uint32x4_t firstRow = vld1q_u32(intFirstRow + x);
|
||||
uint32x4_t previousRow = vld1q_u32(intPrevRow + x);
|
||||
vst1q_u32(intRow + x, vaddq_u32(firstRow, previousRow));
|
||||
}
|
||||
}
|
||||
|
||||
for (int y = aTopInflation + 1; y < (aSize.height + aTopInflation); y++) {
|
||||
uint32x4_t currentRowSum = vdupq_n_u32(0);
|
||||
uint32_t *intRow = aIntegralImage + (y * stride32bit);
|
||||
uint32_t *intPrevRow = aIntegralImage + (y - 1) * stride32bit;
|
||||
uint8_t *sourceRow = aSource + aSourceStride * (y - aTopInflation);
|
||||
|
||||
uint32_t pixel = sourceRow[0];
|
||||
for (int x = 0; x < aLeftInflation; x += 4) {
|
||||
uint32_t temp[4];
|
||||
temp[0] = pixel;
|
||||
temp[1] = temp[0] + pixel;
|
||||
temp[2] = temp[1] + pixel;
|
||||
temp[3] = temp[2] + pixel;
|
||||
uint32x4_t sumPixels = vld1q_u32(temp);
|
||||
sumPixels = vaddq_u32(sumPixels, currentRowSum);
|
||||
currentRowSum = vdupq_n_u32(vgetq_lane_u32(sumPixels, 3));
|
||||
vst1q_u32(intRow + x, vaddq_u32(sumPixels, vld1q_u32(intPrevRow + x)));
|
||||
}
|
||||
|
||||
for (int x = aLeftInflation; x < (aSize.width + aLeftInflation); x += 4) {
|
||||
// It's important to shuffle here. When we exit this loop currentRowSum
|
||||
// has to be set to sumPixels, so that the following loop can get the
|
||||
// correct pixel for the currentRowSum. The highest order pixel in
|
||||
// currentRowSum could've originated from accumulation in the stride.
|
||||
currentRowSum = vdupq_n_u32(vgetq_lane_u32(currentRowSum, 3));
|
||||
|
||||
uint32_t temp[4];
|
||||
temp[0] = *(sourceRow + (x - aLeftInflation));
|
||||
temp[1] = temp[0] + *(sourceRow + (x - aLeftInflation) + 1);
|
||||
temp[2] = temp[1] + *(sourceRow + (x - aLeftInflation) + 2);
|
||||
temp[3] = temp[2] + *(sourceRow + (x - aLeftInflation) + 3);
|
||||
uint32x4_t sumPixels = vld1q_u32(temp);
|
||||
sumPixels = vaddq_u32(sumPixels, currentRowSum);
|
||||
currentRowSum = sumPixels;
|
||||
vst1q_u32(intRow + x, vaddq_u32(sumPixels, vld1q_u32(intPrevRow + x)));
|
||||
}
|
||||
|
||||
pixel = sourceRow[aSize.width - 1];
|
||||
int x = (aSize.width + aLeftInflation);
|
||||
if ((aSize.width & 3)) {
|
||||
// Deal with unaligned portion. Get the correct pixel from currentRowSum,
|
||||
// see explanation above.
|
||||
uint32_t intCurrentRowSum = ((uint32_t*)¤tRowSum)[(aSize.width % 4) - 1];
|
||||
for (; x < integralImageSize.width; x++) {
|
||||
// We could be unaligned here!
|
||||
if (!(x & 3)) {
|
||||
// aligned!
|
||||
currentRowSum = vdupq_n_u32(intCurrentRowSum);
|
||||
break;
|
||||
}
|
||||
intCurrentRowSum += pixel;
|
||||
intRow[x] = intPrevRow[x] + intCurrentRowSum;
|
||||
}
|
||||
} else {
|
||||
currentRowSum = vdupq_n_u32(vgetq_lane_u32(currentRowSum, 3));
|
||||
}
|
||||
|
||||
for (; x < integralImageSize.width; x += 4) {
|
||||
uint32_t temp[4];
|
||||
temp[0] = pixel;
|
||||
temp[1] = temp[0] + pixel;
|
||||
temp[2] = temp[1] + pixel;
|
||||
temp[3] = temp[2] + pixel;
|
||||
uint32x4_t sumPixels = vld1q_u32(temp);
|
||||
sumPixels = vaddq_u32(sumPixels, currentRowSum);
|
||||
currentRowSum = vdupq_n_u32(vgetq_lane_u32(sumPixels, 3));
|
||||
vst1q_u32(intRow + x, vaddq_u32(sumPixels, vld1q_u32(intPrevRow + x)));
|
||||
}
|
||||
}
|
||||
|
||||
if (aBottomInflation) {
|
||||
// Store the last valid row of our source image in the last row of
|
||||
// our integral image. This will be overwritten with the correct values
|
||||
// in the upcoming loop.
|
||||
LoadIntegralRowFromRow(aIntegralImage + (integralImageSize.height - 1) * stride32bit,
|
||||
aSource + (aSize.height - 1) * aSourceStride, aSize.width, aLeftInflation, aRightInflation);
|
||||
|
||||
for (int y = aSize.height + aTopInflation; y < integralImageSize.height; y++) {
|
||||
uint32_t *intRow = aIntegralImage + (y * stride32bit);
|
||||
uint32_t *intPrevRow = aIntegralImage + (y - 1) * stride32bit;
|
||||
uint32_t *intLastRow = aIntegralImage + (integralImageSize.height - 1) * stride32bit;
|
||||
for (int x = 0; x < integralImageSize.width; x += 4) {
|
||||
vst1q_u32(intRow + x,
|
||||
vaddq_u32(vld1q_u32(intLastRow + x),
|
||||
vld1q_u32(intPrevRow + x)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to do an in-place box blur using an integral image.
|
||||
*/
|
||||
void
|
||||
AlphaBoxBlur::BoxBlur_NEON(uint8_t* aData,
|
||||
int32_t aLeftLobe,
|
||||
int32_t aRightLobe,
|
||||
int32_t aTopLobe,
|
||||
int32_t aBottomLobe,
|
||||
uint32_t *aIntegralImage,
|
||||
size_t aIntegralImageStride)
|
||||
{
|
||||
IntSize size = GetSize();
|
||||
|
||||
MOZ_ASSERT(size.height > 0);
|
||||
|
||||
// Our 'left' or 'top' lobe will include the current pixel. i.e. when
|
||||
// looking at an integral image the value of a pixel at 'x,y' is calculated
|
||||
// using the value of the integral image values above/below that.
|
||||
aLeftLobe++;
|
||||
aTopLobe++;
|
||||
int32_t boxSize = (aLeftLobe + aRightLobe) * (aTopLobe + aBottomLobe);
|
||||
|
||||
MOZ_ASSERT(boxSize > 0);
|
||||
|
||||
if (boxSize == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t reciprocal = uint32_t((uint64_t(1) << 32) / boxSize);
|
||||
uint32_t stride32bit = aIntegralImageStride / 4;
|
||||
int32_t leftInflation = RoundUpToMultipleOf4(aLeftLobe).value();
|
||||
|
||||
GenerateIntegralImage_NEON(leftInflation, aRightLobe, aTopLobe, aBottomLobe,
|
||||
aIntegralImage, aIntegralImageStride, aData,
|
||||
mStride, size);
|
||||
|
||||
uint32x2_t divisor = vdup_n_u32(reciprocal);
|
||||
|
||||
// This points to the start of the rectangle within the IntegralImage that overlaps
|
||||
// the surface being blurred.
|
||||
uint32_t *innerIntegral = aIntegralImage + (aTopLobe * stride32bit) + leftInflation;
|
||||
IntRect skipRect = mSkipRect;
|
||||
int32_t stride = mStride;
|
||||
uint8_t *data = aData;
|
||||
|
||||
for (int32_t y = 0; y < size.height; y++) {
|
||||
bool inSkipRectY = y > skipRect.y && y < skipRect.YMost();
|
||||
uint32_t *topLeftBase = innerIntegral + ((y - aTopLobe) * ptrdiff_t(stride32bit) - aLeftLobe);
|
||||
uint32_t *topRightBase = innerIntegral + ((y - aTopLobe) * ptrdiff_t(stride32bit) + aRightLobe);
|
||||
uint32_t *bottomRightBase = innerIntegral + ((y + aBottomLobe) * ptrdiff_t(stride32bit) + aRightLobe);
|
||||
uint32_t *bottomLeftBase = innerIntegral + ((y + aBottomLobe) * ptrdiff_t(stride32bit) - aLeftLobe);
|
||||
|
||||
int32_t x = 0;
|
||||
// Process 16 pixels at a time for as long as possible.
|
||||
for (; x <= size.width - 16; x += 16) {
|
||||
if (inSkipRectY && x > skipRect.x && x < skipRect.XMost()) {
|
||||
x = skipRect.XMost() - 16;
|
||||
// Trigger early jump on coming loop iterations, this will be reset
|
||||
// next line anyway.
|
||||
inSkipRectY = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32x4_t topLeft;
|
||||
uint32x4_t topRight;
|
||||
uint32x4_t bottomRight;
|
||||
uint32x4_t bottomLeft;
|
||||
topLeft = vld1q_u32(topLeftBase + x);
|
||||
topRight = vld1q_u32(topRightBase + x);
|
||||
bottomRight = vld1q_u32(bottomRightBase + x);
|
||||
bottomLeft = vld1q_u32(bottomLeftBase + x);
|
||||
uint16x4_t result1 = BlurFourPixels(topLeft, topRight, bottomRight, bottomLeft, divisor);
|
||||
|
||||
topLeft = vld1q_u32(topLeftBase + x + 4);
|
||||
topRight = vld1q_u32(topRightBase + x + 4);
|
||||
bottomRight = vld1q_u32(bottomRightBase + x + 4);
|
||||
bottomLeft = vld1q_u32(bottomLeftBase + x + 4);
|
||||
uint16x4_t result2 = BlurFourPixels(topLeft, topRight, bottomRight, bottomLeft, divisor);
|
||||
|
||||
topLeft = vld1q_u32(topLeftBase + x + 8);
|
||||
topRight = vld1q_u32(topRightBase + x + 8);
|
||||
bottomRight = vld1q_u32(bottomRightBase + x + 8);
|
||||
bottomLeft = vld1q_u32(bottomLeftBase + x + 8);
|
||||
uint16x4_t result3 = BlurFourPixels(topLeft, topRight, bottomRight, bottomLeft, divisor);
|
||||
|
||||
topLeft = vld1q_u32(topLeftBase + x + 12);
|
||||
topRight = vld1q_u32(topRightBase + x + 12);
|
||||
bottomRight = vld1q_u32(bottomRightBase + x + 12);
|
||||
bottomLeft = vld1q_u32(bottomLeftBase + x + 12);
|
||||
uint16x4_t result4 = BlurFourPixels(topLeft, topRight, bottomRight, bottomLeft, divisor);
|
||||
|
||||
uint8x8_t combine1 = vqmovn_u16(vcombine_u16(result1, result2));
|
||||
uint8x8_t combine2 = vqmovn_u16(vcombine_u16(result3, result4));
|
||||
uint8x16_t final = vcombine_u8(combine1, combine2);
|
||||
vst1q_u8(data + stride * y + x, final);
|
||||
}
|
||||
|
||||
// Process the remaining pixels 4 bytes at a time.
|
||||
for (; x < size.width; x += 4) {
|
||||
if (inSkipRectY && x > skipRect.x && x < skipRect.XMost()) {
|
||||
x = skipRect.XMost() - 4;
|
||||
// Trigger early jump on coming loop iterations, this will be reset
|
||||
// next line anyway.
|
||||
inSkipRectY = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32x4_t topLeft = vld1q_u32(topLeftBase + x);
|
||||
uint32x4_t topRight = vld1q_u32(topRightBase + x);
|
||||
uint32x4_t bottomRight = vld1q_u32(bottomRightBase + x);
|
||||
uint32x4_t bottomLeft = vld1q_u32(bottomLeftBase + x);
|
||||
uint16x4_t result = BlurFourPixels(topLeft, topRight, bottomRight, bottomLeft, divisor);
|
||||
uint32x2_t final = vreinterpret_u32_u8(vmovn_u16(vcombine_u16(result, vdup_n_u16(0))));
|
||||
*(uint32_t*)(data + stride * y + x) = vget_lane_u32(final, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(CommandType, int8_t)
|
||||
enum class CommandType : int8_t {
|
||||
DRAWSURFACE = 0,
|
||||
DRAWFILTER,
|
||||
DRAWSURFACEWITHSHADOW,
|
||||
@ -32,7 +32,7 @@ MOZ_BEGIN_ENUM_CLASS(CommandType, int8_t)
|
||||
PUSHCLIPRECT,
|
||||
POPCLIP,
|
||||
SETTRANSFORM
|
||||
MOZ_END_ENUM_CLASS(CommandType)
|
||||
};
|
||||
|
||||
class DrawingCommand
|
||||
{
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "Point.h"
|
||||
#include "BaseRect.h"
|
||||
#include "Matrix.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
#ifdef WIN32
|
||||
// This file gets included from nsGlobalWindow.cpp, which doesn't like
|
||||
@ -225,11 +224,11 @@ public:
|
||||
NoLog &operator <<(const T &aLogText) { return *this; }
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(LogOptions, int)
|
||||
enum class LogOptions : int {
|
||||
NoNewline = 0x01,
|
||||
AutoPrefix = 0x02,
|
||||
AssertOnCall = 0x04
|
||||
MOZ_END_ENUM_CLASS(LogOptions)
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct Hexa {
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "2D.h"
|
||||
#include "mozilla/Constants.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "UserData.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -6,8 +6,6 @@
|
||||
#ifndef MOZILLA_GFX_TYPES_H_
|
||||
#define MOZILLA_GFX_TYPES_H_
|
||||
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@ -16,7 +14,7 @@ namespace gfx {
|
||||
|
||||
typedef float Float;
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(SurfaceType, int8_t)
|
||||
enum class SurfaceType : int8_t {
|
||||
DATA, /* Data surface - bitmap in memory */
|
||||
D2D1_BITMAP, /* Surface wrapping a ID2D1Bitmap */
|
||||
D2D1_DRAWTARGET, /* Surface made from a D2D draw target */
|
||||
@ -29,9 +27,9 @@ MOZ_BEGIN_ENUM_CLASS(SurfaceType, int8_t)
|
||||
D2D1_1_IMAGE, /* A D2D 1.1 ID2D1Image SourceSurface */
|
||||
RECORDING, /* Surface used for recording */
|
||||
TILED /* Surface from a tiled DrawTarget */
|
||||
MOZ_END_ENUM_CLASS(SurfaceType)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(SurfaceFormat, int8_t)
|
||||
enum class SurfaceFormat : int8_t {
|
||||
B8G8R8A8,
|
||||
B8G8R8X8,
|
||||
R8G8B8A8,
|
||||
@ -40,7 +38,7 @@ MOZ_BEGIN_ENUM_CLASS(SurfaceFormat, int8_t)
|
||||
A8,
|
||||
YUV,
|
||||
UNKNOWN
|
||||
MOZ_END_ENUM_CLASS(SurfaceFormat)
|
||||
};
|
||||
|
||||
inline bool IsOpaque(SurfaceFormat aFormat)
|
||||
{
|
||||
@ -55,7 +53,7 @@ inline bool IsOpaque(SurfaceFormat aFormat)
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(FilterType, int8_t)
|
||||
enum class FilterType : int8_t {
|
||||
BLEND = 0,
|
||||
TRANSFORM,
|
||||
MORPHOLOGY,
|
||||
@ -82,15 +80,15 @@ MOZ_BEGIN_ENUM_CLASS(FilterType, int8_t)
|
||||
CROP,
|
||||
PREMULTIPLY,
|
||||
UNPREMULTIPLY
|
||||
MOZ_END_ENUM_CLASS(FilterType)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(DrawTargetType, int8_t)
|
||||
enum class DrawTargetType : int8_t {
|
||||
SOFTWARE_RASTER = 0,
|
||||
HARDWARE_RASTER,
|
||||
VECTOR
|
||||
MOZ_END_ENUM_CLASS(DrawTargetType)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(BackendType, int8_t)
|
||||
enum class BackendType : int8_t {
|
||||
NONE = 0,
|
||||
DIRECT2D,
|
||||
COREGRAPHICS,
|
||||
@ -99,49 +97,49 @@ MOZ_BEGIN_ENUM_CLASS(BackendType, int8_t)
|
||||
SKIA,
|
||||
RECORDING,
|
||||
DIRECT2D1_1
|
||||
MOZ_END_ENUM_CLASS(BackendType)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(FontType, int8_t)
|
||||
enum class FontType : int8_t {
|
||||
DWRITE,
|
||||
GDI,
|
||||
MAC,
|
||||
SKIA,
|
||||
CAIRO,
|
||||
COREGRAPHICS
|
||||
MOZ_END_ENUM_CLASS(FontType)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(NativeSurfaceType, int8_t)
|
||||
enum class NativeSurfaceType : int8_t {
|
||||
D3D10_TEXTURE,
|
||||
CAIRO_SURFACE,
|
||||
CAIRO_CONTEXT,
|
||||
CGCONTEXT,
|
||||
CGCONTEXT_ACCELERATED,
|
||||
OPENGL_TEXTURE
|
||||
MOZ_END_ENUM_CLASS(NativeSurfaceType)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(NativeFontType, int8_t)
|
||||
enum class NativeFontType : int8_t {
|
||||
DWRITE_FONT_FACE,
|
||||
GDI_FONT_FACE,
|
||||
MAC_FONT_FACE,
|
||||
SKIA_FONT_FACE,
|
||||
CAIRO_FONT_FACE
|
||||
MOZ_END_ENUM_CLASS(NativeFontType)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(FontStyle, int8_t)
|
||||
enum class FontStyle : int8_t {
|
||||
NORMAL,
|
||||
ITALIC,
|
||||
BOLD,
|
||||
BOLD_ITALIC
|
||||
MOZ_END_ENUM_CLASS(FontStyle)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(FontHinting, int8_t)
|
||||
enum class FontHinting : int8_t {
|
||||
NONE,
|
||||
LIGHT,
|
||||
NORMAL,
|
||||
FULL
|
||||
MOZ_END_ENUM_CLASS(FontHinting)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(CompositionOp, int8_t)
|
||||
enum class CompositionOp : int8_t {
|
||||
OP_OVER,
|
||||
OP_ADD,
|
||||
OP_ATOP,
|
||||
@ -169,58 +167,58 @@ MOZ_BEGIN_ENUM_CLASS(CompositionOp, int8_t)
|
||||
OP_COLOR,
|
||||
OP_LUMINOSITY,
|
||||
OP_COUNT
|
||||
MOZ_END_ENUM_CLASS(CompositionOp)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(ExtendMode, int8_t)
|
||||
enum class ExtendMode : int8_t {
|
||||
CLAMP,
|
||||
REPEAT,
|
||||
REFLECT
|
||||
MOZ_END_ENUM_CLASS(ExtendMode)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(FillRule, int8_t)
|
||||
enum class FillRule : int8_t {
|
||||
FILL_WINDING,
|
||||
FILL_EVEN_ODD
|
||||
MOZ_END_ENUM_CLASS(FillRule)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(AntialiasMode, int8_t)
|
||||
enum class AntialiasMode : int8_t {
|
||||
NONE,
|
||||
GRAY,
|
||||
SUBPIXEL,
|
||||
DEFAULT
|
||||
MOZ_END_ENUM_CLASS(AntialiasMode)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(Filter, int8_t)
|
||||
enum class Filter : int8_t {
|
||||
GOOD,
|
||||
LINEAR,
|
||||
POINT
|
||||
MOZ_END_ENUM_CLASS(Filter)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(PatternType, int8_t)
|
||||
enum class PatternType : int8_t {
|
||||
COLOR,
|
||||
SURFACE,
|
||||
LINEAR_GRADIENT,
|
||||
RADIAL_GRADIENT
|
||||
MOZ_END_ENUM_CLASS(PatternType)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(JoinStyle, int8_t)
|
||||
enum class JoinStyle : int8_t {
|
||||
BEVEL,
|
||||
ROUND,
|
||||
MITER, //!< Mitered if within the miter limit, else, if the backed supports
|
||||
//!< it (D2D), the miter is clamped. If the backend does not support
|
||||
//!< miter clamping the behavior is as for MITER_OR_BEVEL.
|
||||
MITER_OR_BEVEL //!< Mitered if within the miter limit, else beveled.
|
||||
MOZ_END_ENUM_CLASS(JoinStyle)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(CapStyle, int8_t)
|
||||
enum class CapStyle : int8_t {
|
||||
BUTT,
|
||||
ROUND,
|
||||
SQUARE
|
||||
MOZ_END_ENUM_CLASS(CapStyle)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(SamplingBounds, int8_t)
|
||||
enum class SamplingBounds : int8_t {
|
||||
UNBOUNDED,
|
||||
BOUNDED
|
||||
MOZ_END_ENUM_CLASS(SamplingBounds)
|
||||
};
|
||||
|
||||
/* Color is stored in non-premultiplied form */
|
||||
struct Color
|
||||
|
@ -136,6 +136,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
||||
'QuartzSupport.mm',
|
||||
]
|
||||
|
||||
if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['BUILD_ARM_NEON']:
|
||||
SOURCES += ['BlurNEON.cpp']
|
||||
SOURCES['BlurNEON.cpp'].flags += ['-mfpu=neon']
|
||||
|
||||
FAIL_ON_WARNINGS = True
|
||||
|
||||
MSVC_ENABLE_PGO = True
|
||||
|
@ -12,19 +12,18 @@
|
||||
#include "GLDefs.h"
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
|
||||
|
||||
namespace mozilla {
|
||||
namespace gl {
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(AndroidWindowFormat)
|
||||
enum class AndroidWindowFormat {
|
||||
Unknown = -1,
|
||||
RGBA_8888 = 1,
|
||||
RGBX_8888 = 1 << 1,
|
||||
RGB_565 = 1 << 2
|
||||
MOZ_END_ENUM_CLASS(AndroidWindowFormat)
|
||||
};
|
||||
|
||||
/**
|
||||
* This class is a wrapper around Android's SurfaceTexture class.
|
||||
|
@ -84,7 +84,7 @@ namespace mozilla {
|
||||
namespace mozilla {
|
||||
namespace gl {
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(GLFeature)
|
||||
enum class GLFeature {
|
||||
bind_buffer_offset,
|
||||
blend_minmax,
|
||||
clear_buffers,
|
||||
@ -134,17 +134,17 @@ MOZ_BEGIN_ENUM_CLASS(GLFeature)
|
||||
uniform_matrix_nonsquare,
|
||||
vertex_array_object,
|
||||
EnumMax
|
||||
MOZ_END_ENUM_CLASS(GLFeature)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(ContextProfile, uint8_t)
|
||||
enum class ContextProfile : uint8_t {
|
||||
Unknown = 0,
|
||||
OpenGL, // only for IsAtLeast's <profile> parameter
|
||||
OpenGLCore,
|
||||
OpenGLCompatibility,
|
||||
OpenGLES
|
||||
MOZ_END_ENUM_CLASS(ContextProfile)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(GLVendor)
|
||||
enum class GLVendor {
|
||||
Intel,
|
||||
NVIDIA,
|
||||
ATI,
|
||||
@ -154,9 +154,9 @@ MOZ_BEGIN_ENUM_CLASS(GLVendor)
|
||||
Vivante,
|
||||
VMware,
|
||||
Other
|
||||
MOZ_END_ENUM_CLASS(GLVendor)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(GLRenderer)
|
||||
enum class GLRenderer {
|
||||
Adreno200,
|
||||
Adreno205,
|
||||
AdrenoTM200,
|
||||
@ -170,7 +170,7 @@ MOZ_BEGIN_ENUM_CLASS(GLRenderer)
|
||||
IntelHD3000,
|
||||
MicrosoftBasicRenderDriver,
|
||||
Other
|
||||
MOZ_END_ENUM_CLASS(GLRenderer)
|
||||
};
|
||||
|
||||
class GLContext
|
||||
: public GLLibraryLoader
|
||||
|
@ -16,7 +16,7 @@ namespace gl {
|
||||
|
||||
const size_t kMAX_EXTENSION_GROUP_SIZE = 5;
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(GLVersion, uint32_t)
|
||||
enum class GLVersion : uint32_t {
|
||||
NONE = 0, // Feature is not supported natively by GL
|
||||
GL1_2 = 120,
|
||||
GL1_3 = 130,
|
||||
@ -30,14 +30,14 @@ MOZ_BEGIN_ENUM_CLASS(GLVersion, uint32_t)
|
||||
GL4_1 = 410,
|
||||
GL4_2 = 420,
|
||||
GL4_3 = 430,
|
||||
MOZ_END_ENUM_CLASS(GLVersion)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(GLESVersion, uint32_t)
|
||||
enum class GLESVersion : uint32_t {
|
||||
NONE = 0, // Feature is not support natively by GL ES
|
||||
ES2 = 200,
|
||||
ES3 = 300,
|
||||
ES3_1 = 310,
|
||||
MOZ_END_ENUM_CLASS(GLESVersion)
|
||||
};
|
||||
|
||||
// ARB_ES2_compatibility is natively supported in OpenGL 4.1.
|
||||
static const GLVersion kGLCoreVersionForES2Compat = GLVersion::GL4_1;
|
||||
|
@ -7,25 +7,24 @@
|
||||
#define GLCONTEXT_TYPES_H_
|
||||
|
||||
#include "GLTypes.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace gl {
|
||||
|
||||
class GLContext;
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(GLContextType)
|
||||
enum class GLContextType {
|
||||
Unknown,
|
||||
WGL,
|
||||
CGL,
|
||||
GLX,
|
||||
EGL
|
||||
MOZ_END_ENUM_CLASS(GLContextType)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(OriginPos, uint8_t)
|
||||
enum class OriginPos : uint8_t {
|
||||
TopLeft,
|
||||
BottomLeft
|
||||
MOZ_END_ENUM_CLASS(OriginPos)
|
||||
};
|
||||
|
||||
struct GLFormats
|
||||
{
|
||||
|
@ -6,7 +6,6 @@
|
||||
#ifndef SURFACE_TYPES_H_
|
||||
#define SURFACE_TYPES_H_
|
||||
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include <stdint.h>
|
||||
@ -67,7 +66,7 @@ struct SurfaceCaps MOZ_FINAL
|
||||
}
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(SharedSurfaceType, uint8_t)
|
||||
enum class SharedSurfaceType : uint8_t {
|
||||
Unknown = 0,
|
||||
|
||||
Basic,
|
||||
@ -80,16 +79,16 @@ MOZ_BEGIN_ENUM_CLASS(SharedSurfaceType, uint8_t)
|
||||
IOSurface,
|
||||
|
||||
Max
|
||||
MOZ_END_ENUM_CLASS(SharedSurfaceType)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(AttachmentType, uint8_t)
|
||||
enum class AttachmentType : uint8_t {
|
||||
Screen = 0,
|
||||
|
||||
GLTexture,
|
||||
GLRenderbuffer,
|
||||
|
||||
Max
|
||||
MOZ_END_ENUM_CLASS(AttachmentType)
|
||||
};
|
||||
|
||||
} /* namespace gfx */
|
||||
} /* namespace mozilla */
|
||||
|
@ -34,13 +34,7 @@
|
||||
namespace mozilla {
|
||||
|
||||
typedef gfxImageFormat PixelFormat;
|
||||
#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS)
|
||||
typedef ::GraphicsFilter GraphicsFilterType;
|
||||
#else
|
||||
// If we don't have support for enum classes, then we need to use the actual
|
||||
// enum type here instead of the simulated enum class.
|
||||
typedef GraphicsFilter::Enum GraphicsFilterType;
|
||||
#endif
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
@ -198,7 +192,7 @@ struct ParamTraits<gfxRect>
|
||||
|
||||
template <>
|
||||
struct ParamTraits<gfxContentType>
|
||||
: public ContiguousTypedEnumSerializer<
|
||||
: public ContiguousEnumSerializer<
|
||||
gfxContentType,
|
||||
gfxContentType::COLOR,
|
||||
gfxContentType::SENTINEL>
|
||||
@ -206,7 +200,7 @@ struct ParamTraits<gfxContentType>
|
||||
|
||||
template <>
|
||||
struct ParamTraits<gfxSurfaceType>
|
||||
: public ContiguousTypedEnumSerializer<
|
||||
: public ContiguousEnumSerializer<
|
||||
gfxSurfaceType,
|
||||
gfxSurfaceType::Image,
|
||||
gfxSurfaceType::Max>
|
||||
@ -222,7 +216,7 @@ struct ParamTraits<mozilla::GraphicsFilterType>
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::layers::LayersBackend>
|
||||
: public ContiguousTypedEnumSerializer<
|
||||
: public ContiguousEnumSerializer<
|
||||
mozilla::layers::LayersBackend,
|
||||
mozilla::layers::LayersBackend::LAYERS_NONE,
|
||||
mozilla::layers::LayersBackend::LAYERS_LAST>
|
||||
@ -230,7 +224,7 @@ struct ParamTraits<mozilla::layers::LayersBackend>
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::layers::ScaleMode>
|
||||
: public ContiguousTypedEnumSerializer<
|
||||
: public ContiguousEnumSerializer<
|
||||
mozilla::layers::ScaleMode,
|
||||
mozilla::layers::ScaleMode::SCALE_NONE,
|
||||
mozilla::layers::ScaleMode::SENTINEL>
|
||||
@ -238,7 +232,7 @@ struct ParamTraits<mozilla::layers::ScaleMode>
|
||||
|
||||
template <>
|
||||
struct ParamTraits<gfxImageFormat>
|
||||
: public ContiguousTypedEnumSerializer<
|
||||
: public ContiguousEnumSerializer<
|
||||
gfxImageFormat,
|
||||
gfxImageFormat::ARGB32,
|
||||
gfxImageFormat::Unknown>
|
||||
@ -254,7 +248,7 @@ struct ParamTraits<mozilla::gfx::AttributeName>
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::gfx::AttributeType>
|
||||
: public ContiguousTypedEnumSerializer<
|
||||
: public ContiguousEnumSerializer<
|
||||
mozilla::gfx::AttributeType,
|
||||
mozilla::gfx::AttributeType::eBool,
|
||||
mozilla::gfx::AttributeType::Max>
|
||||
@ -262,7 +256,7 @@ struct ParamTraits<mozilla::gfx::AttributeType>
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::gfx::PrimitiveType>
|
||||
: public ContiguousTypedEnumSerializer<
|
||||
: public ContiguousEnumSerializer<
|
||||
mozilla::gfx::PrimitiveType,
|
||||
mozilla::gfx::PrimitiveType::Empty,
|
||||
mozilla::gfx::PrimitiveType::Max>
|
||||
@ -270,7 +264,7 @@ struct ParamTraits<mozilla::gfx::PrimitiveType>
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::gfx::ColorSpace>
|
||||
: public ContiguousTypedEnumSerializer<
|
||||
: public ContiguousEnumSerializer<
|
||||
mozilla::gfx::ColorSpace,
|
||||
mozilla::gfx::ColorSpace::SRGB,
|
||||
mozilla::gfx::ColorSpace::Max>
|
||||
@ -278,14 +272,14 @@ struct ParamTraits<mozilla::gfx::ColorSpace>
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::layers::TextureFlags>
|
||||
: public BitFlagsTypedEnumSerializer<
|
||||
: public BitFlagsEnumSerializer<
|
||||
mozilla::layers::TextureFlags,
|
||||
mozilla::layers::TextureFlags::ALL_BITS>
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::layers::TextureIdentifier>
|
||||
: public ContiguousTypedEnumSerializer<
|
||||
: public ContiguousEnumSerializer<
|
||||
mozilla::layers::TextureIdentifier,
|
||||
mozilla::layers::TextureIdentifier::Front,
|
||||
mozilla::layers::TextureIdentifier::HighBound>
|
||||
@ -293,14 +287,14 @@ struct ParamTraits<mozilla::layers::TextureIdentifier>
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::layers::DeprecatedTextureHostFlags>
|
||||
: public BitFlagsTypedEnumSerializer<
|
||||
: public BitFlagsEnumSerializer<
|
||||
mozilla::layers::DeprecatedTextureHostFlags,
|
||||
mozilla::layers::DeprecatedTextureHostFlags::ALL_BITS>
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::layers::DiagnosticTypes>
|
||||
: public BitFlagsTypedEnumSerializer<
|
||||
: public BitFlagsEnumSerializer<
|
||||
mozilla::layers::DiagnosticTypes,
|
||||
mozilla::layers::DiagnosticTypes::ALL_BITS>
|
||||
{};
|
||||
@ -854,7 +848,7 @@ struct ParamTraits<mozilla::layers::TextureInfo>
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::layers::CompositableType>
|
||||
: public ContiguousTypedEnumSerializer<
|
||||
: public ContiguousEnumSerializer<
|
||||
mozilla::layers::CompositableType,
|
||||
mozilla::layers::CompositableType::UNKNOWN,
|
||||
mozilla::layers::CompositableType::COUNT>
|
||||
@ -862,7 +856,7 @@ struct ParamTraits<mozilla::layers::CompositableType>
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::gfx::SurfaceFormat>
|
||||
: public ContiguousTypedEnumSerializer<
|
||||
: public ContiguousEnumSerializer<
|
||||
mozilla::gfx::SurfaceFormat,
|
||||
mozilla::gfx::SurfaceFormat::B8G8R8A8,
|
||||
mozilla::gfx::SurfaceFormat::UNKNOWN>
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "mozilla/gfx/Types.h"
|
||||
#include "mozilla/EnumSet.h"
|
||||
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "mozilla/TypedEnumBits.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -25,7 +24,7 @@ namespace layers {
|
||||
* by the compositableCient, they may be modified by either the compositable or
|
||||
* texture clients.
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(TextureFlags, uint32_t)
|
||||
enum class TextureFlags : uint32_t {
|
||||
NO_FLAGS = 0,
|
||||
// Use nearest-neighbour texture filtering (as opposed to linear filtering).
|
||||
USE_NEAREST_FILTER = 1 << 0,
|
||||
@ -67,7 +66,7 @@ MOZ_BEGIN_ENUM_CLASS(TextureFlags, uint32_t)
|
||||
ALL_BITS = (1 << 10) - 1,
|
||||
// the default flags
|
||||
DEFAULT = NO_FLAGS
|
||||
MOZ_END_ENUM_CLASS(TextureFlags)
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(TextureFlags)
|
||||
|
||||
static inline bool
|
||||
@ -83,14 +82,14 @@ TextureRequiresLocking(TextureFlags aFlags)
|
||||
/**
|
||||
* The type of debug diagnostic to enable.
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(DiagnosticTypes, uint8_t)
|
||||
enum class DiagnosticTypes : uint8_t {
|
||||
NO_DIAGNOSTIC = 0,
|
||||
TILE_BORDERS = 1 << 0,
|
||||
LAYER_BORDERS = 1 << 1,
|
||||
BIGIMAGE_BORDERS = 1 << 2,
|
||||
FLASH_BORDERS = 1 << 3,
|
||||
ALL_BITS = (1 << 4) - 1
|
||||
MOZ_END_ENUM_CLASS(DiagnosticTypes)
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(DiagnosticTypes)
|
||||
|
||||
#define DIAGNOSTIC_FLASH_COUNTER_MAX 100
|
||||
@ -98,7 +97,7 @@ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(DiagnosticTypes)
|
||||
/**
|
||||
* Information about the object that is being diagnosed.
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(DiagnosticFlags, uint16_t)
|
||||
enum class DiagnosticFlags : uint16_t {
|
||||
NO_DIAGNOSTIC = 0,
|
||||
IMAGE = 1 << 0,
|
||||
CONTENT = 1 << 1,
|
||||
@ -109,13 +108,13 @@ MOZ_BEGIN_ENUM_CLASS(DiagnosticFlags, uint16_t)
|
||||
BIGIMAGE = 1 << 6,
|
||||
COMPONENT_ALPHA = 1 << 7,
|
||||
REGION_RECT = 1 << 8
|
||||
MOZ_END_ENUM_CLASS(DiagnosticFlags)
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(DiagnosticFlags)
|
||||
|
||||
/**
|
||||
* See gfx/layers/Effects.h
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(EffectTypes, uint8_t)
|
||||
enum class EffectTypes : uint8_t {
|
||||
MASK,
|
||||
BLEND_MODE,
|
||||
COLOR_MATRIX,
|
||||
@ -127,12 +126,12 @@ MOZ_BEGIN_ENUM_CLASS(EffectTypes, uint8_t)
|
||||
RENDER_TARGET,
|
||||
VR_DISTORTION,
|
||||
MAX //sentinel for the count of all effect types
|
||||
MOZ_END_ENUM_CLASS(EffectTypes)
|
||||
};
|
||||
|
||||
/**
|
||||
* How the Compositable should manage textures.
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(CompositableType, uint8_t)
|
||||
enum class CompositableType : uint8_t {
|
||||
UNKNOWN,
|
||||
CONTENT_INC, // painted layer interface, only sends incremental
|
||||
// updates to a texture on the compositor side.
|
||||
@ -143,19 +142,19 @@ MOZ_BEGIN_ENUM_CLASS(CompositableType, uint8_t)
|
||||
CONTENT_SINGLE, // painted layer interface, single buffering
|
||||
CONTENT_DOUBLE, // painted layer interface, double buffering
|
||||
COUNT
|
||||
MOZ_END_ENUM_CLASS(CompositableType)
|
||||
};
|
||||
|
||||
/**
|
||||
* How the texture host is used for composition,
|
||||
* XXX - Only used by ContentClientIncremental
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(DeprecatedTextureHostFlags, uint8_t)
|
||||
enum class DeprecatedTextureHostFlags : uint8_t {
|
||||
DEFAULT = 0, // The default texture host for the given SurfaceDescriptor
|
||||
TILED = 1 << 0, // A texture host that supports tiling
|
||||
COPY_PREVIOUS = 1 << 1, // Texture contents should be initialized
|
||||
// from the previous texture.
|
||||
ALL_BITS = (1 << 2) - 1
|
||||
MOZ_END_ENUM_CLASS(DeprecatedTextureHostFlags)
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(DeprecatedTextureHostFlags)
|
||||
|
||||
#ifdef XP_WIN
|
||||
@ -201,13 +200,13 @@ struct TextureFactoryIdentifier
|
||||
* XXX - We don't really need this, it will be removed along with the incremental
|
||||
* ContentClient/Host.
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(TextureIdentifier, uint8_t)
|
||||
enum class TextureIdentifier : uint8_t {
|
||||
Front = 1,
|
||||
Back = 2,
|
||||
OnWhiteFront = 3,
|
||||
OnWhiteBack = 4,
|
||||
HighBound
|
||||
MOZ_END_ENUM_CLASS(TextureIdentifier)
|
||||
};
|
||||
|
||||
/**
|
||||
* Information required by the compositor from the content-side for creating or
|
||||
@ -249,24 +248,24 @@ struct TextureInfo
|
||||
*
|
||||
* See ShadowLayerForwarder::OpenDescriptor for example.
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(OpenMode, uint8_t)
|
||||
enum class OpenMode : uint8_t {
|
||||
OPEN_NONE = 0,
|
||||
OPEN_READ = 0x1,
|
||||
OPEN_WRITE = 0x2,
|
||||
OPEN_READ_WRITE = OPEN_READ|OPEN_WRITE,
|
||||
OPEN_READ_ONLY = OPEN_READ,
|
||||
OPEN_WRITE_ONLY = OPEN_WRITE
|
||||
MOZ_END_ENUM_CLASS(OpenMode)
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(OpenMode)
|
||||
|
||||
// The kinds of mask texture a shader can support
|
||||
// We rely on the items in this enum being sequential
|
||||
MOZ_BEGIN_ENUM_CLASS(MaskType, uint8_t)
|
||||
enum class MaskType : uint8_t {
|
||||
MaskNone = 0, // no mask layer
|
||||
Mask2d, // mask layer for layers with 2D transforms
|
||||
Mask3d, // mask layer for layers with 3D transforms
|
||||
NumMaskTypes
|
||||
MOZ_END_ENUM_CLASS(MaskType)
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
@ -6,11 +6,9 @@
|
||||
#ifndef GFX_IMAGETYPES_H
|
||||
#define GFX_IMAGETYPES_H
|
||||
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(ImageFormat)
|
||||
enum class ImageFormat {
|
||||
/**
|
||||
* The PLANAR_YCBCR format creates a PlanarYCbCrImage. All backends should
|
||||
* support this format, because the Ogg video decoder depends on it.
|
||||
@ -84,15 +82,15 @@ MOZ_BEGIN_ENUM_CLASS(ImageFormat)
|
||||
* The opaque handle would be a platform specific identifier.
|
||||
*/
|
||||
OVERLAY_IMAGE
|
||||
MOZ_END_ENUM_CLASS(ImageFormat)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(StereoMode)
|
||||
enum class StereoMode {
|
||||
MONO,
|
||||
LEFT_RIGHT,
|
||||
RIGHT_LEFT,
|
||||
BOTTOM_TOP,
|
||||
TOP_BOTTOM
|
||||
MOZ_END_ENUM_CLASS(StereoMode)
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "nsPoint.h" // for nsIntPoint
|
||||
#include "nsRegion.h"
|
||||
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "mozilla/TypedEnumBits.h"
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
@ -46,7 +45,7 @@ class TextureHost;
|
||||
#undef NONE
|
||||
#undef OPAQUE
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(LayersBackend, int8_t)
|
||||
enum class LayersBackend : int8_t {
|
||||
LAYERS_NONE = 0,
|
||||
LAYERS_BASIC,
|
||||
LAYERS_OPENGL,
|
||||
@ -55,29 +54,29 @@ MOZ_BEGIN_ENUM_CLASS(LayersBackend, int8_t)
|
||||
LAYERS_D3D11,
|
||||
LAYERS_CLIENT,
|
||||
LAYERS_LAST
|
||||
MOZ_END_ENUM_CLASS(LayersBackend)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(BufferMode, int8_t)
|
||||
enum class BufferMode : int8_t {
|
||||
BUFFER_NONE,
|
||||
BUFFERED
|
||||
MOZ_END_ENUM_CLASS(BufferMode)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(DrawRegionClip, int8_t)
|
||||
enum class DrawRegionClip : int8_t {
|
||||
DRAW,
|
||||
NONE
|
||||
MOZ_END_ENUM_CLASS(DrawRegionClip)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(SurfaceMode, int8_t)
|
||||
enum class SurfaceMode : int8_t {
|
||||
SURFACE_NONE = 0,
|
||||
SURFACE_OPAQUE,
|
||||
SURFACE_SINGLE_CHANNEL_ALPHA,
|
||||
SURFACE_COMPONENT_ALPHA
|
||||
MOZ_END_ENUM_CLASS(SurfaceMode)
|
||||
};
|
||||
|
||||
// LayerRenderState for Composer2D
|
||||
// We currently only support Composer2D using gralloc. If we want to be backed
|
||||
// by other surfaces we will need a more generic LayerRenderState.
|
||||
MOZ_BEGIN_ENUM_CLASS(LayerRenderStateFlags, int8_t)
|
||||
enum class LayerRenderStateFlags : int8_t {
|
||||
LAYER_RENDER_STATE_DEFAULT = 0,
|
||||
ORIGIN_BOTTOM_LEFT = 1 << 0,
|
||||
BUFFER_ROTATION = 1 << 1,
|
||||
@ -87,7 +86,7 @@ MOZ_BEGIN_ENUM_CLASS(LayerRenderStateFlags, int8_t)
|
||||
// render. This avoids confusion when a layer might return different kinds
|
||||
// of surfaces over time (e.g. video frames).
|
||||
OPAQUE = 1 << 3
|
||||
MOZ_END_ENUM_CLASS(LayerRenderStateFlags)
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(LayerRenderStateFlags)
|
||||
|
||||
// The 'ifdef MOZ_WIDGET_GONK' sadness here is because we don't want to include
|
||||
@ -151,12 +150,12 @@ struct LayerRenderState {
|
||||
#endif
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(ScaleMode, int8_t)
|
||||
enum class ScaleMode : int8_t {
|
||||
SCALE_NONE,
|
||||
STRETCH,
|
||||
SENTINEL
|
||||
// Unimplemented - PRESERVE_ASPECT_RATIO_CONTAIN
|
||||
MOZ_END_ENUM_CLASS(ScaleMode)
|
||||
};
|
||||
|
||||
struct EventRegions {
|
||||
nsIntRegion mHitRegion;
|
||||
|
@ -89,9 +89,9 @@ public:
|
||||
|
||||
static TemporaryRef<SyncObject> CreateSyncObject(SyncHandle aHandle);
|
||||
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS(SyncType)
|
||||
enum class SyncType {
|
||||
D3D11,
|
||||
MOZ_END_NESTED_ENUM_CLASS(SyncType)
|
||||
};
|
||||
|
||||
virtual SyncType GetSyncType() = 0;
|
||||
virtual void FinalizeFrame() = 0;
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "mozilla/gfx/Rect.h"
|
||||
#include "mozilla/gfx/Matrix.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
@ -162,7 +161,7 @@ class SourceSurface;
|
||||
class FilterNode;
|
||||
struct FilterAttribute;
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(AttributeType)
|
||||
enum class AttributeType {
|
||||
eBool,
|
||||
eUint,
|
||||
eFloat,
|
||||
@ -176,7 +175,7 @@ MOZ_BEGIN_ENUM_CLASS(AttributeType)
|
||||
eAttributeMap,
|
||||
eFloats,
|
||||
Max
|
||||
MOZ_END_ENUM_CLASS(AttributeType)
|
||||
};
|
||||
|
||||
// Limits
|
||||
const float kMaxStdDeviation = 500;
|
||||
@ -231,16 +230,16 @@ private:
|
||||
mutable nsClassHashtable<nsUint32HashKey, FilterAttribute> mMap;
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(ColorSpace)
|
||||
enum class ColorSpace {
|
||||
SRGB,
|
||||
LinearRGB,
|
||||
Max
|
||||
MOZ_END_ENUM_CLASS(ColorSpace)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(AlphaModel)
|
||||
enum class AlphaModel {
|
||||
Unpremultiplied,
|
||||
Premultiplied
|
||||
MOZ_END_ENUM_CLASS(AlphaModel)
|
||||
};
|
||||
|
||||
class ColorModel {
|
||||
public:
|
||||
@ -268,7 +267,7 @@ public:
|
||||
AlphaModel mAlphaModel;
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(PrimitiveType)
|
||||
enum class PrimitiveType {
|
||||
Empty = 0,
|
||||
Blend,
|
||||
Morphology,
|
||||
@ -289,7 +288,7 @@ MOZ_BEGIN_ENUM_CLASS(PrimitiveType)
|
||||
SpecularLighting,
|
||||
ToAlpha,
|
||||
Max
|
||||
MOZ_END_ENUM_CLASS(PrimitiveType)
|
||||
};
|
||||
|
||||
/**
|
||||
* A data structure to carry attributes for a given primitive that's part of a
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "nsMargin.h" // for nsIntMargin
|
||||
#include "nsStringGlue.h" // for nsCString
|
||||
#include "xpcom-config.h" // for CPP_THROW_NEW
|
||||
#include "mozilla/TypedEnum.h" // for the VisitEdges typed enum
|
||||
#include "mozilla/Move.h" // for mozilla::Move
|
||||
|
||||
class nsIntRegion;
|
||||
@ -40,12 +39,12 @@ class gfx3DMatrix;
|
||||
* projects including Qt, Gtk, Wine. It should perform reasonably well.
|
||||
*/
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(VisitSide)
|
||||
enum class VisitSide {
|
||||
TOP,
|
||||
BOTTOM,
|
||||
LEFT,
|
||||
RIGHT
|
||||
MOZ_END_ENUM_CLASS(VisitSide)
|
||||
};
|
||||
|
||||
class nsRegionRectIterator;
|
||||
|
||||
|
@ -6,10 +6,8 @@
|
||||
#ifndef DrawMode_h
|
||||
#define DrawMode_h
|
||||
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
// Options for how the text should be drawn
|
||||
MOZ_BEGIN_ENUM_CLASS(DrawMode, int)
|
||||
enum class DrawMode : int {
|
||||
// GLYPH_FILL and GLYPH_STROKE draw into the current context
|
||||
// and may be used together with bitwise OR.
|
||||
GLYPH_FILL = 1,
|
||||
@ -21,7 +19,7 @@ MOZ_BEGIN_ENUM_CLASS(DrawMode, int)
|
||||
// When GLYPH_FILL and GLYPH_STROKE are both set, draws the
|
||||
// stroke underneath the fill.
|
||||
GLYPH_STROKE_UNDERNEATH = 8
|
||||
MOZ_END_ENUM_CLASS(DrawMode)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -6,9 +6,7 @@
|
||||
#ifndef GraphicsFilter_h
|
||||
#define GraphicsFilter_h
|
||||
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(GraphicsFilter, int)
|
||||
enum class GraphicsFilter : int {
|
||||
FILTER_FAST,
|
||||
FILTER_GOOD,
|
||||
FILTER_BEST,
|
||||
@ -16,7 +14,7 @@ MOZ_BEGIN_ENUM_CLASS(GraphicsFilter, int)
|
||||
FILTER_BILINEAR,
|
||||
FILTER_GAUSSIAN,
|
||||
FILTER_SENTINEL
|
||||
MOZ_END_ENUM_CLASS(GraphicsFilter)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <stdint.h>
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Constants.h" // for M_PI
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
// First time gfxPrefs::GetSingleton() needs to be called on the main thread,
|
||||
// before any of the methods accessing the values are used, but after
|
||||
@ -78,14 +77,14 @@ private:
|
||||
|
||||
private:
|
||||
// Enums for the update policy.
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS(UpdatePolicy)
|
||||
enum class UpdatePolicy {
|
||||
Skip, // Set the value to default, skip any Preferences calls
|
||||
Once, // Evaluate the preference once, unchanged during the session
|
||||
Live // Evaluate the preference and set callback so it stays current/live
|
||||
MOZ_END_NESTED_ENUM_CLASS(UpdatePolicy)
|
||||
};
|
||||
|
||||
// Since we cannot use const char*, use a function that returns it.
|
||||
template <MOZ_ENUM_CLASS_ENUM_TYPE(UpdatePolicy) Update, class T, T Default(void), const char* Pref(void)>
|
||||
template <UpdatePolicy Update, class T, T Default(void), const char* Pref(void)>
|
||||
class PrefTemplate
|
||||
{
|
||||
public:
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define GFX_TYPES_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
typedef struct _cairo_surface cairo_surface_t;
|
||||
typedef struct _cairo_user_data_key cairo_user_data_key_t;
|
||||
@ -39,26 +38,26 @@ typedef double gfxFloat;
|
||||
* @see gfxTextRun::BreakAndMeasureText
|
||||
* @see nsLineLayout::NotifyOptionalBreakPosition
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(gfxBreakPriority)
|
||||
enum class gfxBreakPriority {
|
||||
eNoBreak = 0,
|
||||
eWordWrapBreak,
|
||||
eNormalBreak
|
||||
MOZ_END_ENUM_CLASS(gfxBreakPriority)
|
||||
};
|
||||
|
||||
/**
|
||||
* The format for an image surface. For all formats with alpha data, 0
|
||||
* means transparent, 1 or 255 means fully opaque.
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(gfxImageFormat)
|
||||
enum class gfxImageFormat {
|
||||
ARGB32, ///< ARGB data in native endianness, using premultiplied alpha
|
||||
RGB24, ///< xRGB data in native endianness
|
||||
A8, ///< Only an alpha channel
|
||||
A1, ///< Packed transparency information (one byte refers to 8 pixels)
|
||||
RGB16_565, ///< RGB_565 data in native endianness
|
||||
Unknown
|
||||
MOZ_END_ENUM_CLASS(gfxImageFormat)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(gfxSurfaceType)
|
||||
enum class gfxSurfaceType {
|
||||
Image,
|
||||
PDF,
|
||||
PS,
|
||||
@ -85,24 +84,24 @@ MOZ_BEGIN_ENUM_CLASS(gfxSurfaceType)
|
||||
Subsurface,
|
||||
D2D,
|
||||
Max
|
||||
MOZ_END_ENUM_CLASS(gfxSurfaceType)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(gfxContentType)
|
||||
enum class gfxContentType {
|
||||
COLOR = 0x1000,
|
||||
ALPHA = 0x2000,
|
||||
COLOR_ALPHA = 0x3000,
|
||||
SENTINEL = 0xffff
|
||||
MOZ_END_ENUM_CLASS(gfxContentType)
|
||||
};
|
||||
|
||||
/**
|
||||
* The memory used by a gfxASurface (as reported by KnownMemoryUsed()) can
|
||||
* either live in this process's heap, in this process but outside the
|
||||
* heap, or in another process altogether.
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(gfxMemoryLocation)
|
||||
enum class gfxMemoryLocation {
|
||||
IN_PROCESS_HEAP,
|
||||
IN_PROCESS_NONHEAP,
|
||||
OUT_OF_PROCESS
|
||||
MOZ_END_ENUM_CLASS(gfxMemoryLocation)
|
||||
};
|
||||
|
||||
#endif /* GFX_TYPES_H */
|
||||
|
@ -17,10 +17,10 @@
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(VRHMDType, uint16_t)
|
||||
enum class VRHMDType : uint16_t {
|
||||
Oculus,
|
||||
NumHMDTypes
|
||||
MOZ_END_ENUM_CLASS(VRHMDType)
|
||||
};
|
||||
|
||||
struct VRFieldOfView {
|
||||
static VRFieldOfView FromCSSPerspectiveInfo(double aPerspectiveDistance,
|
||||
|
@ -7,7 +7,6 @@
|
||||
#define MOZILLA_IMAGELIB_EXIF_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "nsDebug.h"
|
||||
|
||||
#include "Orientation.h"
|
||||
@ -15,11 +14,11 @@
|
||||
namespace mozilla {
|
||||
namespace image {
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(ByteOrder, uint8_t)
|
||||
enum class ByteOrder : uint8_t {
|
||||
Unknown,
|
||||
LittleEndian,
|
||||
BigEndian
|
||||
MOZ_END_ENUM_CLASS(ByteOrder)
|
||||
};
|
||||
|
||||
struct EXIFData
|
||||
{
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include <mozilla/TypedEnum.h>
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIEventTarget.h"
|
||||
#include "nsIObserver.h"
|
||||
|
@ -7,22 +7,21 @@
|
||||
#define MOZILLA_IMAGELIB_ORIENTATION_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace image {
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(Angle, uint8_t)
|
||||
enum class Angle : uint8_t {
|
||||
D0,
|
||||
D90,
|
||||
D180,
|
||||
D270
|
||||
MOZ_END_ENUM_CLASS(Angle)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(Flip, uint8_t)
|
||||
enum class Flip : uint8_t {
|
||||
Unflipped,
|
||||
Horizontal
|
||||
MOZ_END_ENUM_CLASS(Flip)
|
||||
};
|
||||
|
||||
/**
|
||||
* A struct that describes an image's orientation as a rotation optionally
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "mozilla/WeakPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#ifdef DEBUG
|
||||
@ -133,11 +132,11 @@ class Decoder;
|
||||
class FrameAnimator;
|
||||
class SourceBuffer;
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(DecodeStrategy, uint8_t)
|
||||
enum class DecodeStrategy : uint8_t {
|
||||
ASYNC,
|
||||
SYNC_FOR_SMALL_IMAGES,
|
||||
SYNC_IF_POSSIBLE
|
||||
MOZ_END_ENUM_CLASS(DecodeStrategy)
|
||||
};
|
||||
|
||||
class RasterImage MOZ_FINAL : public ImageResource
|
||||
, public nsIProperties
|
||||
|
@ -117,16 +117,16 @@ VectorSurfaceKey(const gfx::IntSize& aSize,
|
||||
return SurfaceKey(aSize, aSVGContext, aAnimationTime, 0);
|
||||
}
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(Lifetime, uint8_t)
|
||||
enum class Lifetime : uint8_t {
|
||||
Transient,
|
||||
Persistent
|
||||
MOZ_END_ENUM_CLASS(Lifetime)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(InsertOutcome, uint8_t)
|
||||
enum class InsertOutcome : uint8_t {
|
||||
SUCCESS, // Success (but see Insert documentation).
|
||||
FAILURE, // Couldn't insert (e.g., for capacity reasons).
|
||||
FAILURE_ALREADY_PRESENT // A surface with the same key is already present.
|
||||
MOZ_END_ENUM_CLASS(InsertOutcome)
|
||||
};
|
||||
|
||||
/**
|
||||
* SurfaceCache is an imagelib-global service that allows caching of temporary
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/Move.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "mozilla/VolatileBuffer.h"
|
||||
#include "gfxDrawable.h"
|
||||
#include "imgIContainer.h"
|
||||
@ -23,7 +22,7 @@ class ImageRegion;
|
||||
class DrawableFrameRef;
|
||||
class RawAccessFrameRef;
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(BlendMethod, int8_t)
|
||||
enum class BlendMethod : int8_t {
|
||||
// All color components of the frame, including alpha, overwrite the current
|
||||
// contents of the frame's output buffer region.
|
||||
SOURCE,
|
||||
@ -31,20 +30,20 @@ MOZ_BEGIN_ENUM_CLASS(BlendMethod, int8_t)
|
||||
// The frame should be composited onto the output buffer based on its alpha,
|
||||
// using a simple OVER operation.
|
||||
OVER
|
||||
MOZ_END_ENUM_CLASS(BlendMethod)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(DisposalMethod, int8_t)
|
||||
enum class DisposalMethod : int8_t {
|
||||
CLEAR_ALL = -1, // Clear the whole image, revealing what's underneath.
|
||||
NOT_SPECIFIED, // Leave the frame and let the new frame draw on top.
|
||||
KEEP, // Leave the frame and let the new frame draw on top.
|
||||
CLEAR, // Clear the frame's area, revealing what's underneath.
|
||||
RESTORE_PREVIOUS // Restore the previous (composited) frame.
|
||||
MOZ_END_ENUM_CLASS(DisposalMethod)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(Opacity, uint8_t)
|
||||
enum class Opacity : uint8_t {
|
||||
OPAQUE,
|
||||
SOME_TRANSPARENCY
|
||||
MOZ_END_ENUM_CLASS(Opacity)
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
|
@ -206,10 +206,10 @@ private:
|
||||
uint32_t mSize;
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(AcceptedMimeTypes, uint8_t)
|
||||
enum class AcceptedMimeTypes : uint8_t {
|
||||
IMAGES,
|
||||
IMAGES_AND_DOCUMENTS,
|
||||
MOZ_END_ENUM_CLASS(AcceptedMimeTypes)
|
||||
};
|
||||
|
||||
class imgLoader MOZ_FINAL : public imgILoader,
|
||||
public nsIContentSniffer,
|
||||
|
@ -16,7 +16,6 @@
|
||||
#ifdef XP_WIN
|
||||
#include "mozilla/TimeStamp_windows.h"
|
||||
#endif
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
#include "mozilla/IntegerTypeTraits.h"
|
||||
|
||||
@ -129,18 +128,7 @@ struct EnumSerializer {
|
||||
template <typename E,
|
||||
E MinLegal,
|
||||
E HighBound>
|
||||
struct ContiguousEnumValidator
|
||||
{
|
||||
static bool IsLegalValue(E e)
|
||||
{
|
||||
return MinLegal <= e && e < HighBound;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename E,
|
||||
MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(E) MinLegal,
|
||||
MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(E) HighBound>
|
||||
class ContiguousTypedEnumValidator
|
||||
class ContiguousEnumValidator
|
||||
{
|
||||
// Silence overzealous -Wtype-limits bug in GCC fixed in GCC 4.8:
|
||||
// "comparison of unsigned expression >= 0 is always true"
|
||||
@ -151,9 +139,7 @@ class ContiguousTypedEnumValidator
|
||||
public:
|
||||
static bool IsLegalValue(E e)
|
||||
{
|
||||
typedef MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(E) ActualEnumType;
|
||||
return IsLessThanOrEqual(MinLegal, ActualEnumType(e)) &&
|
||||
ActualEnumType(e) < HighBound;
|
||||
return IsLessThanOrEqual(MinLegal, e) && e < HighBound;
|
||||
}
|
||||
};
|
||||
|
||||
@ -167,16 +153,6 @@ struct BitFlagsEnumValidator
|
||||
}
|
||||
};
|
||||
|
||||
template <typename E,
|
||||
MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(E) AllBits>
|
||||
struct BitFlagsTypedEnumValidator
|
||||
{
|
||||
static bool IsLegalValue(E e)
|
||||
{
|
||||
return (e & AllBits) == e;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Specialization of EnumSerializer for enums with contiguous enum values.
|
||||
*
|
||||
@ -201,19 +177,6 @@ struct ContiguousEnumSerializer
|
||||
ContiguousEnumValidator<E, MinLegal, HighBound>>
|
||||
{};
|
||||
|
||||
/**
|
||||
* Similar to ContiguousEnumSerializer, but for MFBT typed enums
|
||||
* as constructed by MOZ_BEGIN_ENUM_CLASS. This can go away when
|
||||
* we drop MOZ_BEGIN_ENUM_CLASS and use C++11 enum classes directly.
|
||||
*/
|
||||
template <typename E,
|
||||
MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(E) MinLegal,
|
||||
MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(E) HighBound>
|
||||
struct ContiguousTypedEnumSerializer
|
||||
: EnumSerializer<E,
|
||||
ContiguousTypedEnumValidator<E, MinLegal, HighBound>>
|
||||
{};
|
||||
|
||||
/**
|
||||
* Specialization of EnumSerializer for enums representing bit flags.
|
||||
*
|
||||
@ -241,18 +204,6 @@ struct BitFlagsEnumSerializer
|
||||
BitFlagsEnumValidator<E, AllBits>>
|
||||
{};
|
||||
|
||||
/**
|
||||
* Similar to BitFlagsEnumSerializer, but for MFBT typed enums
|
||||
* as constructed by MOZ_BEGIN_ENUM_CLASS. This can go away when
|
||||
* we drop MOZ_BEGIN_ENUM_CLASS and use C++11 enum classes directly.
|
||||
*/
|
||||
template <typename E,
|
||||
MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(E) AllBits>
|
||||
struct BitFlagsTypedEnumSerializer
|
||||
: EnumSerializer<E,
|
||||
BitFlagsTypedEnumValidator<E, AllBits>>
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<base::ChildPrivileges>
|
||||
: public ContiguousEnumSerializer<base::ChildPrivileges,
|
||||
|
@ -584,7 +584,11 @@ Valueify(const JSClass *c)
|
||||
enum ESClassValue {
|
||||
ESClass_Object, ESClass_Array, ESClass_Number, ESClass_String,
|
||||
ESClass_Boolean, ESClass_RegExp, ESClass_ArrayBuffer, ESClass_SharedArrayBuffer,
|
||||
ESClass_Date, ESClass_Set, ESClass_Map
|
||||
ESClass_Date, ESClass_Set, ESClass_Map,
|
||||
|
||||
// Special snowflake for the ES6 IsArray method.
|
||||
// Please don't use it without calling that function.
|
||||
ESClass_IsArray
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -7,8 +7,6 @@
|
||||
#ifndef js_ProfilingStack_h
|
||||
#define js_ProfilingStack_h
|
||||
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
#include "jsbytecode.h"
|
||||
#include "jstypes.h"
|
||||
|
||||
@ -73,7 +71,7 @@ class ProfileEntry
|
||||
};
|
||||
|
||||
// Keep these in sync with browser/devtools/profiler/utils/global.js
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS(Category, uint32_t)
|
||||
enum class Category : uint32_t {
|
||||
OTHER = 0x10,
|
||||
CSS = 0x20,
|
||||
JS = 0x40,
|
||||
@ -86,7 +84,7 @@ class ProfileEntry
|
||||
|
||||
FIRST = OTHER,
|
||||
LAST = EVENTS
|
||||
MOZ_END_NESTED_ENUM_CLASS(Category)
|
||||
};
|
||||
|
||||
// All of these methods are marked with the 'volatile' keyword because SPS's
|
||||
// representation of the stack is stored such that all ProfileEntry
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "frontend/FoldConstants.h"
|
||||
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
#include "jslibmath.h"
|
||||
|
||||
@ -252,7 +251,7 @@ Boolish(ParseNode *pn)
|
||||
|
||||
// Expressions that appear in a few specific places are treated specially
|
||||
// during constant folding. This enum tells where a parse node appears.
|
||||
MOZ_BEGIN_ENUM_CLASS(SyntacticContext, int)
|
||||
enum class SyntacticContext : int {
|
||||
// pn is an expression, and it appears in a context where only its side
|
||||
// effects and truthiness matter: the condition of an if statement,
|
||||
// conditional expression, while loop, or for(;;) loop; or an operand of &&
|
||||
@ -264,7 +263,7 @@ MOZ_BEGIN_ENUM_CLASS(SyntacticContext, int)
|
||||
|
||||
// Any other syntactic context.
|
||||
Other
|
||||
MOZ_END_ENUM_CLASS(SyntacticContext)
|
||||
};
|
||||
|
||||
static SyntacticContext
|
||||
condIf(const ParseNode *pn, ParseNodeKind kind)
|
||||
|
@ -312,6 +312,31 @@ BacktrackingAllocator::tryGroupReusedRegister(uint32_t def, uint32_t use)
|
||||
bool
|
||||
BacktrackingAllocator::groupAndQueueRegisters()
|
||||
{
|
||||
// If there is an OSR block, group parameters in that block with the
|
||||
// corresponding parameters in the initial block.
|
||||
if (MBasicBlock *osr = graph.mir().osrBlock()) {
|
||||
size_t originalVreg = 1;
|
||||
for (LInstructionIterator iter = osr->lir()->begin(); iter != osr->lir()->end(); iter++) {
|
||||
if (iter->isParameter()) {
|
||||
for (size_t i = 0; i < iter->numDefs(); i++) {
|
||||
DebugOnly<bool> found = false;
|
||||
uint32_t paramVreg = iter->getDef(i)->virtualRegister();
|
||||
for (; originalVreg < paramVreg; originalVreg++) {
|
||||
if (*vregs[originalVreg].def()->output() == *iter->getDef(i)->output()) {
|
||||
MOZ_ASSERT(vregs[originalVreg].ins()->isParameter());
|
||||
if (!tryGroupRegisters(originalVreg, paramVreg))
|
||||
return false;
|
||||
MOZ_ASSERT(vregs[originalVreg].group() == vregs[paramVreg].group());
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT(found);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Try to group registers with their reused inputs.
|
||||
// Virtual register number 0 is unused.
|
||||
MOZ_ASSERT(vregs[0u].numIntervals() == 0);
|
||||
@ -354,8 +379,6 @@ BacktrackingAllocator::groupAndQueueRegisters()
|
||||
if (!reg.numIntervals())
|
||||
continue;
|
||||
|
||||
// Disable this for now; see bugs 906858, 931487, and 932465.
|
||||
#if 0
|
||||
// Eagerly set the canonical spill slot for registers which are fixed
|
||||
// for that slot, and reuse it for other registers in the group.
|
||||
LDefinition *def = reg.def();
|
||||
@ -364,7 +387,6 @@ BacktrackingAllocator::groupAndQueueRegisters()
|
||||
if (reg.group() && reg.group()->spill.isUse())
|
||||
reg.group()->spill = *def->output();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Place all intervals for this register on the allocation queue.
|
||||
// During initial queueing use single queue items for groups of
|
||||
|
@ -8,7 +8,6 @@
|
||||
#define jit_IonTypes_h
|
||||
|
||||
#include "mozilla/HashFunctions.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
#include "jstypes.h"
|
||||
|
||||
@ -632,7 +631,7 @@ enum ABIFunctionType
|
||||
(ArgType_General << (ArgType_Shift * 2))
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(BarrierKind, uint32_t)
|
||||
enum class BarrierKind : uint32_t {
|
||||
// No barrier is needed.
|
||||
NoBarrier,
|
||||
|
||||
@ -643,7 +642,7 @@ MOZ_BEGIN_ENUM_CLASS(BarrierKind, uint32_t)
|
||||
// Check if the value is in the TypeSet, including the object type if it's
|
||||
// an object.
|
||||
TypeSet
|
||||
MOZ_END_ENUM_CLASS(BarrierKind)
|
||||
};
|
||||
|
||||
} // namespace jit
|
||||
} // namespace js
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Range.h"
|
||||
#include "mozilla/RangedPtr.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
@ -4480,11 +4479,11 @@ JS_PUBLIC_API(JSString *)
|
||||
GetSymbolDescription(HandleSymbol symbol);
|
||||
|
||||
/* Well-known symbols. */
|
||||
MOZ_BEGIN_ENUM_CLASS(SymbolCode, uint32_t)
|
||||
enum class SymbolCode : uint32_t {
|
||||
iterator, // well-known Symbol.iterator
|
||||
InSymbolRegistry = 0xfffffffe, // created by Symbol.for() or JS::GetSymbolFor()
|
||||
UniqueSymbol = 0xffffffff // created by Symbol() or JS::NewSymbol()
|
||||
MOZ_END_ENUM_CLASS(SymbolCode)
|
||||
};
|
||||
|
||||
/* For use in loops that iterate over the well-known symbols. */
|
||||
const size_t WellKnownSymbolLimit = 1;
|
||||
|
@ -2676,7 +2676,8 @@ js::array_concat(JSContext *cx, unsigned argc, Value *vp)
|
||||
HandleValue v = HandleValue::fromMarkedLocation(&p[i]);
|
||||
if (v.isObject()) {
|
||||
RootedObject obj(cx, &v.toObject());
|
||||
if (ObjectClassIs(obj, ESClass_Array, cx)) {
|
||||
// This should be IsConcatSpreadable
|
||||
if (IsArray(obj, cx)) {
|
||||
uint32_t alength;
|
||||
if (!GetLengthProperty(cx, obj, &alength))
|
||||
return false;
|
||||
@ -3039,7 +3040,11 @@ static bool
|
||||
array_isArray(JSContext *cx, unsigned argc, Value *vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
bool isArray = args.length() > 0 && IsObjectWithClass(args[0], ESClass_Array, cx);
|
||||
bool isArray = false;
|
||||
if (args.get(0).isObject()) {
|
||||
RootedObject obj(cx, &args[0].toObject());
|
||||
isArray = IsArray(obj, cx);
|
||||
}
|
||||
args.rval().setBoolean(isArray);
|
||||
return true;
|
||||
}
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "mozilla/Casting.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
#include "jsapi.h" // For JSAutoByteString. See bug 1033916.
|
||||
|
@ -10,7 +10,6 @@
|
||||
#define jsinfer_h
|
||||
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
#include "jsalloc.h"
|
||||
#include "jsfriendapi.h"
|
||||
|
@ -719,7 +719,10 @@ ObjectClassIs(HandleObject obj, ESClassValue classValue, JSContext *cx)
|
||||
|
||||
switch (classValue) {
|
||||
case ESClass_Object: return obj->is<PlainObject>();
|
||||
case ESClass_Array: return obj->is<ArrayObject>();
|
||||
case ESClass_Array:
|
||||
case ESClass_IsArray:
|
||||
// There difference between those is only relevant for proxies.
|
||||
return obj->is<ArrayObject>();
|
||||
case ESClass_Number: return obj->is<NumberObject>();
|
||||
case ESClass_String: return obj->is<StringObject>();
|
||||
case ESClass_Boolean: return obj->is<BooleanObject>();
|
||||
@ -742,6 +745,16 @@ IsObjectWithClass(const Value &v, ESClassValue classValue, JSContext *cx)
|
||||
return ObjectClassIs(obj, classValue, cx);
|
||||
}
|
||||
|
||||
// ES6 7.2.2
|
||||
inline bool
|
||||
IsArray(HandleObject obj, JSContext *cx)
|
||||
{
|
||||
if (obj->is<ArrayObject>())
|
||||
return true;
|
||||
|
||||
return ObjectClassIs(obj, ESClass_IsArray, cx);
|
||||
}
|
||||
|
||||
inline bool
|
||||
Unbox(JSContext *cx, HandleObject obj, MutableHandleValue vp)
|
||||
{
|
||||
|
@ -322,7 +322,7 @@ JO(JSContext *cx, HandleObject obj, StringifyContext *scx)
|
||||
Maybe<AutoIdVector> ids;
|
||||
const AutoIdVector *props;
|
||||
if (scx->replacer && !scx->replacer->isCallable()) {
|
||||
MOZ_ASSERT(JS_IsArrayObject(cx, scx->replacer));
|
||||
MOZ_ASSERT(IsArray(scx->replacer, cx));
|
||||
props = &scx->propertyList;
|
||||
} else {
|
||||
MOZ_ASSERT_IF(scx->replacer, scx->propertyList.length() == 0);
|
||||
@ -507,7 +507,7 @@ Str(JSContext *cx, const Value &v, StringifyContext *scx)
|
||||
|
||||
scx->depth++;
|
||||
bool ok;
|
||||
if (ObjectClassIs(obj, ESClass_Array, cx))
|
||||
if (IsArray(obj, cx))
|
||||
ok = JA(cx, obj, scx);
|
||||
else
|
||||
ok = JO(cx, obj, scx);
|
||||
@ -529,7 +529,7 @@ js_Stringify(JSContext *cx, MutableHandleValue vp, JSObject *replacer_, Value sp
|
||||
if (replacer) {
|
||||
if (replacer->isCallable()) {
|
||||
/* Step 4a(i): use replacer to transform values. */
|
||||
} else if (ObjectClassIs(replacer, ESClass_Array, cx)) {
|
||||
} else if (IsArray(replacer, cx)) {
|
||||
/*
|
||||
* Step 4b: The spec algorithm is unhelpfully vague about the exact
|
||||
* steps taken when the replacer is an array, regarding the exact
|
||||
@ -560,7 +560,8 @@ js_Stringify(JSContext *cx, MutableHandleValue vp, JSObject *replacer_, Value sp
|
||||
|
||||
/* Step 4b(ii). */
|
||||
uint32_t len;
|
||||
JS_ALWAYS_TRUE(GetLengthProperty(cx, replacer, &len));
|
||||
if (!GetLengthProperty(cx, replacer, &len))
|
||||
return false;
|
||||
if (replacer->is<ArrayObject>() && !replacer->isIndexed())
|
||||
len = Min(len, replacer->as<ArrayObject>().getDenseInitializedLength());
|
||||
|
||||
@ -693,7 +694,7 @@ Walk(JSContext *cx, HandleObject holder, HandleId name, HandleValue reviver, Mut
|
||||
if (val.isObject()) {
|
||||
RootedObject obj(cx, &val.toObject());
|
||||
|
||||
if (ObjectClassIs(obj, ESClass_Array, cx)) {
|
||||
if (IsArray(obj, cx)) {
|
||||
/* Step 2a(ii). */
|
||||
uint32_t length;
|
||||
if (!GetLengthProperty(cx, obj, &length))
|
||||
|
@ -1094,6 +1094,50 @@ ScriptedDirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const C
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ScriptedDirectProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl,
|
||||
CallArgs args) const
|
||||
{
|
||||
ReportIncompatible(cx, args);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ScriptedDirectProxyHandler::objectClassIs(HandleObject proxy, ESClassValue classValue,
|
||||
JSContext *cx) const
|
||||
{
|
||||
// Special case IsArray. In every other instance ES wants to have exactly
|
||||
// one object type and not a proxy around it, so return false.
|
||||
if (classValue != ESClass_IsArray)
|
||||
return false;
|
||||
|
||||
// In ES6 IsArray is supposed to poke at the Proxy target, instead we do this here.
|
||||
// The reason for this is that we have proxies for which looking at the target might
|
||||
// be impossible. So instead we use our little objectClassIs function that just works
|
||||
// already across different wrappers.
|
||||
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
return IsArray(target, cx);
|
||||
}
|
||||
|
||||
bool
|
||||
ScriptedDirectProxyHandler::regexp_toShared(JSContext *cx, HandleObject proxy,
|
||||
RegExpGuard *g) const
|
||||
{
|
||||
MOZ_CRASH("Should not end up in ScriptedDirectProxyHandler::regexp_toShared");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ScriptedDirectProxyHandler::boxedValue_unbox(JSContext *cx, HandleObject proxy,
|
||||
MutableHandleValue vp) const
|
||||
{
|
||||
MOZ_CRASH("Should not end up in ScriptedDirectProxyHandler::boxedValue_unbox");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ScriptedDirectProxyHandler::isCallable(JSObject *obj) const
|
||||
{
|
||||
|
@ -64,6 +64,16 @@ class ScriptedDirectProxyHandler : public DirectProxyHandler {
|
||||
return BaseProxyHandler::getOwnEnumerablePropertyKeys(cx, proxy, props);
|
||||
}
|
||||
|
||||
// A scripted proxy should not be treated as generic in most contexts.
|
||||
virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl,
|
||||
CallArgs args) const MOZ_OVERRIDE;
|
||||
virtual bool objectClassIs(HandleObject obj, ESClassValue classValue,
|
||||
JSContext *cx) const MOZ_OVERRIDE;
|
||||
virtual bool regexp_toShared(JSContext *cx, HandleObject proxy,
|
||||
RegExpGuard *g) const MOZ_OVERRIDE;
|
||||
virtual bool boxedValue_unbox(JSContext *cx, HandleObject proxy,
|
||||
MutableHandleValue vp) const MOZ_OVERRIDE;
|
||||
|
||||
virtual bool isCallable(JSObject *obj) const MOZ_OVERRIDE;
|
||||
virtual bool isConstructor(JSObject *obj) const MOZ_OVERRIDE;
|
||||
|
||||
|
@ -35,14 +35,13 @@ for (var constructor of constructors) {
|
||||
}
|
||||
|
||||
// Throws if `this` isn't a TypedArray.
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./];
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
|
||||
new Proxy(new constructor(), {})];
|
||||
invalidReceivers.forEach(invalidReceiver => {
|
||||
assertThrowsInstanceOf(() => {
|
||||
constructor.prototype.entries.call(invalidReceiver);
|
||||
}, TypeError, "Assert that entries fails if this value is not a TypedArray");
|
||||
});
|
||||
// FIXME: Should throw exception if `this` is a proxy, see bug 1115361.
|
||||
constructor.prototype.entries.call(new Proxy(new constructor(), {}));
|
||||
}
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
|
@ -111,14 +111,13 @@ for (var constructor of constructors) {
|
||||
}
|
||||
|
||||
// Throws if `this` isn't a TypedArray.
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./];
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
|
||||
new Proxy(new constructor(), {})];
|
||||
invalidReceivers.forEach(invalidReceiver => {
|
||||
assertThrowsInstanceOf(() => {
|
||||
constructor.prototype.every.call(invalidReceiver, () => true);
|
||||
}, TypeError, "Assert that every fails if this value is not a TypedArray");
|
||||
});
|
||||
// FIXME: Should throw exception if `this` is a proxy, see bug 1115361.
|
||||
constructor.prototype.every.call(new Proxy(new constructor(), {}), () => true);
|
||||
|
||||
// Test that the length getter is never called.
|
||||
assertEq(Object.defineProperty(new constructor([1, 2, 3]), "length", {
|
||||
@ -237,14 +236,13 @@ for (var constructor of constructors) {
|
||||
}
|
||||
|
||||
// Throws if `this` isn't a TypedArray.
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./];
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
|
||||
new Proxy(new constructor(), {})];
|
||||
invalidReceivers.forEach(invalidReceiver => {
|
||||
assertThrowsInstanceOf(() => {
|
||||
constructor.prototype.some.call(invalidReceiver, () => true);
|
||||
}, TypeError, "Assert that some fails if this value is not a TypedArray");
|
||||
});
|
||||
// FIXME: Should throw exception if `this` is a proxy, see bug 1115361.
|
||||
constructor.prototype.some.call(new Proxy(new constructor(), {}), () => false);
|
||||
|
||||
// Test that the length getter is never called.
|
||||
assertEq(Object.defineProperty(new constructor([1, 2, 3]), "length", {
|
||||
@ -258,4 +256,4 @@ assertEq(new Float32Array([undefined, , NaN]).some(v => v === v), false);
|
||||
assertEq(new Float64Array([undefined, , NaN]).some(v => v === v), false);
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
||||
reportCompare(true, true);
|
||||
|
@ -53,14 +53,13 @@ for (var constructor of constructors) {
|
||||
}
|
||||
|
||||
// Throws if `this` isn't a TypedArray.
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./]
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
|
||||
new Proxy(new constructor(), {})];
|
||||
invalidReceivers.forEach(invalidReceiver => {
|
||||
assertThrowsInstanceOf(() => {
|
||||
constructor.prototype.fill.call(invalidReceiver, 1);
|
||||
}, TypeError);
|
||||
});
|
||||
// FIXME: Should throw exception if `this` is a proxy, see bug 1115361.
|
||||
constructor.prototype.fill.call(new Proxy(new constructor(), {}));
|
||||
|
||||
// Test that the length getter is never called.
|
||||
Object.defineProperty(new constructor([1, 2, 3]), "length", {
|
||||
|
@ -35,14 +35,13 @@ for (var constructor of constructors) {
|
||||
}
|
||||
|
||||
// Throws if `this` isn't a TypedArray.
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./];
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
|
||||
new Proxy(new constructor(), {})];
|
||||
invalidReceivers.forEach(invalidReceiver => {
|
||||
assertThrowsInstanceOf(() => {
|
||||
constructor.prototype.includes.call(invalidReceiver);
|
||||
}, TypeError, "Assert that reverse fails if this value is not a TypedArray");
|
||||
});
|
||||
// FIXME: Should throw exception if `this` is a proxy, see bug 1115361.
|
||||
constructor.prototype.includes.call(new Proxy(new constructor(), {}));
|
||||
|
||||
// Test that the length getter is never called.
|
||||
assertEq(Object.defineProperty(new constructor([1, 2, 3]), "length", {
|
||||
|
@ -41,14 +41,13 @@ for (var constructor of constructors) {
|
||||
assertEq(new constructor([1, 2, 1, 2, 1]).indexOf(1, -2), 4);
|
||||
|
||||
// Throws if `this` isn't a TypedArray.
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./];
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
|
||||
new Proxy(new constructor(), {})];
|
||||
invalidReceivers.forEach(invalidReceiver => {
|
||||
assertThrowsInstanceOf(() => {
|
||||
constructor.prototype.indexOf.call(invalidReceiver);
|
||||
}, TypeError, "Assert that indexOf fails if this value is not a TypedArray");
|
||||
});
|
||||
// FIXME: Should throw exception if `this` is a proxy, see bug 1115361.
|
||||
constructor.prototype.indexOf.call(new Proxy(new constructor(), {}));
|
||||
|
||||
// test that this.length is never called
|
||||
assertEq(Object.defineProperty(new constructor([0, 1, 2, 3, 5]), "length", {
|
||||
@ -94,14 +93,13 @@ for (var constructor of constructors) {
|
||||
assertEq(new constructor([1, 2, 1, 2, 1]).lastIndexOf(1, -2), 2);
|
||||
|
||||
// Throws if `this` isn't a TypedArray.
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./];
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
|
||||
new Proxy(new constructor(), {})];
|
||||
invalidReceivers.forEach(invalidReceiver => {
|
||||
assertThrowsInstanceOf(() => {
|
||||
constructor.prototype.lastIndexOf.call(invalidReceiver);
|
||||
}, TypeError, "Assert that lastIndexOf fails if this value is not a TypedArray");
|
||||
});
|
||||
// FIXME: Should throw exception if `this` is a proxy, see bug 1115361.
|
||||
constructor.prototype.lastIndexOf.call(new Proxy(new constructor(), {}));
|
||||
|
||||
// Test that the length getter is never called.
|
||||
assertEq(Object.defineProperty(new constructor([0, 1, 2, 3, 5]), "length", {
|
||||
|
@ -36,14 +36,13 @@ for (var constructor of constructors) {
|
||||
}
|
||||
|
||||
// Throws if `this` isn't a TypedArray.
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./];
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
|
||||
new Proxy(new constructor(), {})];
|
||||
invalidReceivers.forEach(invalidReceiver => {
|
||||
assertThrowsInstanceOf(() => {
|
||||
constructor.prototype.join.call(invalidReceiver);
|
||||
}, TypeError, "Assert that join fails if this value is not a TypedArray");
|
||||
});
|
||||
// FIXME: Should throw exception if `this` is a proxy, see bug 1115361.
|
||||
constructor.prototype.join.call(new Proxy(new constructor(), {}));
|
||||
|
||||
// Test that the length getter is never called.
|
||||
assertEq(Object.defineProperty(new constructor([1, 2, 3]), "length", {
|
||||
|
@ -35,14 +35,13 @@ for (var constructor of constructors) {
|
||||
}
|
||||
|
||||
// Throws if `this` isn't a TypedArray.
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./];
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
|
||||
new Proxy(new constructor(), {})];
|
||||
invalidReceivers.forEach(invalidReceiver => {
|
||||
assertThrowsInstanceOf(() => {
|
||||
constructor.prototype.keys.call(invalidReceiver);
|
||||
}, TypeError, "Assert that keys fails if this value is not a TypedArray");
|
||||
});
|
||||
// FIXME: Should throw exception if `this` is a proxy, see bug 1115361.
|
||||
constructor.prototype.keys.call(new Proxy(new constructor(), {}));
|
||||
}
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
|
@ -87,14 +87,13 @@ for (var constructor of constructors) {
|
||||
}
|
||||
|
||||
// Throws if `this` isn't a TypedArray.
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./];
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
|
||||
new Proxy(new constructor(3), {})];
|
||||
invalidReceivers.forEach(invalidReceiver => {
|
||||
assertThrowsInstanceOf(() => {
|
||||
constructor.prototype.reduce.call(invalidReceiver, () => {});
|
||||
}, TypeError, "Assert that reduce fails if this value is not a TypedArray");
|
||||
});
|
||||
// FIXME: Should throw exception if `this` is a proxy, see bug 1115361.
|
||||
constructor.prototype.reduce.call(new Proxy(new constructor(3), {}), () => {});
|
||||
|
||||
// Test that the length getter is never called.
|
||||
assertEq(Object.defineProperty(arr, "length", {
|
||||
@ -181,14 +180,13 @@ for (var constructor of constructors) {
|
||||
}
|
||||
|
||||
// Throws if `this` isn't a TypedArray.
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./];
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
|
||||
new Proxy(new constructor(3), {})];
|
||||
invalidReceivers.forEach(invalidReceiver => {
|
||||
assertThrowsInstanceOf(() => {
|
||||
constructor.prototype.reduceRight.call(invalidReceiver, () => {});
|
||||
}, TypeError, "Assert that reduceRight fails if this value is not a TypedArray");
|
||||
});
|
||||
// FIXME: Should throw exception if `this` is a proxy, see bug 1115361.
|
||||
constructor.prototype.reduceRight.call(new Proxy(new constructor(3), {}), () => {});
|
||||
|
||||
// Test that the length getter is never called.
|
||||
assertEq(Object.defineProperty(arr, "length", {
|
||||
@ -199,4 +197,4 @@ for (var constructor of constructors) {
|
||||
}
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
reportCompare(true, true);
|
||||
reportCompare(true, true);
|
||||
|
@ -30,14 +30,13 @@ for (var constructor of constructors) {
|
||||
}
|
||||
|
||||
// Throws if `this` isn't a TypedArray.
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./];
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
|
||||
new Proxy(new constructor(), {})];
|
||||
invalidReceivers.forEach(invalidReceiver => {
|
||||
assertThrowsInstanceOf(() => {
|
||||
constructor.prototype.reverse.call(invalidReceiver);
|
||||
}, TypeError, "Assert that reverse fails if this value is not a TypedArray");
|
||||
});
|
||||
// FIXME: Should throw exception if `this` is a proxy, see bug 1115361.
|
||||
constructor.prototype.reverse.call(new Proxy(new constructor(), {}));
|
||||
|
||||
// Test that the length getter is never called.
|
||||
Object.defineProperty(new constructor([1, 2, 3]), "length", {
|
||||
|
@ -36,14 +36,13 @@ for (var constructor of constructors) {
|
||||
}
|
||||
|
||||
// Throws if `this` isn't a TypedArray.
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./];
|
||||
var invalidReceivers = [undefined, null, 1, false, "", Symbol(), [], {}, /./,
|
||||
new Proxy(new constructor(), {})];
|
||||
invalidReceivers.forEach(invalidReceiver => {
|
||||
assertThrowsInstanceOf(() => {
|
||||
constructor.prototype.values.call(invalidReceiver);
|
||||
}, TypeError, "Assert that values fails if this value is not a TypedArray");
|
||||
});
|
||||
// FIXME: Should throw exception if `this` is a proxy, see bug 1115361.
|
||||
constructor.prototype.values.call(new Proxy(new constructor(), {}));
|
||||
}
|
||||
|
||||
if (typeof reportCompare === "function")
|
||||
|
@ -489,6 +489,7 @@ RegExpToShared(JSContext *cx, HandleObject obj, RegExpGuard *g)
|
||||
{
|
||||
if (obj->is<RegExpObject>())
|
||||
return obj->as<RegExpObject>().getShared(cx, g);
|
||||
MOZ_ASSERT(Proxy::objectClassIs(obj, ESClass_RegExp, cx));
|
||||
return Proxy::regexp_toShared(cx, obj, g);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
||||
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -2491,6 +2491,7 @@ PaintedLayerData::Accumulate(ContainerState* aState,
|
||||
|
||||
mVisibleRegion.Or(mVisibleRegion, aVisibleRect);
|
||||
mVisibleRegion.SimplifyOutward(4);
|
||||
mDrawRegion.Or(mDrawRegion, mVisibleRegion);
|
||||
mDrawRegion.Or(mDrawRegion, aDrawRect);
|
||||
mDrawRegion.SimplifyOutward(4);
|
||||
}
|
||||
|
@ -771,8 +771,10 @@ SelectionCarets::DragSelection(const nsPoint &movePoint)
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
// Limit the drag behavior not to cross the end of last selection range
|
||||
// when drag the start frame and vice versa
|
||||
nsRefPtr<nsRange> range = mDragMode == START_FRAME ?
|
||||
selection->GetRangeAt(0) : selection->GetRangeAt(rangeCount - 1);
|
||||
selection->GetRangeAt(rangeCount - 1) : selection->GetRangeAt(0);
|
||||
if (!CompareRangeWithContentOffset(range, fs, offsets, mDragMode)) {
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ namespace mozilla {
|
||||
// Feel free to add more justifications to PixelCastJustification, along with
|
||||
// a comment that explains under what circumstances it is appropriate to use.
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(PixelCastJustification, uint8_t)
|
||||
enum class PixelCastJustification : uint8_t {
|
||||
// For the root layer, Screen Pixel = Parent Layer Pixel.
|
||||
ScreenIsParentLayerForRoot,
|
||||
// For the root composition size we want to view it as layer pixels in any layer
|
||||
@ -31,7 +31,7 @@ MOZ_BEGIN_ENUM_CLASS(PixelCastJustification, uint8_t)
|
||||
// systems is not available (for example, because the object that stores it
|
||||
// is being destroyed), so fall back to the identity.
|
||||
TransformNotAvailable
|
||||
MOZ_END_ENUM_CLASS(PixelCastJustification)
|
||||
};
|
||||
|
||||
template <class TargetUnits, class SourceUnits>
|
||||
gfx::SizeTyped<TargetUnits> ViewAs(const gfx::SizeTyped<SourceUnits>& aSize, PixelCastJustification) {
|
||||
|
@ -163,10 +163,10 @@ public:
|
||||
*/
|
||||
static bool GetDisplayPort(nsIContent* aContent, nsRect *aResult = nullptr);
|
||||
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS(RepaintMode, uint8_t)
|
||||
enum class RepaintMode : uint8_t {
|
||||
Repaint,
|
||||
DoNotRepaint
|
||||
MOZ_END_NESTED_ENUM_CLASS(RepaintMode)
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the display port margins for a content element to be used with a
|
||||
@ -2577,8 +2577,6 @@ private:
|
||||
static bool IsAPZTestLoggingEnabled();
|
||||
};
|
||||
|
||||
MOZ_FINISH_NESTED_ENUM_CLASS(nsLayoutUtils::RepaintMode)
|
||||
|
||||
template<typename PointType, typename RectType, typename CoordType>
|
||||
/* static */ bool
|
||||
nsLayoutUtils::PointIsCloserToRect(PointType aPoint, const RectType& aRect,
|
||||
|
@ -17,6 +17,7 @@ class SelectionCaretsTest(MarionetteTestCase):
|
||||
_textarea_rtl_selector = (By.ID, 'textarea_rtl')
|
||||
_contenteditable_selector = (By.ID, 'contenteditable')
|
||||
_content_selector = (By.ID, 'content')
|
||||
_contenteditable2_selector = (By.ID, 'contenteditable2')
|
||||
|
||||
def setUp(self):
|
||||
# Code to execute before a tests are run.
|
||||
@ -38,6 +39,7 @@ class SelectionCaretsTest(MarionetteTestCase):
|
||||
self._textarea_rtl = self.marionette.find_element(*self._textarea_rtl_selector)
|
||||
self._contenteditable = self.marionette.find_element(*self._contenteditable_selector)
|
||||
self._content = self.marionette.find_element(*self._content_selector)
|
||||
self._contenteditable2 = self.marionette.find_element(*self._contenteditable2_selector)
|
||||
|
||||
def _first_word_location(self, el):
|
||||
'''Get the location (x, y) of the first word in el.
|
||||
@ -115,6 +117,12 @@ class SelectionCaretsTest(MarionetteTestCase):
|
||||
words = original_content.split()
|
||||
self.assertTrue(len(words) >= 1, 'Expect at least one word in the content.')
|
||||
|
||||
# Get the location of the selection carets at the end of the content for
|
||||
# later use.
|
||||
sel.select_all()
|
||||
(_, _), (end_caret_x, end_caret_y) = sel.selection_carets_location()
|
||||
el.tap()
|
||||
|
||||
# Goal: Select the first character.
|
||||
target_content = original_content[0]
|
||||
|
||||
@ -126,6 +134,10 @@ class SelectionCaretsTest(MarionetteTestCase):
|
||||
x, y = self._first_word_location(el)
|
||||
self._long_press_to_select(el, x, y)
|
||||
|
||||
# Move the right caret to the end of the content.
|
||||
(caret1_x, caret1_y), (caret2_x, caret2_y) = sel.selection_carets_location()
|
||||
self.actions.flick(el, caret2_x, caret2_y, end_caret_x, end_caret_y).perform()
|
||||
|
||||
# Move the right caret to the position of the left caret.
|
||||
(caret1_x, caret1_y), (caret2_x, caret2_y) = sel.selection_carets_location()
|
||||
self.actions.flick(el, caret2_x, caret2_y, caret1_x, caret1_y,).perform()
|
||||
@ -309,3 +321,11 @@ class SelectionCaretsTest(MarionetteTestCase):
|
||||
self.openTestHtml(enabled=True)
|
||||
self._test_focus_obtained_by_long_press(self._contenteditable, self._content)
|
||||
|
||||
########################################################################
|
||||
# <div> contenteditable2 test cases with selection carets enabled
|
||||
########################################################################
|
||||
def test_contenteditable_minimum_select_one_character(self):
|
||||
self.openTestHtml(enabled=True)
|
||||
self._test_minimum_select_one_character(self._contenteditable2, self.assertEqual)
|
||||
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "nsFrameList.h"
|
||||
#include "mozilla/layout/FrameChildList.h"
|
||||
#include "FramePropertyTable.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "nsDirection.h"
|
||||
#include "WritingModes.h"
|
||||
#include <algorithm>
|
||||
@ -316,10 +315,10 @@ void NS_MergeReflowStatusInto(nsReflowStatus* aPrimary,
|
||||
/**
|
||||
* DidReflow status values.
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(nsDidReflowStatus, uint32_t)
|
||||
enum class nsDidReflowStatus : uint32_t {
|
||||
NOT_FINISHED,
|
||||
FINISHED
|
||||
MOZ_END_ENUM_CLASS(nsDidReflowStatus)
|
||||
};
|
||||
|
||||
/**
|
||||
* When there is no scrollable overflow rect, the visual overflow rect
|
||||
|
202
layout/reftests/bugs/1120431-1-ref.html
Normal file
202
layout/reftests/bugs/1120431-1-ref.html
Normal file
@ -0,0 +1,202 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style>
|
||||
.container-ext {
|
||||
padding-left: 180px;
|
||||
padding-right: 180px;
|
||||
}
|
||||
|
||||
.headline {
|
||||
line-height: 30px;
|
||||
text-shadow: 1px 1px rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.headline-left {
|
||||
left: 30px;
|
||||
}
|
||||
|
||||
.headline-right {
|
||||
top: 20px !important;
|
||||
/*bottom:370px !important;*/
|
||||
right: 20px;
|
||||
}
|
||||
|
||||
.headline-active {
|
||||
position: fixed;
|
||||
top: 100px;
|
||||
}
|
||||
|
||||
.list-author:before,
|
||||
.list-author:after {
|
||||
content: "\200e";
|
||||
display: table;
|
||||
}
|
||||
.list-author:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.list-author-vocal {
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.ff { position: fixed; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-ext">
|
||||
|
||||
<div class="headline headline-left headline-active">
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal">
|
||||
A
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
B
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
C
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
D
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
E
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal">
|
||||
F
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
G
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
H
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
I
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
J
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal">
|
||||
K
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
L
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
M
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
N
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
O
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal active">
|
||||
P
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
R
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
S
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
T
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
V
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal">
|
||||
W
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
Y
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
Z
|
||||
</li>
|
||||
</ul>
|
||||
<div class="ff" style="left: 69px; top: 115px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 145px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 161px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 191px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 237px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 253px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 283px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 299px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 135px; top: 299px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 135px; top: 299px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 135px; top: 299px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 135px; top: 299px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 329px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 345px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 68px; top: 352px; width: 41px; height: 19px; background: blue;"></div>
|
||||
<div class="ff" style="left: 68px; top: 382px; width: 41px; height: 19px; background: blue;"></div>
|
||||
<div class="ff" style="left: 68px; top: 412px; width: 41px; height: 19px; background: blue;"></div>
|
||||
<div class="ff" style="left: 68px; top: 442px; width: 41px; height: 19px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 465px; width: 3px; height: 3px; background: blue;"></div>
|
||||
|
||||
<ul class="list-author">
|
||||
<li>
|
||||
Word
|
||||
</li>
|
||||
<li>
|
||||
Word
|
||||
</li>
|
||||
<li>
|
||||
Word
|
||||
</li>
|
||||
<li>
|
||||
Word
|
||||
</li>
|
||||
</ul>
|
||||
</div> <!-- headline headline-left headline-active -->
|
||||
|
||||
<div style="position:relative;">
|
||||
<div style="height: 4000px; background: red;">
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- container-ext -->
|
||||
</body>
|
||||
</html>
|
205
layout/reftests/bugs/1120431-1.html
Normal file
205
layout/reftests/bugs/1120431-1.html
Normal file
@ -0,0 +1,205 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style>
|
||||
.container-ext {
|
||||
padding-left: 180px;
|
||||
padding-right: 180px;
|
||||
}
|
||||
|
||||
.headline {
|
||||
line-height: 30px;
|
||||
text-shadow: 1px 1px rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.headline-left {
|
||||
left: 30px;
|
||||
}
|
||||
|
||||
.headline-right {
|
||||
top: 20px !important;
|
||||
/*bottom:370px !important;*/
|
||||
right: 20px;
|
||||
}
|
||||
|
||||
.headline-active {
|
||||
position: fixed;
|
||||
top: 100px;
|
||||
}
|
||||
|
||||
.list-author:before,
|
||||
.list-author:after {
|
||||
content: "\200e";
|
||||
display: table;
|
||||
}
|
||||
.list-author:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.list-author-vocal {
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.ff { position: fixed; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-ext">
|
||||
|
||||
<div class="headline headline-left headline-active">
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal">
|
||||
A
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
B
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
C
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
D
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
E
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal">
|
||||
F
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
G
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
H
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
I
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
J
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal">
|
||||
K
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
L
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
M
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
N
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
O
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal active">
|
||||
P
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
R
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
S
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
T
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
V
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal">
|
||||
W
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
Y
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
Z
|
||||
</li>
|
||||
</ul>
|
||||
<div class="ff" style="left: 69px; top: 115px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 145px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 161px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 191px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 237px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 253px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 283px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 299px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 135px; top: 299px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 135px; top: 299px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 135px; top: 299px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 135px; top: 299px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 329px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 345px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 68px; top: 352px; width: 41px; height: 19px; background: blue;"></div>
|
||||
<div class="ff" style="left: 68px; top: 382px; width: 41px; height: 19px; background: blue;"></div>
|
||||
<div class="ff" style="left: 68px; top: 412px; width: 41px; height: 19px; background: blue;"></div>
|
||||
<div class="ff" style="left: 68px; top: 442px; width: 41px; height: 19px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 465px; width: 3px; height: 3px; background: blue;"></div>
|
||||
|
||||
<ul class="list-author">
|
||||
<li>
|
||||
Word
|
||||
</li>
|
||||
<li>
|
||||
Word
|
||||
</li>
|
||||
<li>
|
||||
Word
|
||||
</li>
|
||||
<li>
|
||||
Word
|
||||
</li>
|
||||
</ul>
|
||||
</div> <!-- headline headline-left headline-active -->
|
||||
<div class="headline headline-right headline-active">
|
||||
<!--‎f--><div style="width: 2px; height: 2px; background: white;"></div>
|
||||
</div>
|
||||
|
||||
<div style="position:relative;">
|
||||
<div style="height: 4000px; background: red;">
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- container-ext -->
|
||||
</body>
|
||||
</html>
|
204
layout/reftests/bugs/1120431-2-ref.html
Normal file
204
layout/reftests/bugs/1120431-2-ref.html
Normal file
@ -0,0 +1,204 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style>
|
||||
.container-ext {
|
||||
padding-left: 180px;
|
||||
padding-right: 180px;
|
||||
}
|
||||
|
||||
.headline {
|
||||
line-height: 30px;
|
||||
text-shadow: 1px 1px rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.headline-left {
|
||||
left: 30px;
|
||||
}
|
||||
|
||||
.headline-right {
|
||||
top: 20px !important;
|
||||
/*bottom:370px !important;*/
|
||||
right: 20px;
|
||||
}
|
||||
|
||||
.headline-active {
|
||||
position: fixed;
|
||||
top: 100px;
|
||||
}
|
||||
|
||||
.list-author:before,
|
||||
.list-author:after {
|
||||
content: "\200e";
|
||||
display: table;
|
||||
}
|
||||
.list-author:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.list-author-vocal {
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.ff { position: fixed; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-ext">
|
||||
|
||||
<div class="headline headline-left headline-active">
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal">
|
||||
A
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
B
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
C
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
D
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
E
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal">
|
||||
F
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
G
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
H
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
I
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
J
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal">
|
||||
K
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
L
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
M
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
N
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
O
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal active">
|
||||
P
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
R
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
S
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
T
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
V
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal">
|
||||
W
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
Y
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
Z
|
||||
</li>
|
||||
</ul>
|
||||
<div class="ff" style="left: 69px; top: 115px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 145px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 161px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 191px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 237px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 253px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 283px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 299px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 135px; top: 299px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 135px; top: 299px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 135px; top: 299px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 135px; top: 299px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 329px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 345px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 68px; top: 352px; width: 41px; height: 19px; background: blue;"></div>
|
||||
<div class="ff" style="left: 68px; top: 382px; width: 41px; height: 19px; background: blue;"></div>
|
||||
<div class="ff" style="left: 68px; top: 412px; width: 41px; height: 19px; background: blue;"></div>
|
||||
<div class="ff" style="left: 68px; top: 442px; width: 41px; height: 19px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 465px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 469px; width: 3px; height: 3px; background: blue;"></div><!-- only needed after whitespace opt -->
|
||||
<div class="ff" style="left: 69px; top: 473px; width: 3px; height: 3px; background: blue;"></div><!-- only needed after whitespace opt -->
|
||||
|
||||
<ul class="list-author">
|
||||
<li>
|
||||
Word
|
||||
</li>
|
||||
<li>
|
||||
Word
|
||||
</li>
|
||||
<li>
|
||||
Word
|
||||
</li>
|
||||
<li>
|
||||
Word
|
||||
</li>
|
||||
</ul>
|
||||
</div> <!-- headline headline-left headline-active -->
|
||||
|
||||
<div style="position:relative;">
|
||||
<div style="height: 4000px; background: red;">
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- container-ext -->
|
||||
</body>
|
||||
</html>
|
207
layout/reftests/bugs/1120431-2.html
Normal file
207
layout/reftests/bugs/1120431-2.html
Normal file
@ -0,0 +1,207 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<style>
|
||||
.container-ext {
|
||||
padding-left: 180px;
|
||||
padding-right: 180px;
|
||||
}
|
||||
|
||||
.headline {
|
||||
line-height: 30px;
|
||||
text-shadow: 1px 1px rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.headline-left {
|
||||
left: 30px;
|
||||
}
|
||||
|
||||
.headline-right {
|
||||
top: 20px !important;
|
||||
/*bottom:370px !important;*/
|
||||
right: 20px;
|
||||
}
|
||||
|
||||
.headline-active {
|
||||
position: fixed;
|
||||
top: 100px;
|
||||
}
|
||||
|
||||
.list-author:before,
|
||||
.list-author:after {
|
||||
content: "\200e";
|
||||
display: table;
|
||||
}
|
||||
.list-author:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.list-author-vocal {
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.ff { position: fixed; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-ext">
|
||||
|
||||
<div class="headline headline-left headline-active">
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal">
|
||||
A
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
B
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
C
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
D
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
E
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal">
|
||||
F
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
G
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
H
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
I
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
J
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal">
|
||||
K
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
L
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
M
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
N
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
O
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal active">
|
||||
P
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
R
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
S
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
T
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
V
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="list-author">
|
||||
<li class="list-author-vocal">
|
||||
W
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
Y
|
||||
</li>
|
||||
<li class="list-author-vocal">
|
||||
Z
|
||||
</li>
|
||||
</ul>
|
||||
<div class="ff" style="left: 69px; top: 115px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 173px; top: 115px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 145px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 161px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 162px; top: 161px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 191px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 177px; top: 207px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 237px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 253px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 168px; top: 253px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 283px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 299px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 135px; top: 299px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 135px; top: 299px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 135px; top: 299px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 135px; top: 299px; width: 4px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 329px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 345px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 68px; top: 352px; width: 41px; height: 19px; background: blue;"></div>
|
||||
<div class="ff" style="left: 68px; top: 382px; width: 41px; height: 19px; background: blue;"></div>
|
||||
<div class="ff" style="left: 68px; top: 412px; width: 41px; height: 19px; background: blue;"></div>
|
||||
<div class="ff" style="left: 68px; top: 442px; width: 41px; height: 19px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 465px; width: 3px; height: 3px; background: blue;"></div>
|
||||
<div class="ff" style="left: 69px; top: 469px; width: 3px; height: 3px; background: blue;"></div><!-- only needed after whitespace opt -->
|
||||
<div class="ff" style="left: 69px; top: 473px; width: 3px; height: 3px; background: blue;"></div><!-- only needed after whitespace opt -->
|
||||
|
||||
<ul class="list-author">
|
||||
<li>
|
||||
Word
|
||||
</li>
|
||||
<li>
|
||||
Word
|
||||
</li>
|
||||
<li>
|
||||
Word
|
||||
</li>
|
||||
<li>
|
||||
Word
|
||||
</li>
|
||||
</ul>
|
||||
</div> <!-- headline headline-left headline-active -->
|
||||
<div class="headline headline-right headline-active">
|
||||
<!--‎f--><div style="width: 2px; height: 2px; background: white;"></div>
|
||||
</div>
|
||||
|
||||
<div style="position:relative;">
|
||||
<div style="height: 4000px; background: red;">
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- container-ext -->
|
||||
</body>
|
||||
</html>
|
@ -1856,3 +1856,5 @@ fuzzy-if(d2d,36,304) HTTP(..) == 1116480-1-fakeitalic-overflow.html 1116480-1-fa
|
||||
== 1111753-1.html about:blank
|
||||
== 1119117-1a.html 1119117-1-ref.html
|
||||
== 1119117-1b.html 1119117-1-ref.html
|
||||
== 1120431-1.html 1120431-1-ref.html
|
||||
== 1120431-2.html 1120431-2-ref.html
|
||||
|
@ -74,14 +74,14 @@ nsCSSProps::kParserVariantTable[eCSSProperty_COUNT_no_shorthands] = {
|
||||
// End-of-array marker for mask arguments to ParseBitmaskValues
|
||||
#define MASK_END_VALUE (-1)
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(CSSParseResult, int32_t)
|
||||
enum class CSSParseResult : int32_t {
|
||||
// Parsed something successfully:
|
||||
Ok,
|
||||
// Did not find what we were looking for, but did not consume any token:
|
||||
NotFound,
|
||||
// Unexpected token or token value, too late for UngetToken() to be enough:
|
||||
Error
|
||||
MOZ_END_ENUM_CLASS(CSSParseResult)
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -53,7 +53,6 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "mozilla/TypedEnumBits.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -1407,7 +1406,7 @@ struct NodeMatchContext {
|
||||
* Additional information about a selector (without combinators) that is
|
||||
* being matched.
|
||||
*/
|
||||
MOZ_BEGIN_ENUM_CLASS(SelectorMatchesFlags, uint8_t)
|
||||
enum class SelectorMatchesFlags : uint8_t {
|
||||
NONE = 0,
|
||||
|
||||
// The selector's flags are unknown. This happens when you don't know
|
||||
@ -1424,7 +1423,7 @@ MOZ_BEGIN_ENUM_CLASS(SelectorMatchesFlags, uint8_t)
|
||||
// The selector is part of an argument to a functional pseudo-class or
|
||||
// pseudo-element.
|
||||
IS_PSEUDO_CLASS_ARGUMENT = 1 << 2
|
||||
MOZ_END_ENUM_CLASS(SelectorMatchesFlags)
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(SelectorMatchesFlags)
|
||||
|
||||
static bool ValueIncludes(const nsSubstring& aValueList,
|
||||
|
@ -10,14 +10,12 @@
|
||||
#define mozilla_EnumeratedArray_h
|
||||
|
||||
#include "mozilla/Array.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* EnumeratedArray is a fixed-size array container for use when an
|
||||
* array is indexed by a specific enum class, as currently implemented
|
||||
* by MOZ_BEGIN_ENUM_CLASS.
|
||||
* array is indexed by a specific enum class.
|
||||
*
|
||||
* This provides type safety by guarding at compile time against accidentally
|
||||
* indexing such arrays with unrelated values. This also removes the need
|
||||
@ -27,11 +25,11 @@ namespace mozilla {
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* MOZ_BEGIN_ENUM_CLASS(AnimalSpecies)
|
||||
* enum class AnimalSpecies {
|
||||
* Cow,
|
||||
* Sheep,
|
||||
* Count
|
||||
* MOZ_END_ENUM_CLASS(AnimalSpecies)
|
||||
* };
|
||||
*
|
||||
* EnumeratedArray<AnimalSpecies, AnimalSpecies::Count, int> headCount;
|
||||
*
|
||||
@ -40,7 +38,7 @@ namespace mozilla {
|
||||
*
|
||||
*/
|
||||
template<typename IndexType,
|
||||
MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(IndexType) SizeAsEnumValue,
|
||||
IndexType SizeAsEnumValue,
|
||||
typename ValueType>
|
||||
class EnumeratedArray
|
||||
{
|
||||
|
256
mfbt/TypedEnum.h
256
mfbt/TypedEnum.h
@ -1,256 +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/. */
|
||||
|
||||
/* Macros to emulate C++11 typed enums and enum classes. */
|
||||
|
||||
#ifndef mozilla_TypedEnum_h
|
||||
#define mozilla_TypedEnum_h
|
||||
|
||||
#include "mozilla/TypedEnumInternal.h"
|
||||
#include "mozilla/MacroArgs.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
/**
|
||||
* MOZ_BEGIN_ENUM_CLASS and MOZ_END_ENUM_CLASS provide access to the
|
||||
* strongly-typed enumeration feature of C++11 ("enum class"). If supported
|
||||
* by the compiler, an enum defined using these macros will not be implicitly
|
||||
* converted to any other type, and its enumerators will be scoped using the
|
||||
* enumeration name. Place MOZ_BEGIN_ENUM_CLASS(EnumName [, type]) in place of
|
||||
* "enum EnumName {", and MOZ_END_ENUM_CLASS(EnumName) in place of the closing
|
||||
* "};". For example,
|
||||
*
|
||||
* MOZ_BEGIN_ENUM_CLASS(Enum, int32_t)
|
||||
* A,
|
||||
* B = 6
|
||||
* MOZ_END_ENUM_CLASS(Enum)
|
||||
*
|
||||
* This will make "Enum::A" and "Enum::B" appear in the global scope, but "A"
|
||||
* and "B" will not. In compilers that support C++11 strongly-typed
|
||||
* enumerations, implicit conversions of Enum values to numeric types will
|
||||
* fail. In other compilers, Enum itself will actually be defined as a class,
|
||||
* and some implicit conversions will fail while others will succeed.
|
||||
*
|
||||
* The optional type argument specifies the underlying type for the enum where
|
||||
* supported, as with MOZ_ENUM_TYPE(). As with MOZ_ENUM_TYPE(), it will do
|
||||
* nothing on compilers that do not support it.
|
||||
*
|
||||
* MOZ_{BEGIN,END}_ENUM_CLASS doesn't work for defining enum classes nested
|
||||
* inside classes. To define an enum class nested inside another class, use
|
||||
* MOZ_{BEGIN,END}_NESTED_ENUM_CLASS, and place a MOZ_FINISH_NESTED_ENUM_CLASS
|
||||
* in namespace scope to handle bits that can only be implemented with
|
||||
* namespace-scoped code. For example:
|
||||
*
|
||||
* class FooBar
|
||||
* {
|
||||
* MOZ_BEGIN_NESTED_ENUM_CLASS(Enum, int32_t)
|
||||
* A,
|
||||
* B = 6
|
||||
* MOZ_END_NESTED_ENUM_CLASS(Enum)
|
||||
* };
|
||||
*
|
||||
* MOZ_FINISH_NESTED_ENUM_CLASS(FooBar::Enum)
|
||||
*/
|
||||
#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS)
|
||||
/*
|
||||
* All compilers that support strong enums also support an explicit
|
||||
* underlying type, so no extra check is needed.
|
||||
*/
|
||||
|
||||
/* Single-argument form. */
|
||||
# define MOZ_BEGIN_NESTED_ENUM_CLASS_HELPER1(Name) \
|
||||
enum class Name {
|
||||
/* Two-argument form. */
|
||||
# define MOZ_BEGIN_NESTED_ENUM_CLASS_HELPER2(Name, type) \
|
||||
enum class Name : type {
|
||||
# define MOZ_END_NESTED_ENUM_CLASS(Name) \
|
||||
};
|
||||
# define MOZ_FINISH_NESTED_ENUM_CLASS(Name) /* nothing */
|
||||
|
||||
/*
|
||||
* MOZ_ENUM_CLASS_ENUM_TYPE allows using enum classes
|
||||
* as template parameter types. For that, we need integer types.
|
||||
* In the present case where the compiler supports strong enums,
|
||||
* these are already integer types so there is nothing more to do.
|
||||
*/
|
||||
# define MOZ_ENUM_CLASS_ENUM_TYPE(Name) Name
|
||||
/*
|
||||
* See the comment below about MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE.
|
||||
*/
|
||||
# define MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(Name) Name
|
||||
#else
|
||||
/**
|
||||
* We need Name to both name a type, and scope the provided enumerator
|
||||
* names. Namespaces and classes both provide scoping, but namespaces
|
||||
* aren't types, so we need to use a class that wraps the enum values. We
|
||||
* have an implicit conversion from the inner enum type to the class, so
|
||||
* statements like
|
||||
*
|
||||
* Enum x = Enum::A;
|
||||
*
|
||||
* will still work. We need to define an implicit conversion from the class
|
||||
* to the inner enum as well, so that (for instance) switch statements will
|
||||
* work. This means that the class can be implicitly converted to a numeric
|
||||
* value as well via the enum type, since C++ allows an implicit
|
||||
* user-defined conversion followed by a standard conversion to still be
|
||||
* implicit.
|
||||
*
|
||||
* We have an explicit constructor from int defined, so that casts like
|
||||
* (Enum)7 will still work. We also have a zero-argument constructor with
|
||||
* no arguments, so declaration without initialization (like "Enum foo;")
|
||||
* will work.
|
||||
*
|
||||
* Additionally, we'll delete as many operators as possible for the inner
|
||||
* enum type, so statements like this will still fail:
|
||||
*
|
||||
* f(5 + Enum::B); // deleted operator+
|
||||
*
|
||||
* But we can't prevent things like this, because C++ doesn't allow
|
||||
* overriding conversions or assignment operators for enums:
|
||||
*
|
||||
* int x = Enum::A;
|
||||
* int f()
|
||||
* {
|
||||
* return Enum::A;
|
||||
* }
|
||||
*/
|
||||
|
||||
/* Single-argument form. */
|
||||
# define MOZ_BEGIN_NESTED_ENUM_CLASS_HELPER1(Name) \
|
||||
class Name \
|
||||
{ \
|
||||
public: \
|
||||
enum Enum \
|
||||
{
|
||||
/* Two-argument form. */
|
||||
# define MOZ_BEGIN_NESTED_ENUM_CLASS_HELPER2(Name, type) \
|
||||
class Name \
|
||||
{ \
|
||||
public: \
|
||||
enum Enum : type \
|
||||
{
|
||||
# define MOZ_END_NESTED_ENUM_CLASS(Name) \
|
||||
}; \
|
||||
Name() {} \
|
||||
MOZ_CONSTEXPR Name(Enum aEnum) : mEnum(aEnum) {} \
|
||||
template<typename Other> \
|
||||
explicit MOZ_CONSTEXPR Name(Other num) : mEnum((Enum)num) {} \
|
||||
MOZ_CONSTEXPR operator Enum() const { return mEnum; } \
|
||||
explicit MOZ_CONSTEXPR Name(const mozilla::CastableTypedEnumResult<Name>& aOther) \
|
||||
: mEnum(aOther.get()) \
|
||||
{} \
|
||||
private: \
|
||||
Enum mEnum; \
|
||||
};
|
||||
# define MOZ_FINISH_NESTED_ENUM_CLASS(Name) \
|
||||
inline int operator+(const int&, const Name::Enum&) = delete; \
|
||||
inline int operator+(const Name::Enum&, const int&) = delete; \
|
||||
inline int operator-(const int&, const Name::Enum&) = delete; \
|
||||
inline int operator-(const Name::Enum&, const int&) = delete; \
|
||||
inline int operator*(const int&, const Name::Enum&) = delete; \
|
||||
inline int operator*(const Name::Enum&, const int&) = delete; \
|
||||
inline int operator/(const int&, const Name::Enum&) = delete; \
|
||||
inline int operator/(const Name::Enum&, const int&) = delete; \
|
||||
inline int operator%(const int&, const Name::Enum&) = delete; \
|
||||
inline int operator%(const Name::Enum&, const int&) = delete; \
|
||||
inline int operator+(const Name::Enum&) = delete; \
|
||||
inline int operator-(const Name::Enum&) = delete; \
|
||||
inline int& operator++(Name::Enum&) = delete; \
|
||||
inline int operator++(Name::Enum&, int) = delete; \
|
||||
inline int& operator--(Name::Enum&) = delete; \
|
||||
inline int operator--(Name::Enum&, int) = delete; \
|
||||
inline bool operator==(const int&, const Name::Enum&) = delete; \
|
||||
inline bool operator==(const Name::Enum&, const int&) = delete; \
|
||||
inline bool operator!=(const int&, const Name::Enum&) = delete; \
|
||||
inline bool operator!=(const Name::Enum&, const int&) = delete; \
|
||||
inline bool operator>(const int&, const Name::Enum&) = delete; \
|
||||
inline bool operator>(const Name::Enum&, const int&) = delete; \
|
||||
inline bool operator<(const int&, const Name::Enum&) = delete; \
|
||||
inline bool operator<(const Name::Enum&, const int&) = delete; \
|
||||
inline bool operator>=(const int&, const Name::Enum&) = delete; \
|
||||
inline bool operator>=(const Name::Enum&, const int&) = delete; \
|
||||
inline bool operator<=(const int&, const Name::Enum&) = delete; \
|
||||
inline bool operator<=(const Name::Enum&, const int&) = delete; \
|
||||
inline bool operator!(const Name::Enum&) = delete; \
|
||||
inline bool operator&&(const bool&, const Name::Enum&) = delete; \
|
||||
inline bool operator&&(const Name::Enum&, const bool&) = delete; \
|
||||
inline bool operator||(const bool&, const Name::Enum&) = delete; \
|
||||
inline bool operator||(const Name::Enum&, const bool&) = delete; \
|
||||
inline int operator&(const int&, const Name::Enum&) = delete; \
|
||||
inline int operator&(const Name::Enum&, const int&) = delete; \
|
||||
inline int operator|(const int&, const Name::Enum&) = delete; \
|
||||
inline int operator|(const Name::Enum&, const int&) = delete; \
|
||||
inline int operator^(const int&, const Name::Enum&) = delete; \
|
||||
inline int operator^(const Name::Enum&, const int&) = delete; \
|
||||
inline int operator<<(const int&, const Name::Enum&) = delete; \
|
||||
inline int operator<<(const Name::Enum&, const int&) = delete; \
|
||||
inline int operator>>(const int&, const Name::Enum&) = delete; \
|
||||
inline int operator>>(const Name::Enum&, const int&) = delete; \
|
||||
inline int& operator+=(int&, const Name::Enum&) = delete; \
|
||||
inline int& operator-=(int&, const Name::Enum&) = delete; \
|
||||
inline int& operator*=(int&, const Name::Enum&) = delete; \
|
||||
inline int& operator/=(int&, const Name::Enum&) = delete; \
|
||||
inline int& operator%=(int&, const Name::Enum&) = delete; \
|
||||
inline int& operator&=(int&, const Name::Enum&) = delete; \
|
||||
inline int& operator|=(int&, const Name::Enum&) = delete; \
|
||||
inline int& operator^=(int&, const Name::Enum&) = delete; \
|
||||
inline int& operator<<=(int&, const Name::Enum&) = delete; \
|
||||
inline int& operator>>=(int&, const Name::Enum&) = delete;
|
||||
|
||||
/*
|
||||
* MOZ_ENUM_CLASS_ENUM_TYPE allows using enum classes
|
||||
* as template parameter types. For that, we need integer types.
|
||||
* In the present case, the integer type is the Enum nested type.
|
||||
*/
|
||||
# define MOZ_ENUM_CLASS_ENUM_TYPE(Name) Name::Enum
|
||||
/*
|
||||
* MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE is a variant of MOZ_ENUM_CLASS_ENUM_TYPE
|
||||
* to be used when the enum class at hand depends on template parameters.
|
||||
*
|
||||
* Indeed, if T depends on template parameters, in order to name a nested type
|
||||
* in T, C++ does not allow to just write "T::NestedType". Instead, we have
|
||||
* to write "typename T::NestedType". The role of this macro is to add
|
||||
* this "typename" keywords where needed.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* template<typename T, MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(T) Value>
|
||||
* struct S {};
|
||||
*
|
||||
* MOZ_BEGIN_ENUM_CLASS(E)
|
||||
* Foo,
|
||||
* Bar
|
||||
* MOZ_END_ENUM_CLASS(E)
|
||||
*
|
||||
* S<E, E::Bar> s;
|
||||
*
|
||||
* In this example, the second template parameter to S is meant to be of type
|
||||
* T, but on non-C++11 compilers, type T is a class type, not an integer
|
||||
* type, so it is not accepted as the type of a constant template parameter.
|
||||
* One would then want to use MOZ_ENUM_CLASS_ENUM_TYPE(T), but that doesn't
|
||||
* work either as T depends on template parameters (more specifically here, T
|
||||
* _is_ a template parameter) so as MOZ_ENUM_CLASS_ENUM_TYPE(T) expands to
|
||||
* T::Enum, we are missing the required "typename" keyword. So here,
|
||||
* MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE is needed.
|
||||
*/
|
||||
# define MOZ_TEMPLATE_ENUM_CLASS_ENUM_TYPE(Name) typename Name::Enum
|
||||
#endif
|
||||
|
||||
# define MOZ_BEGIN_NESTED_ENUM_CLASS_GLUE(a, b) a b
|
||||
# define MOZ_BEGIN_NESTED_ENUM_CLASS(...) \
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS_GLUE( \
|
||||
MOZ_PASTE_PREFIX_AND_ARG_COUNT(MOZ_BEGIN_NESTED_ENUM_CLASS_HELPER, \
|
||||
__VA_ARGS__), \
|
||||
(__VA_ARGS__))
|
||||
|
||||
# define MOZ_BEGIN_ENUM_CLASS(...) MOZ_BEGIN_NESTED_ENUM_CLASS(__VA_ARGS__)
|
||||
# define MOZ_END_ENUM_CLASS(Name) \
|
||||
MOZ_END_NESTED_ENUM_CLASS(Name) \
|
||||
MOZ_FINISH_NESTED_ENUM_CLASS(Name)
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* mozilla_TypedEnum_h */
|
@ -11,11 +11,55 @@
|
||||
#ifndef mozilla_TypedEnumBits_h
|
||||
#define mozilla_TypedEnumBits_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/IntegerTypeTraits.h"
|
||||
#include "mozilla/TypedEnumInternal.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/*
|
||||
* The problem that CastableTypedEnumResult aims to solve is that
|
||||
* typed enums are not convertible to bool, and there is no way to make them
|
||||
* be, yet user code wants to be able to write
|
||||
*
|
||||
* if (myFlags & Flags::SOME_PARTICULAR_FLAG) (1)
|
||||
*
|
||||
* There are different approaches to solving this. Most of them require
|
||||
* adapting user code. For example, we could implement operator! and have
|
||||
* the user write
|
||||
*
|
||||
* if (!!(myFlags & Flags::SOME_PARTICULAR_FLAG)) (2)
|
||||
*
|
||||
* Or we could supply a IsNonZero() or Any() function returning whether
|
||||
* an enum value is nonzero, and have the user write
|
||||
*
|
||||
* if (Any(Flags & Flags::SOME_PARTICULAR_FLAG)) (3)
|
||||
*
|
||||
* But instead, we choose to preserve the original user syntax (1) as it
|
||||
* is inherently more readable, and to ease porting existing code to typed
|
||||
* enums. We achieve this by having operator& and other binary bitwise
|
||||
* operators have as return type a class, CastableTypedEnumResult,
|
||||
* that wraps a typed enum but adds bool convertibility.
|
||||
*/
|
||||
template<typename E>
|
||||
class CastableTypedEnumResult
|
||||
{
|
||||
private:
|
||||
const E mValue;
|
||||
|
||||
public:
|
||||
explicit MOZ_CONSTEXPR CastableTypedEnumResult(E aValue)
|
||||
: mValue(aValue)
|
||||
{}
|
||||
|
||||
MOZ_CONSTEXPR operator E() const { return mValue; }
|
||||
|
||||
template<typename DestinationType>
|
||||
MOZ_EXPLICIT_CONVERSION MOZ_CONSTEXPR
|
||||
operator DestinationType() const { return DestinationType(mValue); }
|
||||
|
||||
MOZ_CONSTEXPR bool operator !() const { return !bool(mValue); }
|
||||
};
|
||||
|
||||
#define MOZ_CASTABLETYPEDENUMRESULT_BINOP(Op, OtherType, ReturnType) \
|
||||
template<typename E> \
|
||||
MOZ_CONSTEXPR ReturnType \
|
||||
@ -69,32 +113,6 @@ MOZ_CASTABLETYPEDENUMRESULT_COMPOUND_ASSIGN_OP(^=)
|
||||
|
||||
#undef MOZ_CASTABLETYPEDENUMRESULT_BINOP
|
||||
|
||||
#ifndef MOZ_HAVE_CXX11_STRONG_ENUMS
|
||||
|
||||
#define MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(Op, ReturnType) \
|
||||
template<typename E> \
|
||||
MOZ_CONSTEXPR ReturnType \
|
||||
operator Op(typename E::Enum aE, const CastableTypedEnumResult<E>& aR) \
|
||||
{ \
|
||||
return ReturnType(aE Op E(aR)); \
|
||||
} \
|
||||
template<typename E> \
|
||||
MOZ_CONSTEXPR ReturnType \
|
||||
operator Op(const CastableTypedEnumResult<E>& aR, typename E::Enum aE) \
|
||||
{ \
|
||||
return ReturnType(E(aR) Op aE); \
|
||||
}
|
||||
|
||||
MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(|, CastableTypedEnumResult<E>)
|
||||
MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(&, CastableTypedEnumResult<E>)
|
||||
MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(^, CastableTypedEnumResult<E>)
|
||||
MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(==, bool)
|
||||
MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(!=, bool)
|
||||
|
||||
#undef MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11
|
||||
|
||||
#endif // not MOZ_HAVE_CXX11_STRONG_ENUMS
|
||||
|
||||
namespace detail {
|
||||
template<typename E>
|
||||
struct UnsignedIntegerTypeForEnum
|
||||
@ -119,7 +137,11 @@ struct UnsignedIntegerTypeForEnum
|
||||
return a = a Op b; \
|
||||
}
|
||||
|
||||
#define MOZ_MAKE_ENUM_CLASS_OPS_IMPL(Name) \
|
||||
/**
|
||||
* MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS generates standard bitwise operators
|
||||
* for the given enum type. Use this to enable using an enum type as bit-field.
|
||||
*/
|
||||
#define MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Name) \
|
||||
MOZ_MAKE_ENUM_CLASS_BINOP_IMPL(Name, |) \
|
||||
MOZ_MAKE_ENUM_CLASS_BINOP_IMPL(Name, &) \
|
||||
MOZ_MAKE_ENUM_CLASS_BINOP_IMPL(Name, ^) \
|
||||
@ -131,54 +153,4 @@ struct UnsignedIntegerTypeForEnum
|
||||
return Result(Name(~(U(a)))); \
|
||||
}
|
||||
|
||||
#ifndef MOZ_HAVE_CXX11_STRONG_ENUMS
|
||||
# define MOZ_MAKE_ENUM_CLASS_BITWISE_BINOP_EXTRA_NON_CXX11(Name, Op) \
|
||||
inline MOZ_CONSTEXPR mozilla::CastableTypedEnumResult<Name> \
|
||||
operator Op(Name a, Name::Enum b) \
|
||||
{ \
|
||||
return a Op Name(b); \
|
||||
} \
|
||||
\
|
||||
inline MOZ_CONSTEXPR mozilla::CastableTypedEnumResult<Name> \
|
||||
operator Op(Name::Enum a, Name b) \
|
||||
{ \
|
||||
return Name(a) Op b; \
|
||||
} \
|
||||
\
|
||||
inline MOZ_CONSTEXPR mozilla::CastableTypedEnumResult<Name> \
|
||||
operator Op(Name::Enum a, Name::Enum b) \
|
||||
{ \
|
||||
return Name(a) Op Name(b); \
|
||||
} \
|
||||
\
|
||||
inline Name& \
|
||||
operator Op##=(Name& a, Name::Enum b) \
|
||||
{ \
|
||||
return a = a Op Name(b); \
|
||||
}
|
||||
|
||||
# define MOZ_MAKE_ENUM_CLASS_OPS_EXTRA_NON_CXX11(Name) \
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_BINOP_EXTRA_NON_CXX11(Name, |) \
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_BINOP_EXTRA_NON_CXX11(Name, &) \
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_BINOP_EXTRA_NON_CXX11(Name, ^) \
|
||||
inline MOZ_CONSTEXPR mozilla::CastableTypedEnumResult<Name> \
|
||||
operator~(Name::Enum a) \
|
||||
{ \
|
||||
return ~(Name(a)); \
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS generates standard bitwise operators
|
||||
* for the given enum type. Use this to enable using an enum type as bit-field.
|
||||
*/
|
||||
#ifdef MOZ_HAVE_CXX11_STRONG_ENUMS
|
||||
# define MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Name) \
|
||||
MOZ_MAKE_ENUM_CLASS_OPS_IMPL(Name)
|
||||
#else
|
||||
# define MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Name) \
|
||||
MOZ_MAKE_ENUM_CLASS_OPS_IMPL(Name) \
|
||||
MOZ_MAKE_ENUM_CLASS_OPS_EXTRA_NON_CXX11(Name)
|
||||
#endif
|
||||
|
||||
#endif // mozilla_TypedEnumBits_h
|
||||
|
@ -1,103 +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/. */
|
||||
|
||||
/* Internal stuff needed by TypedEnum.h and TypedEnumBits.h. */
|
||||
|
||||
// NOTE: When we can assume C++11 enum class support and TypedEnum.h goes away,
|
||||
// we should then consider folding TypedEnumInternal.h into TypedEnumBits.h.
|
||||
|
||||
#ifndef mozilla_TypedEnumInternal_h
|
||||
#define mozilla_TypedEnumInternal_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
#if defined(__clang__)
|
||||
/*
|
||||
* Per Clang documentation, "Note that marketing version numbers should not
|
||||
* be used to check for language features, as different vendors use different
|
||||
* numbering schemes. Instead, use the feature checking macros."
|
||||
*/
|
||||
# ifndef __has_extension
|
||||
# define __has_extension __has_feature /* compatibility, for older versions of clang */
|
||||
# endif
|
||||
# if __has_extension(cxx_strong_enums)
|
||||
# define MOZ_HAVE_CXX11_STRONG_ENUMS
|
||||
# endif
|
||||
#elif defined(__GNUC__)
|
||||
# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
|
||||
# if MOZ_GCC_VERSION_AT_LEAST(4, 6, 3)
|
||||
# define MOZ_HAVE_CXX11_STRONG_ENUMS
|
||||
# endif
|
||||
# endif
|
||||
#elif defined(_MSC_VER)
|
||||
# define MOZ_HAVE_CXX11_STRONG_ENUMS
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/*
|
||||
* The problem that CastableTypedEnumResult aims to solve is that
|
||||
* typed enums are not convertible to bool, and there is no way to make them
|
||||
* be, yet user code wants to be able to write
|
||||
*
|
||||
* if (myFlags & Flags::SOME_PARTICULAR_FLAG) (1)
|
||||
*
|
||||
* There are different approaches to solving this. Most of them require
|
||||
* adapting user code. For example, we could implement operator! and have
|
||||
* the user write
|
||||
*
|
||||
* if (!!(myFlags & Flags::SOME_PARTICULAR_FLAG)) (2)
|
||||
*
|
||||
* Or we could supply a IsNonZero() or Any() function returning whether
|
||||
* an enum value is nonzero, and have the user write
|
||||
*
|
||||
* if (Any(Flags & Flags::SOME_PARTICULAR_FLAG)) (3)
|
||||
*
|
||||
* But instead, we choose to preserve the original user syntax (1) as it
|
||||
* is inherently more readable, and to ease porting existing code to typed
|
||||
* enums. We achieve this by having operator& and other binary bitwise
|
||||
* operators have as return type a class, CastableTypedEnumResult,
|
||||
* that wraps a typed enum but adds bool convertibility.
|
||||
*/
|
||||
template<typename E>
|
||||
class CastableTypedEnumResult
|
||||
{
|
||||
private:
|
||||
const E mValue;
|
||||
|
||||
public:
|
||||
explicit MOZ_CONSTEXPR CastableTypedEnumResult(E aValue)
|
||||
: mValue(aValue)
|
||||
{}
|
||||
|
||||
MOZ_CONSTEXPR operator E() const { return mValue; }
|
||||
|
||||
template<typename DestinationType>
|
||||
MOZ_EXPLICIT_CONVERSION MOZ_CONSTEXPR
|
||||
operator DestinationType() const { return DestinationType(mValue); }
|
||||
|
||||
MOZ_CONSTEXPR bool operator !() const { return !bool(mValue); }
|
||||
|
||||
#ifndef MOZ_HAVE_CXX11_STRONG_ENUMS
|
||||
// This get() method is used to implement a constructor in the
|
||||
// non-c++11 fallback path for MOZ_BEGIN_ENUM_CLASS, taking a
|
||||
// CastableTypedEnumResult. If we try to implement it using the
|
||||
// above conversion operator E(), then at least clang 3.3
|
||||
// (when forced to take the non-c++11 fallback path) compiles
|
||||
// this constructor to an infinite recursion. So we introduce this
|
||||
// get() method, that does exactly the same as the conversion operator,
|
||||
// to work around this.
|
||||
MOZ_CONSTEXPR E get() const { return mValue; }
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // mozilla_TypedEnumInternal_h
|
@ -69,9 +69,7 @@ EXPORTS.mozilla = [
|
||||
'TemplateLib.h',
|
||||
'ThreadLocal.h',
|
||||
'ToString.h',
|
||||
'TypedEnum.h',
|
||||
'TypedEnumBits.h',
|
||||
'TypedEnumInternal.h',
|
||||
'Types.h',
|
||||
'TypeTraits.h',
|
||||
'UniquePtr.h',
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/TypedEnum.h"
|
||||
#include "mozilla/TypedEnumBits.h"
|
||||
|
||||
#include <stdint.h>
|
||||
@ -55,55 +54,55 @@ RequireLiteralType(const T&)
|
||||
RequireLiteralType<T>();
|
||||
}
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(AutoEnum)
|
||||
enum class AutoEnum {
|
||||
A,
|
||||
B = -3,
|
||||
C
|
||||
MOZ_END_ENUM_CLASS(AutoEnum)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(CharEnum, char)
|
||||
enum class CharEnum : char {
|
||||
A,
|
||||
B = 3,
|
||||
C
|
||||
MOZ_END_ENUM_CLASS(CharEnum)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(AutoEnumBitField)
|
||||
enum class AutoEnumBitField {
|
||||
A = 0x10,
|
||||
B = 0x20,
|
||||
C
|
||||
MOZ_END_ENUM_CLASS(AutoEnumBitField)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(CharEnumBitField, char)
|
||||
enum class CharEnumBitField : char {
|
||||
A = 0x10,
|
||||
B,
|
||||
C = 0x40
|
||||
MOZ_END_ENUM_CLASS(CharEnumBitField)
|
||||
};
|
||||
|
||||
struct Nested
|
||||
{
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS(AutoEnum)
|
||||
enum class AutoEnum {
|
||||
A,
|
||||
B,
|
||||
C = -1
|
||||
MOZ_END_NESTED_ENUM_CLASS(AutoEnum)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS(CharEnum, char)
|
||||
enum class CharEnum : char {
|
||||
A = 4,
|
||||
B,
|
||||
C = 1
|
||||
MOZ_END_NESTED_ENUM_CLASS(CharEnum)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS(AutoEnumBitField)
|
||||
enum class AutoEnumBitField {
|
||||
A,
|
||||
B = 0x20,
|
||||
C
|
||||
MOZ_END_NESTED_ENUM_CLASS(AutoEnumBitField)
|
||||
};
|
||||
|
||||
MOZ_BEGIN_NESTED_ENUM_CLASS(CharEnumBitField, char)
|
||||
enum class CharEnumBitField : char {
|
||||
A = 1,
|
||||
B = 1,
|
||||
C = 1
|
||||
MOZ_END_NESTED_ENUM_CLASS(CharEnumBitField)
|
||||
};
|
||||
};
|
||||
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(AutoEnumBitField)
|
||||
@ -112,11 +111,11 @@ MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Nested::AutoEnumBitField)
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Nested::CharEnumBitField)
|
||||
|
||||
#define MAKE_STANDARD_BITFIELD_FOR_TYPE(IntType) \
|
||||
MOZ_BEGIN_ENUM_CLASS(BitFieldFor_##IntType, IntType) \
|
||||
enum class BitFieldFor_##IntType : IntType { \
|
||||
A = 1, \
|
||||
B = 2, \
|
||||
C = 4, \
|
||||
MOZ_END_ENUM_CLASS(BitFieldFor_##IntType) \
|
||||
}; \
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(BitFieldFor_##IntType)
|
||||
|
||||
MAKE_STANDARD_BITFIELD_FOR_TYPE(int8_t)
|
||||
@ -154,7 +153,7 @@ TestNonConvertibilityForOneType()
|
||||
{
|
||||
using mozilla::IsConvertible;
|
||||
|
||||
#if defined(MOZ_HAVE_CXX11_STRONG_ENUMS) && defined(MOZ_HAVE_EXPLICIT_CONVERSION)
|
||||
#if defined(MOZ_HAVE_EXPLICIT_CONVERSION)
|
||||
static_assert(!IsConvertible<T, bool>::value, "should not be convertible");
|
||||
static_assert(!IsConvertible<T, int>::value, "should not be convertible");
|
||||
static_assert(!IsConvertible<T, uint64_t>::value, "should not be convertible");
|
||||
@ -443,52 +442,52 @@ void TestNoConversionsBetweenUnrelatedTypes()
|
||||
#endif
|
||||
}
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(Int8EnumWithHighBits, int8_t)
|
||||
enum class Int8EnumWithHighBits : int8_t {
|
||||
A = 0x20,
|
||||
B = 0x40
|
||||
MOZ_END_ENUM_CLASS(Int8EnumWithHighBits)
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Int8EnumWithHighBits)
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(Uint8EnumWithHighBits, uint8_t)
|
||||
enum class Uint8EnumWithHighBits : uint8_t {
|
||||
A = 0x40,
|
||||
B = 0x80
|
||||
MOZ_END_ENUM_CLASS(Uint8EnumWithHighBits)
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Uint8EnumWithHighBits)
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(Int16EnumWithHighBits, int16_t)
|
||||
enum class Int16EnumWithHighBits : int16_t {
|
||||
A = 0x2000,
|
||||
B = 0x4000
|
||||
MOZ_END_ENUM_CLASS(Int16EnumWithHighBits)
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Int16EnumWithHighBits)
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(Uint16EnumWithHighBits, uint16_t)
|
||||
enum class Uint16EnumWithHighBits : uint16_t {
|
||||
A = 0x4000,
|
||||
B = 0x8000
|
||||
MOZ_END_ENUM_CLASS(Uint16EnumWithHighBits)
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Uint16EnumWithHighBits)
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(Int32EnumWithHighBits, int32_t)
|
||||
enum class Int32EnumWithHighBits : int32_t {
|
||||
A = 0x20000000,
|
||||
B = 0x40000000
|
||||
MOZ_END_ENUM_CLASS(Int32EnumWithHighBits)
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Int32EnumWithHighBits)
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(Uint32EnumWithHighBits, uint32_t)
|
||||
enum class Uint32EnumWithHighBits : uint32_t {
|
||||
A = 0x40000000u,
|
||||
B = 0x80000000u
|
||||
MOZ_END_ENUM_CLASS(Uint32EnumWithHighBits)
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Uint32EnumWithHighBits)
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(Int64EnumWithHighBits, int64_t)
|
||||
enum class Int64EnumWithHighBits : int64_t {
|
||||
A = 0x2000000000000000ll,
|
||||
B = 0x4000000000000000ll
|
||||
MOZ_END_ENUM_CLASS(Int64EnumWithHighBits)
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Int64EnumWithHighBits)
|
||||
|
||||
MOZ_BEGIN_ENUM_CLASS(Uint64EnumWithHighBits, uint64_t)
|
||||
enum class Uint64EnumWithHighBits : uint64_t {
|
||||
A = 0x4000000000000000ull,
|
||||
B = 0x8000000000000000ull
|
||||
MOZ_END_ENUM_CLASS(Uint64EnumWithHighBits)
|
||||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Uint64EnumWithHighBits)
|
||||
|
||||
// Checks that we don't accidentally truncate high bits by coercing to the wrong
|
||||
|
@ -9,15 +9,22 @@
|
||||
<title>Bug 1019441: Marionette tests for selection carets</title>
|
||||
</head>
|
||||
<body>
|
||||
<style>
|
||||
*
|
||||
{
|
||||
-moz-user-select:none;
|
||||
}
|
||||
</style>
|
||||
<div><input id="input" value="ABC DEF GHI"></div>
|
||||
<br />
|
||||
<div><textarea id="textarea" rows="4" cols="8">ABC DEF GHI JKL MNO PQR</textarea></div>
|
||||
<br />
|
||||
<div><textarea dir="rtl" id="textarea_rtl" rows="8" cols="8">موزيلا فيرفكس موزيلا فيرفكس</textarea></div>
|
||||
<br />
|
||||
<div style="width: 10em; height: 4em; word-wrap: break-word; overflow: auto;" contenteditable="true" id="contenteditable">ABC DEF GHI</div>
|
||||
<div style="width: 10em; height: 4em; word-wrap: break-word; overflow: auto; -moz-user-select:text" contenteditable="true" id="contenteditable">ABC DEF GHI</div>
|
||||
<br />
|
||||
<div style="width: 10em; height: 4em; word-wrap: break-word; overflow: auto;" id="content">ABC DEF GHI</div>
|
||||
<div style="width: 10em; height: 4em; word-wrap: break-word; overflow: auto; -moz-user-select:text" id="content">ABC DEF GHI</div>
|
||||
<br />
|
||||
<div style="width: 10em; height: 8em; overflow: auto; -moz-user-select:text" id="contenteditable2" contenteditable="true">First Line<br></br>Second Line<br></br>Third Line</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -45,7 +45,7 @@ private:
|
||||
|
||||
|
||||
virtual void SetDesktopStartupIDOrTimestamp(const nsACString& aDesktopStartupID,
|
||||
uint32_t aTimestamp);
|
||||
uint32_t aTimestamp) MOZ_OVERRIDE;
|
||||
|
||||
nsInterfaceHashtable<nsPtrHashKey<GtkWidget>, nsIWeakReference> mWindows;
|
||||
GtkWidget* mServerWindow;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user