mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-06-25 20:29:33 +00:00
M1257208 Fix build errors with gcc >= 5
This commit is contained in:
parent
cd6a7ba6c8
commit
4c64d8d6d7
|
@ -387,7 +387,7 @@ GetDirectionFromText(const nsTextFragment* aFrag,
|
||||||
* know not to return it
|
* know not to return it
|
||||||
* @return the text node containing the character that determined the direction
|
* @return the text node containing the character that determined the direction
|
||||||
*/
|
*/
|
||||||
static nsINode*
|
static nsTextNode*
|
||||||
WalkDescendantsSetDirectionFromText(Element* aElement, bool aNotify = true,
|
WalkDescendantsSetDirectionFromText(Element* aElement, bool aNotify = true,
|
||||||
nsINode* aChangedNode = nullptr)
|
nsINode* aChangedNode = nullptr)
|
||||||
{
|
{
|
||||||
|
@ -413,7 +413,7 @@ WalkDescendantsSetDirectionFromText(Element* aElement, bool aNotify = true,
|
||||||
// We found a descendant text node with strong directional characters.
|
// We found a descendant text node with strong directional characters.
|
||||||
// Set the directionality of aElement to the corresponding value.
|
// Set the directionality of aElement to the corresponding value.
|
||||||
aElement->SetDirectionality(textNodeDir, aNotify);
|
aElement->SetDirectionality(textNodeDir, aNotify);
|
||||||
return child;
|
return static_cast<nsTextNode*>(child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
child = child->GetNextNode(aElement);
|
child = child->GetNextNode(aElement);
|
||||||
|
@ -471,7 +471,7 @@ public:
|
||||||
NS_RELEASE(textNode);
|
NS_RELEASE(textNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddEntry(nsINode* aTextNode, Element* aElement)
|
void AddEntry(nsTextNode* aTextNode, Element* aElement)
|
||||||
{
|
{
|
||||||
if (!mElements.Contains(aElement)) {
|
if (!mElements.Contains(aElement)) {
|
||||||
mElements.Put(aElement);
|
mElements.Put(aElement);
|
||||||
|
@ -482,7 +482,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveEntry(nsINode* aTextNode, Element* aElement)
|
void RemoveEntry(nsTextNode* aTextNode, Element* aElement)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(mElements.Contains(aElement),
|
NS_ASSERTION(mElements.Contains(aElement),
|
||||||
"element already removed from map");
|
"element already removed from map");
|
||||||
|
@ -542,7 +542,7 @@ private:
|
||||||
static_cast<nsTextNodeDirectionalityMapAndElement*>(aData);
|
static_cast<nsTextNodeDirectionalityMapAndElement*>(aData);
|
||||||
nsINode* oldTextNode = data->mNode;
|
nsINode* oldTextNode = data->mNode;
|
||||||
Element* rootNode = aEntry->GetKey();
|
Element* rootNode = aEntry->GetKey();
|
||||||
nsINode* newTextNode = nullptr;
|
nsTextNode* newTextNode = nullptr;
|
||||||
if (rootNode->GetParentNode() && rootNode->HasDirAuto()) {
|
if (rootNode->GetParentNode() && rootNode->HasDirAuto()) {
|
||||||
newTextNode = WalkDescendantsSetDirectionFromText(rootNode, true,
|
newTextNode = WalkDescendantsSetDirectionFromText(rootNode, true,
|
||||||
oldTextNode);
|
oldTextNode);
|
||||||
|
@ -600,14 +600,14 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void RemoveElementFromMap(nsINode* aTextNode, Element* aElement)
|
static void RemoveElementFromMap(nsTextNode* aTextNode, Element* aElement)
|
||||||
{
|
{
|
||||||
if (aTextNode->HasTextNodeDirectionalityMap()) {
|
if (aTextNode->HasTextNodeDirectionalityMap()) {
|
||||||
GetDirectionalityMap(aTextNode)->RemoveEntry(aTextNode, aElement);
|
GetDirectionalityMap(aTextNode)->RemoveEntry(aTextNode, aElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddEntryToMap(nsINode* aTextNode, Element* aElement)
|
static void AddEntryToMap(nsTextNode* aTextNode, Element* aElement)
|
||||||
{
|
{
|
||||||
nsTextNodeDirectionalityMap* map = GetDirectionalityMap(aTextNode);
|
nsTextNodeDirectionalityMap* map = GetDirectionalityMap(aTextNode);
|
||||||
if (!map) {
|
if (!map) {
|
||||||
|
@ -625,8 +625,8 @@ public:
|
||||||
return GetDirectionalityMap(aTextNode)->UpdateAutoDirection(aDir);
|
return GetDirectionalityMap(aTextNode)->UpdateAutoDirection(aDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ResetTextNodeDirection(nsINode* aTextNode,
|
static void ResetTextNodeDirection(nsTextNode* aTextNode,
|
||||||
nsINode* aChangedTextNode)
|
nsTextNode* aChangedTextNode)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aTextNode->HasTextNodeDirectionalityMap(),
|
MOZ_ASSERT(aTextNode->HasTextNodeDirectionalityMap(),
|
||||||
"Map missing in ResetTextNodeDirection");
|
"Map missing in ResetTextNodeDirection");
|
||||||
|
@ -701,7 +701,7 @@ SetDirectionalityOnDescendants(Element* aElement, Directionality aDir,
|
||||||
void
|
void
|
||||||
WalkAncestorsResetAutoDirection(Element* aElement, bool aNotify)
|
WalkAncestorsResetAutoDirection(Element* aElement, bool aNotify)
|
||||||
{
|
{
|
||||||
nsINode* setByNode;
|
nsTextNode* setByNode;
|
||||||
Element* parent = aElement->GetParentElement();
|
Element* parent = aElement->GetParentElement();
|
||||||
|
|
||||||
while (parent && parent->NodeOrAncestorHasDirAuto()) {
|
while (parent && parent->NodeOrAncestorHasDirAuto()) {
|
||||||
|
@ -711,7 +711,7 @@ WalkAncestorsResetAutoDirection(Element* aElement, bool aNotify)
|
||||||
// Remove it from the map and reset its direction by the downward
|
// Remove it from the map and reset its direction by the downward
|
||||||
// propagation algorithm
|
// propagation algorithm
|
||||||
setByNode =
|
setByNode =
|
||||||
static_cast<nsINode*>(parent->GetProperty(nsGkAtoms::dirAutoSetBy));
|
static_cast<nsTextNode*>(parent->GetProperty(nsGkAtoms::dirAutoSetBy));
|
||||||
if (setByNode) {
|
if (setByNode) {
|
||||||
nsTextNodeDirectionalityMap::RemoveElementFromMap(setByNode, parent);
|
nsTextNodeDirectionalityMap::RemoveElementFromMap(setByNode, parent);
|
||||||
}
|
}
|
||||||
|
@ -737,11 +737,9 @@ WalkDescendantsResetAutoDirection(Element* aElement)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (child->HasTextNodeDirectionalityMap()) {
|
if (child->NodeType() == nsIDOMNode::TEXT_NODE &&
|
||||||
nsTextNodeDirectionalityMap::ResetTextNodeDirection(child, nullptr);
|
child->HasTextNodeDirectionalityMap()) {
|
||||||
// Don't call nsTextNodeDirectionalityMap::EnsureMapIsClearFor(child)
|
nsTextNodeDirectionalityMap::ResetTextNodeDirection(static_cast<nsTextNode*>(child), nullptr);
|
||||||
// since ResetTextNodeDirection may have kept elements in child's
|
|
||||||
// DirectionalityMap.
|
|
||||||
}
|
}
|
||||||
child = child->GetNextNode(aElement);
|
child = child->GetNextNode(aElement);
|
||||||
}
|
}
|
||||||
|
@ -783,7 +781,7 @@ WalkDescendantsSetDirAuto(Element* aElement, bool aNotify)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsINode* textNode = WalkDescendantsSetDirectionFromText(aElement, aNotify);
|
nsTextNode* textNode = WalkDescendantsSetDirectionFromText(aElement, aNotify);
|
||||||
if (textNode) {
|
if (textNode) {
|
||||||
nsTextNodeDirectionalityMap::AddEntryToMap(textNode, aElement);
|
nsTextNodeDirectionalityMap::AddEntryToMap(textNode, aElement);
|
||||||
}
|
}
|
||||||
|
@ -804,7 +802,7 @@ WalkDescendantsClearAncestorDirAuto(Element* aElement)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetAncestorDirectionIfAuto(nsINode* aTextNode, Directionality aDir,
|
void SetAncestorDirectionIfAuto(nsTextNode* aTextNode, Directionality aDir,
|
||||||
bool aNotify = true)
|
bool aNotify = true)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aTextNode->NodeType() == nsIDOMNode::TEXT_NODE,
|
MOZ_ASSERT(aTextNode->NodeType() == nsIDOMNode::TEXT_NODE,
|
||||||
|
@ -818,8 +816,8 @@ void SetAncestorDirectionIfAuto(nsINode* aTextNode, Directionality aDir,
|
||||||
|
|
||||||
if (parent->HasDirAuto()) {
|
if (parent->HasDirAuto()) {
|
||||||
bool resetDirection = false;
|
bool resetDirection = false;
|
||||||
nsINode* directionWasSetByTextNode =
|
nsTextNode* directionWasSetByTextNode =
|
||||||
static_cast<nsINode*>(parent->GetProperty(nsGkAtoms::dirAutoSetBy));
|
static_cast<nsTextNode*>(parent->GetProperty(nsGkAtoms::dirAutoSetBy));
|
||||||
|
|
||||||
if (!parent->HasDirAutoSet()) {
|
if (!parent->HasDirAutoSet()) {
|
||||||
// Fast path if parent's direction is not yet set by any descendant
|
// Fast path if parent's direction is not yet set by any descendant
|
||||||
|
@ -890,7 +888,7 @@ TextNodeWillChangeDirection(nsIContent* aTextNode, Directionality* aOldDir,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TextNodeChangedDirection(nsIContent* aTextNode, Directionality aOldDir,
|
TextNodeChangedDirection(nsTextNode* aTextNode, Directionality aOldDir,
|
||||||
bool aNotify)
|
bool aNotify)
|
||||||
{
|
{
|
||||||
Directionality newDir = GetDirectionFromText(aTextNode->GetText());
|
Directionality newDir = GetDirectionFromText(aTextNode->GetText());
|
||||||
|
@ -920,7 +918,7 @@ TextNodeChangedDirection(nsIContent* aTextNode, Directionality aOldDir,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
SetDirectionFromNewTextNode(nsIContent* aTextNode)
|
SetDirectionFromNewTextNode(nsTextNode* aTextNode)
|
||||||
{
|
{
|
||||||
if (!NodeAffectsDirAutoAncestor(aTextNode)) {
|
if (!NodeAffectsDirAutoAncestor(aTextNode)) {
|
||||||
return;
|
return;
|
||||||
|
@ -1007,8 +1005,8 @@ OnSetDirAttr(Element* aElement, const nsAttrValue* aNewValue,
|
||||||
WalkDescendantsSetDirAuto(aElement, aNotify);
|
WalkDescendantsSetDirAuto(aElement, aNotify);
|
||||||
} else {
|
} else {
|
||||||
if (aElement->HasDirAutoSet()) {
|
if (aElement->HasDirAutoSet()) {
|
||||||
nsINode* setByNode =
|
nsTextNode* setByNode =
|
||||||
static_cast<nsINode*>(aElement->GetProperty(nsGkAtoms::dirAutoSetBy));
|
static_cast<nsTextNode*>(aElement->GetProperty(nsGkAtoms::dirAutoSetBy));
|
||||||
nsTextNodeDirectionalityMap::RemoveElementFromMap(setByNode, aElement);
|
nsTextNodeDirectionalityMap::RemoveElementFromMap(setByNode, aElement);
|
||||||
}
|
}
|
||||||
SetDirectionalityOnDescendants(aElement,
|
SetDirectionalityOnDescendants(aElement,
|
||||||
|
|
|
@ -89,14 +89,14 @@ bool TextNodeWillChangeDirection(nsIContent* aTextNode, Directionality* aOldDir,
|
||||||
* After the contents of a text node have changed, change the directionality
|
* After the contents of a text node have changed, change the directionality
|
||||||
* of any elements whose directionality is determined by that node
|
* of any elements whose directionality is determined by that node
|
||||||
*/
|
*/
|
||||||
void TextNodeChangedDirection(nsIContent* aTextNode, Directionality aOldDir,
|
void TextNodeChangedDirection(nsTextNode* aTextNode, Directionality aOldDir,
|
||||||
bool aNotify);
|
bool aNotify);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When a text node is appended to an element, find any ancestors with dir=auto
|
* When a text node is appended to an element, find any ancestors with dir=auto
|
||||||
* whose directionality will be determined by the text node
|
* whose directionality will be determined by the text node
|
||||||
*/
|
*/
|
||||||
void SetDirectionFromNewTextNode(nsIContent* aTextNode);
|
void SetDirectionFromNewTextNode(nsTextNode* aTextNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When a text node is removed from a document, find any ancestors whose
|
* When a text node is removed from a document, find any ancestors whose
|
||||||
|
|
|
@ -371,7 +371,10 @@ nsGenericDOMDataNode::SetTextInternal(uint32_t aOffset, uint32_t aCount,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirAffectsAncestor) {
|
if (dirAffectsAncestor) {
|
||||||
TextNodeChangedDirection(this, oldDir, aNotify);
|
// dirAffectsAncestor being true implies that we have a text node, see
|
||||||
|
// above.
|
||||||
|
MOZ_ASSERT(NodeType() == nsIDOMNode::TEXT_NODE);
|
||||||
|
TextNodeChangedDirection(static_cast<nsTextNode*>(this), oldDir, aNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify observers
|
// Notify observers
|
||||||
|
|
|
@ -1621,8 +1621,11 @@ public:
|
||||||
"ClearHasTextNodeDirectionalityMap on non-text node");
|
"ClearHasTextNodeDirectionalityMap on non-text node");
|
||||||
ClearBoolFlag(NodeHasTextNodeDirectionalityMap);
|
ClearBoolFlag(NodeHasTextNodeDirectionalityMap);
|
||||||
}
|
}
|
||||||
bool HasTextNodeDirectionalityMap() const
|
bool HasTextNodeDirectionalityMap() const {
|
||||||
{ return GetBoolFlag(NodeHasTextNodeDirectionalityMap); }
|
MOZ_ASSERT(NodeType() == nsIDOMNode::TEXT_NODE,
|
||||||
|
"HasTextNodeDirectionalityMap on non-text node");
|
||||||
|
return GetBoolFlag(NodeHasTextNodeDirectionalityMap);
|
||||||
|
}
|
||||||
|
|
||||||
void SetHasDirAuto() { SetBoolFlag(NodeHasDirAuto); }
|
void SetHasDirAuto() { SetBoolFlag(NodeHasDirAuto); }
|
||||||
void ClearHasDirAuto() { ClearBoolFlag(NodeHasDirAuto); }
|
void ClearHasDirAuto() { ClearBoolFlag(NodeHasDirAuto); }
|
||||||
|
|
|
@ -49,6 +49,7 @@ public:
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||||
|
using mozilla::dom::Text::GetParentElement;
|
||||||
|
|
||||||
// nsIDOMCharacterData
|
// nsIDOMCharacterData
|
||||||
NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
|
NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user