Commit bbe83925 authored by Cristian Tuns's avatar Cristian Tuns
Browse files

Backed out 2 changesets (bug 1737694) for causing web platform tests failures...

Backed out 2 changesets (bug 1737694) for causing web platform tests failures on autocapitalize.html CLOSED TREE

Backed out changeset cbfc81505f1a (bug 1737694)
Backed out changeset c2f44297bd03 (bug 1737694)
parent 731e590e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -4627,6 +4627,16 @@ void nsContentUtils::UnregisterShutdownObserver(nsIObserver* aObserver) {
  }
}

/* static */
bool nsContentUtils::HasNonEmptyAttr(const nsIContent* aContent,
                                     int32_t aNameSpaceID, nsAtom* aName) {
  static Element::AttrValuesArray strings[] = {nsGkAtoms::_empty, nullptr};
  return aContent->IsElement() &&
         aContent->AsElement()->FindAttrValueIn(aNameSpaceID, aName, strings,
                                                eCaseMatters) ==
             Element::ATTR_VALUE_NO_MATCH;
}

/* static */
bool nsContentUtils::HasMutationListeners(nsINode* aNode, uint32_t aType,
                                          nsINode* aTargetForSubtreeModified) {
+7 −0
Original line number Diff line number Diff line
@@ -859,6 +859,13 @@ class nsContentUtils {
  static void RegisterShutdownObserver(nsIObserver* aObserver);
  static void UnregisterShutdownObserver(nsIObserver* aObserver);

  /**
   * @return true if aContent has an attribute aName in namespace aNameSpaceID,
   * and the attribute value is non-empty.
   */
  static bool HasNonEmptyAttr(const nsIContent* aContent, int32_t aNameSpaceID,
                              nsAtom* aName);

  /**
   * Method that gets the primary presContext for the node.
   *
+5 −4
Original line number Diff line number Diff line
@@ -1668,8 +1668,9 @@ void EventStateManager::CreateClickHoldTimer(nsPresContext* inPresContext,

  // if content clicked on has a popup, don't even start the timer
  // since we'll end up conflicting and both will show.
  if (mGestureDownContent && mGestureDownContent->IsElement() &&
      mGestureDownContent->AsElement()->HasNonEmptyAttr(nsGkAtoms::popup)) {
  if (mGestureDownContent &&
      nsContentUtils::HasNonEmptyAttr(mGestureDownContent, kNameSpaceID_None,
                                      nsGkAtoms::popup)) {
    return;
  }

@@ -1763,8 +1764,8 @@ void EventStateManager::FireContextClick() {
    } else if (mGestureDownContent->IsXULElement(nsGkAtoms::toolbarbutton)) {
      // a <toolbarbutton> that has the container attribute set
      // will already have its own dropdown.
      if (mGestureDownContent->AsElement()->HasNonEmptyAttr(
              nsGkAtoms::container)) {
      if (nsContentUtils::HasNonEmptyAttr(
              mGestureDownContent, kNameSpaceID_None, nsGkAtoms::container)) {
        allowedToDispatch = false;
      } else {
        // If the toolbar button has an open menu, don't attempt to open
+2 −1
Original line number Diff line number Diff line
@@ -180,7 +180,8 @@ void HTMLLinkElement::CreateAndDispatchEvent(Document* aDoc,
  static Element::AttrValuesArray strings[] = {nsGkAtoms::_empty,
                                               nsGkAtoms::stylesheet, nullptr};

  if (!HasNonEmptyAttr(nsGkAtoms::rev) &&
  if (!nsContentUtils::HasNonEmptyAttr(this, kNameSpaceID_None,
                                       nsGkAtoms::rev) &&
      FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::rel, strings,
                      eIgnoreCase) != ATTR_VALUE_NO_MATCH)
    return;
+6 −3
Original line number Diff line number Diff line
@@ -1739,7 +1739,8 @@ void nsGenericHTMLFormElement::UnbindFromTree(bool aNullParent) {

    // We have to remove the form id observer if there was one.
    // We will re-add one later if needed (during bind to tree).
    if (HasNonEmptyAttr(nsGkAtoms::form)) {
    if (nsContentUtils::HasNonEmptyAttr(this, kNameSpaceID_None,
                                        nsGkAtoms::form)) {
      RemoveFormIdObserver();
    }
  }
@@ -1786,7 +1787,8 @@ nsresult nsGenericHTMLFormElement::BeforeSetAttr(
    if (aName == nsGkAtoms::form) {
      // If @form isn't set or set to the empty string, there were no observer
      // so we don't have to remove it.
      if (HasNonEmptyAttr(nsGkAtoms::form)) {
      if (nsContentUtils::HasNonEmptyAttr(this, kNameSpaceID_None,
                                          nsGkAtoms::form)) {
        // The current form id observer is no longer needed.
        // A new one may be added in AfterSetAttr.
        RemoveFormIdObserver();
@@ -2469,7 +2471,8 @@ void nsGenericHTMLFormControlElement::UnbindFromTree(bool aNullParent) {

void nsGenericHTMLFormControlElement::GetAutocapitalize(
    nsAString& aValue) const {
  if (HasNonEmptyAttr(nsGkAtoms::autocapitalize)) {
  if (nsContentUtils::HasNonEmptyAttr(this, kNameSpaceID_None,
                                      nsGkAtoms::autocapitalize)) {
    nsGenericHTMLFormElement::GetAutocapitalize(aValue);
    return;
  }
Loading