зеркало из https://github.com/mozilla/gecko-dev.git
fix for bug 201982 - r=brade, sr=smfr
nsIEditProperty was an interface with no methods and only static members - moved it to an entirely static class.
This commit is contained in:
Родитель
5ee9cc297b
Коммит
f364fe0cc0
|
@ -43,7 +43,7 @@
|
|||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsIDOMElementCSSInlineStyle.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIEditProperty.h"
|
||||
#include "nsEditProperty.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsCRT.h"
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Glazman <glazman@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
|
@ -39,27 +40,27 @@
|
|||
#ifndef __nsEditProperty_h__
|
||||
#define __nsEditProperty_h__
|
||||
|
||||
#include "nsIEditProperty.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
/** simple class for describing a single property as it relates to a range of content.
|
||||
* not ref counted.
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
|
||||
/** simple interface for describing a single property as it relates to a range of content.
|
||||
*
|
||||
*/
|
||||
class nsEditProperty : public nsIEditProperty
|
||||
*/
|
||||
|
||||
class nsEditProperty
|
||||
{
|
||||
public:
|
||||
/*interfaces for addref and release and queryinterface*/
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
protected:
|
||||
nsEditProperty ();
|
||||
virtual ~nsEditProperty();
|
||||
static void RegisterAtoms();
|
||||
|
||||
#define EDITOR_ATOM(name_, value_) static nsIAtom* name_;
|
||||
#include "nsEditPropertyAtomList.h"
|
||||
#undef EDITOR_ATOM
|
||||
|
||||
friend nsresult NS_NewEditProperty(nsIEditProperty **aResult);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,75 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.1 (the "License"); you may not use this file except in
|
||||
* compliance with the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Glazman <glazman@netscape.com>
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the NPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the NPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef __nsIEditProperty_h__
|
||||
#define __nsIEditProperty_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
|
||||
#define NS_IEDITPROPERTY_IID \
|
||||
{/* 9875cd40-ca81-11d2-8f4d-006008159b0c*/ \
|
||||
0x9875cd40, 0xca81, 0x11d2, \
|
||||
{0x8f, 0x4d, 0x0, 0x60, 0x8, 0x15, 0x9b, 0x0c} }
|
||||
|
||||
/** simple interface for describing a single property as it relates to a range of content.
|
||||
*
|
||||
*/
|
||||
|
||||
class nsIEditProperty : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IEDITPROPERTY_IID)
|
||||
|
||||
public:
|
||||
|
||||
#define EDITOR_ATOM(name_, value_) static nsIAtom* name_;
|
||||
#include "nsEditPropertyAtomList.h"
|
||||
#undef EDITOR_ATOM
|
||||
|
||||
/** special strings */
|
||||
static nsString *allProperties; // this magic string represents the union of all inline style tags
|
||||
|
||||
};
|
||||
|
||||
extern nsresult NS_NewEditProperty(nsIEditProperty **aResult);
|
||||
|
||||
#endif
|
|
@ -59,6 +59,13 @@
|
|||
|
||||
static NS_DEFINE_CID(kEditorCommandTableCID, NS_EDITORCOMMANDTABLE_CID);
|
||||
|
||||
PR_STATIC_CALLBACK(nsresult)
|
||||
Initialize(nsIModule* self)
|
||||
{
|
||||
nsEditProperty::RegisterAtoms();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPlaintextEditor)
|
||||
|
||||
|
@ -157,4 +164,4 @@ static const nsModuleComponentInfo components[] = {
|
|||
// Implement the NSGetModule() exported function for your module
|
||||
// and the entire implementation of the module object.
|
||||
//
|
||||
NS_IMPL_NSGETMODULE(nsEditorModule, components)
|
||||
NS_IMPL_NSGETMODULE_WITH_CTOR(nsEditorModule, components, Initialize)
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIEditProperty.h"
|
||||
#include "nsEditProperty.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
|
@ -190,14 +190,14 @@ nsresult TextEditorTest::TestTextProperties()
|
|||
PRBool all = PR_FALSE;
|
||||
PRBool first=PR_FALSE;
|
||||
|
||||
result = htmlEditor->GetInlineProperty(nsIEditProperty::b, nsString(), nsString(), &first, &any, &all);
|
||||
result = htmlEditor->GetInlineProperty(nsEditProperty::b, nsString(), nsString(), &first, &any, &all);
|
||||
TEST_RESULT(result);
|
||||
NS_ASSERTION(PR_FALSE==first, "first should be false");
|
||||
NS_ASSERTION(PR_FALSE==any, "any should be false");
|
||||
NS_ASSERTION(PR_FALSE==all, "all should be false");
|
||||
result = htmlEditor->SetInlineProperty(nsIEditProperty::b, nsString(), nsString());
|
||||
result = htmlEditor->SetInlineProperty(nsEditProperty::b, nsString(), nsString());
|
||||
TEST_RESULT(result);
|
||||
result = htmlEditor->GetInlineProperty(nsIEditProperty::b, nsString(), nsString(), &first, &any, &all);
|
||||
result = htmlEditor->GetInlineProperty(nsEditProperty::b, nsString(), nsString(), &first, &any, &all);
|
||||
TEST_RESULT(result);
|
||||
NS_ASSERTION(PR_TRUE==first, "first should be true");
|
||||
NS_ASSERTION(PR_TRUE==any, "any should be true");
|
||||
|
@ -206,9 +206,9 @@ nsresult TextEditorTest::TestTextProperties()
|
|||
|
||||
// remove the bold we just set
|
||||
printf("set the whole first text node to not bold\n");
|
||||
result = htmlEditor->RemoveInlineProperty(nsIEditProperty::b, nsString());
|
||||
result = htmlEditor->RemoveInlineProperty(nsEditProperty::b, nsString());
|
||||
TEST_RESULT(result);
|
||||
result = htmlEditor->GetInlineProperty(nsIEditProperty::b, nsString(), nsString(), &first, &any, &all);
|
||||
result = htmlEditor->GetInlineProperty(nsEditProperty::b, nsString(), nsString(), &first, &any, &all);
|
||||
TEST_RESULT(result);
|
||||
NS_ASSERTION(PR_FALSE==first, "first should be false");
|
||||
NS_ASSERTION(PR_FALSE==any, "any should be false");
|
||||
|
@ -219,23 +219,23 @@ nsresult TextEditorTest::TestTextProperties()
|
|||
printf("set the first text node (1, length-1) to bold and italic, and (2, length-1) to underline.\n");
|
||||
selection->Collapse(textNode, 1);
|
||||
selection->Extend(textNode, length-1);
|
||||
result = htmlEditor->SetInlineProperty(nsIEditProperty::b, nsString(), nsString());
|
||||
result = htmlEditor->SetInlineProperty(nsEditProperty::b, nsString(), nsString());
|
||||
TEST_RESULT(result);
|
||||
result = htmlEditor->GetInlineProperty(nsIEditProperty::b, nsString(), nsString(), &first, &any, &all);
|
||||
result = htmlEditor->GetInlineProperty(nsEditProperty::b, nsString(), nsString(), &first, &any, &all);
|
||||
TEST_RESULT(result);
|
||||
NS_ASSERTION(PR_TRUE==first, "first should be true");
|
||||
NS_ASSERTION(PR_TRUE==any, "any should be true");
|
||||
NS_ASSERTION(PR_TRUE==all, "all should be true");
|
||||
mEditor->DebugDumpContent();
|
||||
// make all that same text italic
|
||||
result = htmlEditor->SetInlineProperty(nsIEditProperty::i, nsString(), nsString());
|
||||
result = htmlEditor->SetInlineProperty(nsEditProperty::i, nsString(), nsString());
|
||||
TEST_RESULT(result);
|
||||
result = htmlEditor->GetInlineProperty(nsIEditProperty::i, nsString(), nsString(), &first, &any, &all);
|
||||
result = htmlEditor->GetInlineProperty(nsEditProperty::i, nsString(), nsString(), &first, &any, &all);
|
||||
TEST_RESULT(result);
|
||||
NS_ASSERTION(PR_TRUE==first, "first should be true");
|
||||
NS_ASSERTION(PR_TRUE==any, "any should be true");
|
||||
NS_ASSERTION(PR_TRUE==all, "all should be true");
|
||||
result = htmlEditor->GetInlineProperty(nsIEditProperty::b, nsString(), nsString(), &first, &any, &all);
|
||||
result = htmlEditor->GetInlineProperty(nsEditProperty::b, nsString(), nsString(), &first, &any, &all);
|
||||
TEST_RESULT(result);
|
||||
NS_ASSERTION(PR_TRUE==first, "first should be true");
|
||||
NS_ASSERTION(PR_TRUE==any, "any should be true");
|
||||
|
@ -256,9 +256,9 @@ nsresult TextEditorTest::TestTextProperties()
|
|||
NS_ASSERTION(length==915, "wrong text node");
|
||||
selection->Collapse(textNode, 1);
|
||||
selection->Extend(textNode, length-2);
|
||||
result = htmlEditor->SetInlineProperty(nsIEditProperty::u, nsString(), nsString());
|
||||
result = htmlEditor->SetInlineProperty(nsEditProperty::u, nsString(), nsString());
|
||||
TEST_RESULT(result);
|
||||
result = htmlEditor->GetInlineProperty(nsIEditProperty::u, nsString(), nsString(), &first, &any, &all);
|
||||
result = htmlEditor->GetInlineProperty(nsEditProperty::u, nsString(), nsString(), &first, &any, &all);
|
||||
TEST_RESULT(result);
|
||||
NS_ASSERTION(PR_TRUE==first, "first should be true");
|
||||
NS_ASSERTION(PR_TRUE==any, "any should be true");
|
||||
|
|
|
@ -173,12 +173,12 @@ nsresult TypeInState::SetProp(nsIAtom *aProp, const nsString &aAttr)
|
|||
nsresult TypeInState::SetProp(nsIAtom *aProp, const nsString &aAttr, const nsString &aValue)
|
||||
{
|
||||
// special case for big/small, these nest
|
||||
if (nsIEditProperty::big == aProp)
|
||||
if (nsEditProperty::big == aProp)
|
||||
{
|
||||
mRelativeFontSize++;
|
||||
return NS_OK;
|
||||
}
|
||||
if (nsIEditProperty::small == aProp)
|
||||
if (nsEditProperty::small == aProp)
|
||||
{
|
||||
mRelativeFontSize--;
|
||||
return NS_OK;
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsIDOMNode.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsISelectionListener.h"
|
||||
#include "nsIEditProperty.h"
|
||||
#include "nsEditProperty.h"
|
||||
#include "nsString.h"
|
||||
#include "nsVoidArray.h"
|
||||
|
||||
|
|
|
@ -38,25 +38,15 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsEditProperty.h"
|
||||
#include "nsString.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsStaticAtom.h"
|
||||
|
||||
// singleton instance
|
||||
static nsEditProperty *gInstance;
|
||||
|
||||
NS_IMPL_ADDREF(nsEditProperty)
|
||||
|
||||
NS_IMPL_RELEASE(nsEditProperty)
|
||||
#include "nsEditProperty.h"
|
||||
|
||||
|
||||
#define EDITOR_ATOM(name_, value_) nsIAtom* nsIEditProperty::name_ = 0;
|
||||
#define EDITOR_ATOM(name_, value_) nsIAtom* nsEditProperty::name_ = 0;
|
||||
#include "nsEditPropertyAtomList.h"
|
||||
#undef EDITOR_ATOM
|
||||
|
||||
// special
|
||||
nsString * nsIEditProperty::allProperties;
|
||||
|
||||
/* From the HTML 4.0 DTD,
|
||||
|
||||
INLINE:
|
||||
|
@ -78,7 +68,8 @@ But what about BODY, TR, TD, TH, CAPTION, COL, COLGROUP, THEAD, TFOOT, LI, DT, D
|
|||
|
||||
|
||||
*/
|
||||
nsEditProperty::nsEditProperty()
|
||||
void
|
||||
nsEditProperty::RegisterAtoms()
|
||||
{
|
||||
// inline tags
|
||||
static const nsStaticAtom property_atoms[] = {
|
||||
|
@ -88,56 +79,4 @@ nsEditProperty::nsEditProperty()
|
|||
};
|
||||
|
||||
NS_RegisterStaticAtoms(property_atoms, NS_ARRAY_LENGTH(property_atoms));
|
||||
|
||||
// special
|
||||
if ( (nsIEditProperty::allProperties = new nsString) != nsnull )
|
||||
nsIEditProperty::allProperties->Assign(NS_LITERAL_STRING("moz_allproperties"));
|
||||
}
|
||||
|
||||
nsEditProperty::~nsEditProperty()
|
||||
{
|
||||
// special
|
||||
if (nsIEditProperty::allProperties) {
|
||||
delete (nsIEditProperty::allProperties);
|
||||
nsIEditProperty::allProperties = nsnull;
|
||||
}
|
||||
gInstance = nsnull;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditProperty::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
if (nsnull == aInstancePtr) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aIID.Equals(NS_GET_IID(nsISupports))) {
|
||||
*aInstancePtr = (void*)(nsISupports*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(NS_GET_IID(nsIEditProperty))) {
|
||||
*aInstancePtr = (void*)(nsIEditProperty*)this;
|
||||
NS_ADDREF_THIS();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
/* Factory for edit property object */
|
||||
nsresult NS_NewEditProperty(nsIEditProperty **aResult)
|
||||
{
|
||||
if (aResult)
|
||||
{
|
||||
if (!gInstance)
|
||||
{
|
||||
gInstance = new nsEditProperty();
|
||||
if (!gInstance) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
*aResult = gInstance;
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
|
|
@ -70,19 +70,7 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
/* nsITransactionListener method implementations. */
|
||||
NS_IMETHOD WillDo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, PRBool *aInterrupt);
|
||||
NS_IMETHOD DidDo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, nsresult aDoResult);
|
||||
NS_IMETHOD WillUndo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, PRBool *aInterrupt);
|
||||
NS_IMETHOD DidUndo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, nsresult aUndoResult);
|
||||
NS_IMETHOD WillRedo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, PRBool *aInterrupt);
|
||||
NS_IMETHOD DidRedo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, nsresult aRedoResult);
|
||||
NS_IMETHOD WillBeginBatch(nsITransactionManager *aTxMgr, PRBool *aInterrupt);
|
||||
NS_IMETHOD DidBeginBatch(nsITransactionManager *aTxMgr, nsresult aResult);
|
||||
NS_IMETHOD WillEndBatch(nsITransactionManager *aTxMgr, PRBool *aInterrupt);
|
||||
NS_IMETHOD DidEndBatch(nsITransactionManager *aTxMgr, nsresult aResult);
|
||||
NS_IMETHOD WillMerge(nsITransactionManager *aTxMgr, nsITransaction *aTopTransaction, nsITransaction *aTransaction, PRBool *aInterrupt);
|
||||
NS_IMETHOD DidMerge(nsITransactionManager *aTxMgr, nsITransaction *aTopTransaction, nsITransaction *aTransaction, PRBool aDidMerge, nsresult aMergeResult);
|
||||
|
||||
NS_DECL_NSITRANSACTIONLISTENER
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEditProperty.h"
|
||||
#include "nsEditProperty.h"
|
||||
#include "ChangeCSSInlineStyleTxn.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "TransactionFactory.h"
|
||||
|
@ -344,12 +344,12 @@ nsHTMLCSSUtils::IsCSSEditableProperty(nsIDOMNode * aNode,
|
|||
content->GetTag(*getter_AddRefs(tagName));
|
||||
|
||||
// html inline styles B I TT U STRIKE and COLOR/FACE on FONT
|
||||
if (nsIEditProperty::b == aProperty
|
||||
|| nsIEditProperty::i == aProperty
|
||||
|| nsIEditProperty::tt == aProperty
|
||||
|| nsIEditProperty::u == aProperty
|
||||
|| nsIEditProperty::strike == aProperty
|
||||
|| ((nsIEditProperty::font == aProperty) && aAttribute &&
|
||||
if (nsEditProperty::b == aProperty
|
||||
|| nsEditProperty::i == aProperty
|
||||
|| nsEditProperty::tt == aProperty
|
||||
|| nsEditProperty::u == aProperty
|
||||
|| nsEditProperty::strike == aProperty
|
||||
|| ((nsEditProperty::font == aProperty) && aAttribute &&
|
||||
(aAttribute->Equals(NS_LITERAL_STRING("color")) ||
|
||||
aAttribute->Equals(NS_LITERAL_STRING("face"))))) {
|
||||
return PR_TRUE;
|
||||
|
@ -357,39 +357,39 @@ nsHTMLCSSUtils::IsCSSEditableProperty(nsIDOMNode * aNode,
|
|||
|
||||
// ALIGN attribute on elements supporting it
|
||||
if (aAttribute && (aAttribute->Equals(NS_LITERAL_STRING("align"))) &&
|
||||
(nsIEditProperty::div == tagName
|
||||
|| nsIEditProperty::p == tagName
|
||||
|| nsIEditProperty::h1 == tagName
|
||||
|| nsIEditProperty::h2 == tagName
|
||||
|| nsIEditProperty::h3 == tagName
|
||||
|| nsIEditProperty::h4 == tagName
|
||||
|| nsIEditProperty::h5 == tagName
|
||||
|| nsIEditProperty::h6 == tagName
|
||||
|| nsIEditProperty::td == tagName
|
||||
|| nsIEditProperty::th == tagName
|
||||
|| nsIEditProperty::table == tagName
|
||||
|| nsIEditProperty::hr == tagName
|
||||
(nsEditProperty::div == tagName
|
||||
|| nsEditProperty::p == tagName
|
||||
|| nsEditProperty::h1 == tagName
|
||||
|| nsEditProperty::h2 == tagName
|
||||
|| nsEditProperty::h3 == tagName
|
||||
|| nsEditProperty::h4 == tagName
|
||||
|| nsEditProperty::h5 == tagName
|
||||
|| nsEditProperty::h6 == tagName
|
||||
|| nsEditProperty::td == tagName
|
||||
|| nsEditProperty::th == tagName
|
||||
|| nsEditProperty::table == tagName
|
||||
|| nsEditProperty::hr == tagName
|
||||
// Let's add the following elements here even if ALIGN has not
|
||||
// the same meaning for them
|
||||
|| nsIEditProperty::legend == tagName
|
||||
|| nsIEditProperty::caption == tagName)) {
|
||||
|| nsEditProperty::legend == tagName
|
||||
|| nsEditProperty::caption == tagName)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
if (aAttribute && (aAttribute->Equals(NS_LITERAL_STRING("valign"))) &&
|
||||
(nsIEditProperty::col == tagName
|
||||
|| nsIEditProperty::colgroup == tagName
|
||||
|| nsIEditProperty::tbody == tagName
|
||||
|| nsIEditProperty::td == tagName
|
||||
|| nsIEditProperty::th == tagName
|
||||
|| nsIEditProperty::tfoot == tagName
|
||||
|| nsIEditProperty::thead == tagName
|
||||
|| nsIEditProperty::tr == tagName)) {
|
||||
(nsEditProperty::col == tagName
|
||||
|| nsEditProperty::colgroup == tagName
|
||||
|| nsEditProperty::tbody == tagName
|
||||
|| nsEditProperty::td == tagName
|
||||
|| nsEditProperty::th == tagName
|
||||
|| nsEditProperty::tfoot == tagName
|
||||
|| nsEditProperty::thead == tagName
|
||||
|| nsEditProperty::tr == tagName)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// attributes TEXT, BACKGROUND and BGCOLOR on BODY
|
||||
if (aAttribute && (nsIEditProperty::body == tagName) &&
|
||||
if (aAttribute && (nsEditProperty::body == tagName) &&
|
||||
(aAttribute->Equals(NS_LITERAL_STRING("text"))
|
||||
|| aAttribute->Equals(NS_LITERAL_STRING("background"))
|
||||
|| aAttribute->Equals(NS_LITERAL_STRING("bgcolor")))) {
|
||||
|
@ -402,8 +402,8 @@ nsHTMLCSSUtils::IsCSSEditableProperty(nsIDOMNode * aNode,
|
|||
}
|
||||
|
||||
// attributes HEIGHT, WIDTH and NOWRAP on TD and TH
|
||||
if (aAttribute && ((nsIEditProperty::td == tagName)
|
||||
|| (nsIEditProperty::th == tagName)) &&
|
||||
if (aAttribute && ((nsEditProperty::td == tagName)
|
||||
|| (nsEditProperty::th == tagName)) &&
|
||||
(aAttribute->Equals(NS_LITERAL_STRING("height"))
|
||||
|| aAttribute->Equals(NS_LITERAL_STRING("width"))
|
||||
|| aAttribute->Equals(NS_LITERAL_STRING("nowrap")))) {
|
||||
|
@ -411,28 +411,28 @@ nsHTMLCSSUtils::IsCSSEditableProperty(nsIDOMNode * aNode,
|
|||
}
|
||||
|
||||
// attributes HEIGHT and WIDTH on TABLE
|
||||
if (aAttribute && (nsIEditProperty::table == tagName) &&
|
||||
if (aAttribute && (nsEditProperty::table == tagName) &&
|
||||
(aAttribute->Equals(NS_LITERAL_STRING("height"))
|
||||
|| aAttribute->Equals(NS_LITERAL_STRING("width")))) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// attributes SIZE and WIDTH on HR
|
||||
if (aAttribute && (nsIEditProperty::hr == tagName) &&
|
||||
if (aAttribute && (nsEditProperty::hr == tagName) &&
|
||||
(aAttribute->Equals(NS_LITERAL_STRING("size"))
|
||||
|| aAttribute->Equals(NS_LITERAL_STRING("width")))) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// attribute TYPE on OL UL LI
|
||||
if (aAttribute && (nsIEditProperty::ol == tagName
|
||||
|| nsIEditProperty::ul == tagName
|
||||
|| nsIEditProperty::li == tagName) &&
|
||||
if (aAttribute && (nsEditProperty::ol == tagName
|
||||
|| nsEditProperty::ul == tagName
|
||||
|| nsEditProperty::li == tagName) &&
|
||||
aAttribute->Equals(NS_LITERAL_STRING("type"))) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
if (aAttribute && nsIEditProperty::img == tagName &&
|
||||
if (aAttribute && nsEditProperty::img == tagName &&
|
||||
(aAttribute->Equals(NS_LITERAL_STRING("border"))
|
||||
|| aAttribute->Equals(NS_LITERAL_STRING("width"))
|
||||
|| aAttribute->Equals(NS_LITERAL_STRING("height")))) {
|
||||
|
@ -442,15 +442,15 @@ nsHTMLCSSUtils::IsCSSEditableProperty(nsIDOMNode * aNode,
|
|||
// other elements that we can align using CSS even if they
|
||||
// can't carry the html ALIGN attribute
|
||||
if (aAttribute && aAttribute->Equals(NS_LITERAL_STRING("align")) &&
|
||||
(nsIEditProperty::ul == tagName
|
||||
|| nsIEditProperty::ol == tagName
|
||||
|| nsIEditProperty::dl == tagName
|
||||
|| nsIEditProperty::li == tagName
|
||||
|| nsIEditProperty::dd == tagName
|
||||
|| nsIEditProperty::dt == tagName
|
||||
|| nsIEditProperty::address == tagName
|
||||
|| nsIEditProperty::pre == tagName
|
||||
|| nsIEditProperty::ul == tagName)) {
|
||||
(nsEditProperty::ul == tagName
|
||||
|| nsEditProperty::ol == tagName
|
||||
|| nsEditProperty::dl == tagName
|
||||
|| nsEditProperty::li == tagName
|
||||
|| nsEditProperty::dd == tagName
|
||||
|| nsEditProperty::dt == tagName
|
||||
|| nsEditProperty::address == tagName
|
||||
|| nsEditProperty::pre == tagName
|
||||
|| nsEditProperty::ul == tagName)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -637,7 +637,7 @@ nsHTMLCSSUtils::RemoveCSSInlineStyle(nsIDOMNode *aNode, nsIAtom *aProperty, cons
|
|||
nsresult res = RemoveCSSProperty(elem, aProperty, aPropertyValue, PR_FALSE);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
if (mHTMLEditor->NodeIsType(aNode, nsIEditProperty::span)) {
|
||||
if (mHTMLEditor->NodeIsType(aNode, nsEditProperty::span)) {
|
||||
PRInt32 attrCount;
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
|
||||
res = content->GetAttrCount(attrCount);
|
||||
|
@ -670,7 +670,7 @@ nsHTMLCSSUtils::RemoveCSSInlineStyle(nsIDOMNode *aNode, nsIAtom *aProperty, cons
|
|||
PRBool
|
||||
nsHTMLCSSUtils::IsCSSInvertable(nsIAtom *aProperty, const nsAString *aAttribute)
|
||||
{
|
||||
return PRBool(nsIEditProperty::b == aProperty);
|
||||
return PRBool(nsEditProperty::b == aProperty);
|
||||
}
|
||||
|
||||
// Get the default browser background color if we need it for GetCSSBackgroundColorState
|
||||
|
@ -783,61 +783,61 @@ nsHTMLCSSUtils::GetCSSPropertyAtom(nsCSSEditableProperty aProperty, nsIAtom ** a
|
|||
if (0 < aProperty) {
|
||||
switch (aProperty) {
|
||||
case eCSSEditableProperty_background_color:
|
||||
*aAtom = nsIEditProperty::cssBackgroundColor;
|
||||
*aAtom = nsEditProperty::cssBackgroundColor;
|
||||
break;
|
||||
case eCSSEditableProperty_background_image:
|
||||
*aAtom = nsIEditProperty::cssBackgroundImage;
|
||||
*aAtom = nsEditProperty::cssBackgroundImage;
|
||||
break;
|
||||
case eCSSEditableProperty_border:
|
||||
*aAtom = nsIEditProperty::cssBorder;
|
||||
*aAtom = nsEditProperty::cssBorder;
|
||||
break;
|
||||
case eCSSEditableProperty_caption_side:
|
||||
*aAtom = nsIEditProperty::cssCaptionSide;
|
||||
*aAtom = nsEditProperty::cssCaptionSide;
|
||||
break;
|
||||
case eCSSEditableProperty_color:
|
||||
*aAtom = nsIEditProperty::cssColor;
|
||||
*aAtom = nsEditProperty::cssColor;
|
||||
break;
|
||||
case eCSSEditableProperty_float:
|
||||
*aAtom = nsIEditProperty::cssFloat;
|
||||
*aAtom = nsEditProperty::cssFloat;
|
||||
break;
|
||||
case eCSSEditableProperty_font_family:
|
||||
*aAtom = nsIEditProperty::cssFontFamily;
|
||||
*aAtom = nsEditProperty::cssFontFamily;
|
||||
break;
|
||||
case eCSSEditableProperty_font_size:
|
||||
*aAtom = nsIEditProperty::cssFontSize;
|
||||
*aAtom = nsEditProperty::cssFontSize;
|
||||
break;
|
||||
case eCSSEditableProperty_font_style:
|
||||
*aAtom = nsIEditProperty::cssFontStyle;
|
||||
*aAtom = nsEditProperty::cssFontStyle;
|
||||
break;
|
||||
case eCSSEditableProperty_font_weight:
|
||||
*aAtom = nsIEditProperty::cssFontWeight;
|
||||
*aAtom = nsEditProperty::cssFontWeight;
|
||||
break;
|
||||
case eCSSEditableProperty_height:
|
||||
*aAtom = nsIEditProperty::cssHeight;
|
||||
*aAtom = nsEditProperty::cssHeight;
|
||||
break;
|
||||
case eCSSEditableProperty_list_style_type:
|
||||
*aAtom = nsIEditProperty::cssListStyleType;
|
||||
*aAtom = nsEditProperty::cssListStyleType;
|
||||
break;
|
||||
case eCSSEditableProperty_margin_left:
|
||||
*aAtom = nsIEditProperty::cssMarginLeft;
|
||||
*aAtom = nsEditProperty::cssMarginLeft;
|
||||
break;
|
||||
case eCSSEditableProperty_margin_right:
|
||||
*aAtom = nsIEditProperty::cssMarginRight;
|
||||
*aAtom = nsEditProperty::cssMarginRight;
|
||||
break;
|
||||
case eCSSEditableProperty_text_align:
|
||||
*aAtom = nsIEditProperty::cssTextAlign;
|
||||
*aAtom = nsEditProperty::cssTextAlign;
|
||||
break;
|
||||
case eCSSEditableProperty_text_decoration:
|
||||
*aAtom = nsIEditProperty::cssTextDecoration;
|
||||
*aAtom = nsEditProperty::cssTextDecoration;
|
||||
break;
|
||||
case eCSSEditableProperty_vertical_align:
|
||||
*aAtom = nsIEditProperty::cssVerticalAlign;
|
||||
*aAtom = nsEditProperty::cssVerticalAlign;
|
||||
break;
|
||||
case eCSSEditableProperty_whitespace:
|
||||
*aAtom = nsIEditProperty::cssWhitespace;
|
||||
*aAtom = nsEditProperty::cssWhitespace;
|
||||
break;
|
||||
case eCSSEditableProperty_width:
|
||||
*aAtom = nsIEditProperty::cssWidth;
|
||||
*aAtom = nsEditProperty::cssWidth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -907,27 +907,27 @@ nsHTMLCSSUtils::GenerateCSSDeclarationsFromHTMLStyle(nsIDOMNode * aNode,
|
|||
nsCOMPtr<nsIAtom> tagName;
|
||||
content->GetTag(*getter_AddRefs(tagName));
|
||||
|
||||
if (nsIEditProperty::b == aHTMLProperty) {
|
||||
if (nsEditProperty::b == aHTMLProperty) {
|
||||
BuildCSSDeclarations(cssPropertyArray, cssValueArray, boldEquivTable, aValue, aGetOrRemoveRequest);
|
||||
}
|
||||
else if (nsIEditProperty::i == aHTMLProperty) {
|
||||
else if (nsEditProperty::i == aHTMLProperty) {
|
||||
BuildCSSDeclarations(cssPropertyArray, cssValueArray, italicEquivTable, aValue, aGetOrRemoveRequest);
|
||||
}
|
||||
else if (nsIEditProperty::u == aHTMLProperty) {
|
||||
else if (nsEditProperty::u == aHTMLProperty) {
|
||||
BuildCSSDeclarations(cssPropertyArray, cssValueArray, underlineEquivTable, aValue, aGetOrRemoveRequest);
|
||||
}
|
||||
else if (nsIEditProperty::strike == aHTMLProperty) {
|
||||
else if (nsEditProperty::strike == aHTMLProperty) {
|
||||
BuildCSSDeclarations(cssPropertyArray, cssValueArray, strikeEquivTable, aValue, aGetOrRemoveRequest);
|
||||
}
|
||||
else if (nsIEditProperty::tt == aHTMLProperty) {
|
||||
else if (nsEditProperty::tt == aHTMLProperty) {
|
||||
BuildCSSDeclarations(cssPropertyArray, cssValueArray, ttEquivTable, aValue, aGetOrRemoveRequest);
|
||||
}
|
||||
else if (aAttribute) {
|
||||
if (nsIEditProperty::font == aHTMLProperty &&
|
||||
if (nsEditProperty::font == aHTMLProperty &&
|
||||
aAttribute->Equals(NS_LITERAL_STRING("color"))) {
|
||||
BuildCSSDeclarations(cssPropertyArray, cssValueArray, fontColorEquivTable, aValue, aGetOrRemoveRequest);
|
||||
}
|
||||
else if (nsIEditProperty::font == aHTMLProperty &&
|
||||
else if (nsEditProperty::font == aHTMLProperty &&
|
||||
aAttribute->Equals(NS_LITERAL_STRING("face"))) {
|
||||
BuildCSSDeclarations(cssPropertyArray, cssValueArray, fontFaceEquivTable, aValue, aGetOrRemoveRequest);
|
||||
}
|
||||
|
@ -944,14 +944,14 @@ nsHTMLCSSUtils::GenerateCSSDeclarationsFromHTMLStyle(nsIDOMNode * aNode,
|
|||
BuildCSSDeclarations(cssPropertyArray, cssValueArray, borderEquivTable, aValue, aGetOrRemoveRequest);
|
||||
}
|
||||
else if (aAttribute->Equals(NS_LITERAL_STRING("align"))) {
|
||||
if (nsIEditProperty::table == tagName) {
|
||||
if (nsEditProperty::table == tagName) {
|
||||
BuildCSSDeclarations(cssPropertyArray, cssValueArray, tableAlignEquivTable, aValue, aGetOrRemoveRequest);
|
||||
}
|
||||
else if (nsIEditProperty::hr == tagName) {
|
||||
else if (nsEditProperty::hr == tagName) {
|
||||
BuildCSSDeclarations(cssPropertyArray, cssValueArray, hrAlignEquivTable, aValue, aGetOrRemoveRequest);
|
||||
}
|
||||
else if (nsIEditProperty::legend == tagName ||
|
||||
nsIEditProperty::caption == tagName) {
|
||||
else if (nsEditProperty::legend == tagName ||
|
||||
nsEditProperty::caption == tagName) {
|
||||
BuildCSSDeclarations(cssPropertyArray, cssValueArray, captionAlignEquivTable, aValue, aGetOrRemoveRequest);
|
||||
}
|
||||
else {
|
||||
|
@ -968,13 +968,13 @@ nsHTMLCSSUtils::GenerateCSSDeclarationsFromHTMLStyle(nsIDOMNode * aNode,
|
|||
BuildCSSDeclarations(cssPropertyArray, cssValueArray, widthEquivTable, aValue, aGetOrRemoveRequest);
|
||||
}
|
||||
else if (aAttribute->Equals(NS_LITERAL_STRING("height")) ||
|
||||
(nsIEditProperty::hr == tagName && aAttribute->Equals(NS_LITERAL_STRING("size")))) {
|
||||
(nsEditProperty::hr == tagName && aAttribute->Equals(NS_LITERAL_STRING("size")))) {
|
||||
BuildCSSDeclarations(cssPropertyArray, cssValueArray, heightEquivTable, aValue, aGetOrRemoveRequest);
|
||||
}
|
||||
else if (aAttribute->Equals(NS_LITERAL_STRING("type")) &&
|
||||
(nsIEditProperty::ol == tagName
|
||||
|| nsIEditProperty::ul == tagName
|
||||
|| nsIEditProperty::li == tagName)) {
|
||||
(nsEditProperty::ol == tagName
|
||||
|| nsEditProperty::ul == tagName
|
||||
|| nsEditProperty::li == tagName)) {
|
||||
BuildCSSDeclarations(cssPropertyArray, cssValueArray, listStyleTypeEquivTable, aValue, aGetOrRemoveRequest);
|
||||
}
|
||||
}
|
||||
|
@ -1149,7 +1149,7 @@ nsHTMLCSSUtils::IsCSSEquivalentToHTMLInlineStyleSet(nsIDOMNode * aNode,
|
|||
// early way out if we can
|
||||
if (valueString.Equals(NS_LITERAL_STRING(""))) return NS_OK;
|
||||
|
||||
if (nsIEditProperty::b == aHTMLProperty) {
|
||||
if (nsEditProperty::b == aHTMLProperty) {
|
||||
if (valueString.Equals(NS_LITERAL_STRING("bold"))) {
|
||||
aIsSet = PR_TRUE;
|
||||
}
|
||||
|
@ -1176,27 +1176,27 @@ nsHTMLCSSUtils::IsCSSEquivalentToHTMLInlineStyleSet(nsIDOMNode * aNode,
|
|||
}
|
||||
}
|
||||
|
||||
else if (nsIEditProperty::i == aHTMLProperty) {
|
||||
else if (nsEditProperty::i == aHTMLProperty) {
|
||||
if (valueString.Equals(NS_LITERAL_STRING("italic")) ||
|
||||
valueString.Equals(NS_LITERAL_STRING("oblique"))) {
|
||||
aIsSet= PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
else if (nsIEditProperty::u == aHTMLProperty) {
|
||||
else if (nsEditProperty::u == aHTMLProperty) {
|
||||
nsAutoString val;
|
||||
val.Assign(NS_LITERAL_STRING("underline"));
|
||||
aIsSet = PRBool(ChangeCSSInlineStyleTxn::ValueIncludes(valueString, val, PR_FALSE));
|
||||
}
|
||||
|
||||
else if (nsIEditProperty::strike == aHTMLProperty) {
|
||||
else if (nsEditProperty::strike == aHTMLProperty) {
|
||||
nsAutoString val;
|
||||
val.Assign(NS_LITERAL_STRING("line-through"));
|
||||
aIsSet = PRBool(ChangeCSSInlineStyleTxn::ValueIncludes(valueString, val, PR_FALSE));
|
||||
}
|
||||
|
||||
else if (aHTMLAttribute &&
|
||||
( (nsIEditProperty::font == aHTMLProperty &&
|
||||
( (nsEditProperty::font == aHTMLProperty &&
|
||||
aHTMLAttribute->Equals(NS_LITERAL_STRING("color"))) ||
|
||||
aHTMLAttribute->Equals(NS_LITERAL_STRING("bgcolor")))) {
|
||||
if (htmlValueString.IsEmpty())
|
||||
|
@ -1233,11 +1233,11 @@ nsHTMLCSSUtils::IsCSSEquivalentToHTMLInlineStyleSet(nsIDOMNode * aNode,
|
|||
}
|
||||
}
|
||||
|
||||
else if (nsIEditProperty::tt == aHTMLProperty) {
|
||||
else if (nsEditProperty::tt == aHTMLProperty) {
|
||||
aIsSet = Substring(valueString, 0, 9).Equals(NS_LITERAL_STRING("monospace"));
|
||||
}
|
||||
|
||||
else if ((nsIEditProperty::font == aHTMLProperty) && aHTMLAttribute
|
||||
else if ((nsEditProperty::font == aHTMLProperty) && aHTMLAttribute
|
||||
&& aHTMLAttribute->Equals(NS_LITERAL_STRING("face"))) {
|
||||
nsAutoString leftCSSValue;
|
||||
leftCSSValue = Substring(valueString, 0, 5);
|
||||
|
@ -1271,7 +1271,7 @@ nsHTMLCSSUtils::IsCSSEquivalentToHTMLInlineStyleSet(nsIDOMNode * aNode,
|
|||
}
|
||||
}
|
||||
|
||||
if (nsIEditProperty::u == aHTMLProperty || nsIEditProperty::strike == aHTMLProperty) {
|
||||
if (nsEditProperty::u == aHTMLProperty || nsEditProperty::strike == aHTMLProperty) {
|
||||
// unfortunately, the value of the text-decoration property is not inherited.
|
||||
// that means that we have to look at ancestors of node to see if they are underlined
|
||||
nsCOMPtr<nsIDOMNode> tmp;
|
||||
|
@ -1285,7 +1285,7 @@ nsHTMLCSSUtils::IsCSSEquivalentToHTMLInlineStyleSet(nsIDOMNode * aNode,
|
|||
node = nsnull;
|
||||
}
|
||||
}
|
||||
} while ((nsIEditProperty::u == aHTMLProperty || nsIEditProperty::strike == aHTMLProperty) &&
|
||||
} while ((nsEditProperty::u == aHTMLProperty || nsEditProperty::strike == aHTMLProperty) &&
|
||||
!aIsSet && node);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "nsIDOMElement.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
#include "ChangeCSSInlineStyleTxn.h"
|
||||
#include "nsIEditProperty.h"
|
||||
#include "nsEditProperty.h"
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
|
||||
#define SPECIFIED_STYLE_TYPE 1
|
||||
|
|
|
@ -606,11 +606,11 @@ nsHTMLEditRules::GetListState(PRBool *aMixed, PRBool *aOL, PRBool *aUL, PRBool *
|
|||
{
|
||||
nsIDOMNode* curNode = arrayOfNodes[i];
|
||||
|
||||
if (mHTMLEditor->NodeIsType(curNode,nsIEditProperty::ul))
|
||||
if (mHTMLEditor->NodeIsType(curNode,nsEditProperty::ul))
|
||||
*aUL = PR_TRUE;
|
||||
else if (mHTMLEditor->NodeIsType(curNode,nsIEditProperty::ol))
|
||||
else if (mHTMLEditor->NodeIsType(curNode,nsEditProperty::ol))
|
||||
*aOL = PR_TRUE;
|
||||
else if (mHTMLEditor->NodeIsType(curNode,nsIEditProperty::li))
|
||||
else if (mHTMLEditor->NodeIsType(curNode,nsEditProperty::li))
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
PRInt32 offset;
|
||||
|
@ -621,9 +621,9 @@ nsHTMLEditRules::GetListState(PRBool *aMixed, PRBool *aOL, PRBool *aUL, PRBool *
|
|||
else if (nsHTMLEditUtils::IsOrderedList(parent))
|
||||
*aOL = PR_TRUE;
|
||||
}
|
||||
else if (mHTMLEditor->NodeIsType(curNode,nsIEditProperty::dl) ||
|
||||
mHTMLEditor->NodeIsType(curNode,nsIEditProperty::dt) ||
|
||||
mHTMLEditor->NodeIsType(curNode,nsIEditProperty::dd) )
|
||||
else if (mHTMLEditor->NodeIsType(curNode,nsEditProperty::dl) ||
|
||||
mHTMLEditor->NodeIsType(curNode,nsEditProperty::dt) ||
|
||||
mHTMLEditor->NodeIsType(curNode,nsEditProperty::dd) )
|
||||
{
|
||||
*aDL = PR_TRUE;
|
||||
}
|
||||
|
@ -658,21 +658,21 @@ nsHTMLEditRules::GetListItemState(PRBool *aMixed, PRBool *aLI, PRBool *aDT, PRBo
|
|||
{
|
||||
nsIDOMNode* curNode = arrayOfNodes[i];
|
||||
|
||||
if (mHTMLEditor->NodeIsType(curNode,nsIEditProperty::ul) ||
|
||||
mHTMLEditor->NodeIsType(curNode,nsIEditProperty::ol) ||
|
||||
mHTMLEditor->NodeIsType(curNode,nsIEditProperty::li) )
|
||||
if (mHTMLEditor->NodeIsType(curNode,nsEditProperty::ul) ||
|
||||
mHTMLEditor->NodeIsType(curNode,nsEditProperty::ol) ||
|
||||
mHTMLEditor->NodeIsType(curNode,nsEditProperty::li) )
|
||||
{
|
||||
*aLI = PR_TRUE;
|
||||
}
|
||||
else if (mHTMLEditor->NodeIsType(curNode,nsIEditProperty::dt))
|
||||
else if (mHTMLEditor->NodeIsType(curNode,nsEditProperty::dt))
|
||||
{
|
||||
*aDT = PR_TRUE;
|
||||
}
|
||||
else if (mHTMLEditor->NodeIsType(curNode,nsIEditProperty::dd))
|
||||
else if (mHTMLEditor->NodeIsType(curNode,nsEditProperty::dd))
|
||||
{
|
||||
*aDD = PR_TRUE;
|
||||
}
|
||||
else if (mHTMLEditor->NodeIsType(curNode,nsIEditProperty::dl))
|
||||
else if (mHTMLEditor->NodeIsType(curNode,nsEditProperty::dl))
|
||||
{
|
||||
// need to look inside dl and see which types of items it has
|
||||
PRBool bDT, bDD;
|
||||
|
@ -894,7 +894,7 @@ nsHTMLEditRules::GetIndentState(PRBool *aCanIndent, PRBool *aCanOutdent)
|
|||
// we are in CSS mode, indentation is done using the margin-left property
|
||||
nsAutoString value;
|
||||
// retrieve its specified value
|
||||
mHTMLEditor->mHTMLCSSUtils->GetSpecifiedProperty(curNode, nsIEditProperty::cssMarginLeft, value);
|
||||
mHTMLEditor->mHTMLCSSUtils->GetSpecifiedProperty(curNode, nsEditProperty::cssMarginLeft, value);
|
||||
float f;
|
||||
nsCOMPtr<nsIAtom> unit;
|
||||
// get its number part and its unit
|
||||
|
@ -1136,9 +1136,9 @@ nsHTMLEditRules::GetFormatString(nsIDOMNode *aNode, nsAString &outFormat)
|
|||
|
||||
nsCOMPtr<nsIAtom> atom = mHTMLEditor->GetTag(aNode);
|
||||
|
||||
if ( nsIEditProperty::p == atom ||
|
||||
nsIEditProperty::address == atom ||
|
||||
nsIEditProperty::pre == atom )
|
||||
if ( nsEditProperty::p == atom ||
|
||||
nsEditProperty::address == atom ||
|
||||
nsEditProperty::pre == atom )
|
||||
{
|
||||
atom->ToString(format);
|
||||
}
|
||||
|
@ -5601,8 +5601,8 @@ nsHTMLEditRules::GetDefinitionListItemTypes(nsIDOMNode *aNode, PRBool &aDT, PRBo
|
|||
res = aNode->GetFirstChild(getter_AddRefs(child));
|
||||
while (child && NS_SUCCEEDED(res))
|
||||
{
|
||||
if (mHTMLEditor->NodeIsType(child,nsIEditProperty::dt)) aDT = PR_TRUE;
|
||||
else if (mHTMLEditor->NodeIsType(child,nsIEditProperty::dd)) aDD = PR_TRUE;
|
||||
if (mHTMLEditor->NodeIsType(child,nsEditProperty::dt)) aDT = PR_TRUE;
|
||||
else if (mHTMLEditor->NodeIsType(child,nsEditProperty::dd)) aDD = PR_TRUE;
|
||||
res = child->GetNextSibling(getter_AddRefs(temp));
|
||||
child = temp;
|
||||
}
|
||||
|
@ -8018,7 +8018,7 @@ nsHTMLEditRules::RemoveAlignment(nsIDOMNode * aNode, const nsAString & aAlignTyp
|
|||
else
|
||||
{
|
||||
nsAutoString dummyCssValue;
|
||||
res = mHTMLEditor->mHTMLCSSUtils->RemoveCSSInlineStyle(child, nsIEditProperty::cssTextAlign, dummyCssValue);
|
||||
res = mHTMLEditor->mHTMLCSSUtils->RemoveCSSInlineStyle(child, nsEditProperty::cssTextAlign, dummyCssValue);
|
||||
}
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
|
@ -8042,7 +8042,7 @@ nsHTMLEditRules::RemoveAlignment(nsIDOMNode * aNode, const nsAString & aAlignTyp
|
|||
// if we are in CSS mode and if the element is a DIV, let's remove it
|
||||
// if it does not carry any style hint (style attr, class or ID)
|
||||
nsAutoString dummyCssValue;
|
||||
res = mHTMLEditor->mHTMLCSSUtils->RemoveCSSInlineStyle(child, nsIEditProperty::cssTextAlign, dummyCssValue);
|
||||
res = mHTMLEditor->mHTMLCSSUtils->RemoveCSSInlineStyle(child, nsEditProperty::cssTextAlign, dummyCssValue);
|
||||
if (NS_FAILED(res)) return res;
|
||||
nsCOMPtr<nsIDOMElement> childElt = do_QueryInterface(child);
|
||||
PRBool hasStyleOrIdOrClass;
|
||||
|
@ -8202,7 +8202,7 @@ nsHTMLEditRules::RelativeChangeIndentation(nsIDOMNode *aNode, PRInt8 aRelativeCh
|
|||
|
||||
nsAutoString value;
|
||||
nsresult res;
|
||||
mHTMLEditor->mHTMLCSSUtils->GetSpecifiedProperty(aNode, nsIEditProperty::cssMarginLeft, value);
|
||||
mHTMLEditor->mHTMLCSSUtils->GetSpecifiedProperty(aNode, nsEditProperty::cssMarginLeft, value);
|
||||
float f;
|
||||
nsIAtom * unit;
|
||||
mHTMLEditor->mHTMLCSSUtils->ParseLength(value, &f, &unit);
|
||||
|
@ -8214,23 +8214,23 @@ nsHTMLEditRules::RelativeChangeIndentation(nsIDOMNode *aNode, PRInt8 aRelativeCh
|
|||
}
|
||||
nsAutoString unitString;
|
||||
unit->ToString(unitString);
|
||||
if (nsIEditProperty::cssInUnit == unit)
|
||||
if (nsEditProperty::cssInUnit == unit)
|
||||
f += NS_EDITOR_INDENT_INCREMENT_IN * aRelativeChange;
|
||||
else if (nsIEditProperty::cssCmUnit == unit)
|
||||
else if (nsEditProperty::cssCmUnit == unit)
|
||||
f += NS_EDITOR_INDENT_INCREMENT_CM * aRelativeChange;
|
||||
else if (nsIEditProperty::cssMmUnit == unit)
|
||||
else if (nsEditProperty::cssMmUnit == unit)
|
||||
f += NS_EDITOR_INDENT_INCREMENT_MM * aRelativeChange;
|
||||
else if (nsIEditProperty::cssPtUnit == unit)
|
||||
else if (nsEditProperty::cssPtUnit == unit)
|
||||
f += NS_EDITOR_INDENT_INCREMENT_PT * aRelativeChange;
|
||||
else if (nsIEditProperty::cssPcUnit == unit)
|
||||
else if (nsEditProperty::cssPcUnit == unit)
|
||||
f += NS_EDITOR_INDENT_INCREMENT_PC * aRelativeChange;
|
||||
else if (nsIEditProperty::cssEmUnit == unit)
|
||||
else if (nsEditProperty::cssEmUnit == unit)
|
||||
f += NS_EDITOR_INDENT_INCREMENT_EM * aRelativeChange;
|
||||
else if (nsIEditProperty::cssExUnit == unit)
|
||||
else if (nsEditProperty::cssExUnit == unit)
|
||||
f += NS_EDITOR_INDENT_INCREMENT_EX * aRelativeChange;
|
||||
else if (nsIEditProperty::cssPxUnit == unit)
|
||||
else if (nsEditProperty::cssPxUnit == unit)
|
||||
f += NS_EDITOR_INDENT_INCREMENT_PX * aRelativeChange;
|
||||
else if (nsIEditProperty::cssPercentUnit == unit)
|
||||
else if (nsEditProperty::cssPercentUnit == unit)
|
||||
f += NS_EDITOR_INDENT_INCREMENT_PERCENT * aRelativeChange;
|
||||
|
||||
NS_IF_RELEASE(unit);
|
||||
|
@ -8241,10 +8241,10 @@ nsHTMLEditRules::RelativeChangeIndentation(nsIDOMNode *aNode, PRInt8 aRelativeCh
|
|||
nsAutoString newValue;
|
||||
newValue.AppendFloat(f);
|
||||
newValue.Append(unitString);
|
||||
mHTMLEditor->mHTMLCSSUtils->SetCSSProperty(element, nsIEditProperty::cssMarginLeft, newValue, PR_FALSE);
|
||||
mHTMLEditor->mHTMLCSSUtils->SetCSSProperty(element, nsEditProperty::cssMarginLeft, newValue, PR_FALSE);
|
||||
}
|
||||
else {
|
||||
mHTMLEditor->mHTMLCSSUtils->RemoveCSSProperty(element, nsIEditProperty::cssMarginLeft, value, PR_FALSE);
|
||||
mHTMLEditor->mHTMLCSSUtils->RemoveCSSProperty(element, nsEditProperty::cssMarginLeft, value, PR_FALSE);
|
||||
if (nsHTMLEditUtils::IsDiv(aNode)) {
|
||||
// we deal with a DIV ; let's see if it is useless and if we can remove it
|
||||
nsCOMPtr<nsIDOMNamedNodeMap> attributeList;
|
||||
|
|
|
@ -289,11 +289,6 @@ NS_IMETHODIMP nsHTMLEditor::Init(nsIDOMDocument *aDoc,
|
|||
mRangeHelper = do_CreateInstance(kRangeUtilsCID);
|
||||
if (!mRangeHelper) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Init mEditProperty
|
||||
result = NS_NewEditProperty(getter_AddRefs(mEditProperty));
|
||||
if (NS_FAILED(result)) { return result; }
|
||||
if (!mEditProperty) {return NS_ERROR_NULL_POINTER;}
|
||||
|
||||
if (1)
|
||||
{
|
||||
// block to scope nsAutoEditInitRulesTrigger
|
||||
|
@ -641,16 +636,16 @@ nsHTMLEditor::NodeIsBlockStatic(nsIDOMNode *aNode, PRBool *aIsBlock)
|
|||
|
||||
// Nodes we know we want to treat as block
|
||||
// even though the parser says they're not:
|
||||
if (tagAtom==nsIEditProperty::body ||
|
||||
tagAtom==nsIEditProperty::head ||
|
||||
tagAtom==nsIEditProperty::tbody ||
|
||||
tagAtom==nsIEditProperty::thead ||
|
||||
tagAtom==nsIEditProperty::tfoot ||
|
||||
tagAtom==nsIEditProperty::tr ||
|
||||
tagAtom==nsIEditProperty::th ||
|
||||
tagAtom==nsIEditProperty::td ||
|
||||
tagAtom==nsIEditProperty::li ||
|
||||
tagAtom==nsIEditProperty::pre)
|
||||
if (tagAtom==nsEditProperty::body ||
|
||||
tagAtom==nsEditProperty::head ||
|
||||
tagAtom==nsEditProperty::tbody ||
|
||||
tagAtom==nsEditProperty::thead ||
|
||||
tagAtom==nsEditProperty::tfoot ||
|
||||
tagAtom==nsEditProperty::tr ||
|
||||
tagAtom==nsEditProperty::th ||
|
||||
tagAtom==nsEditProperty::td ||
|
||||
tagAtom==nsEditProperty::li ||
|
||||
tagAtom==nsEditProperty::pre)
|
||||
{
|
||||
*aIsBlock = PR_TRUE;
|
||||
return NS_OK;
|
||||
|
@ -668,31 +663,31 @@ nsHTMLEditor::NodeIsBlockStatic(nsIDOMNode *aNode, PRBool *aIsBlock)
|
|||
|
||||
#ifdef DEBUG
|
||||
// Check this against what we would have said with the old code:
|
||||
if (tagAtom==nsIEditProperty::p ||
|
||||
tagAtom==nsIEditProperty::div ||
|
||||
tagAtom==nsIEditProperty::blockquote ||
|
||||
tagAtom==nsIEditProperty::h1 ||
|
||||
tagAtom==nsIEditProperty::h2 ||
|
||||
tagAtom==nsIEditProperty::h3 ||
|
||||
tagAtom==nsIEditProperty::h4 ||
|
||||
tagAtom==nsIEditProperty::h5 ||
|
||||
tagAtom==nsIEditProperty::h6 ||
|
||||
tagAtom==nsIEditProperty::ul ||
|
||||
tagAtom==nsIEditProperty::ol ||
|
||||
tagAtom==nsIEditProperty::dl ||
|
||||
tagAtom==nsIEditProperty::noscript ||
|
||||
tagAtom==nsIEditProperty::form ||
|
||||
tagAtom==nsIEditProperty::hr ||
|
||||
tagAtom==nsIEditProperty::table ||
|
||||
tagAtom==nsIEditProperty::fieldset ||
|
||||
tagAtom==nsIEditProperty::address ||
|
||||
tagAtom==nsIEditProperty::caption ||
|
||||
tagAtom==nsIEditProperty::col ||
|
||||
tagAtom==nsIEditProperty::colgroup ||
|
||||
tagAtom==nsIEditProperty::li ||
|
||||
tagAtom==nsIEditProperty::dt ||
|
||||
tagAtom==nsIEditProperty::dd ||
|
||||
tagAtom==nsIEditProperty::legend )
|
||||
if (tagAtom==nsEditProperty::p ||
|
||||
tagAtom==nsEditProperty::div ||
|
||||
tagAtom==nsEditProperty::blockquote ||
|
||||
tagAtom==nsEditProperty::h1 ||
|
||||
tagAtom==nsEditProperty::h2 ||
|
||||
tagAtom==nsEditProperty::h3 ||
|
||||
tagAtom==nsEditProperty::h4 ||
|
||||
tagAtom==nsEditProperty::h5 ||
|
||||
tagAtom==nsEditProperty::h6 ||
|
||||
tagAtom==nsEditProperty::ul ||
|
||||
tagAtom==nsEditProperty::ol ||
|
||||
tagAtom==nsEditProperty::dl ||
|
||||
tagAtom==nsEditProperty::noscript ||
|
||||
tagAtom==nsEditProperty::form ||
|
||||
tagAtom==nsEditProperty::hr ||
|
||||
tagAtom==nsEditProperty::table ||
|
||||
tagAtom==nsEditProperty::fieldset ||
|
||||
tagAtom==nsEditProperty::address ||
|
||||
tagAtom==nsEditProperty::caption ||
|
||||
tagAtom==nsEditProperty::col ||
|
||||
tagAtom==nsEditProperty::colgroup ||
|
||||
tagAtom==nsEditProperty::li ||
|
||||
tagAtom==nsEditProperty::dt ||
|
||||
tagAtom==nsEditProperty::dd ||
|
||||
tagAtom==nsEditProperty::legend )
|
||||
{
|
||||
if (!(*aIsBlock))
|
||||
{
|
||||
|
@ -721,39 +716,39 @@ nsHTMLEditor::NodeIsBlockStatic(nsIDOMNode *aNode, PRBool *aIsBlock)
|
|||
nsIAtom *tagAtom = NS_NewAtom(tagName);
|
||||
if (!tagAtom) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
if (tagAtom==nsIEditProperty::p ||
|
||||
tagAtom==nsIEditProperty::div ||
|
||||
tagAtom==nsIEditProperty::blockquote ||
|
||||
tagAtom==nsIEditProperty::h1 ||
|
||||
tagAtom==nsIEditProperty::h2 ||
|
||||
tagAtom==nsIEditProperty::h3 ||
|
||||
tagAtom==nsIEditProperty::h4 ||
|
||||
tagAtom==nsIEditProperty::h5 ||
|
||||
tagAtom==nsIEditProperty::h6 ||
|
||||
tagAtom==nsIEditProperty::ul ||
|
||||
tagAtom==nsIEditProperty::ol ||
|
||||
tagAtom==nsIEditProperty::dl ||
|
||||
tagAtom==nsIEditProperty::pre ||
|
||||
tagAtom==nsIEditProperty::noscript ||
|
||||
tagAtom==nsIEditProperty::form ||
|
||||
tagAtom==nsIEditProperty::hr ||
|
||||
tagAtom==nsIEditProperty::fieldset ||
|
||||
tagAtom==nsIEditProperty::address ||
|
||||
tagAtom==nsIEditProperty::body ||
|
||||
tagAtom==nsIEditProperty::caption ||
|
||||
tagAtom==nsIEditProperty::table ||
|
||||
tagAtom==nsIEditProperty::tbody ||
|
||||
tagAtom==nsIEditProperty::thead ||
|
||||
tagAtom==nsIEditProperty::tfoot ||
|
||||
tagAtom==nsIEditProperty::tr ||
|
||||
tagAtom==nsIEditProperty::td ||
|
||||
tagAtom==nsIEditProperty::th ||
|
||||
tagAtom==nsIEditProperty::col ||
|
||||
tagAtom==nsIEditProperty::colgroup ||
|
||||
tagAtom==nsIEditProperty::li ||
|
||||
tagAtom==nsIEditProperty::dt ||
|
||||
tagAtom==nsIEditProperty::dd ||
|
||||
tagAtom==nsIEditProperty::legend )
|
||||
if (tagAtom==nsEditProperty::p ||
|
||||
tagAtom==nsEditProperty::div ||
|
||||
tagAtom==nsEditProperty::blockquote ||
|
||||
tagAtom==nsEditProperty::h1 ||
|
||||
tagAtom==nsEditProperty::h2 ||
|
||||
tagAtom==nsEditProperty::h3 ||
|
||||
tagAtom==nsEditProperty::h4 ||
|
||||
tagAtom==nsEditProperty::h5 ||
|
||||
tagAtom==nsEditProperty::h6 ||
|
||||
tagAtom==nsEditProperty::ul ||
|
||||
tagAtom==nsEditProperty::ol ||
|
||||
tagAtom==nsEditProperty::dl ||
|
||||
tagAtom==nsEditProperty::pre ||
|
||||
tagAtom==nsEditProperty::noscript ||
|
||||
tagAtom==nsEditProperty::form ||
|
||||
tagAtom==nsEditProperty::hr ||
|
||||
tagAtom==nsEditProperty::fieldset ||
|
||||
tagAtom==nsEditProperty::address ||
|
||||
tagAtom==nsEditProperty::body ||
|
||||
tagAtom==nsEditProperty::caption ||
|
||||
tagAtom==nsEditProperty::table ||
|
||||
tagAtom==nsEditProperty::tbody ||
|
||||
tagAtom==nsEditProperty::thead ||
|
||||
tagAtom==nsEditProperty::tfoot ||
|
||||
tagAtom==nsEditProperty::tr ||
|
||||
tagAtom==nsEditProperty::td ||
|
||||
tagAtom==nsEditProperty::th ||
|
||||
tagAtom==nsEditProperty::col ||
|
||||
tagAtom==nsEditProperty::colgroup ||
|
||||
tagAtom==nsEditProperty::li ||
|
||||
tagAtom==nsEditProperty::dt ||
|
||||
tagAtom==nsEditProperty::dd ||
|
||||
tagAtom==nsEditProperty::legend )
|
||||
{
|
||||
*aIsBlock = PR_TRUE;
|
||||
}
|
||||
|
@ -948,7 +943,7 @@ nsHTMLEditor::GetBlockSectionsForRange(nsIDOMRange *aRange,
|
|||
nsCOMPtr<nsIAtom> currentContentTag;
|
||||
currentContent->GetTag(*getter_AddRefs(currentContentTag));
|
||||
// <BR> divides block content ranges. We can achieve this by nulling out lastRange
|
||||
if (nsIEditProperty::br==currentContentTag)
|
||||
if (nsEditProperty::br==currentContentTag)
|
||||
{
|
||||
lastRange = nsnull;
|
||||
}
|
||||
|
@ -2532,7 +2527,7 @@ nsHTMLEditor::GetCSSBackgroundColorState(PRBool *aMixed, nsAString &aOutColor, P
|
|||
}
|
||||
do {
|
||||
// retrieve the computed style of background-color for blockParent
|
||||
mHTMLCSSUtils->GetComputedProperty(blockParent, nsIEditProperty::cssBackgroundColor,
|
||||
mHTMLCSSUtils->GetComputedProperty(blockParent, nsEditProperty::cssBackgroundColor,
|
||||
aOutColor);
|
||||
tmp = blockParent;
|
||||
res = tmp->GetParentNode(getter_AddRefs(blockParent));
|
||||
|
@ -2567,7 +2562,7 @@ nsHTMLEditor::GetCSSBackgroundColorState(PRBool *aMixed, nsAString &aOutColor, P
|
|||
else {
|
||||
// no, it's not; let's retrieve the computed style of background-color for the
|
||||
// node to examine
|
||||
mHTMLCSSUtils->GetComputedProperty(nodeToExamine, nsIEditProperty::cssBackgroundColor,
|
||||
mHTMLCSSUtils->GetComputedProperty(nodeToExamine, nsEditProperty::cssBackgroundColor,
|
||||
aOutColor);
|
||||
if (!aOutColor.Equals(NS_LITERAL_STRING("transparent"))) {
|
||||
break;
|
||||
|
@ -3506,7 +3501,7 @@ nsHTMLEditor::InsertLinkAroundSelection(nsIDOMElement* aAnchorElement)
|
|||
res = attribute->GetValue(value);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
res = SetInlineProperty(nsIEditProperty::a, name, value);
|
||||
res = SetInlineProperty(nsEditProperty::a, name, value);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
}
|
||||
|
@ -4136,7 +4131,7 @@ nsCOMPtr<nsIDOMNode> nsHTMLEditor::FindUserSelectAllNode(nsIDOMNode *aNode)
|
|||
nsAutoString mozUserSelectValue;
|
||||
while (node)
|
||||
{
|
||||
mHTMLCSSUtils->GetComputedProperty(node, nsIEditProperty::cssMozUserSelect, mozUserSelectValue);
|
||||
mHTMLCSSUtils->GetComputedProperty(node, nsEditProperty::cssMozUserSelect, mozUserSelectValue);
|
||||
if (mozUserSelectValue.Equals(NS_LITERAL_STRING("all")))
|
||||
{
|
||||
resultNode = node;
|
||||
|
@ -4680,13 +4675,13 @@ nsHTMLEditor::SetCaretInTableCell(nsIDOMElement* aElement)
|
|||
{
|
||||
nsCOMPtr<nsIAtom> atom;
|
||||
content->GetTag(*getter_AddRefs(atom));
|
||||
if (atom.get() == nsIEditProperty::table ||
|
||||
atom.get() == nsIEditProperty::tbody ||
|
||||
atom.get() == nsIEditProperty::thead ||
|
||||
atom.get() == nsIEditProperty::tfoot ||
|
||||
atom.get() == nsIEditProperty::caption ||
|
||||
atom.get() == nsIEditProperty::tr ||
|
||||
atom.get() == nsIEditProperty::td )
|
||||
if (atom.get() == nsEditProperty::table ||
|
||||
atom.get() == nsEditProperty::tbody ||
|
||||
atom.get() == nsEditProperty::thead ||
|
||||
atom.get() == nsEditProperty::tfoot ||
|
||||
atom.get() == nsEditProperty::caption ||
|
||||
atom.get() == nsEditProperty::tr ||
|
||||
atom.get() == nsEditProperty::td )
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aElement);
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
|
@ -4930,8 +4925,8 @@ nsHTMLEditor::GetNextElementByTagName(nsIDOMElement *aCurrentElement,
|
|||
|
||||
nsIAtom *tagAtom = NS_NewAtom(*aTagName);
|
||||
if (!tagAtom) { return NS_ERROR_NULL_POINTER; }
|
||||
if (tagAtom==nsIEditProperty::th)
|
||||
tagAtom=nsIEditProperty::td;
|
||||
if (tagAtom==nsEditProperty::th)
|
||||
tagAtom=nsEditProperty::td;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> currentNode = do_QueryInterface(aCurrentElement);
|
||||
if (!currentNode)
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
|
||||
#include "nsEditRules.h"
|
||||
|
||||
#include "nsIEditProperty.h"
|
||||
#include "nsEditProperty.h"
|
||||
#include "nsHTMLCSSUtils.h"
|
||||
#include "nsIParserService.h"
|
||||
|
||||
|
@ -839,8 +839,6 @@ protected:
|
|||
nsCOMPtr<nsIAtom> mFontAtom;
|
||||
nsCOMPtr<nsIAtom> mLinkAtom;
|
||||
|
||||
nsCOMPtr<nsIEditProperty> mEditProperty;
|
||||
|
||||
nsCOMPtr<nsIDOMNode> mCachedNode;
|
||||
|
||||
PRBool mCachedBoldStyle;
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#include "nsIEditor.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
#include "nsIHTMLObjectResizer.h"
|
||||
#include "nsIEditProperty.h"
|
||||
#include "nsEditProperty.h"
|
||||
#include "nsTextEditUtils.h"
|
||||
|
||||
/*
|
||||
|
|
|
@ -571,7 +571,7 @@ nsresult nsHTMLEditor::SplitStyleAbovePoint(nsCOMPtr<nsIDOMNode> *aNode,
|
|||
SPECIFIED_STYLE_TYPE);
|
||||
}
|
||||
if ( (aProperty && NodeIsType(tmp, aProperty)) || // node is the correct inline prop
|
||||
(aProperty == nsIEditProperty::href && nsHTMLEditUtils::IsLink(tmp)) ||
|
||||
(aProperty == nsEditProperty::href && nsHTMLEditUtils::IsLink(tmp)) ||
|
||||
// node is href - test if really <a href=...
|
||||
(!aProperty && NodeIsProperty(tmp)) || // or node is any prop, and we asked to split them all
|
||||
isSet) // or the style is specified in the style attribute
|
||||
|
@ -594,7 +594,7 @@ PRBool nsHTMLEditor::NodeIsProperty(nsIDOMNode *aNode)
|
|||
if (!IsContainer(aNode)) return PR_FALSE;
|
||||
if (!IsEditable(aNode)) return PR_FALSE;
|
||||
if (IsBlockNode(aNode)) return PR_FALSE;
|
||||
if (NodeIsType(aNode, nsIEditProperty::a)) return PR_FALSE;
|
||||
if (NodeIsType(aNode, nsEditProperty::a)) return PR_FALSE;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -622,8 +622,8 @@ nsresult nsHTMLEditor::RemoveStyleInside(nsIDOMNode *aNode,
|
|||
// then process the node itself
|
||||
if ( !aChildrenOnly &&
|
||||
(aProperty && NodeIsType(aNode, aProperty) || // node is prop we asked for
|
||||
(aProperty == nsIEditProperty::href && nsHTMLEditUtils::IsLink(aNode)) || // but check for link (<a href=...)
|
||||
(aProperty == nsIEditProperty::name && nsHTMLEditUtils::IsNamedAnchor(aNode))) || // and for named anchors
|
||||
(aProperty == nsEditProperty::href && nsHTMLEditUtils::IsLink(aNode)) || // but check for link (<a href=...)
|
||||
(aProperty == nsEditProperty::name && nsHTMLEditUtils::IsNamedAnchor(aNode))) || // and for named anchors
|
||||
(!aProperty && NodeIsProperty(aNode))) // or node is any prop and we asked for that
|
||||
{
|
||||
// if we weren't passed an attribute, then we want to
|
||||
|
@ -676,12 +676,12 @@ nsresult nsHTMLEditor::RemoveStyleInside(nsIDOMNode *aNode,
|
|||
// remove the node if it is a span, if its style attribute is empty or absent,
|
||||
// and if it does not have a class nor an id
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aNode);
|
||||
res = RemoveElementIfNoStyleOrIdOrClass(element, nsIEditProperty::span);
|
||||
res = RemoveElementIfNoStyleOrIdOrClass(element, nsEditProperty::span);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( aProperty == nsIEditProperty::font && // or node is big or small and we are setting font size
|
||||
(NodeIsType(aNode, nsIEditProperty::big) || NodeIsType(aNode, nsIEditProperty::small)) &&
|
||||
if ( aProperty == nsEditProperty::font && // or node is big or small and we are setting font size
|
||||
(NodeIsType(aNode, nsEditProperty::big) || NodeIsType(aNode, nsEditProperty::small)) &&
|
||||
aAttribute->Equals(NS_LITERAL_STRING("size"),nsCaseInsensitiveStringComparator()))
|
||||
{
|
||||
res = RemoveContainer(aNode); // if we are setting font size, remove any nested bigs and smalls
|
||||
|
@ -1206,9 +1206,9 @@ nsresult nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsAStr
|
|||
// manipulating text attributes on a collapsed selection only sets state for the next text insertion
|
||||
|
||||
// For links, aProperty uses "href", use "a" instead
|
||||
if (aProperty == nsIEditProperty::href ||
|
||||
aProperty == nsIEditProperty::name)
|
||||
aProperty = nsIEditProperty::a;
|
||||
if (aProperty == nsEditProperty::href ||
|
||||
aProperty == nsEditProperty::name)
|
||||
aProperty = nsEditProperty::a;
|
||||
|
||||
if (aProperty) return mTypeInState->ClearProp(aProperty, nsAutoString(*aAttribute));
|
||||
else return mTypeInState->ClearAllProps();
|
||||
|
@ -1241,7 +1241,7 @@ nsresult nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsAStr
|
|||
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
|
||||
if (aProperty == nsIEditProperty::name)
|
||||
if (aProperty == nsEditProperty::name)
|
||||
{
|
||||
// promote range if it starts or end in a named anchor and we
|
||||
// want to remove named anchors
|
||||
|
@ -1402,8 +1402,8 @@ nsHTMLEditor::RelativeFontChange( PRInt32 aSizeChange)
|
|||
if (bCollapsed)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> atom;
|
||||
if (aSizeChange==1) atom = nsIEditProperty::big;
|
||||
else atom = nsIEditProperty::small;
|
||||
if (aSizeChange==1) atom = nsEditProperty::big;
|
||||
else atom = nsEditProperty::small;
|
||||
|
||||
// Let's see in what kind of element the selection is
|
||||
PRInt32 offset;
|
||||
|
@ -1641,7 +1641,7 @@ nsHTMLEditor::RelativeFontChangeHelper( PRInt32 aSizeChange,
|
|||
|
||||
// if this is a font node with size, put big/small inside it
|
||||
NS_NAMED_LITERAL_STRING(attr, "size");
|
||||
if (NodeIsType(aNode, nsIEditProperty::font) && HasAttr(aNode, &attr))
|
||||
if (NodeIsType(aNode, nsEditProperty::font) && HasAttr(aNode, &attr))
|
||||
{
|
||||
// cycle through children and adjust relative font size
|
||||
res = aNode->GetChildNodes(getter_AddRefs(childNodes));
|
||||
|
@ -1776,7 +1776,7 @@ nsHTMLEditor::GetFontFaceState(PRBool *aMixed, nsAString &outFace)
|
|||
PRBool first, any, all;
|
||||
|
||||
NS_NAMED_LITERAL_STRING(attr, "face");
|
||||
res = GetInlinePropertyBase(nsIEditProperty::font, &attr, nsnull, &first, &any, &all, &outFace);
|
||||
res = GetInlinePropertyBase(nsEditProperty::font, &attr, nsnull, &first, &any, &all, &outFace);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (any && !all) return res; // mixed
|
||||
if (all)
|
||||
|
@ -1785,13 +1785,13 @@ nsHTMLEditor::GetFontFaceState(PRBool *aMixed, nsAString &outFace)
|
|||
return res;
|
||||
}
|
||||
|
||||
res = GetInlinePropertyBase(nsIEditProperty::tt, nsnull, nsnull, &first, &any, &all,nsnull);
|
||||
res = GetInlinePropertyBase(nsEditProperty::tt, nsnull, nsnull, &first, &any, &all,nsnull);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (any && !all) return res; // mixed
|
||||
if (all)
|
||||
{
|
||||
*aMixed = PR_FALSE;
|
||||
nsIEditProperty::tt->ToString(outFace);
|
||||
nsEditProperty::tt->ToString(outFace);
|
||||
}
|
||||
|
||||
if (!any)
|
||||
|
@ -1815,7 +1815,7 @@ nsHTMLEditor::GetFontColorState(PRBool *aMixed, nsAString &aOutColor)
|
|||
NS_NAMED_LITERAL_STRING(colorStr, "color");
|
||||
PRBool first, any, all;
|
||||
|
||||
res = GetInlinePropertyBase(nsIEditProperty::font, &colorStr, nsnull, &first, &any, &all, &aOutColor);
|
||||
res = GetInlinePropertyBase(nsEditProperty::font, &colorStr, nsnull, &first, &any, &all, &aOutColor);
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (any && !all) return res; // mixed
|
||||
if (all)
|
||||
|
|
|
@ -298,11 +298,11 @@ nsHTMLEditor::SetResizerPosition(PRInt32 aX, PRInt32 aY, nsIDOMElement *aResizer
|
|||
y.AppendInt(aY);
|
||||
|
||||
mHTMLCSSUtils->SetCSSProperty(aResizer,
|
||||
nsIEditProperty::cssLeft,
|
||||
nsEditProperty::cssLeft,
|
||||
x + NS_LITERAL_STRING("px"),
|
||||
PR_TRUE);
|
||||
mHTMLCSSUtils->SetCSSProperty(aResizer,
|
||||
nsIEditProperty::cssTop,
|
||||
nsEditProperty::cssTop,
|
||||
y + NS_LITERAL_STRING("px"),
|
||||
PR_TRUE);
|
||||
}
|
||||
|
@ -597,11 +597,11 @@ nsHTMLEditor::StartResizing(nsIDOMElement *aHandle)
|
|||
w.AppendInt(mResizedObjectWidth);
|
||||
h.AppendInt(mResizedObjectHeight);
|
||||
mHTMLCSSUtils->SetCSSProperty(mResizingShadow,
|
||||
nsIEditProperty::cssWidth,
|
||||
nsEditProperty::cssWidth,
|
||||
w + NS_LITERAL_STRING("px"),
|
||||
PR_TRUE);
|
||||
mHTMLCSSUtils->SetCSSProperty(mResizingShadow,
|
||||
nsIEditProperty::cssHeight,
|
||||
nsEditProperty::cssHeight,
|
||||
h + NS_LITERAL_STRING("px"),
|
||||
PR_TRUE);
|
||||
|
||||
|
@ -685,11 +685,11 @@ nsHTMLEditor::SetResizingInfoPosition(PRInt32 aX, PRInt32 aY, PRInt32 aW, PRInt3
|
|||
x.AppendInt(aX + 20);
|
||||
y.AppendInt(aY + 20);
|
||||
mHTMLCSSUtils->SetCSSProperty(mResizingInfo,
|
||||
nsIEditProperty::cssLeft,
|
||||
nsEditProperty::cssLeft,
|
||||
x + NS_LITERAL_STRING("px"),
|
||||
PR_TRUE);
|
||||
mHTMLCSSUtils->SetCSSProperty(mResizingInfo,
|
||||
nsIEditProperty::cssTop,
|
||||
nsEditProperty::cssTop,
|
||||
y + NS_LITERAL_STRING("px"),
|
||||
PR_TRUE);
|
||||
|
||||
|
@ -745,11 +745,11 @@ nsHTMLEditor::SetShadowPosition(nsIDOMElement *aResizedObject,
|
|||
x.AppendInt(aX);
|
||||
y.AppendInt(aY);
|
||||
mHTMLCSSUtils->SetCSSProperty(mResizingShadow,
|
||||
nsIEditProperty::cssLeft,
|
||||
nsEditProperty::cssLeft,
|
||||
x + NS_LITERAL_STRING("px"),
|
||||
PR_TRUE);
|
||||
mHTMLCSSUtils->SetCSSProperty(mResizingShadow,
|
||||
nsIEditProperty::cssTop,
|
||||
nsEditProperty::cssTop,
|
||||
y + NS_LITERAL_STRING("px"),
|
||||
PR_TRUE);
|
||||
|
||||
|
@ -862,19 +862,19 @@ nsHTMLEditor::MouseMove(nsIDOMEvent* aMouseEvent)
|
|||
h.AppendInt(newHeight);
|
||||
|
||||
mHTMLCSSUtils->SetCSSProperty(mResizingShadow,
|
||||
nsIEditProperty::cssLeft,
|
||||
nsEditProperty::cssLeft,
|
||||
x + NS_LITERAL_STRING("px"),
|
||||
PR_TRUE);
|
||||
mHTMLCSSUtils->SetCSSProperty(mResizingShadow,
|
||||
nsIEditProperty::cssTop,
|
||||
nsEditProperty::cssTop,
|
||||
y + NS_LITERAL_STRING("px"),
|
||||
PR_TRUE);
|
||||
mHTMLCSSUtils->SetCSSProperty(mResizingShadow,
|
||||
nsIEditProperty::cssWidth,
|
||||
nsEditProperty::cssWidth,
|
||||
w + NS_LITERAL_STRING("px"),
|
||||
PR_TRUE);
|
||||
mHTMLCSSUtils->SetCSSProperty(mResizingShadow,
|
||||
nsIEditProperty::cssHeight,
|
||||
nsEditProperty::cssHeight,
|
||||
h + NS_LITERAL_STRING("px"),
|
||||
PR_TRUE);
|
||||
|
||||
|
@ -921,11 +921,11 @@ nsHTMLEditor::SetFinalSize(PRInt32 aX, PRInt32 aY)
|
|||
RemoveAttribute(mResizedObject, heightStr);
|
||||
|
||||
mHTMLCSSUtils->SetCSSProperty(mResizedObject,
|
||||
nsIEditProperty::cssWidth,
|
||||
nsEditProperty::cssWidth,
|
||||
w + NS_LITERAL_STRING("px"),
|
||||
PR_FALSE);
|
||||
mHTMLCSSUtils->SetCSSProperty(mResizedObject,
|
||||
nsIEditProperty::cssHeight,
|
||||
nsEditProperty::cssHeight,
|
||||
h + NS_LITERAL_STRING("px"),
|
||||
PR_FALSE);
|
||||
}
|
||||
|
@ -936,11 +936,11 @@ nsHTMLEditor::SetFinalSize(PRInt32 aX, PRInt32 aY)
|
|||
// triggering an immediate reflow; otherwise, we have problems
|
||||
// with asynchronous reflow
|
||||
mHTMLCSSUtils->SetCSSProperty(mResizedObject,
|
||||
nsIEditProperty::cssWidth,
|
||||
nsEditProperty::cssWidth,
|
||||
w + NS_LITERAL_STRING("px"),
|
||||
PR_FALSE);
|
||||
mHTMLCSSUtils->SetCSSProperty(mResizedObject,
|
||||
nsIEditProperty::cssHeight,
|
||||
nsEditProperty::cssHeight,
|
||||
h + NS_LITERAL_STRING("px"),
|
||||
PR_FALSE);
|
||||
|
||||
|
@ -948,11 +948,11 @@ nsHTMLEditor::SetFinalSize(PRInt32 aX, PRInt32 aY)
|
|||
SetAttribute(mResizedObject, heightStr, h);
|
||||
|
||||
mHTMLCSSUtils->RemoveCSSProperty(mResizedObject,
|
||||
nsIEditProperty::cssWidth,
|
||||
nsEditProperty::cssWidth,
|
||||
NS_LITERAL_STRING(""),
|
||||
PR_FALSE);
|
||||
mHTMLCSSUtils->RemoveCSSProperty(mResizedObject,
|
||||
nsIEditProperty::cssHeight,
|
||||
nsEditProperty::cssHeight,
|
||||
NS_LITERAL_STRING(""),
|
||||
PR_FALSE);
|
||||
}
|
||||
|
@ -1056,11 +1056,11 @@ nsHTMLEditor::CheckResizingState(nsISelection *aSelection)
|
|||
|
||||
nsCOMPtr<nsIDOMNode> tableContainer = GetEnclosingTable(focusNode);
|
||||
|
||||
if (nsIEditProperty::img == tagAtom ||
|
||||
if (nsEditProperty::img == tagAtom ||
|
||||
tableContainer) {
|
||||
mResizedObjectIsAnImage = PR_FALSE;
|
||||
|
||||
if (nsIEditProperty::img == tagAtom)
|
||||
if (nsEditProperty::img == tagAtom)
|
||||
mResizedObjectIsAnImage = PR_TRUE;
|
||||
else {
|
||||
focusNode = tableContainer;
|
||||
|
|
|
@ -182,7 +182,7 @@ PRBool IsRowNode(nsIDOMNode *aNode)
|
|||
if (content)
|
||||
{
|
||||
content->GetTag(*getter_AddRefs(atom));
|
||||
if (atom && atom.get() == nsIEditProperty::tr)
|
||||
if (atom && atom.get() == nsEditProperty::tr)
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
|
@ -283,7 +283,7 @@ nsHTMLEditor::GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode)
|
|||
{
|
||||
nsCOMPtr<nsIAtom> atom;
|
||||
content->GetTag(*getter_AddRefs(atom));
|
||||
if (atom.get() == nsIEditProperty::tr)
|
||||
if (atom.get() == nsEditProperty::tr)
|
||||
{
|
||||
// Found a row directly under <table>
|
||||
*aRowNode = tableChild.get();
|
||||
|
@ -291,9 +291,9 @@ nsHTMLEditor::GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode)
|
|||
return NS_OK;
|
||||
}
|
||||
// Look for row in one of the row container elements
|
||||
if (atom.get() == nsIEditProperty::tbody ||
|
||||
atom.get() == nsIEditProperty::thead ||
|
||||
atom.get() == nsIEditProperty::tfoot )
|
||||
if (atom.get() == nsEditProperty::tbody ||
|
||||
atom.get() == nsEditProperty::thead ||
|
||||
atom.get() == nsEditProperty::tfoot )
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> rowNode;
|
||||
res = tableChild->GetFirstChild(getter_AddRefs(rowNode));
|
||||
|
|
Загрузка…
Ссылка в новой задаче