Fixing bug 225837. DeCOMtaminating nsIContent more, making GetTag() return a weak raw pointer, and renaming GetTag() to Tag(), and making GetRangeList() return an const nsVoidArray*, and changing GetContentID() to return the id, and renaming it to ContentID(). r=jonas@sicking.cc, sr=bryner@brianryner.com.
git-svn-id: svn://10.0.0.236/trunk@149527 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
19a3086422
commit
2affc5b4f0
@ -154,10 +154,11 @@ STDMETHODIMP nsAccessNodeWrap::get_nodeInfo(
|
|||||||
*aUniqueID = 0; // magic value of 0 means we're on the document node.
|
*aUniqueID = 0; // magic value of 0 means we're on the document node.
|
||||||
if (content) {
|
if (content) {
|
||||||
content->GetNameSpaceID(&nameSpaceID);
|
content->GetNameSpaceID(&nameSpaceID);
|
||||||
// This is a unique ID for every content node.
|
// This is a unique ID for every content node. The 3rd party
|
||||||
// The 3rd party accessibility application can compare this to the childID we return for
|
// accessibility application can compare this to the childID we
|
||||||
// events such as focus events, to correlate back to data nodes in their internal object model.
|
// return for events such as focus events, to correlate back to
|
||||||
content->GetContentID(NS_STATIC_CAST(PRUint32*, aUniqueID));
|
// data nodes in their internal object model.
|
||||||
|
*aUniqueID = content->ContentID();
|
||||||
}
|
}
|
||||||
*aNameSpaceID = NS_STATIC_CAST(short, nameSpaceID);
|
*aNameSpaceID = NS_STATIC_CAST(short, nameSpaceID);
|
||||||
|
|
||||||
|
|||||||
@ -163,11 +163,6 @@
|
|||||||
#define NS_RANGE_CID \
|
#define NS_RANGE_CID \
|
||||||
{/* {56AD2981-8A87-11d2-918C-0080C8E44DB5}*/ \
|
{/* {56AD2981-8A87-11d2-918C-0080C8E44DB5}*/ \
|
||||||
0x56ad2981, 0x8a87, 0x11d2, { 0x91, 0x8c, 0x0, 0x80, 0xc8, 0xe4, 0x4d, 0xb5 } }
|
0x56ad2981, 0x8a87, 0x11d2, { 0x91, 0x8c, 0x0, 0x80, 0xc8, 0xe4, 0x4d, 0xb5 } }
|
||||||
|
|
||||||
// {A1FDE868-E802-11d4-9885-00C04FA0CF4B}
|
|
||||||
#define NS_ATTRIBUTECONTENT_CID \
|
|
||||||
{ 0xa1fde868, 0xe802, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
|
|
||||||
|
|
||||||
#define NS_CONTENTITERATOR_CID \
|
#define NS_CONTENTITERATOR_CID \
|
||||||
{/* {a6cf90e3-15b3-11d2-932e-00805f8add32}*/ \
|
{/* {a6cf90e3-15b3-11d2-932e-00805f8add32}*/ \
|
||||||
0xa6cf90e3, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
0xa6cf90e3, 0x15b3, 0x11d2, {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||||
|
|||||||
@ -88,7 +88,8 @@ public:
|
|||||||
* @param aCompileEventHandlers whether to initialize the event handlers in
|
* @param aCompileEventHandlers whether to initialize the event handlers in
|
||||||
* the document (used by nsXULElement)
|
* the document (used by nsXULElement)
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers)
|
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep,
|
||||||
|
PRBool aCompileEventHandlers)
|
||||||
{
|
{
|
||||||
mDocument = aDocument;
|
mDocument = aDocument;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -135,10 +136,10 @@ public:
|
|||||||
NS_IMETHOD GetNameSpaceID(PRInt32* aResult) const = 0;
|
NS_IMETHOD GetNameSpaceID(PRInt32* aResult) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the tag for this element
|
* Get the tag for this element. This will always return a non-null
|
||||||
* @param aResult the tag [OUT]
|
* atom pointer (as implied by the naming of the method).
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetTag(nsIAtom** aResult) const = 0;
|
virtual nsIAtom *Tag() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the NodeInfo for this element
|
* Get the NodeInfo for this element
|
||||||
@ -305,7 +306,6 @@ public:
|
|||||||
* @throws NS_CONTENT_ATTR_HAS_VALUE if the attribute exists and has a
|
* @throws NS_CONTENT_ATTR_HAS_VALUE if the attribute exists and has a
|
||||||
* non-empty value (==NS_OK)
|
* non-empty value (==NS_OK)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
NS_IMETHOD GetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
nsIAtom** aPrefix, nsAString& aResult) const = 0;
|
nsIAtom** aPrefix, nsAString& aResult) const = 0;
|
||||||
|
|
||||||
@ -316,7 +316,6 @@ public:
|
|||||||
* @param aAttr the attribute name
|
* @param aAttr the attribute name
|
||||||
* @return whether an attribute exists
|
* @return whether an attribute exists
|
||||||
*/
|
*/
|
||||||
|
|
||||||
NS_IMETHOD_(PRBool) HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const = 0;
|
NS_IMETHOD_(PRBool) HasAttr(PRInt32 aNameSpaceID, nsIAtom* aName) const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -348,7 +347,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Get the number of all specified attributes.
|
* Get the number of all specified attributes.
|
||||||
*
|
*
|
||||||
* @param aCountResult the number of attributes [OUT]
|
* @returns the number of attributes
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD_(PRUint32) GetAttrCount() const = 0;
|
NS_IMETHOD_(PRUint32) GetAttrCount() const = 0;
|
||||||
|
|
||||||
@ -371,11 +370,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
NS_IMETHOD RangeRemove(nsIDOMRange* aRange) = 0;
|
NS_IMETHOD RangeRemove(nsIDOMRange* aRange) = 0;
|
||||||
/**
|
/**
|
||||||
* Get the list of ranges that have either endpoint in this content item
|
* Get the list of ranges that have either endpoint in this content
|
||||||
* @param aResult the list of ranges owned partially by this content [OUT]
|
* item.
|
||||||
|
* @returns the list of ranges owned partially by this content. The
|
||||||
|
* nsVoidArray is owned by the content object and its lifetime is
|
||||||
|
* controlled completely by the content object.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetRangeList(nsVoidArray** aResult) const = 0;
|
virtual const nsVoidArray *GetRangeList() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle a DOM event for this piece of content. This method is responsible
|
* Handle a DOM event for this piece of content. This method is responsible
|
||||||
* for handling and controlling all three stages of events, capture, local
|
* for handling and controlling all three stages of events, capture, local
|
||||||
@ -423,12 +425,10 @@ public:
|
|||||||
* An opaque pointer to this dictionary is passed to the session
|
* An opaque pointer to this dictionary is passed to the session
|
||||||
* history as a handle associated with the current document's state
|
* history as a handle associated with the current document's state
|
||||||
*
|
*
|
||||||
* @param aID the unique ID for this content [OUT]
|
|
||||||
*
|
|
||||||
* These methods are DEPRECATED, DON'T USE THEM!!!
|
* These methods are DEPRECATED, DON'T USE THEM!!!
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetContentID(PRUint32 *aId) = 0;
|
virtual PRUint32 ContentID() const = 0;
|
||||||
/**
|
/**
|
||||||
* Set the unique content ID for this content.
|
* Set the unique content ID for this content.
|
||||||
* @param aID the ID to set
|
* @param aID the ID to set
|
||||||
|
|||||||
@ -122,6 +122,9 @@ NS_IMETHODIMP
|
|||||||
mozSanitizingHTMLSerializer::Init(PRUint32 aFlags, PRUint32 dummy,
|
mozSanitizingHTMLSerializer::Init(PRUint32 aFlags, PRUint32 dummy,
|
||||||
const char* aCharSet, PRBool aIsCopying)
|
const char* aCharSet, PRBool aIsCopying)
|
||||||
{
|
{
|
||||||
|
NS_ENSURE_TRUE(nsContentUtils::GetParserServiceWeakRef(),
|
||||||
|
NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,31 +205,21 @@ mozSanitizingHTMLSerializer::IsContainer(PRInt32 aId)
|
|||||||
so that at least these methods that none of us understand only have to be
|
so that at least these methods that none of us understand only have to be
|
||||||
written once?" */
|
written once?" */
|
||||||
|
|
||||||
nsresult
|
// static
|
||||||
mozSanitizingHTMLSerializer::GetIdForContent(nsIContent* aContent,
|
PRInt32
|
||||||
PRInt32* aID)
|
mozSanitizingHTMLSerializer::GetIdForContent(nsIContent* aContent)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIHTMLContent> htmlcontent = do_QueryInterface(aContent);
|
if (!aContent->IsContentOfType(nsIContent::eHTML)) {
|
||||||
if (!htmlcontent) {
|
return eHTMLTag_unknown;
|
||||||
*aID = eHTMLTag_unknown;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tagname;
|
|
||||||
mContent->GetTag(getter_AddRefs(tagname));
|
|
||||||
if (!tagname)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
nsIParserService* parserService = nsContentUtils::GetParserServiceWeakRef();
|
nsIParserService* parserService = nsContentUtils::GetParserServiceWeakRef();
|
||||||
if (!parserService)
|
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
|
|
||||||
nsresult rv;
|
PRInt32 id;
|
||||||
rv = parserService->HTMLAtomTagToId(tagname, aID);
|
nsresult rv = parserService->HTMLAtomTagToId(aContent->Tag(), &id);
|
||||||
if (NS_FAILED(rv))
|
NS_ASSERTION(NS_SUCCEEDED(rv), "Can't map HTML tag to id!");
|
||||||
return rv;
|
|
||||||
|
|
||||||
return NS_OK;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
@ -253,23 +246,20 @@ mozSanitizingHTMLSerializer::AppendElementStart(nsIDOMElement *aElement,
|
|||||||
NS_ENSURE_ARG(aElement);
|
NS_ENSURE_ARG(aElement);
|
||||||
|
|
||||||
mContent = do_QueryInterface(aElement);
|
mContent = do_QueryInterface(aElement);
|
||||||
if (!mContent) return NS_ERROR_FAILURE;
|
NS_ENSURE_TRUE(mContent, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
mOutputString = &aStr;
|
mOutputString = &aStr;
|
||||||
|
|
||||||
nsresult rv;
|
PRInt32 id = GetIdForContent(mContent);
|
||||||
PRInt32 id;
|
|
||||||
rv = GetIdForContent(mContent, &id);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
PRBool isContainer = IsContainer(id);
|
PRBool isContainer = IsContainer(id);
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
if (isContainer) {
|
if (isContainer) {
|
||||||
rv = DoOpenContainer(id);
|
rv = DoOpenContainer(id);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
nsAutoString empty;
|
rv = DoAddLeaf(id, nsString());
|
||||||
rv = DoAddLeaf(id, empty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
mContent = 0;
|
mContent = 0;
|
||||||
@ -285,14 +275,12 @@ mozSanitizingHTMLSerializer::AppendElementEnd(nsIDOMElement *aElement,
|
|||||||
NS_ENSURE_ARG(aElement);
|
NS_ENSURE_ARG(aElement);
|
||||||
|
|
||||||
mContent = do_QueryInterface(aElement);
|
mContent = do_QueryInterface(aElement);
|
||||||
if (!mContent) return NS_ERROR_FAILURE;
|
NS_ENSURE_TRUE(mContent, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
mOutputString = &aStr;
|
mOutputString = &aStr;
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv = NS_OK;
|
||||||
PRInt32 id;
|
PRInt32 id = GetIdForContent(mContent);
|
||||||
rv = GetIdForContent(mContent, &id);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
PRBool isContainer = IsContainer(id);
|
PRBool isContainer = IsContainer(id);
|
||||||
|
|
||||||
|
|||||||
@ -146,7 +146,7 @@ protected:
|
|||||||
nsString& value /*inout*/);
|
nsString& value /*inout*/);
|
||||||
nsresult SanitizeTextNode(nsString& value /*inout*/);
|
nsresult SanitizeTextNode(nsString& value /*inout*/);
|
||||||
PRBool IsContainer(PRInt32 aId);
|
PRBool IsContainer(PRInt32 aId);
|
||||||
nsresult GetIdForContent(nsIContent* aContent, PRInt32* aID);
|
static PRInt32 GetIdForContent(nsIContent* aContent);
|
||||||
nsresult GetParserService(nsIParserService** aParserService);
|
nsresult GetParserService(nsIParserService** aParserService);
|
||||||
nsresult DoOpenContainer(PRInt32 aTag);
|
nsresult DoOpenContainer(PRInt32 aTag);
|
||||||
nsresult DoCloseContainer(PRInt32 aTag);
|
nsresult DoCloseContainer(PRInt32 aTag);
|
||||||
|
|||||||
@ -63,7 +63,7 @@ public:
|
|||||||
// Empty interface
|
// Empty interface
|
||||||
|
|
||||||
// nsIContent
|
// nsIContent
|
||||||
NS_IMETHOD GetTag(nsIAtom** aResult) const;
|
virtual nsIAtom *Tag() const;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
||||||
@ -112,12 +112,10 @@ NS_IMPL_ADDREF_INHERITED(nsCommentNode, nsGenericDOMDataNode)
|
|||||||
NS_IMPL_RELEASE_INHERITED(nsCommentNode, nsGenericDOMDataNode)
|
NS_IMPL_RELEASE_INHERITED(nsCommentNode, nsGenericDOMDataNode)
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsIAtom *
|
||||||
nsCommentNode::GetTag(nsIAtom** aResult) const
|
nsCommentNode::Tag() const
|
||||||
{
|
{
|
||||||
NS_ADDREF(*aResult = nsLayoutAtoms::commentTagName);
|
return nsLayoutAtoms::commentTagName;
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|||||||
@ -1391,8 +1391,7 @@ nsContentUtils::GenerateStateKey(nsIContent* aContent,
|
|||||||
NS_ENSURE_TRUE(aContent, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(aContent, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
// Don't capture state for anonymous content
|
// Don't capture state for anonymous content
|
||||||
PRUint32 contentID;
|
PRUint32 contentID = aContent->ContentID();
|
||||||
aContent->GetContentID(&contentID);
|
|
||||||
if (!contentID) {
|
if (!contentID) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@ -1565,11 +1564,8 @@ nsContentUtils::BelongsInForm(nsIDOMHTMLFormElement *aForm,
|
|||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (content->Tag() == nsHTMLAtoms::form &&
|
||||||
|
content->IsContentOfType(nsIContent::eHTML)) {
|
||||||
content->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (tag == nsHTMLAtoms::form) {
|
|
||||||
// The child is contained within a form, but not the right form
|
// The child is contained within a form, but not the right form
|
||||||
// so we ignore it.
|
// so we ignore it.
|
||||||
|
|
||||||
|
|||||||
@ -359,8 +359,12 @@ nsresult nsCopySupport::IsPlainTextContext(nsISelection *aSel, nsIDocument *aDoc
|
|||||||
selContent = selContent->GetParent())
|
selContent = selContent->GetParent())
|
||||||
{
|
{
|
||||||
// checking for selection inside a plaintext form widget
|
// checking for selection inside a plaintext form widget
|
||||||
nsCOMPtr<nsIAtom> atom;
|
|
||||||
selContent->GetTag(getter_AddRefs(atom));
|
if (!selContent->IsContentOfType(nsIContent::eHTML)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsIAtom *atom = selContent->Tag();
|
||||||
|
|
||||||
if (atom == nsHTMLAtoms::input ||
|
if (atom == nsHTMLAtoms::input ||
|
||||||
atom == nsHTMLAtoms::textarea)
|
atom == nsHTMLAtoms::textarea)
|
||||||
|
|||||||
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
|
NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
|
||||||
const nsAString& aName,
|
nsIAtom *aName,
|
||||||
nsIDOMNamedNodeMap *aEntities,
|
nsIDOMNamedNodeMap *aEntities,
|
||||||
nsIDOMNamedNodeMap *aNotations,
|
nsIDOMNamedNodeMap *aNotations,
|
||||||
const nsAString& aPublicId,
|
const nsAString& aPublicId,
|
||||||
@ -54,6 +54,7 @@ NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
|
|||||||
const nsAString& aInternalSubset)
|
const nsAString& aInternalSubset)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aDocType);
|
NS_ENSURE_ARG_POINTER(aDocType);
|
||||||
|
NS_ENSURE_ARG_POINTER(aName);
|
||||||
|
|
||||||
*aDocType = new nsDOMDocumentType(aName, aEntities, aNotations, aPublicId,
|
*aDocType = new nsDOMDocumentType(aName, aEntities, aNotations, aPublicId,
|
||||||
aSystemId, aInternalSubset);
|
aSystemId, aInternalSubset);
|
||||||
@ -66,29 +67,23 @@ NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDOMDocumentType::nsDOMDocumentType(const nsAString& aName,
|
nsDOMDocumentType::nsDOMDocumentType(nsIAtom *aName,
|
||||||
nsIDOMNamedNodeMap *aEntities,
|
nsIDOMNamedNodeMap *aEntities,
|
||||||
nsIDOMNamedNodeMap *aNotations,
|
nsIDOMNamedNodeMap *aNotations,
|
||||||
const nsAString& aPublicId,
|
const nsAString& aPublicId,
|
||||||
const nsAString& aSystemId,
|
const nsAString& aSystemId,
|
||||||
const nsAString& aInternalSubset) :
|
const nsAString& aInternalSubset) :
|
||||||
mName(aName),
|
mName(aName),
|
||||||
|
mEntities(aEntities),
|
||||||
|
mNotations(aNotations),
|
||||||
mPublicId(aPublicId),
|
mPublicId(aPublicId),
|
||||||
mSystemId(aSystemId),
|
mSystemId(aSystemId),
|
||||||
mInternalSubset(aInternalSubset)
|
mInternalSubset(aInternalSubset)
|
||||||
{
|
{
|
||||||
|
|
||||||
mEntities = aEntities;
|
|
||||||
mNotations = aNotations;
|
|
||||||
|
|
||||||
NS_IF_ADDREF(mEntities);
|
|
||||||
NS_IF_ADDREF(mNotations);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDOMDocumentType::~nsDOMDocumentType()
|
nsDOMDocumentType::~nsDOMDocumentType()
|
||||||
{
|
{
|
||||||
NS_IF_RELEASE(mEntities);
|
|
||||||
NS_IF_RELEASE(mNotations);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -110,9 +105,7 @@ NS_IMPL_RELEASE(nsDOMDocumentType)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMDocumentType::GetName(nsAString& aName)
|
nsDOMDocumentType::GetName(nsAString& aName)
|
||||||
{
|
{
|
||||||
aName=mName;
|
return mName->ToString(aName);
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
@ -164,20 +157,16 @@ nsDOMDocumentType::GetInternalSubset(nsAString& aInternalSubset)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsIAtom *
|
||||||
nsDOMDocumentType::GetTag(nsIAtom** aResult) const
|
nsDOMDocumentType::Tag() const
|
||||||
{
|
{
|
||||||
*aResult = NS_NewAtom(mName);
|
return mName;
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMDocumentType::GetNodeName(nsAString& aNodeName)
|
nsDOMDocumentType::GetNodeName(nsAString& aNodeName)
|
||||||
{
|
{
|
||||||
aNodeName=mName;
|
return mName->ToString(aNodeName);
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|||||||
@ -39,6 +39,7 @@
|
|||||||
#ifndef nsDOMDocumentType_h___
|
#ifndef nsDOMDocumentType_h___
|
||||||
#define nsDOMDocumentType_h___
|
#define nsDOMDocumentType_h___
|
||||||
|
|
||||||
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIDOMDocumentType.h"
|
#include "nsIDOMDocumentType.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsGenericDOMDataNode.h"
|
#include "nsGenericDOMDataNode.h"
|
||||||
@ -53,7 +54,7 @@ class nsDOMDocumentType : public nsGenericDOMDataNode,
|
|||||||
public nsIDOMDocumentType
|
public nsIDOMDocumentType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsDOMDocumentType(const nsAString& aName,
|
nsDOMDocumentType(nsIAtom *aName,
|
||||||
nsIDOMNamedNodeMap *aEntities,
|
nsIDOMNamedNodeMap *aEntities,
|
||||||
nsIDOMNamedNodeMap *aNotations,
|
nsIDOMNamedNodeMap *aNotations,
|
||||||
const nsAString& aPublicId,
|
const nsAString& aPublicId,
|
||||||
@ -72,12 +73,12 @@ public:
|
|||||||
NS_DECL_NSIDOMDOCUMENTTYPE
|
NS_DECL_NSIDOMDOCUMENTTYPE
|
||||||
|
|
||||||
// nsIContent
|
// nsIContent
|
||||||
NS_IMETHOD GetTag(nsIAtom** aResult) const;
|
virtual nsIAtom *Tag() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsString mName;
|
nsCOMPtr<nsIAtom> mName;
|
||||||
nsIDOMNamedNodeMap* mEntities;
|
nsCOMPtr<nsIDOMNamedNodeMap> mEntities;
|
||||||
nsIDOMNamedNodeMap* mNotations;
|
nsCOMPtr<nsIDOMNamedNodeMap> mNotations;
|
||||||
nsString mPublicId;
|
nsString mPublicId;
|
||||||
nsString mSystemId;
|
nsString mSystemId;
|
||||||
nsString mInternalSubset;
|
nsString mInternalSubset;
|
||||||
@ -85,7 +86,7 @@ protected:
|
|||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
|
NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
|
||||||
const nsAString& aName,
|
nsIAtom *aName,
|
||||||
nsIDOMNamedNodeMap *aEntities,
|
nsIDOMNamedNodeMap *aEntities,
|
||||||
nsIDOMNamedNodeMap *aNotations,
|
nsIDOMNamedNodeMap *aNotations,
|
||||||
const nsAString& aPublicId,
|
const nsAString& aPublicId,
|
||||||
|
|||||||
@ -343,7 +343,10 @@ nsDOMImplementation::CreateDocumentType(const nsAString& aQualifiedName,
|
|||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aReturn);
|
NS_ENSURE_ARG_POINTER(aReturn);
|
||||||
|
|
||||||
return NS_NewDOMDocumentType(aReturn, aQualifiedName, nsnull, nsnull,
|
nsCOMPtr<nsIAtom> name = do_GetAtom(aQualifiedName);
|
||||||
|
NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
|
return NS_NewDOMDocumentType(aReturn, name, nsnull, nsnull,
|
||||||
aPublicId, aSystemId, nsString());
|
aPublicId, aSystemId, nsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1602,7 +1605,7 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
|||||||
mScriptGlobalObject = aScriptGlobalObject;
|
mScriptGlobalObject = aScriptGlobalObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIScriptLoader*
|
nsIScriptLoader *
|
||||||
nsDocument::GetScriptLoader()
|
nsDocument::GetScriptLoader()
|
||||||
{
|
{
|
||||||
if (!mScriptLoader) {
|
if (!mScriptLoader) {
|
||||||
|
|||||||
@ -388,21 +388,8 @@ nsDocumentEncoder::SerializeToStringRecursive(nsIDOMNode* aNode,
|
|||||||
PRBool
|
PRBool
|
||||||
nsDocumentEncoder::IsTag(nsIDOMNode* aNode, nsIAtom* aAtom)
|
nsDocumentEncoder::IsTag(nsIDOMNode* aNode, nsIAtom* aAtom)
|
||||||
{
|
{
|
||||||
if (aNode)
|
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||||
{
|
return content && content->Tag() == aAtom;
|
||||||
nsCOMPtr<nsIAtom> atom;
|
|
||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
|
||||||
if (content)
|
|
||||||
content->GetTag(getter_AddRefs(atom));
|
|
||||||
if (atom)
|
|
||||||
{
|
|
||||||
if (atom.get() == aAtom)
|
|
||||||
{
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsresult
|
static nsresult
|
||||||
@ -683,7 +670,7 @@ nsDocumentEncoder::SerializeRangeNodes(nsIDOMRange* aRange,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (aNode != mCommonParent.get())
|
if (aNode != mCommonParent)
|
||||||
{
|
{
|
||||||
if (IncludeInContext(aNode))
|
if (IncludeInContext(aNode))
|
||||||
{
|
{
|
||||||
@ -723,7 +710,7 @@ nsDocumentEncoder::SerializeRangeNodes(nsIDOMRange* aRange,
|
|||||||
// to add one here in order to include it in the children we serialize.
|
// to add one here in order to include it in the children we serialize.
|
||||||
nsCOMPtr<nsIDOMNode> endParent;
|
nsCOMPtr<nsIDOMNode> endParent;
|
||||||
aRange->GetEndContainer(getter_AddRefs(endParent));
|
aRange->GetEndContainer(getter_AddRefs(endParent));
|
||||||
if (aNode != endParent.get())
|
if (aNode != endParent)
|
||||||
{
|
{
|
||||||
endOffset++;
|
endOffset++;
|
||||||
}
|
}
|
||||||
@ -742,7 +729,7 @@ nsDocumentEncoder::SerializeRangeNodes(nsIDOMRange* aRange,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// serialize the end of this node
|
// serialize the end of this node
|
||||||
if (aNode != mCommonParent.get())
|
if (aNode != mCommonParent)
|
||||||
{
|
{
|
||||||
rv = SerializeNodeEnd(aNode, aString);
|
rv = SerializeNodeEnd(aNode, aString);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
@ -1117,15 +1104,14 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
|
|||||||
selContent = selContent->GetParent())
|
selContent = selContent->GetParent())
|
||||||
{
|
{
|
||||||
// checking for selection inside a plaintext form widget
|
// checking for selection inside a plaintext form widget
|
||||||
nsCOMPtr<nsIAtom> atom;
|
nsIAtom *atom = selContent->Tag();
|
||||||
selContent->GetTag(getter_AddRefs(atom));
|
if (atom == nsHTMLAtoms::input ||
|
||||||
if (atom.get() == nsHTMLAtoms::input ||
|
atom == nsHTMLAtoms::textarea)
|
||||||
atom.get() == nsHTMLAtoms::textarea)
|
|
||||||
{
|
{
|
||||||
mIsTextWidget = PR_TRUE;
|
mIsTextWidget = PR_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (atom.get() == nsHTMLAtoms::body)
|
else if (atom == nsHTMLAtoms::body)
|
||||||
{
|
{
|
||||||
// check for moz prewrap style on body. If it's there we are
|
// check for moz prewrap style on body. If it's there we are
|
||||||
// in a plaintext editor. This is pretty cheezy but I haven't
|
// in a plaintext editor. This is pretty cheezy but I haven't
|
||||||
@ -1264,41 +1250,34 @@ nsHTMLCopyEncoder::IncludeInContext(nsIDOMNode *aNode)
|
|||||||
if (!content)
|
if (!content)
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = content->Tag();
|
||||||
|
|
||||||
content->GetTag(getter_AddRefs(tag));
|
return (tag == nsHTMLAtoms::b ||
|
||||||
|
tag == nsHTMLAtoms::i ||
|
||||||
if (tag.get() == nsHTMLAtoms::b ||
|
tag == nsHTMLAtoms::u ||
|
||||||
tag.get() == nsHTMLAtoms::i ||
|
tag == nsHTMLAtoms::a ||
|
||||||
tag.get() == nsHTMLAtoms::u ||
|
tag == nsHTMLAtoms::tt ||
|
||||||
tag.get() == nsHTMLAtoms::a ||
|
tag == nsHTMLAtoms::s ||
|
||||||
tag.get() == nsHTMLAtoms::tt ||
|
tag == nsHTMLAtoms::big ||
|
||||||
tag.get() == nsHTMLAtoms::s ||
|
tag == nsHTMLAtoms::small ||
|
||||||
tag.get() == nsHTMLAtoms::big ||
|
tag == nsHTMLAtoms::strike ||
|
||||||
tag.get() == nsHTMLAtoms::small ||
|
tag == nsHTMLAtoms::em ||
|
||||||
tag.get() == nsHTMLAtoms::strike ||
|
tag == nsHTMLAtoms::strong ||
|
||||||
tag.get() == nsHTMLAtoms::em ||
|
tag == nsHTMLAtoms::dfn ||
|
||||||
tag.get() == nsHTMLAtoms::strong ||
|
tag == nsHTMLAtoms::code ||
|
||||||
tag.get() == nsHTMLAtoms::dfn ||
|
tag == nsHTMLAtoms::cite ||
|
||||||
tag.get() == nsHTMLAtoms::code ||
|
tag == nsHTMLAtoms::variable ||
|
||||||
tag.get() == nsHTMLAtoms::cite ||
|
tag == nsHTMLAtoms::abbr ||
|
||||||
tag.get() == nsHTMLAtoms::variable ||
|
tag == nsHTMLAtoms::font ||
|
||||||
tag.get() == nsHTMLAtoms::abbr ||
|
tag == nsHTMLAtoms::script ||
|
||||||
tag.get() == nsHTMLAtoms::font ||
|
tag == nsHTMLAtoms::span ||
|
||||||
tag.get() == nsHTMLAtoms::script ||
|
tag == nsHTMLAtoms::pre ||
|
||||||
tag.get() == nsHTMLAtoms::span ||
|
tag == nsHTMLAtoms::h1 ||
|
||||||
tag.get() == nsHTMLAtoms::pre ||
|
tag == nsHTMLAtoms::h2 ||
|
||||||
tag.get() == nsHTMLAtoms::h1 ||
|
tag == nsHTMLAtoms::h3 ||
|
||||||
tag.get() == nsHTMLAtoms::h2 ||
|
tag == nsHTMLAtoms::h4 ||
|
||||||
tag.get() == nsHTMLAtoms::h3 ||
|
tag == nsHTMLAtoms::h5 ||
|
||||||
tag.get() == nsHTMLAtoms::h4 ||
|
tag == nsHTMLAtoms::h6);
|
||||||
tag.get() == nsHTMLAtoms::h5 ||
|
|
||||||
tag.get() == nsHTMLAtoms::h6)
|
|
||||||
{
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1457,11 +1436,8 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, PRInt32
|
|||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(parent);
|
nsCOMPtr<nsIContent> content = do_QueryInterface(parent);
|
||||||
if (content)
|
if (content)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> atom;
|
|
||||||
content->GetTag(getter_AddRefs(atom));
|
|
||||||
|
|
||||||
PRInt32 id;
|
PRInt32 id;
|
||||||
parserService->HTMLAtomTagToId(atom, &id);
|
parserService->HTMLAtomTagToId(content->Tag(), &id);
|
||||||
|
|
||||||
PRBool isBlock = PR_FALSE;
|
PRBool isBlock = PR_FALSE;
|
||||||
parserService->IsBlock(id, isBlock);
|
parserService->IsBlock(id, isBlock);
|
||||||
@ -1546,11 +1522,8 @@ nsHTMLCopyEncoder::GetPromotedPoint(Endpoint aWhere, nsIDOMNode *aNode, PRInt32
|
|||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(parent);
|
nsCOMPtr<nsIContent> content = do_QueryInterface(parent);
|
||||||
if (content)
|
if (content)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> atom;
|
|
||||||
content->GetTag(getter_AddRefs(atom));
|
|
||||||
|
|
||||||
PRInt32 id;
|
PRInt32 id;
|
||||||
parserService->HTMLAtomTagToId(atom, &id);
|
parserService->HTMLAtomTagToId(content->Tag(), &id);
|
||||||
|
|
||||||
PRBool isBlock = PR_FALSE;
|
PRBool isBlock = PR_FALSE;
|
||||||
parserService->IsBlock(id, isBlock);
|
parserService->IsBlock(id, isBlock);
|
||||||
|
|||||||
@ -587,10 +587,7 @@ nsFrameLoader::GetURL(nsAString& aURI)
|
|||||||
{
|
{
|
||||||
aURI.Truncate();
|
aURI.Truncate();
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> type;
|
if (mOwnerContent->Tag() == nsHTMLAtoms::object) {
|
||||||
mOwnerContent->GetTag(getter_AddRefs(type));
|
|
||||||
|
|
||||||
if (type == nsHTMLAtoms::object) {
|
|
||||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, aURI);
|
mOwnerContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, aURI);
|
||||||
} else {
|
} else {
|
||||||
mOwnerContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, aURI);
|
mOwnerContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, aURI);
|
||||||
|
|||||||
@ -834,11 +834,10 @@ nsGenericDOMDataNode::HandleDOMEvent(nsIPresContext* aPresContext,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRUint32
|
||||||
nsGenericDOMDataNode::GetContentID(PRUint32* aID)
|
nsGenericDOMDataNode::ContentID() const
|
||||||
{
|
{
|
||||||
*aID = 0;
|
return 0;
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
@ -987,12 +986,10 @@ nsGenericDOMDataNode::RangeRemove(nsIDOMRange* aRange)
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const nsVoidArray *
|
||||||
NS_IMETHODIMP
|
nsGenericDOMDataNode::GetRangeList() const
|
||||||
nsGenericDOMDataNode::GetRangeList(nsVoidArray** aResult) const
|
|
||||||
{
|
{
|
||||||
*aResult = LookupRangeList();
|
return LookupRangeList();
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|||||||
@ -197,11 +197,11 @@ public:
|
|||||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent,
|
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent,
|
||||||
nsIDOMEvent** aDOMEvent, PRUint32 aFlags,
|
nsIDOMEvent** aDOMEvent, PRUint32 aFlags,
|
||||||
nsEventStatus* aEventStatus);
|
nsEventStatus* aEventStatus);
|
||||||
NS_IMETHOD GetContentID(PRUint32* aID);
|
virtual PRUint32 ContentID() const;
|
||||||
NS_IMETHOD SetContentID(PRUint32 aID);
|
NS_IMETHOD SetContentID(PRUint32 aID);
|
||||||
NS_IMETHOD RangeAdd(nsIDOMRange* aRange);
|
NS_IMETHOD RangeAdd(nsIDOMRange* aRange);
|
||||||
NS_IMETHOD RangeRemove(nsIDOMRange* aRange);
|
NS_IMETHOD RangeRemove(nsIDOMRange* aRange);
|
||||||
NS_IMETHOD GetRangeList(nsVoidArray** aResult) const;
|
virtual const nsVoidArray *GetRangeList() const;
|
||||||
NS_IMETHOD SetFocus(nsIPresContext *aPresContext);
|
NS_IMETHOD SetFocus(nsIPresContext *aPresContext);
|
||||||
NS_IMETHOD RemoveFocus(nsIPresContext *aPresContext);
|
NS_IMETHOD RemoveFocus(nsIPresContext *aPresContext);
|
||||||
|
|
||||||
|
|||||||
@ -1768,12 +1768,10 @@ nsGenericElement::GetNameSpaceID(PRInt32* aNameSpaceID) const
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsIAtom *
|
||||||
nsGenericElement::GetTag(nsIAtom** aResult) const
|
nsGenericElement::Tag() const
|
||||||
{
|
{
|
||||||
NS_ADDREF(*aResult = mNodeInfo->NameAtom());
|
return mNodeInfo->NameAtom();
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(nsINodeInfo *)
|
NS_IMETHODIMP_(nsINodeInfo *)
|
||||||
@ -2019,20 +2017,18 @@ nsGenericElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRUint32
|
||||||
nsGenericElement::GetContentID(PRUint32* aID)
|
nsGenericElement::ContentID() const
|
||||||
{
|
{
|
||||||
nsDOMSlots *slots = GetExistingDOMSlots();
|
nsDOMSlots *slots = GetExistingDOMSlots();
|
||||||
|
|
||||||
if (slots) {
|
if (slots) {
|
||||||
*aID = slots->mContentID;
|
return slots->mContentID;
|
||||||
} else {
|
|
||||||
PtrBits flags = GetFlags();
|
|
||||||
|
|
||||||
*aID = flags >> GENERIC_ELEMENT_CONTENT_ID_BITS_OFFSET;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
PtrBits flags = GetFlags();
|
||||||
|
|
||||||
|
return flags >> GENERIC_ELEMENT_CONTENT_ID_BITS_OFFSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
@ -2326,13 +2322,11 @@ nsGenericElement::RangeRemove(nsIDOMRange* aRange)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
const nsVoidArray *
|
||||||
nsGenericElement::GetRangeList(nsVoidArray** aResult) const
|
nsGenericElement::GetRangeList() const
|
||||||
{
|
{
|
||||||
*aResult = nsnull;
|
|
||||||
|
|
||||||
if (!HasRangeList()) {
|
if (!HasRangeList()) {
|
||||||
return NS_OK;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
RangeListMapEntry *entry =
|
RangeListMapEntry *entry =
|
||||||
@ -2344,12 +2338,10 @@ nsGenericElement::GetRangeList(nsVoidArray** aResult) const
|
|||||||
NS_ERROR("Huh, our bit says we have a range list, but there's nothing "
|
NS_ERROR("Huh, our bit says we have a range list, but there's nothing "
|
||||||
"in the hash!?!!");
|
"in the hash!?!!");
|
||||||
|
|
||||||
return NS_ERROR_UNEXPECTED;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
*aResult = entry->mRangeList;
|
return entry->mRangeList;
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
@ -2422,8 +2414,8 @@ nsGenericElement::GetListenerManager(nsIEventListenerManager** aResult)
|
|||||||
*aResult = nsnull;
|
*aResult = nsnull;
|
||||||
|
|
||||||
if (!sEventListenerManagersHash.ops) {
|
if (!sEventListenerManagersHash.ops) {
|
||||||
// We''re already shut down, don't bother creating a event
|
// We're already shut down, don't bother creating a event listener
|
||||||
// listener manager.
|
// manager.
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -368,19 +368,19 @@ public:
|
|||||||
NS_IMETHOD_(PRBool) IsNativeAnonymous() const;
|
NS_IMETHOD_(PRBool) IsNativeAnonymous() const;
|
||||||
NS_IMETHOD_(void) SetNativeAnonymous(PRBool aAnonymous);
|
NS_IMETHOD_(void) SetNativeAnonymous(PRBool aAnonymous);
|
||||||
NS_IMETHOD GetNameSpaceID(PRInt32* aNameSpaceID) const;
|
NS_IMETHOD GetNameSpaceID(PRInt32* aNameSpaceID) const;
|
||||||
NS_IMETHOD GetTag(nsIAtom** aResult) const;
|
virtual nsIAtom *Tag() const;
|
||||||
NS_IMETHOD_(nsINodeInfo *) GetNodeInfo() const;
|
NS_IMETHOD_(nsINodeInfo *) GetNodeInfo() const;
|
||||||
NS_IMETHOD_(nsIAtom*) GetIDAttributeName() const;
|
NS_IMETHOD_(nsIAtom*) GetIDAttributeName() const;
|
||||||
NS_IMETHOD_(nsIAtom*) GetClassAttributeName() const;
|
NS_IMETHOD_(nsIAtom*) GetClassAttributeName() const;
|
||||||
NS_IMETHOD RangeAdd(nsIDOMRange* aRange);
|
NS_IMETHOD RangeAdd(nsIDOMRange* aRange);
|
||||||
NS_IMETHOD RangeRemove(nsIDOMRange* aRange);
|
NS_IMETHOD RangeRemove(nsIDOMRange* aRange);
|
||||||
NS_IMETHOD GetRangeList(nsVoidArray** aResult) const;
|
virtual const nsVoidArray *GetRangeList() const;
|
||||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
||||||
nsEvent* aEvent,
|
nsEvent* aEvent,
|
||||||
nsIDOMEvent** aDOMEvent,
|
nsIDOMEvent** aDOMEvent,
|
||||||
PRUint32 aFlags,
|
PRUint32 aFlags,
|
||||||
nsEventStatus* aEventStatus);
|
nsEventStatus* aEventStatus);
|
||||||
NS_IMETHOD GetContentID(PRUint32* aID);
|
virtual PRUint32 ContentID() const;
|
||||||
NS_IMETHOD SetContentID(PRUint32 aID);
|
NS_IMETHOD SetContentID(PRUint32 aID);
|
||||||
NS_IMETHOD SetFocus(nsIPresContext* aContext);
|
NS_IMETHOD SetFocus(nsIPresContext* aContext);
|
||||||
NS_IMETHOD RemoveFocus(nsIPresContext* aContext);
|
NS_IMETHOD RemoveFocus(nsIPresContext* aContext);
|
||||||
|
|||||||
@ -461,7 +461,7 @@ nsHTMLContentSerializer::IsJavaScript(nsIAtom* aAttrNameAtom, const nsAString& a
|
|||||||
aAttrNameAtom == nsHTMLAtoms::src) {
|
aAttrNameAtom == nsHTMLAtoms::src) {
|
||||||
static const char kJavaScript[] = "javascript";
|
static const char kJavaScript[] = "javascript";
|
||||||
PRInt32 pos = aValueString.FindChar(':');
|
PRInt32 pos = aValueString.FindChar(':');
|
||||||
if ( pos < (PRInt32)(sizeof kJavaScript - 1) )
|
if (pos < (PRInt32)(sizeof kJavaScript - 1))
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
nsAutoString scheme(Substring(aValueString, 0, pos));
|
nsAutoString scheme(Substring(aValueString, 0, pos));
|
||||||
scheme.StripWhitespace();
|
scheme.StripWhitespace();
|
||||||
@ -602,21 +602,21 @@ nsHTMLContentSerializer::SerializeAttributes(nsIContent* aContent,
|
|||||||
|
|
||||||
// XXX: This special cased textarea code should be
|
// XXX: This special cased textarea code should be
|
||||||
// removed when bug #17003 is fixed.
|
// removed when bug #17003 is fixed.
|
||||||
if ( (aTagName == nsHTMLAtoms::textarea) &&
|
if ((aTagName == nsHTMLAtoms::textarea) &&
|
||||||
((attrName.get() == nsHTMLAtoms::value) ||
|
((attrName == nsHTMLAtoms::value) ||
|
||||||
(attrName.get() == nsHTMLAtoms::defaultvalue)) ){
|
(attrName == nsHTMLAtoms::defaultvalue))){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mIsCopying && mIsFirstChildOfOL && (aTagName == nsHTMLAtoms::li) &&
|
if (mIsCopying && mIsFirstChildOfOL && (aTagName == nsHTMLAtoms::li) &&
|
||||||
(attrName.get() == nsHTMLAtoms::value)){
|
(attrName == nsHTMLAtoms::value)){
|
||||||
// This is handled separately in SerializeLIValueAttribute()
|
// This is handled separately in SerializeLIValueAttribute()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
PRBool isJS = IsJavaScript(attrName, valueStr);
|
PRBool isJS = IsJavaScript(attrName, valueStr);
|
||||||
|
|
||||||
if (((attrName.get() == nsHTMLAtoms::href) ||
|
if (((attrName == nsHTMLAtoms::href) ||
|
||||||
(attrName.get() == nsHTMLAtoms::src))) {
|
(attrName == nsHTMLAtoms::src))) {
|
||||||
// Make all links absolute when converting only the selection:
|
// Make all links absolute when converting only the selection:
|
||||||
if (mFlags & nsIDocumentEncoder::OutputAbsoluteLinks) {
|
if (mFlags & nsIDocumentEncoder::OutputAbsoluteLinks) {
|
||||||
// Would be nice to handle OBJECT and APPLET tags,
|
// Would be nice to handle OBJECT and APPLET tags,
|
||||||
@ -677,10 +677,9 @@ nsHTMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
|
|||||||
// even if we're not in pretty printing mode
|
// even if we're not in pretty printing mode
|
||||||
PRBool hasDirtyAttr = HasDirtyAttr(content);
|
PRBool hasDirtyAttr = HasDirtyAttr(content);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> name;
|
nsIAtom *name = content->Tag();
|
||||||
content->GetTag(getter_AddRefs(name));
|
|
||||||
|
|
||||||
if (name.get() == nsHTMLAtoms::br && mPreLevel > 0
|
if (name == nsHTMLAtoms::br && mPreLevel > 0
|
||||||
&& (mFlags & nsIDocumentEncoder::OutputNoFormattingInPre)) {
|
&& (mFlags & nsIDocumentEncoder::OutputNoFormattingInPre)) {
|
||||||
AppendToString(mLineBreak, aStr);
|
AppendToString(mLineBreak, aStr);
|
||||||
mMayIgnoreLineBreakSequence = PR_TRUE;
|
mMayIgnoreLineBreakSequence = PR_TRUE;
|
||||||
@ -688,7 +687,7 @@ nsHTMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.get() == nsHTMLAtoms::body) {
|
if (name == nsHTMLAtoms::body) {
|
||||||
mInBody = PR_TRUE;
|
mInBody = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -711,9 +710,9 @@ nsHTMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
|
|||||||
|
|
||||||
StartIndentation(name, hasDirtyAttr, aStr);
|
StartIndentation(name, hasDirtyAttr, aStr);
|
||||||
|
|
||||||
if ((name.get() == nsHTMLAtoms::pre) ||
|
if (name == nsHTMLAtoms::pre ||
|
||||||
(name.get() == nsHTMLAtoms::script) ||
|
name == nsHTMLAtoms::script ||
|
||||||
(name.get() == nsHTMLAtoms::style)) {
|
name == nsHTMLAtoms::style) {
|
||||||
mPreLevel++;
|
mPreLevel++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -725,7 +724,7 @@ nsHTMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
|
|||||||
|
|
||||||
// Need to keep track of OL and LI elements in order to get ordinal number
|
// Need to keep track of OL and LI elements in order to get ordinal number
|
||||||
// for the LI.
|
// for the LI.
|
||||||
if (mIsCopying && name.get() == nsHTMLAtoms::ol){
|
if (mIsCopying && name == nsHTMLAtoms::ol){
|
||||||
// We are copying and current node is an OL;
|
// We are copying and current node is an OL;
|
||||||
// Store it's start attribute value in olState->startVal.
|
// Store it's start attribute value in olState->startVal.
|
||||||
nsAutoString start;
|
nsAutoString start;
|
||||||
@ -747,7 +746,7 @@ nsHTMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
|
|||||||
mOLStateStack.AppendElement(state);
|
mOLStateStack.AppendElement(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mIsCopying && name.get() == nsHTMLAtoms::li) {
|
if (mIsCopying && name == nsHTMLAtoms::li) {
|
||||||
mIsFirstChildOfOL = IsFirstChildOfOL(aElement);
|
mIsFirstChildOfOL = IsFirstChildOfOL(aElement);
|
||||||
if (mIsFirstChildOfOL){
|
if (mIsFirstChildOfOL){
|
||||||
// If OL is parent of this LI, serialize attributes in different manner.
|
// If OL is parent of this LI, serialize attributes in different manner.
|
||||||
@ -769,17 +768,17 @@ nsHTMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
|
|||||||
|
|
||||||
// XXX: This special cased textarea code should be
|
// XXX: This special cased textarea code should be
|
||||||
// removed when bug #17003 is fixed.
|
// removed when bug #17003 is fixed.
|
||||||
if (name.get() == nsHTMLAtoms::textarea)
|
if (name == nsHTMLAtoms::textarea)
|
||||||
{
|
{
|
||||||
nsAutoString valueStr;
|
nsAutoString valueStr;
|
||||||
content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::value, valueStr);
|
content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::value, valueStr);
|
||||||
AppendToString(valueStr, aStr);
|
AppendToString(valueStr, aStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((name.get() == nsHTMLAtoms::script) ||
|
if (name == nsHTMLAtoms::script ||
|
||||||
(name.get() == nsHTMLAtoms::style) ||
|
name == nsHTMLAtoms::style ||
|
||||||
(name.get() == nsHTMLAtoms::noscript) ||
|
name == nsHTMLAtoms::noscript ||
|
||||||
(name.get() == nsHTMLAtoms::noframes)) {
|
name == nsHTMLAtoms::noframes) {
|
||||||
mInCDATA = PR_TRUE;
|
mInCDATA = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -797,16 +796,15 @@ nsHTMLContentSerializer::AppendElementEnd(nsIDOMElement *aElement,
|
|||||||
|
|
||||||
PRBool hasDirtyAttr = HasDirtyAttr(content);
|
PRBool hasDirtyAttr = HasDirtyAttr(content);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> name;
|
nsIAtom *name = content->Tag();
|
||||||
content->GetTag(getter_AddRefs(name));
|
|
||||||
|
|
||||||
if ((name.get() == nsHTMLAtoms::pre) ||
|
if (name == nsHTMLAtoms::pre ||
|
||||||
(name.get() == nsHTMLAtoms::script) ||
|
name == nsHTMLAtoms::script ||
|
||||||
(name.get() == nsHTMLAtoms::style)) {
|
name == nsHTMLAtoms::style) {
|
||||||
mPreLevel--;
|
mPreLevel--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mIsCopying && (name.get() == nsHTMLAtoms::ol)){
|
if (mIsCopying && (name == nsHTMLAtoms::ol)){
|
||||||
NS_ASSERTION((mOLStateStack.Count() > 0), "Cannot have an empty OL Stack");
|
NS_ASSERTION((mOLStateStack.Count() > 0), "Cannot have an empty OL Stack");
|
||||||
/* Though at this point we must always have an state to be deleted as all
|
/* Though at this point we must always have an state to be deleted as all
|
||||||
the OL opening tags are supposed to push an olState object to the stack*/
|
the OL opening tags are supposed to push an olState object to the stack*/
|
||||||
@ -819,7 +817,7 @@ nsHTMLContentSerializer::AppendElementEnd(nsIDOMElement *aElement,
|
|||||||
|
|
||||||
nsIParserService* parserService = nsContentUtils::GetParserServiceWeakRef();
|
nsIParserService* parserService = nsContentUtils::GetParserServiceWeakRef();
|
||||||
|
|
||||||
if (parserService && (name.get() != nsHTMLAtoms::style)) {
|
if (parserService && (name != nsHTMLAtoms::style)) {
|
||||||
PRBool isContainer;
|
PRBool isContainer;
|
||||||
PRInt32 id;
|
PRInt32 id;
|
||||||
|
|
||||||
|
|||||||
@ -164,7 +164,10 @@ nsPlainTextSerializer::Init(PRUint32 aFlags, PRUint32 aWrapColumn,
|
|||||||
"Can't do formatted and preformatted output at the same time!");
|
"Can't do formatted and preformatted output at the same time!");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
NS_ENSURE_TRUE(nsContentUtils::GetParserServiceWeakRef(),
|
||||||
|
NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
mFlags = aFlags;
|
mFlags = aFlags;
|
||||||
@ -388,9 +391,7 @@ nsPlainTextSerializer::AppendElementStart(nsIDOMElement *aElement,
|
|||||||
if (!mContent) return NS_ERROR_FAILURE;
|
if (!mContent) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
PRInt32 id;
|
PRInt32 id = GetIdForContent(mContent);
|
||||||
rv = GetIdForContent(mContent, &id);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
PRBool isContainer = IsContainer(id);
|
PRBool isContainer = IsContainer(id);
|
||||||
|
|
||||||
@ -423,9 +424,7 @@ nsPlainTextSerializer::AppendElementEnd(nsIDOMElement *aElement,
|
|||||||
if (!mContent) return NS_ERROR_FAILURE;
|
if (!mContent) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
PRInt32 id;
|
PRInt32 id = GetIdForContent(mContent);
|
||||||
rv = GetIdForContent(mContent, &id);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
PRBool isContainer = IsContainer(id);
|
PRBool isContainer = IsContainer(id);
|
||||||
|
|
||||||
@ -1849,26 +1848,21 @@ nsPlainTextSerializer::IsCurrentNodeConverted(const nsIParserNode* aNode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
// static
|
||||||
nsPlainTextSerializer::GetIdForContent(nsIContent* aContent,
|
PRInt32
|
||||||
PRInt32* aID)
|
nsPlainTextSerializer::GetIdForContent(nsIContent* aContent)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIHTMLContent> htmlcontent = do_QueryInterface(aContent);
|
if (!aContent->IsContentOfType(nsIContent::eHTML)) {
|
||||||
if (!htmlcontent) {
|
return eHTMLTag_unknown;
|
||||||
*aID = eHTMLTag_unknown;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tagname;
|
nsIParserService* parserService = nsContentUtils::GetParserServiceWeakRef();
|
||||||
mContent->GetTag(getter_AddRefs(tagname));
|
|
||||||
if (!tagname) return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
nsIParserService* parserService =
|
|
||||||
nsContentUtils::GetParserServiceWeakRef();
|
|
||||||
if (!parserService)
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
return parserService->HTMLAtomTagToId(tagname, aID);
|
PRInt32 id;
|
||||||
|
nsresult rv = parserService->HTMLAtomTagToId(aContent->Tag(), &id);
|
||||||
|
NS_ASSERTION(NS_SUCCEEDED(rv), "Can't map HTML tag to id!");
|
||||||
|
|
||||||
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -148,7 +148,7 @@ protected:
|
|||||||
PRBool IsInPre();
|
PRBool IsInPre();
|
||||||
PRBool IsInOL();
|
PRBool IsInOL();
|
||||||
PRBool IsCurrentNodeConverted(const nsIParserNode* aNode);
|
PRBool IsCurrentNodeConverted(const nsIParserNode* aNode);
|
||||||
nsresult GetIdForContent(nsIContent* aContent, PRInt32* aID);
|
static PRInt32 GetIdForContent(nsIContent* aContent);
|
||||||
nsresult DoOpenContainer(const nsIParserNode* aNode, PRInt32 aTag);
|
nsresult DoOpenContainer(const nsIParserNode* aNode, PRInt32 aTag);
|
||||||
nsresult DoCloseContainer(PRInt32 aTag);
|
nsresult DoCloseContainer(PRInt32 aTag);
|
||||||
nsresult DoAddLeaf(const nsIParserNode* aNode,
|
nsresult DoAddLeaf(const nsIParserNode* aNode,
|
||||||
|
|||||||
@ -3662,15 +3662,11 @@ nsPrintEngine::FindFrameByType(nsIPresContext* aPresContext,
|
|||||||
aParentFrame->FirstChild(aPresContext, nsnull, &child);
|
aParentFrame->FirstChild(aPresContext, nsnull, &child);
|
||||||
while (child) {
|
while (child) {
|
||||||
nsIContent* content = child->GetContent();
|
nsIContent* content = child->GetContent();
|
||||||
if (content) {
|
if (content && content->Tag() == aType) {
|
||||||
nsCOMPtr<nsIAtom> type;
|
nsRect r = child->GetRect();
|
||||||
content->GetTag(getter_AddRefs(type));
|
aChildRect.SetRect(aRect.x + r.x, aRect.y + r.y, r.width, r.height);
|
||||||
if (type.get() == aType) {
|
aRect -= aParentFrame->GetPosition();
|
||||||
nsRect r = child->GetRect();
|
return child;
|
||||||
aChildRect.SetRect(aRect.x + r.x, aRect.y + r.y, r.width, r.height);
|
|
||||||
aRect -= aParentFrame->GetPosition();
|
|
||||||
return child;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
nsIFrame * fndFrame = FindFrameByType(aPresContext, child, aType, aRect, aChildRect);
|
nsIFrame * fndFrame = FindFrameByType(aPresContext, child, aType, aRect, aChildRect);
|
||||||
if (fndFrame != nsnull) {
|
if (fndFrame != nsnull) {
|
||||||
|
|||||||
@ -873,12 +873,12 @@ nsresult nsRange::PopRanges(nsIDOMNode* aDestNode, PRInt32 aOffset, nsIContent*
|
|||||||
iter->Init(aSourceNode);
|
iter->Init(aSourceNode);
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> cN;
|
nsCOMPtr<nsIContent> cN;
|
||||||
nsVoidArray* theRangeList;
|
const nsVoidArray* theRangeList;
|
||||||
|
|
||||||
iter->CurrentNode(getter_AddRefs(cN));
|
iter->CurrentNode(getter_AddRefs(cN));
|
||||||
while (cN && (NS_ENUMERATOR_FALSE == iter->IsDone()))
|
while (cN && (NS_ENUMERATOR_FALSE == iter->IsDone()))
|
||||||
{
|
{
|
||||||
cN->GetRangeList(&theRangeList);
|
theRangeList = cN->GetRangeList();
|
||||||
if (theRangeList)
|
if (theRangeList)
|
||||||
{
|
{
|
||||||
nsRange* theRange;
|
nsRange* theRange;
|
||||||
@ -910,7 +910,7 @@ nsresult nsRange::PopRanges(nsIDOMNode* aDestNode, PRInt32 aOffset, nsIContent*
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// must refresh theRangeList - it might have gone away!
|
// must refresh theRangeList - it might have gone away!
|
||||||
cN->GetRangeList(&theRangeList);
|
theRangeList = cN->GetRangeList();
|
||||||
if (theRangeList)
|
if (theRangeList)
|
||||||
theCount = theRangeList->Count();
|
theCount = theRangeList->Count();
|
||||||
else
|
else
|
||||||
@ -2331,8 +2331,7 @@ nsresult nsRange::OwnerChildInserted(nsIContent* aParentNode, PRInt32 aOffset)
|
|||||||
|
|
||||||
nsCOMPtr<nsIContent> parent( do_QueryInterface(aParentNode) );
|
nsCOMPtr<nsIContent> parent( do_QueryInterface(aParentNode) );
|
||||||
// quick return if no range list
|
// quick return if no range list
|
||||||
nsVoidArray *theRangeList;
|
const nsVoidArray *theRangeList = parent->GetRangeList();
|
||||||
parent->GetRangeList(&theRangeList);
|
|
||||||
if (!theRangeList) return NS_OK;
|
if (!theRangeList) return NS_OK;
|
||||||
|
|
||||||
nsresult res;
|
nsresult res;
|
||||||
@ -2384,8 +2383,7 @@ nsresult nsRange::OwnerChildRemoved(nsIContent* aParentNode, PRInt32 aOffset, ns
|
|||||||
nsresult res = PopRanges(domNode, aOffset, removed);
|
nsresult res = PopRanges(domNode, aOffset, removed);
|
||||||
|
|
||||||
// quick return if no range list
|
// quick return if no range list
|
||||||
nsVoidArray *theRangeList;
|
const nsVoidArray *theRangeList = parent->GetRangeList();
|
||||||
parent->GetRangeList(&theRangeList);
|
|
||||||
if (!theRangeList) return NS_OK;
|
if (!theRangeList) return NS_OK;
|
||||||
|
|
||||||
PRInt32 count = theRangeList->Count();
|
PRInt32 count = theRangeList->Count();
|
||||||
@ -2444,8 +2442,7 @@ nsresult nsRange::TextOwnerChanged(nsIContent* aTextNode, PRInt32 aStartChanged,
|
|||||||
if (!aTextNode) return NS_ERROR_UNEXPECTED;
|
if (!aTextNode) return NS_ERROR_UNEXPECTED;
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> textNode( do_QueryInterface(aTextNode) );
|
nsCOMPtr<nsIContent> textNode( do_QueryInterface(aTextNode) );
|
||||||
nsVoidArray *theRangeList;
|
const nsVoidArray *theRangeList = aTextNode->GetRangeList();
|
||||||
aTextNode->GetRangeList(&theRangeList);
|
|
||||||
// the caller already checked to see if there was a range list
|
// the caller already checked to see if there was a range list
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(textNode));
|
nsCOMPtr<nsIDOMNode> domNode(do_QueryInterface(textNode));
|
||||||
|
|||||||
@ -148,7 +148,7 @@ struct nsScrollSelectionIntoViewEvent;
|
|||||||
PRBool IsValidSelectionPoint(nsSelection *aFrameSel, nsIContent *aContent);
|
PRBool IsValidSelectionPoint(nsSelection *aFrameSel, nsIContent *aContent);
|
||||||
PRBool IsValidSelectionPoint(nsSelection *aFrameSel, nsIDOMNode *aDomNode);
|
PRBool IsValidSelectionPoint(nsSelection *aFrameSel, nsIDOMNode *aDomNode);
|
||||||
|
|
||||||
static nsCOMPtr<nsIAtom> GetTag(nsIDOMNode *aNode);
|
static nsIAtom *GetTag(nsIDOMNode *aNode);
|
||||||
static nsresult ParentOffset(nsIDOMNode *aNode, nsIDOMNode **aParent, PRInt32 *aChildOffset);
|
static nsresult ParentOffset(nsIDOMNode *aNode, nsIDOMNode **aParent, PRInt32 *aChildOffset);
|
||||||
static nsIDOMNode *GetCellParent(nsIDOMNode *aDomNode);
|
static nsIDOMNode *GetCellParent(nsIDOMNode *aDomNode);
|
||||||
|
|
||||||
@ -1330,21 +1330,17 @@ void printRange(nsIDOMRange *aDomRange)
|
|||||||
}
|
}
|
||||||
#endif /* PRINT_RANGE */
|
#endif /* PRINT_RANGE */
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> GetTag(nsIDOMNode *aNode)
|
static
|
||||||
|
nsIAtom *GetTag(nsIDOMNode *aNode)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> atom;
|
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||||
|
if (!content)
|
||||||
if (!aNode)
|
|
||||||
{
|
{
|
||||||
NS_NOTREACHED("null node passed to GetTag()");
|
NS_NOTREACHED("bad node passed to GetTag()");
|
||||||
return atom;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
return content->Tag();
|
||||||
if (content)
|
|
||||||
content->GetTag(getter_AddRefs(atom));
|
|
||||||
|
|
||||||
return atom;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
@ -1376,7 +1372,7 @@ GetCellParent(nsIDOMNode *aDomNode)
|
|||||||
nsCOMPtr<nsIDOMNode> parent(aDomNode);
|
nsCOMPtr<nsIDOMNode> parent(aDomNode);
|
||||||
nsCOMPtr<nsIDOMNode> current(aDomNode);
|
nsCOMPtr<nsIDOMNode> current(aDomNode);
|
||||||
PRInt32 childOffset;
|
PRInt32 childOffset;
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag;
|
||||||
// Start with current node and look for a table cell
|
// Start with current node and look for a table cell
|
||||||
while(current)
|
while(current)
|
||||||
{
|
{
|
||||||
@ -3289,9 +3285,8 @@ nsSelection::FrameOrParentHasSpecialSelectionStyle(nsIFrame* aFrame, PRUint8 aSe
|
|||||||
|
|
||||||
static PRBool IsCell(nsIContent *aContent)
|
static PRBool IsCell(nsIContent *aContent)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> tag;
|
return (aContent->Tag() == nsHTMLAtoms::td &&
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
aContent->IsContentOfType(nsIContent::eHTML));
|
||||||
return (tag == nsHTMLAtoms::td);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsITableCellLayout*
|
nsITableCellLayout*
|
||||||
@ -4057,11 +4052,10 @@ nsSelection::GetParentTable(nsIContent *aCell, nsIContent **aTable)
|
|||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
for (nsIContent* parent = aCell->GetParent(); parent;
|
for (nsIContent* parent = aCell->GetParent(); parent;
|
||||||
parent = parent->GetParent()) {
|
parent = parent->GetParent()) {
|
||||||
parent->GetTag(getter_AddRefs(tag));
|
if (parent->Tag() == nsHTMLAtoms::table &&
|
||||||
if (tag == nsHTMLAtoms::table) {
|
parent->IsContentOfType(nsIContent::eHTML)) {
|
||||||
*aTable = parent;
|
*aTable = parent;
|
||||||
NS_ADDREF(*aTable);
|
NS_ADDREF(*aTable);
|
||||||
|
|
||||||
@ -4259,11 +4253,13 @@ nsTypedSelection::GetTableSelectionType(nsIDOMRange* aRange, PRInt32* aTableSele
|
|||||||
if ((endOffset - startOffset) != 1)
|
if ((endOffset - startOffset) != 1)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> atom;
|
if (!content->IsContentOfType(nsIContent::eHTML)) {
|
||||||
content->GetTag(getter_AddRefs(atom));
|
return NS_OK;
|
||||||
if (!atom) return NS_ERROR_FAILURE;
|
}
|
||||||
|
|
||||||
if (atom == nsHTMLAtoms::tr)
|
nsIAtom *tag = content->Tag();
|
||||||
|
|
||||||
|
if (tag == nsHTMLAtoms::tr)
|
||||||
{
|
{
|
||||||
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_CELL;
|
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_CELL;
|
||||||
}
|
}
|
||||||
@ -4273,13 +4269,14 @@ nsTypedSelection::GetTableSelectionType(nsIDOMRange* aRange, PRInt32* aTableSele
|
|||||||
if (!child)
|
if (!child)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
child->GetTag(getter_AddRefs(atom));
|
tag = child->Tag();
|
||||||
|
|
||||||
if (atom == nsHTMLAtoms::table)
|
if (tag == nsHTMLAtoms::table)
|
||||||
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_TABLE;
|
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_TABLE;
|
||||||
else if (atom == nsHTMLAtoms::tr)
|
else if (tag == nsHTMLAtoms::tr)
|
||||||
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_ROW;
|
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_ROW;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5945,16 +5942,10 @@ nsTypedSelection::Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset)
|
|||||||
content = do_QueryInterface(aParentNode);
|
content = do_QueryInterface(aParentNode);
|
||||||
if (!content)
|
if (!content)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
content->GetTag(getter_AddRefs(tag));
|
const char *tagString;
|
||||||
if (tag)
|
content->Tag()->GetUTF8String(&tagString);
|
||||||
{
|
printf ("Sel. Collapse to %p %s %d\n", content, tagString, aOffset);
|
||||||
nsAutoString tagString;
|
|
||||||
tag->ToString(tagString);
|
|
||||||
char * tagCString = ToNewCString(tagString);
|
|
||||||
printf ("Sel. Collapse to %p %s %d\n", content, tagCString, aOffset);
|
|
||||||
delete [] tagCString;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf ("Sel. Collapse set to null parent.\n");
|
printf ("Sel. Collapse set to null parent.\n");
|
||||||
@ -6135,8 +6126,7 @@ nsTypedSelection::FixupSelectionPoints(nsIDOMRange *aRange , nsDirection *aDir,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
// if end node is a tbody then all bets are off we cannot select "rows"
|
// if end node is a tbody then all bets are off we cannot select "rows"
|
||||||
nsCOMPtr<nsIAtom> atom;
|
nsIAtom *atom = GetTag(endNode);
|
||||||
atom = GetTag(endNode);
|
|
||||||
if (atom == nsHTMLAtoms::tbody)
|
if (atom == nsHTMLAtoms::tbody)
|
||||||
return NS_ERROR_FAILURE; //cannot select INTO row node ony cells
|
return NS_ERROR_FAILURE; //cannot select INTO row node ony cells
|
||||||
|
|
||||||
@ -6719,7 +6709,6 @@ nsTypedSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset)
|
|||||||
res = CopyRangeToAnchorFocus(range);
|
res = CopyRangeToAnchorFocus(range);
|
||||||
if (NS_FAILED(res))
|
if (NS_FAILED(res))
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_OUT_RANGE(range);
|
DEBUG_OUT_RANGE(range);
|
||||||
@ -6735,16 +6724,10 @@ nsTypedSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset)
|
|||||||
{
|
{
|
||||||
nsCOMPtr<nsIContent>content;
|
nsCOMPtr<nsIContent>content;
|
||||||
content = do_QueryInterface(aParentNode);
|
content = do_QueryInterface(aParentNode);
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
content->GetTag(getter_AddRefs(tag));
|
const char *tagString;
|
||||||
if (tag)
|
content->Tag()->GetUTF8String(&tagString);
|
||||||
{
|
printf ("Sel. Extend to %p %s %d\n", content, tagString, aOffset);
|
||||||
nsAutoString tagString;
|
|
||||||
tag->ToString(tagString);
|
|
||||||
char * tagCString = ToNewCString(tagString);
|
|
||||||
printf ("Sel. Extend to %p %s %d\n", content, tagCString, aOffset);
|
|
||||||
delete [] tagCString;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf ("Sel. Extend set to null parent.\n");
|
printf ("Sel. Extend set to null parent.\n");
|
||||||
|
|||||||
@ -62,7 +62,7 @@ public:
|
|||||||
NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::)
|
NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::)
|
||||||
|
|
||||||
// nsIContent
|
// nsIContent
|
||||||
NS_IMETHOD GetTag(nsIAtom** aResult) const;
|
nsIAtom *Tag() const;
|
||||||
NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags);
|
NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
||||||
@ -105,12 +105,10 @@ NS_INTERFACE_MAP_BEGIN(nsTextNode)
|
|||||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Text)
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Text)
|
||||||
NS_INTERFACE_MAP_END_INHERITING(nsGenericDOMDataNode)
|
NS_INTERFACE_MAP_END_INHERITING(nsGenericDOMDataNode)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsIAtom *
|
||||||
nsTextNode::GetTag(nsIAtom** aResult) const
|
nsTextNode::Tag() const
|
||||||
{
|
{
|
||||||
NS_ADDREF(*aResult = nsLayoutAtoms::textTagName);
|
return nsLayoutAtoms::textTagName;
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|||||||
@ -99,7 +99,7 @@ nsTreeWalker::~nsTreeWalker()
|
|||||||
* nsISupports stuff
|
* nsISupports stuff
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// QueryInterface implementation for nsDOMDocumentType
|
// QueryInterface implementation for nsTreeWalker
|
||||||
NS_INTERFACE_MAP_BEGIN(nsTreeWalker)
|
NS_INTERFACE_MAP_BEGIN(nsTreeWalker)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMTreeWalker)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMTreeWalker)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||||
|
|||||||
@ -580,9 +580,7 @@ nsXMLContentSerializer::AppendElementStart(nsIDOMElement *aElement,
|
|||||||
PRInt32 elementNsID;
|
PRInt32 elementNsID;
|
||||||
content->GetNameSpaceID(&elementNsID);
|
content->GetNameSpaceID(&elementNsID);
|
||||||
if (elementNsID == kNameSpaceID_XHTML) {
|
if (elementNsID == kNameSpaceID_XHTML) {
|
||||||
nsCOMPtr<nsIAtom> elementName;
|
if (IsShorthandAttr(attrName, content->Tag()) &&
|
||||||
content->GetTag(getter_AddRefs(elementName));
|
|
||||||
if (IsShorthandAttr(attrName, elementName) &&
|
|
||||||
valueStr.IsEmpty()) {
|
valueStr.IsEmpty()) {
|
||||||
valueStr = nameStr;
|
valueStr = nameStr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -879,31 +879,24 @@ nsEventStateManager::HandleAccessKey(nsIPresContext* aPresContext,
|
|||||||
if (mAccessKeys->Exists(&key)) {
|
if (mAccessKeys->Exists(&key)) {
|
||||||
nsCOMPtr<nsIContent> content = dont_AddRef(NS_STATIC_CAST(nsIContent*, mAccessKeys->Get(&key)));
|
nsCOMPtr<nsIContent> content = dont_AddRef(NS_STATIC_CAST(nsIContent*, mAccessKeys->Get(&key)));
|
||||||
|
|
||||||
PRBool isXUL = content->IsContentOfType(nsIContent::eXUL);
|
|
||||||
|
|
||||||
// if it's a XUL element...
|
// if it's a XUL element...
|
||||||
if (isXUL) {
|
if (content->IsContentOfType(nsIContent::eXUL)) {
|
||||||
|
|
||||||
// find out what type of content node this is
|
// find out what type of content node this is
|
||||||
nsCOMPtr<nsIAtom> atom;
|
if (content->Tag() == nsXULAtoms::label) {
|
||||||
nsresult rv = content->GetTag(getter_AddRefs(atom));
|
// If anything fails, this will be null ...
|
||||||
if (NS_SUCCEEDED(rv) && atom) {
|
nsCOMPtr<nsIDOMElement> element;
|
||||||
if (atom == nsXULAtoms::label) {
|
|
||||||
// If anything fails, this will be null ...
|
|
||||||
nsCOMPtr<nsIDOMElement> element;
|
|
||||||
|
|
||||||
nsAutoString control;
|
nsAutoString control;
|
||||||
content->GetAttr(kNameSpaceID_None, nsXULAtoms::control, control);
|
content->GetAttr(kNameSpaceID_None, nsXULAtoms::control, control);
|
||||||
if (!control.IsEmpty()) {
|
if (!control.IsEmpty()) {
|
||||||
nsCOMPtr<nsIDOMDocument> domDocument =
|
nsCOMPtr<nsIDOMDocument> domDocument =
|
||||||
do_QueryInterface(content->GetDocument());
|
do_QueryInterface(content->GetDocument());
|
||||||
if (domDocument)
|
if (domDocument)
|
||||||
domDocument->GetElementById(control, getter_AddRefs(element));
|
domDocument->GetElementById(control, getter_AddRefs(element));
|
||||||
}
|
|
||||||
// ... that here we'll either change |content| to the element
|
|
||||||
// referenced by |element|, or clear it.
|
|
||||||
content = do_QueryInterface(element);
|
|
||||||
}
|
}
|
||||||
|
// ... that here we'll either change |content| to the element
|
||||||
|
// referenced by |element|, or clear it.
|
||||||
|
content = do_QueryInterface(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!content)
|
if (!content)
|
||||||
@ -929,22 +922,19 @@ nsEventStateManager::HandleAccessKey(nsIPresContext* aPresContext,
|
|||||||
element) {
|
element) {
|
||||||
|
|
||||||
// find out what type of content node this is
|
// find out what type of content node this is
|
||||||
nsCOMPtr<nsIAtom> atom;
|
nsIAtom *atom = content->Tag();
|
||||||
nsresult rv = content->GetTag(getter_AddRefs(atom));
|
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && atom) {
|
// define behavior for each type of XUL element:
|
||||||
// define behavior for each type of XUL element:
|
if (atom == nsXULAtoms::textbox || atom == nsXULAtoms::menulist) {
|
||||||
if (atom == nsXULAtoms::textbox || atom == nsXULAtoms::menulist) {
|
// if it's a text box or menulist, give it focus
|
||||||
// if it's a text box or menulist, give it focus
|
element->Focus();
|
||||||
element->Focus();
|
} else if (atom == nsXULAtoms::toolbarbutton) {
|
||||||
} else if (atom == nsXULAtoms::toolbarbutton) {
|
// if it's a toolbar button, just click
|
||||||
// if it's a toolbar button, just click
|
element->Click();
|
||||||
element->Click();
|
} else {
|
||||||
} else {
|
// otherwise, focus and click in it
|
||||||
// otherwise, focus and click in it
|
element->Focus();
|
||||||
element->Focus();
|
element->Click();
|
||||||
element->Click();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1078,36 +1068,36 @@ nsEventStateManager::HandleAccessKey(nsIPresContext* aPresContext,
|
|||||||
// a drag.
|
// a drag.
|
||||||
//
|
//
|
||||||
void
|
void
|
||||||
nsEventStateManager :: CreateClickHoldTimer ( nsIPresContext* inPresContext, nsGUIEvent* inMouseDownEvent )
|
nsEventStateManager::CreateClickHoldTimer(nsIPresContext* inPresContext,
|
||||||
|
nsGUIEvent* inMouseDownEvent)
|
||||||
{
|
{
|
||||||
// just to be anal (er, safe)
|
// just to be anal (er, safe)
|
||||||
if ( mClickHoldTimer ) {
|
if (mClickHoldTimer) {
|
||||||
mClickHoldTimer->Cancel();
|
mClickHoldTimer->Cancel();
|
||||||
mClickHoldTimer = nsnull;
|
mClickHoldTimer = nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if content clicked on has a popup, don't even start the timer
|
// if content clicked on has a popup, don't even start the timer
|
||||||
// since we'll end up conflicting and both will show.
|
// since we'll end up conflicting and both will show.
|
||||||
if ( mGestureDownFrame ) {
|
if (mGestureDownFrame) {
|
||||||
nsIContent* clickedContent = mGestureDownFrame->GetContent();
|
nsIContent* clickedContent = mGestureDownFrame->GetContent();
|
||||||
if ( clickedContent ) {
|
if (clickedContent) {
|
||||||
// check for the |popup| attribute
|
// check for the |popup| attribute
|
||||||
nsAutoString popup;
|
nsAutoString popup;
|
||||||
clickedContent->GetAttr(kNameSpaceID_None, nsXULAtoms::popup, popup);
|
clickedContent->GetAttr(kNameSpaceID_None, nsXULAtoms::popup, popup);
|
||||||
if ( popup != NS_LITERAL_STRING("") )
|
if (popup != NS_LITERAL_STRING(""))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// check for a <menubutton> like bookmarks
|
// check for a <menubutton> like bookmarks
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (clickedContent->Tag() == nsXULAtoms::menubutton)
|
||||||
clickedContent->GetTag ( getter_AddRefs(tag) );
|
|
||||||
if ( tag == nsXULAtoms::menubutton )
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mClickHoldTimer = do_CreateInstance("@mozilla.org/timer;1");
|
mClickHoldTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||||
if ( mClickHoldTimer )
|
if ( mClickHoldTimer )
|
||||||
mClickHoldTimer->InitWithFuncCallback(sClickHoldCallback, this, kClickHoldDelay,
|
mClickHoldTimer->InitWithFuncCallback(sClickHoldCallback, this,
|
||||||
|
kClickHoldDelay,
|
||||||
nsITimer::TYPE_ONE_SHOT);
|
nsITimer::TYPE_ONE_SHOT);
|
||||||
|
|
||||||
mEventPoint = inMouseDownEvent->point;
|
mEventPoint = inMouseDownEvent->point;
|
||||||
@ -1125,9 +1115,9 @@ nsEventStateManager :: CreateClickHoldTimer ( nsIPresContext* inPresContext, nsG
|
|||||||
// Stop the timer that would show the context menu dead in its tracks
|
// Stop the timer that would show the context menu dead in its tracks
|
||||||
//
|
//
|
||||||
void
|
void
|
||||||
nsEventStateManager :: KillClickHoldTimer ( )
|
nsEventStateManager::KillClickHoldTimer()
|
||||||
{
|
{
|
||||||
if ( mClickHoldTimer ) {
|
if (mClickHoldTimer) {
|
||||||
mClickHoldTimer->Cancel();
|
mClickHoldTimer->Cancel();
|
||||||
mClickHoldTimer = nsnull;
|
mClickHoldTimer = nsnull;
|
||||||
}
|
}
|
||||||
@ -1144,7 +1134,7 @@ nsEventStateManager :: KillClickHoldTimer ( )
|
|||||||
// This fires after the mouse has been down for a certain length of time.
|
// This fires after the mouse has been down for a certain length of time.
|
||||||
//
|
//
|
||||||
void
|
void
|
||||||
nsEventStateManager :: sClickHoldCallback ( nsITimer *aTimer, void* aESM )
|
nsEventStateManager::sClickHoldCallback(nsITimer *aTimer, void* aESM)
|
||||||
{
|
{
|
||||||
nsEventStateManager* self = NS_STATIC_CAST(nsEventStateManager*, aESM);
|
nsEventStateManager* self = NS_STATIC_CAST(nsEventStateManager*, aESM);
|
||||||
if ( self )
|
if ( self )
|
||||||
@ -1170,7 +1160,7 @@ nsEventStateManager :: sClickHoldCallback ( nsITimer *aTimer, void* aESM )
|
|||||||
// _not_ what we want.
|
// _not_ what we want.
|
||||||
//
|
//
|
||||||
void
|
void
|
||||||
nsEventStateManager :: FireContextClick ( )
|
nsEventStateManager::FireContextClick()
|
||||||
{
|
{
|
||||||
if ( !mEventDownWidget || !mEventPresContext )
|
if ( !mEventDownWidget || !mEventPresContext )
|
||||||
return;
|
return;
|
||||||
@ -1205,47 +1195,54 @@ nsEventStateManager :: FireContextClick ( )
|
|||||||
mCurrentTarget = mGestureDownFrame;
|
mCurrentTarget = mGestureDownFrame;
|
||||||
if ( mGestureDownFrame ) {
|
if ( mGestureDownFrame ) {
|
||||||
nsIContent* lastContent = mGestureDownFrame->GetContent();
|
nsIContent* lastContent = mGestureDownFrame->GetContent();
|
||||||
|
|
||||||
if ( lastContent ) {
|
if ( lastContent ) {
|
||||||
// before dispatching, check that we're not on something that doesn't get a context menu
|
// before dispatching, check that we're not on something that
|
||||||
|
// doesn't get a context menu
|
||||||
|
nsIAtom *tag = lastContent->Tag();
|
||||||
PRBool allowedToDispatch = PR_TRUE;
|
PRBool allowedToDispatch = PR_TRUE;
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (lastContent->IsContentOfType(nsIContent::eXUL)) {
|
||||||
lastContent->GetTag ( getter_AddRefs(tag) );
|
if (tag == nsXULAtoms::scrollbar ||
|
||||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElm ( do_QueryInterface(lastContent) );
|
tag == nsXULAtoms::scrollbarbutton ||
|
||||||
PRBool isFormControl =
|
tag == nsXULAtoms::button)
|
||||||
lastContent->IsContentOfType(nsIContent::eHTML_FORM_CONTROL);
|
allowedToDispatch = PR_FALSE;
|
||||||
if ( inputElm ) {
|
else if (tag == nsXULAtoms::toolbarbutton) {
|
||||||
// of all input elements, only ones dealing with text are allowed to have context menus
|
// a <toolbarbutton> that has the container attribute set
|
||||||
if ( tag == nsHTMLAtoms::input ) {
|
// will already have its own dropdown.
|
||||||
nsAutoString type;
|
nsAutoString container;
|
||||||
lastContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, type);
|
lastContent->GetAttr(kNameSpaceID_None, nsXULAtoms::container,
|
||||||
if ( type != NS_LITERAL_STRING("") && type != NS_LITERAL_STRING("text") &&
|
container);
|
||||||
type != NS_LITERAL_STRING("password") && type != NS_LITERAL_STRING("file") )
|
if (!container.IsEmpty())
|
||||||
allowedToDispatch = PR_FALSE;
|
allowedToDispatch = PR_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( isFormControl && tag != nsHTMLAtoms::textarea )
|
else if (lastContent->IsContentOfType(eHTML)) {
|
||||||
// catches combo-boxes, <object>
|
nsCOMPtr<nsIFormControl> formCtrl(do_QueryInterface(lastContent));
|
||||||
allowedToDispatch = PR_FALSE;
|
|
||||||
else if ( tag == nsXULAtoms::scrollbar || tag == nsXULAtoms::scrollbarbutton || tag == nsXULAtoms::button )
|
if (formCtrl) {
|
||||||
allowedToDispatch = PR_FALSE;
|
// of all form controls, only ones dealing with text are
|
||||||
else if ( tag == nsHTMLAtoms::applet || tag == nsHTMLAtoms::embed )
|
// allowed to have context menus
|
||||||
allowedToDispatch = PR_FALSE;
|
PRInt32 formCtrlType = formCtrl->GetType();
|
||||||
else if ( tag == nsXULAtoms::toolbarbutton ) {
|
|
||||||
// a <toolbarbutton> that has the container attribute set will already have its
|
allowedToDispatch = (type == NS_FORM_INPUT_TEXT ||
|
||||||
// own dropdown.
|
type == NS_FORM_INPUT_PASSWORD ||
|
||||||
nsAutoString container;
|
type == NS_FORM_INPUT_FILE ||
|
||||||
lastContent->GetAttr(kNameSpaceID_None, nsXULAtoms::container, container);
|
type == NS_FORM_TEXTAREA);
|
||||||
if ( container.Length() )
|
}
|
||||||
|
else if (tag == nsHTMLAtoms::applet ||
|
||||||
|
tag == nsHTMLAtoms::embed ||
|
||||||
|
tag == nsHTMLAtoms::object) {
|
||||||
allowedToDispatch = PR_FALSE;
|
allowedToDispatch = PR_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( allowedToDispatch ) {
|
if (allowedToDispatch) {
|
||||||
// stop selection tracking, we're in control now
|
// stop selection tracking, we're in control now
|
||||||
nsCOMPtr<nsIFrameSelection> frameSel;
|
nsCOMPtr<nsIFrameSelection> frameSel;
|
||||||
GetSelection ( mGestureDownFrame, mEventPresContext, getter_AddRefs(frameSel) );
|
GetSelection(mGestureDownFrame, mEventPresContext,
|
||||||
if ( frameSel ) {
|
getter_AddRefs(frameSel));
|
||||||
|
if (frameSel) {
|
||||||
PRBool mouseDownState = PR_TRUE;
|
PRBool mouseDownState = PR_TRUE;
|
||||||
frameSel->GetMouseDownState(&mouseDownState);
|
frameSel->GetMouseDownState(&mouseDownState);
|
||||||
if (mouseDownState)
|
if (mouseDownState)
|
||||||
@ -1253,14 +1250,15 @@ nsEventStateManager :: FireContextClick ( )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// dispatch to DOM
|
// dispatch to DOM
|
||||||
lastContent->HandleDOMEvent(mEventPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
|
lastContent->HandleDOMEvent(mEventPresContext, &event, nsnull,
|
||||||
|
NS_EVENT_FLAG_INIT, &status);
|
||||||
|
|
||||||
// Firing the DOM event could have caused mGestureDownFrame to
|
// Firing the DOM event could have caused mGestureDownFrame to
|
||||||
// be destroyed. So, null-check it again.
|
// be destroyed. So, null-check it again.
|
||||||
|
|
||||||
if (mGestureDownFrame) {
|
if (mGestureDownFrame) {
|
||||||
// dispatch to the frame
|
// dispatch to the frame
|
||||||
mGestureDownFrame->HandleEvent(mEventPresContext, &event, &status);
|
mGestureDownFrame->HandleEvent(mEventPresContext, &event, &status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1290,7 +1288,9 @@ nsEventStateManager :: FireContextClick ( )
|
|||||||
// want to cancel the drag gesture if the context-click event is handled.
|
// want to cancel the drag gesture if the context-click event is handled.
|
||||||
//
|
//
|
||||||
void
|
void
|
||||||
nsEventStateManager :: BeginTrackingDragGesture ( nsIPresContext* aPresContext, nsGUIEvent* inDownEvent, nsIFrame* inDownFrame )
|
nsEventStateManager::BeginTrackingDragGesture(nsIPresContext* aPresContext,
|
||||||
|
nsGUIEvent* inDownEvent,
|
||||||
|
nsIFrame* inDownFrame)
|
||||||
{
|
{
|
||||||
mIsTrackingDragGesture = PR_TRUE;
|
mIsTrackingDragGesture = PR_TRUE;
|
||||||
mGestureDownPoint = inDownEvent->point;
|
mGestureDownPoint = inDownEvent->point;
|
||||||
@ -1312,7 +1312,7 @@ nsEventStateManager :: BeginTrackingDragGesture ( nsIPresContext* aPresContext,
|
|||||||
// state of d&d gesture tracker and return to the START state.
|
// state of d&d gesture tracker and return to the START state.
|
||||||
//
|
//
|
||||||
void
|
void
|
||||||
nsEventStateManager :: StopTrackingDragGesture ( )
|
nsEventStateManager::StopTrackingDragGesture()
|
||||||
{
|
{
|
||||||
mIsTrackingDragGesture = PR_FALSE;
|
mIsTrackingDragGesture = PR_FALSE;
|
||||||
mGestureDownPoint = nsPoint(0,0);
|
mGestureDownPoint = nsPoint(0,0);
|
||||||
@ -1327,7 +1327,9 @@ nsEventStateManager :: StopTrackingDragGesture ( )
|
|||||||
// Helper routine to get an nsIFrameSelection from the given frame
|
// Helper routine to get an nsIFrameSelection from the given frame
|
||||||
//
|
//
|
||||||
void
|
void
|
||||||
nsEventStateManager :: GetSelection ( nsIFrame* inFrame, nsIPresContext* inPresContext, nsIFrameSelection** outSelection )
|
nsEventStateManager::GetSelection(nsIFrame* inFrame,
|
||||||
|
nsIPresContext* inPresContext,
|
||||||
|
nsIFrameSelection** outSelection)
|
||||||
{
|
{
|
||||||
*outSelection = nsnull;
|
*outSelection = nsnull;
|
||||||
|
|
||||||
@ -1371,7 +1373,8 @@ nsEventStateManager :: GetSelection ( nsIFrame* inFrame, nsIPresContext* inPresC
|
|||||||
// Do we need to do anything about this? Let's wait and see.
|
// Do we need to do anything about this? Let's wait and see.
|
||||||
//
|
//
|
||||||
void
|
void
|
||||||
nsEventStateManager :: GenerateDragGesture ( nsIPresContext* aPresContext, nsGUIEvent *aEvent )
|
nsEventStateManager::GenerateDragGesture(nsIPresContext* aPresContext,
|
||||||
|
nsGUIEvent *aEvent)
|
||||||
{
|
{
|
||||||
NS_WARN_IF_FALSE(aPresContext, "This shouldn't happen.");
|
NS_WARN_IF_FALSE(aPresContext, "This shouldn't happen.");
|
||||||
if ( IsTrackingDragGesture() ) {
|
if ( IsTrackingDragGesture() ) {
|
||||||
@ -2276,13 +2279,15 @@ nsEventStateManager::GetNearestScrollingView(nsIView* aView)
|
|||||||
PRBool
|
PRBool
|
||||||
nsEventStateManager::CheckDisabled(nsIContent* aContent)
|
nsEventStateManager::CheckDisabled(nsIContent* aContent)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = aContent->Tag();
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (tag == nsHTMLAtoms::input ||
|
if (((tag == nsHTMLAtoms::input ||
|
||||||
tag == nsHTMLAtoms::select ||
|
tag == nsHTMLAtoms::select ||
|
||||||
tag == nsHTMLAtoms::textarea ||
|
tag == nsHTMLAtoms::textarea ||
|
||||||
tag == nsHTMLAtoms::button) {
|
tag == nsHTMLAtoms::button) &&
|
||||||
|
(aContent->IsContentOfType(nsIContent::eHTML))) ||
|
||||||
|
(tag == nsHTMLAtoms::button &&
|
||||||
|
aContent->IsContentOfType(nsIContent::eXUL))) {
|
||||||
return aContent->HasAttr(kNameSpaceID_None, nsHTMLAtoms::disabled);
|
return aContent->HasAttr(kNameSpaceID_None, nsHTMLAtoms::disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2519,9 +2524,7 @@ nsEventStateManager::MaybeDispatchMouseEventToIframe(
|
|||||||
if (parentDoc) {
|
if (parentDoc) {
|
||||||
nsIContent *docContent = parentDoc->FindContentForSubDocument(mDocument);
|
nsIContent *docContent = parentDoc->FindContentForSubDocument(mDocument);
|
||||||
if (docContent) {
|
if (docContent) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (docContent->Tag() == nsHTMLAtoms::iframe) {
|
||||||
docContent->GetTag(getter_AddRefs(tag));
|
|
||||||
if (tag == nsHTMLAtoms::iframe) {
|
|
||||||
// We're an IFRAME. Send an event to our IFRAME tag.
|
// We're an IFRAME. Send an event to our IFRAME tag.
|
||||||
nsIPresShell *parentShell = parentDoc->GetShellAt(0);
|
nsIPresShell *parentShell = parentDoc->GetShellAt(0);
|
||||||
if (parentShell) {
|
if (parentShell) {
|
||||||
@ -2548,7 +2551,8 @@ nsEventStateManager::MaybeDispatchMouseEventToIframe(
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIEvent* aEvent)
|
nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext,
|
||||||
|
nsGUIEvent* aEvent)
|
||||||
{
|
{
|
||||||
// Hold onto old target content through the event and reset after.
|
// Hold onto old target content through the event and reset after.
|
||||||
nsCOMPtr<nsIContent> targetBeforeEvent = mCurrentTargetContent;
|
nsCOMPtr<nsIContent> targetBeforeEvent = mCurrentTargetContent;
|
||||||
@ -2664,7 +2668,8 @@ nsEventStateManager::GenerateMouseEnterExit(nsIPresContext* aPresContext, nsGUIE
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsEventStateManager::GenerateDragDropEnterExit(nsIPresContext* aPresContext, nsGUIEvent* aEvent)
|
nsEventStateManager::GenerateDragDropEnterExit(nsIPresContext* aPresContext,
|
||||||
|
nsGUIEvent* aEvent)
|
||||||
{
|
{
|
||||||
//Hold onto old target content through the event and reset after.
|
//Hold onto old target content through the event and reset after.
|
||||||
nsCOMPtr<nsIContent> targetBeforeEvent = mCurrentTargetContent;
|
nsCOMPtr<nsIContent> targetBeforeEvent = mCurrentTargetContent;
|
||||||
@ -2943,7 +2948,8 @@ nsEventStateManager::CheckForAndDispatchClick(nsIPresContext* aPresContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
nsEventStateManager::ChangeFocus(nsIContent* aFocusContent, PRInt32 aFocusedWith)
|
nsEventStateManager::ChangeFocus(nsIContent* aFocusContent,
|
||||||
|
PRInt32 aFocusedWith)
|
||||||
{
|
{
|
||||||
aFocusContent->SetFocus(mPresContext);
|
aFocusContent->SetFocus(mPresContext);
|
||||||
if (aFocusedWith != eEventFocusedByMouse) {
|
if (aFocusedWith != eEventFocusedByMouse) {
|
||||||
@ -3310,13 +3316,19 @@ nsEventStateManager::ShiftFocusInternal(PRBool aForward, nsIContent* aStart)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsEventStateManager::TabIndexFrom(nsIContent *aFrom, PRInt32 *aOutIndex)
|
void
|
||||||
|
nsEventStateManager::TabIndexFrom(nsIContent *aFrom, PRInt32 *aOutIndex)
|
||||||
{
|
{
|
||||||
if (aFrom->IsContentOfType(nsIContent::eHTML)) {
|
if (aFrom->IsContentOfType(nsIContent::eHTML)) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = aFrom->Tag();
|
||||||
aFrom->GetTag(getter_AddRefs(tag));
|
|
||||||
if (nsHTMLAtoms::a != tag && nsHTMLAtoms::area != tag && nsHTMLAtoms::button != tag &&
|
if (tag != nsHTMLAtoms::a &&
|
||||||
nsHTMLAtoms::input != tag && nsHTMLAtoms::object != tag && nsHTMLAtoms::select != tag && nsHTMLAtoms::textarea != tag)
|
tag != nsHTMLAtoms::area &&
|
||||||
|
tag != nsHTMLAtoms::button &&
|
||||||
|
tag != nsHTMLAtoms::input &&
|
||||||
|
tag != nsHTMLAtoms::object &&
|
||||||
|
tag != nsHTMLAtoms::select &&
|
||||||
|
tag != nsHTMLAtoms::textarea)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3366,9 +3378,8 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent,
|
|||||||
|
|
||||||
//Need to do special check in case we're in an imagemap which has multiple content per frame
|
//Need to do special check in case we're in an imagemap which has multiple content per frame
|
||||||
if (mCurrentFocus) {
|
if (mCurrentFocus) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (mCurrentFocus->Tag() == nsHTMLAtoms::area &&
|
||||||
mCurrentFocus->GetTag(getter_AddRefs(tag));
|
mCurrentFocus->IsContentOfType(nsIContent::eHTML)) {
|
||||||
if (nsHTMLAtoms::area==tag) {
|
|
||||||
//Focus is in an imagemap area
|
//Focus is in an imagemap area
|
||||||
if (aFrame == mCurrentFocusFrame) {
|
if (aFrame == mCurrentFocusFrame) {
|
||||||
//The current focus map area is in the current frame, don't skip over it.
|
//The current focus map area is in the current frame, don't skip over it.
|
||||||
@ -3413,7 +3424,6 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent,
|
|||||||
(vis->mVisible != NS_STYLE_VISIBILITY_HIDDEN) &&
|
(vis->mVisible != NS_STYLE_VISIBILITY_HIDDEN) &&
|
||||||
(ui->mUserFocus != NS_STYLE_USER_FOCUS_IGNORE) &&
|
(ui->mUserFocus != NS_STYLE_USER_FOCUS_IGNORE) &&
|
||||||
(ui->mUserFocus != NS_STYLE_USER_FOCUS_NONE) && element) {
|
(ui->mUserFocus != NS_STYLE_USER_FOCUS_NONE) && element) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
PRInt32 tabIndex = -1;
|
PRInt32 tabIndex = -1;
|
||||||
PRBool disabled = PR_TRUE;
|
PRBool disabled = PR_TRUE;
|
||||||
PRBool hidden = PR_FALSE;
|
PRBool hidden = PR_FALSE;
|
||||||
@ -3428,9 +3438,9 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent,
|
|||||||
mPrefBranch->GetIntPref("accessibility.tabfocus", &tabFocusModel);
|
mPrefBranch->GetIntPref("accessibility.tabfocus", &tabFocusModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
child->GetTag(getter_AddRefs(tag));
|
nsIAtom *tag = child->Tag();
|
||||||
if (child->IsContentOfType(nsIContent::eHTML)) {
|
if (child->IsContentOfType(nsIContent::eHTML)) {
|
||||||
if (nsHTMLAtoms::input==tag) {
|
if (tag == nsHTMLAtoms::input) {
|
||||||
nsCOMPtr<nsIDOMHTMLInputElement> nextInput(do_QueryInterface(child));
|
nsCOMPtr<nsIDOMHTMLInputElement> nextInput(do_QueryInterface(child));
|
||||||
if (nextInput) {
|
if (nextInput) {
|
||||||
nextInput->GetDisabled(&disabled);
|
nextInput->GetDisabled(&disabled);
|
||||||
@ -3457,7 +3467,7 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::select==tag) {
|
else if (tag == nsHTMLAtoms::select) {
|
||||||
// Select counts as form but not as text
|
// Select counts as form but not as text
|
||||||
disabled = !(tabFocusModel & eTabFocus_formElementsMask);
|
disabled = !(tabFocusModel & eTabFocus_formElementsMask);
|
||||||
if (!disabled) {
|
if (!disabled) {
|
||||||
@ -3468,7 +3478,7 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::textarea==tag) {
|
else if (tag == nsHTMLAtoms::textarea) {
|
||||||
// it's a textarea
|
// it's a textarea
|
||||||
disabled = PR_FALSE;
|
disabled = PR_FALSE;
|
||||||
if (!disabled) {
|
if (!disabled) {
|
||||||
@ -3479,7 +3489,7 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::a==tag) {
|
else if (tag == nsHTMLAtoms::a) {
|
||||||
// it's a link
|
// it's a link
|
||||||
disabled = !(tabFocusModel & eTabFocus_linksMask);
|
disabled = !(tabFocusModel & eTabFocus_linksMask);
|
||||||
nsCOMPtr<nsIDOMHTMLAnchorElement> nextAnchor(do_QueryInterface(child));
|
nsCOMPtr<nsIDOMHTMLAnchorElement> nextAnchor(do_QueryInterface(child));
|
||||||
@ -3495,7 +3505,7 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::button==tag) {
|
else if (tag == nsHTMLAtoms::button) {
|
||||||
// Button counts as a form element but not as text
|
// Button counts as a form element but not as text
|
||||||
disabled = !(tabFocusModel & eTabFocus_formElementsMask);
|
disabled = !(tabFocusModel & eTabFocus_formElementsMask);
|
||||||
if (!disabled) {
|
if (!disabled) {
|
||||||
@ -3506,7 +3516,7 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::img==tag) {
|
else if (tag == nsHTMLAtoms::img) {
|
||||||
// Don't need to set disabled here, because if we
|
// Don't need to set disabled here, because if we
|
||||||
// match an imagemap, we'll return from there.
|
// match an imagemap, we'll return from there.
|
||||||
if (tabFocusModel & eTabFocus_linksMask) {
|
if (tabFocusModel & eTabFocus_linksMask) {
|
||||||
@ -3564,7 +3574,7 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::object==tag) {
|
else if (tag == nsHTMLAtoms::object) {
|
||||||
// OBJECT is treated as a form element.
|
// OBJECT is treated as a form element.
|
||||||
disabled = !(tabFocusModel & eTabFocus_formElementsMask);
|
disabled = !(tabFocusModel & eTabFocus_formElementsMask);
|
||||||
if (!disabled) {
|
if (!disabled) {
|
||||||
@ -3574,7 +3584,7 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent,
|
|||||||
disabled = PR_FALSE;
|
disabled = PR_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (nsHTMLAtoms::iframe==tag || nsHTMLAtoms::frame==tag) {
|
else if (tag == nsHTMLAtoms::iframe || tag == nsHTMLAtoms::frame) {
|
||||||
disabled = PR_TRUE;
|
disabled = PR_TRUE;
|
||||||
if (child) {
|
if (child) {
|
||||||
nsCOMPtr<nsIDocument> doc = child->GetDocument();
|
nsCOMPtr<nsIDocument> doc = child->GetDocument();
|
||||||
@ -3620,7 +3630,6 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent,
|
|||||||
else
|
else
|
||||||
disabled = PR_FALSE;
|
disabled = PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//TabIndex not set (-1) treated at same level as set to 0
|
//TabIndex not set (-1) treated at same level as set to 0
|
||||||
@ -3741,7 +3750,8 @@ nsEventStateManager::GetEventTarget(nsIFrame **aFrame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsEventStateManager::GetEventTargetContent(nsEvent* aEvent, nsIContent** aContent)
|
nsEventStateManager::GetEventTargetContent(nsEvent* aEvent,
|
||||||
|
nsIContent** aContent)
|
||||||
{
|
{
|
||||||
if (aEvent &&
|
if (aEvent &&
|
||||||
(aEvent->message == NS_FOCUS_CONTENT ||
|
(aEvent->message == NS_FOCUS_CONTENT ||
|
||||||
@ -4071,7 +4081,9 @@ nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsEventStateManager::SendFocusBlur(nsIPresContext* aPresContext, nsIContent *aContent, PRBool aEnsureWindowHasFocus)
|
nsEventStateManager::SendFocusBlur(nsIPresContext* aPresContext,
|
||||||
|
nsIContent *aContent,
|
||||||
|
PRBool aEnsureWindowHasFocus)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIPresShell> presShell;
|
nsCOMPtr<nsIPresShell> presShell;
|
||||||
aPresContext->GetShell(getter_AddRefs(presShell));
|
aPresContext->GetShell(getter_AddRefs(presShell));
|
||||||
@ -4428,7 +4440,8 @@ nsEventStateManager::UnregisterAccessKey(nsIContent* aContent, PRUint32 aKey)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsEventStateManager::ForceViewUpdate(nsIView* aView)
|
void
|
||||||
|
nsEventStateManager::ForceViewUpdate(nsIView* aView)
|
||||||
{
|
{
|
||||||
// force the update to happen now, otherwise multiple scrolls can
|
// force the update to happen now, otherwise multiple scrolls can
|
||||||
// occur before the update is processed. (bug #7354)
|
// occur before the update is processed. (bug #7354)
|
||||||
@ -4505,7 +4518,9 @@ nsEventStateManager::DispatchNewEvent(nsISupports* aTarget, nsIDOMEvent* aEvent,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsEventStateManager::EnsureDocument(nsIPresContext* aPresContext) {
|
void
|
||||||
|
nsEventStateManager::EnsureDocument(nsIPresContext* aPresContext)
|
||||||
|
{
|
||||||
if (!mDocument) {
|
if (!mDocument) {
|
||||||
nsCOMPtr<nsIPresShell> presShell;
|
nsCOMPtr<nsIPresShell> presShell;
|
||||||
aPresContext->GetShell(getter_AddRefs(presShell));
|
aPresContext->GetShell(getter_AddRefs(presShell));
|
||||||
@ -4513,12 +4528,16 @@ void nsEventStateManager::EnsureDocument(nsIPresContext* aPresContext) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsEventStateManager::EnsureDocument(nsIPresShell* aPresShell) {
|
void
|
||||||
|
nsEventStateManager::EnsureDocument(nsIPresShell* aPresShell)
|
||||||
|
{
|
||||||
if (!mDocument && aPresShell)
|
if (!mDocument && aPresShell)
|
||||||
aPresShell->GetDocument(getter_AddRefs(mDocument));
|
aPresShell->GetDocument(getter_AddRefs(mDocument));
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsEventStateManager::FlushPendingEvents(nsIPresContext* aPresContext) {
|
void
|
||||||
|
nsEventStateManager::FlushPendingEvents(nsIPresContext* aPresContext)
|
||||||
|
{
|
||||||
NS_PRECONDITION(nsnull != aPresContext, "nsnull ptr");
|
NS_PRECONDITION(nsnull != aPresContext, "nsnull ptr");
|
||||||
nsCOMPtr<nsIPresShell> shell;
|
nsCOMPtr<nsIPresShell> shell;
|
||||||
aPresContext->GetShell(getter_AddRefs(shell));
|
aPresContext->GetShell(getter_AddRefs(shell));
|
||||||
@ -4677,7 +4696,8 @@ nsEventStateManager::GetDocSelectionLocation(nsIContent **aStartContent,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsEventStateManager::FocusElementButNotDocument(nsIContent *aContent)
|
void
|
||||||
|
nsEventStateManager::FocusElementButNotDocument(nsIContent *aContent)
|
||||||
{
|
{
|
||||||
// Focus an element in the current document, but don't switch document/window focus!
|
// Focus an element in the current document, but don't switch document/window focus!
|
||||||
|
|
||||||
@ -4726,7 +4746,9 @@ void nsEventStateManager::FocusElementButNotDocument(nsIContent *aContent)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsEventStateManager::MoveFocusToCaret(PRBool aCanFocusDoc, PRBool *aIsSelectionWithFocus)
|
NS_IMETHODIMP
|
||||||
|
nsEventStateManager::MoveFocusToCaret(PRBool aCanFocusDoc,
|
||||||
|
PRBool *aIsSelectionWithFocus)
|
||||||
{
|
{
|
||||||
// mBrowseWithCaret equals the pref accessibility.browsewithcaret
|
// mBrowseWithCaret equals the pref accessibility.browsewithcaret
|
||||||
// When it's true, the user can arrow around the browser as if it's a
|
// When it's true, the user can arrow around the browser as if it's a
|
||||||
@ -4754,7 +4776,6 @@ NS_IMETHODIMP nsEventStateManager::MoveFocusToCaret(PRBool aCanFocusDoc, PRBool
|
|||||||
// We could end the loop earlier, such as when we're no longer
|
// We could end the loop earlier, such as when we're no longer
|
||||||
// in the same frame, by comparing getPrimaryFrameFor(selectionContent)
|
// in the same frame, by comparing getPrimaryFrameFor(selectionContent)
|
||||||
// with a variable holding the starting selectionContent
|
// with a variable holding the starting selectionContent
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
while (testContent) {
|
while (testContent) {
|
||||||
// Keep testing while selectionContent is equal to something,
|
// Keep testing while selectionContent is equal to something,
|
||||||
// eventually we'll run out of ancestors
|
// eventually we'll run out of ancestors
|
||||||
@ -4764,10 +4785,11 @@ NS_IMETHODIMP nsEventStateManager::MoveFocusToCaret(PRBool aCanFocusDoc, PRBool
|
|||||||
return NS_OK; // already focused on this node, this whole thing's moot
|
return NS_OK; // already focused on this node, this whole thing's moot
|
||||||
}
|
}
|
||||||
|
|
||||||
testContent->GetTag(getter_AddRefs(tag));
|
nsIAtom *tag = testContent->Tag();
|
||||||
|
|
||||||
// Add better focusable test here later if necessary ...
|
// Add better focusable test here later if necessary ...
|
||||||
if (nsHTMLAtoms::a == tag.get()) {
|
if (tag == nsHTMLAtoms::a &&
|
||||||
|
testContent->IsContentOfType(nsIContent::eHTML)) {
|
||||||
*aIsSelectionWithFocus = PR_TRUE;
|
*aIsSelectionWithFocus = PR_TRUE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -4812,8 +4834,8 @@ NS_IMETHODIMP nsEventStateManager::MoveFocusToCaret(PRBool aCanFocusDoc, PRBool
|
|||||||
// Right now we only look for elements with the <a> tag.
|
// Right now we only look for elements with the <a> tag.
|
||||||
// Add better focusable test here later if necessary ...
|
// Add better focusable test here later if necessary ...
|
||||||
if (testContent) {
|
if (testContent) {
|
||||||
testContent->GetTag(getter_AddRefs(tag));
|
if (testContent->Tag() == nsHTMLAtoms::a &&
|
||||||
if (nsHTMLAtoms::a == tag.get()) {
|
testContent->IsContentOfType(nsIContent::eHTML)) {
|
||||||
*aIsSelectionWithFocus = PR_TRUE;
|
*aIsSelectionWithFocus = PR_TRUE;
|
||||||
FocusElementButNotDocument(testContent);
|
FocusElementButNotDocument(testContent);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -4856,7 +4878,8 @@ NS_IMETHODIMP nsEventStateManager::MoveFocusToCaret(PRBool aCanFocusDoc, PRBool
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsEventStateManager::MoveCaretToFocus()
|
NS_IMETHODIMP
|
||||||
|
nsEventStateManager::MoveCaretToFocus()
|
||||||
{
|
{
|
||||||
// If in HTML content and the pref accessibility.browsewithcaret is TRUE,
|
// If in HTML content and the pref accessibility.browsewithcaret is TRUE,
|
||||||
// then always move the caret to beginning of a new focus
|
// then always move the caret to beginning of a new focus
|
||||||
@ -4936,7 +4959,8 @@ NS_IMETHODIMP nsEventStateManager::MoveCaretToFocus()
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEventStateManager::SetCaretEnabled(nsIPresShell *aPresShell, PRBool aEnabled)
|
nsresult
|
||||||
|
nsEventStateManager::SetCaretEnabled(nsIPresShell *aPresShell, PRBool aEnabled)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsICaret> caret;
|
nsCOMPtr<nsICaret> caret;
|
||||||
aPresShell->GetCaret(getter_AddRefs(caret));
|
aPresShell->GetCaret(getter_AddRefs(caret));
|
||||||
@ -4959,8 +4983,11 @@ nsresult nsEventStateManager::SetCaretEnabled(nsIPresShell *aPresShell, PRBool a
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEventStateManager::SetContentCaretVisible(nsIPresShell* aPresShell, nsIContent *aFocusedContent, PRBool aVisible)
|
nsresult
|
||||||
{
|
nsEventStateManager::SetContentCaretVisible(nsIPresShell* aPresShell,
|
||||||
|
nsIContent *aFocusedContent,
|
||||||
|
PRBool aVisible)
|
||||||
|
{
|
||||||
// When browsing with caret, make sure caret is visible after new focus
|
// When browsing with caret, make sure caret is visible after new focus
|
||||||
nsCOMPtr<nsICaret> caret;
|
nsCOMPtr<nsICaret> caret;
|
||||||
aPresShell->GetCaret(getter_AddRefs(caret));
|
aPresShell->GetCaret(getter_AddRefs(caret));
|
||||||
@ -5127,10 +5154,8 @@ nsEventStateManager::IsIFrameDoc(nsIDocShell* aDocShell)
|
|||||||
|
|
||||||
if (!docContent)
|
if (!docContent)
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
return docContent->Tag() == nsHTMLAtoms::iframe;
|
||||||
docContent->GetTag(getter_AddRefs(tag));
|
|
||||||
return (tag == nsHTMLAtoms::iframe);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
|
|||||||
@ -48,7 +48,6 @@
|
|||||||
#include "nsISelection.h"
|
#include "nsISelection.h"
|
||||||
#include "nsIEnumerator.h"
|
#include "nsIEnumerator.h"
|
||||||
|
|
||||||
|
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsIEventStateManager.h"
|
#include "nsIEventStateManager.h"
|
||||||
#include "nsIPrivateDOMEvent.h"
|
#include "nsIPrivateDOMEvent.h"
|
||||||
@ -58,19 +57,18 @@
|
|||||||
#include "prprf.h"
|
#include "prprf.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
|
||||||
|
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsTextFragment.h"
|
#include "nsTextFragment.h"
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
#include "nsITextContent.h"
|
#include "nsITextContent.h"
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
|
#include "nsLayoutAtoms.h"
|
||||||
// XXX share all id's in this dir
|
// XXX share all id's in this dir
|
||||||
|
|
||||||
|
|
||||||
|
class nsAttributeContent : public nsITextContent, public nsIAttributeContent
|
||||||
|
{
|
||||||
class nsAttributeContent : public nsITextContent, public nsIAttributeContent {
|
|
||||||
public:
|
public:
|
||||||
friend nsresult NS_NewAttributeContent(nsAttributeContent** aNewFrame);
|
friend nsresult NS_NewAttributeContent(nsAttributeContent** aNewFrame);
|
||||||
|
|
||||||
@ -92,10 +90,9 @@ public:
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHOD GetTag(nsIAtom** aResult) const
|
nsIAtom *Tag() const
|
||||||
{
|
{
|
||||||
*aResult = nsnull;
|
return nsLayoutAtoms::textTagName;
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHOD_(nsINodeInfo *) GetNodeInfo() const
|
NS_IMETHOD_(nsINodeInfo *) GetNodeInfo() const
|
||||||
@ -171,9 +168,9 @@ public:
|
|||||||
PRUint32 aFlags,
|
PRUint32 aFlags,
|
||||||
nsEventStatus* aEventStatus);
|
nsEventStatus* aEventStatus);
|
||||||
|
|
||||||
NS_IMETHOD GetContentID(PRUint32* aID) {
|
virtual PRUint32 ContentID() const {
|
||||||
*aID = 0;
|
NS_ERROR("nsAttributeContent::ContentID() not implemented!");
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHOD SetContentID(PRUint32 aID) {
|
NS_IMETHOD SetContentID(PRUint32 aID) {
|
||||||
@ -182,7 +179,7 @@ public:
|
|||||||
|
|
||||||
NS_IMETHOD RangeAdd(nsIDOMRange* aRange);
|
NS_IMETHOD RangeAdd(nsIDOMRange* aRange);
|
||||||
NS_IMETHOD RangeRemove(nsIDOMRange* aRange);
|
NS_IMETHOD RangeRemove(nsIDOMRange* aRange);
|
||||||
NS_IMETHOD GetRangeList(nsVoidArray** aResult) const;
|
const nsVoidArray * GetRangeList() const;
|
||||||
|
|
||||||
// Implementation for nsIContent
|
// Implementation for nsIContent
|
||||||
NS_IMETHOD_(PRBool) CanContainChildren() const { return PR_FALSE; }
|
NS_IMETHOD_(PRBool) CanContainChildren() const { return PR_FALSE; }
|
||||||
@ -237,8 +234,7 @@ public:
|
|||||||
|
|
||||||
nsTextFragment mText;
|
nsTextFragment mText;
|
||||||
PRInt32 mNameSpaceID;
|
PRInt32 mNameSpaceID;
|
||||||
nsIAtom* mAttrName;
|
nsCOMPtr<nsIAtom> mAttrName;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -247,7 +243,7 @@ NS_NewAttributeContent(nsIContent** aContent)
|
|||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aContent);
|
NS_ENSURE_ARG_POINTER(aContent);
|
||||||
|
|
||||||
nsAttributeContent* it = new nsAttributeContent;
|
nsAttributeContent* it = new nsAttributeContent();
|
||||||
if (!it) {
|
if (!it) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
@ -261,27 +257,24 @@ nsAttributeContent::nsAttributeContent()
|
|||||||
: mText()
|
: mText()
|
||||||
{
|
{
|
||||||
mContent = nsnull;
|
mContent = nsnull;
|
||||||
mAttrName = nsnull;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
nsAttributeContent::~nsAttributeContent()
|
nsAttributeContent::~nsAttributeContent()
|
||||||
{
|
{
|
||||||
NS_IF_RELEASE(mAttrName);
|
|
||||||
//NS_IF_RELEASE(mDocument);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsAttributeContent::Init(nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aAttrName)
|
nsAttributeContent::Init(nsIContent* aContent, PRInt32 aNameSpaceID,
|
||||||
|
nsIAtom* aAttrName)
|
||||||
{
|
{
|
||||||
NS_ASSERTION((nsnull == mContent) && (nsnull != aContent), "null ptr");
|
NS_ENSURE_TRUE(aAttrName && aContent, NS_ERROR_NULL_POINTER);
|
||||||
|
|
||||||
mContent = aContent;
|
mContent = aContent;
|
||||||
|
|
||||||
NS_IF_RELEASE(mAttrName);
|
|
||||||
mNameSpaceID = aNameSpaceID;
|
mNameSpaceID = aNameSpaceID;
|
||||||
mAttrName = aAttrName;
|
mAttrName = aAttrName;
|
||||||
NS_ADDREF(mAttrName);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,7 +285,7 @@ nsAttributeContent::Init(nsIContent* aContent, PRInt32 aNameSpaceID, nsIAtom* aA
|
|||||||
* @param _classiiddef The name of the #define symbol that defines the IID
|
* @param _classiiddef The name of the #define symbol that defines the IID
|
||||||
* for the class (e.g. NS_ISUPPORTS_IID)
|
* for the class (e.g. NS_ISUPPORTS_IID)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsAttributeContent)
|
NS_INTERFACE_MAP_BEGIN(nsAttributeContent)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIContent)
|
NS_INTERFACE_MAP_ENTRY(nsIContent)
|
||||||
@ -343,10 +336,10 @@ nsAttributeContent::RangeRemove(nsIDOMRange* aRange)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
const nsVoidArray *
|
||||||
nsAttributeContent::GetRangeList(nsVoidArray** aResult) const
|
nsAttributeContent::GetRangeList() const
|
||||||
{
|
{
|
||||||
return NS_ERROR_FAILURE;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|||||||
@ -1430,17 +1430,17 @@ SinkContext::CloseContainer(const nsHTMLTag aTag)
|
|||||||
|
|
||||||
if (mStack[mStackPos].mNumFlushed < content->GetChildCount()) {
|
if (mStack[mStackPos].mNumFlushed < content->GetChildCount()) {
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
// Tracing code
|
{
|
||||||
nsCOMPtr<nsIAtom> tag;
|
// Tracing code
|
||||||
mStack[mStackPos].mContent->GetTag(getter_AddRefs(tag));
|
const char *tagStr;
|
||||||
const char *tagStr;
|
mStack[mStackPos].mContent->Tag()->GetUTF8String(&tagStr);
|
||||||
tag->GetUTF8String(&tagStr);
|
|
||||||
|
|
||||||
SINK_TRACE(SINK_TRACE_REFLOW,
|
SINK_TRACE(SINK_TRACE_REFLOW,
|
||||||
("SinkContext::CloseContainer: reflow on notifyImmediate "
|
("SinkContext::CloseContainer: reflow on notifyImmediate "
|
||||||
"tag=%s newIndex=%d stackPos=%d",
|
"tag=%s newIndex=%d stackPos=%d",
|
||||||
tagStr,
|
tagStr,
|
||||||
mStack[mStackPos].mNumFlushed, mStackPos));
|
mStack[mStackPos].mNumFlushed, mStackPos));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
mSink->NotifyAppend(content, mStack[mStackPos].mNumFlushed);
|
mSink->NotifyAppend(content, mStack[mStackPos].mNumFlushed);
|
||||||
}
|
}
|
||||||
@ -1846,16 +1846,16 @@ SinkContext::FlushTags(PRBool aNotify)
|
|||||||
|
|
||||||
if (!flushed && (mStack[stackPos].mNumFlushed < childCount)) {
|
if (!flushed && (mStack[stackPos].mNumFlushed < childCount)) {
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
// Tracing code
|
{
|
||||||
nsCOMPtr<nsIAtom> tag;
|
// Tracing code
|
||||||
mStack[stackPos].mContent->GetTag(getter_AddRefs(tag));
|
const char* tagStr;
|
||||||
const char* tagStr;
|
mStack[stackPos].mContent->Tag()->GetUTF8String(&tagStr);
|
||||||
tag->GetUTF8String(&tagStr);
|
|
||||||
|
|
||||||
SINK_TRACE(SINK_TRACE_REFLOW,
|
SINK_TRACE(SINK_TRACE_REFLOW,
|
||||||
("SinkContext::FlushTags: tag=%s from newindex=%d at "
|
("SinkContext::FlushTags: tag=%s from newindex=%d at "
|
||||||
"stackPos=%d", tagStr,
|
"stackPos=%d", tagStr,
|
||||||
mStack[stackPos].mNumFlushed, stackPos));
|
mStack[stackPos].mNumFlushed, stackPos));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if ((mStack[stackPos].mInsertionPoint != -1) &&
|
if ((mStack[stackPos].mInsertionPoint != -1) &&
|
||||||
(mStackPos > (stackPos + 1))) {
|
(mStackPos > (stackPos + 1))) {
|
||||||
|
|||||||
@ -1426,12 +1426,9 @@ nsHTMLDocument::AttributeWillChange(nsIContent* aContent, PRInt32 aNameSpaceID,
|
|||||||
|
|
||||||
if (!IsXHTML() && aAttribute == nsHTMLAtoms::name &&
|
if (!IsXHTML() && aAttribute == nsHTMLAtoms::name &&
|
||||||
aNameSpaceID == kNameSpaceID_None) {
|
aNameSpaceID == kNameSpaceID_None) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
|
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
if (IsNamedItem(aContent, aContent->Tag(), value)) {
|
||||||
|
|
||||||
if (IsNamedItem(aContent, tag, value)) {
|
|
||||||
nsresult rv = RemoveFromNameTable(value, aContent);
|
nsresult rv = RemoveFromNameTable(value, aContent);
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
@ -1459,12 +1456,9 @@ nsHTMLDocument::AttributeChanged(nsIContent* aContent, PRInt32 aNameSpaceID,
|
|||||||
|
|
||||||
if (!IsXHTML() && aAttribute == nsHTMLAtoms::name &&
|
if (!IsXHTML() && aAttribute == nsHTMLAtoms::name &&
|
||||||
aNameSpaceID == kNameSpaceID_None) {
|
aNameSpaceID == kNameSpaceID_None) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
|
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
if (IsNamedItem(aContent, aContent->Tag(), value)) {
|
||||||
|
|
||||||
if (IsNamedItem(aContent, tag, value)) {
|
|
||||||
nsresult rv = UpdateNameTableEntry(value, aContent);
|
nsresult rv = UpdateNameTableEntry(value, aContent);
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
@ -3499,9 +3493,7 @@ nsHTMLDocument::RemoveFromIdTable(nsIContent *aContent)
|
|||||||
nsresult
|
nsresult
|
||||||
nsHTMLDocument::UnregisterNamedItems(nsIContent *aContent)
|
nsHTMLDocument::UnregisterNamedItems(nsIContent *aContent)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = aContent->Tag();
|
||||||
|
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (tag == nsLayoutAtoms::textTagName) {
|
if (tag == nsLayoutAtoms::textTagName) {
|
||||||
// Text nodes are not named items nor can they have children.
|
// Text nodes are not named items nor can they have children.
|
||||||
@ -3538,9 +3530,7 @@ nsHTMLDocument::UnregisterNamedItems(nsIContent *aContent)
|
|||||||
nsresult
|
nsresult
|
||||||
nsHTMLDocument::RegisterNamedItems(nsIContent *aContent)
|
nsHTMLDocument::RegisterNamedItems(nsIContent *aContent)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = aContent->Tag();
|
||||||
|
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (tag == nsLayoutAtoms::textTagName) {
|
if (tag == nsLayoutAtoms::textTagName) {
|
||||||
// Text nodes are not named items nor can they have children.
|
// Text nodes are not named items nor can they have children.
|
||||||
@ -3582,8 +3572,7 @@ FindNamedItems(const nsAString& aName, nsIContent *aContent,
|
|||||||
NS_ASSERTION(aEntry.mContentList,
|
NS_ASSERTION(aEntry.mContentList,
|
||||||
"Entry w/o content list passed to FindNamedItems()!");
|
"Entry w/o content list passed to FindNamedItems()!");
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = aContent->Tag();
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (tag == nsLayoutAtoms::textTagName) {
|
if (tag == nsLayoutAtoms::textTagName) {
|
||||||
// Text nodes are not named items nor can they have children.
|
// Text nodes are not named items nor can they have children.
|
||||||
@ -3734,9 +3723,8 @@ nsHTMLDocument::ResolveName(const nsAString& aName,
|
|||||||
|
|
||||||
nsIContent *e = entry->mIdContent;
|
nsIContent *e = entry->mIdContent;
|
||||||
|
|
||||||
if (e && e != ID_NOT_IN_DOCUMENT) {
|
if (e && e != ID_NOT_IN_DOCUMENT && e->IsContentOfType(nsIContent::eHTML)) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = e->Tag();
|
||||||
e->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (tag == nsHTMLAtoms::embed ||
|
if (tag == nsHTMLAtoms::embed ||
|
||||||
tag == nsHTMLAtoms::img ||
|
tag == nsHTMLAtoms::img ||
|
||||||
|
|||||||
@ -3153,7 +3153,7 @@ RuleProcessorData::RuleProcessorData(nsIPresContext* aPresContext,
|
|||||||
aContent->GetNameSpaceID(&mNameSpaceID);
|
aContent->GetNameSpaceID(&mNameSpaceID);
|
||||||
|
|
||||||
// get the tag and parent
|
// get the tag and parent
|
||||||
aContent->GetTag(&mContentTag);
|
mContentTag = aContent->Tag();
|
||||||
mParentContent = aContent->GetParent();
|
mParentContent = aContent->GetParent();
|
||||||
|
|
||||||
// get the event state
|
// get the event state
|
||||||
@ -3218,7 +3218,6 @@ RuleProcessorData::~RuleProcessorData()
|
|||||||
if (mParentData)
|
if (mParentData)
|
||||||
mParentData->Destroy(mPresContext);
|
mParentData->Destroy(mPresContext);
|
||||||
|
|
||||||
NS_IF_RELEASE(mContentTag);
|
|
||||||
NS_IF_RELEASE(mContentID);
|
NS_IF_RELEASE(mContentID);
|
||||||
NS_IF_RELEASE(mStyledContent);
|
NS_IF_RELEASE(mStyledContent);
|
||||||
|
|
||||||
@ -3330,8 +3329,7 @@ inline PRBool IsQuirkEventSensitive(nsIAtom *aContentTag)
|
|||||||
|
|
||||||
static PRBool IsSignificantChild(nsIContent* aChild, PRBool aAcceptNonWhitespaceText)
|
static PRBool IsSignificantChild(nsIContent* aChild, PRBool aAcceptNonWhitespaceText)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = aChild->Tag(); // skip text, comments, and PIs
|
||||||
aChild->GetTag(getter_AddRefs(tag)); // skip text & comments
|
|
||||||
if ((tag != nsLayoutAtoms::textTagName) &&
|
if ((tag != nsLayoutAtoms::textTagName) &&
|
||||||
(tag != nsLayoutAtoms::commentTagName) &&
|
(tag != nsLayoutAtoms::commentTagName) &&
|
||||||
(tag != nsLayoutAtoms::processingInstructionTagName)) {
|
(tag != nsLayoutAtoms::processingInstructionTagName)) {
|
||||||
|
|||||||
@ -594,23 +594,24 @@ nsBindingManager::ChangeDocumentFor(nsIContent* aContent, nsIDocument* aOldDocum
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsBindingManager::ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult)
|
nsBindingManager::ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID,
|
||||||
|
nsIAtom** aResult)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIXBLBinding> binding;
|
nsCOMPtr<nsIXBLBinding> binding;
|
||||||
GetBinding(aContent, getter_AddRefs(binding));
|
GetBinding(aContent, getter_AddRefs(binding));
|
||||||
|
|
||||||
if (binding) {
|
if (binding) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
binding->GetBaseTag(aNameSpaceID, aResult);
|
||||||
binding->GetBaseTag(aNameSpaceID, getter_AddRefs(tag));
|
|
||||||
if (tag) {
|
if (*aResult) {
|
||||||
*aResult = tag;
|
|
||||||
NS_ADDREF(*aResult);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
aContent->GetNameSpaceID(aNameSpaceID);
|
aContent->GetNameSpaceID(aNameSpaceID);
|
||||||
return aContent->GetTag(aResult);
|
NS_ADDREF(*aResult = aContent->Tag());
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|||||||
@ -553,9 +553,11 @@ nsXBLBinding::GenerateAnonymousContent()
|
|||||||
for (PRUint32 i = 0; i < length; i++) {
|
for (PRUint32 i = 0; i < length; i++) {
|
||||||
children->Item(i, getter_AddRefs(node));
|
children->Item(i, getter_AddRefs(node));
|
||||||
childContent = do_QueryInterface(node);
|
childContent = do_QueryInterface(node);
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
childContent->GetTag(getter_AddRefs(tag));
|
nsINodeInfo *ni = childContent->GetNodeInfo();
|
||||||
if (tag != nsXULAtoms::observes && tag != nsXULAtoms::templateAtom) {
|
|
||||||
|
if (!ni || (!ni->Equals(nsXULAtoms::observes, kNameSpaceID_XUL) &&
|
||||||
|
!ni->Equals(nsXULAtoms::templateAtom, kNameSpaceID_XUL))) {
|
||||||
hasContent = PR_FALSE;
|
hasContent = PR_FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -631,9 +633,12 @@ nsXBLBinding::GenerateAnonymousContent()
|
|||||||
else {
|
else {
|
||||||
// We were unable to place this child. All anonymous content
|
// We were unable to place this child. All anonymous content
|
||||||
// should be thrown out. Special-case template and observes.
|
// should be thrown out. Special-case template and observes.
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
childContent->GetTag(getter_AddRefs(tag));
|
nsINodeInfo *ni = childContent->GetNodeInfo();
|
||||||
if (tag != nsXULAtoms::observes && tag != nsXULAtoms::templateAtom) {
|
|
||||||
|
if (!ni ||
|
||||||
|
(!ni->Equals(nsXULAtoms::observes, kNameSpaceID_XUL) &&
|
||||||
|
!ni->Equals(nsXULAtoms::templateAtom, kNameSpaceID_XUL))) {
|
||||||
// Kill all anonymous content.
|
// Kill all anonymous content.
|
||||||
mContent = nsnull;
|
mContent = nsnull;
|
||||||
bindingManager->SetContentListFor(mBoundElement, nsnull);
|
bindingManager->SetContentListFor(mBoundElement, nsnull);
|
||||||
@ -1233,9 +1238,8 @@ nsXBLBinding::GetImmediateChild(nsIAtom* aTag, nsIContent** aResult)
|
|||||||
|
|
||||||
for (PRUint32 i = 0; i < childCount; i++) {
|
for (PRUint32 i = 0; i < childCount; i++) {
|
||||||
nsIContent *child = binding->GetChildAt(i);
|
nsIContent *child = binding->GetChildAt(i);
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
child->GetTag(getter_AddRefs(tag));
|
if (aTag == child->Tag()) {
|
||||||
if (aTag == tag) {
|
|
||||||
*aResult = child;
|
*aResult = child;
|
||||||
NS_ADDREF(*aResult);
|
NS_ADDREF(*aResult);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -499,9 +499,11 @@ nsXBLPrototypeBinding::AttributeChanged(nsIAtom* aAttribute,
|
|||||||
// See if we're the <html> tag in XUL, and see if value is being
|
// See if we're the <html> tag in XUL, and see if value is being
|
||||||
// set or unset on us. We may also be a tag that is having
|
// set or unset on us. We may also be a tag that is having
|
||||||
// xbl:text set on us.
|
// xbl:text set on us.
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
realElement->GetTag(getter_AddRefs(tag));
|
if (dstAttr == nsXBLAtoms::xbltext ||
|
||||||
if (dstAttr == nsXBLAtoms::xbltext || (tag == nsHTMLAtoms::html) && (dstAttr == nsHTMLAtoms::value)) {
|
(realElement->Tag() == nsHTMLAtoms::html &&
|
||||||
|
realElement->IsContentOfType(nsIContent::eHTML)) &&
|
||||||
|
dstAttr == nsHTMLAtoms::value) {
|
||||||
// Flush out all our kids.
|
// Flush out all our kids.
|
||||||
PRUint32 childCount = realElement->GetChildCount();
|
PRUint32 childCount = realElement->GetChildCount();
|
||||||
for (PRUint32 i = 0; i < childCount; i++)
|
for (PRUint32 i = 0; i < childCount; i++)
|
||||||
@ -606,9 +608,7 @@ nsXBLPrototypeBinding::GetInsertionPoint(nsIContent* aBoundElement,
|
|||||||
nsIContent** aDefaultContent)
|
nsIContent** aDefaultContent)
|
||||||
{
|
{
|
||||||
if (mInsertionPointTable) {
|
if (mInsertionPointTable) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsISupportsKey key(aChild->Tag());
|
||||||
aChild->GetTag(getter_AddRefs(tag));
|
|
||||||
nsISupportsKey key(tag);
|
|
||||||
nsXBLInsertionPointEntry* entry = NS_STATIC_CAST(nsXBLInsertionPointEntry*, mInsertionPointTable->Get(&key));
|
nsXBLInsertionPointEntry* entry = NS_STATIC_CAST(nsXBLInsertionPointEntry*, mInsertionPointTable->Get(&key));
|
||||||
if (!entry) {
|
if (!entry) {
|
||||||
nsISupportsKey key2(nsXBLAtoms::children);
|
nsISupportsKey key2(nsXBLAtoms::children);
|
||||||
@ -726,9 +726,8 @@ nsXBLPrototypeBinding::GetImmediateChild(nsIAtom* aTag)
|
|||||||
|
|
||||||
for (PRUint32 i = 0; i < childCount; i++) {
|
for (PRUint32 i = 0; i < childCount; i++) {
|
||||||
nsIContent *child = mBinding->GetChildAt(i);
|
nsIContent *child = mBinding->GetChildAt(i);
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
child->GetTag(getter_AddRefs(tag));
|
if (aTag == child->Tag()) {
|
||||||
if (aTag == tag) {
|
|
||||||
NS_ADDREF(child);
|
NS_ADDREF(child);
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
@ -769,9 +768,9 @@ nsXBLPrototypeBinding::LocateInstance(nsIContent* aBoundElement,
|
|||||||
nsCOMPtr<nsIContent> childPoint;
|
nsCOMPtr<nsIContent> childPoint;
|
||||||
|
|
||||||
if (aBoundElement) {
|
if (aBoundElement) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsINodeInfo *ni = templParent->GetNodeInfo();
|
||||||
templParent->GetTag(getter_AddRefs(tag));
|
|
||||||
if (tag == nsXBLAtoms::children) {
|
if (ni->Equals(nsXBLAtoms::children, kNameSpaceID_XBL)) {
|
||||||
childPoint = templParent;
|
childPoint = templParent;
|
||||||
templParent = childPoint->GetParent();
|
templParent = childPoint->GetParent();
|
||||||
}
|
}
|
||||||
@ -897,13 +896,14 @@ PRBool PR_CALLBACK SetAttrs(nsHashKey* aKey, void* aData, void* aClosure)
|
|||||||
element);
|
element);
|
||||||
if (realElement) {
|
if (realElement) {
|
||||||
realElement->SetAttr(kNameSpaceID_None, dst, value, PR_FALSE);
|
realElement->SetAttr(kNameSpaceID_None, dst, value, PR_FALSE);
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
realElement->GetTag(getter_AddRefs(tag));
|
|
||||||
if (dst == nsXBLAtoms::xbltext ||
|
if (dst == nsXBLAtoms::xbltext ||
|
||||||
(tag == nsHTMLAtoms::html) && (dst == nsHTMLAtoms::value) && !value.IsEmpty()) {
|
(realElement->Tag() == nsHTMLAtoms::html &&
|
||||||
|
realElement->IsContentOfType(nsIContent::eHTML) &&
|
||||||
|
dst == nsHTMLAtoms::value && !value.IsEmpty())) {
|
||||||
nsCOMPtr<nsIDOMText> textNode;
|
nsCOMPtr<nsIDOMText> textNode;
|
||||||
nsCOMPtr<nsIDOMDocument> domDoc(
|
nsCOMPtr<nsIDOMDocument> domDoc =
|
||||||
do_QueryInterface(changeData->mBoundElement->GetDocument()));
|
do_QueryInterface(changeData->mBoundElement->GetDocument());
|
||||||
domDoc->CreateTextNode(value, getter_AddRefs(textNode));
|
domDoc->CreateTextNode(value, getter_AddRefs(textNode));
|
||||||
nsCOMPtr<nsIDOMNode> dummy;
|
nsCOMPtr<nsIDOMNode> dummy;
|
||||||
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(realElement));
|
nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(realElement));
|
||||||
@ -1233,9 +1233,7 @@ nsXBLPrototypeBinding::GetNestedChildren(nsIAtom* aTag, nsIContent* aContent,
|
|||||||
for (PRUint32 i = 0; i < childCount; i++) {
|
for (PRUint32 i = 0; i < childCount; i++) {
|
||||||
nsIContent *child = aContent->GetChildAt(i);
|
nsIContent *child = aContent->GetChildAt(i);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (aTag == child->Tag()) {
|
||||||
child->GetTag(getter_AddRefs(tag));
|
|
||||||
if (aTag == tag) {
|
|
||||||
if (!*aList)
|
if (!*aList)
|
||||||
NS_NewISupportsArray(aList); // Addref happens here.
|
NS_NewISupportsArray(aList); // Addref happens here.
|
||||||
(*aList)->AppendElement(child);
|
(*aList)->AppendElement(child);
|
||||||
|
|||||||
@ -673,7 +673,8 @@ nsXBLService::FlushStyleBindings(nsIContent* aContent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsXBLService::ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult)
|
nsXBLService::ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID,
|
||||||
|
nsIAtom** aResult)
|
||||||
{
|
{
|
||||||
nsIDocument* document = aContent->GetDocument();
|
nsIDocument* document = aContent->GetDocument();
|
||||||
if (document) {
|
if (document) {
|
||||||
@ -684,7 +685,8 @@ nsXBLService::ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom**
|
|||||||
}
|
}
|
||||||
|
|
||||||
aContent->GetNameSpaceID(aNameSpaceID);
|
aContent->GetNameSpaceID(aNameSpaceID);
|
||||||
aContent->GetTag(aResult); // Addref happens here.
|
NS_ADDREF(*aResult = aContent->Tag());
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1057,14 +1059,17 @@ nsXBLService::LoadBindingDocumentInfo(nsIContent* aBoundElement,
|
|||||||
bindingManager->GetXBLDocumentInfo(documentURI, getter_AddRefs(info));
|
bindingManager->GetXBLDocumentInfo(documentURI, getter_AddRefs(info));
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tagName;
|
nsINodeInfo *ni = nsnull;
|
||||||
if (aBoundElement)
|
if (aBoundElement)
|
||||||
aBoundElement->GetTag(getter_AddRefs(tagName));
|
ni = aBoundElement->GetNodeInfo();
|
||||||
|
|
||||||
if (!info && bindingManager &&
|
if (!info && bindingManager &&
|
||||||
(tagName != nsXULAtoms::scrollbar) &&
|
(!ni || (!ni->Equals(nsXULAtoms::scrollbar, kNameSpaceID_XUL) &&
|
||||||
(tagName != nsXULAtoms::thumb) &&
|
!ni->Equals(nsXULAtoms::thumb, kNameSpaceID_XUL))) &&
|
||||||
(tagName != nsHTMLAtoms::input) &&
|
(!ni || (!ni->Equals(nsHTMLAtoms::input) &&
|
||||||
(tagName != nsHTMLAtoms::select) && !aForceSyncLoad) {
|
!ni->Equals(nsHTMLAtoms::select) &&
|
||||||
|
!aBoundElement->IsContentOfType(nsIContent::eHTML))) &&
|
||||||
|
!aForceSyncLoad) {
|
||||||
// The third line of defense is to investigate whether or not the
|
// The third line of defense is to investigate whether or not the
|
||||||
// document is currently being loaded asynchronously. If so, there's no
|
// document is currently being loaded asynchronously. If so, there's no
|
||||||
// document yet, but we need to glom on our request so that it will be
|
// document yet, but we need to glom on our request so that it will be
|
||||||
@ -1146,13 +1151,15 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun
|
|||||||
if (aBoundDocument)
|
if (aBoundDocument)
|
||||||
loadGroup = aBoundDocument->GetDocumentLoadGroup();
|
loadGroup = aBoundDocument->GetDocumentLoadGroup();
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tagName;
|
nsINodeInfo *ni = nsnull;
|
||||||
if (aBoundElement)
|
if (aBoundElement)
|
||||||
aBoundElement->GetTag(getter_AddRefs(tagName));
|
ni = aBoundElement->GetNodeInfo();
|
||||||
|
|
||||||
if (tagName == nsXULAtoms::scrollbar ||
|
if (ni && (ni->Equals(nsXULAtoms::scrollbar, kNameSpaceID_XUL) ||
|
||||||
tagName == nsXULAtoms::thumb ||
|
ni->Equals(nsXULAtoms::thumb, kNameSpaceID_XUL) ||
|
||||||
tagName == nsHTMLAtoms::select || IsResourceURI(aDocumentURI))
|
(ni->Equals(nsHTMLAtoms::select) &&
|
||||||
|
aBoundElement->IsContentOfType(nsIContent::eHTML))) ||
|
||||||
|
IsResourceURI(aDocumentURI))
|
||||||
aForceSyncLoad = PR_TRUE;
|
aForceSyncLoad = PR_TRUE;
|
||||||
|
|
||||||
if(!aForceSyncLoad) {
|
if(!aForceSyncLoad) {
|
||||||
|
|||||||
@ -66,7 +66,7 @@ public:
|
|||||||
// Empty interface
|
// Empty interface
|
||||||
|
|
||||||
// nsIContent
|
// nsIContent
|
||||||
NS_IMETHOD GetTag(nsIAtom** aResult) const;
|
virtual nsIAtom *Tag() const;
|
||||||
NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags);
|
NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
||||||
@ -113,12 +113,10 @@ NS_IMPL_ADDREF_INHERITED(nsXMLCDATASection, nsGenericDOMDataNode)
|
|||||||
NS_IMPL_RELEASE_INHERITED(nsXMLCDATASection, nsGenericDOMDataNode)
|
NS_IMPL_RELEASE_INHERITED(nsXMLCDATASection, nsGenericDOMDataNode)
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsIAtom *
|
||||||
nsXMLCDATASection::GetTag(nsIAtom** aResult) const
|
nsXMLCDATASection::Tag() const
|
||||||
{
|
{
|
||||||
*aResult = nsLayoutAtoms::textTagName;
|
return nsLayoutAtoms::textTagName;
|
||||||
NS_ADDREF(*aResult);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(PRBool)
|
NS_IMETHODIMP_(PRBool)
|
||||||
|
|||||||
@ -112,12 +112,10 @@ nsXMLProcessingInstruction::GetAttrValue(const nsAString& aAttr,
|
|||||||
return nsParserUtils::GetQuotedAttributeValue(data, aAttr, aValue);
|
return nsParserUtils::GetQuotedAttributeValue(data, aAttr, aValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsIAtom *
|
||||||
nsXMLProcessingInstruction::GetTag(nsIAtom** aResult) const
|
nsXMLProcessingInstruction::Tag() const
|
||||||
{
|
{
|
||||||
*aResult = nsLayoutAtoms::processingInstructionTagName;
|
return nsLayoutAtoms::processingInstructionTagName;
|
||||||
NS_ADDREF(*aResult);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(PRBool)
|
NS_IMETHODIMP_(PRBool)
|
||||||
|
|||||||
@ -64,7 +64,7 @@ public:
|
|||||||
NS_DECL_NSIDOMPROCESSINGINSTRUCTION
|
NS_DECL_NSIDOMPROCESSINGINSTRUCTION
|
||||||
|
|
||||||
// nsIContent
|
// nsIContent
|
||||||
NS_IMETHOD GetTag(nsIAtom** aResult) const;
|
virtual nsIAtom *Tag() const;
|
||||||
NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags);
|
NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|||||||
@ -536,9 +536,8 @@ nsXMLContentSink::CloseElement(nsIContent* aContent, PRBool* aAppendContent)
|
|||||||
if (!aContent->IsContentOfType(nsIContent::eHTML)) {
|
if (!aContent->IsContentOfType(nsIContent::eHTML)) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tagAtom;
|
nsIAtom *tagAtom = aContent->Tag();
|
||||||
aContent->GetTag(getter_AddRefs(tagAtom));
|
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
@ -1304,11 +1303,12 @@ nsXMLContentSink::HandleDoctypeDecl(const nsAString & aSubset,
|
|||||||
if (!doc)
|
if (!doc)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMDocumentType> docType;
|
nsCOMPtr<nsIAtom> name = do_GetAtom(aName);
|
||||||
|
NS_ENSURE_TRUE(name, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
// Create a new doctype node
|
// Create a new doctype node
|
||||||
rv = NS_NewDOMDocumentType(getter_AddRefs(docType),
|
nsCOMPtr<nsIDOMDocumentType> docType;
|
||||||
aName, nsnull, nsnull,
|
rv = NS_NewDOMDocumentType(getter_AddRefs(docType), name, nsnull, nsnull,
|
||||||
aPublicId, aSystemId, aSubset);
|
aPublicId, aSystemId, aSubset);
|
||||||
if (NS_FAILED(rv) || !docType) {
|
if (NS_FAILED(rv) || !docType) {
|
||||||
return rv;
|
return rv;
|
||||||
|
|||||||
@ -607,7 +607,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
|
|||||||
} else if (nsCRT::strcmp("loadAsInteractiveData", aCommand) == 0) {
|
} else if (nsCRT::strcmp("loadAsInteractiveData", aCommand) == 0) {
|
||||||
aCommand = kLoadAsData; // XBL, for example, needs scripts and styles
|
aCommand = kLoadAsData; // XBL, for example, needs scripts and styles
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsCRT::strcmp(aCommand, kLoadAsData) == 0) {
|
if (nsCRT::strcmp(aCommand, kLoadAsData) == 0) {
|
||||||
mLoadedAsData = PR_TRUE;
|
mLoadedAsData = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2068,7 +2068,6 @@ nsXULElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
|||||||
// On the removal of a <treeitem>, <treechildren>, or <treecell> element,
|
// On the removal of a <treeitem>, <treechildren>, or <treecell> element,
|
||||||
// the possibility exists that some of the items in the removed subtree
|
// the possibility exists that some of the items in the removed subtree
|
||||||
// are selected (and therefore need to be deselected). We need to account for this.
|
// are selected (and therefore need to be deselected). We need to account for this.
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
nsCOMPtr<nsIDOMXULMultiSelectControlElement> controlElement;
|
nsCOMPtr<nsIDOMXULMultiSelectControlElement> controlElement;
|
||||||
nsCOMPtr<nsIListBoxObject> listBox;
|
nsCOMPtr<nsIListBoxObject> listBox;
|
||||||
PRBool fireSelectionHandler = PR_FALSE;
|
PRBool fireSelectionHandler = PR_FALSE;
|
||||||
@ -2077,8 +2076,8 @@ nsXULElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
|||||||
// anything else = index to re-set as current
|
// anything else = index to re-set as current
|
||||||
PRInt32 newCurrentIndex = -1;
|
PRInt32 newCurrentIndex = -1;
|
||||||
|
|
||||||
oldKid->GetTag(getter_AddRefs(tag));
|
nsINodeInfo *ni = oldKid->GetNodeInfo();
|
||||||
if (tag == nsXULAtoms::listitem) {
|
if (ni && ni->Equals(nsXULAtoms::listitem, kNameSpaceID_XUL)) {
|
||||||
// This is the nasty case. We have (potentially) a slew of selected items
|
// This is the nasty case. We have (potentially) a slew of selected items
|
||||||
// and cells going away.
|
// and cells going away.
|
||||||
// First, retrieve the tree.
|
// First, retrieve the tree.
|
||||||
@ -2186,12 +2185,10 @@ nsXULElement::GetNameSpaceID(PRInt32* aNameSpaceID) const
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
nsIAtom *
|
||||||
nsXULElement::GetTag(nsIAtom** aResult) const
|
nsXULElement::Tag() const
|
||||||
{
|
{
|
||||||
NS_ADDREF(*aResult = NodeInfo()->NameAtom());
|
return NodeInfo()->NameAtom();
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(already_AddRefed<nsINodeInfo>)
|
NS_IMETHODIMP_(already_AddRefed<nsINodeInfo>)
|
||||||
@ -2237,17 +2234,14 @@ nsXULElement::UnregisterAccessKey(const nsAString& aOldValue)
|
|||||||
PRBool validElement = PR_TRUE;
|
PRBool validElement = PR_TRUE;
|
||||||
|
|
||||||
// find out what type of content node this is
|
// find out what type of content node this is
|
||||||
nsCOMPtr<nsIAtom> atom;
|
if (NodeInfo()->Equals(nsXULAtoms::label)) {
|
||||||
nsresult rv = GetTag(getter_AddRefs(atom));
|
// XXXjag a side-effect is that we filter out
|
||||||
if (NS_SUCCEEDED(rv) && atom) {
|
// anonymous <label>s in e.g. <menu>, <menuitem>,
|
||||||
if (atom == nsXULAtoms::label) {
|
// <button>. These <label>s inherit |accesskey| and
|
||||||
// XXXjag a side-effect is that we filter out anonymous <label>s
|
// would otherwise register themselves, overwriting
|
||||||
// in e.g. <menu>, <menuitem>, <button>. These <label>s inherit
|
// the content we really meant to be registered.
|
||||||
// |accesskey| and would otherwise register themselves, overwriting
|
if (!HasAttr(kNameSpaceID_None, nsXULAtoms::control))
|
||||||
// the content we really meant to be registered.
|
validElement = PR_FALSE;
|
||||||
if (!HasAttr(kNameSpaceID_None, nsXULAtoms::control))
|
|
||||||
validElement = PR_FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (validElement) {
|
if (validElement) {
|
||||||
@ -2323,10 +2317,7 @@ nsXULElement::SetAttr(nsINodeInfo* aNodeInfo,
|
|||||||
Attributes()->UpdateStyleRule(baseURL, aValue);
|
Attributes()->UpdateStyleRule(baseURL, aValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (NodeInfo()->Equals(nsXULAtoms::window) &&
|
||||||
GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (tag == nsXULAtoms::window &&
|
|
||||||
aNodeInfo->Equals(nsXULAtoms::hidechrome)) {
|
aNodeInfo->Equals(nsXULAtoms::hidechrome)) {
|
||||||
nsAutoString val(aValue);
|
nsAutoString val(aValue);
|
||||||
HideWindowChrome(val.Equals(NS_LITERAL_STRING("true")));
|
HideWindowChrome(val.Equals(NS_LITERAL_STRING("true")));
|
||||||
@ -2600,10 +2591,7 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (NodeInfo()->Equals(nsXULAtoms::window) &&
|
||||||
GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (tag == nsXULAtoms::window &&
|
|
||||||
aName == nsXULAtoms::hidechrome)
|
aName == nsXULAtoms::hidechrome)
|
||||||
HideWindowChrome(PR_FALSE);
|
HideWindowChrome(PR_FALSE);
|
||||||
|
|
||||||
@ -3188,11 +3176,10 @@ nsXULElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRUint32
|
||||||
nsXULElement::GetContentID(PRUint32* aID)
|
nsXULElement::ContentID() const
|
||||||
{
|
{
|
||||||
*aID = 0;
|
return 0;
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
@ -3230,12 +3217,11 @@ nsXULElement::RangeRemove(nsIDOMRange* aRange)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
const nsVoidArray *
|
||||||
nsXULElement::GetRangeList(nsVoidArray** aResult) const
|
nsXULElement::GetRangeList() const
|
||||||
{
|
{
|
||||||
// XUL content does not yet support DOM ranges
|
// XUL content does not yet support DOM ranges
|
||||||
*aResult = nsnull;
|
return nsnull;
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3568,17 +3554,20 @@ nsXULElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
|
|||||||
aHint = NS_STYLE_HINT_NONE;
|
aHint = NS_STYLE_HINT_NONE;
|
||||||
|
|
||||||
if (aAttribute == nsXULAtoms::value &&
|
if (aAttribute == nsXULAtoms::value &&
|
||||||
(aModType == nsIDOMMutationEvent::REMOVAL || aModType == nsIDOMMutationEvent::ADDITION)) {
|
(aModType == nsIDOMMutationEvent::REMOVAL ||
|
||||||
nsCOMPtr<nsIAtom> tag;
|
aModType == nsIDOMMutationEvent::ADDITION)) {
|
||||||
GetTag(getter_AddRefs(tag));
|
nsIAtom *tag = Tag();
|
||||||
if (tag == nsXULAtoms::label || tag == nsXULAtoms::description)
|
if (tag == nsXULAtoms::label || tag == nsXULAtoms::description)
|
||||||
// Label and description dynamically morph between a normal block and a cropping single-line
|
// Label and description dynamically morph between a normal
|
||||||
// XUL text frame. If the value attribute is being added or removed, then we need to return
|
// block and a cropping single-line XUL text frame. If the
|
||||||
// a hint of frame change. (See bugzilla bug 95475 for details.)
|
// value attribute is being added or removed, then we need to
|
||||||
|
// return a hint of frame change. (See bugzilla bug 95475 for
|
||||||
|
// details.)
|
||||||
aHint = NS_STYLE_HINT_FRAMECHANGE;
|
aHint = NS_STYLE_HINT_FRAMECHANGE;
|
||||||
} else {
|
} else {
|
||||||
// if left or top changes we reflow. This will happen in xul containers that
|
// if left or top changes we reflow. This will happen in xul
|
||||||
// manage positioned children such as a bulletinboard.
|
// containers that manage positioned children such as a
|
||||||
|
// bulletinboard.
|
||||||
if (nsXULAtoms::left == aAttribute || nsXULAtoms::top == aAttribute)
|
if (nsXULAtoms::left == aAttribute || nsXULAtoms::top == aAttribute)
|
||||||
aHint = NS_STYLE_HINT_REFLOW;
|
aHint = NS_STYLE_HINT_REFLOW;
|
||||||
}
|
}
|
||||||
@ -4115,17 +4104,19 @@ nsXULElement::GetStyle(nsIDOMCSSStyleDeclaration** aStyle)
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsXULElement::GetParentTree(nsIDOMXULMultiSelectControlElement** aTreeElement)
|
nsXULElement::GetParentTree(nsIDOMXULMultiSelectControlElement** aTreeElement)
|
||||||
{
|
{
|
||||||
for (nsIContent* current = GetParent(); current; current = current->GetParent()) {
|
for (nsIContent* current = GetParent(); current;
|
||||||
nsCOMPtr<nsIAtom> tag;
|
current = current->GetParent()) {
|
||||||
current->GetTag(getter_AddRefs(tag));
|
if (current->GetNodeInfo()->Equals(nsXULAtoms::listbox,
|
||||||
if (tag == nsXULAtoms::listbox) {
|
kNameSpaceID_XUL)) {
|
||||||
CallQueryInterface(current, aTreeElement);
|
CallQueryInterface(current, aTreeElement);
|
||||||
// XXX returning NS_OK because that's what the code used to do;
|
// XXX returning NS_OK because that's what the code used to do;
|
||||||
// is that the right thing, though?
|
// is that the right thing, though?
|
||||||
return NS_OK;
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
|
|||||||
@ -432,7 +432,7 @@ public:
|
|||||||
PRBool aDeepSetDocument);
|
PRBool aDeepSetDocument);
|
||||||
NS_IMETHOD RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
|
NS_IMETHOD RemoveChildAt(PRUint32 aIndex, PRBool aNotify);
|
||||||
NS_IMETHOD GetNameSpaceID(PRInt32* aNameSpeceID) const;
|
NS_IMETHOD GetNameSpaceID(PRInt32* aNameSpeceID) const;
|
||||||
NS_IMETHOD GetTag(nsIAtom** aResult) const;
|
virtual nsIAtom *Tag() const;
|
||||||
NS_IMETHOD_(nsINodeInfo *) GetNodeInfo() const;
|
NS_IMETHOD_(nsINodeInfo *) GetNodeInfo() const;
|
||||||
NS_IMETHOD_(nsIAtom *) GetIDAttributeName() const;
|
NS_IMETHOD_(nsIAtom *) GetIDAttributeName() const;
|
||||||
NS_IMETHOD_(nsIAtom *) GetClassAttributeName() const;
|
NS_IMETHOD_(nsIAtom *) GetClassAttributeName() const;
|
||||||
@ -457,12 +457,12 @@ public:
|
|||||||
nsEventStatus* aEventStatus);
|
nsEventStatus* aEventStatus);
|
||||||
NS_IMETHOD DoneCreatingElement();
|
NS_IMETHOD DoneCreatingElement();
|
||||||
|
|
||||||
NS_IMETHOD GetContentID(PRUint32* aID);
|
virtual PRUint32 ContentID() const;
|
||||||
NS_IMETHOD SetContentID(PRUint32 aID);
|
NS_IMETHOD SetContentID(PRUint32 aID);
|
||||||
|
|
||||||
NS_IMETHOD RangeAdd(nsIDOMRange* aRange);
|
NS_IMETHOD RangeAdd(nsIDOMRange* aRange);
|
||||||
NS_IMETHOD RangeRemove(nsIDOMRange* aRange);
|
NS_IMETHOD RangeRemove(nsIDOMRange* aRange);
|
||||||
NS_IMETHOD GetRangeList(nsVoidArray** aResult) const;
|
virtual const nsVoidArray *GetRangeList() const;
|
||||||
NS_IMETHOD SetFocus(nsIPresContext* aPresContext);
|
NS_IMETHOD SetFocus(nsIPresContext* aPresContext);
|
||||||
NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext);
|
NS_IMETHOD RemoveFocus(nsIPresContext* aPresContext);
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
@ -238,9 +238,8 @@ XULPopupListenerImpl::PreLaunchPopup(nsIDOMEvent* aMouseEvent)
|
|||||||
// submenu of an already-showing popup. We don't need to do anything at all.
|
// submenu of an already-showing popup. We don't need to do anything at all.
|
||||||
if (popupType == eXULPopupType_popup) {
|
if (popupType == eXULPopupType_popup) {
|
||||||
nsCOMPtr<nsIContent> targetContent = do_QueryInterface(target);
|
nsCOMPtr<nsIContent> targetContent = do_QueryInterface(target);
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = targetContent->Tag();
|
||||||
targetContent->GetTag(getter_AddRefs(tag));
|
if (tag == nsXULAtoms::menu || tag == nsXULAtoms::menuitem)
|
||||||
if (tag && (tag.get() == nsXULAtoms::menu || tag.get() == nsXULAtoms::menuitem))
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -406,9 +405,7 @@ GetImmediateChild(nsIContent* aContent, nsIAtom *aTag, nsIContent** aResult)
|
|||||||
PRInt32 childCount = aContent->GetChildCount();
|
PRInt32 childCount = aContent->GetChildCount();
|
||||||
for (PRInt32 i = 0; i < childCount; i++) {
|
for (PRInt32 i = 0; i < childCount; i++) {
|
||||||
nsIContent *child = aContent->GetChildAt(i);
|
nsIContent *child = aContent->GetChildAt(i);
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (child->Tag() == aTag) {
|
||||||
child->GetTag(getter_AddRefs(tag));
|
|
||||||
if (aTag == tag.get()) {
|
|
||||||
*aResult = child;
|
*aResult = child;
|
||||||
NS_ADDREF(*aResult);
|
NS_ADDREF(*aResult);
|
||||||
return;
|
return;
|
||||||
@ -520,10 +517,8 @@ XULPopupListenerImpl::LaunchPopup(PRInt32 aClientX, PRInt32 aClientY)
|
|||||||
|
|
||||||
if (identifier == NS_LITERAL_STRING("_child")) {
|
if (identifier == NS_LITERAL_STRING("_child")) {
|
||||||
nsCOMPtr<nsIContent> popup;
|
nsCOMPtr<nsIContent> popup;
|
||||||
|
|
||||||
nsIAtom* tag = nsXULAtoms::menupopup;
|
|
||||||
|
|
||||||
GetImmediateChild(content, tag, getter_AddRefs(popup));
|
GetImmediateChild(content, nsXULAtoms::menupopup, getter_AddRefs(popup));
|
||||||
if (popup)
|
if (popup)
|
||||||
popupContent = do_QueryInterface(popup);
|
popupContent = do_QueryInterface(popup);
|
||||||
else {
|
else {
|
||||||
@ -537,9 +532,10 @@ XULPopupListenerImpl::LaunchPopup(PRInt32 aClientX, PRInt32 aClientY)
|
|||||||
for (ctr = 0; ctr < listLength; ctr++) {
|
for (ctr = 0; ctr < listLength; ctr++) {
|
||||||
list->Item(ctr, getter_AddRefs(node));
|
list->Item(ctr, getter_AddRefs(node));
|
||||||
nsCOMPtr<nsIContent> childContent(do_QueryInterface(node));
|
nsCOMPtr<nsIContent> childContent(do_QueryInterface(node));
|
||||||
nsCOMPtr<nsIAtom> childTag;
|
|
||||||
childContent->GetTag(getter_AddRefs(childTag));
|
nsINodeInfo *ni = childContent->GetNodeInfo();
|
||||||
if (childTag.get() == tag) {
|
|
||||||
|
if (ni && ni->Equals(nsXULAtoms::menupopup, kNameSpaceID_XUL)) {
|
||||||
popupContent = do_QueryInterface(childContent);
|
popupContent = do_QueryInterface(childContent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -199,23 +199,15 @@ nsElementMap::Add(const nsAString& aID, nsIContent* aContent)
|
|||||||
//NS_ERROR("element was already in the map");
|
//NS_ERROR("element was already in the map");
|
||||||
#ifdef PR_LOGGING
|
#ifdef PR_LOGGING
|
||||||
if (PR_LOG_TEST(gMapLog, PR_LOG_ALWAYS)) {
|
if (PR_LOG_TEST(gMapLog, PR_LOG_ALWAYS)) {
|
||||||
nsresult rv;
|
const char *tagname;
|
||||||
|
aContent->Tag()->GetUTF8String(&tagname);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsCAutoString aidC;
|
||||||
rv = aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsAutoString tagname;
|
|
||||||
rv = tag->ToString(tagname);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsCAutoString tagnameC, aidC;
|
|
||||||
tagnameC.AssignWithConversion(tagname);
|
|
||||||
aidC.AssignWithConversion(id, aID.Length());
|
aidC.AssignWithConversion(id, aID.Length());
|
||||||
PR_LOG(gMapLog, PR_LOG_ALWAYS,
|
PR_LOG(gMapLog, PR_LOG_ALWAYS,
|
||||||
("xulelemap(%p) dup %s[%p] <-- %s\n",
|
("xulelemap(%p) dup %s[%p] <-- %s\n",
|
||||||
this,
|
this,
|
||||||
tagnameC.get(),
|
tagname,
|
||||||
aContent,
|
aContent,
|
||||||
aidC.get()));
|
aidC.get()));
|
||||||
}
|
}
|
||||||
@ -236,23 +228,15 @@ nsElementMap::Add(const nsAString& aID, nsIContent* aContent)
|
|||||||
|
|
||||||
#ifdef PR_LOGGING
|
#ifdef PR_LOGGING
|
||||||
if (PR_LOG_TEST(gMapLog, PR_LOG_ALWAYS)) {
|
if (PR_LOG_TEST(gMapLog, PR_LOG_ALWAYS)) {
|
||||||
nsresult rv;
|
const char *tagname;
|
||||||
|
aContent->Tag()->GetUTF8String(&tagname);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsCAutoString aidC;
|
||||||
rv = aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsAutoString tagname;
|
|
||||||
rv = tag->ToString(tagname);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsCAutoString tagnameC, aidC;
|
|
||||||
tagnameC.AssignWithConversion(tagname);
|
|
||||||
aidC.AssignWithConversion(id, aID.Length());
|
aidC.AssignWithConversion(id, aID.Length());
|
||||||
PR_LOG(gMapLog, PR_LOG_ALWAYS,
|
PR_LOG(gMapLog, PR_LOG_ALWAYS,
|
||||||
("xulelemap(%p) add %s[%p] <-- %s\n",
|
("xulelemap(%p) add %s[%p] <-- %s\n",
|
||||||
this,
|
this,
|
||||||
tagnameC.get(),
|
tagname,
|
||||||
aContent,
|
aContent,
|
||||||
aidC.get()));
|
aidC.get()));
|
||||||
}
|
}
|
||||||
@ -274,23 +258,15 @@ nsElementMap::Remove(const nsAString& aID, nsIContent* aContent)
|
|||||||
|
|
||||||
#ifdef PR_LOGGING
|
#ifdef PR_LOGGING
|
||||||
if (PR_LOG_TEST(gMapLog, PR_LOG_ALWAYS)) {
|
if (PR_LOG_TEST(gMapLog, PR_LOG_ALWAYS)) {
|
||||||
nsresult rv;
|
const char *tagname;
|
||||||
|
aContent->Tag()->GetUTF8String(&tagname);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsCAutoString aidC;
|
||||||
rv = aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsAutoString tagname;
|
|
||||||
rv = tag->ToString(tagname);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsCAutoString tagnameC, aidC;
|
|
||||||
tagnameC.AssignWithConversion(tagname);
|
|
||||||
aidC.AssignWithConversion(id);
|
aidC.AssignWithConversion(id);
|
||||||
PR_LOG(gMapLog, PR_LOG_ALWAYS,
|
PR_LOG(gMapLog, PR_LOG_ALWAYS,
|
||||||
("xulelemap(%p) remove %s[%p] <-- %s\n",
|
("xulelemap(%p) remove %s[%p] <-- %s\n",
|
||||||
this,
|
this,
|
||||||
tagnameC.get(),
|
tagname,
|
||||||
aContent,
|
aContent,
|
||||||
aidC.get()));
|
aidC.get()));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1879,10 +1879,10 @@ nsXULDocument::AddElementToDocumentPre(nsIContent* aElement)
|
|||||||
nsresult
|
nsresult
|
||||||
nsXULDocument::AddElementToDocumentPost(nsIContent* aElement)
|
nsXULDocument::AddElementToDocumentPost(nsIContent* aElement)
|
||||||
{
|
{
|
||||||
|
nsINodeInfo *ni = aElement->GetNodeInfo();
|
||||||
|
|
||||||
// We need to pay special attention to the keyset tag to set up a listener
|
// We need to pay special attention to the keyset tag to set up a listener
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (ni && ni->Equals(nsXULAtoms::keyset, kNameSpaceID_XUL)) {
|
||||||
aElement->GetTag(getter_AddRefs(tag));
|
|
||||||
if (tag == nsXULAtoms::keyset) {
|
|
||||||
// Create our XUL key listener and hook it up.
|
// Create our XUL key listener and hook it up.
|
||||||
nsCOMPtr<nsIXBLService> xblService(do_GetService("@mozilla.org/xbl;1"));
|
nsCOMPtr<nsIXBLService> xblService(do_GetService("@mozilla.org/xbl;1"));
|
||||||
if (xblService) {
|
if (xblService) {
|
||||||
@ -2660,14 +2660,11 @@ nsXULDocument::ContextStack::IsInsideXULTemplate()
|
|||||||
if (mDepth) {
|
if (mDepth) {
|
||||||
for (nsIContent* element = mTop->mElement; element;
|
for (nsIContent* element = mTop->mElement; element;
|
||||||
element = element->GetParent()) {
|
element = element->GetParent()) {
|
||||||
PRInt32 nameSpaceID;
|
|
||||||
element->GetNameSpaceID(&nameSpaceID);
|
nsINodeInfo *ni = element->GetNodeInfo();
|
||||||
if (nameSpaceID == kNameSpaceID_XUL) {
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (ni && ni->Equals(nsXULAtoms::Template, kNameSpaceID_XUL)) {
|
||||||
element->GetTag(getter_AddRefs(tag));
|
return PR_TRUE;
|
||||||
if (tag == nsXULAtoms::Template) {
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3588,8 +3585,9 @@ nsXULDocument::CreateTemplateBuilder(nsIContent* aElement)
|
|||||||
xblService->ResolveTag(aElement, &nameSpaceID, getter_AddRefs(baseTag));
|
xblService->ResolveTag(aElement, &nameSpaceID, getter_AddRefs(baseTag));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
aElement->GetNameSpaceID(&nameSpaceID);
|
nsINodeInfo *ni = aElement->GetNodeInfo();
|
||||||
aElement->GetTag(getter_AddRefs(baseTag));
|
nameSpaceID = ni->NamespaceID();
|
||||||
|
baseTag = ni->NameAtom();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((nameSpaceID == kNameSpaceID_XUL) && (baseTag == nsXULAtoms::tree)) {
|
if ((nameSpaceID == kNameSpaceID_XUL) && (baseTag == nsXULAtoms::tree)) {
|
||||||
@ -3963,14 +3961,12 @@ nsXULDocument::BroadcasterHookup::~BroadcasterHookup()
|
|||||||
// Tell the world we failed
|
// Tell the world we failed
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = mObservesElement->Tag();
|
||||||
rv = mObservesElement->GetTag(getter_AddRefs(tag));
|
|
||||||
if (NS_FAILED(rv)) return;
|
|
||||||
|
|
||||||
nsAutoString broadcasterID;
|
nsAutoString broadcasterID;
|
||||||
nsAutoString attribute;
|
nsAutoString attribute;
|
||||||
|
|
||||||
if (tag.get() == nsXULAtoms::observes) {
|
if (tag == nsXULAtoms::observes) {
|
||||||
rv = mObservesElement->GetAttr(kNameSpaceID_None, nsXULAtoms::element, broadcasterID);
|
rv = mObservesElement->GetAttr(kNameSpaceID_None, nsXULAtoms::element, broadcasterID);
|
||||||
if (NS_FAILED(rv)) return;
|
if (NS_FAILED(rv)) return;
|
||||||
|
|
||||||
@ -4041,19 +4037,13 @@ nsXULDocument::CheckBroadcasterHookup(nsXULDocument* aDocument,
|
|||||||
|
|
||||||
*aDidResolve = PR_FALSE;
|
*aDidResolve = PR_FALSE;
|
||||||
|
|
||||||
PRInt32 nameSpaceID;
|
|
||||||
rv = aElement->GetNameSpaceID(&nameSpaceID);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
rv = aElement->GetTag(getter_AddRefs(tag));
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMElement> listener;
|
nsCOMPtr<nsIDOMElement> listener;
|
||||||
nsAutoString broadcasterID;
|
nsAutoString broadcasterID;
|
||||||
nsAutoString attribute;
|
nsAutoString attribute;
|
||||||
|
|
||||||
if ((nameSpaceID == kNameSpaceID_XUL) && (tag.get() == nsXULAtoms::observes)) {
|
nsINodeInfo *ni = aElement->GetNodeInfo();
|
||||||
|
|
||||||
|
if (ni && ni->Equals(nsXULAtoms::observes, kNameSpaceID_XUL)) {
|
||||||
// It's an <observes> element, which means that the actual
|
// It's an <observes> element, which means that the actual
|
||||||
// listener is the _parent_ node. This element should have an
|
// listener is the _parent_ node. This element should have an
|
||||||
// 'element' attribute that specifies the ID of the
|
// 'element' attribute that specifies the ID of the
|
||||||
@ -4061,13 +4051,9 @@ nsXULDocument::CheckBroadcasterHookup(nsXULDocument* aDocument,
|
|||||||
// specifies the name of the attribute to observe.
|
// specifies the name of the attribute to observe.
|
||||||
nsIContent* parent = aElement->GetParent();
|
nsIContent* parent = aElement->GetParent();
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> parentTag;
|
|
||||||
rv = parent->GetTag(getter_AddRefs(parentTag));
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
// If we're still parented by an 'overlay' tag, then we haven't
|
// If we're still parented by an 'overlay' tag, then we haven't
|
||||||
// made it into the real document yet. Defer hookup.
|
// made it into the real document yet. Defer hookup.
|
||||||
if (parentTag == nsXULAtoms::overlay) {
|
if (parent->GetNodeInfo()->Equals(nsXULAtoms::overlay, kNameSpaceID_XUL)) {
|
||||||
*aNeedsHookup = PR_TRUE;
|
*aNeedsHookup = PR_TRUE;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@ -4095,11 +4081,13 @@ nsXULDocument::CheckBroadcasterHookup(nsXULDocument* aDocument,
|
|||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
if (rv == NS_CONTENT_ATTR_HAS_VALUE && !broadcasterID.IsEmpty()) {
|
if (rv == NS_CONTENT_ATTR_HAS_VALUE && !broadcasterID.IsEmpty()) {
|
||||||
// We've got something in the command attribute. We only treat this as
|
// We've got something in the command attribute. We
|
||||||
// a normal broadcaster if we are not a menuitem or a key.
|
// only treat this as a normal broadcaster if we are
|
||||||
|
// not a menuitem or a key.
|
||||||
|
|
||||||
aElement->GetTag(getter_AddRefs(tag));
|
nsINodeInfo *ni = aElement->GetNodeInfo();
|
||||||
if (tag.get() == nsXULAtoms::menuitem || tag.get() == nsXULAtoms::key) {
|
if (ni->Equals(nsXULAtoms::menuitem, kNameSpaceID_XUL) ||
|
||||||
|
ni->Equals(nsXULAtoms::key, kNameSpaceID_XUL)) {
|
||||||
*aNeedsHookup = PR_FALSE;
|
*aNeedsHookup = PR_FALSE;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@ -4146,12 +4134,8 @@ nsXULDocument::CheckBroadcasterHookup(nsXULDocument* aDocument,
|
|||||||
if (! content)
|
if (! content)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag2;
|
|
||||||
rv = content->GetTag(getter_AddRefs(tag2));
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsAutoString tagStr;
|
nsAutoString tagStr;
|
||||||
rv = tag2->ToString(tagStr);
|
rv = content->Tag()->ToString(tagStr);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
nsCAutoString tagstrC, attributeC,broadcasteridC;
|
nsCAutoString tagstrC, attributeC,broadcasteridC;
|
||||||
|
|||||||
@ -85,11 +85,7 @@ nsContentTagTestNode::FilterInstantiations(InstantiationSet& aInstantiations, vo
|
|||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (VALUE_TO_ICONTENT(value)->Tag() != mTag) {
|
||||||
rv = VALUE_TO_ICONTENT(value)->GetTag(getter_AddRefs(tag));
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
if (tag != mTag) {
|
|
||||||
aInstantiations.Erase(inst--);
|
aInstantiations.Erase(inst--);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -86,11 +86,7 @@ nsContentTestNode::nsContentTestNode(InnerNode* aParent,
|
|||||||
static void
|
static void
|
||||||
ElementToString(nsIContent *aContent, nsString &aResult)
|
ElementToString(nsIContent *aContent, nsString &aResult)
|
||||||
{
|
{
|
||||||
aResult.Truncate();
|
aContent->Tag()->ToString(aResult);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
tag->ToString(aResult);
|
|
||||||
|
|
||||||
aResult.Append(PRUnichar('@'));
|
aResult.Append(PRUnichar('@'));
|
||||||
aResult.AppendInt(NS_PTR_TO_INT32(aContent), 16);
|
aResult.AppendInt(NS_PTR_TO_INT32(aContent), 16);
|
||||||
@ -138,10 +134,7 @@ nsContentTestNode::FilterInstantiations(InstantiationSet& aInstantiations, void*
|
|||||||
|
|
||||||
if (mTag) {
|
if (mTag) {
|
||||||
// If we're supposed to be checking the tag, do it now.
|
// If we're supposed to be checking the tag, do it now.
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (content->Tag() != mTag)
|
||||||
content->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (tag != mTag)
|
|
||||||
consistent = PR_FALSE;
|
consistent = PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,8 +171,7 @@ nsContentTestNode::FilterInstantiations(InstantiationSet& aInstantiations, void*
|
|||||||
|
|
||||||
if (mTag) {
|
if (mTag) {
|
||||||
// If we're supposed to be checking the tag, do it now.
|
// If we're supposed to be checking the tag, do it now.
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = content->Tag();
|
||||||
content->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (tag != mTag) {
|
if (tag != mTag) {
|
||||||
consistent = PR_FALSE;
|
consistent = PR_FALSE;
|
||||||
@ -249,10 +241,7 @@ nsContentTestNode::FilterInstantiations(InstantiationSet& aInstantiations, void*
|
|||||||
if (mTag) {
|
if (mTag) {
|
||||||
// If we've got a tag, check it to ensure
|
// If we've got a tag, check it to ensure
|
||||||
// we're consistent.
|
// we're consistent.
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (content->Tag() != mTag)
|
||||||
content->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (tag != mTag)
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -437,26 +437,21 @@ nsXULContentBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
|
|||||||
// Dump out the template node's tag, the template ID, and the RDF
|
// Dump out the template node's tag, the template ID, and the RDF
|
||||||
// resource that is being used as the index into the graph.
|
// resource that is being used as the index into the graph.
|
||||||
if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) {
|
if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
rv = aTemplateNode->GetTag(getter_AddRefs(tag));
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsXPIDLCString resourceCStr;
|
nsXPIDLCString resourceCStr;
|
||||||
rv = aChild->GetValue(getter_Copies(resourceCStr));
|
rv = aChild->GetValue(getter_Copies(resourceCStr));
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
nsAutoString tagstr;
|
const char *tagstr;
|
||||||
tag->ToString(tagstr);
|
aTemplateNode->Tag()->GetUTF8String(&tagstr);
|
||||||
|
|
||||||
nsAutoString templatestr;
|
nsAutoString templatestr;
|
||||||
aTemplateNode->GetAttr(kNameSpaceID_None, nsXULAtoms::id, templatestr);
|
aTemplateNode->GetAttr(kNameSpaceID_None, nsXULAtoms::id, templatestr);
|
||||||
nsCAutoString templatestrC,tagstrC;
|
nsCAutoString templatestrC;
|
||||||
tagstrC.AssignWithConversion(tagstr);
|
|
||||||
templatestrC.AssignWithConversion(templatestr);
|
templatestrC.AssignWithConversion(templatestr);
|
||||||
PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
|
PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
|
||||||
("xultemplate[%p] build-content-from-template %s (template='%s') [%s]",
|
("xultemplate[%p] build-content-from-template %s (template='%s') [%s]",
|
||||||
this,
|
this,
|
||||||
tagstrC.get(),
|
tagstr,
|
||||||
templatestrC.get(),
|
templatestrC.get(),
|
||||||
resourceCStr.get()));
|
resourceCStr.get()));
|
||||||
}
|
}
|
||||||
@ -540,19 +535,15 @@ nsXULContentBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = tmplKid->Tag();
|
||||||
rv = tmplKid->GetTag(getter_AddRefs(tag));
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
#ifdef PR_LOGGING
|
#ifdef PR_LOGGING
|
||||||
if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) {
|
if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) {
|
||||||
nsAutoString tagname;
|
const char *tagname;
|
||||||
tag->ToString(tagname);
|
tag->GetUTF8String(&tagname);
|
||||||
nsCAutoString tagstrC;
|
|
||||||
tagstrC.AssignWithConversion(tagname);
|
|
||||||
PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
|
PR_LOG(gXULTemplateLog, PR_LOG_DEBUG,
|
||||||
("xultemplate[%p] building %s %s %s",
|
("xultemplate[%p] building %s %s %s",
|
||||||
this, tagstrC.get(),
|
this, tagname,
|
||||||
(isResourceElement ? "[resource]" : ""),
|
(isResourceElement ? "[resource]" : ""),
|
||||||
(isUnique ? "[unique]" : "")));
|
(isUnique ? "[unique]" : "")));
|
||||||
}
|
}
|
||||||
@ -667,7 +658,8 @@ nsXULContentBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((tag.get() == nsXULAtoms::textnode) && (nameSpaceID == kNameSpaceID_XUL)) {
|
else if (tag == nsXULAtoms::textnode &&
|
||||||
|
nameSpaceID == kNameSpaceID_XUL) {
|
||||||
// <xul:text value="..."> is replaced by text of the
|
// <xul:text value="..."> is replaced by text of the
|
||||||
// actual value of the 'rdf:resource' attribute for the
|
// actual value of the 'rdf:resource' attribute for the
|
||||||
// given node.
|
// given node.
|
||||||
@ -901,7 +893,8 @@ nsXULContentBuilder::AddPersistentAttributes(nsIContent* aTemplateNode,
|
|||||||
rv = value->GetValueConst(&valueStr);
|
rv = value->GetValueConst(&valueStr);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
rv = aRealNode->SetAttr(nameSpaceID, tag, nsAutoString(valueStr), PR_FALSE);
|
rv = aRealNode->SetAttr(nameSpaceID, tag, nsDependentString(valueStr),
|
||||||
|
PR_FALSE);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1012,7 +1005,7 @@ nsXULContentBuilder::IsDirectlyContainedBy(nsIContent* aChild, nsIContent* aPare
|
|||||||
|
|
||||||
// Now walk up the template subtree in parallel with the generated
|
// Now walk up the template subtree in parallel with the generated
|
||||||
// subtree.
|
// subtree.
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsINodeInfo *ni;
|
||||||
nsCOMPtr<nsIContent> generated(aChild);
|
nsCOMPtr<nsIContent> generated(aChild);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@ -1035,10 +1028,10 @@ nsXULContentBuilder::IsDirectlyContainedBy(nsIContent* aChild, nsIContent* aPare
|
|||||||
// The content within a template ends when we hit the
|
// The content within a template ends when we hit the
|
||||||
// <template> or <rule> element in the simple syntax, or the
|
// <template> or <rule> element in the simple syntax, or the
|
||||||
// <action> element in the extended syntax.
|
// <action> element in the extended syntax.
|
||||||
tmpl->GetTag(getter_AddRefs(tag));
|
ni = tmpl->GetNodeInfo();
|
||||||
} while (tag != nsXULAtoms::templateAtom &&
|
} while (!ni->Equals(nsXULAtoms::templateAtom, kNameSpaceID_XUL) &&
|
||||||
tag != nsXULAtoms::rule &&
|
!ni->Equals(nsXULAtoms::rule, kNameSpaceID_XUL) &&
|
||||||
tag != nsXULAtoms::action);
|
!ni->Equals(nsXULAtoms::action, kNameSpaceID_XUL));
|
||||||
|
|
||||||
// Did we find the generated parent?
|
// Did we find the generated parent?
|
||||||
return PRBool(generated.get() == aParent);
|
return PRBool(generated.get() == aParent);
|
||||||
@ -1097,34 +1090,21 @@ nsXULContentBuilder::RemoveMember(nsIContent* aContainerElement,
|
|||||||
|
|
||||||
#ifdef PR_LOGGING
|
#ifdef PR_LOGGING
|
||||||
if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_ALWAYS)) {
|
if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_ALWAYS)) {
|
||||||
nsCOMPtr<nsIAtom> parentTag;
|
const char *parentTagStr;
|
||||||
rv = parent->GetTag(getter_AddRefs(parentTag));
|
parent->Tag()->GetUTF8String(&parentTagStr);
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsAutoString parentTagStr;
|
const char *childTagStr;
|
||||||
rv = parentTag->ToString(parentTagStr);
|
child->Tag()->GetUTF8String(&childTagStr);
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> childTag;
|
|
||||||
rv = child->GetTag(getter_AddRefs(childTag));
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
nsAutoString childTagStr;
|
|
||||||
rv = childTag->ToString(childTagStr);
|
|
||||||
if (NS_FAILED(rv)) return rv;
|
|
||||||
|
|
||||||
const char* resourceCStr;
|
const char* resourceCStr;
|
||||||
rv = aMember->GetValueConst(&resourceCStr);
|
rv = aMember->GetValueConst(&resourceCStr);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
nsCAutoString childtagstrC,parenttagstrC;
|
|
||||||
parenttagstrC.AssignWithConversion(parentTagStr);
|
|
||||||
childtagstrC.AssignWithConversion(childTagStr);
|
|
||||||
PR_LOG(gXULTemplateLog, PR_LOG_ALWAYS,
|
PR_LOG(gXULTemplateLog, PR_LOG_ALWAYS,
|
||||||
("xultemplate[%p] remove-member %s->%s [%s]",
|
("xultemplate[%p] remove-member %s->%s [%s]",
|
||||||
this,
|
this,
|
||||||
parenttagstrC.get(),
|
parentTagStr,
|
||||||
childtagstrC.get(),
|
childTagStr,
|
||||||
resourceCStr));
|
resourceCStr));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1377,30 +1357,23 @@ nsXULContentBuilder::IsOpen(nsIContent* aElement)
|
|||||||
|
|
||||||
// XXXhyatt - use XBL service to obtain base tag.
|
// XXXhyatt - use XBL service to obtain base tag.
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = aElement->Tag();
|
||||||
rv = aElement->GetTag(getter_AddRefs(tag));
|
|
||||||
if (NS_FAILED(rv)) return PR_FALSE;
|
|
||||||
|
|
||||||
// Treat the 'root' element as always open, -unless- it's a
|
// Treat the 'root' element as always open, -unless- it's a
|
||||||
// menu/menupopup. We don't need to "fake" these as being open.
|
// menu/menupopup. We don't need to "fake" these as being open.
|
||||||
if ((aElement == mRoot) && (tag.get() != nsXULAtoms::menu) &&
|
if ((aElement == mRoot) && aElement->IsContentOfType(nsIContent::eXUL) &&
|
||||||
(tag.get() != nsXULAtoms::menubutton) &&
|
(tag != nsXULAtoms::menu) &&
|
||||||
(tag.get() != nsXULAtoms::toolbarbutton) &&
|
(tag != nsXULAtoms::menubutton) &&
|
||||||
(tag.get() != nsXULAtoms::button))
|
(tag != nsXULAtoms::toolbarbutton) &&
|
||||||
|
(tag != nsXULAtoms::button))
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
|
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::open, value);
|
rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::open, value);
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get open attribute");
|
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get open attribute");
|
||||||
if (NS_FAILED(rv)) return PR_FALSE;
|
|
||||||
|
|
||||||
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
|
return (rv == NS_CONTENT_ATTR_HAS_VALUE &&
|
||||||
if (value == NS_LITERAL_STRING("true"))
|
value == NS_LITERAL_STRING("true"));
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1427,9 +1400,8 @@ nsXULContentBuilder::RemoveGeneratedContent(nsIContent* aElement)
|
|||||||
// Optimize for the <template> element, because we *know*
|
// Optimize for the <template> element, because we *know*
|
||||||
// it won't have any generated content: there's no reason
|
// it won't have any generated content: there's no reason
|
||||||
// to even check this subtree.
|
// to even check this subtree.
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsINodeInfo *ni = element->GetNodeInfo();
|
||||||
element->GetTag(getter_AddRefs(tag));
|
if (!ni || ni->Equals(nsXULAtoms::templateAtom, kNameSpaceID_XUL))
|
||||||
if (tag.get() == nsXULAtoms::templateAtom)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// If the element is in the template map, then we
|
// If the element is in the template map, then we
|
||||||
@ -1468,32 +1440,26 @@ PRBool
|
|||||||
nsXULContentBuilder::IsLazyWidgetItem(nsIContent* aElement)
|
nsXULContentBuilder::IsLazyWidgetItem(nsIContent* aElement)
|
||||||
{
|
{
|
||||||
// Determine if this is a <tree>, <treeitem>, or <menu> element
|
// Determine if this is a <tree>, <treeitem>, or <menu> element
|
||||||
nsresult rv;
|
|
||||||
|
|
||||||
PRInt32 nameSpaceID;
|
if (!aElement->IsContentOfType(nsIContent::eXUL)) {
|
||||||
rv = aElement->GetNameSpaceID(&nameSpaceID);
|
return PR_FALSE;
|
||||||
if (NS_FAILED(rv)) return PR_FALSE;
|
}
|
||||||
|
|
||||||
// XXXhyatt Use the XBL service to obtain a base tag.
|
// XXXhyatt Use the XBL service to obtain a base tag.
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = aElement->Tag();
|
||||||
rv = aElement->GetTag(getter_AddRefs(tag));
|
|
||||||
if (NS_FAILED(rv)) return PR_FALSE;
|
|
||||||
|
|
||||||
if (nameSpaceID != kNameSpaceID_XUL)
|
|
||||||
return PR_FALSE;
|
|
||||||
|
|
||||||
if ((tag.get() == nsXULAtoms::menu) || (tag.get() == nsXULAtoms::menulist) ||
|
|
||||||
(tag.get() == nsXULAtoms::menubutton) || (tag.get() == nsXULAtoms::toolbarbutton) ||
|
|
||||||
(tag.get() == nsXULAtoms::button) || (tag == nsXULAtoms::treeitem))
|
|
||||||
return PR_TRUE;
|
|
||||||
|
|
||||||
return PR_FALSE;
|
|
||||||
|
|
||||||
|
return (tag == nsXULAtoms::menu ||
|
||||||
|
tag == nsXULAtoms::menulist ||
|
||||||
|
tag == nsXULAtoms::menubutton ||
|
||||||
|
tag == nsXULAtoms::toolbarbutton ||
|
||||||
|
tag == nsXULAtoms::button ||
|
||||||
|
tag == nsXULAtoms::treeitem);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsXULContentBuilder::GetElementsForResource(nsIRDFResource* aResource, nsISupportsArray* aElements)
|
nsXULContentBuilder::GetElementsForResource(nsIRDFResource* aResource,
|
||||||
|
nsISupportsArray* aElements)
|
||||||
{
|
{
|
||||||
const char *uri;
|
const char *uri;
|
||||||
aResource->GetValueConst(&uri);
|
aResource->GetValueConst(&uri);
|
||||||
@ -1876,12 +1842,11 @@ nsXULContentBuilder::OpenContainer(nsIContent* aElement)
|
|||||||
nsresult
|
nsresult
|
||||||
nsXULContentBuilder::CloseContainer(nsIContent* aElement)
|
nsXULContentBuilder::CloseContainer(nsIContent* aElement)
|
||||||
{
|
{
|
||||||
|
#if 0 // Um, what was this really supposed to do?
|
||||||
// See if we're responsible for this element
|
// See if we're responsible for this element
|
||||||
if (! IsElementInBuilder(aElement, this))
|
if (! IsElementInBuilder(aElement, this))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
#endif
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
aElement->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -283,19 +283,24 @@ nsresult
|
|||||||
XULSortServiceImpl::FindSortableContainer(nsIContent *aRoot,
|
XULSortServiceImpl::FindSortableContainer(nsIContent *aRoot,
|
||||||
nsIContent **aContainer)
|
nsIContent **aContainer)
|
||||||
{
|
{
|
||||||
|
*aContainer = nsnull;
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = aRoot->Tag();
|
||||||
if (NS_FAILED(rv = aRoot->GetTag(getter_AddRefs(tag)))) return rv;
|
|
||||||
|
|
||||||
if (tag == nsXULAtoms::templateAtom) // ignore content within templates
|
if (aRoot->IsContentOfType(nsIContent::eXUL)) {
|
||||||
return NS_OK;
|
if (tag == nsXULAtoms::templateAtom) // ignore content within templates
|
||||||
|
return NS_OK;
|
||||||
|
|
||||||
if (tag == nsXULAtoms::listbox || tag == nsXULAtoms::treechildren || tag == nsXULAtoms::menupopup)
|
if (tag == nsXULAtoms::listbox ||
|
||||||
{
|
tag == nsXULAtoms::treechildren ||
|
||||||
*aContainer = aRoot;
|
tag == nsXULAtoms::menupopup) {
|
||||||
NS_ADDREF(*aContainer);
|
*aContainer = aRoot;
|
||||||
return NS_OK;
|
NS_ADDREF(*aContainer);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PRUint32 numChildren = aRoot->GetChildCount();
|
PRUint32 numChildren = aRoot->GetChildCount();
|
||||||
@ -361,25 +366,33 @@ XULSortServiceImpl::SetSortColumnHints(nsIContent *content,
|
|||||||
nsIContent *child = content->GetChildAt(childIndex);
|
nsIContent *child = content->GetChildAt(childIndex);
|
||||||
|
|
||||||
if (child->IsContentOfType(nsIContent::eXUL)) {
|
if (child->IsContentOfType(nsIContent::eXUL)) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = child->Tag();
|
||||||
if (NS_FAILED(rv = child->GetTag(getter_AddRefs(tag)))) return rv;
|
|
||||||
|
if (tag == nsXULAtoms::treecols ||
|
||||||
if (tag == nsXULAtoms::treecols || tag == nsXULAtoms::listcols || tag == nsXULAtoms::listhead) {
|
tag == nsXULAtoms::listcols ||
|
||||||
|
tag == nsXULAtoms::listhead) {
|
||||||
rv = SetSortColumnHints(child, sortResource, sortDirection);
|
rv = SetSortColumnHints(child, sortResource, sortDirection);
|
||||||
} else if (tag == nsXULAtoms::treecol ||
|
} else if (tag == nsXULAtoms::treecol ||
|
||||||
tag == nsXULAtoms::listcol || tag == nsXULAtoms::listheader) {
|
tag == nsXULAtoms::listcol ||
|
||||||
|
tag == nsXULAtoms::listheader) {
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv = child->GetAttr(kNameSpaceID_None, nsXULAtoms::resource, value))
|
if (NS_SUCCEEDED(rv = child->GetAttr(kNameSpaceID_None,
|
||||||
|
nsXULAtoms::resource, value))
|
||||||
&& rv == NS_CONTENT_ATTR_HAS_VALUE)
|
&& rv == NS_CONTENT_ATTR_HAS_VALUE)
|
||||||
{
|
{
|
||||||
if (value == sortResource) {
|
if (value == sortResource) {
|
||||||
child->SetAttr(kNameSpaceID_None, nsXULAtoms::sortActive, *kTrueStr, PR_TRUE);
|
child->SetAttr(kNameSpaceID_None, nsXULAtoms::sortActive,
|
||||||
child->SetAttr(kNameSpaceID_None, nsXULAtoms::sortDirection, sortDirection, PR_TRUE);
|
*kTrueStr, PR_TRUE);
|
||||||
// Note: don't break out of loop; want to set/unset attribs on ALL sort columns
|
child->SetAttr(kNameSpaceID_None, nsXULAtoms::sortDirection,
|
||||||
|
sortDirection, PR_TRUE);
|
||||||
|
// Note: don't break out of loop; want to set/unset
|
||||||
|
// attribs on ALL sort columns
|
||||||
} else {
|
} else {
|
||||||
child->UnsetAttr(kNameSpaceID_None, nsXULAtoms::sortActive, PR_TRUE);
|
child->UnsetAttr(kNameSpaceID_None, nsXULAtoms::sortActive,
|
||||||
child->UnsetAttr(kNameSpaceID_None, nsXULAtoms::sortDirection, PR_TRUE);
|
PR_TRUE);
|
||||||
|
child->UnsetAttr(kNameSpaceID_None, nsXULAtoms::sortDirection,
|
||||||
|
PR_TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -390,30 +403,39 @@ XULSortServiceImpl::SetSortColumnHints(nsIContent *content,
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
XULSortServiceImpl::GetSortColumnInfo(nsIContent *tree, nsAString &sortResource,
|
XULSortServiceImpl::GetSortColumnInfo(nsIContent *tree,
|
||||||
nsAString &sortDirection, nsAString &sortResource2,
|
nsAString &sortResource,
|
||||||
|
nsAString &sortDirection,
|
||||||
|
nsAString &sortResource2,
|
||||||
PRBool &inbetweenSeparatorSort)
|
PRBool &inbetweenSeparatorSort)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_ERROR_FAILURE;
|
nsresult rv = NS_ERROR_FAILURE;
|
||||||
inbetweenSeparatorSort = PR_FALSE;
|
inbetweenSeparatorSort = PR_FALSE;
|
||||||
|
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
if (NS_SUCCEEDED(rv = tree->GetAttr(kNameSpaceID_None, nsXULAtoms::sortActive, value))
|
if (NS_SUCCEEDED(rv = tree->GetAttr(kNameSpaceID_None,
|
||||||
|
nsXULAtoms::sortActive, value))
|
||||||
&& (rv == NS_CONTENT_ATTR_HAS_VALUE))
|
&& (rv == NS_CONTENT_ATTR_HAS_VALUE))
|
||||||
{
|
{
|
||||||
if (value.Equals(NS_LITERAL_STRING("true")))
|
if (value.Equals(NS_LITERAL_STRING("true")))
|
||||||
{
|
{
|
||||||
if (NS_SUCCEEDED(rv = tree->GetAttr(kNameSpaceID_None, nsXULAtoms::sortResource, sortResource))
|
if (NS_SUCCEEDED(rv = tree->GetAttr(kNameSpaceID_None,
|
||||||
|
nsXULAtoms::sortResource,
|
||||||
|
sortResource))
|
||||||
&& (rv == NS_CONTENT_ATTR_HAS_VALUE))
|
&& (rv == NS_CONTENT_ATTR_HAS_VALUE))
|
||||||
{
|
{
|
||||||
if (NS_SUCCEEDED(rv = tree->GetAttr(kNameSpaceID_None, nsXULAtoms::sortDirection, sortDirection))
|
if (NS_SUCCEEDED(rv = tree->GetAttr(kNameSpaceID_None,
|
||||||
|
nsXULAtoms::sortDirection,
|
||||||
|
sortDirection))
|
||||||
&& (rv == NS_CONTENT_ATTR_HAS_VALUE))
|
&& (rv == NS_CONTENT_ATTR_HAS_VALUE))
|
||||||
{
|
{
|
||||||
rv = NS_OK;
|
rv = NS_OK;
|
||||||
|
|
||||||
// sort separator flag is optional
|
// sort separator flag is optional
|
||||||
if (NS_SUCCEEDED(rv = tree->GetAttr(kNameSpaceID_None, nsXULAtoms::sortSeparators,
|
if (NS_SUCCEEDED(rv = tree->GetAttr(kNameSpaceID_None,
|
||||||
value)) && (rv == NS_CONTENT_ATTR_HAS_VALUE))
|
nsXULAtoms::sortSeparators,
|
||||||
|
value)) &&
|
||||||
|
(rv == NS_CONTENT_ATTR_HAS_VALUE))
|
||||||
{
|
{
|
||||||
if (value.Equals(NS_LITERAL_STRING("true")))
|
if (value.Equals(NS_LITERAL_STRING("true")))
|
||||||
{
|
{
|
||||||
@ -422,8 +444,10 @@ XULSortServiceImpl::GetSortColumnInfo(nsIContent *tree, nsAString &sortResource,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// secondary sort info is optional
|
// secondary sort info is optional
|
||||||
if (NS_FAILED(rv = tree->GetAttr(kNameSpaceID_None, nsXULAtoms::sortResource2, sortResource2))
|
if (NS_FAILED(rv = tree->GetAttr(kNameSpaceID_None,
|
||||||
|| (rv != NS_CONTENT_ATTR_HAS_VALUE))
|
nsXULAtoms::sortResource2,
|
||||||
|
sortResource2)) ||
|
||||||
|
(rv != NS_CONTENT_ATTR_HAS_VALUE))
|
||||||
{
|
{
|
||||||
sortResource2.Truncate();
|
sortResource2.Truncate();
|
||||||
}
|
}
|
||||||
@ -437,8 +461,8 @@ XULSortServiceImpl::GetSortColumnInfo(nsIContent *tree, nsAString &sortResource,
|
|||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
XULSortServiceImpl::CompareNodes(nsIRDFNode *cellNode1, PRBool isCollationKey1,
|
XULSortServiceImpl::CompareNodes(nsIRDFNode *cellNode1, PRBool isCollationKey1,
|
||||||
nsIRDFNode *cellNode2, PRBool isCollationKey2,
|
nsIRDFNode *cellNode2, PRBool isCollationKey2,
|
||||||
PRBool &bothValid, PRInt32 & sortOrder)
|
PRBool &bothValid, PRInt32 & sortOrder)
|
||||||
{
|
{
|
||||||
bothValid = PR_FALSE;
|
bothValid = PR_FALSE;
|
||||||
sortOrder = 0;
|
sortOrder = 0;
|
||||||
@ -1100,7 +1124,6 @@ XULSortServiceImpl::SortContainer(nsIContent *container, sortPtr sortInfo,
|
|||||||
// (since we also skip over non XUL:treeitem nodes)
|
// (since we also skip over non XUL:treeitem nodes)
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
currentElement = numChildren;
|
currentElement = numChildren;
|
||||||
PRUint32 childIndex;
|
PRUint32 childIndex;
|
||||||
// childIndex is unsigned, so childIndex >= 0 would always test true
|
// childIndex is unsigned, so childIndex >= 0 would always test true
|
||||||
@ -1109,9 +1132,12 @@ XULSortServiceImpl::SortContainer(nsIContent *container, sortPtr sortInfo,
|
|||||||
nsIContent *child = container->GetChildAt(childIndex);
|
nsIContent *child = container->GetChildAt(childIndex);
|
||||||
|
|
||||||
if (child->IsContentOfType(nsIContent::eXUL)) {
|
if (child->IsContentOfType(nsIContent::eXUL)) {
|
||||||
if (NS_FAILED(rv = child->GetTag(getter_AddRefs(tag)))) continue;
|
nsIAtom *tag = child->Tag();
|
||||||
if (tag == nsXULAtoms::listitem || tag == nsXULAtoms::treeitem
|
|
||||||
|| tag == nsXULAtoms::menu || tag == nsXULAtoms::menuitem) {
|
if (tag == nsXULAtoms::listitem ||
|
||||||
|
tag == nsXULAtoms::treeitem ||
|
||||||
|
tag == nsXULAtoms::menu ||
|
||||||
|
tag == nsXULAtoms::menuitem) {
|
||||||
--currentElement;
|
--currentElement;
|
||||||
|
|
||||||
nsCOMPtr<nsIRDFResource> resource;
|
nsCOMPtr<nsIRDFResource> resource;
|
||||||
@ -1171,9 +1197,12 @@ XULSortServiceImpl::SortContainer(nsIContent *container, sortPtr sortInfo,
|
|||||||
nsIContent *child = container->GetChildAt(childIndex);
|
nsIContent *child = container->GetChildAt(childIndex);
|
||||||
|
|
||||||
if (child->IsContentOfType(nsIContent::eXUL)) {
|
if (child->IsContentOfType(nsIContent::eXUL)) {
|
||||||
if (NS_FAILED(rv = child->GetTag(getter_AddRefs(tag)))) continue;
|
nsIAtom *tag = child->Tag();
|
||||||
if (tag == nsXULAtoms::listitem || tag == nsXULAtoms::treeitem
|
|
||||||
|| tag == nsXULAtoms::menu || tag == nsXULAtoms::menuitem) {
|
if (tag == nsXULAtoms::listitem ||
|
||||||
|
tag == nsXULAtoms::treeitem ||
|
||||||
|
tag == nsXULAtoms::menu ||
|
||||||
|
tag == nsXULAtoms::menuitem) {
|
||||||
// immediately remove the child node, and ignore any errors
|
// immediately remove the child node, and ignore any errors
|
||||||
container->RemoveChildAt(childIndex, PR_FALSE);
|
container->RemoveChildAt(childIndex, PR_FALSE);
|
||||||
}
|
}
|
||||||
@ -1202,14 +1231,13 @@ XULSortServiceImpl::SortContainer(nsIContent *container, sortPtr sortInfo,
|
|||||||
for (childIndex = 0; childIndex < numChildren; childIndex++) {
|
for (childIndex = 0; childIndex < numChildren; childIndex++) {
|
||||||
nsIContent *child = parentNode->GetChildAt(childIndex);
|
nsIContent *child = parentNode->GetChildAt(childIndex);
|
||||||
|
|
||||||
if (!child->IsContentOfType(nsIContent::eXUL))
|
nsINodeInfo *ni = child->GetNodeInfo();
|
||||||
continue;
|
|
||||||
|
|
||||||
if (NS_FAILED(rv = child->GetTag(getter_AddRefs(tag)))) continue;
|
if (ni && (ni->Equals(nsXULAtoms::treechildren, kNameSpaceID_XUL) ||
|
||||||
if (tag != nsXULAtoms::treechildren && tag != nsXULAtoms::menupopup) continue;
|
ni->Equals(nsXULAtoms::menupopup, kNameSpaceID_XUL))) {
|
||||||
|
sortInfo->parentContainer = parentNode;
|
||||||
sortInfo->parentContainer = parentNode;
|
SortContainer(child, sortInfo, merelyInvertFlag);
|
||||||
SortContainer(child, sortInfo, merelyInvertFlag);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1377,10 +1405,6 @@ XULSortServiceImpl::InsertContainerNode(nsIRDFCompositeDataSource *db, nsRDFSort
|
|||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
nsAutoString id;
|
nsAutoString id;
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
|
|
||||||
if (NS_FAILED(rv = trueParent->GetTag(getter_AddRefs(tag))))
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
rv = trueParent->GetAttr(kNameSpaceID_None, nsXULAtoms::ref, id);
|
rv = trueParent->GetAttr(kNameSpaceID_None, nsXULAtoms::ref, id);
|
||||||
if (id.IsEmpty())
|
if (id.IsEmpty())
|
||||||
@ -1627,9 +1651,7 @@ XULSortServiceImpl::Sort(nsIDOMNode* node, const nsAString& sortResource, const
|
|||||||
// store sort info in attributes on content
|
// store sort info in attributes on content
|
||||||
SetSortHints(dbNode, sortResource, sortDirection, sortResource2, sortInfo.inbetweenSeparatorSort, PR_TRUE);
|
SetSortHints(dbNode, sortResource, sortDirection, sortResource2, sortInfo.inbetweenSeparatorSort, PR_TRUE);
|
||||||
|
|
||||||
// start sorting the content depending on the tag
|
// start sorting the content
|
||||||
nsCOMPtr<nsIAtom> dbNodeTag;
|
|
||||||
dbNode->GetTag(getter_AddRefs(dbNodeTag));
|
|
||||||
nsCOMPtr<nsIContent> container;
|
nsCOMPtr<nsIContent> container;
|
||||||
if (NS_FAILED(rv = FindSortableContainer(dbNode, getter_AddRefs(container)))) return rv;
|
if (NS_FAILED(rv = FindSortableContainer(dbNode, getter_AddRefs(container)))) return rv;
|
||||||
SortContainer(container, &sortInfo, invertTreeFlag);
|
SortContainer(container, &sortInfo, invertTreeFlag);
|
||||||
|
|||||||
@ -1379,18 +1379,9 @@ nsXULTemplateBuilder::ComputeContainmentProperties()
|
|||||||
PRBool
|
PRBool
|
||||||
nsXULTemplateBuilder::IsTemplateElement(nsIContent* aContent)
|
nsXULTemplateBuilder::IsTemplateElement(nsIContent* aContent)
|
||||||
{
|
{
|
||||||
PRInt32 nameSpaceID;
|
nsINodeInfo *ni = aContent->GetNodeInfo();
|
||||||
aContent->GetNameSpaceID(&nameSpaceID);
|
|
||||||
|
|
||||||
if (nameSpaceID == kNameSpaceID_XUL) {
|
return ni && ni->Equals(nsXULAtoms::Template, kNameSpaceID_XUL);
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (tag.get() == nsXULAtoms::Template)
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
@ -1545,14 +1536,9 @@ nsXULTemplateBuilder::CompileRules()
|
|||||||
|
|
||||||
for (PRUint32 i = 0; i < count; i++) {
|
for (PRUint32 i = 0; i < count; i++) {
|
||||||
nsIContent *rule = tmpl->GetChildAt(i);
|
nsIContent *rule = tmpl->GetChildAt(i);
|
||||||
|
nsINodeInfo *ni = rule->GetNodeInfo();
|
||||||
|
|
||||||
if (!rule->IsContentOfType(nsIContent::eXUL))
|
if (ni && ni->Equals(nsXULAtoms::rule, kNameSpaceID_XUL)) {
|
||||||
continue;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
rule->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (tag == nsXULAtoms::rule) {
|
|
||||||
++nrules;
|
++nrules;
|
||||||
|
|
||||||
// If the <rule> has a <conditions> element, then
|
// If the <rule> has a <conditions> element, then
|
||||||
@ -1737,11 +1723,9 @@ nsXULTemplateBuilder::CompileConditions(nsTemplateRule* aRule,
|
|||||||
for (PRUint32 i = 0; i < count; ++i) {
|
for (PRUint32 i = 0; i < count; ++i) {
|
||||||
nsIContent *condition = aConditions->GetChildAt(i);
|
nsIContent *condition = aConditions->GetChildAt(i);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
condition->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
TestNode* testnode = nsnull;
|
TestNode* testnode = nsnull;
|
||||||
rv = CompileCondition(tag, aRule, condition, aParentNode, &testnode);
|
rv = CompileCondition(condition->Tag(), aRule, condition,
|
||||||
|
aParentNode, &testnode);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
|
|
||||||
// XXXwaterson proably wrong to just drill it straight down
|
// XXXwaterson proably wrong to just drill it straight down
|
||||||
|
|||||||
@ -69,29 +69,26 @@ nsComposeTxtSrvFilter::Skip(nsIDOMNode* aNode, PRBool *_retval)
|
|||||||
// their type is "cite"
|
// their type is "cite"
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
nsCOMPtr<nsIContent> content(do_QueryInterface(aNode));
|
||||||
if (content) {
|
if (content) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = content->Tag();
|
||||||
content->GetTag(getter_AddRefs(tag));
|
if (tag == mBlockQuoteAtom) {
|
||||||
if (tag) {
|
if (mIsForMail) {
|
||||||
if (tag == mBlockQuoteAtom) {
|
nsAutoString cite;
|
||||||
if (mIsForMail) {
|
if (NS_SUCCEEDED(content->GetAttr(kNameSpaceID_None, mTypeAtom, cite))) {
|
||||||
nsAutoString cite;
|
*_retval = cite.EqualsIgnoreCase("cite");
|
||||||
if (NS_SUCCEEDED(content->GetAttr(kNameSpaceID_None, mTypeAtom, cite))) {
|
|
||||||
*_retval = cite.EqualsIgnoreCase("cite");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (tag == mPreAtom || tag == mSpanAtom) {
|
|
||||||
if (mIsForMail) {
|
|
||||||
nsAutoString mozQuote;
|
|
||||||
if (NS_SUCCEEDED(content->GetAttr(kNameSpaceID_None, mMozQuoteAtom, mozQuote))) {
|
|
||||||
*_retval = mozQuote.EqualsIgnoreCase("true");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (tag == mScriptAtom ||
|
|
||||||
tag == mTextAreaAtom ||
|
|
||||||
tag == mSelectAreaAtom ||
|
|
||||||
tag == mMapAtom) {
|
|
||||||
*_retval = PR_TRUE;
|
|
||||||
}
|
}
|
||||||
|
} else if (tag == mPreAtom || tag == mSpanAtom) {
|
||||||
|
if (mIsForMail) {
|
||||||
|
nsAutoString mozQuote;
|
||||||
|
if (NS_SUCCEEDED(content->GetAttr(kNameSpaceID_None, mMozQuoteAtom, mozQuote))) {
|
||||||
|
*_retval = mozQuote.EqualsIgnoreCase("true");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (tag == mScriptAtom ||
|
||||||
|
tag == mTextAreaAtom ||
|
||||||
|
tag == mSelectAreaAtom ||
|
||||||
|
tag == mMapAtom) {
|
||||||
|
*_retval = PR_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3785,22 +3785,19 @@ NS_IMETHODIMP nsEditor::ResetModificationCount()
|
|||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// GetTag: digs out the atom for the tag of this node
|
// GetTag: digs out the atom for the tag of this node
|
||||||
//
|
//
|
||||||
nsCOMPtr<nsIAtom>
|
nsIAtom *
|
||||||
nsEditor::GetTag(nsIDOMNode *aNode)
|
nsEditor::GetTag(nsIDOMNode *aNode)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> atom;
|
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||||
|
|
||||||
if (!aNode)
|
if (!content)
|
||||||
{
|
{
|
||||||
NS_NOTREACHED("null node passed to nsEditor::GetTag()");
|
NS_ASSERTION(aNode, "null node passed to nsEditor::Tag()");
|
||||||
return atom;
|
|
||||||
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
return content->Tag();
|
||||||
if (content)
|
|
||||||
content->GetTag(getter_AddRefs(atom));
|
|
||||||
|
|
||||||
return atom;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3816,14 +3813,14 @@ nsEditor::GetTagString(nsIDOMNode *aNode, nsAString& outString)
|
|||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> atom = GetTag(aNode);
|
nsIAtom *atom = GetTag(aNode);
|
||||||
if (atom)
|
if (!atom)
|
||||||
{
|
{
|
||||||
atom->ToString(outString);
|
return NS_ERROR_FAILURE;
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_ERROR_FAILURE;
|
atom->ToString(outString);
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3839,10 +3836,7 @@ nsEditor::NodesSameType(nsIDOMNode *aNode1, nsIDOMNode *aNode2)
|
|||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> atom1 = GetTag(aNode1);
|
return GetTag(aNode1) == GetTag(aNode2);
|
||||||
nsCOMPtr<nsIAtom> atom2 = GetTag(aNode2);
|
|
||||||
|
|
||||||
return (atom1 == atom2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -457,14 +457,13 @@ public:
|
|||||||
/** returns PR_TRUE if aNode is of the type implied by aTag */
|
/** returns PR_TRUE if aNode is of the type implied by aTag */
|
||||||
static inline PRBool NodeIsType(nsIDOMNode *aNode, nsIAtom *aTag)
|
static inline PRBool NodeIsType(nsIDOMNode *aNode, nsIAtom *aTag)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> nodeAtom = nsEditor::GetTag(aNode);
|
return GetTag(aNode) == aTag;
|
||||||
return (nodeAtom == aTag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// we should get rid of this method if we can
|
// we should get rid of this method if we can
|
||||||
static inline PRBool NodeIsTypeString(nsIDOMNode *aNode, const nsAString &aTag)
|
static inline PRBool NodeIsTypeString(nsIDOMNode *aNode, const nsAString &aTag)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> nodeAtom = nsEditor::GetTag(aNode);
|
nsIAtom *nodeAtom = GetTag(aNode);
|
||||||
return nodeAtom && nodeAtom->Equals(aTag);
|
return nodeAtom && nodeAtom->Equals(aTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -509,7 +508,7 @@ public:
|
|||||||
|
|
||||||
/** from html rules code - migration in progress */
|
/** from html rules code - migration in progress */
|
||||||
static nsresult GetTagString(nsIDOMNode *aNode, nsAString& outString);
|
static nsresult GetTagString(nsIDOMNode *aNode, nsAString& outString);
|
||||||
static nsCOMPtr<nsIAtom> GetTag(nsIDOMNode *aNode);
|
static nsIAtom *GetTag(nsIDOMNode *aNode);
|
||||||
virtual PRBool NodesSameType(nsIDOMNode *aNode1, nsIDOMNode *aNode2);
|
virtual PRBool NodesSameType(nsIDOMNode *aNode1, nsIDOMNode *aNode2);
|
||||||
static PRBool IsTextOrElementNode(nsIDOMNode *aNode);
|
static PRBool IsTextOrElementNode(nsIDOMNode *aNode);
|
||||||
static PRBool IsTextNode(nsIDOMNode *aNode);
|
static PRBool IsTextNode(nsIDOMNode *aNode);
|
||||||
|
|||||||
@ -343,8 +343,7 @@ nsHTMLCSSUtils::IsCSSEditableProperty(nsIDOMNode * aNode,
|
|||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
|
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
|
||||||
if (!content) return PR_FALSE;
|
if (!content) return PR_FALSE;
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tagName;
|
nsIAtom *tagName = content->Tag();
|
||||||
content->GetTag(getter_AddRefs(tagName));
|
|
||||||
// brade: should the above use nsEditor::GetTag(aNode)?
|
// brade: should the above use nsEditor::GetTag(aNode)?
|
||||||
// brade: shouldn't some of the above go below the next block?
|
// brade: shouldn't some of the above go below the next block?
|
||||||
|
|
||||||
@ -918,10 +917,7 @@ nsHTMLCSSUtils::GenerateCSSDeclarationsFromHTMLStyle(nsIDOMNode * aNode,
|
|||||||
}
|
}
|
||||||
if (!node) return;
|
if (!node) return;
|
||||||
|
|
||||||
// brade: use nsEditor::GetTag instead??
|
nsIAtom *tagName = nsEditor::GetTag(node);
|
||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
|
|
||||||
nsCOMPtr<nsIAtom> tagName;
|
|
||||||
content->GetTag(getter_AddRefs(tagName));
|
|
||||||
|
|
||||||
if (nsEditProperty::b == aHTMLProperty) {
|
if (nsEditProperty::b == aHTMLProperty) {
|
||||||
BuildCSSDeclarations(cssPropertyArray, cssValueArray, boldEquivTable, aValue, aGetOrRemoveRequest);
|
BuildCSSDeclarations(cssPropertyArray, cssValueArray, boldEquivTable, aValue, aGetOrRemoveRequest);
|
||||||
|
|||||||
@ -576,7 +576,7 @@ nsHTMLEditor::NodeIsBlockStatic(nsIDOMNode *aNode, PRBool *aIsBlock)
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tagAtom = nsEditor::GetTag(aNode);
|
nsIAtom *tagAtom = GetTag(aNode);
|
||||||
if (!tagAtom) return NS_ERROR_NULL_POINTER;
|
if (!tagAtom) return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
if (!sParserService) {
|
if (!sParserService) {
|
||||||
@ -886,10 +886,8 @@ nsHTMLEditor::GetBlockSectionsForRange(nsIDOMRange *aRange,
|
|||||||
nsCOMPtr<nsIDOMNode>currentNode = do_QueryInterface(currentContent);
|
nsCOMPtr<nsIDOMNode>currentNode = do_QueryInterface(currentContent);
|
||||||
if (currentNode)
|
if (currentNode)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> currentContentTag;
|
|
||||||
currentContent->GetTag(getter_AddRefs(currentContentTag));
|
|
||||||
// <BR> divides block content ranges. We can achieve this by nulling out lastRange
|
// <BR> divides block content ranges. We can achieve this by nulling out lastRange
|
||||||
if (nsEditProperty::br==currentContentTag)
|
if (currentContent->Tag() == nsEditProperty::br)
|
||||||
{
|
{
|
||||||
lastRange = nsnull;
|
lastRange = nsnull;
|
||||||
}
|
}
|
||||||
@ -4591,15 +4589,14 @@ nsHTMLEditor::SetCaretInTableCell(nsIDOMElement* aElement)
|
|||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
||||||
if (content)
|
if (content)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> atom;
|
nsIAtom *atom = content->Tag();
|
||||||
content->GetTag(getter_AddRefs(atom));
|
if (atom == nsEditProperty::table ||
|
||||||
if (atom.get() == nsEditProperty::table ||
|
atom == nsEditProperty::tbody ||
|
||||||
atom.get() == nsEditProperty::tbody ||
|
atom == nsEditProperty::thead ||
|
||||||
atom.get() == nsEditProperty::thead ||
|
atom == nsEditProperty::tfoot ||
|
||||||
atom.get() == nsEditProperty::tfoot ||
|
atom == nsEditProperty::caption ||
|
||||||
atom.get() == nsEditProperty::caption ||
|
atom == nsEditProperty::tr ||
|
||||||
atom.get() == nsEditProperty::tr ||
|
atom == nsEditProperty::td )
|
||||||
atom.get() == nsEditProperty::td )
|
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aElement);
|
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aElement);
|
||||||
nsCOMPtr<nsIDOMNode> parent;
|
nsCOMPtr<nsIDOMNode> parent;
|
||||||
@ -4795,7 +4792,7 @@ nsHTMLEditor::CollapseAdjacentTextNodes(nsIDOMRange *aInRange)
|
|||||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(content);
|
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(content);
|
||||||
if (text && node && IsEditable(node))
|
if (text && node && IsEditable(node))
|
||||||
{
|
{
|
||||||
textNodes.AppendElement((void*)(node.get()));
|
textNodes.AppendElement(node.get());
|
||||||
}
|
}
|
||||||
iter->Next();
|
iter->Next();
|
||||||
iter->CurrentNode(getter_AddRefs(content));
|
iter->CurrentNode(getter_AddRefs(content));
|
||||||
@ -4858,9 +4855,7 @@ nsHTMLEditor::GetNextElementByTagName(nsIDOMElement *aCurrentElement,
|
|||||||
if (NS_FAILED(res)) return res;
|
if (NS_FAILED(res)) return res;
|
||||||
if (!nextNode) break;
|
if (!nextNode) break;
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> atom = GetTag(currentNode);
|
if (GetTag(currentNode) == tagAtom)
|
||||||
|
|
||||||
if (tagAtom == atom)
|
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(currentNode);
|
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(currentNode);
|
||||||
if (!element) return NS_ERROR_NULL_POINTER;
|
if (!element) return NS_ERROR_NULL_POINTER;
|
||||||
@ -5902,11 +5897,10 @@ nsHTMLEditor::NodesSameType(nsIDOMNode *aNode1, nsIDOMNode *aNode2)
|
|||||||
PRBool useCSS;
|
PRBool useCSS;
|
||||||
GetIsCSSEnabled(&useCSS);
|
GetIsCSSEnabled(&useCSS);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> atom1 = GetTag(aNode1);
|
nsIAtom *tag1 = GetTag(aNode1);
|
||||||
nsCOMPtr<nsIAtom> atom2 = GetTag(aNode2);
|
|
||||||
|
if (tag1 == GetTag(aNode2)) {
|
||||||
if (atom1.get() == atom2.get()) {
|
if (useCSS && tag1 == nsEditProperty::span) {
|
||||||
if (useCSS && atom1 == nsEditProperty::span) {
|
|
||||||
if (mHTMLCSSUtils->ElementsSameStyle(aNode1, aNode2)) {
|
if (mHTMLCSSUtils->ElementsSameStyle(aNode1, aNode2)) {
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -264,19 +264,19 @@ nsHTMLEditor::GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode)
|
|||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(tableChild);
|
nsCOMPtr<nsIContent> content = do_QueryInterface(tableChild);
|
||||||
if (content)
|
if (content)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> atom;
|
nsIAtom *atom = content->Tag();
|
||||||
content->GetTag(getter_AddRefs(atom));
|
|
||||||
if (atom == nsEditProperty::tr)
|
if (atom == nsEditProperty::tr)
|
||||||
{
|
{
|
||||||
// Found a row directly under <table>
|
// Found a row directly under <table>
|
||||||
*aRowNode = tableChild.get();
|
*aRowNode = tableChild;
|
||||||
NS_ADDREF(*aRowNode);
|
NS_ADDREF(*aRowNode);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
// Look for row in one of the row container elements
|
// Look for row in one of the row container elements
|
||||||
if (atom == nsEditProperty::tbody ||
|
if (atom == nsEditProperty::tbody ||
|
||||||
atom == nsEditProperty::thead ||
|
atom == nsEditProperty::thead ||
|
||||||
atom == nsEditProperty::tfoot )
|
atom == nsEditProperty::tfoot)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMNode> rowNode;
|
nsCOMPtr<nsIDOMNode> rowNode;
|
||||||
res = tableChild->GetFirstChild(getter_AddRefs(rowNode));
|
res = tableChild->GetFirstChild(getter_AddRefs(rowNode));
|
||||||
|
|||||||
@ -3183,42 +3183,35 @@ nsTextServicesDocument::ClearDidSkip(nsIContentIterator* aFilteredIter)
|
|||||||
PRBool
|
PRBool
|
||||||
nsTextServicesDocument::IsBlockNode(nsIContent *aContent)
|
nsTextServicesDocument::IsBlockNode(nsIContent *aContent)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> atom;
|
nsIAtom *atom = aContent->Tag();
|
||||||
|
|
||||||
aContent->GetTag(getter_AddRefs(atom));
|
return (sAAtom != atom &&
|
||||||
|
sAddressAtom != atom &&
|
||||||
if (!atom)
|
sBigAtom != atom &&
|
||||||
return PR_TRUE;
|
sBlinkAtom != atom &&
|
||||||
|
sBAtom != atom &&
|
||||||
nsIAtom *atomPtr = atom.get();
|
sCiteAtom != atom &&
|
||||||
|
sCodeAtom != atom &&
|
||||||
return (sAAtom != atomPtr &&
|
sDfnAtom != atom &&
|
||||||
sAddressAtom != atomPtr &&
|
sEmAtom != atom &&
|
||||||
sBigAtom != atomPtr &&
|
sFontAtom != atom &&
|
||||||
sBlinkAtom != atomPtr &&
|
sIAtom != atom &&
|
||||||
sBAtom != atomPtr &&
|
sKbdAtom != atom &&
|
||||||
sCiteAtom != atomPtr &&
|
sKeygenAtom != atom &&
|
||||||
sCodeAtom != atomPtr &&
|
sNobrAtom != atom &&
|
||||||
sDfnAtom != atomPtr &&
|
sSAtom != atom &&
|
||||||
sEmAtom != atomPtr &&
|
sSampAtom != atom &&
|
||||||
sFontAtom != atomPtr &&
|
sSmallAtom != atom &&
|
||||||
sIAtom != atomPtr &&
|
sSpacerAtom != atom &&
|
||||||
sKbdAtom != atomPtr &&
|
sSpanAtom != atom &&
|
||||||
sKeygenAtom != atomPtr &&
|
sStrikeAtom != atom &&
|
||||||
sNobrAtom != atomPtr &&
|
sStrongAtom != atom &&
|
||||||
sSAtom != atomPtr &&
|
sSubAtom != atom &&
|
||||||
sSampAtom != atomPtr &&
|
sSupAtom != atom &&
|
||||||
sSmallAtom != atomPtr &&
|
sTtAtom != atom &&
|
||||||
sSpacerAtom != atomPtr &&
|
sUAtom != atom &&
|
||||||
sSpanAtom != atomPtr &&
|
sVarAtom != atom &&
|
||||||
sStrikeAtom != atomPtr &&
|
sWbrAtom != atom);
|
||||||
sStrongAtom != atomPtr &&
|
|
||||||
sSubAtom != atomPtr &&
|
|
||||||
sSupAtom != atomPtr &&
|
|
||||||
sTtAtom != atomPtr &&
|
|
||||||
sUAtom != atomPtr &&
|
|
||||||
sVarAtom != atomPtr &&
|
|
||||||
sWbrAtom != atomPtr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
@ -4989,11 +4982,9 @@ void
|
|||||||
nsTextServicesDocument::PrintContentNode(nsIContent *aContent)
|
nsTextServicesDocument::PrintContentNode(nsIContent *aContent)
|
||||||
{
|
{
|
||||||
nsString tmpStr, str;
|
nsString tmpStr, str;
|
||||||
nsCOMPtr<nsIAtom> atom;
|
|
||||||
nsresult result;
|
nsresult result;
|
||||||
|
|
||||||
aContent->GetTag(getter_AddRefs(atom));
|
aContent->Tag()->ToString(tmpStr);
|
||||||
atom->ToString(tmpStr);
|
|
||||||
printf("%s", NS_LossyConvertUCS2toASCII(tmpStr).get());
|
printf("%s", NS_LossyConvertUCS2toASCII(tmpStr).get());
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aContent);
|
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aContent);
|
||||||
|
|||||||
@ -52,7 +52,8 @@ nsContextMenuInfo::~nsContextMenuInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* readonly attribute nsIDOMEvent mouseEvent; */
|
/* readonly attribute nsIDOMEvent mouseEvent; */
|
||||||
NS_IMETHODIMP nsContextMenuInfo::GetMouseEvent(nsIDOMEvent **aEvent)
|
NS_IMETHODIMP
|
||||||
|
nsContextMenuInfo::GetMouseEvent(nsIDOMEvent **aEvent)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aEvent);
|
NS_ENSURE_ARG_POINTER(aEvent);
|
||||||
NS_IF_ADDREF(*aEvent = mMouseEvent);
|
NS_IF_ADDREF(*aEvent = mMouseEvent);
|
||||||
@ -60,7 +61,8 @@ NS_IMETHODIMP nsContextMenuInfo::GetMouseEvent(nsIDOMEvent **aEvent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* readonly attribute nsIDOMNode targetNode; */
|
/* readonly attribute nsIDOMNode targetNode; */
|
||||||
NS_IMETHODIMP nsContextMenuInfo::GetTargetNode(nsIDOMNode **aNode)
|
NS_IMETHODIMP
|
||||||
|
nsContextMenuInfo::GetTargetNode(nsIDOMNode **aNode)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aNode);
|
NS_ENSURE_ARG_POINTER(aNode);
|
||||||
NS_IF_ADDREF(*aNode = mDOMNode);
|
NS_IF_ADDREF(*aNode = mDOMNode);
|
||||||
@ -135,7 +137,8 @@ nsContextMenuInfo::GetAssociatedLink(nsAString& aHRef)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* readonly attribute imgIContainer imageContainer; */
|
/* readonly attribute imgIContainer imageContainer; */
|
||||||
NS_IMETHODIMP nsContextMenuInfo::GetImageContainer(imgIContainer **aImageContainer)
|
NS_IMETHODIMP
|
||||||
|
nsContextMenuInfo::GetImageContainer(imgIContainer **aImageContainer)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aImageContainer);
|
NS_ENSURE_ARG_POINTER(aImageContainer);
|
||||||
NS_ENSURE_STATE(mDOMNode);
|
NS_ENSURE_STATE(mDOMNode);
|
||||||
@ -149,7 +152,8 @@ NS_IMETHODIMP nsContextMenuInfo::GetImageContainer(imgIContainer **aImageContain
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* readonly attribute nsIURI imageSrc; */
|
/* readonly attribute nsIURI imageSrc; */
|
||||||
NS_IMETHODIMP nsContextMenuInfo::GetImageSrc(nsIURI **aURI)
|
NS_IMETHODIMP
|
||||||
|
nsContextMenuInfo::GetImageSrc(nsIURI **aURI)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aURI);
|
NS_ENSURE_ARG_POINTER(aURI);
|
||||||
NS_ENSURE_STATE(mDOMNode);
|
NS_ENSURE_STATE(mDOMNode);
|
||||||
@ -336,7 +340,10 @@ nsContextMenuInfo::GetBackgroundImageRequest(nsIDOMNode * aDOMNode, imgIRequest
|
|||||||
// The check is a bit expensive, however until the canvas frame is somehow cached on the
|
// The check is a bit expensive, however until the canvas frame is somehow cached on the
|
||||||
// body frame, or the root element, we need to walk the frames up until we find the canvas
|
// body frame, or the root element, we need to walk the frames up until we find the canvas
|
||||||
//
|
//
|
||||||
nsresult nsContextMenuInfo::GetFrameForBackgroundUpdate(nsIPresContext *aPresContext,nsIFrame *aFrame, nsIFrame **aBGFrame)
|
nsresult
|
||||||
|
nsContextMenuInfo::GetFrameForBackgroundUpdate(nsIPresContext *aPresContext,
|
||||||
|
nsIFrame *aFrame,
|
||||||
|
nsIFrame **aBGFrame)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aFrame && aBGFrame, "illegal null parameter");
|
NS_ASSERTION(aFrame && aBGFrame, "illegal null parameter");
|
||||||
|
|
||||||
@ -348,13 +355,13 @@ nsresult nsContextMenuInfo::GetFrameForBackgroundUpdate(nsIPresContext *aPresCon
|
|||||||
nsIContent* pContent = aFrame->GetContent();
|
nsIContent* pContent = aFrame->GetContent();
|
||||||
if (pContent) {
|
if (pContent) {
|
||||||
// make sure that this is the HTML or BODY element
|
// make sure that this is the HTML or BODY element
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = pContent->Tag();
|
||||||
pContent->GetTag(getter_AddRefs(tag));
|
|
||||||
nsCOMPtr<nsIAtom> mTag_html = do_GetAtom("html");
|
nsCOMPtr<nsIAtom> tag_html = do_GetAtom("html");
|
||||||
nsCOMPtr<nsIAtom> mTag_body = do_GetAtom("body");
|
nsCOMPtr<nsIAtom> tag_body = do_GetAtom("body");
|
||||||
if (tag &&
|
if (tag &&
|
||||||
tag.get() == mTag_html ||
|
tag == tag_html ||
|
||||||
tag.get() == mTag_body) {
|
tag == tag_body) {
|
||||||
// the frame is the body frame, so we provide the canvas frame
|
// the frame is the body frame, so we provide the canvas frame
|
||||||
nsIFrame *pCanvasFrame = aFrame->GetParent();
|
nsIFrame *pCanvasFrame = aFrame->GetParent();
|
||||||
while (pCanvasFrame) {
|
while (pCanvasFrame) {
|
||||||
|
|||||||
@ -146,7 +146,8 @@ NS_INTERFACE_MAP_END
|
|||||||
// nsDocShellTreeOwner::nsIInterfaceRequestor
|
// nsDocShellTreeOwner::nsIInterfaceRequestor
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::GetInterface(const nsIID& aIID, void** aSink)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::GetInterface(const nsIID& aIID, void** aSink)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aSink);
|
NS_ENSURE_ARG_POINTER(aSink);
|
||||||
|
|
||||||
@ -190,8 +191,10 @@ NS_IMETHODIMP nsDocShellTreeOwner::GetInterface(const nsIID& aIID, void** aSink)
|
|||||||
// nsDocShellTreeOwner::nsIDocShellTreeOwner
|
// nsDocShellTreeOwner::nsIDocShellTreeOwner
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::FindItemWithName(const PRUnichar* aName,
|
NS_IMETHODIMP
|
||||||
nsIDocShellTreeItem* aRequestor, nsIDocShellTreeItem** aFoundItem)
|
nsDocShellTreeOwner::FindItemWithName(const PRUnichar* aName,
|
||||||
|
nsIDocShellTreeItem* aRequestor,
|
||||||
|
nsIDocShellTreeItem** aFoundItem)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG(aName);
|
NS_ENSURE_ARG(aName);
|
||||||
NS_ENSURE_ARG_POINTER(aFoundItem);
|
NS_ENSURE_ARG_POINTER(aFoundItem);
|
||||||
@ -253,9 +256,10 @@ NS_IMETHODIMP nsDocShellTreeOwner::FindItemWithName(const PRUnichar* aName,
|
|||||||
return NS_OK; // failed
|
return NS_OK; // failed
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsDocShellTreeOwner::FindChildWithName(const PRUnichar *aName,
|
nsresult
|
||||||
PRBool aRecurse, nsIDocShellTreeItem* aRequestor,
|
nsDocShellTreeOwner::FindChildWithName(const PRUnichar *aName, PRBool aRecurse,
|
||||||
nsIDocShellTreeItem **aFoundItem)
|
nsIDocShellTreeItem* aRequestor,
|
||||||
|
nsIDocShellTreeItem **aFoundItem)
|
||||||
{
|
{
|
||||||
if (!mWebBrowser)
|
if (!mWebBrowser)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -296,9 +300,9 @@ nsresult nsDocShellTreeOwner::FindChildWithName(const PRUnichar *aName,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsDocShellTreeOwner::FindItemWithNameAcrossWindows(
|
nsresult
|
||||||
const PRUnichar* aName,
|
nsDocShellTreeOwner::FindItemWithNameAcrossWindows(const PRUnichar* aName,
|
||||||
nsIDocShellTreeItem** aFoundItem)
|
nsIDocShellTreeItem** aFoundItem)
|
||||||
{
|
{
|
||||||
// search for the item across the list of top-level windows
|
// search for the item across the list of top-level windows
|
||||||
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
|
||||||
@ -339,7 +343,8 @@ nsresult nsDocShellTreeOwner::FindItemWithNameAcrossWindows(
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsDocShellTreeOwner::EnsurePrompter()
|
void
|
||||||
|
nsDocShellTreeOwner::EnsurePrompter()
|
||||||
{
|
{
|
||||||
if (mPrompter)
|
if (mPrompter)
|
||||||
return;
|
return;
|
||||||
@ -353,7 +358,8 @@ void nsDocShellTreeOwner::EnsurePrompter()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsDocShellTreeOwner::EnsureAuthPrompter()
|
void
|
||||||
|
nsDocShellTreeOwner::EnsureAuthPrompter()
|
||||||
{
|
{
|
||||||
if (mAuthPrompter)
|
if (mAuthPrompter)
|
||||||
return;
|
return;
|
||||||
@ -367,8 +373,9 @@ void nsDocShellTreeOwner::EnsureAuthPrompter()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsDocShellTreeOwner::AddToWatcher() {
|
void
|
||||||
|
nsDocShellTreeOwner::AddToWatcher()
|
||||||
|
{
|
||||||
if (mWebBrowser) {
|
if (mWebBrowser) {
|
||||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||||
mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
|
mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
|
||||||
@ -380,8 +387,9 @@ void nsDocShellTreeOwner::AddToWatcher() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsDocShellTreeOwner::RemoveFromWatcher() {
|
void
|
||||||
|
nsDocShellTreeOwner::RemoveFromWatcher()
|
||||||
|
{
|
||||||
if (mWebBrowser) {
|
if (mWebBrowser) {
|
||||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||||
mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
|
mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
|
||||||
@ -394,8 +402,9 @@ void nsDocShellTreeOwner::RemoveFromWatcher() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
|
NS_IMETHODIMP
|
||||||
PRBool aPrimary, const PRUnichar* aID)
|
nsDocShellTreeOwner::ContentShellAdded(nsIDocShellTreeItem* aContentShell,
|
||||||
|
PRBool aPrimary, const PRUnichar* aID)
|
||||||
{
|
{
|
||||||
if(mTreeOwner)
|
if(mTreeOwner)
|
||||||
return mTreeOwner->ContentShellAdded(aContentShell, aPrimary, aID);
|
return mTreeOwner->ContentShellAdded(aContentShell, aPrimary, aID);
|
||||||
@ -405,7 +414,8 @@ NS_IMETHODIMP nsDocShellTreeOwner::ContentShellAdded(nsIDocShellTreeItem* aConte
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::GetPrimaryContentShell(nsIDocShellTreeItem** aShell)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::GetPrimaryContentShell(nsIDocShellTreeItem** aShell)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aShell);
|
NS_ENSURE_ARG_POINTER(aShell);
|
||||||
|
|
||||||
@ -418,8 +428,9 @@ NS_IMETHODIMP nsDocShellTreeOwner::GetPrimaryContentShell(nsIDocShellTreeItem**
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem,
|
NS_IMETHODIMP
|
||||||
PRInt32 aCX, PRInt32 aCY)
|
nsDocShellTreeOwner::SizeShellTo(nsIDocShellTreeItem* aShellItem,
|
||||||
|
PRInt32 aCX, PRInt32 aCY)
|
||||||
{
|
{
|
||||||
NS_ENSURE_STATE(mTreeOwner || mWebBrowserChrome);
|
NS_ENSURE_STATE(mTreeOwner || mWebBrowserChrome);
|
||||||
|
|
||||||
@ -490,145 +501,165 @@ nsDocShellTreeOwner::GetPersistence(PRBool* aPersistPosition,
|
|||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::InitWindow(nativeWindow aParentNativeWindow,
|
NS_IMETHODIMP
|
||||||
nsIWidget* aParentWidget, PRInt32 aX, PRInt32 aY, PRInt32 aCX, PRInt32 aCY)
|
nsDocShellTreeOwner::InitWindow(nativeWindow aParentNativeWindow,
|
||||||
|
nsIWidget* aParentWidget, PRInt32 aX,
|
||||||
|
PRInt32 aY, PRInt32 aCX, PRInt32 aCY)
|
||||||
{
|
{
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::Create()
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::Create()
|
||||||
{
|
{
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::Destroy()
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::Destroy()
|
||||||
{
|
{
|
||||||
if (mOwnerWin)
|
if (mOwnerWin)
|
||||||
{
|
{
|
||||||
return mWebBrowserChrome->DestroyBrowserWindow();
|
return mWebBrowserChrome->DestroyBrowserWindow();
|
||||||
}
|
}
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::SetPosition(PRInt32 aX, PRInt32 aY)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::SetPosition(PRInt32 aX, PRInt32 aY)
|
||||||
{
|
{
|
||||||
if (mOwnerWin)
|
if (mOwnerWin)
|
||||||
{
|
{
|
||||||
return mOwnerWin->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
|
return mOwnerWin->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
|
||||||
aX, aY, 0, 0);
|
aX, aY, 0, 0);
|
||||||
}
|
}
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::GetPosition(PRInt32* aX, PRInt32* aY)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::GetPosition(PRInt32* aX, PRInt32* aY)
|
||||||
{
|
{
|
||||||
if (mOwnerWin)
|
if (mOwnerWin)
|
||||||
{
|
{
|
||||||
return mOwnerWin->GetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
|
return mOwnerWin->GetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
|
||||||
aX, aY, nsnull, nsnull);
|
aX, aY, nsnull, nsnull);
|
||||||
}
|
}
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::SetSize(PRInt32 aCX, PRInt32 aCY, PRBool aRepaint)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::SetSize(PRInt32 aCX, PRInt32 aCY, PRBool aRepaint)
|
||||||
{
|
{
|
||||||
if (mOwnerWin)
|
if (mOwnerWin)
|
||||||
{
|
{
|
||||||
return mOwnerWin->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER,
|
return mOwnerWin->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER,
|
||||||
0, 0, aCX, aCY);
|
0, 0, aCX, aCY);
|
||||||
}
|
}
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::GetSize(PRInt32* aCX, PRInt32* aCY)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::GetSize(PRInt32* aCX, PRInt32* aCY)
|
||||||
{
|
{
|
||||||
if (mOwnerWin)
|
if (mOwnerWin)
|
||||||
{
|
{
|
||||||
return mOwnerWin->GetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER,
|
return mOwnerWin->GetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER,
|
||||||
nsnull, nsnull, aCX, aCY);
|
nsnull, nsnull, aCX, aCY);
|
||||||
}
|
}
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::SetPositionAndSize(PRInt32 aX, PRInt32 aY,
|
NS_IMETHODIMP
|
||||||
PRInt32 aCX, PRInt32 aCY, PRBool aRepaint)
|
nsDocShellTreeOwner::SetPositionAndSize(PRInt32 aX, PRInt32 aY, PRInt32 aCX,
|
||||||
|
PRInt32 aCY, PRBool aRepaint)
|
||||||
{
|
{
|
||||||
if (mOwnerWin)
|
if (mOwnerWin)
|
||||||
{
|
{
|
||||||
return mOwnerWin->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER |
|
return mOwnerWin->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER |
|
||||||
nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
|
nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
|
||||||
aX, aY, aCX, aCY);
|
aX, aY, aCX, aCY);
|
||||||
}
|
}
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::GetPositionAndSize(PRInt32* aX, PRInt32* aY,
|
NS_IMETHODIMP
|
||||||
PRInt32* aCX, PRInt32* aCY)
|
nsDocShellTreeOwner::GetPositionAndSize(PRInt32* aX, PRInt32* aY, PRInt32* aCX,
|
||||||
|
PRInt32* aCY)
|
||||||
{
|
{
|
||||||
if (mOwnerWin)
|
if (mOwnerWin)
|
||||||
{
|
{
|
||||||
return mOwnerWin->GetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER |
|
return mOwnerWin->GetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER |
|
||||||
nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
|
nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION,
|
||||||
aX, aY, aCX, aCY);
|
aX, aY, aCX, aCY);
|
||||||
}
|
}
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::Repaint(PRBool aForce)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::Repaint(PRBool aForce)
|
||||||
{
|
{
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::GetParentWidget(nsIWidget** aParentWidget)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::GetParentWidget(nsIWidget** aParentWidget)
|
||||||
{
|
{
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::SetParentWidget(nsIWidget* aParentWidget)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::SetParentWidget(nsIWidget* aParentWidget)
|
||||||
{
|
{
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::GetParentNativeWindow(nativeWindow* aParentNativeWindow)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::GetParentNativeWindow(nativeWindow* aParentNativeWindow)
|
||||||
{
|
{
|
||||||
if (mOwnerWin)
|
if (mOwnerWin)
|
||||||
{
|
{
|
||||||
return mOwnerWin->GetSiteWindow(aParentNativeWindow);
|
return mOwnerWin->GetSiteWindow(aParentNativeWindow);
|
||||||
}
|
}
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::SetParentNativeWindow(nativeWindow aParentNativeWindow)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::SetParentNativeWindow(nativeWindow aParentNativeWindow)
|
||||||
{
|
{
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::GetVisibility(PRBool* aVisibility)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::GetVisibility(PRBool* aVisibility)
|
||||||
{
|
{
|
||||||
if (mOwnerWin)
|
if (mOwnerWin)
|
||||||
{
|
{
|
||||||
return mOwnerWin->GetVisibility(aVisibility);
|
return mOwnerWin->GetVisibility(aVisibility);
|
||||||
}
|
}
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::SetVisibility(PRBool aVisibility)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::SetVisibility(PRBool aVisibility)
|
||||||
{
|
{
|
||||||
if (mOwnerWin)
|
if (mOwnerWin)
|
||||||
{
|
{
|
||||||
return mOwnerWin->SetVisibility(aVisibility);
|
return mOwnerWin->SetVisibility(aVisibility);
|
||||||
}
|
}
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::GetEnabled(PRBool *aEnabled)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::GetEnabled(PRBool *aEnabled)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aEnabled);
|
NS_ENSURE_ARG_POINTER(aEnabled);
|
||||||
*aEnabled = PR_TRUE;
|
*aEnabled = PR_TRUE;
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::SetEnabled(PRBool aEnabled)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::SetEnabled(PRBool aEnabled)
|
||||||
{
|
{
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
@ -647,12 +678,14 @@ nsDocShellTreeOwner::SetBlurSuppression(PRBool aBlurSuppression)
|
|||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::GetMainWidget(nsIWidget** aMainWidget)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::GetMainWidget(nsIWidget** aMainWidget)
|
||||||
{
|
{
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::SetFocus()
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::SetFocus()
|
||||||
{
|
{
|
||||||
if (mOwnerWin)
|
if (mOwnerWin)
|
||||||
{
|
{
|
||||||
@ -661,7 +694,8 @@ NS_IMETHODIMP nsDocShellTreeOwner::SetFocus()
|
|||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::GetTitle(PRUnichar** aTitle)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::GetTitle(PRUnichar** aTitle)
|
||||||
{
|
{
|
||||||
if (mOwnerWin)
|
if (mOwnerWin)
|
||||||
{
|
{
|
||||||
@ -670,7 +704,8 @@ NS_IMETHODIMP nsDocShellTreeOwner::GetTitle(PRUnichar** aTitle)
|
|||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::SetTitle(const PRUnichar* aTitle)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::SetTitle(const PRUnichar* aTitle)
|
||||||
{
|
{
|
||||||
if (mOwnerWin)
|
if (mOwnerWin)
|
||||||
{
|
{
|
||||||
@ -708,9 +743,10 @@ nsDocShellTreeOwner::OnStateChange(nsIWebProgress* aProgress,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::OnLocationChange(nsIWebProgress* aWebProgress,
|
NS_IMETHODIMP
|
||||||
nsIRequest* aRequest,
|
nsDocShellTreeOwner::OnLocationChange(nsIWebProgress* aWebProgress,
|
||||||
nsIURI* aURI)
|
nsIRequest* aRequest,
|
||||||
|
nsIURI* aURI)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
@ -741,7 +777,8 @@ nsDocShellTreeOwner::OnSecurityChange(nsIWebProgress *aWebProgress,
|
|||||||
// nsDocShellTreeOwner: Accessors
|
// nsDocShellTreeOwner: Accessors
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
void nsDocShellTreeOwner::WebBrowser(nsWebBrowser* aWebBrowser)
|
void
|
||||||
|
nsDocShellTreeOwner::WebBrowser(nsWebBrowser* aWebBrowser)
|
||||||
{
|
{
|
||||||
if ( !aWebBrowser )
|
if ( !aWebBrowser )
|
||||||
RemoveChromeListeners();
|
RemoveChromeListeners();
|
||||||
@ -753,47 +790,48 @@ void nsDocShellTreeOwner::WebBrowser(nsWebBrowser* aWebBrowser)
|
|||||||
mWebBrowser = aWebBrowser;
|
mWebBrowser = aWebBrowser;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsWebBrowser* nsDocShellTreeOwner::WebBrowser()
|
nsWebBrowser *
|
||||||
|
nsDocShellTreeOwner::WebBrowser()
|
||||||
{
|
{
|
||||||
return mWebBrowser;
|
return mWebBrowser;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::SetTreeOwner(nsIDocShellTreeOwner* aTreeOwner)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::SetTreeOwner(nsIDocShellTreeOwner* aTreeOwner)
|
||||||
{
|
{
|
||||||
if(aTreeOwner) {
|
if(aTreeOwner) {
|
||||||
nsCOMPtr<nsIWebBrowserChrome> webBrowserChrome(do_GetInterface(aTreeOwner));
|
nsCOMPtr<nsIWebBrowserChrome> webBrowserChrome(do_GetInterface(aTreeOwner));
|
||||||
NS_ENSURE_TRUE(webBrowserChrome, NS_ERROR_INVALID_ARG);
|
NS_ENSURE_TRUE(webBrowserChrome, NS_ERROR_INVALID_ARG);
|
||||||
NS_ENSURE_SUCCESS(SetWebBrowserChrome(webBrowserChrome), NS_ERROR_INVALID_ARG);
|
NS_ENSURE_SUCCESS(SetWebBrowserChrome(webBrowserChrome), NS_ERROR_INVALID_ARG);
|
||||||
mTreeOwner = aTreeOwner;
|
mTreeOwner = aTreeOwner;
|
||||||
}
|
}
|
||||||
else if(mWebBrowserChrome)
|
else if(mWebBrowserChrome)
|
||||||
mTreeOwner = nsnull;
|
mTreeOwner = nsnull;
|
||||||
else {
|
else {
|
||||||
mTreeOwner = nsnull;
|
mTreeOwner = nsnull;
|
||||||
NS_ENSURE_SUCCESS(SetWebBrowserChrome(nsnull), NS_ERROR_FAILURE);
|
NS_ENSURE_SUCCESS(SetWebBrowserChrome(nsnull), NS_ERROR_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP nsDocShellTreeOwner::SetWebBrowserChrome(nsIWebBrowserChrome* aWebBrowserChrome)
|
NS_IMETHODIMP
|
||||||
|
nsDocShellTreeOwner::SetWebBrowserChrome(nsIWebBrowserChrome* aWebBrowserChrome)
|
||||||
{
|
{
|
||||||
if(!aWebBrowserChrome) {
|
if(!aWebBrowserChrome) {
|
||||||
mWebBrowserChrome = nsnull;
|
mWebBrowserChrome = nsnull;
|
||||||
mOwnerWin = nsnull;
|
mOwnerWin = nsnull;
|
||||||
mOwnerRequestor = nsnull;
|
mOwnerRequestor = nsnull;
|
||||||
}
|
} else {
|
||||||
else
|
nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin(do_QueryInterface(aWebBrowserChrome));
|
||||||
{
|
nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryInterface(aWebBrowserChrome));
|
||||||
nsCOMPtr<nsIEmbeddingSiteWindow> ownerWin(do_QueryInterface(aWebBrowserChrome));
|
|
||||||
nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryInterface(aWebBrowserChrome));
|
|
||||||
|
|
||||||
// it's ok for ownerWin or requestor to be null.
|
// it's ok for ownerWin or requestor to be null.
|
||||||
mWebBrowserChrome = aWebBrowserChrome;
|
mWebBrowserChrome = aWebBrowserChrome;
|
||||||
mOwnerWin = ownerWin;
|
mOwnerWin = ownerWin;
|
||||||
mOwnerRequestor = requestor;
|
mOwnerRequestor = requestor;
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -804,7 +842,7 @@ NS_IMETHODIMP nsDocShellTreeOwner::SetWebBrowserChrome(nsIWebBrowserChrome* aWeb
|
|||||||
// has implemented the right interfaces.
|
// has implemented the right interfaces.
|
||||||
//
|
//
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocShellTreeOwner :: AddChromeListeners ( )
|
nsDocShellTreeOwner::AddChromeListeners()
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
@ -855,7 +893,7 @@ nsDocShellTreeOwner :: AddChromeListeners ( )
|
|||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocShellTreeOwner :: RemoveChromeListeners ( )
|
nsDocShellTreeOwner::RemoveChromeListeners()
|
||||||
{
|
{
|
||||||
if ( mChromeTooltipListener ) {
|
if ( mChromeTooltipListener ) {
|
||||||
mChromeTooltipListener->RemoveChromeListeners();
|
mChromeTooltipListener->RemoveChromeListeners();
|
||||||
@ -905,7 +943,9 @@ DefaultTooltipTextProvider::DefaultTooltipTextProvider()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* void getNodeText (in nsIDOMNode aNode, out wstring aText); */
|
/* void getNodeText (in nsIDOMNode aNode, out wstring aText); */
|
||||||
NS_IMETHODIMP DefaultTooltipTextProvider::GetNodeText(nsIDOMNode *aNode, PRUnichar **aText, PRBool *_retval)
|
NS_IMETHODIMP
|
||||||
|
DefaultTooltipTextProvider::GetNodeText(nsIDOMNode *aNode, PRUnichar **aText,
|
||||||
|
PRBool *_retval)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aNode);
|
NS_ENSURE_ARG_POINTER(aNode);
|
||||||
NS_ENSURE_ARG_POINTER(aText);
|
NS_ENSURE_ARG_POINTER(aText);
|
||||||
@ -919,8 +959,7 @@ NS_IMETHODIMP DefaultTooltipTextProvider::GetNodeText(nsIDOMNode *aNode, PRUnich
|
|||||||
if ( currElement ) {
|
if ( currElement ) {
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(currElement));
|
nsCOMPtr<nsIContent> content(do_QueryInterface(currElement));
|
||||||
if (content) {
|
if (content) {
|
||||||
nsCOMPtr<nsIAtom> tagAtom;
|
nsIAtom *tagAtom = content->Tag();
|
||||||
content->GetTag(getter_AddRefs(tagAtom));
|
|
||||||
if (tagAtom != mTag_dialog &&
|
if (tagAtom != mTag_dialog &&
|
||||||
tagAtom != mTag_dialogheader &&
|
tagAtom != mTag_dialogheader &&
|
||||||
tagAtom != mTag_window) {
|
tagAtom != mTag_window) {
|
||||||
@ -969,7 +1008,8 @@ NS_INTERFACE_MAP_END
|
|||||||
// ChromeTooltipListener ctor
|
// ChromeTooltipListener ctor
|
||||||
//
|
//
|
||||||
|
|
||||||
ChromeTooltipListener :: ChromeTooltipListener ( nsWebBrowser* inBrowser, nsIWebBrowserChrome* inChrome )
|
ChromeTooltipListener::ChromeTooltipListener(nsWebBrowser* inBrowser,
|
||||||
|
nsIWebBrowserChrome* inChrome)
|
||||||
: mWebBrowser(inBrowser), mWebBrowserChrome(inChrome),
|
: mWebBrowser(inBrowser), mWebBrowserChrome(inChrome),
|
||||||
mTooltipListenerInstalled(PR_FALSE),
|
mTooltipListenerInstalled(PR_FALSE),
|
||||||
mMouseClientX(0), mMouseClientY(0),
|
mMouseClientX(0), mMouseClientY(0),
|
||||||
@ -986,7 +1026,7 @@ ChromeTooltipListener :: ChromeTooltipListener ( nsWebBrowser* inBrowser, nsIWeb
|
|||||||
//
|
//
|
||||||
// ChromeTooltipListener dtor
|
// ChromeTooltipListener dtor
|
||||||
//
|
//
|
||||||
ChromeTooltipListener :: ~ChromeTooltipListener ( )
|
ChromeTooltipListener::~ChromeTooltipListener()
|
||||||
{
|
{
|
||||||
|
|
||||||
} // dtor
|
} // dtor
|
||||||
@ -999,7 +1039,7 @@ ChromeTooltipListener :: ~ChromeTooltipListener ( )
|
|||||||
// has implemented the right interfaces.
|
// has implemented the right interfaces.
|
||||||
//
|
//
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ChromeTooltipListener :: AddChromeListeners ( )
|
ChromeTooltipListener::AddChromeListeners()
|
||||||
{
|
{
|
||||||
if ( !mEventReceiver )
|
if ( !mEventReceiver )
|
||||||
GetEventReceiver(mWebBrowser, getter_AddRefs(mEventReceiver));
|
GetEventReceiver(mWebBrowser, getter_AddRefs(mEventReceiver));
|
||||||
@ -1027,7 +1067,7 @@ ChromeTooltipListener :: AddChromeListeners ( )
|
|||||||
// of how many succeed so we can clean up correctly in Release().
|
// of how many succeed so we can clean up correctly in Release().
|
||||||
//
|
//
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ChromeTooltipListener :: AddTooltipListener()
|
ChromeTooltipListener::AddTooltipListener()
|
||||||
{
|
{
|
||||||
if (mEventReceiver) {
|
if (mEventReceiver) {
|
||||||
nsIDOMMouseListener *pListener = NS_STATIC_CAST(nsIDOMMouseListener *, this);
|
nsIDOMMouseListener *pListener = NS_STATIC_CAST(nsIDOMMouseListener *, this);
|
||||||
@ -1050,7 +1090,7 @@ ChromeTooltipListener :: AddTooltipListener()
|
|||||||
// Unsubscribe from the various things we've hooked up to the window root.
|
// Unsubscribe from the various things we've hooked up to the window root.
|
||||||
//
|
//
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ChromeTooltipListener :: RemoveChromeListeners ( )
|
ChromeTooltipListener::RemoveChromeListeners ( )
|
||||||
{
|
{
|
||||||
HideTooltip();
|
HideTooltip();
|
||||||
|
|
||||||
@ -1072,7 +1112,7 @@ ChromeTooltipListener :: RemoveChromeListeners ( )
|
|||||||
// Unsubscribe from all the various tooltip events that we were listening to
|
// Unsubscribe from all the various tooltip events that we were listening to
|
||||||
//
|
//
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ChromeTooltipListener :: RemoveTooltipListener()
|
ChromeTooltipListener::RemoveTooltipListener()
|
||||||
{
|
{
|
||||||
if (mEventReceiver) {
|
if (mEventReceiver) {
|
||||||
nsIDOMMouseListener *pListener = NS_STATIC_CAST(nsIDOMMouseListener *, this);
|
nsIDOMMouseListener *pListener = NS_STATIC_CAST(nsIDOMMouseListener *, this);
|
||||||
@ -1097,7 +1137,6 @@ nsresult
|
|||||||
ChromeTooltipListener::KeyDown(nsIDOMEvent* aMouseEvent)
|
ChromeTooltipListener::KeyDown(nsIDOMEvent* aMouseEvent)
|
||||||
{
|
{
|
||||||
return HideTooltip();
|
return HideTooltip();
|
||||||
|
|
||||||
} // KeyDown
|
} // KeyDown
|
||||||
|
|
||||||
|
|
||||||
@ -1232,7 +1271,8 @@ ChromeTooltipListener::MouseMove(nsIDOMEvent* aMouseEvent)
|
|||||||
// Tell the registered chrome that they should show the tooltip
|
// Tell the registered chrome that they should show the tooltip
|
||||||
//
|
//
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ChromeTooltipListener :: ShowTooltip ( PRInt32 inXCoords, PRInt32 inYCoords, const nsAString & inTipText )
|
ChromeTooltipListener::ShowTooltip(PRInt32 inXCoords, PRInt32 inYCoords,
|
||||||
|
const nsAString & inTipText)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
@ -1256,7 +1296,7 @@ ChromeTooltipListener :: ShowTooltip ( PRInt32 inXCoords, PRInt32 inYCoords, con
|
|||||||
// NOTE: This routine is safe to call even if the popup is already closed.
|
// NOTE: This routine is safe to call even if the popup is already closed.
|
||||||
//
|
//
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ChromeTooltipListener :: HideTooltip ( )
|
ChromeTooltipListener::HideTooltip()
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
@ -1300,7 +1340,8 @@ ChromeTooltipListener :: HideTooltip ( )
|
|||||||
// -- the dom node the user hovered over (mPossibleTooltipNode)
|
// -- the dom node the user hovered over (mPossibleTooltipNode)
|
||||||
//
|
//
|
||||||
void
|
void
|
||||||
ChromeTooltipListener :: sTooltipCallback (nsITimer *aTimer, void *aChromeTooltipListener)
|
ChromeTooltipListener::sTooltipCallback(nsITimer *aTimer,
|
||||||
|
void *aChromeTooltipListener)
|
||||||
{
|
{
|
||||||
ChromeTooltipListener* self = NS_STATIC_CAST(ChromeTooltipListener*, aChromeTooltipListener);
|
ChromeTooltipListener* self = NS_STATIC_CAST(ChromeTooltipListener*, aChromeTooltipListener);
|
||||||
if ( self && self->mPossibleTooltipNode ) {
|
if ( self && self->mPossibleTooltipNode ) {
|
||||||
@ -1335,7 +1376,7 @@ ChromeTooltipListener :: sTooltipCallback (nsITimer *aTimer, void *aChromeToolti
|
|||||||
// Create a new timer to see if we should auto-hide. It's ok if this fails.
|
// Create a new timer to see if we should auto-hide. It's ok if this fails.
|
||||||
//
|
//
|
||||||
void
|
void
|
||||||
ChromeTooltipListener :: CreateAutoHideTimer ( )
|
ChromeTooltipListener::CreateAutoHideTimer()
|
||||||
{
|
{
|
||||||
// just to be anal (er, safe)
|
// just to be anal (er, safe)
|
||||||
if ( mAutoHideTimer ) {
|
if ( mAutoHideTimer ) {
|
||||||
@ -1359,7 +1400,7 @@ ChromeTooltipListener :: CreateAutoHideTimer ( )
|
|||||||
// be called multiple times, even if the tip has already been closed.
|
// be called multiple times, even if the tip has already been closed.
|
||||||
//
|
//
|
||||||
void
|
void
|
||||||
ChromeTooltipListener :: sAutoHideCallback ( nsITimer *aTimer, void* aListener )
|
ChromeTooltipListener::sAutoHideCallback(nsITimer *aTimer, void* aListener)
|
||||||
{
|
{
|
||||||
ChromeTooltipListener* self = NS_STATIC_CAST(ChromeTooltipListener*, aListener);
|
ChromeTooltipListener* self = NS_STATIC_CAST(ChromeTooltipListener*, aListener);
|
||||||
if ( self )
|
if ( self )
|
||||||
@ -1389,7 +1430,7 @@ NS_INTERFACE_MAP_END
|
|||||||
//
|
//
|
||||||
// ChromeTooltipListener ctor
|
// ChromeTooltipListener ctor
|
||||||
//
|
//
|
||||||
ChromeContextMenuListener :: ChromeContextMenuListener ( nsWebBrowser* inBrowser, nsIWebBrowserChrome* inChrome )
|
ChromeContextMenuListener::ChromeContextMenuListener(nsWebBrowser* inBrowser, nsIWebBrowserChrome* inChrome )
|
||||||
: mContextMenuListenerInstalled(PR_FALSE),
|
: mContextMenuListenerInstalled(PR_FALSE),
|
||||||
mWebBrowser(inBrowser),
|
mWebBrowser(inBrowser),
|
||||||
mWebBrowserChrome(inChrome)
|
mWebBrowserChrome(inChrome)
|
||||||
@ -1400,9 +1441,8 @@ ChromeContextMenuListener :: ChromeContextMenuListener ( nsWebBrowser* inBrowser
|
|||||||
//
|
//
|
||||||
// ChromeTooltipListener dtor
|
// ChromeTooltipListener dtor
|
||||||
//
|
//
|
||||||
ChromeContextMenuListener :: ~ChromeContextMenuListener ( )
|
ChromeContextMenuListener::~ChromeContextMenuListener()
|
||||||
{
|
{
|
||||||
|
|
||||||
} // dtor
|
} // dtor
|
||||||
|
|
||||||
|
|
||||||
@ -1413,7 +1453,7 @@ ChromeContextMenuListener :: ~ChromeContextMenuListener ( )
|
|||||||
// is just the context-menu DOM event.
|
// is just the context-menu DOM event.
|
||||||
//
|
//
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ChromeContextMenuListener :: AddContextMenuListener()
|
ChromeContextMenuListener::AddContextMenuListener()
|
||||||
{
|
{
|
||||||
if (mEventReceiver) {
|
if (mEventReceiver) {
|
||||||
nsIDOMContextMenuListener *pListener = NS_STATIC_CAST(nsIDOMContextMenuListener *, this);
|
nsIDOMContextMenuListener *pListener = NS_STATIC_CAST(nsIDOMContextMenuListener *, this);
|
||||||
@ -1432,7 +1472,7 @@ ChromeContextMenuListener :: AddContextMenuListener()
|
|||||||
// Unsubscribe from all the various context menu events that we were listening to.
|
// Unsubscribe from all the various context menu events that we were listening to.
|
||||||
//
|
//
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ChromeContextMenuListener :: RemoveContextMenuListener()
|
ChromeContextMenuListener::RemoveContextMenuListener()
|
||||||
{
|
{
|
||||||
if (mEventReceiver) {
|
if (mEventReceiver) {
|
||||||
nsIDOMContextMenuListener *pListener = NS_STATIC_CAST(nsIDOMContextMenuListener *, this);
|
nsIDOMContextMenuListener *pListener = NS_STATIC_CAST(nsIDOMContextMenuListener *, this);
|
||||||
@ -1452,7 +1492,7 @@ ChromeContextMenuListener :: RemoveContextMenuListener()
|
|||||||
// has implemented the right interfaces.
|
// has implemented the right interfaces.
|
||||||
//
|
//
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ChromeContextMenuListener :: AddChromeListeners ( )
|
ChromeContextMenuListener::AddChromeListeners()
|
||||||
{
|
{
|
||||||
if ( !mEventReceiver )
|
if ( !mEventReceiver )
|
||||||
GetEventReceiver(mWebBrowser, getter_AddRefs(mEventReceiver));
|
GetEventReceiver(mWebBrowser, getter_AddRefs(mEventReceiver));
|
||||||
@ -1477,7 +1517,7 @@ ChromeContextMenuListener :: AddChromeListeners ( )
|
|||||||
// Unsubscribe from the various things we've hooked up to the window root.
|
// Unsubscribe from the various things we've hooked up to the window root.
|
||||||
//
|
//
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ChromeContextMenuListener :: RemoveChromeListeners ( )
|
ChromeContextMenuListener::RemoveChromeListeners()
|
||||||
{
|
{
|
||||||
if ( mContextMenuListenerInstalled )
|
if ( mContextMenuListenerInstalled )
|
||||||
RemoveContextMenuListener();
|
RemoveContextMenuListener();
|
||||||
@ -1499,7 +1539,7 @@ ChromeContextMenuListener :: RemoveChromeListeners ( )
|
|||||||
// end chrome.
|
// end chrome.
|
||||||
//
|
//
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
ChromeContextMenuListener :: ContextMenu ( nsIDOMEvent* aMouseEvent )
|
ChromeContextMenuListener::ContextMenu(nsIDOMEvent* aMouseEvent)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMEventTarget> targetNode;
|
nsCOMPtr<nsIDOMEventTarget> targetNode;
|
||||||
nsresult res = aMouseEvent->GetTarget(getter_AddRefs(targetNode));
|
nsresult res = aMouseEvent->GetTarget(getter_AddRefs(targetNode));
|
||||||
@ -1532,24 +1572,23 @@ ChromeContextMenuListener :: ContextMenu ( nsIDOMEvent* aMouseEvent )
|
|||||||
|
|
||||||
PRUint32 flags = nsIContextMenuListener::CONTEXT_NONE;
|
PRUint32 flags = nsIContextMenuListener::CONTEXT_NONE;
|
||||||
PRUint32 flags2 = nsIContextMenuListener2::CONTEXT_NONE;
|
PRUint32 flags2 = nsIContextMenuListener2::CONTEXT_NONE;
|
||||||
nsCOMPtr<nsIDOMHTMLElement> element;
|
nsCOMPtr<nsIContent> content;
|
||||||
do {
|
do {
|
||||||
// XXX test for selected text
|
// XXX test for selected text
|
||||||
element = do_QueryInterface(node);
|
content = do_QueryInterface(node);
|
||||||
if (element)
|
if (content && content->IsContentOfType(nsIContent::eHTML)) {
|
||||||
{
|
const char *tagStr;
|
||||||
nsAutoString tag;
|
content->Tag()->GetUTF8String(&tagStr);
|
||||||
element->GetTagName(tag);
|
|
||||||
|
|
||||||
// Test what kind of element we're dealing with here
|
// Test what kind of element we're dealing with here
|
||||||
if (tag.Equals(NS_LITERAL_STRING("img"), nsCaseInsensitiveStringComparator()))
|
if (strcmp(tagStr, "img") == 0)
|
||||||
{
|
{
|
||||||
flags |= nsIContextMenuListener::CONTEXT_IMAGE;
|
flags |= nsIContextMenuListener::CONTEXT_IMAGE;
|
||||||
flags2 |= nsIContextMenuListener2::CONTEXT_IMAGE;
|
flags2 |= nsIContextMenuListener2::CONTEXT_IMAGE;
|
||||||
targetDOMnode = node;
|
targetDOMnode = node;
|
||||||
// if we see an image, keep searching for a possible anchor
|
// if we see an image, keep searching for a possible anchor
|
||||||
}
|
}
|
||||||
else if (tag.Equals(NS_LITERAL_STRING("input"), nsCaseInsensitiveStringComparator()))
|
else if (strcmp(tagStr, "input") == 0)
|
||||||
{
|
{
|
||||||
// INPUT element - button, combo, checkbox, text etc.
|
// INPUT element - button, combo, checkbox, text etc.
|
||||||
flags |= nsIContextMenuListener::CONTEXT_INPUT;
|
flags |= nsIContextMenuListener::CONTEXT_INPUT;
|
||||||
@ -1568,7 +1607,7 @@ ChromeContextMenuListener :: ContextMenu ( nsIDOMEvent* aMouseEvent )
|
|||||||
}
|
}
|
||||||
break; // exit do-while
|
break; // exit do-while
|
||||||
}
|
}
|
||||||
else if (tag.Equals(NS_LITERAL_STRING("textarea"), nsCaseInsensitiveStringComparator()))
|
else if (strcmp(tagStr, "textarea") == 0)
|
||||||
{
|
{
|
||||||
// text area
|
// text area
|
||||||
flags |= nsIContextMenuListener::CONTEXT_TEXT;
|
flags |= nsIContextMenuListener::CONTEXT_TEXT;
|
||||||
@ -1576,7 +1615,7 @@ ChromeContextMenuListener :: ContextMenu ( nsIDOMEvent* aMouseEvent )
|
|||||||
targetDOMnode = node;
|
targetDOMnode = node;
|
||||||
break; // exit do-while
|
break; // exit do-while
|
||||||
}
|
}
|
||||||
else if (tag.Equals(NS_LITERAL_STRING("html"), nsCaseInsensitiveStringComparator()))
|
else if (strcmp(tagStr, "html") == 0)
|
||||||
{
|
{
|
||||||
if (!flags && !flags2) {
|
if (!flags && !flags2) {
|
||||||
// only care about this if no other context was found.
|
// only care about this if no other context was found.
|
||||||
@ -1593,30 +1632,28 @@ ChromeContextMenuListener :: ContextMenu ( nsIDOMEvent* aMouseEvent )
|
|||||||
}
|
}
|
||||||
break; // exit do-while
|
break; // exit do-while
|
||||||
}
|
}
|
||||||
else if ( tag.EqualsWithConversion("object", PR_TRUE) || /* XXX what about images and documents? */
|
else if (strcmp(tagStr, "object") == 0 || /* XXX what about images and documents? */
|
||||||
tag.EqualsWithConversion("embed", PR_TRUE) ||
|
strcmp(tagStr, "embed") == 0 ||
|
||||||
tag.EqualsWithConversion("applet", PR_TRUE) )
|
strcmp(tagStr, "applet") == 0)
|
||||||
{ // always consume events for plugins and Java
|
{ // always consume events for plugins and Java
|
||||||
return NS_OK; // who may throw their own context menus
|
return NS_OK; // who may throw their own context menus
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test if the element has an associated link
|
// Test if the element has an associated link
|
||||||
nsCOMPtr<nsIDOMNamedNodeMap> attributes;
|
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(node));
|
||||||
node->GetAttributes(getter_AddRefs(attributes));
|
|
||||||
if (attributes)
|
PRBool hasAttr = PR_FALSE;
|
||||||
|
res = element->HasAttribute(NS_LITERAL_STRING("href"), &hasAttr);
|
||||||
|
|
||||||
|
if (NS_SUCCEEDED(res) && hasAttr)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIDOMNode> hrefNode;
|
flags |= nsIContextMenuListener::CONTEXT_LINK;
|
||||||
attributes->GetNamedItem(NS_LITERAL_STRING("href"), getter_AddRefs(hrefNode));
|
flags2 |= nsIContextMenuListener2::CONTEXT_LINK;
|
||||||
if (hrefNode)
|
if (!targetDOMnode)
|
||||||
{
|
targetDOMnode = node;
|
||||||
flags |= nsIContextMenuListener::CONTEXT_LINK;
|
if (menuInfoImpl)
|
||||||
flags2 |= nsIContextMenuListener2::CONTEXT_LINK;
|
menuInfoImpl->SetAssociatedLink(node);
|
||||||
if (!targetDOMnode)
|
break; // exit do-while
|
||||||
targetDOMnode = node;
|
|
||||||
if (menuInfoImpl)
|
|
||||||
menuInfoImpl->SetAssociatedLink(node);
|
|
||||||
break; // exit do-while
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1662,5 +1699,3 @@ ChromeContextMenuListener :: ContextMenu ( nsIDOMEvent* aMouseEvent )
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
} // MouseDown
|
} // MouseDown
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -431,17 +431,22 @@ nsFind::NextNode(nsIDOMRange* aSearchRange,
|
|||||||
|
|
||||||
PRBool nsFind::IsBlockNode(nsIContent* aContent)
|
PRBool nsFind::IsBlockNode(nsIContent* aContent)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> atom;
|
if (!aContent->IsContentOfType(nsIContent::eHTML)) {
|
||||||
aContent->GetTag(getter_AddRefs(atom));
|
return PR_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (atom.get() == sImgAtom || atom.get() == sHRAtom
|
nsIAtom *atom = aContent->Tag();
|
||||||
|| atom.get() == sThAtom || atom.get() == sTdAtom)
|
|
||||||
|
if (atom == sImgAtom ||
|
||||||
|
atom == sHRAtom ||
|
||||||
|
atom == sThAtom ||
|
||||||
|
atom == sTdAtom)
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
|
|
||||||
if (!mParserService) {
|
if (!mParserService) {
|
||||||
nsresult rv;
|
mParserService = do_GetService(kParserServiceCID);
|
||||||
mParserService = do_GetService(kParserServiceCID, &rv);
|
if (!mParserService)
|
||||||
if (NS_FAILED(rv) || !mParserService) return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRInt32 id;
|
PRInt32 id;
|
||||||
@ -457,12 +462,8 @@ PRBool nsFind::IsTextNode(nsIDOMNode* aNode)
|
|||||||
// Can't just QI for nsITextContent, because nsCommentNode
|
// Can't just QI for nsITextContent, because nsCommentNode
|
||||||
// also implements that interface.
|
// also implements that interface.
|
||||||
nsCOMPtr<nsIContent> content (do_QueryInterface(aNode));
|
nsCOMPtr<nsIContent> content (do_QueryInterface(aNode));
|
||||||
if (!content) return PR_FALSE;
|
|
||||||
nsCOMPtr<nsIAtom> atom;
|
return content && content->Tag() == sTextAtom;
|
||||||
content->GetTag(getter_AddRefs(atom));
|
|
||||||
if (atom.get() == sTextAtom)
|
|
||||||
return PR_TRUE;
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool nsFind::IsVisibleNode(nsIDOMNode *aDOMNode)
|
PRBool nsFind::IsVisibleNode(nsIDOMNode *aDOMNode)
|
||||||
@ -491,19 +492,20 @@ PRBool nsFind::IsVisibleNode(nsIDOMNode *aDOMNode)
|
|||||||
|
|
||||||
PRBool nsFind::SkipNode(nsIContent* aContent)
|
PRBool nsFind::SkipNode(nsIContent* aContent)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> atom;
|
nsIAtom *atom;
|
||||||
|
|
||||||
#ifdef HAVE_BIDI_ITERATOR
|
#ifdef HAVE_BIDI_ITERATOR
|
||||||
aContent->GetTag(getter_AddRefs(atom));
|
atom = aContent->Tag();
|
||||||
if (!atom)
|
|
||||||
return PR_TRUE;
|
|
||||||
nsIAtom *atomPtr = atom.get();
|
|
||||||
|
|
||||||
// We may not need to skip comment nodes,
|
// We may not need to skip comment nodes,
|
||||||
// now that IsTextNode distinguishes them from real text nodes.
|
// now that IsTextNode distinguishes them from real text nodes.
|
||||||
return (sScriptAtom == atomPtr || sCommentAtom == atomPtr
|
return (atom == sCommentAtom ||
|
||||||
|| sNoframesAtom == atomPtr
|
(aContent->IsContentOfType(nsIContent::eHTML) &&
|
||||||
|| sSelectAtom == atomPtr || sTextareaAtom == atomPtr)
|
(atom == sScriptAtom ||
|
||||||
|
atom == sCommentAtom ||
|
||||||
|
atom == sNoframesAtom ||
|
||||||
|
atom == sSelectAtom ||
|
||||||
|
atom == sTextareaAtom)));
|
||||||
|
|
||||||
#else /* HAVE_BIDI_ITERATOR */
|
#else /* HAVE_BIDI_ITERATOR */
|
||||||
// Temporary: eventually we will have an iterator to do this,
|
// Temporary: eventually we will have an iterator to do this,
|
||||||
@ -511,39 +513,33 @@ PRBool nsFind::SkipNode(nsIContent* aContent)
|
|||||||
// and see whether any parent is a skipped node,
|
// and see whether any parent is a skipped node,
|
||||||
// and take the performance hit.
|
// and take the performance hit.
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> node (do_QueryInterface(aContent));
|
nsIContent *content = aContent;
|
||||||
while (node)
|
while (content)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIContent> content (do_QueryInterface(node));
|
atom = content->Tag();
|
||||||
if (!content) return PR_FALSE;
|
|
||||||
content->GetTag(getter_AddRefs(atom));
|
if (atom == sCommentAtom ||
|
||||||
if (!atom)
|
(content->IsContentOfType(nsIContent::eHTML) &&
|
||||||
return PR_FALSE;
|
(atom == sScriptAtom ||
|
||||||
nsAutoString atomName;
|
atom == sNoframesAtom ||
|
||||||
atom->ToString(atomName);
|
atom == sSelectAtom ||
|
||||||
//printf("Atom name is %s\n",
|
atom == sTextareaAtom)))
|
||||||
// NS_LossyConvertUCS2toASCII(atomName).get());
|
|
||||||
nsIAtom *atomPtr = atom.get();
|
|
||||||
if (atomPtr == sScriptAtom || atomPtr == sCommentAtom
|
|
||||||
|| sNoframesAtom == atomPtr
|
|
||||||
|| sSelectAtom == atomPtr || sTextareaAtom == atomPtr)
|
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_FIND
|
#ifdef DEBUG_FIND
|
||||||
printf("Skipping node: ");
|
printf("Skipping node: ");
|
||||||
DumpNode(node);
|
DumpNode(node);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only climb to the nearest block node
|
// Only climb to the nearest block node
|
||||||
if (IsBlockNode(content))
|
if (IsBlockNode(content))
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMNode> parent;
|
content = content->GetParent();
|
||||||
nsresult rv = node->GetParentNode(getter_AddRefs(parent));
|
|
||||||
if (NS_FAILED(rv)) return PR_FALSE;
|
|
||||||
|
|
||||||
node = parent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
#endif /* HAVE_BIDI_ITERATOR */
|
#endif /* HAVE_BIDI_ITERATOR */
|
||||||
}
|
}
|
||||||
|
|||||||
@ -367,8 +367,8 @@ txXPathNodeUtils::getLocalName(const txXPathNode& aNode)
|
|||||||
|
|
||||||
if (aNode.isContent()) {
|
if (aNode.isContent()) {
|
||||||
if (aNode.mContent->IsContentOfType(nsIContent::eELEMENT)) {
|
if (aNode.mContent->IsContentOfType(nsIContent::eELEMENT)) {
|
||||||
nsIAtom* localName;
|
nsIAtom* localName = aNode.mContent->Tag();
|
||||||
aNode.mContent->GetTag(&localName);
|
NS_ADDREF(localName);
|
||||||
|
|
||||||
return localName;
|
return localName;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -511,9 +511,8 @@ void txMozillaXMLOutput::closePrevious(PRInt8 aAction)
|
|||||||
void txMozillaXMLOutput::startHTMLElement(nsIDOMElement* aElement, PRBool aXHTML)
|
void txMozillaXMLOutput::startHTMLElement(nsIDOMElement* aElement, PRBool aXHTML)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
nsCOMPtr<nsIAtom> atom;
|
|
||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
||||||
content->GetTag(getter_AddRefs(atom));
|
nsIAtom *atom = content->Tag();
|
||||||
|
|
||||||
mDontAddCurrent = (atom == txHTMLAtoms::script);
|
mDontAddCurrent = (atom == txHTMLAtoms::script);
|
||||||
|
|
||||||
@ -587,8 +586,7 @@ void txMozillaXMLOutput::endHTMLElement(nsIDOMElement* aElement)
|
|||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
||||||
NS_ASSERTION(content, "Can't QI to nsIContent");
|
NS_ASSERTION(content, "Can't QI to nsIContent");
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> atom;
|
nsIAtom *atom = content->Tag();
|
||||||
content->GetTag(getter_AddRefs(atom));
|
|
||||||
|
|
||||||
if (mTableState == ADDED_TBODY) {
|
if (mTableState == ADDED_TBODY) {
|
||||||
NS_ASSERTION(atom == txHTMLAtoms::tbody,
|
NS_ASSERTION(atom == txHTMLAtoms::tbody,
|
||||||
|
|||||||
@ -2431,11 +2431,9 @@ nsTypeAheadFind::IsTargetContentOkay(nsIContent *aContent)
|
|||||||
// not support nsIFormControl or eHTML_FORM_CONTROL, and it's not worth
|
// not support nsIFormControl or eHTML_FORM_CONTROL, and it's not worth
|
||||||
// having a table of atoms just for it. Instead, we're paying for 1 extra
|
// having a table of atoms just for it. Instead, we're paying for 1 extra
|
||||||
// string compare per keystroke, which isn't too bad.
|
// string compare per keystroke, which isn't too bad.
|
||||||
nsCOMPtr<nsIAtom> targetTagAtom;
|
const char *tagStr;
|
||||||
aContent->GetTag(getter_AddRefs(targetTagAtom));
|
aContent->Tag()->GetUTF8String(&tagStr);
|
||||||
nsAutoString targetTagString;
|
if (strcmp(tagStr, "isindex") == 0) {
|
||||||
targetTagAtom->ToString(targetTagString);
|
|
||||||
if (targetTagString.Equals(NS_LITERAL_STRING("isindex"))) {
|
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -266,12 +266,8 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
|
|||||||
nsIContent* content = aFrame->GetContent();
|
nsIContent* content = aFrame->GetContent();
|
||||||
if (content->IsContentOfType(nsIContent::eXUL))
|
if (content->IsContentOfType(nsIContent::eXUL))
|
||||||
aFrame = aFrame->GetParent();
|
aFrame = aFrame->GetParent();
|
||||||
else {
|
else if (content->Tag() == mInputAtom)
|
||||||
nsCOMPtr<nsIAtom> tag;
|
atom = mInputCheckedAtom;
|
||||||
content->GetTag(getter_AddRefs(tag));
|
|
||||||
if (tag == mInputAtom)
|
|
||||||
atom = mInputCheckedAtom;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!atom)
|
if (!atom)
|
||||||
|
|||||||
@ -121,7 +121,6 @@
|
|||||||
|
|
||||||
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
|
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
|
||||||
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
|
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
|
||||||
static NS_DEFINE_CID(kAttributeContentCID, NS_ATTRIBUTECONTENT_CID);
|
|
||||||
|
|
||||||
#include "nsIDOMWindowInternal.h"
|
#include "nsIDOMWindowInternal.h"
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
@ -1438,23 +1437,24 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex
|
|||||||
|
|
||||||
// Creates the content and frame and return if successful
|
// Creates the content and frame and return if successful
|
||||||
nsresult rv = NS_ERROR_FAILURE;
|
nsresult rv = NS_ERROR_FAILURE;
|
||||||
if (nsnull != attrName) {
|
if (attrName) {
|
||||||
nsIFrame* textFrame = nsnull;
|
nsIFrame* textFrame = nsnull;
|
||||||
nsCOMPtr<nsIContent> content(do_CreateInstance(kAttributeContentCID));
|
nsCOMPtr<nsIContent> content;
|
||||||
if (content) {
|
rv = NS_NewAttributeContent(getter_AddRefs(content));
|
||||||
nsCOMPtr<nsIAttributeContent> attrContent(do_QueryInterface(content));
|
|
||||||
if (attrContent) {
|
|
||||||
attrContent->Init(aContent, attrNameSpace, attrName);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set aContent as the parent content and set the document object. This
|
nsCOMPtr<nsIAttributeContent> attrContent(do_QueryInterface(content));
|
||||||
// way event handling works
|
if (attrContent) {
|
||||||
|
attrContent->Init(aContent, attrNameSpace, attrName);
|
||||||
|
|
||||||
|
// Set aContent as the parent content and set the document
|
||||||
|
// object. This way event handling works
|
||||||
content->SetParent(aContent);
|
content->SetParent(aContent);
|
||||||
content->SetDocument(aDocument, PR_TRUE, PR_TRUE);
|
content->SetDocument(aDocument, PR_TRUE, PR_TRUE);
|
||||||
|
|
||||||
// Create a text frame and initialize it
|
// Create a text frame and initialize it
|
||||||
NS_NewTextFrame(shell, &textFrame);
|
NS_NewTextFrame(shell, &textFrame);
|
||||||
textFrame->Init(aPresContext, content, aParentFrame, aStyleContext, nsnull);
|
textFrame->Init(aPresContext, content, aParentFrame, aStyleContext,
|
||||||
|
nsnull);
|
||||||
|
|
||||||
// Return the text frame
|
// Return the text frame
|
||||||
*aFrame = textFrame;
|
*aFrame = textFrame;
|
||||||
@ -2980,13 +2980,15 @@ nsCSSFrameConstructor::ConstructTableForeignFrame(nsIPresShell* aPres
|
|||||||
nsIFrame* parentFrame = nsnull;
|
nsIFrame* parentFrame = nsnull;
|
||||||
aIsPseudoParent = PR_FALSE;
|
aIsPseudoParent = PR_FALSE;
|
||||||
|
|
||||||
// XXX form code needs to be fixed so that the forms can work without a frame.
|
// XXX form code needs to be fixed so that the forms can work
|
||||||
nsCOMPtr<nsIAtom> tag;
|
// without a frame.
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
nsIAtom *tag = aContent->Tag();
|
||||||
|
|
||||||
// Do not construct pseudo frames for trees
|
// Do not construct pseudo frames for trees
|
||||||
if (MustGeneratePseudoParent(aPresContext, aParentFrameIn, tag.get(), aContent, aStyleContext)) {
|
if (MustGeneratePseudoParent(aPresContext, aParentFrameIn, tag, aContent,
|
||||||
// this frame may have a pseudo parent, use block frame type to trigger foreign
|
aStyleContext)) {
|
||||||
|
// this frame may have a pseudo parent, use block frame type to
|
||||||
|
// trigger foreign
|
||||||
GetParentFrame(aPresShell, aPresContext, aTableCreator, *aParentFrameIn,
|
GetParentFrame(aPresShell, aPresContext, aTableCreator, *aParentFrameIn,
|
||||||
nsLayoutAtoms::blockFrame, aState, parentFrame, aIsPseudoParent);
|
nsLayoutAtoms::blockFrame, aState, parentFrame, aIsPseudoParent);
|
||||||
if (!aIsPseudoParent && !aState.mPseudoFrames.IsEmpty()) {
|
if (!aIsPseudoParent && !aState.mPseudoFrames.IsEmpty()) {
|
||||||
@ -5087,9 +5089,7 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell
|
|||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
// Only cut XUL scrollbars off if they're not in a XUL document. This allows
|
// Only cut XUL scrollbars off if they're not in a XUL document. This allows
|
||||||
// scrollbars to be styled from XUL (although not from XML or HTML).
|
// scrollbars to be styled from XUL (although not from XML or HTML).
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (content->Tag() == nsXULAtoms::scrollbar) {
|
||||||
content->GetTag(getter_AddRefs(tag));
|
|
||||||
if (tag.get() == nsXULAtoms::scrollbar) {
|
|
||||||
nsCOMPtr<nsIDOMXULDocument> xulDoc(do_QueryInterface(aDocument));
|
nsCOMPtr<nsIDOMXULDocument> xulDoc(do_QueryInterface(aDocument));
|
||||||
if (xulDoc)
|
if (xulDoc)
|
||||||
content->SetBindingParent(aParent);
|
content->SetBindingParent(aParent);
|
||||||
@ -6165,10 +6165,8 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre
|
|||||||
ProcessChildren(aPresShell, aPresContext, aState, aContent, scrolledFrame, PR_TRUE,
|
ProcessChildren(aPresShell, aPresContext, aState, aContent, scrolledFrame, PR_TRUE,
|
||||||
childItems, PR_TRUE);
|
childItems, PR_TRUE);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
CreateAnonymousFrames(aPresShell, aPresContext, aContent->Tag(), aState,
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
aContent, newFrame, PR_FALSE, childItems);
|
||||||
CreateAnonymousFrames(aPresShell, aPresContext, tag, aState, aContent, newFrame,
|
|
||||||
PR_FALSE, childItems);
|
|
||||||
|
|
||||||
// Set the scrolled frame's initial child lists
|
// Set the scrolled frame's initial child lists
|
||||||
scrolledFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
scrolledFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
||||||
@ -6228,10 +6226,8 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre
|
|||||||
ProcessChildren(aPresShell, aPresContext, aState, aContent, newFrame, PR_TRUE,
|
ProcessChildren(aPresShell, aPresContext, aState, aContent, newFrame, PR_TRUE,
|
||||||
childItems, PR_TRUE);
|
childItems, PR_TRUE);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
CreateAnonymousFrames(aPresShell, aPresContext, aContent->Tag(), aState,
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
aContent, newFrame, PR_FALSE, childItems);
|
||||||
CreateAnonymousFrames(aPresShell, aPresContext, tag, aState, aContent, newFrame,
|
|
||||||
PR_FALSE, childItems);
|
|
||||||
|
|
||||||
// Set the frame's initial child list(s)
|
// Set the frame's initial child list(s)
|
||||||
newFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
newFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
||||||
@ -6577,15 +6573,11 @@ nsCSSFrameConstructor::ResolveStyleContext(nsIPresContext* aPresContext,
|
|||||||
if (aContent->IsContentOfType(nsIContent::eELEMENT)) {
|
if (aContent->IsContentOfType(nsIContent::eELEMENT)) {
|
||||||
return aPresContext->ResolveStyleContextFor(aContent, parentStyleContext);
|
return aPresContext->ResolveStyleContextFor(aContent, parentStyleContext);
|
||||||
} else {
|
} else {
|
||||||
#ifdef DEBUG
|
|
||||||
{
|
NS_ASSERTION(aContent->Tag() == nsLayoutAtoms::textTagName,
|
||||||
nsCOMPtr<nsIAtom> tag;
|
"shouldn't waste time creating style contexts for "
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
"comments and processing instructions");
|
||||||
NS_ASSERTION(tag == nsLayoutAtoms::textTagName,
|
|
||||||
"shouldn't waste time creating style contexts for "
|
|
||||||
"comments and processing instructions");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return aPresContext->ResolveStyleContextForNonElement(parentStyleContext);
|
return aPresContext->ResolveStyleContextForNonElement(parentStyleContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7023,8 +7015,7 @@ nsCSSFrameConstructor::ConstructFrame(nsIPresShell* aPresShell,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the element's tag
|
// Get the element's tag
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = aContent->Tag();
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
// never create frames for comments on PIs
|
// never create frames for comments on PIs
|
||||||
if (tag == nsLayoutAtoms::commentTagName ||
|
if (tag == nsLayoutAtoms::commentTagName ||
|
||||||
@ -7104,7 +7095,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||||||
PRInt32 nameSpaceID;
|
PRInt32 nameSpaceID;
|
||||||
xblService->ResolveTag(aContent, &nameSpaceID, getter_AddRefs(baseTag));
|
xblService->ResolveTag(aContent, &nameSpaceID, getter_AddRefs(baseTag));
|
||||||
|
|
||||||
if (baseTag.get() != aTag || aNameSpaceID != nameSpaceID) {
|
if (baseTag != aTag || aNameSpaceID != nameSpaceID) {
|
||||||
// Construct the frame using the XBL base tag.
|
// Construct the frame using the XBL base tag.
|
||||||
rv = ConstructFrameInternal( aPresShell,
|
rv = ConstructFrameInternal( aPresShell,
|
||||||
aPresContext,
|
aPresContext,
|
||||||
@ -7612,7 +7603,7 @@ FindPreviousAnonymousSibling(nsIPresShell* aPresShell,
|
|||||||
nodeList->Item(PRUint32(index), getter_AddRefs(node));
|
nodeList->Item(PRUint32(index), getter_AddRefs(node));
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
|
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
|
||||||
if (child.get() == aChild)
|
if (child == aChild)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7694,7 +7685,7 @@ FindNextAnonymousSibling(nsIPresShell* aPresShell,
|
|||||||
nodeList->Item(PRUint32(index), getter_AddRefs(node));
|
nodeList->Item(PRUint32(index), getter_AddRefs(node));
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
|
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
|
||||||
if (child.get() == aChild)
|
if (child == aChild)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7935,21 +7926,20 @@ inline PRBool
|
|||||||
ShouldIgnoreSelectChild(nsIContent* aContainer)
|
ShouldIgnoreSelectChild(nsIContent* aContainer)
|
||||||
{
|
{
|
||||||
// Ignore options and optgroups inside a select (size > 1)
|
// Ignore options and optgroups inside a select (size > 1)
|
||||||
nsCOMPtr<nsIAtom> containerTag;
|
nsIAtom *containerTag = aContainer->Tag();
|
||||||
aContainer->GetTag(getter_AddRefs(containerTag));
|
|
||||||
|
|
||||||
if (containerTag == nsHTMLAtoms::optgroup ||
|
if (containerTag == nsHTMLAtoms::optgroup ||
|
||||||
containerTag == nsHTMLAtoms::select) {
|
containerTag == nsHTMLAtoms::select) {
|
||||||
nsIContent* selectContent = aContainer;
|
nsIContent* selectContent = aContainer;
|
||||||
|
|
||||||
while (containerTag != nsHTMLAtoms::select) {
|
while (containerTag != nsHTMLAtoms::select) {
|
||||||
selectContent = selectContent->GetParent();
|
selectContent = selectContent->GetParent();
|
||||||
if (!selectContent) {
|
if (!selectContent) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
selectContent->GetTag(getter_AddRefs(containerTag));
|
containerTag = selectContent->Tag();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsISelectElement> selectElement = do_QueryInterface(selectContent);
|
nsCOMPtr<nsISelectElement> selectElement = do_QueryInterface(selectContent);
|
||||||
if (selectElement) {
|
if (selectElement) {
|
||||||
nsAutoString selSize;
|
nsAutoString selSize;
|
||||||
@ -8097,7 +8087,8 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
|
|||||||
if (tag == nsXULAtoms::treechildren ||
|
if (tag == nsXULAtoms::treechildren ||
|
||||||
tag == nsXULAtoms::treeitem ||
|
tag == nsXULAtoms::treeitem ||
|
||||||
tag == nsXULAtoms::treerow ||
|
tag == nsXULAtoms::treerow ||
|
||||||
(UseXBLForms() && ShouldIgnoreSelectChild(aContainer)))
|
(namespaceID == kNameSpaceID_XUL && UseXBLForms() &&
|
||||||
|
ShouldIgnoreSelectChild(aContainer)))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -8656,10 +8647,7 @@ PRBool NotifyListBoxBody(nsIPresContext* aPresContext,
|
|||||||
if (!aContainer)
|
if (!aContainer)
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (aChild->Tag() == nsXULAtoms::listitem) {
|
||||||
aChild->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (tag == nsXULAtoms::listitem) {
|
|
||||||
nsListBoxBodyFrame* listBoxBody = nsnull;
|
nsListBoxBodyFrame* listBoxBody = nsnull;
|
||||||
if (aChildFrame) {
|
if (aChildFrame) {
|
||||||
// There is a frame for the removed content, so its parent frame is the listboxbody
|
// There is a frame for the removed content, so its parent frame is the listboxbody
|
||||||
@ -8693,6 +8681,7 @@ PRBool NotifyListBoxBody(nsIPresContext* aPresContext,
|
|||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIAtom> tag;
|
||||||
PRInt32 namespaceID;
|
PRInt32 namespaceID;
|
||||||
aDocument->GetBindingManager()->ResolveTag(aContainer, &namespaceID,
|
aDocument->GetBindingManager()->ResolveTag(aContainer, &namespaceID,
|
||||||
getter_AddRefs(tag));
|
getter_AddRefs(tag));
|
||||||
@ -8701,7 +8690,8 @@ PRBool NotifyListBoxBody(nsIPresContext* aPresContext,
|
|||||||
if (tag == nsXULAtoms::treechildren ||
|
if (tag == nsXULAtoms::treechildren ||
|
||||||
tag == nsXULAtoms::treeitem ||
|
tag == nsXULAtoms::treeitem ||
|
||||||
tag == nsXULAtoms::treerow ||
|
tag == nsXULAtoms::treerow ||
|
||||||
(aUseXBLForms && ShouldIgnoreSelectChild(aContainer)))
|
(namespaceID == kNameSpaceID_XUL && aUseXBLForms &&
|
||||||
|
ShouldIgnoreSelectChild(aContainer)))
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
|
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
@ -10178,7 +10168,9 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
|
|||||||
mDocument->GetBindingManager()->ResolveTag(aContent, &namespaceID,
|
mDocument->GetBindingManager()->ResolveTag(aContent, &namespaceID,
|
||||||
getter_AddRefs(tag));
|
getter_AddRefs(tag));
|
||||||
|
|
||||||
if (tag && (tag.get() == nsXULAtoms::listitem || tag.get() == nsXULAtoms::listcell))
|
if (namespaceID == kNameSpaceID_XUL &&
|
||||||
|
(tag == nsXULAtoms::listitem ||
|
||||||
|
tag == nsXULAtoms::listcell))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10312,9 +10304,7 @@ nsCSSFrameConstructor::ConstructAlternateFrame(nsIPresShell* aPresShell,
|
|||||||
aFrame = nsnull;
|
aFrame = nsnull;
|
||||||
|
|
||||||
// Get the alternate text to use
|
// Get the alternate text to use
|
||||||
nsCOMPtr<nsIAtom> tag;
|
GetAlternateTextFor(aContent, aContent->Tag(), altText);
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
GetAlternateTextFor(aContent, tag, altText);
|
|
||||||
|
|
||||||
// Create a text content element for the alternate text
|
// Create a text content element for the alternate text
|
||||||
nsCOMPtr<nsIContent> altTextContent(do_CreateInstance(kTextNodeCID,&rv));
|
nsCOMPtr<nsIContent> altTextContent(do_CreateInstance(kTextNodeCID,&rv));
|
||||||
@ -10437,12 +10427,12 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||||||
|
|
||||||
// Get aFrame's content object and the tag name
|
// Get aFrame's content object and the tag name
|
||||||
PRInt32 nameSpaceID;
|
PRInt32 nameSpaceID;
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom* tag;
|
||||||
|
|
||||||
nsIContent* content = aFrame->GetContent();
|
nsIContent* content = aFrame->GetContent();
|
||||||
NS_ASSERTION(content, "null content object");
|
NS_ASSERTION(content, "null content object");
|
||||||
content->GetNameSpaceID(&nameSpaceID);
|
content->GetNameSpaceID(&nameSpaceID);
|
||||||
content->GetTag(getter_AddRefs(tag));
|
tag = content->Tag();
|
||||||
|
|
||||||
// Get the child list name that the frame is contained in
|
// Get the child list name that the frame is contained in
|
||||||
nsCOMPtr<nsIAtom> listName;
|
nsCOMPtr<nsIAtom> listName;
|
||||||
@ -10464,8 +10454,8 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||||||
// See whether it's an IMG or an INPUT element (for image buttons)
|
// See whether it's an IMG or an INPUT element (for image buttons)
|
||||||
// or if it is an applet with no displayable children
|
// or if it is an applet with no displayable children
|
||||||
// XXX need to check nameSpaceID in these spots
|
// XXX need to check nameSpaceID in these spots
|
||||||
if (nsHTMLAtoms::img == tag.get() || nsHTMLAtoms::input == tag.get() ||
|
if (nsHTMLAtoms::img == tag || nsHTMLAtoms::input == tag ||
|
||||||
(nsHTMLAtoms::applet == tag.get() && !HasDisplayableChildren(aPresContext, aFrame))) {
|
(nsHTMLAtoms::applet == tag && !HasDisplayableChildren(aPresContext, aFrame))) {
|
||||||
// Try and construct an alternate frame to use when the
|
// Try and construct an alternate frame to use when the
|
||||||
// image can't be rendered
|
// image can't be rendered
|
||||||
nsIFrame* newFrame;
|
nsIFrame* newFrame;
|
||||||
@ -10508,9 +10498,9 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((nsHTMLAtoms::object == tag.get()) ||
|
} else if ((nsHTMLAtoms::object == tag) ||
|
||||||
(nsHTMLAtoms::embed == tag.get()) ||
|
(nsHTMLAtoms::embed == tag) ||
|
||||||
(nsHTMLAtoms::applet == tag.get())) {
|
(nsHTMLAtoms::applet == tag)) {
|
||||||
// It's an OBJECT, EMBED, or APPLET, so we should display the contents
|
// It's an OBJECT, EMBED, or APPLET, so we should display the contents
|
||||||
// instead
|
// instead
|
||||||
nsIFrame* absoluteContainingBlock;
|
nsIFrame* absoluteContainingBlock;
|
||||||
@ -10529,10 +10519,10 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||||||
|
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
// Verify that we calculated the same containing block
|
// Verify that we calculated the same containing block
|
||||||
if (listName.get() == nsLayoutAtoms::absoluteList) {
|
if (listName == nsLayoutAtoms::absoluteList) {
|
||||||
NS_ASSERTION(absoluteContainingBlock == parentFrame,
|
NS_ASSERTION(absoluteContainingBlock == parentFrame,
|
||||||
"wrong absolute containing block");
|
"wrong absolute containing block");
|
||||||
} else if (listName.get() == nsLayoutAtoms::floatList) {
|
} else if (listName == nsLayoutAtoms::floatList) {
|
||||||
NS_ASSERTION(floatContainingBlock == parentFrame,
|
NS_ASSERTION(floatContainingBlock == parentFrame,
|
||||||
"wrong float containing block");
|
"wrong float containing block");
|
||||||
}
|
}
|
||||||
@ -10610,13 +10600,13 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||||||
// block frame.
|
// block frame.
|
||||||
SplitToContainingBlock(aPresContext, state, parentFrame, list1, list2, list3, PR_FALSE);
|
SplitToContainingBlock(aPresContext, state, parentFrame, list1, list2, list3, PR_FALSE);
|
||||||
}
|
}
|
||||||
} else if (listName.get() == nsLayoutAtoms::absoluteList) {
|
} else if (listName == nsLayoutAtoms::absoluteList) {
|
||||||
newFrame = state.mAbsoluteItems.childList;
|
newFrame = state.mAbsoluteItems.childList;
|
||||||
state.mAbsoluteItems.childList = nsnull;
|
state.mAbsoluteItems.childList = nsnull;
|
||||||
} else if (listName.get() == nsLayoutAtoms::fixedList) {
|
} else if (listName == nsLayoutAtoms::fixedList) {
|
||||||
newFrame = state.mFixedItems.childList;
|
newFrame = state.mFixedItems.childList;
|
||||||
state.mFixedItems.childList = nsnull;
|
state.mFixedItems.childList = nsnull;
|
||||||
} else if (listName.get() == nsLayoutAtoms::floatList) {
|
} else if (listName == nsLayoutAtoms::floatList) {
|
||||||
newFrame = state.mFloatedItems.childList;
|
newFrame = state.mFloatedItems.childList;
|
||||||
state.mFloatedItems.childList = nsnull;
|
state.mFloatedItems.childList = nsnull;
|
||||||
}
|
}
|
||||||
@ -10631,7 +10621,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||||||
|
|
||||||
InsertOutOfFlowFrames(state, aPresContext);
|
InsertOutOfFlowFrames(state, aPresContext);
|
||||||
}
|
}
|
||||||
} else if (nsHTMLAtoms::input == tag.get()) {
|
} else if (nsHTMLAtoms::input == tag) {
|
||||||
// XXX image INPUT elements are also image frames, but don't throw away the
|
// XXX image INPUT elements are also image frames, but don't throw away the
|
||||||
// image frame, because the frame class has extra logic that is specific to
|
// image frame, because the frame class has extra logic that is specific to
|
||||||
// INPUT elements
|
// INPUT elements
|
||||||
@ -11216,7 +11206,7 @@ nsCSSFrameConstructor::FindPrimaryFrameFor(nsIPresContext* aPresContext,
|
|||||||
while (parentFrame) {
|
while (parentFrame) {
|
||||||
// Search the child frames for a match
|
// Search the child frames for a match
|
||||||
*aFrame = FindFrameWithContent(aPresContext, aFrameManager, parentFrame,
|
*aFrame = FindFrameWithContent(aPresContext, aFrameManager, parentFrame,
|
||||||
parentContent.get(), aContent, aHint);
|
parentContent, aContent, aHint);
|
||||||
#ifdef NOISY_FINDFRAME
|
#ifdef NOISY_FINDFRAME
|
||||||
printf("FindFrameWithContent returned %p\n", *aFrame);
|
printf("FindFrameWithContent returned %p\n", *aFrame);
|
||||||
#endif
|
#endif
|
||||||
@ -11233,7 +11223,7 @@ nsCSSFrameConstructor::FindPrimaryFrameFor(nsIPresContext* aPresContext,
|
|||||||
#endif
|
#endif
|
||||||
nsIFrame *verifyTestFrame =
|
nsIFrame *verifyTestFrame =
|
||||||
FindFrameWithContent(aPresContext, aFrameManager, parentFrame,
|
FindFrameWithContent(aPresContext, aFrameManager, parentFrame,
|
||||||
parentContent.get(), aContent, nsnull);
|
parentContent, aContent, nsnull);
|
||||||
#ifdef NOISY_FINDFRAME
|
#ifdef NOISY_FINDFRAME
|
||||||
printf("VERIFY returned %p\n", verifyTestFrame);
|
printf("VERIFY returned %p\n", verifyTestFrame);
|
||||||
#endif
|
#endif
|
||||||
@ -11263,9 +11253,7 @@ nsCSSFrameConstructor::FindPrimaryFrameFor(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
if (aHint && !*aFrame)
|
if (aHint && !*aFrame)
|
||||||
{ // if we had a hint, and we didn't get a frame, see if we should try the slow way
|
{ // if we had a hint, and we didn't get a frame, see if we should try the slow way
|
||||||
nsCOMPtr<nsIAtom>tag;
|
if (aContent->Tag() == nsLayoutAtoms::textTagName)
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
if (nsLayoutAtoms::textTagName == tag.get())
|
|
||||||
{
|
{
|
||||||
#ifdef NOISY_FINDFRAME
|
#ifdef NOISY_FINDFRAME
|
||||||
FFWC_slowSearchForText++;
|
FFWC_slowSearchForText++;
|
||||||
@ -12244,11 +12232,11 @@ nsCSSFrameConstructor::WrapFramesInFirstLetterFrame(
|
|||||||
// Take the old textFrame out of the inline parents child list
|
// Take the old textFrame out of the inline parents child list
|
||||||
DeletingFrameSubtree(aPresContext, aState.mPresShell,
|
DeletingFrameSubtree(aPresContext, aState.mPresShell,
|
||||||
aState.mFrameManager, textFrame);
|
aState.mFrameManager, textFrame);
|
||||||
parentFrame->RemoveFrame(aPresContext, *aState.mPresShell.get(),
|
parentFrame->RemoveFrame(aPresContext, *aState.mPresShell,
|
||||||
nsnull, textFrame);
|
nsnull, textFrame);
|
||||||
|
|
||||||
// Insert in the letter frame(s)
|
// Insert in the letter frame(s)
|
||||||
parentFrame->InsertFrames(aPresContext, *aState.mPresShell.get(),
|
parentFrame->InsertFrames(aPresContext, *aState.mPresShell,
|
||||||
nsnull, prevFrame, letterFrames.childList);
|
nsnull, prevFrame, letterFrames.childList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -12552,16 +12540,16 @@ nsCSSFrameConstructor::RecoverLetterFrames(nsIPresShell* aPresShell, nsIPresCont
|
|||||||
// Take the old textFrame out of the parents child list
|
// Take the old textFrame out of the parents child list
|
||||||
DeletingFrameSubtree(aPresContext, aState.mPresShell,
|
DeletingFrameSubtree(aPresContext, aState.mPresShell,
|
||||||
aState.mFrameManager, textFrame);
|
aState.mFrameManager, textFrame);
|
||||||
parentFrame->RemoveFrame(aPresContext, *aState.mPresShell.get(),
|
parentFrame->RemoveFrame(aPresContext, *aState.mPresShell,
|
||||||
nsnull, textFrame);
|
nsnull, textFrame);
|
||||||
|
|
||||||
// Insert in the letter frame(s)
|
// Insert in the letter frame(s)
|
||||||
parentFrame->InsertFrames(aPresContext, *aState.mPresShell.get(),
|
parentFrame->InsertFrames(aPresContext, *aState.mPresShell,
|
||||||
nsnull, prevFrame, letterFrames.childList);
|
nsnull, prevFrame, letterFrames.childList);
|
||||||
|
|
||||||
// Insert in floats too if needed
|
// Insert in floats too if needed
|
||||||
if (aState.mFloatedItems.childList) {
|
if (aState.mFloatedItems.childList) {
|
||||||
aBlockFrame->AppendFrames(aPresContext, *aState.mPresShell.get(),
|
aBlockFrame->AppendFrames(aPresContext, *aState.mPresShell,
|
||||||
nsLayoutAtoms::floatList,
|
nsLayoutAtoms::floatList,
|
||||||
aState.mFloatedItems.childList);
|
aState.mFloatedItems.childList);
|
||||||
}
|
}
|
||||||
@ -12608,13 +12596,11 @@ nsCSSFrameConstructor::CreateListBoxContent(nsIPresContext* aPresContext,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
aChild->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
PRInt32 namespaceID;
|
PRInt32 namespaceID;
|
||||||
aChild->GetNameSpaceID(&namespaceID);
|
aChild->GetNameSpaceID(&namespaceID);
|
||||||
|
|
||||||
rv = ConstructFrameInternal(shell, aPresContext, state, aChild, aParentFrame, tag, namespaceID,
|
rv = ConstructFrameInternal(shell, aPresContext, state, aChild,
|
||||||
|
aParentFrame, aChild->Tag(), namespaceID,
|
||||||
styleContext, frameItems, PR_FALSE);
|
styleContext, frameItems, PR_FALSE);
|
||||||
|
|
||||||
nsIFrame* newFrame = frameItems.childList;
|
nsIFrame* newFrame = frameItems.childList;
|
||||||
@ -12688,10 +12674,8 @@ nsCSSFrameConstructor::ConstructBlock(nsIPresShell* aPresShell,
|
|||||||
nsresult rv = ProcessChildren(aPresShell, aPresContext, aState, aContent,
|
nsresult rv = ProcessChildren(aPresShell, aPresContext, aState, aContent,
|
||||||
aNewFrame, PR_TRUE, childItems, PR_TRUE);
|
aNewFrame, PR_TRUE, childItems, PR_TRUE);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
CreateAnonymousFrames(aPresShell, aPresContext, aContent->Tag(), aState,
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
aContent, aNewFrame, PR_FALSE, childItems);
|
||||||
CreateAnonymousFrames(aPresShell, aPresContext, tag, aState, aContent, aNewFrame,
|
|
||||||
PR_FALSE, childItems);
|
|
||||||
|
|
||||||
// Set the frame's initial child list
|
// Set the frame's initial child list
|
||||||
aNewFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
aNewFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
||||||
@ -12762,10 +12746,8 @@ nsCSSFrameConstructor::ConstructInline(nsIPresShell* aPresShell,
|
|||||||
aNewFrame, PR_TRUE, childItems, &kidsAllInline);
|
aNewFrame, PR_TRUE, childItems, &kidsAllInline);
|
||||||
if (kidsAllInline) {
|
if (kidsAllInline) {
|
||||||
// Set the inline frame's initial child list
|
// Set the inline frame's initial child list
|
||||||
nsCOMPtr<nsIAtom> tag;
|
CreateAnonymousFrames(aPresShell, aPresContext, aContent->Tag(), aState,
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
aContent, aNewFrame, PR_FALSE, childItems);
|
||||||
CreateAnonymousFrames(aPresShell, aPresContext, tag, aState, aContent, aNewFrame,
|
|
||||||
PR_FALSE, childItems);
|
|
||||||
|
|
||||||
aNewFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
aNewFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
||||||
|
|
||||||
|
|||||||
@ -194,7 +194,7 @@ protected:
|
|||||||
static InlineBackgroundData gInlineBGData;
|
static InlineBackgroundData gInlineBGData;
|
||||||
|
|
||||||
static void GetPath(nsFloatPoint aPoints[],nsPoint aPolyPath[],PRInt32 *aCurIndex,ePathTypes aPathType,PRInt32 &aC1Index,float aFrac=0);
|
static void GetPath(nsFloatPoint aPoints[],nsPoint aPolyPath[],PRInt32 *aCurIndex,ePathTypes aPathType,PRInt32 &aC1Index,float aFrac=0);
|
||||||
static nsresult GetFrameForBackgroundUpdate(nsIPresContext *aPresContext,nsIFrame *aFrame, nsIFrame **aBGFrame);
|
static void GetFrameForBackgroundUpdate(nsIPresContext *aPresContext,nsIFrame *aFrame, nsIFrame **aBGFrame);
|
||||||
|
|
||||||
// FillRect or InvertRect depending on the renderingaInvert parameter
|
// FillRect or InvertRect depending on the renderingaInvert parameter
|
||||||
static void FillOrInvertRect(nsIRenderingContext& aRC,nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight, PRBool aInvert);
|
static void FillOrInvertRect(nsIRenderingContext& aRC,nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight, PRBool aInvert);
|
||||||
@ -1555,32 +1555,30 @@ PRBool GetBGColorForHTMLElement( nsIPresContext *aPresContext,
|
|||||||
nsIContent *pContent;
|
nsIContent *pContent;
|
||||||
if ((pContent = doc->GetRootContent())) {
|
if ((pContent = doc->GetRootContent())) {
|
||||||
// make sure that this is the HTML element
|
// make sure that this is the HTML element
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = pContent->Tag();
|
||||||
pContent->GetTag(getter_AddRefs(tag));
|
|
||||||
NS_ASSERTION(tag, "Tag could not be retrieved from root content element");
|
NS_ASSERTION(tag, "Tag could not be retrieved from root content element");
|
||||||
if (tag) {
|
if (tag == nsHTMLAtoms::html ||
|
||||||
if (tag == nsHTMLAtoms::html ||
|
tag == nsHTMLAtoms::body) {
|
||||||
tag == nsHTMLAtoms::body) {
|
// use this guy's color
|
||||||
// use this guy's color
|
nsIFrame *pFrame = nsnull;
|
||||||
nsIFrame *pFrame = nsnull;
|
if (NS_SUCCEEDED(shell->GetPrimaryFrameFor(pContent, &pFrame)) &&
|
||||||
if (NS_SUCCEEDED(shell->GetPrimaryFrameFor(pContent, &pFrame)) && pFrame) {
|
pFrame) {
|
||||||
nsStyleContext *pContext = pFrame->GetStyleContext();
|
nsStyleContext *pContext = pFrame->GetStyleContext();
|
||||||
if (pContext) {
|
if (pContext) {
|
||||||
const nsStyleBackground* color = pContext->GetStyleBackground();
|
const nsStyleBackground* color = pContext->GetStyleBackground();
|
||||||
if (0 == (color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) {
|
if (0 == (color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT)) {
|
||||||
aBGColor = color;
|
aBGColor = color;
|
||||||
// set the reslt to TRUE to indicate we mapped the color
|
// set the reslt to TRUE to indicate we mapped the color
|
||||||
result = PR_TRUE;
|
result = PR_TRUE;
|
||||||
}
|
}
|
||||||
}// if context
|
}// if context
|
||||||
}// if frame
|
}// if frame
|
||||||
}// if tag == html or body
|
}// if tag == html or body
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
else {
|
else {
|
||||||
printf( "Root Content is not HTML or BODY: cannot get bgColor of HTML or BODY\n");
|
printf( "Root Content is not HTML or BODY: cannot get bgColor of HTML or BODY\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}// if tag
|
|
||||||
}// if content
|
}// if content
|
||||||
NS_RELEASE(doc);
|
NS_RELEASE(doc);
|
||||||
}// if doc
|
}// if doc
|
||||||
@ -1599,39 +1597,36 @@ PRBool GetBGColorForHTMLElement( nsIPresContext *aPresContext,
|
|||||||
// The check is a bit expensive, however until the canvas frame is somehow cached on the
|
// The check is a bit expensive, however until the canvas frame is somehow cached on the
|
||||||
// body frame, or the root element, we need to walk the frames up until we find the canvas
|
// body frame, or the root element, we need to walk the frames up until we find the canvas
|
||||||
//
|
//
|
||||||
nsresult GetFrameForBackgroundUpdate(nsIPresContext *aPresContext,nsIFrame *aFrame, nsIFrame **aBGFrame)
|
void
|
||||||
|
GetFrameForBackgroundUpdate(nsIPresContext *aPresContext,nsIFrame *aFrame,
|
||||||
|
nsIFrame **aBGFrame)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aFrame && aBGFrame, "illegal null parameter");
|
if (!aFrame || !aBGFrame) {
|
||||||
|
NS_ERROR("illegal null parameter");
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
return;
|
||||||
|
}
|
||||||
if (aFrame && aBGFrame) {
|
|
||||||
*aBGFrame = aFrame; // default to the frame passed in
|
*aBGFrame = aFrame; // default to the frame passed in
|
||||||
|
|
||||||
nsIContent* pContent = aFrame->GetContent();
|
nsIContent* pContent = aFrame->GetContent();
|
||||||
if (pContent) {
|
if (pContent) {
|
||||||
// make sure that this is the HTML or BODY element
|
// make sure that this is the HTML or BODY element
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = pContent->Tag();
|
||||||
pContent->GetTag(getter_AddRefs(tag));
|
|
||||||
if (tag) {
|
if (tag == nsHTMLAtoms::html ||
|
||||||
if (tag.get() == nsHTMLAtoms::html ||
|
tag == nsHTMLAtoms::body) {
|
||||||
tag.get() == nsHTMLAtoms::body) {
|
// the frame is the body frame, so we provide the canvas frame
|
||||||
// the frame is the body frame, so we provide the canvas frame
|
nsIFrame *pCanvasFrame = aFrame->GetParent();
|
||||||
nsIFrame *pCanvasFrame = aFrame->GetParent();
|
while (pCanvasFrame) {
|
||||||
while (pCanvasFrame) {
|
if (pCanvasFrame->GetType() == nsLayoutAtoms::canvasFrame) {
|
||||||
if (pCanvasFrame->GetType() == nsLayoutAtoms::canvasFrame) {
|
*aBGFrame = pCanvasFrame;
|
||||||
*aBGFrame = pCanvasFrame;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
pCanvasFrame = pCanvasFrame->GetParent();
|
||||||
pCanvasFrame = pCanvasFrame->GetParent();
|
}
|
||||||
}
|
}// if tag == html or body
|
||||||
}// if tag == html or body
|
|
||||||
}// if tag
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
rv = NS_ERROR_NULL_POINTER;
|
|
||||||
}
|
}
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper macro to determine if the borderstyle 'a' is a MOZ-BG-XXX style
|
// helper macro to determine if the borderstyle 'a' is a MOZ-BG-XXX style
|
||||||
@ -2743,10 +2738,8 @@ FindElementBackground(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
if (!parentFrame)
|
if (!parentFrame)
|
||||||
return PR_TRUE; // no parent to look at
|
return PR_TRUE; // no parent to look at
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (content->Tag() != nsHTMLAtoms::body)
|
||||||
content->GetTag(getter_AddRefs(tag));
|
|
||||||
if (tag != nsHTMLAtoms::body)
|
|
||||||
return PR_TRUE; // not frame for <BODY> element
|
return PR_TRUE; // not frame for <BODY> element
|
||||||
|
|
||||||
// We should only look at the <html> background if we're in an HTML document
|
// We should only look at the <html> background if we're in an HTML document
|
||||||
|
|||||||
@ -621,10 +621,10 @@ FrameManager::GetPrimaryFrameFor(nsIContent* aContent, nsIFrame** aResult)
|
|||||||
if (index > 0) // no use looking if it's the first child
|
if (index > 0) // no use looking if it's the first child
|
||||||
{
|
{
|
||||||
nsIContent *prevSibling;
|
nsIContent *prevSibling;
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag;
|
||||||
do {
|
do {
|
||||||
prevSibling = parent->GetChildAt(--index);
|
prevSibling = parent->GetChildAt(--index);
|
||||||
prevSibling->GetTag(getter_AddRefs(tag));
|
tag = prevSibling->Tag();
|
||||||
} while (index &&
|
} while (index &&
|
||||||
(tag == nsLayoutAtoms::textTagName ||
|
(tag == nsLayoutAtoms::textTagName ||
|
||||||
tag == nsLayoutAtoms::commentTagName ||
|
tag == nsLayoutAtoms::commentTagName ||
|
||||||
|
|||||||
@ -4014,9 +4014,8 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll)
|
|||||||
// Ensure it's an anchor element
|
// Ensure it's an anchor element
|
||||||
content = do_QueryInterface(node);
|
content = do_QueryInterface(node);
|
||||||
if (content) {
|
if (content) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (content->Tag() == nsHTMLAtoms::a &&
|
||||||
content->GetTag(getter_AddRefs(tag));
|
content->IsContentOfType(nsIContent::eHTML)) {
|
||||||
if (tag == nsHTMLAtoms::a) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
content = nsnull;
|
content = nsnull;
|
||||||
|
|||||||
@ -359,8 +359,12 @@ nsresult nsCopySupport::IsPlainTextContext(nsISelection *aSel, nsIDocument *aDoc
|
|||||||
selContent = selContent->GetParent())
|
selContent = selContent->GetParent())
|
||||||
{
|
{
|
||||||
// checking for selection inside a plaintext form widget
|
// checking for selection inside a plaintext form widget
|
||||||
nsCOMPtr<nsIAtom> atom;
|
|
||||||
selContent->GetTag(getter_AddRefs(atom));
|
if (!selContent->IsContentOfType(nsIContent::eHTML)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsIAtom *atom = selContent->Tag();
|
||||||
|
|
||||||
if (atom == nsHTMLAtoms::input ||
|
if (atom == nsHTMLAtoms::input ||
|
||||||
atom == nsHTMLAtoms::textarea)
|
atom == nsHTMLAtoms::textarea)
|
||||||
|
|||||||
@ -481,7 +481,6 @@ MAKE_CTOR(CreateCSSLoader, nsICSSLoader, NS_NewCSS
|
|||||||
MAKE_CTOR(CreateHTMLElementFactory, nsIElementFactory, NS_NewHTMLElementFactory)
|
MAKE_CTOR(CreateHTMLElementFactory, nsIElementFactory, NS_NewHTMLElementFactory)
|
||||||
MAKE_CTOR(CreateTextNode, nsITextContent, NS_NewTextNode)
|
MAKE_CTOR(CreateTextNode, nsITextContent, NS_NewTextNode)
|
||||||
//MAKE_CTOR(CreateAnonymousElement, nsIContent, NS_NewAnonymousElement)
|
//MAKE_CTOR(CreateAnonymousElement, nsIContent, NS_NewAnonymousElement)
|
||||||
MAKE_CTOR(CreateAttributeContent, nsIContent, NS_NewAttributeContent)
|
|
||||||
MAKE_CTOR(CreateXMLElementFactory, nsIElementFactory, NS_NewXMLElementFactory)
|
MAKE_CTOR(CreateXMLElementFactory, nsIElementFactory, NS_NewXMLElementFactory)
|
||||||
//MAKE_CTOR(CreateSelection, nsISelection, NS_NewSelection)
|
//MAKE_CTOR(CreateSelection, nsISelection, NS_NewSelection)
|
||||||
MAKE_CTOR(CreateDOMSelection, nsISelection, NS_NewDomSelection)
|
MAKE_CTOR(CreateDOMSelection, nsISelection, NS_NewDomSelection)
|
||||||
@ -882,11 +881,6 @@ static const nsModuleComponentInfo gComponents[] = {
|
|||||||
CreateAnonymousElement },
|
CreateAnonymousElement },
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{ "Attribute Content",
|
|
||||||
NS_ATTRIBUTECONTENT_CID,
|
|
||||||
nsnull,
|
|
||||||
CreateAttributeContent },
|
|
||||||
|
|
||||||
{ "XML element factory",
|
{ "XML element factory",
|
||||||
NS_XML_ELEMENT_FACTORY_CID,
|
NS_XML_ELEMENT_FACTORY_CID,
|
||||||
NS_XML_ELEMENT_FACTORY_CONTRACTID,
|
NS_XML_ELEMENT_FACTORY_CONTRACTID,
|
||||||
|
|||||||
@ -447,22 +447,11 @@ nsFileControlFrame::GetTextControlFrame(nsIPresContext* aPresContext, nsIFrame*
|
|||||||
|
|
||||||
while (childFrame) {
|
while (childFrame) {
|
||||||
// see if the child is a text control
|
// see if the child is a text control
|
||||||
nsIContent* content = childFrame->GetContent();
|
nsCOMPtr<nsIFormControl> formCtrl =
|
||||||
if (content) {
|
do_QueryInterface(childFrame->GetContent());
|
||||||
nsCOMPtr<nsIAtom> atom;
|
|
||||||
nsresult res = content->GetTag(getter_AddRefs(atom));
|
|
||||||
if (NS_SUCCEEDED(res) && atom) {
|
|
||||||
if (atom.get() == nsHTMLAtoms::input) {
|
|
||||||
|
|
||||||
// It's an input, is it a text input?
|
if (formCtrl && formCtrl->GetType() == NS_FORM_INPUT_TEXT) {
|
||||||
nsAutoString value;
|
result = (nsNewFrame*)childFrame;
|
||||||
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, value)) {
|
|
||||||
if (value.EqualsIgnoreCase("text")) {
|
|
||||||
result = (nsNewFrame*)childFrame;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if not continue looking
|
// if not continue looking
|
||||||
|
|||||||
@ -104,25 +104,12 @@ nsGfxButtonControlFrame::IsFileBrowseButton(PRInt32 type)
|
|||||||
rv = PR_TRUE;
|
rv = PR_TRUE;
|
||||||
}
|
}
|
||||||
else if (NS_FORM_INPUT_BUTTON == type) {
|
else if (NS_FORM_INPUT_BUTTON == type) {
|
||||||
|
|
||||||
// Check to see if parent is a file input
|
// Check to see if parent is a file input
|
||||||
nsresult result;
|
nsCOMPtr<nsIFormControl> formCtrl =
|
||||||
nsCOMPtr<nsIContent> parentContent = mContent->GetParent();
|
do_QueryInterface(mContent->GetParent());
|
||||||
if (parentContent) {
|
|
||||||
nsCOMPtr<nsIAtom> atom;
|
|
||||||
result = parentContent->GetTag(getter_AddRefs(atom));
|
|
||||||
if (NS_SUCCEEDED(result) && atom) {
|
|
||||||
if (atom == nsHTMLAtoms::input) {
|
|
||||||
|
|
||||||
// It's an input, is it a file input?
|
if (formCtrl && formCtrl->GetType() == NS_FORM_INPUT_FILE) {
|
||||||
nsAutoString value;
|
rv = PR_TRUE;
|
||||||
if (NS_CONTENT_ATTR_HAS_VALUE == parentContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, value)) {
|
|
||||||
if (value.EqualsIgnoreCase("file")) {
|
|
||||||
rv = PR_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
|
|||||||
@ -793,9 +793,8 @@ nsTextInputSelectionImpl::CompleteMove(PRBool aForward, PRBool aExtend)
|
|||||||
if (offset > 0)
|
if (offset > 0)
|
||||||
{
|
{
|
||||||
nsIContent *child = parentDIV->GetChildAt(offset - 1);
|
nsIContent *child = parentDIV->GetChildAt(offset - 1);
|
||||||
nsCOMPtr<nsIAtom> tagName;
|
|
||||||
child->GetTag(getter_AddRefs(tagName));
|
if (child->Tag() == nsHTMLAtoms::br)
|
||||||
if (tagName == nsHTMLAtoms::br)
|
|
||||||
{
|
{
|
||||||
--offset;
|
--offset;
|
||||||
hint = HINTRIGHT; // for Bug 106855
|
hint = HINTRIGHT; // for Bug 106855
|
||||||
@ -1329,16 +1328,7 @@ PRBool nsTextControlFrame::IsSingleLineTextControl() const
|
|||||||
|
|
||||||
PRBool nsTextControlFrame::IsTextArea() const
|
PRBool nsTextControlFrame::IsTextArea() const
|
||||||
{
|
{
|
||||||
if (!mContent)
|
return mContent && mContent->Tag() == nsHTMLAtoms::textarea;
|
||||||
return PR_FALSE;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
mContent->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (nsHTMLAtoms::textarea == tag)
|
|
||||||
return PR_TRUE;
|
|
||||||
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: wouldn't it be nice to get this from the style context!
|
// XXX: wouldn't it be nice to get this from the style context!
|
||||||
@ -2297,9 +2287,7 @@ nsTextControlFrame::SelectAllContents()
|
|||||||
// br under the root node!
|
// br under the root node!
|
||||||
nsIContent *child = rootContent->GetChildAt(numChildren - 1);
|
nsIContent *child = rootContent->GetChildAt(numChildren - 1);
|
||||||
if (child) {
|
if (child) {
|
||||||
nsCOMPtr<nsIAtom> tagName;
|
if (child->Tag() == nsHTMLAtoms::br)
|
||||||
child->GetTag(getter_AddRefs(tagName));
|
|
||||||
if (tagName == nsHTMLAtoms::br)
|
|
||||||
--numChildren;
|
--numChildren;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,6 +40,7 @@
|
|||||||
#include "nsStyleConsts.h"
|
#include "nsStyleConsts.h"
|
||||||
#include "nsIPresContext.h"
|
#include "nsIPresContext.h"
|
||||||
#include "nsIViewManager.h"
|
#include "nsIViewManager.h"
|
||||||
|
#include "nsINodeInfo.h"
|
||||||
#include "nsHTMLAtoms.h"
|
#include "nsHTMLAtoms.h"
|
||||||
#include "nsIView.h"
|
#include "nsIView.h"
|
||||||
#include "nsHTMLValue.h"
|
#include "nsHTMLValue.h"
|
||||||
@ -87,18 +88,10 @@ nsAreaFrame::RegUnregAccessKey(nsIPresContext* aPresContext,
|
|||||||
if (!mContent)
|
if (!mContent)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
PRBool isXUL = mContent->IsContentOfType(nsIContent::eXUL);
|
nsINodeInfo *ni = mContent->GetNodeInfo();
|
||||||
if (!isXUL)
|
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
// find out what type of element this is
|
|
||||||
nsCOMPtr<nsIAtom> atom;
|
|
||||||
nsresult rv = mContent->GetTag(getter_AddRefs(atom));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
// only support accesskeys for the following elements
|
// only support accesskeys for the following elements
|
||||||
if (atom != nsXULAtoms::label)
|
if (!ni || !ni->Equals(nsXULAtoms::label, kNameSpaceID_XUL))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
// To filter out <label>s without a control attribute.
|
// To filter out <label>s without a control attribute.
|
||||||
@ -120,7 +113,7 @@ nsAreaFrame::RegUnregAccessKey(nsIPresContext* aPresContext,
|
|||||||
nsCOMPtr<nsIEventStateManager> esm;
|
nsCOMPtr<nsIEventStateManager> esm;
|
||||||
aPresContext->GetEventStateManager(getter_AddRefs(esm));
|
aPresContext->GetEventStateManager(getter_AddRefs(esm));
|
||||||
|
|
||||||
rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
if (esm) {
|
if (esm) {
|
||||||
PRUint32 key = accessKey.First();
|
PRUint32 key = accessKey.First();
|
||||||
|
|||||||
@ -2632,6 +2632,8 @@ NS_IMETHODIMP nsFrame::IsPercentageBase(PRBool& aBase) const
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NS_DEBUG
|
||||||
|
|
||||||
PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame)
|
PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame)
|
||||||
{
|
{
|
||||||
PRInt32 result = -1;
|
PRInt32 result = -1;
|
||||||
@ -2647,8 +2649,6 @@ PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NS_DEBUG
|
|
||||||
|
|
||||||
#ifdef DEBUG_waterson
|
#ifdef DEBUG_waterson
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2707,10 +2707,9 @@ nsresult
|
|||||||
nsFrame::MakeFrameName(const nsAString& aType, nsAString& aResult) const
|
nsFrame::MakeFrameName(const nsAString& aType, nsAString& aResult) const
|
||||||
{
|
{
|
||||||
aResult = aType;
|
aResult = aType;
|
||||||
if (nsnull != mContent) {
|
if (mContent) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = mContent->Tag();
|
||||||
mContent->GetTag(getter_AddRefs(tag));
|
if (tag != nsLayoutAtoms::textTagName) {
|
||||||
if (tag && tag != nsLayoutAtoms::textTagName) {
|
|
||||||
nsAutoString buf;
|
nsAutoString buf;
|
||||||
tag->ToString(buf);
|
tag->ToString(buf);
|
||||||
aResult.Append(NS_LITERAL_STRING("(") + buf + NS_LITERAL_STRING(")"));
|
aResult.Append(NS_LITERAL_STRING("(") + buf + NS_LITERAL_STRING(")"));
|
||||||
@ -4756,18 +4755,11 @@ static void
|
|||||||
GetTagName(nsFrame* aFrame, nsIContent* aContent, PRIntn aResultSize,
|
GetTagName(nsFrame* aFrame, nsIContent* aContent, PRIntn aResultSize,
|
||||||
char* aResult)
|
char* aResult)
|
||||||
{
|
{
|
||||||
char namebuf[40];
|
const char *nameStr = "";
|
||||||
namebuf[0] = 0;
|
|
||||||
if (aContent) {
|
if (aContent) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
aContent->Tag()->GetUTF8String(&nameStr);
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
if (tag) {
|
|
||||||
nsAutoString tmp;
|
|
||||||
tag->ToString(tmp);
|
|
||||||
tmp.ToCString(namebuf, sizeof(namebuf));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
PR_snprintf(aResult, aResultSize, "%s@%p", namebuf, aFrame);
|
PR_snprintf(aResult, aResultSize, "%s@%p", nameStr, aFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@ -335,10 +335,6 @@ public:
|
|||||||
const nsRect& aDamageRect,
|
const nsRect& aDamageRect,
|
||||||
PRBool aImmediate = PR_FALSE) const;
|
PRBool aImmediate = PR_FALSE) const;
|
||||||
|
|
||||||
// Helper function to return the index in parent of the frame's content
|
|
||||||
// object. Returns -1 on error or if the frame doesn't have a content object
|
|
||||||
static PRInt32 ContentIndexInContainer(const nsIFrame* aFrame);
|
|
||||||
|
|
||||||
// Helper function that tests if the frame tree is too deep; if it
|
// Helper function that tests if the frame tree is too deep; if it
|
||||||
// is it marks the frame as "unflowable" and zeros out the metrics
|
// is it marks the frame as "unflowable" and zeros out the metrics
|
||||||
// and returns PR_TRUE. Otherwise, the frame is unmarked
|
// and returns PR_TRUE. Otherwise, the frame is unmarked
|
||||||
@ -420,6 +416,10 @@ public:
|
|||||||
// NS_FRAME_IS_DIRTY bit set
|
// NS_FRAME_IS_DIRTY bit set
|
||||||
static void VerifyDirtyBitSet(nsIFrame* aFrameList);
|
static void VerifyDirtyBitSet(nsIFrame* aFrameList);
|
||||||
|
|
||||||
|
// Helper function to return the index in parent of the frame's content
|
||||||
|
// object. Returns -1 on error or if the frame doesn't have a content object
|
||||||
|
static PRInt32 ContentIndexInContainer(const nsIFrame* aFrame);
|
||||||
|
|
||||||
void ListTag(FILE* out) const {
|
void ListTag(FILE* out) const {
|
||||||
ListTag(out, (nsIFrame*)this);
|
ListTag(out, (nsIFrame*)this);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -605,8 +605,7 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||||||
nsIAtom* aAttribute,
|
nsIAtom* aAttribute,
|
||||||
PRInt32 aModType)
|
PRInt32 aModType)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> type;
|
nsIAtom *type = aChild->Tag();
|
||||||
aChild->GetTag(getter_AddRefs(type));
|
|
||||||
|
|
||||||
if ((type != nsHTMLAtoms::object && aAttribute == nsHTMLAtoms::src) ||
|
if ((type != nsHTMLAtoms::object && aAttribute == nsHTMLAtoms::src) ||
|
||||||
(type == nsHTMLAtoms::object && aAttribute == nsHTMLAtoms::data)) {
|
(type == nsHTMLAtoms::object && aAttribute == nsHTMLAtoms::data)) {
|
||||||
@ -619,10 +618,7 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||||||
}
|
}
|
||||||
// If the noResize attribute changes, dis/allow frame to be resized
|
// If the noResize attribute changes, dis/allow frame to be resized
|
||||||
else if (aAttribute == nsHTMLAtoms::noresize) {
|
else if (aAttribute == nsHTMLAtoms::noresize) {
|
||||||
nsCOMPtr<nsIAtom> parentTag;
|
if (mContent->GetParent()->Tag() == nsHTMLAtoms::frameset) {
|
||||||
mContent->GetParent()->GetTag(getter_AddRefs(parentTag));
|
|
||||||
|
|
||||||
if (parentTag == nsHTMLAtoms::frameset) {
|
|
||||||
nsIFrame* parentFrame = GetParent();
|
nsIFrame* parentFrame = GetParent();
|
||||||
|
|
||||||
if (parentFrame) {
|
if (parentFrame) {
|
||||||
@ -750,10 +746,8 @@ nsHTMLFrameInnerFrame::Destroy(nsIPresContext* aPresContext)
|
|||||||
PRBool nsHTMLFrameInnerFrame::GetURL(nsIContent* aContent, nsString& aResult)
|
PRBool nsHTMLFrameInnerFrame::GetURL(nsIContent* aContent, nsString& aResult)
|
||||||
{
|
{
|
||||||
aResult.SetLength(0);
|
aResult.SetLength(0);
|
||||||
nsCOMPtr<nsIAtom> type;
|
|
||||||
aContent->GetTag(getter_AddRefs(type));
|
|
||||||
|
|
||||||
if (type.get() == nsHTMLAtoms::object) {
|
if (aContent->Tag() == nsHTMLAtoms::object) {
|
||||||
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, aResult)))
|
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, aResult)))
|
||||||
if (!aResult.IsEmpty())
|
if (!aResult.IsEmpty())
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
|
|||||||
@ -399,8 +399,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
|
|||||||
if (!child->IsContentOfType(nsIContent::eHTML))
|
if (!child->IsContentOfType(nsIContent::eHTML))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = child->Tag();
|
||||||
child->GetTag(getter_AddRefs(tag));
|
|
||||||
if (tag == nsHTMLAtoms::frameset || tag == nsHTMLAtoms::frame) {
|
if (tag == nsHTMLAtoms::frameset || tag == nsHTMLAtoms::frame) {
|
||||||
nsRefPtr<nsStyleContext> kidSC;
|
nsRefPtr<nsStyleContext> kidSC;
|
||||||
nsresult result;
|
nsresult result;
|
||||||
@ -719,14 +718,10 @@ nsHTMLFramesetFrame* nsHTMLFramesetFrame::GetFramesetParent(nsIFrame* aChild)
|
|||||||
if (content) {
|
if (content) {
|
||||||
nsCOMPtr<nsIContent> contentParent = content->GetParent();
|
nsCOMPtr<nsIContent> contentParent = content->GetParent();
|
||||||
|
|
||||||
if (contentParent && contentParent->IsContentOfType(nsIContent::eHTML)) {
|
if (contentParent && contentParent->IsContentOfType(nsIContent::eHTML) &&
|
||||||
nsCOMPtr<nsIAtom> tag;
|
contentParent->Tag() == nsHTMLAtoms::frameset) {
|
||||||
contentParent->GetTag(getter_AddRefs(tag));
|
nsIFrame* fptr = aChild->GetParent();
|
||||||
|
parent = (nsHTMLFramesetFrame*) fptr;
|
||||||
if (tag == nsHTMLAtoms::frameset) {
|
|
||||||
nsIFrame* fptr = aChild->GetParent();
|
|
||||||
parent = (nsHTMLFramesetFrame*) fptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1451,16 +1451,14 @@ CalcQuirkContainingBlockHeight(const nsHTMLReflowState& aReflowState)
|
|||||||
if (firstAncestorRS) {
|
if (firstAncestorRS) {
|
||||||
nsIContent* frameContent = firstAncestorRS->frame->GetContent();
|
nsIContent* frameContent = firstAncestorRS->frame->GetContent();
|
||||||
if (frameContent) {
|
if (frameContent) {
|
||||||
nsCOMPtr<nsIAtom> contentTag;
|
nsIAtom *contentTag = frameContent->Tag();
|
||||||
frameContent->GetTag(getter_AddRefs(contentTag));
|
|
||||||
NS_ASSERTION(contentTag == nsHTMLAtoms::html, "First ancestor is not HTML");
|
NS_ASSERTION(contentTag == nsHTMLAtoms::html, "First ancestor is not HTML");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (secondAncestorRS) {
|
if (secondAncestorRS) {
|
||||||
nsIContent* frameContent = secondAncestorRS->frame->GetContent();
|
nsIContent* frameContent = secondAncestorRS->frame->GetContent();
|
||||||
if (frameContent) {
|
if (frameContent) {
|
||||||
nsCOMPtr<nsIAtom> contentTag;
|
nsIAtom *contentTag = frameContent->Tag();
|
||||||
frameContent->GetTag(getter_AddRefs(contentTag));
|
|
||||||
NS_ASSERTION(contentTag == nsHTMLAtoms::body, "Second ancestor is not BODY");
|
NS_ASSERTION(contentTag == nsHTMLAtoms::body, "Second ancestor is not BODY");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1211,13 +1211,10 @@ nsImageFrame::DisplayAltFeedback(nsIPresContext* aPresContext,
|
|||||||
if (!inner.IsEmpty()) {
|
if (!inner.IsEmpty()) {
|
||||||
nsIContent* content = GetContent();
|
nsIContent* content = GetContent();
|
||||||
if (content) {
|
if (content) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsAutoString altText;
|
||||||
content->GetTag(getter_AddRefs(tag));
|
nsCSSFrameConstructor::GetAlternateTextFor(content, content->Tag(),
|
||||||
if (tag) {
|
altText);
|
||||||
nsAutoString altText;
|
DisplayAltText(aPresContext, aRenderingContext, altText, inner);
|
||||||
nsCSSFrameConstructor::GetAlternateTextFor(content, tag, altText);
|
|
||||||
DisplayAltText(aPresContext, aRenderingContext, altText, inner);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -882,10 +882,10 @@ NS_IMETHODIMP nsInlineFrame::GetAccessible(nsIAccessible** aAccessible)
|
|||||||
// Broken image accessibles are created here, because layout
|
// Broken image accessibles are created here, because layout
|
||||||
// replaces the image or image control frame with an inline frame
|
// replaces the image or image control frame with an inline frame
|
||||||
*aAccessible = nsnull;
|
*aAccessible = nsnull;
|
||||||
nsCOMPtr<nsIAtom> tagAtom;
|
nsIAtom *tagAtom = mContent->Tag();
|
||||||
mContent->GetTag(getter_AddRefs(tagAtom));
|
if ((tagAtom == nsHTMLAtoms::img || tagAtom == nsHTMLAtoms::input ||
|
||||||
if (tagAtom == nsHTMLAtoms::img || tagAtom == nsHTMLAtoms::input ||
|
tagAtom == nsHTMLAtoms::label || tagAtom == nsHTMLAtoms::hr) &&
|
||||||
tagAtom == nsHTMLAtoms::label || tagAtom == nsHTMLAtoms::hr) {
|
mContent->IsContentOfType(nsIContent::eHTML)) {
|
||||||
// Only get accessibility service if we're going to use it
|
// Only get accessibility service if we're going to use it
|
||||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||||
if (!accService)
|
if (!accService)
|
||||||
|
|||||||
@ -2464,25 +2464,23 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||||||
if (!applyMinLH && (isFirstLine || isLastLine)) {
|
if (!applyMinLH && (isFirstLine || isLastLine)) {
|
||||||
nsIContent* blockContent = mRootSpan->mFrame->mFrame->GetContent();
|
nsIContent* blockContent = mRootSpan->mFrame->mFrame->GetContent();
|
||||||
if (blockContent) {
|
if (blockContent) {
|
||||||
nsCOMPtr<nsIAtom> blockTagAtom;
|
nsIAtom *blockTagAtom = blockContent->Tag();
|
||||||
nsresult result = blockContent->GetTag(getter_AddRefs(blockTagAtom));
|
// (2) above, if the first line of LI
|
||||||
if ( NS_SUCCEEDED(result) && blockTagAtom) {
|
if (isFirstLine && blockTagAtom == nsHTMLAtoms::li) {
|
||||||
// (2) above, if the first line of LI
|
// if the line is empty, then don't force the min height
|
||||||
if (isFirstLine && blockTagAtom.get() == nsHTMLAtoms::li) {
|
// (see bug 75963)
|
||||||
// if the line is empty, then don't force the min height (see bug 75963)
|
if (!IsZeroHeight()) {
|
||||||
if (!IsZeroHeight()) {
|
|
||||||
applyMinLH = PR_TRUE;
|
|
||||||
foundLI = PR_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// (3) above, if the last line of LI, DT, or DD
|
|
||||||
else if (!applyMinLH && isLastLine &&
|
|
||||||
((blockTagAtom.get() == nsHTMLAtoms::li) ||
|
|
||||||
(blockTagAtom.get() == nsHTMLAtoms::dt) ||
|
|
||||||
(blockTagAtom.get() == nsHTMLAtoms::dd))) {
|
|
||||||
applyMinLH = PR_TRUE;
|
applyMinLH = PR_TRUE;
|
||||||
|
foundLI = PR_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// (3) above, if the last line of LI, DT, or DD
|
||||||
|
else if (!applyMinLH && isLastLine &&
|
||||||
|
((blockTagAtom == nsHTMLAtoms::li) ||
|
||||||
|
(blockTagAtom == nsHTMLAtoms::dt) ||
|
||||||
|
(blockTagAtom == nsHTMLAtoms::dd))) {
|
||||||
|
applyMinLH = PR_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (applyMinLH) {
|
if (applyMinLH) {
|
||||||
|
|||||||
@ -492,13 +492,11 @@ PRBool nsObjectFrame::IsSupportedImage(nsIContent* aContent)
|
|||||||
PRBool haveType = (rv == NS_CONTENT_ATTR_HAS_VALUE) && (!type.IsEmpty());
|
PRBool haveType = (rv == NS_CONTENT_ATTR_HAS_VALUE) && (!type.IsEmpty());
|
||||||
if (!haveType)
|
if (!haveType)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
nsAutoString data;
|
nsAutoString data;
|
||||||
|
|
||||||
// If this is an OBJECT tag, we should look for a DATA attribute.
|
// If this is an OBJECT tag, we should look for a DATA attribute.
|
||||||
// If not, it's an EMBED tag, and so we should look for a SRC attribute.
|
// If not, it's an EMBED tag, and so we should look for a SRC attribute.
|
||||||
if (tag == nsHTMLAtoms::object)
|
if (aContent->Tag() == nsHTMLAtoms::object)
|
||||||
rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, data);
|
rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, data);
|
||||||
else
|
else
|
||||||
rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, data);
|
rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, data);
|
||||||
@ -635,19 +633,17 @@ nsObjectFrame::Init(nsIPresContext* aPresContext,
|
|||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
nsAutoString data;
|
nsAutoString data;
|
||||||
|
|
||||||
// If this is an OBJECT tag, we should look for a DATA attribute.
|
// If this is an OBJECT tag, we should look for a DATA attribute.
|
||||||
// If not, it's an EMBED tag, and so we should look for a SRC attribute.
|
// If not, it's an EMBED tag, and so we should look for a SRC attribute.
|
||||||
if (tag == nsHTMLAtoms::object)
|
if (aContent->Tag() == nsHTMLAtoms::object)
|
||||||
rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, data);
|
rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, data);
|
||||||
else
|
else
|
||||||
rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, data);
|
rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, data);
|
||||||
|
|
||||||
imageLoader->ImageURIChanged(data);
|
imageLoader->ImageURIChanged(data);
|
||||||
|
|
||||||
nsCOMPtr<nsIPresShell> shell;
|
nsCOMPtr<nsIPresShell> shell;
|
||||||
aPresContext->GetShell(getter_AddRefs(shell));
|
aPresContext->GetShell(getter_AddRefs(shell));
|
||||||
nsIFrame * aNewFrame = nsnull;
|
nsIFrame * aNewFrame = nsnull;
|
||||||
@ -671,9 +667,8 @@ nsObjectFrame::Init(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
|
|
||||||
// only do the following for the object tag
|
// only do the following for the object tag
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (aContent->Tag() != nsHTMLAtoms::object)
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
return rv;
|
||||||
if (tag.get() != nsHTMLAtoms::object) return rv;
|
|
||||||
|
|
||||||
// for now, we should try to do the same for "document" types and create
|
// for now, we should try to do the same for "document" types and create
|
||||||
// and IFrame-like sub-frame
|
// and IFrame-like sub-frame
|
||||||
@ -915,8 +910,7 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||||||
aMetrics.height = aReflowState.mComputedHeight;
|
aMetrics.height = aReflowState.mComputedHeight;
|
||||||
|
|
||||||
// for EMBED and APPLET, default to 240x200 for compatibility
|
// for EMBED and APPLET, default to 240x200 for compatibility
|
||||||
nsCOMPtr<nsIAtom> atom;
|
nsIAtom *atom = mContent->Tag();
|
||||||
mContent->GetTag(getter_AddRefs(atom));
|
|
||||||
if (atom == nsHTMLAtoms::applet || atom == nsHTMLAtoms::embed) {
|
if (atom == nsHTMLAtoms::applet || atom == nsHTMLAtoms::embed) {
|
||||||
float p2t;
|
float p2t;
|
||||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||||
@ -1116,9 +1110,8 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
mInstanceOwner->SetPluginHost(pluginHost);
|
mInstanceOwner->SetPluginHost(pluginHost);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = mContent->Tag();
|
||||||
mContent->GetTag(getter_AddRefs(tag));
|
if (tag == nsHTMLAtoms::applet) {
|
||||||
if (tag.get() == nsHTMLAtoms::applet) {
|
|
||||||
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::code, src)) {
|
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::code, src)) {
|
||||||
// Create an absolute URL
|
// Create an absolute URL
|
||||||
rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURL);
|
rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURL);
|
||||||
@ -1409,25 +1402,29 @@ nsObjectFrame::IsHidden(PRBool aCheckVisibilityStyle) const
|
|||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
mContent->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
// only <embed> tags support the HIDDEN attribute
|
// only <embed> tags support the HIDDEN attribute
|
||||||
if (tag.get() == nsHTMLAtoms::embed) {
|
if (mContent->Tag() == nsHTMLAtoms::embed) {
|
||||||
nsAutoString hidden;
|
nsAutoString hidden;
|
||||||
nsresult result = mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::hidden, hidden);
|
nsresult result = mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::hidden, hidden);
|
||||||
|
|
||||||
// Yes, these are really the kooky ways that you could tell 4.x
|
// Yes, these are really the kooky ways that you could tell 4.x
|
||||||
// not to hide the <embed> once you'd put the 'hidden' attribute
|
// not to hide the <embed> once you'd put the 'hidden' attribute
|
||||||
// on the tag...
|
// on the tag...
|
||||||
// these |NS_ConvertASCIItoUCS2|s can't be |NS_LITERAL_STRING|s until |EqualsIgnoreCase| get's fixed
|
|
||||||
// HIDDEN w/ no attributes gets translated as we are hidden for compatibility
|
// these |NS_ConvertASCIItoUCS2|s can't be |NS_LITERAL_STRING|s
|
||||||
// w/ 4.x and IE so we don't create a non-painting widget in layout. See bug 188959.
|
// until |EqualsIgnoreCase| get's fixed
|
||||||
|
|
||||||
|
// HIDDEN w/ no attributes gets translated as we are hidden for
|
||||||
|
// compatibility w/ 4.x and IE so we don't create a non-painting
|
||||||
|
// widget in layout. See bug 188959.
|
||||||
if (NS_CONTENT_ATTR_NOT_THERE != result &&
|
if (NS_CONTENT_ATTR_NOT_THERE != result &&
|
||||||
(hidden.IsEmpty() ||
|
(hidden.IsEmpty() ||
|
||||||
!hidden.Equals(NS_LITERAL_STRING("false"), nsCaseInsensitiveStringComparator()) &&
|
!hidden.Equals(NS_LITERAL_STRING("false"),
|
||||||
!hidden.Equals(NS_LITERAL_STRING("no"), nsCaseInsensitiveStringComparator()) &&
|
nsCaseInsensitiveStringComparator()) &&
|
||||||
!hidden.Equals(NS_LITERAL_STRING("off"), nsCaseInsensitiveStringComparator()))) {
|
!hidden.Equals(NS_LITERAL_STRING("no"),
|
||||||
|
nsCaseInsensitiveStringComparator()) &&
|
||||||
|
!hidden.Equals(NS_LITERAL_STRING("off"),
|
||||||
|
nsCaseInsensitiveStringComparator()))) {
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2520,20 +2517,16 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetTagType(nsPluginTagType *result)
|
|||||||
nsIContent* cont = mOwner->GetContent();
|
nsIContent* cont = mOwner->GetContent();
|
||||||
if (cont)
|
if (cont)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> atom;
|
nsIAtom *atom = cont->Tag();
|
||||||
cont->GetTag(getter_AddRefs(atom));
|
|
||||||
|
|
||||||
if (atom)
|
if (atom == nsHTMLAtoms::applet)
|
||||||
{
|
*result = nsPluginTagType_Applet;
|
||||||
if (atom == nsHTMLAtoms::applet)
|
else if (atom == nsHTMLAtoms::embed)
|
||||||
*result = nsPluginTagType_Applet;
|
*result = nsPluginTagType_Embed;
|
||||||
else if (atom == nsHTMLAtoms::embed)
|
else if (atom == nsHTMLAtoms::object)
|
||||||
*result = nsPluginTagType_Embed;
|
*result = nsPluginTagType_Object;
|
||||||
else if (atom == nsHTMLAtoms::object)
|
|
||||||
*result = nsPluginTagType_Object;
|
|
||||||
|
|
||||||
rv = NS_OK;
|
rv = NS_OK;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3030,9 +3023,8 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
|
|||||||
// to the bottom of the array if there isn't already a "src" specified.
|
// to the bottom of the array if there isn't already a "src" specified.
|
||||||
PRInt16 numRealAttrs = mNumCachedAttrs;
|
PRInt16 numRealAttrs = mNumCachedAttrs;
|
||||||
nsAutoString data;
|
nsAutoString data;
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = content->Tag();
|
||||||
content->GetTag(getter_AddRefs(tag));
|
if (nsHTMLAtoms::object == tag
|
||||||
if (nsHTMLAtoms::object == tag.get()
|
|
||||||
&& !content->HasAttr(kNameSpaceID_None, nsHTMLAtoms::src)
|
&& !content->HasAttr(kNameSpaceID_None, nsHTMLAtoms::src)
|
||||||
&& NS_CONTENT_ATTR_NOT_THERE != content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, data)) {
|
&& NS_CONTENT_ATTR_NOT_THERE != content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, data)) {
|
||||||
mNumCachedAttrs++;
|
mNumCachedAttrs++;
|
||||||
|
|||||||
@ -148,7 +148,7 @@ struct nsScrollSelectionIntoViewEvent;
|
|||||||
PRBool IsValidSelectionPoint(nsSelection *aFrameSel, nsIContent *aContent);
|
PRBool IsValidSelectionPoint(nsSelection *aFrameSel, nsIContent *aContent);
|
||||||
PRBool IsValidSelectionPoint(nsSelection *aFrameSel, nsIDOMNode *aDomNode);
|
PRBool IsValidSelectionPoint(nsSelection *aFrameSel, nsIDOMNode *aDomNode);
|
||||||
|
|
||||||
static nsCOMPtr<nsIAtom> GetTag(nsIDOMNode *aNode);
|
static nsIAtom *GetTag(nsIDOMNode *aNode);
|
||||||
static nsresult ParentOffset(nsIDOMNode *aNode, nsIDOMNode **aParent, PRInt32 *aChildOffset);
|
static nsresult ParentOffset(nsIDOMNode *aNode, nsIDOMNode **aParent, PRInt32 *aChildOffset);
|
||||||
static nsIDOMNode *GetCellParent(nsIDOMNode *aDomNode);
|
static nsIDOMNode *GetCellParent(nsIDOMNode *aDomNode);
|
||||||
|
|
||||||
@ -1330,21 +1330,17 @@ void printRange(nsIDOMRange *aDomRange)
|
|||||||
}
|
}
|
||||||
#endif /* PRINT_RANGE */
|
#endif /* PRINT_RANGE */
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> GetTag(nsIDOMNode *aNode)
|
static
|
||||||
|
nsIAtom *GetTag(nsIDOMNode *aNode)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> atom;
|
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||||
|
if (!content)
|
||||||
if (!aNode)
|
|
||||||
{
|
{
|
||||||
NS_NOTREACHED("null node passed to GetTag()");
|
NS_NOTREACHED("bad node passed to GetTag()");
|
||||||
return atom;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
return content->Tag();
|
||||||
if (content)
|
|
||||||
content->GetTag(getter_AddRefs(atom));
|
|
||||||
|
|
||||||
return atom;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
@ -1376,7 +1372,7 @@ GetCellParent(nsIDOMNode *aDomNode)
|
|||||||
nsCOMPtr<nsIDOMNode> parent(aDomNode);
|
nsCOMPtr<nsIDOMNode> parent(aDomNode);
|
||||||
nsCOMPtr<nsIDOMNode> current(aDomNode);
|
nsCOMPtr<nsIDOMNode> current(aDomNode);
|
||||||
PRInt32 childOffset;
|
PRInt32 childOffset;
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag;
|
||||||
// Start with current node and look for a table cell
|
// Start with current node and look for a table cell
|
||||||
while(current)
|
while(current)
|
||||||
{
|
{
|
||||||
@ -3289,9 +3285,8 @@ nsSelection::FrameOrParentHasSpecialSelectionStyle(nsIFrame* aFrame, PRUint8 aSe
|
|||||||
|
|
||||||
static PRBool IsCell(nsIContent *aContent)
|
static PRBool IsCell(nsIContent *aContent)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> tag;
|
return (aContent->Tag() == nsHTMLAtoms::td &&
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
aContent->IsContentOfType(nsIContent::eHTML));
|
||||||
return (tag == nsHTMLAtoms::td);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsITableCellLayout*
|
nsITableCellLayout*
|
||||||
@ -4057,11 +4052,10 @@ nsSelection::GetParentTable(nsIContent *aCell, nsIContent **aTable)
|
|||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
for (nsIContent* parent = aCell->GetParent(); parent;
|
for (nsIContent* parent = aCell->GetParent(); parent;
|
||||||
parent = parent->GetParent()) {
|
parent = parent->GetParent()) {
|
||||||
parent->GetTag(getter_AddRefs(tag));
|
if (parent->Tag() == nsHTMLAtoms::table &&
|
||||||
if (tag == nsHTMLAtoms::table) {
|
parent->IsContentOfType(nsIContent::eHTML)) {
|
||||||
*aTable = parent;
|
*aTable = parent;
|
||||||
NS_ADDREF(*aTable);
|
NS_ADDREF(*aTable);
|
||||||
|
|
||||||
@ -4259,11 +4253,13 @@ nsTypedSelection::GetTableSelectionType(nsIDOMRange* aRange, PRInt32* aTableSele
|
|||||||
if ((endOffset - startOffset) != 1)
|
if ((endOffset - startOffset) != 1)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> atom;
|
if (!content->IsContentOfType(nsIContent::eHTML)) {
|
||||||
content->GetTag(getter_AddRefs(atom));
|
return NS_OK;
|
||||||
if (!atom) return NS_ERROR_FAILURE;
|
}
|
||||||
|
|
||||||
if (atom == nsHTMLAtoms::tr)
|
nsIAtom *tag = content->Tag();
|
||||||
|
|
||||||
|
if (tag == nsHTMLAtoms::tr)
|
||||||
{
|
{
|
||||||
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_CELL;
|
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_CELL;
|
||||||
}
|
}
|
||||||
@ -4273,13 +4269,14 @@ nsTypedSelection::GetTableSelectionType(nsIDOMRange* aRange, PRInt32* aTableSele
|
|||||||
if (!child)
|
if (!child)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
child->GetTag(getter_AddRefs(atom));
|
tag = child->Tag();
|
||||||
|
|
||||||
if (atom == nsHTMLAtoms::table)
|
if (tag == nsHTMLAtoms::table)
|
||||||
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_TABLE;
|
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_TABLE;
|
||||||
else if (atom == nsHTMLAtoms::tr)
|
else if (tag == nsHTMLAtoms::tr)
|
||||||
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_ROW;
|
*aTableSelectionType = nsISelectionPrivate::TABLESELECTION_ROW;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5945,16 +5942,10 @@ nsTypedSelection::Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset)
|
|||||||
content = do_QueryInterface(aParentNode);
|
content = do_QueryInterface(aParentNode);
|
||||||
if (!content)
|
if (!content)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
content->GetTag(getter_AddRefs(tag));
|
const char *tagString;
|
||||||
if (tag)
|
content->Tag()->GetUTF8String(&tagString);
|
||||||
{
|
printf ("Sel. Collapse to %p %s %d\n", content, tagString, aOffset);
|
||||||
nsAutoString tagString;
|
|
||||||
tag->ToString(tagString);
|
|
||||||
char * tagCString = ToNewCString(tagString);
|
|
||||||
printf ("Sel. Collapse to %p %s %d\n", content, tagCString, aOffset);
|
|
||||||
delete [] tagCString;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf ("Sel. Collapse set to null parent.\n");
|
printf ("Sel. Collapse set to null parent.\n");
|
||||||
@ -6135,8 +6126,7 @@ nsTypedSelection::FixupSelectionPoints(nsIDOMRange *aRange , nsDirection *aDir,
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
// if end node is a tbody then all bets are off we cannot select "rows"
|
// if end node is a tbody then all bets are off we cannot select "rows"
|
||||||
nsCOMPtr<nsIAtom> atom;
|
nsIAtom *atom = GetTag(endNode);
|
||||||
atom = GetTag(endNode);
|
|
||||||
if (atom == nsHTMLAtoms::tbody)
|
if (atom == nsHTMLAtoms::tbody)
|
||||||
return NS_ERROR_FAILURE; //cannot select INTO row node ony cells
|
return NS_ERROR_FAILURE; //cannot select INTO row node ony cells
|
||||||
|
|
||||||
@ -6719,7 +6709,6 @@ nsTypedSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset)
|
|||||||
res = CopyRangeToAnchorFocus(range);
|
res = CopyRangeToAnchorFocus(range);
|
||||||
if (NS_FAILED(res))
|
if (NS_FAILED(res))
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_OUT_RANGE(range);
|
DEBUG_OUT_RANGE(range);
|
||||||
@ -6735,16 +6724,10 @@ nsTypedSelection::Extend(nsIDOMNode* aParentNode, PRInt32 aOffset)
|
|||||||
{
|
{
|
||||||
nsCOMPtr<nsIContent>content;
|
nsCOMPtr<nsIContent>content;
|
||||||
content = do_QueryInterface(aParentNode);
|
content = do_QueryInterface(aParentNode);
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
content->GetTag(getter_AddRefs(tag));
|
const char *tagString;
|
||||||
if (tag)
|
content->Tag()->GetUTF8String(&tagString);
|
||||||
{
|
printf ("Sel. Extend to %p %s %d\n", content, tagString, aOffset);
|
||||||
nsAutoString tagString;
|
|
||||||
tag->ToString(tagString);
|
|
||||||
char * tagCString = ToNewCString(tagString);
|
|
||||||
printf ("Sel. Extend to %p %s %d\n", content, tagCString, aOffset);
|
|
||||||
delete [] tagCString;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf ("Sel. Extend set to null parent.\n");
|
printf ("Sel. Extend set to null parent.\n");
|
||||||
|
|||||||
@ -40,6 +40,7 @@
|
|||||||
#include "nsStyleConsts.h"
|
#include "nsStyleConsts.h"
|
||||||
#include "nsIPresContext.h"
|
#include "nsIPresContext.h"
|
||||||
#include "nsIViewManager.h"
|
#include "nsIViewManager.h"
|
||||||
|
#include "nsINodeInfo.h"
|
||||||
#include "nsHTMLAtoms.h"
|
#include "nsHTMLAtoms.h"
|
||||||
#include "nsIView.h"
|
#include "nsIView.h"
|
||||||
#include "nsHTMLValue.h"
|
#include "nsHTMLValue.h"
|
||||||
@ -87,18 +88,10 @@ nsAreaFrame::RegUnregAccessKey(nsIPresContext* aPresContext,
|
|||||||
if (!mContent)
|
if (!mContent)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
PRBool isXUL = mContent->IsContentOfType(nsIContent::eXUL);
|
nsINodeInfo *ni = mContent->GetNodeInfo();
|
||||||
if (!isXUL)
|
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
// find out what type of element this is
|
|
||||||
nsCOMPtr<nsIAtom> atom;
|
|
||||||
nsresult rv = mContent->GetTag(getter_AddRefs(atom));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
// only support accesskeys for the following elements
|
// only support accesskeys for the following elements
|
||||||
if (atom != nsXULAtoms::label)
|
if (!ni || !ni->Equals(nsXULAtoms::label, kNameSpaceID_XUL))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
// To filter out <label>s without a control attribute.
|
// To filter out <label>s without a control attribute.
|
||||||
@ -120,7 +113,7 @@ nsAreaFrame::RegUnregAccessKey(nsIPresContext* aPresContext,
|
|||||||
nsCOMPtr<nsIEventStateManager> esm;
|
nsCOMPtr<nsIEventStateManager> esm;
|
||||||
aPresContext->GetEventStateManager(getter_AddRefs(esm));
|
aPresContext->GetEventStateManager(getter_AddRefs(esm));
|
||||||
|
|
||||||
rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
if (esm) {
|
if (esm) {
|
||||||
PRUint32 key = accessKey.First();
|
PRUint32 key = accessKey.First();
|
||||||
|
|||||||
@ -2632,6 +2632,8 @@ NS_IMETHODIMP nsFrame::IsPercentageBase(PRBool& aBase) const
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NS_DEBUG
|
||||||
|
|
||||||
PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame)
|
PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame)
|
||||||
{
|
{
|
||||||
PRInt32 result = -1;
|
PRInt32 result = -1;
|
||||||
@ -2647,8 +2649,6 @@ PRInt32 nsFrame::ContentIndexInContainer(const nsIFrame* aFrame)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NS_DEBUG
|
|
||||||
|
|
||||||
#ifdef DEBUG_waterson
|
#ifdef DEBUG_waterson
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2707,10 +2707,9 @@ nsresult
|
|||||||
nsFrame::MakeFrameName(const nsAString& aType, nsAString& aResult) const
|
nsFrame::MakeFrameName(const nsAString& aType, nsAString& aResult) const
|
||||||
{
|
{
|
||||||
aResult = aType;
|
aResult = aType;
|
||||||
if (nsnull != mContent) {
|
if (mContent) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = mContent->Tag();
|
||||||
mContent->GetTag(getter_AddRefs(tag));
|
if (tag != nsLayoutAtoms::textTagName) {
|
||||||
if (tag && tag != nsLayoutAtoms::textTagName) {
|
|
||||||
nsAutoString buf;
|
nsAutoString buf;
|
||||||
tag->ToString(buf);
|
tag->ToString(buf);
|
||||||
aResult.Append(NS_LITERAL_STRING("(") + buf + NS_LITERAL_STRING(")"));
|
aResult.Append(NS_LITERAL_STRING("(") + buf + NS_LITERAL_STRING(")"));
|
||||||
@ -4756,18 +4755,11 @@ static void
|
|||||||
GetTagName(nsFrame* aFrame, nsIContent* aContent, PRIntn aResultSize,
|
GetTagName(nsFrame* aFrame, nsIContent* aContent, PRIntn aResultSize,
|
||||||
char* aResult)
|
char* aResult)
|
||||||
{
|
{
|
||||||
char namebuf[40];
|
const char *nameStr = "";
|
||||||
namebuf[0] = 0;
|
|
||||||
if (aContent) {
|
if (aContent) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
aContent->Tag()->GetUTF8String(&nameStr);
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
if (tag) {
|
|
||||||
nsAutoString tmp;
|
|
||||||
tag->ToString(tmp);
|
|
||||||
tmp.ToCString(namebuf, sizeof(namebuf));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
PR_snprintf(aResult, aResultSize, "%s@%p", namebuf, aFrame);
|
PR_snprintf(aResult, aResultSize, "%s@%p", nameStr, aFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@ -335,10 +335,6 @@ public:
|
|||||||
const nsRect& aDamageRect,
|
const nsRect& aDamageRect,
|
||||||
PRBool aImmediate = PR_FALSE) const;
|
PRBool aImmediate = PR_FALSE) const;
|
||||||
|
|
||||||
// Helper function to return the index in parent of the frame's content
|
|
||||||
// object. Returns -1 on error or if the frame doesn't have a content object
|
|
||||||
static PRInt32 ContentIndexInContainer(const nsIFrame* aFrame);
|
|
||||||
|
|
||||||
// Helper function that tests if the frame tree is too deep; if it
|
// Helper function that tests if the frame tree is too deep; if it
|
||||||
// is it marks the frame as "unflowable" and zeros out the metrics
|
// is it marks the frame as "unflowable" and zeros out the metrics
|
||||||
// and returns PR_TRUE. Otherwise, the frame is unmarked
|
// and returns PR_TRUE. Otherwise, the frame is unmarked
|
||||||
@ -420,6 +416,10 @@ public:
|
|||||||
// NS_FRAME_IS_DIRTY bit set
|
// NS_FRAME_IS_DIRTY bit set
|
||||||
static void VerifyDirtyBitSet(nsIFrame* aFrameList);
|
static void VerifyDirtyBitSet(nsIFrame* aFrameList);
|
||||||
|
|
||||||
|
// Helper function to return the index in parent of the frame's content
|
||||||
|
// object. Returns -1 on error or if the frame doesn't have a content object
|
||||||
|
static PRInt32 ContentIndexInContainer(const nsIFrame* aFrame);
|
||||||
|
|
||||||
void ListTag(FILE* out) const {
|
void ListTag(FILE* out) const {
|
||||||
ListTag(out, (nsIFrame*)this);
|
ListTag(out, (nsIFrame*)this);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -621,10 +621,10 @@ FrameManager::GetPrimaryFrameFor(nsIContent* aContent, nsIFrame** aResult)
|
|||||||
if (index > 0) // no use looking if it's the first child
|
if (index > 0) // no use looking if it's the first child
|
||||||
{
|
{
|
||||||
nsIContent *prevSibling;
|
nsIContent *prevSibling;
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag;
|
||||||
do {
|
do {
|
||||||
prevSibling = parent->GetChildAt(--index);
|
prevSibling = parent->GetChildAt(--index);
|
||||||
prevSibling->GetTag(getter_AddRefs(tag));
|
tag = prevSibling->Tag();
|
||||||
} while (index &&
|
} while (index &&
|
||||||
(tag == nsLayoutAtoms::textTagName ||
|
(tag == nsLayoutAtoms::textTagName ||
|
||||||
tag == nsLayoutAtoms::commentTagName ||
|
tag == nsLayoutAtoms::commentTagName ||
|
||||||
|
|||||||
@ -1451,16 +1451,14 @@ CalcQuirkContainingBlockHeight(const nsHTMLReflowState& aReflowState)
|
|||||||
if (firstAncestorRS) {
|
if (firstAncestorRS) {
|
||||||
nsIContent* frameContent = firstAncestorRS->frame->GetContent();
|
nsIContent* frameContent = firstAncestorRS->frame->GetContent();
|
||||||
if (frameContent) {
|
if (frameContent) {
|
||||||
nsCOMPtr<nsIAtom> contentTag;
|
nsIAtom *contentTag = frameContent->Tag();
|
||||||
frameContent->GetTag(getter_AddRefs(contentTag));
|
|
||||||
NS_ASSERTION(contentTag == nsHTMLAtoms::html, "First ancestor is not HTML");
|
NS_ASSERTION(contentTag == nsHTMLAtoms::html, "First ancestor is not HTML");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (secondAncestorRS) {
|
if (secondAncestorRS) {
|
||||||
nsIContent* frameContent = secondAncestorRS->frame->GetContent();
|
nsIContent* frameContent = secondAncestorRS->frame->GetContent();
|
||||||
if (frameContent) {
|
if (frameContent) {
|
||||||
nsCOMPtr<nsIAtom> contentTag;
|
nsIAtom *contentTag = frameContent->Tag();
|
||||||
frameContent->GetTag(getter_AddRefs(contentTag));
|
|
||||||
NS_ASSERTION(contentTag == nsHTMLAtoms::body, "Second ancestor is not BODY");
|
NS_ASSERTION(contentTag == nsHTMLAtoms::body, "Second ancestor is not BODY");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1211,13 +1211,10 @@ nsImageFrame::DisplayAltFeedback(nsIPresContext* aPresContext,
|
|||||||
if (!inner.IsEmpty()) {
|
if (!inner.IsEmpty()) {
|
||||||
nsIContent* content = GetContent();
|
nsIContent* content = GetContent();
|
||||||
if (content) {
|
if (content) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsAutoString altText;
|
||||||
content->GetTag(getter_AddRefs(tag));
|
nsCSSFrameConstructor::GetAlternateTextFor(content, content->Tag(),
|
||||||
if (tag) {
|
altText);
|
||||||
nsAutoString altText;
|
DisplayAltText(aPresContext, aRenderingContext, altText, inner);
|
||||||
nsCSSFrameConstructor::GetAlternateTextFor(content, tag, altText);
|
|
||||||
DisplayAltText(aPresContext, aRenderingContext, altText, inner);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -882,10 +882,10 @@ NS_IMETHODIMP nsInlineFrame::GetAccessible(nsIAccessible** aAccessible)
|
|||||||
// Broken image accessibles are created here, because layout
|
// Broken image accessibles are created here, because layout
|
||||||
// replaces the image or image control frame with an inline frame
|
// replaces the image or image control frame with an inline frame
|
||||||
*aAccessible = nsnull;
|
*aAccessible = nsnull;
|
||||||
nsCOMPtr<nsIAtom> tagAtom;
|
nsIAtom *tagAtom = mContent->Tag();
|
||||||
mContent->GetTag(getter_AddRefs(tagAtom));
|
if ((tagAtom == nsHTMLAtoms::img || tagAtom == nsHTMLAtoms::input ||
|
||||||
if (tagAtom == nsHTMLAtoms::img || tagAtom == nsHTMLAtoms::input ||
|
tagAtom == nsHTMLAtoms::label || tagAtom == nsHTMLAtoms::hr) &&
|
||||||
tagAtom == nsHTMLAtoms::label || tagAtom == nsHTMLAtoms::hr) {
|
mContent->IsContentOfType(nsIContent::eHTML)) {
|
||||||
// Only get accessibility service if we're going to use it
|
// Only get accessibility service if we're going to use it
|
||||||
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
nsCOMPtr<nsIAccessibilityService> accService(do_GetService("@mozilla.org/accessibilityService;1"));
|
||||||
if (!accService)
|
if (!accService)
|
||||||
|
|||||||
@ -2464,25 +2464,23 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||||||
if (!applyMinLH && (isFirstLine || isLastLine)) {
|
if (!applyMinLH && (isFirstLine || isLastLine)) {
|
||||||
nsIContent* blockContent = mRootSpan->mFrame->mFrame->GetContent();
|
nsIContent* blockContent = mRootSpan->mFrame->mFrame->GetContent();
|
||||||
if (blockContent) {
|
if (blockContent) {
|
||||||
nsCOMPtr<nsIAtom> blockTagAtom;
|
nsIAtom *blockTagAtom = blockContent->Tag();
|
||||||
nsresult result = blockContent->GetTag(getter_AddRefs(blockTagAtom));
|
// (2) above, if the first line of LI
|
||||||
if ( NS_SUCCEEDED(result) && blockTagAtom) {
|
if (isFirstLine && blockTagAtom == nsHTMLAtoms::li) {
|
||||||
// (2) above, if the first line of LI
|
// if the line is empty, then don't force the min height
|
||||||
if (isFirstLine && blockTagAtom.get() == nsHTMLAtoms::li) {
|
// (see bug 75963)
|
||||||
// if the line is empty, then don't force the min height (see bug 75963)
|
if (!IsZeroHeight()) {
|
||||||
if (!IsZeroHeight()) {
|
|
||||||
applyMinLH = PR_TRUE;
|
|
||||||
foundLI = PR_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// (3) above, if the last line of LI, DT, or DD
|
|
||||||
else if (!applyMinLH && isLastLine &&
|
|
||||||
((blockTagAtom.get() == nsHTMLAtoms::li) ||
|
|
||||||
(blockTagAtom.get() == nsHTMLAtoms::dt) ||
|
|
||||||
(blockTagAtom.get() == nsHTMLAtoms::dd))) {
|
|
||||||
applyMinLH = PR_TRUE;
|
applyMinLH = PR_TRUE;
|
||||||
|
foundLI = PR_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// (3) above, if the last line of LI, DT, or DD
|
||||||
|
else if (!applyMinLH && isLastLine &&
|
||||||
|
((blockTagAtom == nsHTMLAtoms::li) ||
|
||||||
|
(blockTagAtom == nsHTMLAtoms::dt) ||
|
||||||
|
(blockTagAtom == nsHTMLAtoms::dd))) {
|
||||||
|
applyMinLH = PR_TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (applyMinLH) {
|
if (applyMinLH) {
|
||||||
|
|||||||
@ -492,13 +492,11 @@ PRBool nsObjectFrame::IsSupportedImage(nsIContent* aContent)
|
|||||||
PRBool haveType = (rv == NS_CONTENT_ATTR_HAS_VALUE) && (!type.IsEmpty());
|
PRBool haveType = (rv == NS_CONTENT_ATTR_HAS_VALUE) && (!type.IsEmpty());
|
||||||
if (!haveType)
|
if (!haveType)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
nsAutoString data;
|
nsAutoString data;
|
||||||
|
|
||||||
// If this is an OBJECT tag, we should look for a DATA attribute.
|
// If this is an OBJECT tag, we should look for a DATA attribute.
|
||||||
// If not, it's an EMBED tag, and so we should look for a SRC attribute.
|
// If not, it's an EMBED tag, and so we should look for a SRC attribute.
|
||||||
if (tag == nsHTMLAtoms::object)
|
if (aContent->Tag() == nsHTMLAtoms::object)
|
||||||
rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, data);
|
rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, data);
|
||||||
else
|
else
|
||||||
rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, data);
|
rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, data);
|
||||||
@ -635,19 +633,17 @@ nsObjectFrame::Init(nsIPresContext* aPresContext,
|
|||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
nsAutoString data;
|
nsAutoString data;
|
||||||
|
|
||||||
// If this is an OBJECT tag, we should look for a DATA attribute.
|
// If this is an OBJECT tag, we should look for a DATA attribute.
|
||||||
// If not, it's an EMBED tag, and so we should look for a SRC attribute.
|
// If not, it's an EMBED tag, and so we should look for a SRC attribute.
|
||||||
if (tag == nsHTMLAtoms::object)
|
if (aContent->Tag() == nsHTMLAtoms::object)
|
||||||
rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, data);
|
rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, data);
|
||||||
else
|
else
|
||||||
rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, data);
|
rv = aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::src, data);
|
||||||
|
|
||||||
imageLoader->ImageURIChanged(data);
|
imageLoader->ImageURIChanged(data);
|
||||||
|
|
||||||
nsCOMPtr<nsIPresShell> shell;
|
nsCOMPtr<nsIPresShell> shell;
|
||||||
aPresContext->GetShell(getter_AddRefs(shell));
|
aPresContext->GetShell(getter_AddRefs(shell));
|
||||||
nsIFrame * aNewFrame = nsnull;
|
nsIFrame * aNewFrame = nsnull;
|
||||||
@ -671,9 +667,8 @@ nsObjectFrame::Init(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
|
|
||||||
// only do the following for the object tag
|
// only do the following for the object tag
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (aContent->Tag() != nsHTMLAtoms::object)
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
return rv;
|
||||||
if (tag.get() != nsHTMLAtoms::object) return rv;
|
|
||||||
|
|
||||||
// for now, we should try to do the same for "document" types and create
|
// for now, we should try to do the same for "document" types and create
|
||||||
// and IFrame-like sub-frame
|
// and IFrame-like sub-frame
|
||||||
@ -915,8 +910,7 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||||||
aMetrics.height = aReflowState.mComputedHeight;
|
aMetrics.height = aReflowState.mComputedHeight;
|
||||||
|
|
||||||
// for EMBED and APPLET, default to 240x200 for compatibility
|
// for EMBED and APPLET, default to 240x200 for compatibility
|
||||||
nsCOMPtr<nsIAtom> atom;
|
nsIAtom *atom = mContent->Tag();
|
||||||
mContent->GetTag(getter_AddRefs(atom));
|
|
||||||
if (atom == nsHTMLAtoms::applet || atom == nsHTMLAtoms::embed) {
|
if (atom == nsHTMLAtoms::applet || atom == nsHTMLAtoms::embed) {
|
||||||
float p2t;
|
float p2t;
|
||||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||||
@ -1116,9 +1110,8 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
mInstanceOwner->SetPluginHost(pluginHost);
|
mInstanceOwner->SetPluginHost(pluginHost);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = mContent->Tag();
|
||||||
mContent->GetTag(getter_AddRefs(tag));
|
if (tag == nsHTMLAtoms::applet) {
|
||||||
if (tag.get() == nsHTMLAtoms::applet) {
|
|
||||||
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::code, src)) {
|
if (NS_CONTENT_ATTR_HAS_VALUE == mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::code, src)) {
|
||||||
// Create an absolute URL
|
// Create an absolute URL
|
||||||
rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURL);
|
rv = MakeAbsoluteURL(getter_AddRefs(fullURL), src, baseURL);
|
||||||
@ -1409,25 +1402,29 @@ nsObjectFrame::IsHidden(PRBool aCheckVisibilityStyle) const
|
|||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
mContent->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
// only <embed> tags support the HIDDEN attribute
|
// only <embed> tags support the HIDDEN attribute
|
||||||
if (tag.get() == nsHTMLAtoms::embed) {
|
if (mContent->Tag() == nsHTMLAtoms::embed) {
|
||||||
nsAutoString hidden;
|
nsAutoString hidden;
|
||||||
nsresult result = mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::hidden, hidden);
|
nsresult result = mContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::hidden, hidden);
|
||||||
|
|
||||||
// Yes, these are really the kooky ways that you could tell 4.x
|
// Yes, these are really the kooky ways that you could tell 4.x
|
||||||
// not to hide the <embed> once you'd put the 'hidden' attribute
|
// not to hide the <embed> once you'd put the 'hidden' attribute
|
||||||
// on the tag...
|
// on the tag...
|
||||||
// these |NS_ConvertASCIItoUCS2|s can't be |NS_LITERAL_STRING|s until |EqualsIgnoreCase| get's fixed
|
|
||||||
// HIDDEN w/ no attributes gets translated as we are hidden for compatibility
|
// these |NS_ConvertASCIItoUCS2|s can't be |NS_LITERAL_STRING|s
|
||||||
// w/ 4.x and IE so we don't create a non-painting widget in layout. See bug 188959.
|
// until |EqualsIgnoreCase| get's fixed
|
||||||
|
|
||||||
|
// HIDDEN w/ no attributes gets translated as we are hidden for
|
||||||
|
// compatibility w/ 4.x and IE so we don't create a non-painting
|
||||||
|
// widget in layout. See bug 188959.
|
||||||
if (NS_CONTENT_ATTR_NOT_THERE != result &&
|
if (NS_CONTENT_ATTR_NOT_THERE != result &&
|
||||||
(hidden.IsEmpty() ||
|
(hidden.IsEmpty() ||
|
||||||
!hidden.Equals(NS_LITERAL_STRING("false"), nsCaseInsensitiveStringComparator()) &&
|
!hidden.Equals(NS_LITERAL_STRING("false"),
|
||||||
!hidden.Equals(NS_LITERAL_STRING("no"), nsCaseInsensitiveStringComparator()) &&
|
nsCaseInsensitiveStringComparator()) &&
|
||||||
!hidden.Equals(NS_LITERAL_STRING("off"), nsCaseInsensitiveStringComparator()))) {
|
!hidden.Equals(NS_LITERAL_STRING("no"),
|
||||||
|
nsCaseInsensitiveStringComparator()) &&
|
||||||
|
!hidden.Equals(NS_LITERAL_STRING("off"),
|
||||||
|
nsCaseInsensitiveStringComparator()))) {
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2520,20 +2517,16 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetTagType(nsPluginTagType *result)
|
|||||||
nsIContent* cont = mOwner->GetContent();
|
nsIContent* cont = mOwner->GetContent();
|
||||||
if (cont)
|
if (cont)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> atom;
|
nsIAtom *atom = cont->Tag();
|
||||||
cont->GetTag(getter_AddRefs(atom));
|
|
||||||
|
|
||||||
if (atom)
|
if (atom == nsHTMLAtoms::applet)
|
||||||
{
|
*result = nsPluginTagType_Applet;
|
||||||
if (atom == nsHTMLAtoms::applet)
|
else if (atom == nsHTMLAtoms::embed)
|
||||||
*result = nsPluginTagType_Applet;
|
*result = nsPluginTagType_Embed;
|
||||||
else if (atom == nsHTMLAtoms::embed)
|
else if (atom == nsHTMLAtoms::object)
|
||||||
*result = nsPluginTagType_Embed;
|
*result = nsPluginTagType_Object;
|
||||||
else if (atom == nsHTMLAtoms::object)
|
|
||||||
*result = nsPluginTagType_Object;
|
|
||||||
|
|
||||||
rv = NS_OK;
|
rv = NS_OK;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3030,9 +3023,8 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
|
|||||||
// to the bottom of the array if there isn't already a "src" specified.
|
// to the bottom of the array if there isn't already a "src" specified.
|
||||||
PRInt16 numRealAttrs = mNumCachedAttrs;
|
PRInt16 numRealAttrs = mNumCachedAttrs;
|
||||||
nsAutoString data;
|
nsAutoString data;
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = content->Tag();
|
||||||
content->GetTag(getter_AddRefs(tag));
|
if (nsHTMLAtoms::object == tag
|
||||||
if (nsHTMLAtoms::object == tag.get()
|
|
||||||
&& !content->HasAttr(kNameSpaceID_None, nsHTMLAtoms::src)
|
&& !content->HasAttr(kNameSpaceID_None, nsHTMLAtoms::src)
|
||||||
&& NS_CONTENT_ATTR_NOT_THERE != content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, data)) {
|
&& NS_CONTENT_ATTR_NOT_THERE != content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, data)) {
|
||||||
mNumCachedAttrs++;
|
mNumCachedAttrs++;
|
||||||
|
|||||||
@ -4014,9 +4014,8 @@ PresShell::GoToAnchor(const nsAString& aAnchorName, PRBool aScroll)
|
|||||||
// Ensure it's an anchor element
|
// Ensure it's an anchor element
|
||||||
content = do_QueryInterface(node);
|
content = do_QueryInterface(node);
|
||||||
if (content) {
|
if (content) {
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (content->Tag() == nsHTMLAtoms::a &&
|
||||||
content->GetTag(getter_AddRefs(tag));
|
content->IsContentOfType(nsIContent::eHTML)) {
|
||||||
if (tag == nsHTMLAtoms::a) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
content = nsnull;
|
content = nsnull;
|
||||||
|
|||||||
@ -605,8 +605,7 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||||||
nsIAtom* aAttribute,
|
nsIAtom* aAttribute,
|
||||||
PRInt32 aModType)
|
PRInt32 aModType)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIAtom> type;
|
nsIAtom *type = aChild->Tag();
|
||||||
aChild->GetTag(getter_AddRefs(type));
|
|
||||||
|
|
||||||
if ((type != nsHTMLAtoms::object && aAttribute == nsHTMLAtoms::src) ||
|
if ((type != nsHTMLAtoms::object && aAttribute == nsHTMLAtoms::src) ||
|
||||||
(type == nsHTMLAtoms::object && aAttribute == nsHTMLAtoms::data)) {
|
(type == nsHTMLAtoms::object && aAttribute == nsHTMLAtoms::data)) {
|
||||||
@ -619,10 +618,7 @@ nsHTMLFrameOuterFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|||||||
}
|
}
|
||||||
// If the noResize attribute changes, dis/allow frame to be resized
|
// If the noResize attribute changes, dis/allow frame to be resized
|
||||||
else if (aAttribute == nsHTMLAtoms::noresize) {
|
else if (aAttribute == nsHTMLAtoms::noresize) {
|
||||||
nsCOMPtr<nsIAtom> parentTag;
|
if (mContent->GetParent()->Tag() == nsHTMLAtoms::frameset) {
|
||||||
mContent->GetParent()->GetTag(getter_AddRefs(parentTag));
|
|
||||||
|
|
||||||
if (parentTag == nsHTMLAtoms::frameset) {
|
|
||||||
nsIFrame* parentFrame = GetParent();
|
nsIFrame* parentFrame = GetParent();
|
||||||
|
|
||||||
if (parentFrame) {
|
if (parentFrame) {
|
||||||
@ -750,10 +746,8 @@ nsHTMLFrameInnerFrame::Destroy(nsIPresContext* aPresContext)
|
|||||||
PRBool nsHTMLFrameInnerFrame::GetURL(nsIContent* aContent, nsString& aResult)
|
PRBool nsHTMLFrameInnerFrame::GetURL(nsIContent* aContent, nsString& aResult)
|
||||||
{
|
{
|
||||||
aResult.SetLength(0);
|
aResult.SetLength(0);
|
||||||
nsCOMPtr<nsIAtom> type;
|
|
||||||
aContent->GetTag(getter_AddRefs(type));
|
|
||||||
|
|
||||||
if (type.get() == nsHTMLAtoms::object) {
|
if (aContent->Tag() == nsHTMLAtoms::object) {
|
||||||
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, aResult)))
|
if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::data, aResult)))
|
||||||
if (!aResult.IsEmpty())
|
if (!aResult.IsEmpty())
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
|
|||||||
@ -399,8 +399,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
|
|||||||
if (!child->IsContentOfType(nsIContent::eHTML))
|
if (!child->IsContentOfType(nsIContent::eHTML))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = child->Tag();
|
||||||
child->GetTag(getter_AddRefs(tag));
|
|
||||||
if (tag == nsHTMLAtoms::frameset || tag == nsHTMLAtoms::frame) {
|
if (tag == nsHTMLAtoms::frameset || tag == nsHTMLAtoms::frame) {
|
||||||
nsRefPtr<nsStyleContext> kidSC;
|
nsRefPtr<nsStyleContext> kidSC;
|
||||||
nsresult result;
|
nsresult result;
|
||||||
@ -719,14 +718,10 @@ nsHTMLFramesetFrame* nsHTMLFramesetFrame::GetFramesetParent(nsIFrame* aChild)
|
|||||||
if (content) {
|
if (content) {
|
||||||
nsCOMPtr<nsIContent> contentParent = content->GetParent();
|
nsCOMPtr<nsIContent> contentParent = content->GetParent();
|
||||||
|
|
||||||
if (contentParent && contentParent->IsContentOfType(nsIContent::eHTML)) {
|
if (contentParent && contentParent->IsContentOfType(nsIContent::eHTML) &&
|
||||||
nsCOMPtr<nsIAtom> tag;
|
contentParent->Tag() == nsHTMLAtoms::frameset) {
|
||||||
contentParent->GetTag(getter_AddRefs(tag));
|
nsIFrame* fptr = aChild->GetParent();
|
||||||
|
parent = (nsHTMLFramesetFrame*) fptr;
|
||||||
if (tag == nsHTMLAtoms::frameset) {
|
|
||||||
nsIFrame* fptr = aChild->GetParent();
|
|
||||||
parent = (nsHTMLFramesetFrame*) fptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -447,22 +447,11 @@ nsFileControlFrame::GetTextControlFrame(nsIPresContext* aPresContext, nsIFrame*
|
|||||||
|
|
||||||
while (childFrame) {
|
while (childFrame) {
|
||||||
// see if the child is a text control
|
// see if the child is a text control
|
||||||
nsIContent* content = childFrame->GetContent();
|
nsCOMPtr<nsIFormControl> formCtrl =
|
||||||
if (content) {
|
do_QueryInterface(childFrame->GetContent());
|
||||||
nsCOMPtr<nsIAtom> atom;
|
|
||||||
nsresult res = content->GetTag(getter_AddRefs(atom));
|
|
||||||
if (NS_SUCCEEDED(res) && atom) {
|
|
||||||
if (atom.get() == nsHTMLAtoms::input) {
|
|
||||||
|
|
||||||
// It's an input, is it a text input?
|
if (formCtrl && formCtrl->GetType() == NS_FORM_INPUT_TEXT) {
|
||||||
nsAutoString value;
|
result = (nsNewFrame*)childFrame;
|
||||||
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, value)) {
|
|
||||||
if (value.EqualsIgnoreCase("text")) {
|
|
||||||
result = (nsNewFrame*)childFrame;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if not continue looking
|
// if not continue looking
|
||||||
|
|||||||
@ -104,25 +104,12 @@ nsGfxButtonControlFrame::IsFileBrowseButton(PRInt32 type)
|
|||||||
rv = PR_TRUE;
|
rv = PR_TRUE;
|
||||||
}
|
}
|
||||||
else if (NS_FORM_INPUT_BUTTON == type) {
|
else if (NS_FORM_INPUT_BUTTON == type) {
|
||||||
|
|
||||||
// Check to see if parent is a file input
|
// Check to see if parent is a file input
|
||||||
nsresult result;
|
nsCOMPtr<nsIFormControl> formCtrl =
|
||||||
nsCOMPtr<nsIContent> parentContent = mContent->GetParent();
|
do_QueryInterface(mContent->GetParent());
|
||||||
if (parentContent) {
|
|
||||||
nsCOMPtr<nsIAtom> atom;
|
|
||||||
result = parentContent->GetTag(getter_AddRefs(atom));
|
|
||||||
if (NS_SUCCEEDED(result) && atom) {
|
|
||||||
if (atom == nsHTMLAtoms::input) {
|
|
||||||
|
|
||||||
// It's an input, is it a file input?
|
if (formCtrl && formCtrl->GetType() == NS_FORM_INPUT_FILE) {
|
||||||
nsAutoString value;
|
rv = PR_TRUE;
|
||||||
if (NS_CONTENT_ATTR_HAS_VALUE == parentContent->GetAttr(kNameSpaceID_None, nsHTMLAtoms::type, value)) {
|
|
||||||
if (value.EqualsIgnoreCase("file")) {
|
|
||||||
rv = PR_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
|
|||||||
@ -793,9 +793,8 @@ nsTextInputSelectionImpl::CompleteMove(PRBool aForward, PRBool aExtend)
|
|||||||
if (offset > 0)
|
if (offset > 0)
|
||||||
{
|
{
|
||||||
nsIContent *child = parentDIV->GetChildAt(offset - 1);
|
nsIContent *child = parentDIV->GetChildAt(offset - 1);
|
||||||
nsCOMPtr<nsIAtom> tagName;
|
|
||||||
child->GetTag(getter_AddRefs(tagName));
|
if (child->Tag() == nsHTMLAtoms::br)
|
||||||
if (tagName == nsHTMLAtoms::br)
|
|
||||||
{
|
{
|
||||||
--offset;
|
--offset;
|
||||||
hint = HINTRIGHT; // for Bug 106855
|
hint = HINTRIGHT; // for Bug 106855
|
||||||
@ -1329,16 +1328,7 @@ PRBool nsTextControlFrame::IsSingleLineTextControl() const
|
|||||||
|
|
||||||
PRBool nsTextControlFrame::IsTextArea() const
|
PRBool nsTextControlFrame::IsTextArea() const
|
||||||
{
|
{
|
||||||
if (!mContent)
|
return mContent && mContent->Tag() == nsHTMLAtoms::textarea;
|
||||||
return PR_FALSE;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
mContent->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (nsHTMLAtoms::textarea == tag)
|
|
||||||
return PR_TRUE;
|
|
||||||
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: wouldn't it be nice to get this from the style context!
|
// XXX: wouldn't it be nice to get this from the style context!
|
||||||
@ -2297,9 +2287,7 @@ nsTextControlFrame::SelectAllContents()
|
|||||||
// br under the root node!
|
// br under the root node!
|
||||||
nsIContent *child = rootContent->GetChildAt(numChildren - 1);
|
nsIContent *child = rootContent->GetChildAt(numChildren - 1);
|
||||||
if (child) {
|
if (child) {
|
||||||
nsCOMPtr<nsIAtom> tagName;
|
if (child->Tag() == nsHTMLAtoms::br)
|
||||||
child->GetTag(getter_AddRefs(tagName));
|
|
||||||
if (tagName == nsHTMLAtoms::br)
|
|
||||||
--numChildren;
|
--numChildren;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -121,7 +121,6 @@
|
|||||||
|
|
||||||
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
|
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
|
||||||
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
|
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
|
||||||
static NS_DEFINE_CID(kAttributeContentCID, NS_ATTRIBUTECONTENT_CID);
|
|
||||||
|
|
||||||
#include "nsIDOMWindowInternal.h"
|
#include "nsIDOMWindowInternal.h"
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
@ -1438,23 +1437,24 @@ nsCSSFrameConstructor::CreateGeneratedFrameFor(nsIPresContext* aPresContex
|
|||||||
|
|
||||||
// Creates the content and frame and return if successful
|
// Creates the content and frame and return if successful
|
||||||
nsresult rv = NS_ERROR_FAILURE;
|
nsresult rv = NS_ERROR_FAILURE;
|
||||||
if (nsnull != attrName) {
|
if (attrName) {
|
||||||
nsIFrame* textFrame = nsnull;
|
nsIFrame* textFrame = nsnull;
|
||||||
nsCOMPtr<nsIContent> content(do_CreateInstance(kAttributeContentCID));
|
nsCOMPtr<nsIContent> content;
|
||||||
if (content) {
|
rv = NS_NewAttributeContent(getter_AddRefs(content));
|
||||||
nsCOMPtr<nsIAttributeContent> attrContent(do_QueryInterface(content));
|
|
||||||
if (attrContent) {
|
|
||||||
attrContent->Init(aContent, attrNameSpace, attrName);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set aContent as the parent content and set the document object. This
|
nsCOMPtr<nsIAttributeContent> attrContent(do_QueryInterface(content));
|
||||||
// way event handling works
|
if (attrContent) {
|
||||||
|
attrContent->Init(aContent, attrNameSpace, attrName);
|
||||||
|
|
||||||
|
// Set aContent as the parent content and set the document
|
||||||
|
// object. This way event handling works
|
||||||
content->SetParent(aContent);
|
content->SetParent(aContent);
|
||||||
content->SetDocument(aDocument, PR_TRUE, PR_TRUE);
|
content->SetDocument(aDocument, PR_TRUE, PR_TRUE);
|
||||||
|
|
||||||
// Create a text frame and initialize it
|
// Create a text frame and initialize it
|
||||||
NS_NewTextFrame(shell, &textFrame);
|
NS_NewTextFrame(shell, &textFrame);
|
||||||
textFrame->Init(aPresContext, content, aParentFrame, aStyleContext, nsnull);
|
textFrame->Init(aPresContext, content, aParentFrame, aStyleContext,
|
||||||
|
nsnull);
|
||||||
|
|
||||||
// Return the text frame
|
// Return the text frame
|
||||||
*aFrame = textFrame;
|
*aFrame = textFrame;
|
||||||
@ -2980,13 +2980,15 @@ nsCSSFrameConstructor::ConstructTableForeignFrame(nsIPresShell* aPres
|
|||||||
nsIFrame* parentFrame = nsnull;
|
nsIFrame* parentFrame = nsnull;
|
||||||
aIsPseudoParent = PR_FALSE;
|
aIsPseudoParent = PR_FALSE;
|
||||||
|
|
||||||
// XXX form code needs to be fixed so that the forms can work without a frame.
|
// XXX form code needs to be fixed so that the forms can work
|
||||||
nsCOMPtr<nsIAtom> tag;
|
// without a frame.
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
nsIAtom *tag = aContent->Tag();
|
||||||
|
|
||||||
// Do not construct pseudo frames for trees
|
// Do not construct pseudo frames for trees
|
||||||
if (MustGeneratePseudoParent(aPresContext, aParentFrameIn, tag.get(), aContent, aStyleContext)) {
|
if (MustGeneratePseudoParent(aPresContext, aParentFrameIn, tag, aContent,
|
||||||
// this frame may have a pseudo parent, use block frame type to trigger foreign
|
aStyleContext)) {
|
||||||
|
// this frame may have a pseudo parent, use block frame type to
|
||||||
|
// trigger foreign
|
||||||
GetParentFrame(aPresShell, aPresContext, aTableCreator, *aParentFrameIn,
|
GetParentFrame(aPresShell, aPresContext, aTableCreator, *aParentFrameIn,
|
||||||
nsLayoutAtoms::blockFrame, aState, parentFrame, aIsPseudoParent);
|
nsLayoutAtoms::blockFrame, aState, parentFrame, aIsPseudoParent);
|
||||||
if (!aIsPseudoParent && !aState.mPseudoFrames.IsEmpty()) {
|
if (!aIsPseudoParent && !aState.mPseudoFrames.IsEmpty()) {
|
||||||
@ -5087,9 +5089,7 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsIPresShell* aPresShell
|
|||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
// Only cut XUL scrollbars off if they're not in a XUL document. This allows
|
// Only cut XUL scrollbars off if they're not in a XUL document. This allows
|
||||||
// scrollbars to be styled from XUL (although not from XML or HTML).
|
// scrollbars to be styled from XUL (although not from XML or HTML).
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (content->Tag() == nsXULAtoms::scrollbar) {
|
||||||
content->GetTag(getter_AddRefs(tag));
|
|
||||||
if (tag.get() == nsXULAtoms::scrollbar) {
|
|
||||||
nsCOMPtr<nsIDOMXULDocument> xulDoc(do_QueryInterface(aDocument));
|
nsCOMPtr<nsIDOMXULDocument> xulDoc(do_QueryInterface(aDocument));
|
||||||
if (xulDoc)
|
if (xulDoc)
|
||||||
content->SetBindingParent(aParent);
|
content->SetBindingParent(aParent);
|
||||||
@ -6165,10 +6165,8 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre
|
|||||||
ProcessChildren(aPresShell, aPresContext, aState, aContent, scrolledFrame, PR_TRUE,
|
ProcessChildren(aPresShell, aPresContext, aState, aContent, scrolledFrame, PR_TRUE,
|
||||||
childItems, PR_TRUE);
|
childItems, PR_TRUE);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
CreateAnonymousFrames(aPresShell, aPresContext, aContent->Tag(), aState,
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
aContent, newFrame, PR_FALSE, childItems);
|
||||||
CreateAnonymousFrames(aPresShell, aPresContext, tag, aState, aContent, newFrame,
|
|
||||||
PR_FALSE, childItems);
|
|
||||||
|
|
||||||
// Set the scrolled frame's initial child lists
|
// Set the scrolled frame's initial child lists
|
||||||
scrolledFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
scrolledFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
||||||
@ -6228,10 +6226,8 @@ nsCSSFrameConstructor::ConstructFrameByDisplayType(nsIPresShell* aPre
|
|||||||
ProcessChildren(aPresShell, aPresContext, aState, aContent, newFrame, PR_TRUE,
|
ProcessChildren(aPresShell, aPresContext, aState, aContent, newFrame, PR_TRUE,
|
||||||
childItems, PR_TRUE);
|
childItems, PR_TRUE);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
CreateAnonymousFrames(aPresShell, aPresContext, aContent->Tag(), aState,
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
aContent, newFrame, PR_FALSE, childItems);
|
||||||
CreateAnonymousFrames(aPresShell, aPresContext, tag, aState, aContent, newFrame,
|
|
||||||
PR_FALSE, childItems);
|
|
||||||
|
|
||||||
// Set the frame's initial child list(s)
|
// Set the frame's initial child list(s)
|
||||||
newFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
newFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
||||||
@ -6577,15 +6573,11 @@ nsCSSFrameConstructor::ResolveStyleContext(nsIPresContext* aPresContext,
|
|||||||
if (aContent->IsContentOfType(nsIContent::eELEMENT)) {
|
if (aContent->IsContentOfType(nsIContent::eELEMENT)) {
|
||||||
return aPresContext->ResolveStyleContextFor(aContent, parentStyleContext);
|
return aPresContext->ResolveStyleContextFor(aContent, parentStyleContext);
|
||||||
} else {
|
} else {
|
||||||
#ifdef DEBUG
|
|
||||||
{
|
NS_ASSERTION(aContent->Tag() == nsLayoutAtoms::textTagName,
|
||||||
nsCOMPtr<nsIAtom> tag;
|
"shouldn't waste time creating style contexts for "
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
"comments and processing instructions");
|
||||||
NS_ASSERTION(tag == nsLayoutAtoms::textTagName,
|
|
||||||
"shouldn't waste time creating style contexts for "
|
|
||||||
"comments and processing instructions");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return aPresContext->ResolveStyleContextForNonElement(parentStyleContext);
|
return aPresContext->ResolveStyleContextForNonElement(parentStyleContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7023,8 +7015,7 @@ nsCSSFrameConstructor::ConstructFrame(nsIPresShell* aPresShell,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the element's tag
|
// Get the element's tag
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom *tag = aContent->Tag();
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
// never create frames for comments on PIs
|
// never create frames for comments on PIs
|
||||||
if (tag == nsLayoutAtoms::commentTagName ||
|
if (tag == nsLayoutAtoms::commentTagName ||
|
||||||
@ -7104,7 +7095,7 @@ nsCSSFrameConstructor::ConstructFrameInternal( nsIPresShell* aPresShe
|
|||||||
PRInt32 nameSpaceID;
|
PRInt32 nameSpaceID;
|
||||||
xblService->ResolveTag(aContent, &nameSpaceID, getter_AddRefs(baseTag));
|
xblService->ResolveTag(aContent, &nameSpaceID, getter_AddRefs(baseTag));
|
||||||
|
|
||||||
if (baseTag.get() != aTag || aNameSpaceID != nameSpaceID) {
|
if (baseTag != aTag || aNameSpaceID != nameSpaceID) {
|
||||||
// Construct the frame using the XBL base tag.
|
// Construct the frame using the XBL base tag.
|
||||||
rv = ConstructFrameInternal( aPresShell,
|
rv = ConstructFrameInternal( aPresShell,
|
||||||
aPresContext,
|
aPresContext,
|
||||||
@ -7612,7 +7603,7 @@ FindPreviousAnonymousSibling(nsIPresShell* aPresShell,
|
|||||||
nodeList->Item(PRUint32(index), getter_AddRefs(node));
|
nodeList->Item(PRUint32(index), getter_AddRefs(node));
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
|
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
|
||||||
if (child.get() == aChild)
|
if (child == aChild)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7694,7 +7685,7 @@ FindNextAnonymousSibling(nsIPresShell* aPresShell,
|
|||||||
nodeList->Item(PRUint32(index), getter_AddRefs(node));
|
nodeList->Item(PRUint32(index), getter_AddRefs(node));
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
|
nsCOMPtr<nsIContent> child = do_QueryInterface(node);
|
||||||
if (child.get() == aChild)
|
if (child == aChild)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7935,21 +7926,20 @@ inline PRBool
|
|||||||
ShouldIgnoreSelectChild(nsIContent* aContainer)
|
ShouldIgnoreSelectChild(nsIContent* aContainer)
|
||||||
{
|
{
|
||||||
// Ignore options and optgroups inside a select (size > 1)
|
// Ignore options and optgroups inside a select (size > 1)
|
||||||
nsCOMPtr<nsIAtom> containerTag;
|
nsIAtom *containerTag = aContainer->Tag();
|
||||||
aContainer->GetTag(getter_AddRefs(containerTag));
|
|
||||||
|
|
||||||
if (containerTag == nsHTMLAtoms::optgroup ||
|
if (containerTag == nsHTMLAtoms::optgroup ||
|
||||||
containerTag == nsHTMLAtoms::select) {
|
containerTag == nsHTMLAtoms::select) {
|
||||||
nsIContent* selectContent = aContainer;
|
nsIContent* selectContent = aContainer;
|
||||||
|
|
||||||
while (containerTag != nsHTMLAtoms::select) {
|
while (containerTag != nsHTMLAtoms::select) {
|
||||||
selectContent = selectContent->GetParent();
|
selectContent = selectContent->GetParent();
|
||||||
if (!selectContent) {
|
if (!selectContent) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
selectContent->GetTag(getter_AddRefs(containerTag));
|
containerTag = selectContent->Tag();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsISelectElement> selectElement = do_QueryInterface(selectContent);
|
nsCOMPtr<nsISelectElement> selectElement = do_QueryInterface(selectContent);
|
||||||
if (selectElement) {
|
if (selectElement) {
|
||||||
nsAutoString selSize;
|
nsAutoString selSize;
|
||||||
@ -8097,7 +8087,8 @@ nsCSSFrameConstructor::ContentAppended(nsIPresContext* aPresContext,
|
|||||||
if (tag == nsXULAtoms::treechildren ||
|
if (tag == nsXULAtoms::treechildren ||
|
||||||
tag == nsXULAtoms::treeitem ||
|
tag == nsXULAtoms::treeitem ||
|
||||||
tag == nsXULAtoms::treerow ||
|
tag == nsXULAtoms::treerow ||
|
||||||
(UseXBLForms() && ShouldIgnoreSelectChild(aContainer)))
|
(namespaceID == kNameSpaceID_XUL && UseXBLForms() &&
|
||||||
|
ShouldIgnoreSelectChild(aContainer)))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -8656,10 +8647,7 @@ PRBool NotifyListBoxBody(nsIPresContext* aPresContext,
|
|||||||
if (!aContainer)
|
if (!aContainer)
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
if (aChild->Tag() == nsXULAtoms::listitem) {
|
||||||
aChild->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
if (tag == nsXULAtoms::listitem) {
|
|
||||||
nsListBoxBodyFrame* listBoxBody = nsnull;
|
nsListBoxBodyFrame* listBoxBody = nsnull;
|
||||||
if (aChildFrame) {
|
if (aChildFrame) {
|
||||||
// There is a frame for the removed content, so its parent frame is the listboxbody
|
// There is a frame for the removed content, so its parent frame is the listboxbody
|
||||||
@ -8693,6 +8681,7 @@ PRBool NotifyListBoxBody(nsIPresContext* aPresContext,
|
|||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIAtom> tag;
|
||||||
PRInt32 namespaceID;
|
PRInt32 namespaceID;
|
||||||
aDocument->GetBindingManager()->ResolveTag(aContainer, &namespaceID,
|
aDocument->GetBindingManager()->ResolveTag(aContainer, &namespaceID,
|
||||||
getter_AddRefs(tag));
|
getter_AddRefs(tag));
|
||||||
@ -8701,7 +8690,8 @@ PRBool NotifyListBoxBody(nsIPresContext* aPresContext,
|
|||||||
if (tag == nsXULAtoms::treechildren ||
|
if (tag == nsXULAtoms::treechildren ||
|
||||||
tag == nsXULAtoms::treeitem ||
|
tag == nsXULAtoms::treeitem ||
|
||||||
tag == nsXULAtoms::treerow ||
|
tag == nsXULAtoms::treerow ||
|
||||||
(aUseXBLForms && ShouldIgnoreSelectChild(aContainer)))
|
(namespaceID == kNameSpaceID_XUL && aUseXBLForms &&
|
||||||
|
ShouldIgnoreSelectChild(aContainer)))
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
|
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
@ -10178,7 +10168,9 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
|
|||||||
mDocument->GetBindingManager()->ResolveTag(aContent, &namespaceID,
|
mDocument->GetBindingManager()->ResolveTag(aContent, &namespaceID,
|
||||||
getter_AddRefs(tag));
|
getter_AddRefs(tag));
|
||||||
|
|
||||||
if (tag && (tag.get() == nsXULAtoms::listitem || tag.get() == nsXULAtoms::listcell))
|
if (namespaceID == kNameSpaceID_XUL &&
|
||||||
|
(tag == nsXULAtoms::listitem ||
|
||||||
|
tag == nsXULAtoms::listcell))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10312,9 +10304,7 @@ nsCSSFrameConstructor::ConstructAlternateFrame(nsIPresShell* aPresShell,
|
|||||||
aFrame = nsnull;
|
aFrame = nsnull;
|
||||||
|
|
||||||
// Get the alternate text to use
|
// Get the alternate text to use
|
||||||
nsCOMPtr<nsIAtom> tag;
|
GetAlternateTextFor(aContent, aContent->Tag(), altText);
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
GetAlternateTextFor(aContent, tag, altText);
|
|
||||||
|
|
||||||
// Create a text content element for the alternate text
|
// Create a text content element for the alternate text
|
||||||
nsCOMPtr<nsIContent> altTextContent(do_CreateInstance(kTextNodeCID,&rv));
|
nsCOMPtr<nsIContent> altTextContent(do_CreateInstance(kTextNodeCID,&rv));
|
||||||
@ -10437,12 +10427,12 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||||||
|
|
||||||
// Get aFrame's content object and the tag name
|
// Get aFrame's content object and the tag name
|
||||||
PRInt32 nameSpaceID;
|
PRInt32 nameSpaceID;
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsIAtom* tag;
|
||||||
|
|
||||||
nsIContent* content = aFrame->GetContent();
|
nsIContent* content = aFrame->GetContent();
|
||||||
NS_ASSERTION(content, "null content object");
|
NS_ASSERTION(content, "null content object");
|
||||||
content->GetNameSpaceID(&nameSpaceID);
|
content->GetNameSpaceID(&nameSpaceID);
|
||||||
content->GetTag(getter_AddRefs(tag));
|
tag = content->Tag();
|
||||||
|
|
||||||
// Get the child list name that the frame is contained in
|
// Get the child list name that the frame is contained in
|
||||||
nsCOMPtr<nsIAtom> listName;
|
nsCOMPtr<nsIAtom> listName;
|
||||||
@ -10464,8 +10454,8 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||||||
// See whether it's an IMG or an INPUT element (for image buttons)
|
// See whether it's an IMG or an INPUT element (for image buttons)
|
||||||
// or if it is an applet with no displayable children
|
// or if it is an applet with no displayable children
|
||||||
// XXX need to check nameSpaceID in these spots
|
// XXX need to check nameSpaceID in these spots
|
||||||
if (nsHTMLAtoms::img == tag.get() || nsHTMLAtoms::input == tag.get() ||
|
if (nsHTMLAtoms::img == tag || nsHTMLAtoms::input == tag ||
|
||||||
(nsHTMLAtoms::applet == tag.get() && !HasDisplayableChildren(aPresContext, aFrame))) {
|
(nsHTMLAtoms::applet == tag && !HasDisplayableChildren(aPresContext, aFrame))) {
|
||||||
// Try and construct an alternate frame to use when the
|
// Try and construct an alternate frame to use when the
|
||||||
// image can't be rendered
|
// image can't be rendered
|
||||||
nsIFrame* newFrame;
|
nsIFrame* newFrame;
|
||||||
@ -10508,9 +10498,9 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ((nsHTMLAtoms::object == tag.get()) ||
|
} else if ((nsHTMLAtoms::object == tag) ||
|
||||||
(nsHTMLAtoms::embed == tag.get()) ||
|
(nsHTMLAtoms::embed == tag) ||
|
||||||
(nsHTMLAtoms::applet == tag.get())) {
|
(nsHTMLAtoms::applet == tag)) {
|
||||||
// It's an OBJECT, EMBED, or APPLET, so we should display the contents
|
// It's an OBJECT, EMBED, or APPLET, so we should display the contents
|
||||||
// instead
|
// instead
|
||||||
nsIFrame* absoluteContainingBlock;
|
nsIFrame* absoluteContainingBlock;
|
||||||
@ -10529,10 +10519,10 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||||||
|
|
||||||
#ifdef NS_DEBUG
|
#ifdef NS_DEBUG
|
||||||
// Verify that we calculated the same containing block
|
// Verify that we calculated the same containing block
|
||||||
if (listName.get() == nsLayoutAtoms::absoluteList) {
|
if (listName == nsLayoutAtoms::absoluteList) {
|
||||||
NS_ASSERTION(absoluteContainingBlock == parentFrame,
|
NS_ASSERTION(absoluteContainingBlock == parentFrame,
|
||||||
"wrong absolute containing block");
|
"wrong absolute containing block");
|
||||||
} else if (listName.get() == nsLayoutAtoms::floatList) {
|
} else if (listName == nsLayoutAtoms::floatList) {
|
||||||
NS_ASSERTION(floatContainingBlock == parentFrame,
|
NS_ASSERTION(floatContainingBlock == parentFrame,
|
||||||
"wrong float containing block");
|
"wrong float containing block");
|
||||||
}
|
}
|
||||||
@ -10610,13 +10600,13 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||||||
// block frame.
|
// block frame.
|
||||||
SplitToContainingBlock(aPresContext, state, parentFrame, list1, list2, list3, PR_FALSE);
|
SplitToContainingBlock(aPresContext, state, parentFrame, list1, list2, list3, PR_FALSE);
|
||||||
}
|
}
|
||||||
} else if (listName.get() == nsLayoutAtoms::absoluteList) {
|
} else if (listName == nsLayoutAtoms::absoluteList) {
|
||||||
newFrame = state.mAbsoluteItems.childList;
|
newFrame = state.mAbsoluteItems.childList;
|
||||||
state.mAbsoluteItems.childList = nsnull;
|
state.mAbsoluteItems.childList = nsnull;
|
||||||
} else if (listName.get() == nsLayoutAtoms::fixedList) {
|
} else if (listName == nsLayoutAtoms::fixedList) {
|
||||||
newFrame = state.mFixedItems.childList;
|
newFrame = state.mFixedItems.childList;
|
||||||
state.mFixedItems.childList = nsnull;
|
state.mFixedItems.childList = nsnull;
|
||||||
} else if (listName.get() == nsLayoutAtoms::floatList) {
|
} else if (listName == nsLayoutAtoms::floatList) {
|
||||||
newFrame = state.mFloatedItems.childList;
|
newFrame = state.mFloatedItems.childList;
|
||||||
state.mFloatedItems.childList = nsnull;
|
state.mFloatedItems.childList = nsnull;
|
||||||
}
|
}
|
||||||
@ -10631,7 +10621,7 @@ nsCSSFrameConstructor::CantRenderReplacedElement(nsIPresShell* aPresShell,
|
|||||||
|
|
||||||
InsertOutOfFlowFrames(state, aPresContext);
|
InsertOutOfFlowFrames(state, aPresContext);
|
||||||
}
|
}
|
||||||
} else if (nsHTMLAtoms::input == tag.get()) {
|
} else if (nsHTMLAtoms::input == tag) {
|
||||||
// XXX image INPUT elements are also image frames, but don't throw away the
|
// XXX image INPUT elements are also image frames, but don't throw away the
|
||||||
// image frame, because the frame class has extra logic that is specific to
|
// image frame, because the frame class has extra logic that is specific to
|
||||||
// INPUT elements
|
// INPUT elements
|
||||||
@ -11216,7 +11206,7 @@ nsCSSFrameConstructor::FindPrimaryFrameFor(nsIPresContext* aPresContext,
|
|||||||
while (parentFrame) {
|
while (parentFrame) {
|
||||||
// Search the child frames for a match
|
// Search the child frames for a match
|
||||||
*aFrame = FindFrameWithContent(aPresContext, aFrameManager, parentFrame,
|
*aFrame = FindFrameWithContent(aPresContext, aFrameManager, parentFrame,
|
||||||
parentContent.get(), aContent, aHint);
|
parentContent, aContent, aHint);
|
||||||
#ifdef NOISY_FINDFRAME
|
#ifdef NOISY_FINDFRAME
|
||||||
printf("FindFrameWithContent returned %p\n", *aFrame);
|
printf("FindFrameWithContent returned %p\n", *aFrame);
|
||||||
#endif
|
#endif
|
||||||
@ -11233,7 +11223,7 @@ nsCSSFrameConstructor::FindPrimaryFrameFor(nsIPresContext* aPresContext,
|
|||||||
#endif
|
#endif
|
||||||
nsIFrame *verifyTestFrame =
|
nsIFrame *verifyTestFrame =
|
||||||
FindFrameWithContent(aPresContext, aFrameManager, parentFrame,
|
FindFrameWithContent(aPresContext, aFrameManager, parentFrame,
|
||||||
parentContent.get(), aContent, nsnull);
|
parentContent, aContent, nsnull);
|
||||||
#ifdef NOISY_FINDFRAME
|
#ifdef NOISY_FINDFRAME
|
||||||
printf("VERIFY returned %p\n", verifyTestFrame);
|
printf("VERIFY returned %p\n", verifyTestFrame);
|
||||||
#endif
|
#endif
|
||||||
@ -11263,9 +11253,7 @@ nsCSSFrameConstructor::FindPrimaryFrameFor(nsIPresContext* aPresContext,
|
|||||||
|
|
||||||
if (aHint && !*aFrame)
|
if (aHint && !*aFrame)
|
||||||
{ // if we had a hint, and we didn't get a frame, see if we should try the slow way
|
{ // if we had a hint, and we didn't get a frame, see if we should try the slow way
|
||||||
nsCOMPtr<nsIAtom>tag;
|
if (aContent->Tag() == nsLayoutAtoms::textTagName)
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
|
||||||
if (nsLayoutAtoms::textTagName == tag.get())
|
|
||||||
{
|
{
|
||||||
#ifdef NOISY_FINDFRAME
|
#ifdef NOISY_FINDFRAME
|
||||||
FFWC_slowSearchForText++;
|
FFWC_slowSearchForText++;
|
||||||
@ -12244,11 +12232,11 @@ nsCSSFrameConstructor::WrapFramesInFirstLetterFrame(
|
|||||||
// Take the old textFrame out of the inline parents child list
|
// Take the old textFrame out of the inline parents child list
|
||||||
DeletingFrameSubtree(aPresContext, aState.mPresShell,
|
DeletingFrameSubtree(aPresContext, aState.mPresShell,
|
||||||
aState.mFrameManager, textFrame);
|
aState.mFrameManager, textFrame);
|
||||||
parentFrame->RemoveFrame(aPresContext, *aState.mPresShell.get(),
|
parentFrame->RemoveFrame(aPresContext, *aState.mPresShell,
|
||||||
nsnull, textFrame);
|
nsnull, textFrame);
|
||||||
|
|
||||||
// Insert in the letter frame(s)
|
// Insert in the letter frame(s)
|
||||||
parentFrame->InsertFrames(aPresContext, *aState.mPresShell.get(),
|
parentFrame->InsertFrames(aPresContext, *aState.mPresShell,
|
||||||
nsnull, prevFrame, letterFrames.childList);
|
nsnull, prevFrame, letterFrames.childList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -12552,16 +12540,16 @@ nsCSSFrameConstructor::RecoverLetterFrames(nsIPresShell* aPresShell, nsIPresCont
|
|||||||
// Take the old textFrame out of the parents child list
|
// Take the old textFrame out of the parents child list
|
||||||
DeletingFrameSubtree(aPresContext, aState.mPresShell,
|
DeletingFrameSubtree(aPresContext, aState.mPresShell,
|
||||||
aState.mFrameManager, textFrame);
|
aState.mFrameManager, textFrame);
|
||||||
parentFrame->RemoveFrame(aPresContext, *aState.mPresShell.get(),
|
parentFrame->RemoveFrame(aPresContext, *aState.mPresShell,
|
||||||
nsnull, textFrame);
|
nsnull, textFrame);
|
||||||
|
|
||||||
// Insert in the letter frame(s)
|
// Insert in the letter frame(s)
|
||||||
parentFrame->InsertFrames(aPresContext, *aState.mPresShell.get(),
|
parentFrame->InsertFrames(aPresContext, *aState.mPresShell,
|
||||||
nsnull, prevFrame, letterFrames.childList);
|
nsnull, prevFrame, letterFrames.childList);
|
||||||
|
|
||||||
// Insert in floats too if needed
|
// Insert in floats too if needed
|
||||||
if (aState.mFloatedItems.childList) {
|
if (aState.mFloatedItems.childList) {
|
||||||
aBlockFrame->AppendFrames(aPresContext, *aState.mPresShell.get(),
|
aBlockFrame->AppendFrames(aPresContext, *aState.mPresShell,
|
||||||
nsLayoutAtoms::floatList,
|
nsLayoutAtoms::floatList,
|
||||||
aState.mFloatedItems.childList);
|
aState.mFloatedItems.childList);
|
||||||
}
|
}
|
||||||
@ -12608,13 +12596,11 @@ nsCSSFrameConstructor::CreateListBoxContent(nsIPresContext* aPresContext,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
|
||||||
aChild->GetTag(getter_AddRefs(tag));
|
|
||||||
|
|
||||||
PRInt32 namespaceID;
|
PRInt32 namespaceID;
|
||||||
aChild->GetNameSpaceID(&namespaceID);
|
aChild->GetNameSpaceID(&namespaceID);
|
||||||
|
|
||||||
rv = ConstructFrameInternal(shell, aPresContext, state, aChild, aParentFrame, tag, namespaceID,
|
rv = ConstructFrameInternal(shell, aPresContext, state, aChild,
|
||||||
|
aParentFrame, aChild->Tag(), namespaceID,
|
||||||
styleContext, frameItems, PR_FALSE);
|
styleContext, frameItems, PR_FALSE);
|
||||||
|
|
||||||
nsIFrame* newFrame = frameItems.childList;
|
nsIFrame* newFrame = frameItems.childList;
|
||||||
@ -12688,10 +12674,8 @@ nsCSSFrameConstructor::ConstructBlock(nsIPresShell* aPresShell,
|
|||||||
nsresult rv = ProcessChildren(aPresShell, aPresContext, aState, aContent,
|
nsresult rv = ProcessChildren(aPresShell, aPresContext, aState, aContent,
|
||||||
aNewFrame, PR_TRUE, childItems, PR_TRUE);
|
aNewFrame, PR_TRUE, childItems, PR_TRUE);
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> tag;
|
CreateAnonymousFrames(aPresShell, aPresContext, aContent->Tag(), aState,
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
aContent, aNewFrame, PR_FALSE, childItems);
|
||||||
CreateAnonymousFrames(aPresShell, aPresContext, tag, aState, aContent, aNewFrame,
|
|
||||||
PR_FALSE, childItems);
|
|
||||||
|
|
||||||
// Set the frame's initial child list
|
// Set the frame's initial child list
|
||||||
aNewFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
aNewFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
||||||
@ -12762,10 +12746,8 @@ nsCSSFrameConstructor::ConstructInline(nsIPresShell* aPresShell,
|
|||||||
aNewFrame, PR_TRUE, childItems, &kidsAllInline);
|
aNewFrame, PR_TRUE, childItems, &kidsAllInline);
|
||||||
if (kidsAllInline) {
|
if (kidsAllInline) {
|
||||||
// Set the inline frame's initial child list
|
// Set the inline frame's initial child list
|
||||||
nsCOMPtr<nsIAtom> tag;
|
CreateAnonymousFrames(aPresShell, aPresContext, aContent->Tag(), aState,
|
||||||
aContent->GetTag(getter_AddRefs(tag));
|
aContent, aNewFrame, PR_FALSE, childItems);
|
||||||
CreateAnonymousFrames(aPresShell, aPresContext, tag, aState, aContent, aNewFrame,
|
|
||||||
PR_FALSE, childItems);
|
|
||||||
|
|
||||||
aNewFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
aNewFrame->SetInitialChildList(aPresContext, nsnull, childItems.childList);
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user