mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-26 13:58:49 +00:00
Issue #2112 - Part 12: Remove reserved Servo bits from node/element flags and event states
This commit is contained in:
+7
-7
@@ -79,27 +79,27 @@ NS_GetContentList(nsINode* aRootNode,
|
||||
// Element-specific flags
|
||||
enum {
|
||||
// Set if the element has a pending style change.
|
||||
ELEMENT_HAS_PENDING_RESTYLE = NODE_SHARED_RESTYLE_BIT_1,
|
||||
ELEMENT_HAS_PENDING_RESTYLE = ELEMENT_FLAG_BIT(0),
|
||||
|
||||
// Set if the element is a potential restyle root (that is, has a style
|
||||
// change pending _and_ that style change will attempt to restyle
|
||||
// descendants).
|
||||
ELEMENT_IS_POTENTIAL_RESTYLE_ROOT = NODE_SHARED_RESTYLE_BIT_2,
|
||||
ELEMENT_IS_POTENTIAL_RESTYLE_ROOT = ELEMENT_FLAG_BIT(1),
|
||||
|
||||
// Set if the element has a pending animation-only style change as
|
||||
// part of an animation-only style update (where we update styles from
|
||||
// animation to the current refresh tick, but leave everything else as
|
||||
// it was).
|
||||
ELEMENT_HAS_PENDING_ANIMATION_ONLY_RESTYLE = ELEMENT_FLAG_BIT(0),
|
||||
ELEMENT_HAS_PENDING_ANIMATION_ONLY_RESTYLE = ELEMENT_FLAG_BIT(2),
|
||||
|
||||
// Set if the element is a potential animation-only restyle root (that
|
||||
// is, has an animation-only style change pending _and_ that style
|
||||
// change will attempt to restyle descendants).
|
||||
ELEMENT_IS_POTENTIAL_ANIMATION_ONLY_RESTYLE_ROOT = ELEMENT_FLAG_BIT(1),
|
||||
ELEMENT_IS_POTENTIAL_ANIMATION_ONLY_RESTYLE_ROOT = ELEMENT_FLAG_BIT(3),
|
||||
|
||||
// Set if this element has a pending restyle with an eRestyle_SomeDescendants
|
||||
// restyle hint.
|
||||
ELEMENT_IS_CONDITIONAL_RESTYLE_ANCESTOR = ELEMENT_FLAG_BIT(2),
|
||||
ELEMENT_IS_CONDITIONAL_RESTYLE_ANCESTOR = ELEMENT_FLAG_BIT(4),
|
||||
|
||||
// Just the HAS_PENDING bits, for convenience
|
||||
ELEMENT_PENDING_RESTYLE_FLAGS =
|
||||
@@ -117,10 +117,10 @@ enum {
|
||||
ELEMENT_IS_CONDITIONAL_RESTYLE_ANCESTOR,
|
||||
|
||||
// Set if this element is marked as 'scrollgrab' (see bug 912666)
|
||||
ELEMENT_HAS_SCROLLGRAB = ELEMENT_FLAG_BIT(3),
|
||||
ELEMENT_HAS_SCROLLGRAB = ELEMENT_FLAG_BIT(5),
|
||||
|
||||
// Remaining bits are for subclasses
|
||||
ELEMENT_TYPE_SPECIFIC_BITS_OFFSET = NODE_TYPE_SPECIFIC_BITS_OFFSET + 4
|
||||
ELEMENT_TYPE_SPECIFIC_BITS_OFFSET = NODE_TYPE_SPECIFIC_BITS_OFFSET + 6
|
||||
};
|
||||
|
||||
#undef ELEMENT_FLAG_BIT
|
||||
|
||||
+1
-13
@@ -202,20 +202,8 @@ enum {
|
||||
|
||||
NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS = NODE_FLAG_BIT(20),
|
||||
|
||||
// These two bits are shared by Gecko's and Servo's restyle systems for
|
||||
// different purposes. They should not be accessed directly, and access to
|
||||
// them should be properly guarded by asserts.
|
||||
NODE_SHARED_RESTYLE_BIT_1 = NODE_FLAG_BIT(21),
|
||||
NODE_SHARED_RESTYLE_BIT_2 = NODE_FLAG_BIT(22),
|
||||
|
||||
// Whether this node is dirty for Servo's style system.
|
||||
NODE_IS_DIRTY_FOR_SERVO = NODE_SHARED_RESTYLE_BIT_1,
|
||||
|
||||
// Whether this node has dirty descendants for Servo's style system.
|
||||
NODE_HAS_DIRTY_DESCENDANTS_FOR_SERVO = NODE_SHARED_RESTYLE_BIT_2,
|
||||
|
||||
// Remaining bits are node type specific.
|
||||
NODE_TYPE_SPECIFIC_BITS_OFFSET = 23
|
||||
NODE_TYPE_SPECIFIC_BITS_OFFSET = 21
|
||||
};
|
||||
|
||||
// Make sure we have space for our bits
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
#define NS_EVENT_STATE_HIGHEST_SERVO_BIT 6
|
||||
|
||||
/**
|
||||
* EventStates is the class used to represent the event states of nsIContent
|
||||
* instances. These states are calculated by IntrinsicState() and
|
||||
@@ -24,7 +22,6 @@ class EventStates
|
||||
{
|
||||
public:
|
||||
typedef uint64_t InternalType;
|
||||
typedef uint8_t ServoType;
|
||||
|
||||
EventStates()
|
||||
: mStates(0)
|
||||
@@ -157,14 +154,6 @@ public:
|
||||
return mStates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to get the appropriate state representation for Servo.
|
||||
*/
|
||||
ServoType ServoValue() const
|
||||
{
|
||||
return mStates & ((1 << (NS_EVENT_STATE_HIGHEST_SERVO_BIT + 1)) - 1);
|
||||
}
|
||||
|
||||
private:
|
||||
InternalType mStates;
|
||||
};
|
||||
@@ -182,19 +171,6 @@ private:
|
||||
#define NS_DEFINE_EVENT_STATE_MACRO(_val) \
|
||||
(mozilla::EventStates(mozilla::EventStates::InternalType(1) << _val))
|
||||
|
||||
/*
|
||||
* In order to efficiently convert Gecko EventState values into Servo
|
||||
* ElementState values [1], we maintain the invariant that the low bits of
|
||||
* EventState can be masked off to form an ElementState (this works so
|
||||
* long as Servo never supports a state that Gecko doesn't).
|
||||
*
|
||||
* This is unfortunately rather fragile for now, but we should soon have
|
||||
* the infrastructure to statically-assert that these match up. If you
|
||||
* need to change these, please notify somebody involved with Stylo.
|
||||
*
|
||||
* [1] https://github.com/servo/servo/blob/master/components/style/element_state.rs
|
||||
*/
|
||||
|
||||
// Mouse is down on content.
|
||||
#define NS_EVENT_STATE_ACTIVE NS_DEFINE_EVENT_STATE_MACRO(0)
|
||||
// Content has focus.
|
||||
@@ -209,14 +185,6 @@ private:
|
||||
#define NS_EVENT_STATE_CHECKED NS_DEFINE_EVENT_STATE_MACRO(5)
|
||||
// Content is in the indeterminate state.
|
||||
#define NS_EVENT_STATE_INDETERMINATE NS_DEFINE_EVENT_STATE_MACRO(6)
|
||||
|
||||
/*
|
||||
* Bits below here do not have Servo-related ordering constraints.
|
||||
*
|
||||
* Remember to change NS_EVENT_STATE_HIGHEST_SERVO_BIT at the top of the file if
|
||||
* this changes!
|
||||
*/
|
||||
|
||||
// Drag is hovering over content.
|
||||
#define NS_EVENT_STATE_DRAGOVER NS_DEFINE_EVENT_STATE_MACRO(7)
|
||||
// Content is URL's target (ref).
|
||||
@@ -285,10 +253,14 @@ private:
|
||||
#define NS_EVENT_STATE_VULNERABLE_UPDATABLE NS_DEFINE_EVENT_STATE_MACRO(39)
|
||||
// Handler for click to play plugin (vulnerable w/no update)
|
||||
#define NS_EVENT_STATE_VULNERABLE_NO_UPDATE NS_DEFINE_EVENT_STATE_MACRO(40)
|
||||
// This bit is currently free.
|
||||
// #define NS_EVENT_STATE_?????????? NS_DEFINE_EVENT_STATE_MACRO(41)
|
||||
// Element is ltr (for :dir pseudo-class)
|
||||
#define NS_EVENT_STATE_LTR NS_DEFINE_EVENT_STATE_MACRO(42)
|
||||
// Element is rtl (for :dir pseudo-class)
|
||||
#define NS_EVENT_STATE_RTL NS_DEFINE_EVENT_STATE_MACRO(43)
|
||||
// This bit is currently free.
|
||||
// #define NS_EVENT_STATE_?????????? NS_DEFINE_EVENT_STATE_MACRO(44)
|
||||
// Element is highlighted (devtools inspector)
|
||||
#define NS_EVENT_STATE_DEVTOOLS_HIGHLIGHTED NS_DEFINE_EVENT_STATE_MACRO(45)
|
||||
// States for tracking the state of the "dir" attribute for HTML elements. We
|
||||
|
||||
Reference in New Issue
Block a user