~ubuntu-branches/ubuntu/precise/xulrunner-1.9/precise

« back to all changes in this revision

Viewing changes to mozilla/accessible/src/base/nsAccessibilityUtils.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2008-12-16 18:40:18 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20081216184018-j646ukfhzxnjynix
Tags: 1.9.0.5+nobinonly-0ubuntu1
* new security/stability upstream release v1.9.0.5 (FIREFOX_3_0_5_RELEASE)
  - see USN-690-1
* submit patches upstreamed:
  - bzXXX_plugin_for_mimetype_pref.patch => bz449188_att350098_plugin_for_mimetype_pref.patch
  - update debian/patches/series
* adjust XULFastLoad cache in response to interleaving landing of bmo
  #453545 and #462806
  - update debian/patches/bz368428_attachment_308130.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
#include "nsIDOMDocument.h"
53
53
#include "nsIDOMDocumentView.h"
54
54
#include "nsIDOMDocumentXBL.h"
 
55
#include "nsIDOMHTMLDocument.h"
 
56
#include "nsIDOMHTMLElement.h"
55
57
#include "nsIDOMNodeList.h"
56
58
#include "nsIDOMRange.h"
57
59
#include "nsIDOMXULContainerElement.h"
1031
1033
    }
1032
1034
  }
1033
1035
}
 
1036
 
 
1037
already_AddRefed<nsIDOMElement>
 
1038
nsAccUtils::GetDOMElementFor(nsIDOMNode *aNode)
 
1039
{
 
1040
  nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
 
1041
  nsIDOMElement *element = nsnull;
 
1042
 
 
1043
  if (node->IsNodeOfType(nsINode::eELEMENT))
 
1044
    CallQueryInterface(node, &element);
 
1045
 
 
1046
  else if (node->IsNodeOfType(nsINode::eTEXT)) {
 
1047
    nsCOMPtr<nsINode> nodeParent = node->GetNodeParent();
 
1048
    NS_ASSERTION(nodeParent, "Text node has no parent!");
 
1049
    if (nodeParent)
 
1050
      CallQueryInterface(nodeParent, &element);
 
1051
  }
 
1052
 
 
1053
  else if (node->IsNodeOfType(nsINode::eDOCUMENT)) {
 
1054
    nsCOMPtr<nsIDOMHTMLDocument> htmlDoc(do_QueryInterface(node));
 
1055
    if (htmlDoc) {
 
1056
      nsCOMPtr<nsIDOMHTMLElement> bodyElement;
 
1057
      htmlDoc->GetBody(getter_AddRefs(bodyElement));
 
1058
      if (bodyElement) {
 
1059
        CallQueryInterface(bodyElement, &element);
 
1060
        return element;
 
1061
      }
 
1062
    }
 
1063
 
 
1064
    nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(node));
 
1065
    domDoc->GetDocumentElement(&element);
 
1066
  }
 
1067
 
 
1068
  return element;
 
1069
}