Backed out changeset 01eff93538c8 (bug 1257208) for failing Reftest dir_auto-set-contained-dir-L.html and others. r=backout

This commit is contained in:
Sebastian Hengst 2016-03-23 18:35:20 +01:00
Родитель db2e8ee11d
Коммит 24a1f2b868
5 изменённых файлов: 28 добавлений и 36 удалений

Просмотреть файл

@ -386,7 +386,7 @@ GetDirectionFromText(const nsTextFragment* aFrag,
* know not to return it
* @return the text node containing the character that determined the direction
*/
static nsTextNode*
static nsINode*
WalkDescendantsSetDirectionFromText(Element* aElement, bool aNotify = true,
nsINode* aChangedNode = nullptr)
{
@ -412,7 +412,7 @@ WalkDescendantsSetDirectionFromText(Element* aElement, bool aNotify = true,
// We found a descendant text node with strong directional characters.
// Set the directionality of aElement to the corresponding value.
aElement->SetDirectionality(textNodeDir, aNotify);
return static_cast<nsTextNode*>(child);
return child;
}
}
child = child->GetNextNode(aElement);
@ -454,7 +454,7 @@ public:
MOZ_COUNT_DTOR(nsTextNodeDirectionalityMap);
}
void AddEntry(nsTextNode* aTextNode, Element* aElement)
void AddEntry(nsINode* aTextNode, Element* aElement)
{
if (!mElements.Contains(aElement)) {
mElements.Put(aElement);
@ -463,7 +463,7 @@ public:
}
}
void RemoveEntry(nsTextNode* aTextNode, Element* aElement)
void RemoveEntry(nsINode* aTextNode, Element* aElement)
{
NS_ASSERTION(mElements.Contains(aElement),
"element already removed from map");
@ -505,7 +505,7 @@ private:
// and remove the text node from the map
nsINode* oldTextNode = static_cast<Element*>(aData);
Element* rootNode = aEntry->GetKey();
nsTextNode* newTextNode = nullptr;
nsINode* newTextNode = nullptr;
if (rootNode->GetParentNode() && rootNode->HasDirAuto()) {
newTextNode = WalkDescendantsSetDirectionFromText(rootNode, true,
oldTextNode);
@ -545,14 +545,14 @@ public:
MOZ_ASSERT(clearedEntries == 0, "Map should be empty already");
}
static void RemoveElementFromMap(nsTextNode* aTextNode, Element* aElement)
static void RemoveElementFromMap(nsINode* aTextNode, Element* aElement)
{
if (aTextNode->HasTextNodeDirectionalityMap()) {
GetDirectionalityMap(aTextNode)->RemoveEntry(aTextNode, aElement);
}
}
static void AddEntryToMap(nsTextNode* aTextNode, Element* aElement)
static void AddEntryToMap(nsINode* aTextNode, Element* aElement)
{
nsTextNodeDirectionalityMap* map = GetDirectionalityMap(aTextNode);
if (!map) {
@ -570,8 +570,8 @@ public:
return GetDirectionalityMap(aTextNode)->UpdateAutoDirection(aDir);
}
static void ResetTextNodeDirection(nsTextNode* aTextNode,
nsTextNode* aChangedTextNode)
static void ResetTextNodeDirection(nsINode* aTextNode,
nsINode* aChangedTextNode)
{
MOZ_ASSERT(aTextNode->HasTextNodeDirectionalityMap(),
"Map missing in ResetTextNodeDirection");
@ -645,7 +645,7 @@ SetDirectionalityOnDescendants(Element* aElement, Directionality aDir,
void
WalkAncestorsResetAutoDirection(Element* aElement, bool aNotify)
{
nsTextNode* setByNode;
nsINode* setByNode;
Element* parent = aElement->GetParentElement();
while (parent && parent->NodeOrAncestorHasDirAuto()) {
@ -655,7 +655,7 @@ WalkAncestorsResetAutoDirection(Element* aElement, bool aNotify)
// Remove it from the map and reset its direction by the downward
// propagation algorithm
setByNode =
static_cast<nsTextNode*>(parent->GetProperty(nsGkAtoms::dirAutoSetBy));
static_cast<nsINode*>(parent->GetProperty(nsGkAtoms::dirAutoSetBy));
if (setByNode) {
nsTextNodeDirectionalityMap::RemoveElementFromMap(setByNode, parent);
}
@ -681,9 +681,8 @@ WalkDescendantsResetAutoDirection(Element* aElement)
continue;
}
if (child->IsNodeOfType(nsIDOMNode::TEXT_NODE) &&
child->HasTextNodeDirectionalityMap()) {
nsTextNodeDirectionalityMap::ResetTextNodeDirection(static_cast<nsTextNode*>(child), nullptr);
if (child->HasTextNodeDirectionalityMap()) {
nsTextNodeDirectionalityMap::ResetTextNodeDirection(child, nullptr);
nsTextNodeDirectionalityMap::EnsureMapIsClearFor(child);
}
child = child->GetNextNode(aElement);
@ -726,7 +725,7 @@ WalkDescendantsSetDirAuto(Element* aElement, bool aNotify)
}
}
nsTextNode* textNode = WalkDescendantsSetDirectionFromText(aElement, aNotify);
nsINode* textNode = WalkDescendantsSetDirectionFromText(aElement, aNotify);
if (textNode) {
nsTextNodeDirectionalityMap::AddEntryToMap(textNode, aElement);
}
@ -747,7 +746,7 @@ WalkDescendantsClearAncestorDirAuto(Element* aElement)
}
}
void SetAncestorDirectionIfAuto(nsTextNode* aTextNode, Directionality aDir,
void SetAncestorDirectionIfAuto(nsINode* aTextNode, Directionality aDir,
bool aNotify = true)
{
MOZ_ASSERT(aTextNode->NodeType() == nsIDOMNode::TEXT_NODE,
@ -761,8 +760,8 @@ void SetAncestorDirectionIfAuto(nsTextNode* aTextNode, Directionality aDir,
if (parent->HasDirAuto()) {
bool resetDirection = false;
nsTextNode* directionWasSetByTextNode =
static_cast<nsTextNode*>(parent->GetProperty(nsGkAtoms::dirAutoSetBy));
nsINode* directionWasSetByTextNode =
static_cast<nsINode*>(parent->GetProperty(nsGkAtoms::dirAutoSetBy));
if (!parent->HasDirAutoSet()) {
// Fast path if parent's direction is not yet set by any descendant
@ -833,7 +832,7 @@ TextNodeWillChangeDirection(nsIContent* aTextNode, Directionality* aOldDir,
}
void
TextNodeChangedDirection(nsTextNode* aTextNode, Directionality aOldDir,
TextNodeChangedDirection(nsIContent* aTextNode, Directionality aOldDir,
bool aNotify)
{
Directionality newDir = GetDirectionFromText(aTextNode->GetText());
@ -863,7 +862,7 @@ TextNodeChangedDirection(nsTextNode* aTextNode, Directionality aOldDir,
}
void
SetDirectionFromNewTextNode(nsTextNode* aTextNode)
SetDirectionFromNewTextNode(nsIContent* aTextNode)
{
if (!NodeAffectsDirAutoAncestor(aTextNode)) {
return;
@ -950,8 +949,8 @@ OnSetDirAttr(Element* aElement, const nsAttrValue* aNewValue,
WalkDescendantsSetDirAuto(aElement, aNotify);
} else {
if (aElement->HasDirAutoSet()) {
nsTextNode* setByNode =
static_cast<nsTextNode*>(aElement->GetProperty(nsGkAtoms::dirAutoSetBy));
nsINode* setByNode =
static_cast<nsINode*>(aElement->GetProperty(nsGkAtoms::dirAutoSetBy));
nsTextNodeDirectionalityMap::RemoveElementFromMap(setByNode, aElement);
}
SetDirectionalityOnDescendants(aElement,
@ -1002,8 +1001,8 @@ SetDirOnBind(mozilla::dom::Element* aElement, nsIContent* aParent)
void ResetDir(mozilla::dom::Element* aElement)
{
if (aElement->HasDirAutoSet()) {
nsTextNode* setByNode =
static_cast<nsTextNode*>(aElement->GetProperty(nsGkAtoms::dirAutoSetBy));
nsINode* setByNode =
static_cast<nsINode*>(aElement->GetProperty(nsGkAtoms::dirAutoSetBy));
nsTextNodeDirectionalityMap::RemoveElementFromMap(setByNode, aElement);
}

Просмотреть файл

@ -89,14 +89,14 @@ bool TextNodeWillChangeDirection(nsIContent* aTextNode, Directionality* aOldDir,
* After the contents of a text node have changed, change the directionality
* of any elements whose directionality is determined by that node
*/
void TextNodeChangedDirection(nsTextNode* aTextNode, Directionality aOldDir,
void TextNodeChangedDirection(nsIContent* aTextNode, Directionality aOldDir,
bool aNotify);
/**
* When a text node is appended to an element, find any ancestors with dir=auto
* whose directionality will be determined by the text node
*/
void SetDirectionFromNewTextNode(nsTextNode* aTextNode);
void SetDirectionFromNewTextNode(nsIContent* aTextNode);
/**
* When a text node is removed from a document, find any ancestors whose

Просмотреть файл

@ -371,10 +371,7 @@ nsGenericDOMDataNode::SetTextInternal(uint32_t aOffset, uint32_t aCount,
}
if (dirAffectsAncestor) {
// 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);
TextNodeChangedDirection(this, oldDir, aNotify);
}
// Notify observers

Просмотреть файл

@ -1624,11 +1624,8 @@ public:
"ClearHasTextNodeDirectionalityMap on non-text node");
ClearBoolFlag(NodeHasTextNodeDirectionalityMap);
}
bool HasTextNodeDirectionalityMap() const {
MOZ_ASSERT(NodeType() == nsIDOMNode::TEXT_NODE,
"HasTextNodeDirectionalityMap on non-text node");
return GetBoolFlag(NodeHasTextNodeDirectionalityMap);
}
bool HasTextNodeDirectionalityMap() const
{ return GetBoolFlag(NodeHasTextNodeDirectionalityMap); }
void SetHasDirAuto() { SetBoolFlag(NodeHasDirAuto); }
void ClearHasDirAuto() { ClearBoolFlag(NodeHasDirAuto); }

Просмотреть файл

@ -49,7 +49,6 @@ public:
// nsIDOMNode
NS_FORWARD_NSIDOMNODE_TO_NSINODE
using mozilla::dom::Text::GetParentElement;
// nsIDOMCharacterData
NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)