diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 05:50:47 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2020-04-17 05:50:47 -0400 |
commit | 4d1d777e706322cb9aca8ed2d5a6e50b805d3bd1 (patch) | |
tree | 1cea0ad854fb25e536caf93f240258eebfb3aea8 /dom/base/nsINode.h | |
parent | 32e8155127126c187ce32f7368742057bcaf69da (diff) | |
download | UXP-4d1d777e706322cb9aca8ed2d5a6e50b805d3bd1.tar UXP-4d1d777e706322cb9aca8ed2d5a6e50b805d3bd1.tar.gz UXP-4d1d777e706322cb9aca8ed2d5a6e50b805d3bd1.tar.lz UXP-4d1d777e706322cb9aca8ed2d5a6e50b805d3bd1.tar.xz UXP-4d1d777e706322cb9aca8ed2d5a6e50b805d3bd1.zip |
Bug 1373798 - Move HTML dir attribute state into event state flags
* Stop calling SetHasDirAuto/ClearHasDirAuto in input element code
* Introduce event state flags that track the state of an element's dir attribute
* Rewrite our existing checks for the state of the dir attr on top of the new event state flags
* Add pseudo-classes for matching on the dir attribute states
* Use the new dir attribute pseudoclasses in html.css
Tag #1375
Diffstat (limited to 'dom/base/nsINode.h')
-rw-r--r-- | dom/base/nsINode.h | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/dom/base/nsINode.h b/dom/base/nsINode.h index 0f882445f..7c3eb9134 100644 --- a/dom/base/nsINode.h +++ b/dom/base/nsINode.h @@ -1608,10 +1608,11 @@ private: NodeIsContent, // Set if the node has animations or transitions ElementHasAnimations, - // Set if node has a dir attribute with a valid value (ltr, rtl, or auto) + // Set if node has a dir attribute with a valid value (ltr, rtl, or auto). + // Note that we cannot compute this from the dir attribute event state + // flags, because we can't use those to distinguish + // <bdi dir="some-invalid-value"> and <bdi dir="auto">. NodeHasValidDirAttribute, - // Set if node has a dir attribute with a fixed value (ltr or rtl, NOT auto) - NodeHasFixedDir, // Set if the node has dir=auto and has a property pointing to the text // node that determines its direction NodeHasDirAutoSet, @@ -1619,8 +1620,6 @@ private: // and has a TextNodeDirectionalityMap property listing the elements whose // direction it determines. NodeHasTextNodeDirectionalityMap, - // Set if the node has dir=auto. - NodeHasDirAuto, // Set if a node in the node's parent chain has dir=auto. NodeAncestorHasDirAuto, // Set if the element is in the scope of a scoped style sheet; this flag is @@ -1715,17 +1714,6 @@ public: void SetHasValidDir() { SetBoolFlag(NodeHasValidDirAttribute); } void ClearHasValidDir() { ClearBoolFlag(NodeHasValidDirAttribute); } bool HasValidDir() const { return GetBoolFlag(NodeHasValidDirAttribute); } - void SetHasFixedDir() { - MOZ_ASSERT(NodeType() != nsIDOMNode::TEXT_NODE, - "SetHasFixedDir on text node"); - SetBoolFlag(NodeHasFixedDir); - } - void ClearHasFixedDir() { - MOZ_ASSERT(NodeType() != nsIDOMNode::TEXT_NODE, - "ClearHasFixedDir on text node"); - ClearBoolFlag(NodeHasFixedDir); - } - bool HasFixedDir() const { return GetBoolFlag(NodeHasFixedDir); } void SetHasDirAutoSet() { MOZ_ASSERT(NodeType() != nsIDOMNode::TEXT_NODE, "SetHasDirAutoSet on text node"); @@ -1754,16 +1742,12 @@ public: return GetBoolFlag(NodeHasTextNodeDirectionalityMap); } - void SetHasDirAuto() { SetBoolFlag(NodeHasDirAuto); } - void ClearHasDirAuto() { ClearBoolFlag(NodeHasDirAuto); } - bool HasDirAuto() const { return GetBoolFlag(NodeHasDirAuto); } - void SetAncestorHasDirAuto() { SetBoolFlag(NodeAncestorHasDirAuto); } void ClearAncestorHasDirAuto() { ClearBoolFlag(NodeAncestorHasDirAuto); } bool AncestorHasDirAuto() const { return GetBoolFlag(NodeAncestorHasDirAuto); } - bool NodeOrAncestorHasDirAuto() const - { return HasDirAuto() || AncestorHasDirAuto(); } + // Implemented in nsIContentInlines.h. + inline bool NodeOrAncestorHasDirAuto() const; void SetIsElementInStyleScope(bool aValue) { MOZ_ASSERT(IsElement(), "SetIsInStyleScope on a non-Element node"); |