mirror of
https://github.com/roytam1/mozilla45esr.git
synced 2026-05-26 06:25:03 +00:00
50ff970e7e
- #375, Bug 1112537 - Optimize String#split('foo').join('bar') pattern. (includes M1235403) r=nbp (36326dfa2) - #415: M1373195 backport (e880223af) - #415: M1376936 M1375331 (33344c644) - #415: M1348095 (consolidated) (d1001e7ef) - #413: update to HTML colspan/rowspan from M1359822, plus M1271126 + M1373095 (no tests) (6958789e8) - #416: M1366903 M1371283 M1368576 (baaf2ee89) - #416: M1368105 (1efa1540f) - checkin additional JS tests (687ba7579) - #416: M1374047 M1365413 M1369913 M1371424 M1346590 M1376087 M1322896 M1354796 M1365333 M1373970 M1355168 (1bc1dd390) - #416: M1265568 M1305036 (257cfd929) - #419: M1377329 (fb72079d0) - #418: M1333106 M1337672 (b1cfd7830) - #416: M1362924 (61ec43889) - #416: M1365189 M1365875 (d9876efcf) - #416: M1378147 M1371890 M1380426 (177c87d34) - #416: note to self on M1377426 (5bcd1c461) - fix debug bustage, shutdown crash (be4d0ed86) - #414: new wildcard based blacklist, updated strings (6ccb443e7) - #416: update certs/pins (797260262) - fix FontDirWrapper off-by-one bugs and warnings (51e6a2cf9) - 104fx_copy should also allow copying debug builds (054bbf081) - #416: M1383000 M1376459 M1372467 M1372383 M1383002 (2f4742e52) - #416: M1308908 M1342433(no tests) (5757a9534) - #416: M1368362 (1cf170047) - #72: additional debugging (0683827d2) - #416: M1381016 M1371657 (afc820240) - #416: update certs for FPR2 final (4ca64d74e) - M1257208 Fix build errors with gcc >= 5 (4c64d8d6d) with additional nsINode* to nsTextNode* change in ResetDir() in DirectionalityUtils.cpp
147 lines
5.2 KiB
C++
147 lines
5.2 KiB
C++
/* -*- 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/. */
|
|
|
|
#ifndef DirectionalityUtils_h___
|
|
#define DirectionalityUtils_h___
|
|
|
|
#include "nscore.h"
|
|
|
|
class nsIContent;
|
|
class nsAString;
|
|
class nsAttrValue;
|
|
class nsTextNode;
|
|
|
|
namespace mozilla {
|
|
namespace dom {
|
|
class Element;
|
|
} // namespace dom
|
|
} // namespace mozilla
|
|
|
|
namespace mozilla {
|
|
|
|
enum Directionality {
|
|
eDir_NotSet,
|
|
eDir_RTL,
|
|
eDir_LTR,
|
|
eDir_Auto
|
|
};
|
|
|
|
/**
|
|
* Set the directionality of an element according to the algorithm defined at
|
|
* http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#the-directionality,
|
|
* not including elements with auto direction.
|
|
*
|
|
* @return the directionality that the element was set to
|
|
*/
|
|
Directionality RecomputeDirectionality(mozilla::dom::Element* aElement,
|
|
bool aNotify = true);
|
|
|
|
/**
|
|
* Set the directionality of any descendants of a node that do not themselves
|
|
* have a dir attribute.
|
|
* For performance reasons we walk down the descendant tree in the rare case
|
|
* of setting the dir attribute, rather than walking up the ancestor tree in
|
|
* the much more common case of getting the element's directionality.
|
|
*/
|
|
void SetDirectionalityOnDescendants(mozilla::dom::Element* aElement,
|
|
Directionality aDir,
|
|
bool aNotify = true);
|
|
|
|
/**
|
|
* Walk the descendants of a node in tree order and, for any text node
|
|
* descendant that determines the directionality of some element and is not a
|
|
* descendant of another descendant of the original node with dir=auto,
|
|
* redetermine that element's directionality
|
|
*/
|
|
void WalkDescendantsResetAutoDirection(mozilla::dom::Element* aElement);
|
|
|
|
/**
|
|
* After setting dir=auto on an element, walk its descendants in tree order.
|
|
* If the node doesn't have the NODE_ANCESTOR_HAS_DIR_AUTO flag, set the
|
|
* NODE_ANCESTOR_HAS_DIR_AUTO flag on all of its descendants.
|
|
* Resolve the directionality of the element by the "downward propagation
|
|
* algorithm" (defined in section 3 in the comments at the beginning of
|
|
* DirectionalityUtils.cpp)
|
|
*/
|
|
void WalkDescendantsSetDirAuto(mozilla::dom::Element* aElement,
|
|
bool aNotify = true);
|
|
|
|
/**
|
|
* After unsetting dir=auto on an element, walk its descendants in tree order,
|
|
* skipping any that have dir=auto themselves, and unset the
|
|
* NODE_ANCESTOR_HAS_DIR_AUTO flag
|
|
*/
|
|
void WalkDescendantsClearAncestorDirAuto(mozilla::dom::Element* aElement);
|
|
|
|
/**
|
|
* When the contents of a text node are about to change, retrieve the current
|
|
* directionality of the text
|
|
*
|
|
* @return whether the text node affects the directionality of any element
|
|
*/
|
|
bool TextNodeWillChangeDirection(nsIContent* aTextNode, Directionality* aOldDir,
|
|
uint32_t aOffset);
|
|
|
|
/**
|
|
* 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,
|
|
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);
|
|
|
|
/**
|
|
* When a text node is removed from a document, find any ancestors whose
|
|
* directionality it determined and redetermine their directionality
|
|
*
|
|
* @param aTextNode the text node
|
|
*/
|
|
void ResetDirectionSetByTextNode(nsTextNode* aTextNode);
|
|
|
|
/**
|
|
* Set the directionality of an element according to the directionality of the
|
|
* text in aValue
|
|
*/
|
|
void SetDirectionalityFromValue(mozilla::dom::Element* aElement,
|
|
const nsAString& aValue,
|
|
bool aNotify);
|
|
|
|
/**
|
|
* Called when setting the dir attribute on an element, immediately after
|
|
* AfterSetAttr. This is instead of using BeforeSetAttr or AfterSetAttr, because
|
|
* in AfterSetAttr we don't know the old value, so we can't identify all cases
|
|
* where we need to walk up or down the document tree and reset the direction;
|
|
* and in BeforeSetAttr we can't do the walk because this element hasn't had the
|
|
* value set yet so the results will be wrong.
|
|
*/
|
|
void OnSetDirAttr(mozilla::dom::Element* aElement,
|
|
const nsAttrValue* aNewValue,
|
|
bool hadValidDir,
|
|
bool hadDirAuto,
|
|
bool aNotify);
|
|
|
|
/**
|
|
* Called when binding a new element to the tree, to set the
|
|
* NodeAncestorHasDirAuto flag and set the direction of the element and its
|
|
* ancestors if necessary
|
|
*/
|
|
void SetDirOnBind(mozilla::dom::Element* aElement, nsIContent* aParent);
|
|
|
|
/**
|
|
* Called when unbinding an element from the tree, to recompute the
|
|
* directionality of the element if it doesn't have autodirection, and to
|
|
* clean up any entries in nsTextDirectionalityMap that refer to it.
|
|
*/
|
|
void ResetDir(mozilla::dom::Element* aElement);
|
|
} // end namespace mozilla
|
|
|
|
#endif /* DirectionalityUtils_h___ */
|