зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1260651 part.56 Rename nsHTMLEditor to mozilla::HTMLEditor and related stuff r=mccr8
This patch renames classes/structs as: nsHTMLEditor -> mozilla::HTMLEditor nsHTMLEditor::BlobReader -> mozilla::HTMLEditor::BlobReader SetSelectionAfterTableEdit -> mozilla::AutoSelectionSetterAfterTableEdit nsHTMLEditor.h -> HTMLEditor.h (exposed as mozilla/editor/HTMLEditor.h) nsHTMLAbsPosition.cpp -> HTMLAbsPositionEditor.cpp nsHTMLAnonymousUtils.cpp -> HTMLAnonymousNodeEditor.cpp nsHTMLDataTransfer.cpp -> HTMLEditorDataTransfer.cpp nsHTMLEditorStyle.cpp -> HTMLStyleEditor.cpp nsHTMLInlineTableEditor.cpp -> HTMLInlineTableEditor.cpp nsHTMLObjectResizer.cpp -> HTMLEditorObjectResizer.cpp nsTableEditor.cpp -> HTMLTableEditor.cpp These new file names are clearer names which related to HTMLEditor than old names. MozReview-Commit-ID: DTWaoFvy0DF --HG-- rename : editor/libeditor/nsHTMLAbsPosition.cpp => editor/libeditor/HTMLAbsPositionEditor.cpp rename : editor/libeditor/nsHTMLAnonymousUtils.cpp => editor/libeditor/HTMLAnonymousNodeEditor.cpp rename : editor/libeditor/nsHTMLEditor.cpp => editor/libeditor/HTMLEditor.cpp rename : editor/libeditor/nsHTMLEditor.h => editor/libeditor/HTMLEditor.h rename : editor/libeditor/nsHTMLDataTransfer.cpp => editor/libeditor/HTMLEditorDataTransfer.cpp rename : editor/libeditor/nsHTMLObjectResizer.cpp => editor/libeditor/HTMLEditorObjectResizer.cpp rename : editor/libeditor/nsHTMLInlineTableEditor.cpp => editor/libeditor/HTMLInlineTableEditor.cpp rename : editor/libeditor/nsHTMLEditorStyle.cpp => editor/libeditor/HTMLStyleEditor.cpp rename : editor/libeditor/nsTableEditor.cpp => editor/libeditor/HTMLTableEditor.cpp
This commit is contained in:
Родитель
9e30876e77
Коммит
9b6e26f0bb
|
@ -4372,7 +4372,7 @@ nsDocument::SetStyleSheetApplicableState(StyleSheetHandle aSheet,
|
|||
|
||||
// We have to always notify, since this will be called for sheets
|
||||
// that are children of sheets in our style set, as well as some
|
||||
// sheets for nsHTMLEditor.
|
||||
// sheets for HTMLEditor.
|
||||
|
||||
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetApplicableStateChanged, (aSheet));
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "ChangeStyleTransaction.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/css/Declaration.h"
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
|
@ -20,7 +21,6 @@
|
|||
#include "nsDependentSubstring.h"
|
||||
#include "nsError.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
|
@ -301,7 +301,7 @@ const CSSEditUtils::CSSEquivTable hrAlignEquivTable[] = {
|
|||
{ CSSEditUtils::eCSSEditableProperty_NONE, 0 }
|
||||
};
|
||||
|
||||
CSSEditUtils::CSSEditUtils(nsHTMLEditor* aHTMLEditor)
|
||||
CSSEditUtils::CSSEditUtils(HTMLEditor* aHTMLEditor)
|
||||
: mHTMLEditor(aHTMLEditor)
|
||||
, mIsCSSPrefChecked(true)
|
||||
{
|
||||
|
@ -589,7 +589,7 @@ CSSEditUtils::RemoveCSSInlineStyle(nsIDOMNode* aNode,
|
|||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
if (!element->IsHTMLElement(nsGkAtoms::span) ||
|
||||
nsHTMLEditor::HasAttributes(element)) {
|
||||
HTMLEditor::HasAttributes(element)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "nscore.h" // for nsAString, nsresult, nullptr
|
||||
|
||||
class nsComputedDOMStyle;
|
||||
class nsHTMLEditor;
|
||||
class nsIAtom;
|
||||
class nsIContent;
|
||||
class nsIDOMCSSStyleDeclaration;
|
||||
|
@ -23,6 +22,7 @@ class nsString;
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
class HTMLEditor;
|
||||
namespace dom {
|
||||
class Element;
|
||||
} // namespace dom
|
||||
|
@ -36,7 +36,7 @@ typedef void (*nsProcessValueFunc)(const nsAString* aInputString,
|
|||
class CSSEditUtils final
|
||||
{
|
||||
public:
|
||||
explicit CSSEditUtils(nsHTMLEditor* aEditor);
|
||||
explicit CSSEditUtils(HTMLEditor* aEditor);
|
||||
~CSSEditUtils();
|
||||
|
||||
enum nsCSSEditableProperty
|
||||
|
@ -454,7 +454,7 @@ private:
|
|||
nsAString& aValue, StyleType aStyleType);
|
||||
|
||||
private:
|
||||
nsHTMLEditor* mHTMLEditor;
|
||||
HTMLEditor* mHTMLEditor;
|
||||
bool mIsCSSPrefChecked;
|
||||
};
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "EditorUtils.h"
|
||||
|
@ -20,7 +22,6 @@
|
|||
#include "nsEditor.h"
|
||||
#include "nsError.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "nsHTMLObjectResizer.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsROCSSPrimitiveValue.h"
|
||||
|
@ -46,13 +47,14 @@
|
|||
#include "nscore.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
namespace mozilla {
|
||||
|
||||
using namespace dom;
|
||||
|
||||
#define BLACK_BG_RGB_TRIGGER 0xd0
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::AbsolutePositionSelection(bool aEnabled)
|
||||
HTMLEditor::AbsolutePositionSelection(bool aEnabled)
|
||||
{
|
||||
AutoEditBatch beginBatching(this);
|
||||
AutoRules beginRulesSniffing(this,
|
||||
|
@ -78,7 +80,7 @@ nsHTMLEditor::AbsolutePositionSelection(bool aEnabled)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetAbsolutelyPositionedSelectionContainer(nsIDOMElement **_retval)
|
||||
HTMLEditor::GetAbsolutelyPositionedSelectionContainer(nsIDOMElement** _retval)
|
||||
{
|
||||
nsAutoString positionStr;
|
||||
nsCOMPtr<nsINode> node = GetSelectionContainer();
|
||||
|
@ -102,30 +104,31 @@ nsHTMLEditor::GetAbsolutelyPositionedSelectionContainer(nsIDOMElement **_retval)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetSelectionContainerAbsolutelyPositioned(bool *aIsSelectionContainerAbsolutelyPositioned)
|
||||
HTMLEditor::GetSelectionContainerAbsolutelyPositioned(
|
||||
bool* aIsSelectionContainerAbsolutelyPositioned)
|
||||
{
|
||||
*aIsSelectionContainerAbsolutelyPositioned = (mAbsolutelyPositionedObject != nullptr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetAbsolutePositioningEnabled(bool * aIsEnabled)
|
||||
HTMLEditor::GetAbsolutePositioningEnabled(bool* aIsEnabled)
|
||||
{
|
||||
*aIsEnabled = mIsAbsolutelyPositioningEnabled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SetAbsolutePositioningEnabled(bool aIsEnabled)
|
||||
HTMLEditor::SetAbsolutePositioningEnabled(bool aIsEnabled)
|
||||
{
|
||||
mIsAbsolutelyPositioningEnabled = aIsEnabled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::RelativeChangeElementZIndex(nsIDOMElement * aElement,
|
||||
HTMLEditor::RelativeChangeElementZIndex(nsIDOMElement* aElement,
|
||||
int32_t aChange,
|
||||
int32_t * aReturn)
|
||||
int32_t* aReturn)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
|
@ -144,7 +147,8 @@ nsHTMLEditor::RelativeChangeElementZIndex(nsIDOMElement * aElement,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SetElementZIndex(nsIDOMElement* aElement, int32_t aZindex)
|
||||
HTMLEditor::SetElementZIndex(nsIDOMElement* aElement,
|
||||
int32_t aZindex)
|
||||
{
|
||||
nsCOMPtr<Element> element = do_QueryInterface(aElement);
|
||||
NS_ENSURE_ARG_POINTER(element);
|
||||
|
@ -157,7 +161,7 @@ nsHTMLEditor::SetElementZIndex(nsIDOMElement* aElement, int32_t aZindex)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::RelativeChangeZIndex(int32_t aChange)
|
||||
HTMLEditor::RelativeChangeZIndex(int32_t aChange)
|
||||
{
|
||||
AutoEditBatch beginBatching(this);
|
||||
AutoRules beginRulesSniffing(this,
|
||||
|
@ -182,8 +186,8 @@ nsHTMLEditor::RelativeChangeZIndex(int32_t aChange)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetElementZIndex(nsIDOMElement * aElement,
|
||||
int32_t * aZindex)
|
||||
HTMLEditor::GetElementZIndex(nsIDOMElement* aElement,
|
||||
int32_t* aZindex)
|
||||
{
|
||||
nsCOMPtr<Element> element = do_QueryInterface(aElement);
|
||||
NS_ENSURE_STATE(element || !aElement);
|
||||
|
@ -227,7 +231,7 @@ nsHTMLEditor::GetElementZIndex(nsIDOMElement * aElement,
|
|||
}
|
||||
|
||||
already_AddRefed<Element>
|
||||
nsHTMLEditor::CreateGrabber(nsINode* aParentNode)
|
||||
HTMLEditor::CreateGrabber(nsINode* aParentNode)
|
||||
{
|
||||
// let's create a grabber through the element factory
|
||||
nsCOMPtr<nsIDOMElement> retDOM;
|
||||
|
@ -247,7 +251,7 @@ nsHTMLEditor::CreateGrabber(nsINode* aParentNode)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::RefreshGrabber()
|
||||
HTMLEditor::RefreshGrabber()
|
||||
{
|
||||
NS_ENSURE_TRUE(mAbsolutelyPositionedObject, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
@ -270,7 +274,7 @@ nsHTMLEditor::RefreshGrabber()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::HideGrabber()
|
||||
HTMLEditor::HideGrabber()
|
||||
{
|
||||
nsresult res = mAbsolutelyPositionedObject->UnsetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::_moz_abspos,
|
||||
|
@ -298,7 +302,7 @@ nsHTMLEditor::HideGrabber()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::ShowGrabberOnElement(nsIDOMElement * aElement)
|
||||
HTMLEditor::ShowGrabberOnElement(nsIDOMElement* aElement)
|
||||
{
|
||||
nsCOMPtr<Element> element = do_QueryInterface(aElement);
|
||||
NS_ENSURE_ARG_POINTER(element);
|
||||
|
@ -327,7 +331,7 @@ nsHTMLEditor::ShowGrabberOnElement(nsIDOMElement * aElement)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::StartMoving(nsIDOMElement *aHandle)
|
||||
HTMLEditor::StartMoving(nsIDOMElement* aHandle)
|
||||
{
|
||||
nsCOMPtr<nsINode> parentNode = mGrabber->GetParentNode();
|
||||
|
||||
|
@ -354,7 +358,7 @@ nsHTMLEditor::StartMoving(nsIDOMElement *aHandle)
|
|||
}
|
||||
|
||||
void
|
||||
nsHTMLEditor::SnapToGrid(int32_t & newX, int32_t & newY)
|
||||
HTMLEditor::SnapToGrid(int32_t& newX, int32_t& newY)
|
||||
{
|
||||
if (mSnapToGridEnabled && mGridSize) {
|
||||
newX = (int32_t) floor( ((float)newX / (float)mGridSize) + 0.5f ) * mGridSize;
|
||||
|
@ -363,7 +367,7 @@ nsHTMLEditor::SnapToGrid(int32_t & newX, int32_t & newY)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::GrabberClicked()
|
||||
HTMLEditor::GrabberClicked()
|
||||
{
|
||||
// add a mouse move listener to the editor
|
||||
nsresult res = NS_OK;
|
||||
|
@ -385,7 +389,7 @@ nsHTMLEditor::GrabberClicked()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::EndMoving()
|
||||
HTMLEditor::EndMoving()
|
||||
{
|
||||
if (mPositioningShadow) {
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
|
@ -421,7 +425,8 @@ nsHTMLEditor::EndMoving()
|
|||
return CheckSelectionStateForAnonymousButtons(selection);
|
||||
}
|
||||
nsresult
|
||||
nsHTMLEditor::SetFinalPosition(int32_t aX, int32_t aY)
|
||||
HTMLEditor::SetFinalPosition(int32_t aX,
|
||||
int32_t aY)
|
||||
{
|
||||
nsresult res = EndMoving();
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
@ -456,7 +461,8 @@ nsHTMLEditor::SetFinalPosition(int32_t aX, int32_t aY)
|
|||
}
|
||||
|
||||
void
|
||||
nsHTMLEditor::AddPositioningOffset(int32_t & aX, int32_t & aY)
|
||||
HTMLEditor::AddPositioningOffset(int32_t& aX,
|
||||
int32_t& aY)
|
||||
{
|
||||
// Get the positioning offset
|
||||
int32_t positioningOffset =
|
||||
|
@ -467,8 +473,8 @@ nsHTMLEditor::AddPositioningOffset(int32_t & aX, int32_t & aY)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::AbsolutelyPositionElement(nsIDOMElement* aElement,
|
||||
bool aEnabled)
|
||||
HTMLEditor::AbsolutelyPositionElement(nsIDOMElement* aElement,
|
||||
bool aEnabled)
|
||||
{
|
||||
nsCOMPtr<Element> element = do_QueryInterface(aElement);
|
||||
NS_ENSURE_ARG_POINTER(element);
|
||||
|
@ -540,28 +546,28 @@ nsHTMLEditor::AbsolutelyPositionElement(nsIDOMElement* aElement,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SetSnapToGridEnabled(bool aEnabled)
|
||||
HTMLEditor::SetSnapToGridEnabled(bool aEnabled)
|
||||
{
|
||||
mSnapToGridEnabled = aEnabled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetSnapToGridEnabled(bool * aIsEnabled)
|
||||
HTMLEditor::GetSnapToGridEnabled(bool* aIsEnabled)
|
||||
{
|
||||
*aIsEnabled = mSnapToGridEnabled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SetGridSize(uint32_t aSize)
|
||||
HTMLEditor::SetGridSize(uint32_t aSize)
|
||||
{
|
||||
mGridSize = aSize;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetGridSize(uint32_t * aSize)
|
||||
HTMLEditor::GetGridSize(uint32_t* aSize)
|
||||
{
|
||||
*aSize = mGridSize;
|
||||
return NS_OK;
|
||||
|
@ -569,7 +575,9 @@ nsHTMLEditor::GetGridSize(uint32_t * aSize)
|
|||
|
||||
// self-explanatory
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SetElementPosition(nsIDOMElement *aElement, int32_t aX, int32_t aY)
|
||||
HTMLEditor::SetElementPosition(nsIDOMElement* aElement,
|
||||
int32_t aX,
|
||||
int32_t aY)
|
||||
{
|
||||
nsCOMPtr<Element> element = do_QueryInterface(aElement);
|
||||
NS_ENSURE_STATE(element);
|
||||
|
@ -579,7 +587,9 @@ nsHTMLEditor::SetElementPosition(nsIDOMElement *aElement, int32_t aX, int32_t aY
|
|||
}
|
||||
|
||||
void
|
||||
nsHTMLEditor::SetElementPosition(dom::Element& aElement, int32_t aX, int32_t aY)
|
||||
HTMLEditor::SetElementPosition(Element& aElement,
|
||||
int32_t aX,
|
||||
int32_t aY)
|
||||
{
|
||||
AutoEditBatch batchIt(this);
|
||||
mCSSEditUtils->SetCSSPropertyPixels(aElement, *nsGkAtoms::left, aX);
|
||||
|
@ -588,7 +598,7 @@ nsHTMLEditor::SetElementPosition(dom::Element& aElement, int32_t aX, int32_t aY)
|
|||
|
||||
// self-explanatory
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetPositionedElement(nsIDOMElement ** aReturn)
|
||||
HTMLEditor::GetPositionedElement(nsIDOMElement** aReturn)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> ret =
|
||||
static_cast<nsIDOMElement*>(GetAsDOMNode(mAbsolutelyPositionedObject));
|
||||
|
@ -597,8 +607,8 @@ nsHTMLEditor::GetPositionedElement(nsIDOMElement ** aReturn)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::CheckPositionedElementBGandFG(nsIDOMElement * aElement,
|
||||
nsAString & aReturn)
|
||||
HTMLEditor::CheckPositionedElementBGandFG(nsIDOMElement* aElement,
|
||||
nsAString& aReturn)
|
||||
{
|
||||
// we are going to outline the positioned element and bring it to the
|
||||
// front to overlap any other element intersecting with it. But
|
||||
|
@ -664,3 +674,5 @@ nsHTMLEditor::CheckPositionedElementBGandFG(nsIDOMElement * aElement,
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
|
@ -2,6 +2,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/mozalloc.h"
|
||||
|
@ -11,7 +13,6 @@
|
|||
#include "nsDebug.h"
|
||||
#include "nsError.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsID.h"
|
||||
|
@ -26,7 +27,6 @@
|
|||
#include "nsIDocument.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsIHTMLAbsPosEditor.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
#include "nsIHTMLInlineTableEditor.h"
|
||||
#include "nsIHTMLObjectResizer.h"
|
||||
#include "nsIMutationObserver.h"
|
||||
|
@ -46,8 +46,9 @@
|
|||
class nsIDOMEventListener;
|
||||
class nsISelection;
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
namespace mozilla {
|
||||
|
||||
using namespace dom;
|
||||
|
||||
// retrieve an integer stored into a CSS computed float value
|
||||
static int32_t GetCSSFloatValue(nsIDOMCSSStyleDeclaration * aDecl,
|
||||
|
@ -91,24 +92,28 @@ static int32_t GetCSSFloatValue(nsIDOMCSSStyleDeclaration * aDecl,
|
|||
return (int32_t) f;
|
||||
}
|
||||
|
||||
class nsElementDeletionObserver final : public nsIMutationObserver
|
||||
class ElementDeletionObserver final : public nsIMutationObserver
|
||||
{
|
||||
public:
|
||||
nsElementDeletionObserver(nsINode* aNativeAnonNode, nsINode* aObservedNode)
|
||||
: mNativeAnonNode(aNativeAnonNode), mObservedNode(aObservedNode) {}
|
||||
ElementDeletionObserver(nsINode* aNativeAnonNode, nsINode* aObservedNode)
|
||||
: mNativeAnonNode(aNativeAnonNode)
|
||||
, mObservedNode(aObservedNode)
|
||||
{}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMUTATIONOBSERVER
|
||||
|
||||
protected:
|
||||
~nsElementDeletionObserver() {}
|
||||
~ElementDeletionObserver() {}
|
||||
nsINode* mNativeAnonNode;
|
||||
nsINode* mObservedNode;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsElementDeletionObserver, nsIMutationObserver)
|
||||
NS_IMPL_NSIMUTATIONOBSERVER_CONTENT(nsElementDeletionObserver)
|
||||
NS_IMPL_ISUPPORTS(ElementDeletionObserver, nsIMutationObserver)
|
||||
NS_IMPL_NSIMUTATIONOBSERVER_CONTENT(ElementDeletionObserver)
|
||||
|
||||
void
|
||||
nsElementDeletionObserver::NodeWillBeDestroyed(const nsINode* aNode)
|
||||
ElementDeletionObserver::NodeWillBeDestroyed(const nsINode* aNode)
|
||||
{
|
||||
NS_ASSERTION(aNode == mNativeAnonNode || aNode == mObservedNode,
|
||||
"Wrong aNode!");
|
||||
|
@ -127,9 +132,11 @@ nsElementDeletionObserver::NodeWillBeDestroyed(const nsINode* aNode)
|
|||
// "hidden" is added to the created element. If aAnonClass is not
|
||||
// the empty string, it becomes the value of the attribute "_moz_anonclass"
|
||||
nsresult
|
||||
nsHTMLEditor::CreateAnonymousElement(const nsAString & aTag, nsIDOMNode * aParentNode,
|
||||
const nsAString & aAnonClass, bool aIsCreatedHidden,
|
||||
nsIDOMElement ** aReturn)
|
||||
HTMLEditor::CreateAnonymousElement(const nsAString& aTag,
|
||||
nsIDOMNode* aParentNode,
|
||||
const nsAString& aAnonClass,
|
||||
bool aIsCreatedHidden,
|
||||
nsIDOMElement** aReturn)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aParentNode);
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
|
@ -180,8 +187,8 @@ nsHTMLEditor::CreateAnonymousElement(const nsAString & aTag, nsIDOMNode * aPare
|
|||
}
|
||||
}
|
||||
|
||||
nsElementDeletionObserver* observer =
|
||||
new nsElementDeletionObserver(newContent, parentContent);
|
||||
ElementDeletionObserver* observer =
|
||||
new ElementDeletionObserver(newContent, parentContent);
|
||||
NS_ADDREF(observer); // NodeWillBeDestroyed releases.
|
||||
parentContent->AddMutationObserver(observer);
|
||||
newContent->AddMutationObserver(observer);
|
||||
|
@ -204,12 +211,12 @@ nsHTMLEditor::CreateAnonymousElement(const nsAString & aTag, nsIDOMNode * aPare
|
|||
|
||||
// Removes event listener and calls DeleteRefToAnonymousNode.
|
||||
void
|
||||
nsHTMLEditor::RemoveListenerAndDeleteRef(const nsAString& aEvent,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
Element* aElement,
|
||||
nsIContent * aParentContent,
|
||||
nsIPresShell* aShell)
|
||||
HTMLEditor::RemoveListenerAndDeleteRef(const nsAString& aEvent,
|
||||
nsIDOMEventListener* aListener,
|
||||
bool aUseCapture,
|
||||
Element* aElement,
|
||||
nsIContent* aParentContent,
|
||||
nsIPresShell* aShell)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> evtTarget(do_QueryInterface(aElement));
|
||||
if (evtTarget) {
|
||||
|
@ -220,9 +227,9 @@ nsHTMLEditor::RemoveListenerAndDeleteRef(const nsAString& aEvent,
|
|||
|
||||
// Deletes all references to an anonymous element
|
||||
void
|
||||
nsHTMLEditor::DeleteRefToAnonymousNode(nsIDOMElement* aElement,
|
||||
nsIContent* aParentContent,
|
||||
nsIPresShell* aShell)
|
||||
HTMLEditor::DeleteRefToAnonymousNode(nsIDOMElement* aElement,
|
||||
nsIContent* aParentContent,
|
||||
nsIPresShell* aShell)
|
||||
{
|
||||
// call ContentRemoved() for the anonymous content
|
||||
// node so its references get removed from the frame manager's
|
||||
|
@ -265,7 +272,7 @@ nsHTMLEditor::DeleteRefToAnonymousNode(nsIDOMElement* aElement,
|
|||
// handles, a grabber and/or inline table editing UI need to be displayed
|
||||
// or refreshed
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::CheckSelectionStateForAnonymousButtons(nsISelection * aSelection)
|
||||
HTMLEditor::CheckSelectionStateForAnonymousButtons(nsISelection* aSelection)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSelection);
|
||||
|
||||
|
@ -405,13 +412,15 @@ nsHTMLEditor::CheckSelectionStateForAnonymousButtons(nsISelection * aSelection)
|
|||
// Resizing and Absolute Positioning need to know everything about the
|
||||
// containing box of the element: position, size, margins, borders
|
||||
nsresult
|
||||
nsHTMLEditor::GetPositionAndDimensions(nsIDOMElement * aElement,
|
||||
int32_t & aX, int32_t & aY,
|
||||
int32_t & aW, int32_t & aH,
|
||||
int32_t & aBorderLeft,
|
||||
int32_t & aBorderTop,
|
||||
int32_t & aMarginLeft,
|
||||
int32_t & aMarginTop)
|
||||
HTMLEditor::GetPositionAndDimensions(nsIDOMElement* aElement,
|
||||
int32_t& aX,
|
||||
int32_t& aY,
|
||||
int32_t& aW,
|
||||
int32_t& aH,
|
||||
int32_t& aBorderLeft,
|
||||
int32_t& aBorderTop,
|
||||
int32_t& aMarginLeft,
|
||||
int32_t& aMarginTop)
|
||||
{
|
||||
nsCOMPtr<Element> element = do_QueryInterface(aElement);
|
||||
NS_ENSURE_ARG_POINTER(element);
|
||||
|
@ -471,8 +480,12 @@ nsHTMLEditor::GetPositionAndDimensions(nsIDOMElement * aElement,
|
|||
|
||||
// self-explanatory
|
||||
void
|
||||
nsHTMLEditor::SetAnonymousElementPosition(int32_t aX, int32_t aY, nsIDOMElement *aElement)
|
||||
HTMLEditor::SetAnonymousElementPosition(int32_t aX,
|
||||
int32_t aY,
|
||||
nsIDOMElement* aElement)
|
||||
{
|
||||
mCSSEditUtils->SetCSSPropertyPixels(aElement, NS_LITERAL_STRING("left"), aX);
|
||||
mCSSEditUtils->SetCSSPropertyPixels(aElement, NS_LITERAL_STRING("top"), aY);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
|
@ -14,6 +14,7 @@
|
|||
#include "TextEditUtils.h"
|
||||
#include "WSRunObject.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
#include "mozilla/MathAlgorithms.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/Selection.h"
|
||||
|
@ -31,7 +32,6 @@
|
|||
#include "nsEditor.h"
|
||||
#include "nsError.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIContentIterator.h"
|
||||
|
@ -86,7 +86,7 @@ enum
|
|||
|
||||
static bool IsBlockNode(const nsINode& node)
|
||||
{
|
||||
return nsHTMLEditor::NodeIsBlockStatic(&node);
|
||||
return HTMLEditor::NodeIsBlockStatic(&node);
|
||||
}
|
||||
|
||||
static bool IsInlineNode(const nsINode& node)
|
||||
|
@ -133,8 +133,8 @@ public:
|
|||
class EmptyEditableFunctor final : public BoolDomIterFunctor
|
||||
{
|
||||
public:
|
||||
explicit EmptyEditableFunctor(nsHTMLEditor* editor)
|
||||
: mHTMLEditor(editor)
|
||||
explicit EmptyEditableFunctor(HTMLEditor* aHTMLEditor)
|
||||
: mHTMLEditor(aHTMLEditor)
|
||||
{}
|
||||
|
||||
virtual bool operator()(nsINode* aNode) const
|
||||
|
@ -152,7 +152,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
nsHTMLEditor* mHTMLEditor;
|
||||
HTMLEditor* mHTMLEditor;
|
||||
};
|
||||
|
||||
/********************************************************
|
||||
|
@ -211,7 +211,7 @@ HTMLEditRules::~HTMLEditRules()
|
|||
{
|
||||
// remove ourselves as a listener to edit actions
|
||||
// In some cases, we have already been removed by
|
||||
// ~nsHTMLEditor, in which case we will get a null pointer here
|
||||
// ~HTMLEditor, in which case we will get a null pointer here
|
||||
// which we ignore. But this allows us to add the ability to
|
||||
// switch rule sets on the fly if we want.
|
||||
if (mHTMLEditor)
|
||||
|
@ -233,7 +233,7 @@ HTMLEditRules::Init(nsPlaintextEditor* aTextEditor)
|
|||
{
|
||||
InitFields();
|
||||
|
||||
mHTMLEditor = static_cast<nsHTMLEditor*>(aTextEditor);
|
||||
mHTMLEditor = static_cast<HTMLEditor*>(aTextEditor);
|
||||
nsresult res;
|
||||
|
||||
// call through to base class Init
|
||||
|
@ -1612,7 +1612,7 @@ HTMLEditRules::StandardBreakImpl(nsINode& aNode,
|
|||
nsCOMPtr<nsINode> linkParent = linkNode->GetParentNode();
|
||||
aOffset = mHTMLEditor->SplitNodeDeep(*linkNode, *node->AsContent(),
|
||||
aOffset,
|
||||
nsHTMLEditor::EmptyContainers::no);
|
||||
HTMLEditor::EmptyContainers::no);
|
||||
NS_ENSURE_STATE(aOffset != -1);
|
||||
node = linkParent;
|
||||
}
|
||||
|
@ -1720,7 +1720,7 @@ HTMLEditRules::SplitMailCites(Selection* aSelection,
|
|||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
NS_ENSURE_STATE(selNode->IsContent());
|
||||
int32_t newOffset = mHTMLEditor->SplitNodeDeep(*citeNode,
|
||||
*selNode->AsContent(), selOffset, nsHTMLEditor::EmptyContainers::no,
|
||||
*selNode->AsContent(), selOffset, HTMLEditor::EmptyContainers::no,
|
||||
getter_AddRefs(leftCite), getter_AddRefs(rightCite));
|
||||
NS_ENSURE_STATE(newOffset != -1);
|
||||
selNode = citeNode->GetParentNode();
|
||||
|
@ -3387,7 +3387,7 @@ HTMLEditRules::WillMakeBasicBlock(Selection& aSelection,
|
|||
// Do the splits!
|
||||
offset = mHTMLEditor->SplitNodeDeep(curBlock, *parent->AsContent(),
|
||||
offset,
|
||||
nsHTMLEditor::EmptyContainers::no);
|
||||
HTMLEditor::EmptyContainers::no);
|
||||
NS_ENSURE_STATE(offset != -1);
|
||||
// Put a br at the split point
|
||||
brNode = mHTMLEditor->CreateBR(curBlock->GetParentNode(), offset);
|
||||
|
@ -4222,7 +4222,7 @@ HTMLEditRules::SplitBlock(Element& aBlock,
|
|||
// Do the splits!
|
||||
nsCOMPtr<nsIContent> newMiddleNode1;
|
||||
mHTMLEditor->SplitNodeDeep(aBlock, startParent, startOffset,
|
||||
nsHTMLEditor::EmptyContainers::no,
|
||||
HTMLEditor::EmptyContainers::no,
|
||||
aOutLeftNode, getter_AddRefs(newMiddleNode1));
|
||||
|
||||
// Get split point location
|
||||
|
@ -4233,7 +4233,7 @@ HTMLEditRules::SplitBlock(Element& aBlock,
|
|||
// Do the splits!
|
||||
nsCOMPtr<nsIContent> newMiddleNode2;
|
||||
mHTMLEditor->SplitNodeDeep(aBlock, endParent, endOffset,
|
||||
nsHTMLEditor::EmptyContainers::no,
|
||||
HTMLEditor::EmptyContainers::no,
|
||||
getter_AddRefs(newMiddleNode2), aOutRightNode);
|
||||
|
||||
if (aOutMiddleNode) {
|
||||
|
@ -4411,8 +4411,8 @@ HTMLEditRules::CreateStyleForInsertText(Selection& aSelection,
|
|||
|
||||
if (relFontSize) {
|
||||
// dir indicated bigger versus smaller. 1 = bigger, -1 = smaller
|
||||
nsHTMLEditor::FontSize dir = relFontSize > 0 ?
|
||||
nsHTMLEditor::FontSize::incr : nsHTMLEditor::FontSize::decr;
|
||||
HTMLEditor::FontSize dir = relFontSize > 0 ?
|
||||
HTMLEditor::FontSize::incr : HTMLEditor::FontSize::decr;
|
||||
for (int32_t j = 0; j < DeprecatedAbs(relFontSize); j++) {
|
||||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
res = mHTMLEditor->RelativeFontChangeOnTextNode(dir, newNode, 0, -1);
|
||||
|
@ -4961,7 +4961,7 @@ HTMLEditRules::ExpandSelectionForDeletion(Selection& aSelection)
|
|||
|
||||
// Find current selection common block parent
|
||||
nsCOMPtr<Element> selCommon =
|
||||
nsHTMLEditor::GetBlock(*range->GetCommonAncestor());
|
||||
HTMLEditor::GetBlock(*range->GetCommonAncestor());
|
||||
NS_ENSURE_STATE(selCommon);
|
||||
|
||||
// Set up for loops and cache our root element
|
||||
|
@ -5035,7 +5035,7 @@ HTMLEditRules::ExpandSelectionForDeletion(Selection& aSelection)
|
|||
bool doEndExpansion = true;
|
||||
if (firstBRParent) {
|
||||
// Find block node containing br
|
||||
nsCOMPtr<Element> brBlock = nsHTMLEditor::GetBlock(*firstBRParent);
|
||||
nsCOMPtr<Element> brBlock = HTMLEditor::GetBlock(*firstBRParent);
|
||||
bool nodeBefore = false, nodeAfter = false;
|
||||
|
||||
// Create a range that represents expanded selection
|
||||
|
@ -5969,7 +5969,7 @@ HTMLEditRules::BustUpInlinesAtBRs(
|
|||
|
||||
int32_t resultOffset =
|
||||
mHTMLEditor->SplitNodeDeep(*splitDeepNode, splitParentNode, splitOffset,
|
||||
nsHTMLEditor::EmptyContainers::yes,
|
||||
HTMLEditor::EmptyContainers::yes,
|
||||
getter_AddRefs(leftNode),
|
||||
getter_AddRefs(rightNode));
|
||||
NS_ENSURE_STATE(resultOffset != -1);
|
||||
|
@ -6338,7 +6338,7 @@ HTMLEditRules::SplitParagraph(nsIDOMNode *aPara,
|
|||
NS_ENSURE_STATE(mHTMLEditor);
|
||||
NS_ENSURE_STATE(selNode->IsContent());
|
||||
mHTMLEditor->SplitNodeDeep(*para, *selNode->AsContent(), *aOffset,
|
||||
nsHTMLEditor::EmptyContainers::yes,
|
||||
HTMLEditor::EmptyContainers::yes,
|
||||
getter_AddRefs(leftPara),
|
||||
getter_AddRefs(rightPara));
|
||||
// get rid of the break, if it is visible (otherwise it may be needed to prevent an empty p)
|
||||
|
@ -8441,7 +8441,7 @@ HTMLEditRules::ChangeIndentation(Element& aElement,
|
|||
if (!aElement.IsHTMLElement(nsGkAtoms::div) ||
|
||||
&aElement == mHTMLEditor->GetActiveEditingHost() ||
|
||||
!mHTMLEditor->IsDescendantOfEditorRoot(&aElement) ||
|
||||
nsHTMLEditor::HasAttributes(&aElement)) {
|
||||
HTMLEditor::HasAttributes(&aElement)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nsTArray.h"
|
||||
#include "nscore.h"
|
||||
|
||||
class nsHTMLEditor;
|
||||
class nsIAtom;
|
||||
class nsIDOMCharacterData;
|
||||
class nsIDOMDocument;
|
||||
|
@ -31,6 +30,7 @@ class nsRange;
|
|||
|
||||
namespace mozilla {
|
||||
|
||||
class HTMLEditor;
|
||||
class RulesInfo;
|
||||
struct EditorDOMPoint;
|
||||
namespace dom {
|
||||
|
@ -357,7 +357,7 @@ protected:
|
|||
void DocumentModifiedWorker();
|
||||
|
||||
protected:
|
||||
nsHTMLEditor* mHTMLEditor;
|
||||
HTMLEditor* mHTMLEditor;
|
||||
RefPtr<nsRange> mDocChangeRange;
|
||||
bool mListenerEnabled;
|
||||
bool mReturnInEmptyLIKillsList;
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -4,6 +4,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "EditorUtils.h"
|
||||
|
@ -32,7 +34,6 @@
|
|||
#include "nsEditor.h"
|
||||
#include "nsError.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "nsIClipboard.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIContentFilter.h"
|
||||
|
@ -89,20 +90,22 @@ class nsIAtom;
|
|||
class nsILoadContext;
|
||||
class nsISupports;
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
namespace mozilla {
|
||||
|
||||
using namespace dom;
|
||||
|
||||
#define kInsertCookie "_moz_Insert Here_moz_"
|
||||
|
||||
// some little helpers
|
||||
static bool FindIntegerAfterString(const char *aLeadingString,
|
||||
nsCString &aCStr, int32_t &foundNumber);
|
||||
static nsresult RemoveFragComments(nsCString &theStr);
|
||||
static bool FindIntegerAfterString(const char* aLeadingString,
|
||||
nsCString& aCStr, int32_t& foundNumber);
|
||||
static nsresult RemoveFragComments(nsCString& theStr);
|
||||
static void RemoveBodyAndHead(nsINode& aNode);
|
||||
static nsresult FindTargetNode(nsIDOMNode *aStart, nsCOMPtr<nsIDOMNode> &aResult);
|
||||
static nsresult FindTargetNode(nsIDOMNode* aStart,
|
||||
nsCOMPtr<nsIDOMNode>& aResult);
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::LoadHTML(const nsAString & aInputString)
|
||||
HTMLEditor::LoadHTML(const nsAString& aInputString)
|
||||
{
|
||||
NS_ENSURE_TRUE(mRules, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
|
@ -165,8 +168,8 @@ nsHTMLEditor::LoadHTML(const nsAString & aInputString)
|
|||
return mRules->DidDoAction(selection, &ruleInfo, rv);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::InsertHTML(const nsAString & aInString)
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::InsertHTML(const nsAString& aInString)
|
||||
{
|
||||
const nsAFlatString& empty = EmptyString();
|
||||
|
||||
|
@ -174,16 +177,15 @@ NS_IMETHODIMP nsHTMLEditor::InsertHTML(const nsAString & aInString)
|
|||
nullptr, nullptr, 0, true);
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::InsertHTMLWithContext(const nsAString & aInputString,
|
||||
const nsAString & aContextStr,
|
||||
const nsAString & aInfoStr,
|
||||
const nsAString & aFlavor,
|
||||
nsIDOMDocument *aSourceDoc,
|
||||
nsIDOMNode *aDestNode,
|
||||
int32_t aDestOffset,
|
||||
bool aDeleteSelection)
|
||||
HTMLEditor::InsertHTMLWithContext(const nsAString& aInputString,
|
||||
const nsAString& aContextStr,
|
||||
const nsAString& aInfoStr,
|
||||
const nsAString& aFlavor,
|
||||
nsIDOMDocument* aSourceDoc,
|
||||
nsIDOMNode* aDestNode,
|
||||
int32_t aDestOffset,
|
||||
bool aDeleteSelection)
|
||||
{
|
||||
return DoInsertHTMLWithContext(aInputString, aContextStr, aInfoStr,
|
||||
aFlavor, aSourceDoc, aDestNode, aDestOffset, aDeleteSelection,
|
||||
|
@ -191,16 +193,16 @@ nsHTMLEditor::InsertHTMLWithContext(const nsAString & aInputString,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::DoInsertHTMLWithContext(const nsAString & aInputString,
|
||||
const nsAString & aContextStr,
|
||||
const nsAString & aInfoStr,
|
||||
const nsAString & aFlavor,
|
||||
nsIDOMDocument *aSourceDoc,
|
||||
nsIDOMNode *aDestNode,
|
||||
int32_t aDestOffset,
|
||||
bool aDeleteSelection,
|
||||
bool aTrustedInput,
|
||||
bool aClearStyle)
|
||||
HTMLEditor::DoInsertHTMLWithContext(const nsAString& aInputString,
|
||||
const nsAString& aContextStr,
|
||||
const nsAString& aInfoStr,
|
||||
const nsAString& aFlavor,
|
||||
nsIDOMDocument* aSourceDoc,
|
||||
nsIDOMNode* aDestNode,
|
||||
int32_t aDestOffset,
|
||||
bool aDeleteSelection,
|
||||
bool aTrustedInput,
|
||||
bool aClearStyle)
|
||||
{
|
||||
NS_ENSURE_TRUE(mRules, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
|
@ -708,7 +710,7 @@ nsHTMLEditor::DoInsertHTMLWithContext(const nsAString & aInputString,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::AddInsertionListener(nsIContentFilter *aListener)
|
||||
HTMLEditor::AddInsertionListener(nsIContentFilter* aListener)
|
||||
{
|
||||
NS_ENSURE_TRUE(aListener, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
@ -721,7 +723,7 @@ nsHTMLEditor::AddInsertionListener(nsIContentFilter *aListener)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::RemoveInsertionListener(nsIContentFilter *aListener)
|
||||
HTMLEditor::RemoveInsertionListener(nsIContentFilter* aListener)
|
||||
{
|
||||
NS_ENSURE_TRUE(aListener, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -731,17 +733,17 @@ nsHTMLEditor::RemoveInsertionListener(nsIContentFilter *aListener)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::DoContentFilterCallback(const nsAString &aFlavor,
|
||||
nsIDOMDocument *sourceDoc,
|
||||
bool aWillDeleteSelection,
|
||||
nsIDOMNode **aFragmentAsNode,
|
||||
nsIDOMNode **aFragStartNode,
|
||||
int32_t *aFragStartOffset,
|
||||
nsIDOMNode **aFragEndNode,
|
||||
int32_t *aFragEndOffset,
|
||||
nsIDOMNode **aTargetNode,
|
||||
int32_t *aTargetOffset,
|
||||
bool *aDoContinue)
|
||||
HTMLEditor::DoContentFilterCallback(const nsAString& aFlavor,
|
||||
nsIDOMDocument* sourceDoc,
|
||||
bool aWillDeleteSelection,
|
||||
nsIDOMNode** aFragmentAsNode,
|
||||
nsIDOMNode** aFragStartNode,
|
||||
int32_t* aFragStartOffset,
|
||||
nsIDOMNode** aFragEndNode,
|
||||
int32_t* aFragEndOffset,
|
||||
nsIDOMNode** aTargetNode,
|
||||
int32_t* aTargetOffset,
|
||||
bool* aDoContinue)
|
||||
{
|
||||
*aDoContinue = true;
|
||||
|
||||
|
@ -760,7 +762,8 @@ nsHTMLEditor::DoContentFilterCallback(const nsAString &aFlavor,
|
|||
}
|
||||
|
||||
bool
|
||||
nsHTMLEditor::IsInLink(nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *outLink)
|
||||
HTMLEditor::IsInLink(nsIDOMNode* aNode,
|
||||
nsCOMPtr<nsIDOMNode>* outLink)
|
||||
{
|
||||
NS_ENSURE_TRUE(aNode, false);
|
||||
if (outLink)
|
||||
|
@ -779,9 +782,9 @@ nsHTMLEditor::IsInLink(nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *outLink)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::StripFormattingNodes(nsIContent& aNode, bool aListOnly)
|
||||
HTMLEditor::StripFormattingNodes(nsIContent& aNode,
|
||||
bool aListOnly)
|
||||
{
|
||||
if (aNode.TextIsOnlyWhitespace()) {
|
||||
nsCOMPtr<nsINode> parent = aNode.GetParentNode();
|
||||
|
@ -807,13 +810,14 @@ nsHTMLEditor::StripFormattingNodes(nsIContent& aNode, bool aListOnly)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::PrepareTransferable(nsITransferable **transferable)
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::PrepareTransferable(nsITransferable** aTransferable)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::PrepareHTMLTransferable(nsITransferable **aTransferable)
|
||||
HTMLEditor::PrepareHTMLTransferable(nsITransferable** aTransferable)
|
||||
{
|
||||
// Create generic Transferable for getting the data
|
||||
nsresult rv = CallCreateInstance("@mozilla.org/widget/transferable;1", aTransferable);
|
||||
|
@ -866,8 +870,9 @@ nsHTMLEditor::PrepareHTMLTransferable(nsITransferable **aTransferable)
|
|||
}
|
||||
|
||||
bool
|
||||
FindIntegerAfterString(const char *aLeadingString,
|
||||
nsCString &aCStr, int32_t &foundNumber)
|
||||
FindIntegerAfterString(const char* aLeadingString,
|
||||
nsCString& aCStr,
|
||||
int32_t& foundNumber)
|
||||
{
|
||||
// first obtain offsets from cfhtml str
|
||||
int32_t numFront = aCStr.Find(aLeadingString);
|
||||
|
@ -886,7 +891,7 @@ FindIntegerAfterString(const char *aLeadingString,
|
|||
}
|
||||
|
||||
nsresult
|
||||
RemoveFragComments(nsCString & aStr)
|
||||
RemoveFragComments(nsCString& aStr)
|
||||
{
|
||||
// remove the StartFragment/EndFragment comments from the str, if present
|
||||
int32_t startCommentIndx = aStr.Find("<!--StartFragment");
|
||||
|
@ -907,7 +912,9 @@ RemoveFragComments(nsCString & aStr)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::ParseCFHTML(nsCString & aCfhtml, char16_t **aStuffToPaste, char16_t **aCfcontext)
|
||||
HTMLEditor::ParseCFHTML(nsCString& aCfhtml,
|
||||
char16_t** aStuffToPaste,
|
||||
char16_t** aCfcontext)
|
||||
{
|
||||
// First obtain offsets from cfhtml str.
|
||||
int32_t startHTML, endHTML, startFragment, endFragment;
|
||||
|
@ -1025,15 +1032,17 @@ ImgFromData(const nsACString& aType, const nsACString& aData, nsString& aOutput)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsHTMLEditor::BlobReader, nsIEditorBlobListener)
|
||||
NS_IMPL_ISUPPORTS(HTMLEditor::BlobReader, nsIEditorBlobListener)
|
||||
|
||||
nsHTMLEditor::BlobReader::BlobReader(BlobImpl* aBlob, nsHTMLEditor* aEditor,
|
||||
bool aIsSafe, nsIDOMDocument* aSourceDoc,
|
||||
nsIDOMNode* aDestinationNode,
|
||||
int32_t aDestOffset,
|
||||
bool aDoDeleteSelection)
|
||||
HTMLEditor::BlobReader::BlobReader(BlobImpl* aBlob,
|
||||
HTMLEditor* aHTMLEditor,
|
||||
bool aIsSafe,
|
||||
nsIDOMDocument* aSourceDoc,
|
||||
nsIDOMNode* aDestinationNode,
|
||||
int32_t aDestOffset,
|
||||
bool aDoDeleteSelection)
|
||||
: mBlob(aBlob)
|
||||
, mEditor(aEditor)
|
||||
, mHTMLEditor(aHTMLEditor)
|
||||
, mIsSafe(aIsSafe)
|
||||
, mSourceDoc(aSourceDoc)
|
||||
, mDestinationNode(aDestinationNode)
|
||||
|
@ -1041,12 +1050,12 @@ nsHTMLEditor::BlobReader::BlobReader(BlobImpl* aBlob, nsHTMLEditor* aEditor,
|
|||
, mDoDeleteSelection(aDoDeleteSelection)
|
||||
{
|
||||
MOZ_ASSERT(mBlob);
|
||||
MOZ_ASSERT(mEditor);
|
||||
MOZ_ASSERT(mHTMLEditor);
|
||||
MOZ_ASSERT(mDestinationNode);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::BlobReader::OnResult(const nsACString& aResult)
|
||||
HTMLEditor::BlobReader::OnResult(const nsACString& aResult)
|
||||
{
|
||||
nsString blobType;
|
||||
mBlob->GetType(blobType);
|
||||
|
@ -1056,18 +1065,19 @@ nsHTMLEditor::BlobReader::OnResult(const nsACString& aResult)
|
|||
nsresult rv = ImgFromData(type, aResult, stuffToPaste);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
AutoEditBatch beginBatching(mEditor);
|
||||
rv = mEditor->DoInsertHTMLWithContext(stuffToPaste, EmptyString(), EmptyString(),
|
||||
NS_LITERAL_STRING(kFileMime),
|
||||
mSourceDoc,
|
||||
mDestinationNode, mDestOffset,
|
||||
mDoDeleteSelection,
|
||||
mIsSafe, false);
|
||||
AutoEditBatch beginBatching(mHTMLEditor);
|
||||
rv = mHTMLEditor->DoInsertHTMLWithContext(stuffToPaste, EmptyString(),
|
||||
EmptyString(),
|
||||
NS_LITERAL_STRING(kFileMime),
|
||||
mSourceDoc,
|
||||
mDestinationNode, mDestOffset,
|
||||
mDoDeleteSelection,
|
||||
mIsSafe, false);
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::BlobReader::OnError(const nsAString& aError)
|
||||
HTMLEditor::BlobReader::OnError(const nsAString& aError)
|
||||
{
|
||||
nsCOMPtr<nsINode> destNode = do_QueryInterface(mDestinationNode);
|
||||
const nsPromiseFlatString& flat = PromiseFlatString(aError);
|
||||
|
@ -1081,11 +1091,14 @@ nsHTMLEditor::BlobReader::OnError(const nsAString& aError)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsHTMLEditor::InsertObject(const char* aType, nsISupports* aObject, bool aIsSafe,
|
||||
nsIDOMDocument *aSourceDoc,
|
||||
nsIDOMNode *aDestinationNode,
|
||||
int32_t aDestOffset,
|
||||
bool aDoDeleteSelection)
|
||||
nsresult
|
||||
HTMLEditor::InsertObject(const char* aType,
|
||||
nsISupports* aObject,
|
||||
bool aIsSafe,
|
||||
nsIDOMDocument* aSourceDoc,
|
||||
nsIDOMNode* aDestinationNode,
|
||||
int32_t aDestOffset,
|
||||
bool aDoDeleteSelection)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -1170,14 +1183,14 @@ nsresult nsHTMLEditor::InsertObject(const char* aType, nsISupports* aObject, boo
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable,
|
||||
nsIDOMDocument *aSourceDoc,
|
||||
const nsAString & aContextStr,
|
||||
const nsAString & aInfoStr,
|
||||
bool havePrivateHTMLFlavor,
|
||||
nsIDOMNode *aDestinationNode,
|
||||
int32_t aDestOffset,
|
||||
bool aDoDeleteSelection)
|
||||
HTMLEditor::InsertFromTransferable(nsITransferable* transferable,
|
||||
nsIDOMDocument* aSourceDoc,
|
||||
const nsAString& aContextStr,
|
||||
const nsAString& aInfoStr,
|
||||
bool havePrivateHTMLFlavor,
|
||||
nsIDOMNode* aDestinationNode,
|
||||
int32_t aDestOffset,
|
||||
bool aDoDeleteSelection)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsXPIDLCString bestFlavor;
|
||||
|
@ -1286,8 +1299,10 @@ nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable,
|
|||
}
|
||||
|
||||
static void
|
||||
GetStringFromDataTransfer(nsIDOMDataTransfer *aDataTransfer, const nsAString& aType,
|
||||
int32_t aIndex, nsAString& aOutputString)
|
||||
GetStringFromDataTransfer(nsIDOMDataTransfer* aDataTransfer,
|
||||
const nsAString& aType,
|
||||
int32_t aIndex,
|
||||
nsAString& aOutputString)
|
||||
{
|
||||
nsCOMPtr<nsIVariant> variant;
|
||||
DataTransfer::Cast(aDataTransfer)->GetDataAtNoSecurityCheck(aType, aIndex, getter_AddRefs(variant));
|
||||
|
@ -1295,12 +1310,13 @@ GetStringFromDataTransfer(nsIDOMDataTransfer *aDataTransfer, const nsAString& aT
|
|||
variant->GetAsAString(aOutputString);
|
||||
}
|
||||
|
||||
nsresult nsHTMLEditor::InsertFromDataTransfer(DataTransfer *aDataTransfer,
|
||||
int32_t aIndex,
|
||||
nsIDOMDocument *aSourceDoc,
|
||||
nsIDOMNode *aDestinationNode,
|
||||
int32_t aDestOffset,
|
||||
bool aDoDeleteSelection)
|
||||
nsresult
|
||||
HTMLEditor::InsertFromDataTransfer(DataTransfer* aDataTransfer,
|
||||
int32_t aIndex,
|
||||
nsIDOMDocument* aSourceDoc,
|
||||
nsIDOMNode* aDestinationNode,
|
||||
int32_t aDestOffset,
|
||||
bool aDoDeleteSelection)
|
||||
{
|
||||
ErrorResult rv;
|
||||
RefPtr<DOMStringList> types = aDataTransfer->MozTypesAt(aIndex, rv);
|
||||
|
@ -1400,7 +1416,8 @@ nsresult nsHTMLEditor::InsertFromDataTransfer(DataTransfer *aDataTransfer,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
bool nsHTMLEditor::HavePrivateHTMLFlavor(nsIClipboard *aClipboard)
|
||||
bool
|
||||
HTMLEditor::HavePrivateHTMLFlavor(nsIClipboard* aClipboard)
|
||||
{
|
||||
// check the clipboard for our special kHTMLContext flavor. If that is there, we know
|
||||
// we have our own internal html format on clipboard.
|
||||
|
@ -1419,7 +1436,8 @@ bool nsHTMLEditor::HavePrivateHTMLFlavor(nsIClipboard *aClipboard)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::Paste(int32_t aSelectionType)
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::Paste(int32_t aSelectionType)
|
||||
{
|
||||
if (!FireClipboardEvent(ePaste, aSelectionType)) {
|
||||
return NS_OK;
|
||||
|
@ -1500,7 +1518,8 @@ NS_IMETHODIMP nsHTMLEditor::Paste(int32_t aSelectionType)
|
|||
nullptr, 0, true);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteTransferable(nsITransferable *aTransferable)
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::PasteTransferable(nsITransferable* aTransferable)
|
||||
{
|
||||
// Use an invalid value for the clipboard type as data comes from aTransferable
|
||||
// and we don't currently implement a way to put that in the data transfer yet.
|
||||
|
@ -1519,10 +1538,11 @@ NS_IMETHODIMP nsHTMLEditor::PasteTransferable(nsITransferable *aTransferable)
|
|||
nullptr, 0, true);
|
||||
}
|
||||
|
||||
//
|
||||
// HTML PasteNoFormatting. Ignore any HTML styles and formating in paste source
|
||||
//
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteNoFormatting(int32_t aSelectionType)
|
||||
/**
|
||||
* HTML PasteNoFormatting. Ignore any HTML styles and formating in paste source.
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::PasteNoFormatting(int32_t aSelectionType)
|
||||
{
|
||||
if (!FireClipboardEvent(ePaste, aSelectionType)) {
|
||||
return NS_OK;
|
||||
|
@ -1553,7 +1573,6 @@ NS_IMETHODIMP nsHTMLEditor::PasteNoFormatting(int32_t aSelectionType)
|
|||
return rv;
|
||||
}
|
||||
|
||||
|
||||
// The following arrays contain the MIME types that we can paste. The arrays
|
||||
// are used by CanPaste() and CanPasteTransferable() below.
|
||||
|
||||
|
@ -1562,7 +1581,9 @@ static const char* textHtmlEditorFlavors[] = { kUnicodeMime, kHTMLMime,
|
|||
kJPEGImageMime, kJPGImageMime,
|
||||
kPNGImageMime, kGIFImageMime };
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::CanPaste(int32_t aSelectionType, bool *aCanPaste)
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::CanPaste(int32_t aSelectionType,
|
||||
bool* aCanPaste)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCanPaste);
|
||||
*aCanPaste = false;
|
||||
|
@ -1594,7 +1615,9 @@ NS_IMETHODIMP nsHTMLEditor::CanPaste(int32_t aSelectionType, bool *aCanPaste)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::CanPasteTransferable(nsITransferable *aTransferable, bool *aCanPaste)
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::CanPasteTransferable(nsITransferable* aTransferable,
|
||||
bool* aCanPaste)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCanPaste);
|
||||
|
||||
|
@ -1639,11 +1662,11 @@ NS_IMETHODIMP nsHTMLEditor::CanPasteTransferable(nsITransferable *aTransferable,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// HTML PasteAsQuotation: Paste in a blockquote type=cite
|
||||
//
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsQuotation(int32_t aSelectionType)
|
||||
/**
|
||||
* HTML PasteAsQuotation: Paste in a blockquote type=cite.
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::PasteAsQuotation(int32_t aSelectionType)
|
||||
{
|
||||
if (IsPlaintextEditor())
|
||||
return PasteAsPlaintextQuotation(aSelectionType);
|
||||
|
@ -1652,8 +1675,9 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsQuotation(int32_t aSelectionType)
|
|||
return PasteAsCitedQuotation(citation, aSelectionType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsAString & aCitation,
|
||||
int32_t aSelectionType)
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::PasteAsCitedQuotation(const nsAString& aCitation,
|
||||
int32_t aSelectionType)
|
||||
{
|
||||
AutoEditBatch beginBatching(this);
|
||||
AutoRules beginRulesSniffing(this, EditAction::insertQuotation,
|
||||
|
@ -1689,10 +1713,11 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsAString & aCitation,
|
|||
return Paste(aSelectionType);
|
||||
}
|
||||
|
||||
//
|
||||
// Paste a plaintext quotation
|
||||
//
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation(int32_t aSelectionType)
|
||||
/**
|
||||
* Paste a plaintext quotation.
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::PasteAsPlaintextQuotation(int32_t aSelectionType)
|
||||
{
|
||||
// Get Clipboard Service
|
||||
nsresult rv;
|
||||
|
@ -1742,7 +1767,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation(int32_t aSelectionType)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::InsertTextWithQuotations(const nsAString &aStringToInsert)
|
||||
HTMLEditor::InsertTextWithQuotations(const nsAString& aStringToInsert)
|
||||
{
|
||||
// The whole operation should be undoable in one transaction:
|
||||
BeginTransaction();
|
||||
|
@ -1824,8 +1849,9 @@ nsHTMLEditor::InsertTextWithQuotations(const nsAString &aStringToInsert)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::InsertAsQuotation(const nsAString & aQuotedText,
|
||||
nsIDOMNode **aNodeInserted)
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::InsertAsQuotation(const nsAString& aQuotedText,
|
||||
nsIDOMNode** aNodeInserted)
|
||||
{
|
||||
if (IsPlaintextEditor())
|
||||
return InsertAsPlaintextQuotation(aQuotedText, true, aNodeInserted);
|
||||
|
@ -1840,9 +1866,9 @@ NS_IMETHODIMP nsHTMLEditor::InsertAsQuotation(const nsAString & aQuotedText,
|
|||
// in that here, quoted material is enclosed in a <pre> tag
|
||||
// in order to preserve the original line wrapping.
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::InsertAsPlaintextQuotation(const nsAString & aQuotedText,
|
||||
bool aAddCites,
|
||||
nsIDOMNode **aNodeInserted)
|
||||
HTMLEditor::InsertAsPlaintextQuotation(const nsAString& aQuotedText,
|
||||
bool aAddCites,
|
||||
nsIDOMNode** aNodeInserted)
|
||||
{
|
||||
// get selection
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
|
@ -1910,22 +1936,22 @@ nsHTMLEditor::InsertAsPlaintextQuotation(const nsAString & aQuotedText,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::StripCites()
|
||||
HTMLEditor::StripCites()
|
||||
{
|
||||
return nsPlaintextEditor::StripCites();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::Rewrap(bool aRespectNewlines)
|
||||
HTMLEditor::Rewrap(bool aRespectNewlines)
|
||||
{
|
||||
return nsPlaintextEditor::Rewrap(aRespectNewlines);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::InsertAsCitedQuotation(const nsAString & aQuotedText,
|
||||
const nsAString & aCitation,
|
||||
bool aInsertHTML,
|
||||
nsIDOMNode **aNodeInserted)
|
||||
HTMLEditor::InsertAsCitedQuotation(const nsAString& aQuotedText,
|
||||
const nsAString& aCitation,
|
||||
bool aInsertHTML,
|
||||
nsIDOMNode** aNodeInserted)
|
||||
{
|
||||
// Don't let anyone insert html into a "plaintext" editor:
|
||||
if (IsPlaintextEditor())
|
||||
|
@ -2089,15 +2115,16 @@ nsresult FindTargetNode(nsIDOMNode *aStart, nsCOMPtr<nsIDOMNode> &aResult)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsHTMLEditor::CreateDOMFragmentFromPaste(const nsAString &aInputString,
|
||||
const nsAString & aContextStr,
|
||||
const nsAString & aInfoStr,
|
||||
nsCOMPtr<nsIDOMNode> *outFragNode,
|
||||
nsCOMPtr<nsIDOMNode> *outStartNode,
|
||||
nsCOMPtr<nsIDOMNode> *outEndNode,
|
||||
int32_t *outStartOffset,
|
||||
int32_t *outEndOffset,
|
||||
bool aTrustedInput)
|
||||
nsresult
|
||||
HTMLEditor::CreateDOMFragmentFromPaste(const nsAString& aInputString,
|
||||
const nsAString& aContextStr,
|
||||
const nsAString& aInfoStr,
|
||||
nsCOMPtr<nsIDOMNode>* outFragNode,
|
||||
nsCOMPtr<nsIDOMNode>* outStartNode,
|
||||
nsCOMPtr<nsIDOMNode>* outEndNode,
|
||||
int32_t* outStartOffset,
|
||||
int32_t* outEndOffset,
|
||||
bool aTrustedInput)
|
||||
{
|
||||
NS_ENSURE_TRUE(outFragNode && outStartNode && outEndNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
@ -2201,11 +2228,12 @@ nsresult nsHTMLEditor::CreateDOMFragmentFromPaste(const nsAString &aInputString,
|
|||
}
|
||||
|
||||
|
||||
nsresult nsHTMLEditor::ParseFragment(const nsAString & aFragStr,
|
||||
nsIAtom* aContextLocalName,
|
||||
nsIDocument* aTargetDocument,
|
||||
DocumentFragment** aFragment,
|
||||
bool aTrustedInput)
|
||||
nsresult
|
||||
HTMLEditor::ParseFragment(const nsAString& aFragStr,
|
||||
nsIAtom* aContextLocalName,
|
||||
nsIDocument* aTargetDocument,
|
||||
DocumentFragment** aFragment,
|
||||
bool aTrustedInput)
|
||||
{
|
||||
nsAutoScriptBlockerSuppressNodeRemoved autoBlocker;
|
||||
|
||||
|
@ -2229,12 +2257,13 @@ nsresult nsHTMLEditor::ParseFragment(const nsAString & aFragStr,
|
|||
}
|
||||
|
||||
void
|
||||
nsHTMLEditor::CreateListOfNodesToPaste(DocumentFragment& aFragment,
|
||||
nsTArray<OwningNonNull<nsINode>>& outNodeList,
|
||||
nsINode* aStartNode,
|
||||
int32_t aStartOffset,
|
||||
nsINode* aEndNode,
|
||||
int32_t aEndOffset)
|
||||
HTMLEditor::CreateListOfNodesToPaste(
|
||||
DocumentFragment& aFragment,
|
||||
nsTArray<OwningNonNull<nsINode>>& outNodeList,
|
||||
nsINode* aStartNode,
|
||||
int32_t aStartOffset,
|
||||
nsINode* aEndNode,
|
||||
int32_t aEndOffset)
|
||||
{
|
||||
// If no info was provided about the boundary between context and stream,
|
||||
// then assume all is stream.
|
||||
|
@ -2261,9 +2290,9 @@ nsHTMLEditor::CreateListOfNodesToPaste(DocumentFragment& aFragment,
|
|||
}
|
||||
|
||||
void
|
||||
nsHTMLEditor::GetListAndTableParents(StartOrEnd aStartOrEnd,
|
||||
nsTArray<OwningNonNull<nsINode>>& aNodeList,
|
||||
nsTArray<OwningNonNull<Element>>& outArray)
|
||||
HTMLEditor::GetListAndTableParents(StartOrEnd aStartOrEnd,
|
||||
nsTArray<OwningNonNull<nsINode>>& aNodeList,
|
||||
nsTArray<OwningNonNull<Element>>& outArray)
|
||||
{
|
||||
MOZ_ASSERT(aNodeList.Length());
|
||||
|
||||
|
@ -2280,8 +2309,9 @@ nsHTMLEditor::GetListAndTableParents(StartOrEnd aStartOrEnd,
|
|||
}
|
||||
|
||||
int32_t
|
||||
nsHTMLEditor::DiscoverPartialListsAndTables(nsTArray<OwningNonNull<nsINode>>& aPasteNodes,
|
||||
nsTArray<OwningNonNull<Element>>& aListsAndTables)
|
||||
HTMLEditor::DiscoverPartialListsAndTables(
|
||||
nsTArray<OwningNonNull<nsINode>>& aPasteNodes,
|
||||
nsTArray<OwningNonNull<Element>>& aListsAndTables)
|
||||
{
|
||||
int32_t ret = -1;
|
||||
int32_t listAndTableParents = aListsAndTables.Length();
|
||||
|
@ -2326,9 +2356,10 @@ nsHTMLEditor::DiscoverPartialListsAndTables(nsTArray<OwningNonNull<nsINode>>& aP
|
|||
}
|
||||
|
||||
nsINode*
|
||||
nsHTMLEditor::ScanForListAndTableStructure(StartOrEnd aStartOrEnd,
|
||||
nsTArray<OwningNonNull<nsINode>>& aNodes,
|
||||
Element& aListOrTable)
|
||||
HTMLEditor::ScanForListAndTableStructure(
|
||||
StartOrEnd aStartOrEnd,
|
||||
nsTArray<OwningNonNull<nsINode>>& aNodes,
|
||||
Element& aListOrTable)
|
||||
{
|
||||
// Look upward from first/last paste node for a piece of this list/table
|
||||
int32_t idx = aStartOrEnd == StartOrEnd::end ? aNodes.Length() - 1 : 0;
|
||||
|
@ -2362,10 +2393,11 @@ nsHTMLEditor::ScanForListAndTableStructure(StartOrEnd aStartOrEnd,
|
|||
}
|
||||
|
||||
void
|
||||
nsHTMLEditor::ReplaceOrphanedStructure(StartOrEnd aStartOrEnd,
|
||||
nsTArray<OwningNonNull<nsINode>>& aNodeArray,
|
||||
nsTArray<OwningNonNull<Element>>& aListAndTableArray,
|
||||
int32_t aHighWaterMark)
|
||||
HTMLEditor::ReplaceOrphanedStructure(
|
||||
StartOrEnd aStartOrEnd,
|
||||
nsTArray<OwningNonNull<nsINode>>& aNodeArray,
|
||||
nsTArray<OwningNonNull<Element>>& aListAndTableArray,
|
||||
int32_t aHighWaterMark)
|
||||
{
|
||||
OwningNonNull<Element> curNode = aListAndTableArray[aHighWaterMark];
|
||||
|
||||
|
@ -2401,3 +2433,5 @@ nsHTMLEditor::ReplaceOrphanedStructure(StartOrEnd aStartOrEnd,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
|
@ -6,20 +6,19 @@
|
|||
#include "HTMLEditorEventListener.h"
|
||||
|
||||
#include "HTMLEditUtils.h"
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
#include "mozilla/dom/Event.h"
|
||||
#include "mozilla/dom/Selection.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsEditor.h"
|
||||
#include "nsError.h"
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
#include "nsIHTMLInlineTableEditor.h"
|
||||
#include "nsIHTMLObjectResizer.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
|
@ -39,22 +38,22 @@ HTMLEditorEventListener::Connect(nsEditor* aEditor)
|
|||
nsCOMPtr<nsIHTMLInlineTableEditor> htmlInlineTableEditor =
|
||||
do_QueryObject(aEditor);
|
||||
NS_PRECONDITION(htmlEditor && htmlInlineTableEditor,
|
||||
"Set nsHTMLEditor or its sub class");
|
||||
"Set HTMLEditor or its sub class");
|
||||
return EditorEventListener::Connect(aEditor);
|
||||
}
|
||||
#endif
|
||||
|
||||
nsHTMLEditor*
|
||||
HTMLEditor*
|
||||
HTMLEditorEventListener::GetHTMLEditor()
|
||||
{
|
||||
// mEditor must be nsHTMLEditor or its subclass.
|
||||
return static_cast<nsHTMLEditor*>(mEditor);
|
||||
// mEditor must be HTMLEditor or its subclass.
|
||||
return static_cast<HTMLEditor*>(mEditor);
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLEditorEventListener::MouseUp(nsIDOMMouseEvent* aMouseEvent)
|
||||
{
|
||||
nsHTMLEditor* htmlEditor = GetHTMLEditor();
|
||||
HTMLEditor* htmlEditor = GetHTMLEditor();
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
nsresult rv = aMouseEvent->AsEvent()->GetTarget(getter_AddRefs(target));
|
||||
|
@ -73,7 +72,7 @@ HTMLEditorEventListener::MouseUp(nsIDOMMouseEvent* aMouseEvent)
|
|||
nsresult
|
||||
HTMLEditorEventListener::MouseDown(nsIDOMMouseEvent* aMouseEvent)
|
||||
{
|
||||
nsHTMLEditor* htmlEditor = GetHTMLEditor();
|
||||
HTMLEditor* htmlEditor = GetHTMLEditor();
|
||||
// Contenteditable should disregard mousedowns outside it.
|
||||
// IsAcceptableInputEvent() checks it for a mouse event.
|
||||
if (!htmlEditor->IsAcceptableInputEvent(aMouseEvent->AsEvent())) {
|
||||
|
|
|
@ -10,10 +10,11 @@
|
|||
#include "nscore.h"
|
||||
|
||||
class nsEditor;
|
||||
class nsHTMLEditor;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class HTMLEditor;
|
||||
|
||||
class HTMLEditorEventListener final : public EditorEventListener
|
||||
{
|
||||
public:
|
||||
|
@ -26,7 +27,7 @@ public:
|
|||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// WARNING: You must be use nsHTMLEditor or its sub class for this class.
|
||||
// WARNING: You must be use HTMLEditor or its sub class for this class.
|
||||
virtual nsresult Connect(nsEditor* aEditor) override;
|
||||
#endif
|
||||
|
||||
|
@ -35,7 +36,7 @@ protected:
|
|||
virtual nsresult MouseUp(nsIDOMMouseEvent* aMouseEvent) override;
|
||||
virtual nsresult MouseClick(nsIDOMMouseEvent* aMouseEvent) override;
|
||||
|
||||
inline nsHTMLEditor* GetHTMLEditor();
|
||||
inline HTMLEditor* GetHTMLEditor();
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
#include "nsHTMLObjectResizer.h"
|
||||
|
||||
#include "EditorUtils.h"
|
||||
|
@ -18,7 +19,6 @@
|
|||
#include "nsDebug.h"
|
||||
#include "nsError.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsID.h"
|
||||
|
@ -31,7 +31,6 @@
|
|||
#include "nsIDOMText.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
#include "nsIHTMLObjectResizeListener.h"
|
||||
#include "nsIHTMLObjectResizer.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
@ -46,15 +45,13 @@
|
|||
|
||||
class nsISelection;
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
/******************************************************************************
|
||||
* DocumentResizeEventListener
|
||||
******************************************************************************/
|
||||
|
||||
// ==================================================================
|
||||
// DocumentResizeEventListener
|
||||
// ==================================================================
|
||||
NS_IMPL_ISUPPORTS(DocumentResizeEventListener, nsIDOMEventListener)
|
||||
|
||||
DocumentResizeEventListener::DocumentResizeEventListener(nsIHTMLEditor * aEditor)
|
||||
DocumentResizeEventListener::DocumentResizeEventListener(nsIHTMLEditor* aEditor)
|
||||
{
|
||||
mEditor = do_GetWeakReference(aEditor);
|
||||
}
|
||||
|
@ -72,13 +69,13 @@ DocumentResizeEventListener::HandleEvent(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// ==================================================================
|
||||
// ResizerSelectionListener
|
||||
// ==================================================================
|
||||
/******************************************************************************
|
||||
* ResizerSelectionListener
|
||||
******************************************************************************/
|
||||
|
||||
NS_IMPL_ISUPPORTS(ResizerSelectionListener, nsISelectionListener)
|
||||
|
||||
ResizerSelectionListener::ResizerSelectionListener(nsIHTMLEditor * aEditor)
|
||||
ResizerSelectionListener::ResizerSelectionListener(nsIHTMLEditor* aEditor)
|
||||
{
|
||||
mEditor = do_GetWeakReference(aEditor);
|
||||
}
|
||||
|
@ -88,7 +85,9 @@ ResizerSelectionListener::~ResizerSelectionListener()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ResizerSelectionListener::NotifySelectionChanged(nsIDOMDocument *, nsISelection *aSelection, int16_t aReason)
|
||||
ResizerSelectionListener::NotifySelectionChanged(nsIDOMDocument* aDOMDocument,
|
||||
nsISelection* aSelection,
|
||||
int16_t aReason)
|
||||
{
|
||||
if ((aReason & (nsISelectionListener::MOUSEDOWN_REASON |
|
||||
nsISelectionListener::KEYPRESS_REASON |
|
||||
|
@ -104,13 +103,13 @@ ResizerSelectionListener::NotifySelectionChanged(nsIDOMDocument *, nsISelection
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// ==================================================================
|
||||
// ResizerMouseMotionListener
|
||||
// ==================================================================
|
||||
/******************************************************************************
|
||||
* ResizerMouseMotionListener
|
||||
******************************************************************************/
|
||||
|
||||
NS_IMPL_ISUPPORTS(ResizerMouseMotionListener, nsIDOMEventListener)
|
||||
|
||||
ResizerMouseMotionListener::ResizerMouseMotionListener(nsIHTMLEditor * aEditor)
|
||||
ResizerMouseMotionListener::ResizerMouseMotionListener(nsIHTMLEditor* aEditor)
|
||||
{
|
||||
mEditor = do_GetWeakReference(aEditor);
|
||||
}
|
||||
|
@ -139,12 +138,17 @@ ResizerMouseMotionListener::HandleEvent(nsIDOMEvent* aMouseEvent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// ==================================================================
|
||||
// nsHTMLEditor
|
||||
// ==================================================================
|
||||
namespace mozilla {
|
||||
|
||||
using namespace dom;
|
||||
|
||||
/******************************************************************************
|
||||
* mozilla::HTMLEditor
|
||||
******************************************************************************/
|
||||
|
||||
already_AddRefed<Element>
|
||||
nsHTMLEditor::CreateResizer(int16_t aLocation, nsIDOMNode* aParentNode)
|
||||
HTMLEditor::CreateResizer(int16_t aLocation,
|
||||
nsIDOMNode* aParentNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> retDOM;
|
||||
nsresult res = CreateAnonymousElement(NS_LITERAL_STRING("span"),
|
||||
|
@ -199,8 +203,8 @@ nsHTMLEditor::CreateResizer(int16_t aLocation, nsIDOMNode* aParentNode)
|
|||
}
|
||||
|
||||
already_AddRefed<Element>
|
||||
nsHTMLEditor::CreateShadow(nsIDOMNode* aParentNode,
|
||||
nsIDOMElement* aOriginalObject)
|
||||
HTMLEditor::CreateShadow(nsIDOMNode* aParentNode,
|
||||
nsIDOMElement* aOriginalObject)
|
||||
{
|
||||
// let's create an image through the element factory
|
||||
nsAutoString name;
|
||||
|
@ -221,7 +225,7 @@ nsHTMLEditor::CreateShadow(nsIDOMNode* aParentNode,
|
|||
}
|
||||
|
||||
already_AddRefed<Element>
|
||||
nsHTMLEditor::CreateResizingInfo(nsIDOMNode* aParentNode)
|
||||
HTMLEditor::CreateResizingInfo(nsIDOMNode* aParentNode)
|
||||
{
|
||||
// let's create an info box through the element factory
|
||||
nsCOMPtr<nsIDOMElement> retDOM;
|
||||
|
@ -234,7 +238,7 @@ nsHTMLEditor::CreateResizingInfo(nsIDOMNode* aParentNode)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::SetAllResizersPosition()
|
||||
HTMLEditor::SetAllResizersPosition()
|
||||
{
|
||||
NS_ENSURE_TRUE(mTopLeftHandle, NS_ERROR_FAILURE);
|
||||
|
||||
|
@ -274,7 +278,7 @@ nsHTMLEditor::SetAllResizersPosition()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::RefreshResizers()
|
||||
HTMLEditor::RefreshResizers()
|
||||
{
|
||||
// nothing to do if resizers are not displayed...
|
||||
NS_ENSURE_TRUE(mResizedObject, NS_OK);
|
||||
|
@ -297,7 +301,7 @@ nsHTMLEditor::RefreshResizers()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::ShowResizers(nsIDOMElement *aResizedElement)
|
||||
HTMLEditor::ShowResizers(nsIDOMElement* aResizedElement)
|
||||
{
|
||||
nsresult res = ShowResizersInner(aResizedElement);
|
||||
if (NS_FAILED(res))
|
||||
|
@ -306,7 +310,7 @@ nsHTMLEditor::ShowResizers(nsIDOMElement *aResizedElement)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::ShowResizersInner(nsIDOMElement *aResizedElement)
|
||||
HTMLEditor::ShowResizersInner(nsIDOMElement* aResizedElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResizedElement);
|
||||
nsresult res;
|
||||
|
@ -386,7 +390,7 @@ nsHTMLEditor::ShowResizersInner(nsIDOMElement *aResizedElement)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::HideResizers(void)
|
||||
HTMLEditor::HideResizers()
|
||||
{
|
||||
NS_ENSURE_TRUE(mResizedObject, NS_OK);
|
||||
|
||||
|
@ -481,7 +485,7 @@ nsHTMLEditor::HideResizers(void)
|
|||
}
|
||||
|
||||
void
|
||||
nsHTMLEditor::HideShadowAndInfo()
|
||||
HTMLEditor::HideShadowAndInfo()
|
||||
{
|
||||
if (mResizingShadow)
|
||||
mResizingShadow->SetAttr(kNameSpaceID_None, nsGkAtoms::_class,
|
||||
|
@ -492,7 +496,7 @@ nsHTMLEditor::HideShadowAndInfo()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::StartResizing(nsIDOMElement *aHandle)
|
||||
HTMLEditor::StartResizing(nsIDOMElement* aHandle)
|
||||
{
|
||||
// First notify the listeners if any
|
||||
for (auto& listener : mObjectResizeEventListeners) {
|
||||
|
@ -566,10 +570,11 @@ nsHTMLEditor::StartResizing(nsIDOMElement *aHandle)
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::MouseDown(int32_t aClientX, int32_t aClientY,
|
||||
nsIDOMElement *aTarget, nsIDOMEvent* aEvent)
|
||||
HTMLEditor::MouseDown(int32_t aClientX,
|
||||
int32_t aClientY,
|
||||
nsIDOMElement* aTarget,
|
||||
nsIDOMEvent* aEvent)
|
||||
{
|
||||
bool anonElement = false;
|
||||
if (aTarget && NS_SUCCEEDED(aTarget->HasAttribute(NS_LITERAL_STRING("_moz_anonclass"), &anonElement)))
|
||||
|
@ -597,8 +602,9 @@ nsHTMLEditor::MouseDown(int32_t aClientX, int32_t aClientY,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::MouseUp(int32_t aClientX, int32_t aClientY,
|
||||
nsIDOMElement *aTarget)
|
||||
HTMLEditor::MouseUp(int32_t aClientX,
|
||||
int32_t aClientY,
|
||||
nsIDOMElement* aTarget)
|
||||
{
|
||||
if (mIsResizing) {
|
||||
// we are resizing and release the mouse button, so let's
|
||||
|
@ -620,11 +626,12 @@ nsHTMLEditor::MouseUp(int32_t aClientX, int32_t aClientY,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsHTMLEditor::SetResizeIncrements(int32_t aX, int32_t aY,
|
||||
int32_t aW, int32_t aH,
|
||||
bool aPreserveRatio)
|
||||
HTMLEditor::SetResizeIncrements(int32_t aX,
|
||||
int32_t aY,
|
||||
int32_t aW,
|
||||
int32_t aH,
|
||||
bool aPreserveRatio)
|
||||
{
|
||||
mXIncrementFactor = aX;
|
||||
mYIncrementFactor = aY;
|
||||
|
@ -634,7 +641,10 @@ nsHTMLEditor::SetResizeIncrements(int32_t aX, int32_t aY,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::SetResizingInfoPosition(int32_t aX, int32_t aY, int32_t aW, int32_t aH)
|
||||
HTMLEditor::SetResizingInfoPosition(int32_t aX,
|
||||
int32_t aY,
|
||||
int32_t aW,
|
||||
int32_t aH)
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> domdoc = GetDOMDocument();
|
||||
|
||||
|
@ -715,10 +725,10 @@ nsHTMLEditor::SetResizingInfoPosition(int32_t aX, int32_t aY, int32_t aW, int32_
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::SetShadowPosition(Element* aShadow,
|
||||
Element* aOriginalObject,
|
||||
int32_t aOriginalObjectX,
|
||||
int32_t aOriginalObjectY)
|
||||
HTMLEditor::SetShadowPosition(Element* aShadow,
|
||||
Element* aOriginalObject,
|
||||
int32_t aOriginalObjectX,
|
||||
int32_t aOriginalObjectY)
|
||||
{
|
||||
SetAnonymousElementPosition(aOriginalObjectX, aOriginalObjectY, static_cast<nsIDOMElement*>(GetAsDOMNode(aShadow)));
|
||||
|
||||
|
@ -733,7 +743,9 @@ nsHTMLEditor::SetShadowPosition(Element* aShadow,
|
|||
}
|
||||
|
||||
int32_t
|
||||
nsHTMLEditor::GetNewResizingIncrement(int32_t aX, int32_t aY, int32_t aID)
|
||||
HTMLEditor::GetNewResizingIncrement(int32_t aX,
|
||||
int32_t aY,
|
||||
int32_t aID)
|
||||
{
|
||||
int32_t result = 0;
|
||||
if (!mPreserveRatio) {
|
||||
|
@ -773,7 +785,8 @@ nsHTMLEditor::GetNewResizingIncrement(int32_t aX, int32_t aY, int32_t aID)
|
|||
}
|
||||
|
||||
int32_t
|
||||
nsHTMLEditor::GetNewResizingX(int32_t aX, int32_t aY)
|
||||
HTMLEditor::GetNewResizingX(int32_t aX,
|
||||
int32_t aY)
|
||||
{
|
||||
int32_t resized = mResizedObjectX +
|
||||
GetNewResizingIncrement(aX, aY, kX) * mXIncrementFactor;
|
||||
|
@ -782,7 +795,8 @@ nsHTMLEditor::GetNewResizingX(int32_t aX, int32_t aY)
|
|||
}
|
||||
|
||||
int32_t
|
||||
nsHTMLEditor::GetNewResizingY(int32_t aX, int32_t aY)
|
||||
HTMLEditor::GetNewResizingY(int32_t aX,
|
||||
int32_t aY)
|
||||
{
|
||||
int32_t resized = mResizedObjectY +
|
||||
GetNewResizingIncrement(aX, aY, kY) * mYIncrementFactor;
|
||||
|
@ -791,7 +805,8 @@ nsHTMLEditor::GetNewResizingY(int32_t aX, int32_t aY)
|
|||
}
|
||||
|
||||
int32_t
|
||||
nsHTMLEditor::GetNewResizingWidth(int32_t aX, int32_t aY)
|
||||
HTMLEditor::GetNewResizingWidth(int32_t aX,
|
||||
int32_t aY)
|
||||
{
|
||||
int32_t resized = mResizedObjectWidth +
|
||||
GetNewResizingIncrement(aX, aY, kWidth) *
|
||||
|
@ -800,7 +815,8 @@ nsHTMLEditor::GetNewResizingWidth(int32_t aX, int32_t aY)
|
|||
}
|
||||
|
||||
int32_t
|
||||
nsHTMLEditor::GetNewResizingHeight(int32_t aX, int32_t aY)
|
||||
HTMLEditor::GetNewResizingHeight(int32_t aX,
|
||||
int32_t aY)
|
||||
{
|
||||
int32_t resized = mResizedObjectHeight +
|
||||
GetNewResizingIncrement(aX, aY, kHeight) *
|
||||
|
@ -808,9 +824,8 @@ nsHTMLEditor::GetNewResizingHeight(int32_t aX, int32_t aY)
|
|||
return std::max(resized, 1);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::MouseMove(nsIDOMEvent* aMouseEvent)
|
||||
HTMLEditor::MouseMove(nsIDOMEvent* aMouseEvent)
|
||||
{
|
||||
NS_NAMED_LITERAL_STRING(leftStr, "left");
|
||||
NS_NAMED_LITERAL_STRING(topStr, "top");
|
||||
|
@ -877,7 +892,8 @@ nsHTMLEditor::MouseMove(nsIDOMEvent* aMouseEvent)
|
|||
}
|
||||
|
||||
void
|
||||
nsHTMLEditor::SetFinalSize(int32_t aX, int32_t aY)
|
||||
HTMLEditor::SetFinalSize(int32_t aX,
|
||||
int32_t aY)
|
||||
{
|
||||
if (!mResizedObject) {
|
||||
// paranoia
|
||||
|
@ -980,7 +996,7 @@ nsHTMLEditor::SetFinalSize(int32_t aX, int32_t aY)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetResizedObject(nsIDOMElement * *aResizedObject)
|
||||
HTMLEditor::GetResizedObject(nsIDOMElement** aResizedObject)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> ret = static_cast<nsIDOMElement*>(GetAsDOMNode(mResizedObject));
|
||||
ret.forget(aResizedObject);
|
||||
|
@ -988,21 +1004,21 @@ nsHTMLEditor::GetResizedObject(nsIDOMElement * *aResizedObject)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetObjectResizingEnabled(bool *aIsObjectResizingEnabled)
|
||||
HTMLEditor::GetObjectResizingEnabled(bool* aIsObjectResizingEnabled)
|
||||
{
|
||||
*aIsObjectResizingEnabled = mIsObjectResizingEnabled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SetObjectResizingEnabled(bool aObjectResizingEnabled)
|
||||
HTMLEditor::SetObjectResizingEnabled(bool aObjectResizingEnabled)
|
||||
{
|
||||
mIsObjectResizingEnabled = aObjectResizingEnabled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::AddObjectResizeEventListener(nsIHTMLObjectResizeListener * aListener)
|
||||
HTMLEditor::AddObjectResizeEventListener(nsIHTMLObjectResizeListener* aListener)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aListener);
|
||||
if (mObjectResizeEventListeners.Contains(aListener)) {
|
||||
|
@ -1016,7 +1032,8 @@ nsHTMLEditor::AddObjectResizeEventListener(nsIHTMLObjectResizeListener * aListen
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::RemoveObjectResizeEventListener(nsIHTMLObjectResizeListener * aListener)
|
||||
HTMLEditor::RemoveObjectResizeEventListener(
|
||||
nsIHTMLObjectResizeListener* aListener)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aListener);
|
||||
if (!mObjectResizeEventListeners.Contains(aListener)) {
|
||||
|
@ -1029,3 +1046,4 @@ nsHTMLEditor::RemoveObjectResizeEventListener(nsIHTMLObjectResizeListener * aLis
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
|
@ -2,19 +2,19 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
|
||||
#include "HTMLEditUtils.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsAString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsError.h"
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
#include "nsIHTMLObjectResizer.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsLiteralString.h"
|
||||
|
@ -22,28 +22,28 @@
|
|||
#include "nsString.h"
|
||||
#include "nscore.h"
|
||||
|
||||
using namespace mozilla;
|
||||
namespace mozilla {
|
||||
|
||||
// Uncomment the following line if you want to disable
|
||||
// table deletion when the only column/row is removed
|
||||
// #define DISABLE_TABLE_DELETION 1
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SetInlineTableEditingEnabled(bool aIsEnabled)
|
||||
HTMLEditor::SetInlineTableEditingEnabled(bool aIsEnabled)
|
||||
{
|
||||
mIsInlineTableEditingEnabled = aIsEnabled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetInlineTableEditingEnabled(bool * aIsEnabled)
|
||||
HTMLEditor::GetInlineTableEditingEnabled(bool* aIsEnabled)
|
||||
{
|
||||
*aIsEnabled = mIsInlineTableEditingEnabled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::ShowInlineTableEditingUI(nsIDOMElement * aCell)
|
||||
HTMLEditor::ShowInlineTableEditingUI(nsIDOMElement* aCell)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCell);
|
||||
|
||||
|
@ -93,7 +93,7 @@ nsHTMLEditor::ShowInlineTableEditingUI(nsIDOMElement * aCell)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::HideInlineTableEditingUI()
|
||||
HTMLEditor::HideInlineTableEditingUI()
|
||||
{
|
||||
mInlineEditedCell = nullptr;
|
||||
|
||||
|
@ -130,7 +130,7 @@ nsHTMLEditor::HideInlineTableEditingUI()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::DoInlineTableEditingAction(nsIDOMElement * aElement)
|
||||
HTMLEditor::DoInlineTableEditingAction(nsIDOMElement* aElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aElement);
|
||||
bool anonElement = false;
|
||||
|
@ -187,7 +187,7 @@ nsHTMLEditor::DoInlineTableEditingAction(nsIDOMElement * aElement)
|
|||
}
|
||||
|
||||
void
|
||||
nsHTMLEditor::AddMouseClickListener(nsIDOMElement * aElement)
|
||||
HTMLEditor::AddMouseClickListener(nsIDOMElement* aElement)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> evtTarget(do_QueryInterface(aElement));
|
||||
if (evtTarget) {
|
||||
|
@ -197,7 +197,7 @@ nsHTMLEditor::AddMouseClickListener(nsIDOMElement * aElement)
|
|||
}
|
||||
|
||||
void
|
||||
nsHTMLEditor::RemoveMouseClickListener(nsIDOMElement * aElement)
|
||||
HTMLEditor::RemoveMouseClickListener(nsIDOMElement* aElement)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> evtTarget(do_QueryInterface(aElement));
|
||||
if (evtTarget) {
|
||||
|
@ -207,7 +207,7 @@ nsHTMLEditor::RemoveMouseClickListener(nsIDOMElement * aElement)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::RefreshInlineTableEditingUI()
|
||||
HTMLEditor::RefreshInlineTableEditingUI()
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(mInlineEditedCell);
|
||||
if (!htmlElement) {
|
||||
|
@ -272,3 +272,4 @@ nsHTMLEditor::RefreshInlineTableEditingUI()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
|
@ -3,6 +3,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
|
||||
#include "EditorUtils.h"
|
||||
#include "HTMLEditUtils.h"
|
||||
#include "TextEditUtils.h"
|
||||
|
@ -21,7 +23,6 @@
|
|||
#include "nsEditor.h"
|
||||
#include "nsError.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIContentIterator.h"
|
||||
|
@ -43,11 +44,12 @@
|
|||
|
||||
class nsISupports;
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
namespace mozilla {
|
||||
|
||||
using namespace dom;
|
||||
|
||||
static bool
|
||||
IsEmptyTextNode(nsHTMLEditor* aThis, nsINode* aNode)
|
||||
IsEmptyTextNode(HTMLEditor* aThis, nsINode* aNode)
|
||||
{
|
||||
bool isEmptyTextNode = false;
|
||||
return nsEditor::IsTextNode(aNode) &&
|
||||
|
@ -55,9 +57,10 @@ IsEmptyTextNode(nsHTMLEditor* aThis, nsINode* aNode)
|
|||
isEmptyTextNode;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::AddDefaultProperty(nsIAtom *aProperty,
|
||||
const nsAString & aAttribute,
|
||||
const nsAString & aValue)
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::AddDefaultProperty(nsIAtom* aProperty,
|
||||
const nsAString& aAttribute,
|
||||
const nsAString& aValue)
|
||||
{
|
||||
nsString outValue;
|
||||
int32_t index;
|
||||
|
@ -76,9 +79,10 @@ NS_IMETHODIMP nsHTMLEditor::AddDefaultProperty(nsIAtom *aProperty,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::RemoveDefaultProperty(nsIAtom *aProperty,
|
||||
const nsAString & aAttribute,
|
||||
const nsAString & aValue)
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::RemoveDefaultProperty(nsIAtom* aProperty,
|
||||
const nsAString& aAttribute,
|
||||
const nsAString& aValue)
|
||||
{
|
||||
nsString outValue;
|
||||
int32_t index;
|
||||
|
@ -91,7 +95,8 @@ NS_IMETHODIMP nsHTMLEditor::RemoveDefaultProperty(nsIAtom *aProperty,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::RemoveAllDefaultProperties()
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::RemoveAllDefaultProperties()
|
||||
{
|
||||
uint32_t j, defcon = mDefaultStyles.Length();
|
||||
for (j=0; j<defcon; j++)
|
||||
|
@ -104,9 +109,9 @@ NS_IMETHODIMP nsHTMLEditor::RemoveAllDefaultProperties()
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SetInlineProperty(nsIAtom* aProperty,
|
||||
const nsAString& aAttribute,
|
||||
const nsAString& aValue)
|
||||
HTMLEditor::SetInlineProperty(nsIAtom* aProperty,
|
||||
const nsAString& aAttribute,
|
||||
const nsAString& aValue)
|
||||
{
|
||||
NS_ENSURE_TRUE(aProperty, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(mRules, NS_ERROR_NOT_INITIALIZED);
|
||||
|
@ -221,15 +226,13 @@ nsHTMLEditor::SetInlineProperty(nsIAtom* aProperty,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Helper function for SetInlinePropertyOn*: is aNode a simple old <b>, <font>,
|
||||
// <span style="">, etc. that we can reuse instead of creating a new one?
|
||||
bool
|
||||
nsHTMLEditor::IsSimpleModifiableNode(nsIContent* aContent,
|
||||
nsIAtom* aProperty,
|
||||
const nsAString* aAttribute,
|
||||
const nsAString* aValue)
|
||||
HTMLEditor::IsSimpleModifiableNode(nsIContent* aContent,
|
||||
nsIAtom* aProperty,
|
||||
const nsAString* aAttribute,
|
||||
const nsAString* aValue)
|
||||
{
|
||||
// aContent can be null, in which case we'll return false in a few lines
|
||||
MOZ_ASSERT(aProperty);
|
||||
|
@ -298,14 +301,13 @@ nsHTMLEditor::IsSimpleModifiableNode(nsIContent* aContent,
|
|||
return mCSSEditUtils->ElementsSameStyle(newSpan, element);
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::SetInlinePropertyOnTextNode(Text& aText,
|
||||
int32_t aStartOffset,
|
||||
int32_t aEndOffset,
|
||||
nsIAtom& aProperty,
|
||||
const nsAString* aAttribute,
|
||||
const nsAString& aValue)
|
||||
HTMLEditor::SetInlinePropertyOnTextNode(Text& aText,
|
||||
int32_t aStartOffset,
|
||||
int32_t aEndOffset,
|
||||
nsIAtom& aProperty,
|
||||
const nsAString* aAttribute,
|
||||
const nsAString& aValue)
|
||||
{
|
||||
if (!aText.GetParentNode() ||
|
||||
!CanContainTag(*aText.GetParentNode(), aProperty)) {
|
||||
|
@ -363,12 +365,11 @@ nsHTMLEditor::SetInlinePropertyOnTextNode(Text& aText,
|
|||
return SetInlinePropertyOnNode(*text, aProperty, aAttribute, aValue);
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::SetInlinePropertyOnNodeImpl(nsIContent& aNode,
|
||||
nsIAtom& aProperty,
|
||||
const nsAString* aAttribute,
|
||||
const nsAString& aValue)
|
||||
HTMLEditor::SetInlinePropertyOnNodeImpl(nsIContent& aNode,
|
||||
nsIAtom& aProperty,
|
||||
const nsAString* aAttribute,
|
||||
const nsAString& aValue)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> attrAtom = aAttribute ? NS_Atomize(*aAttribute) : nullptr;
|
||||
|
||||
|
@ -469,12 +470,11 @@ nsHTMLEditor::SetInlinePropertyOnNodeImpl(nsIContent& aNode,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::SetInlinePropertyOnNode(nsIContent& aNode,
|
||||
nsIAtom& aProperty,
|
||||
const nsAString* aAttribute,
|
||||
const nsAString& aValue)
|
||||
HTMLEditor::SetInlinePropertyOnNode(nsIContent& aNode,
|
||||
nsIAtom& aProperty,
|
||||
const nsAString* aAttribute,
|
||||
const nsAString& aValue)
|
||||
{
|
||||
nsCOMPtr<nsIContent> previousSibling = aNode.GetPreviousSibling(),
|
||||
nextSibling = aNode.GetNextSibling();
|
||||
|
@ -514,10 +514,10 @@ nsHTMLEditor::SetInlinePropertyOnNode(nsIContent& aNode,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::SplitStyleAboveRange(nsRange* inRange, nsIAtom* aProperty,
|
||||
const nsAString* aAttribute)
|
||||
HTMLEditor::SplitStyleAboveRange(nsRange* inRange,
|
||||
nsIAtom* aProperty,
|
||||
const nsAString* aAttribute)
|
||||
{
|
||||
NS_ENSURE_TRUE(inRange, NS_ERROR_NULL_POINTER);
|
||||
nsresult res;
|
||||
|
@ -550,13 +550,13 @@ nsHTMLEditor::SplitStyleAboveRange(nsRange* inRange, nsIAtom* aProperty,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::SplitStyleAbovePoint(nsCOMPtr<nsINode>* aNode,
|
||||
int32_t* aOffset,
|
||||
// null here means we split all properties
|
||||
nsIAtom* aProperty,
|
||||
const nsAString* aAttribute,
|
||||
nsIContent** aOutLeftNode,
|
||||
nsIContent** aOutRightNode)
|
||||
HTMLEditor::SplitStyleAbovePoint(nsCOMPtr<nsINode>* aNode,
|
||||
int32_t* aOffset,
|
||||
// null here means we split all properties
|
||||
nsIAtom* aProperty,
|
||||
const nsAString* aAttribute,
|
||||
nsIContent** aOutLeftNode,
|
||||
nsIContent** aOutRightNode)
|
||||
{
|
||||
NS_ENSURE_TRUE(aNode && *aNode && aOffset, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE((*aNode)->IsContent(), NS_OK);
|
||||
|
@ -603,8 +603,10 @@ nsHTMLEditor::SplitStyleAbovePoint(nsCOMPtr<nsINode>* aNode,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::ClearStyle(nsCOMPtr<nsINode>* aNode, int32_t* aOffset,
|
||||
nsIAtom* aProperty, const nsAString* aAttribute)
|
||||
HTMLEditor::ClearStyle(nsCOMPtr<nsINode>* aNode,
|
||||
int32_t* aOffset,
|
||||
nsIAtom* aProperty,
|
||||
const nsAString* aAttribute)
|
||||
{
|
||||
nsCOMPtr<nsIContent> leftNode, rightNode;
|
||||
nsresult res = SplitStyleAbovePoint(aNode, aOffset, aProperty,
|
||||
|
@ -683,13 +685,14 @@ nsHTMLEditor::ClearStyle(nsCOMPtr<nsINode>* aNode, int32_t* aOffset,
|
|||
}
|
||||
|
||||
bool
|
||||
nsHTMLEditor::NodeIsProperty(nsINode& aNode)
|
||||
HTMLEditor::NodeIsProperty(nsINode& aNode)
|
||||
{
|
||||
return IsContainer(&aNode) && IsEditable(&aNode) && !IsBlockNode(&aNode) &&
|
||||
!aNode.IsHTMLElement(nsGkAtoms::a);
|
||||
}
|
||||
|
||||
nsresult nsHTMLEditor::ApplyDefaultProperties()
|
||||
nsresult
|
||||
HTMLEditor::ApplyDefaultProperties()
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
uint32_t j, defcon = mDefaultStyles.Length();
|
||||
|
@ -704,10 +707,10 @@ nsresult nsHTMLEditor::ApplyDefaultProperties()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::RemoveStyleInside(nsIContent& aNode,
|
||||
nsIAtom* aProperty,
|
||||
const nsAString* aAttribute,
|
||||
const bool aChildrenOnly /* = false */)
|
||||
HTMLEditor::RemoveStyleInside(nsIContent& aNode,
|
||||
nsIAtom* aProperty,
|
||||
const nsAString* aAttribute,
|
||||
const bool aChildrenOnly /* = false */)
|
||||
{
|
||||
if (aNode.GetAsText()) {
|
||||
return NS_OK;
|
||||
|
@ -815,8 +818,8 @@ nsHTMLEditor::RemoveStyleInside(nsIContent& aNode,
|
|||
}
|
||||
|
||||
bool
|
||||
nsHTMLEditor::IsOnlyAttribute(const nsIContent* aContent,
|
||||
const nsAString& aAttribute)
|
||||
HTMLEditor::IsOnlyAttribute(const nsIContent* aContent,
|
||||
const nsAString& aAttribute)
|
||||
{
|
||||
MOZ_ASSERT(aContent);
|
||||
|
||||
|
@ -842,7 +845,7 @@ nsHTMLEditor::IsOnlyAttribute(const nsIContent* aContent,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::PromoteRangeIfStartsOrEndsInNamedAnchor(nsRange& aRange)
|
||||
HTMLEditor::PromoteRangeIfStartsOrEndsInNamedAnchor(nsRange& aRange)
|
||||
{
|
||||
// We assume that <a> is not nested.
|
||||
nsCOMPtr<nsINode> startNode = aRange.GetStartParent();
|
||||
|
@ -884,7 +887,7 @@ nsHTMLEditor::PromoteRangeIfStartsOrEndsInNamedAnchor(nsRange& aRange)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::PromoteInlineRange(nsRange& aRange)
|
||||
HTMLEditor::PromoteInlineRange(nsRange& aRange)
|
||||
{
|
||||
nsCOMPtr<nsINode> startNode = aRange.GetStartParent();
|
||||
int32_t startOffset = aRange.StartOffset();
|
||||
|
@ -917,7 +920,8 @@ nsHTMLEditor::PromoteInlineRange(nsRange& aRange)
|
|||
}
|
||||
|
||||
bool
|
||||
nsHTMLEditor::IsAtFrontOfNode(nsINode& aNode, int32_t aOffset)
|
||||
HTMLEditor::IsAtFrontOfNode(nsINode& aNode,
|
||||
int32_t aOffset)
|
||||
{
|
||||
if (!aOffset) {
|
||||
return true;
|
||||
|
@ -936,7 +940,8 @@ nsHTMLEditor::IsAtFrontOfNode(nsINode& aNode, int32_t aOffset)
|
|||
}
|
||||
|
||||
bool
|
||||
nsHTMLEditor::IsAtEndOfNode(nsINode& aNode, int32_t aOffset)
|
||||
HTMLEditor::IsAtEndOfNode(nsINode& aNode,
|
||||
int32_t aOffset)
|
||||
{
|
||||
if (aOffset == (int32_t)aNode.Length()) {
|
||||
return true;
|
||||
|
@ -956,14 +961,14 @@ nsHTMLEditor::IsAtEndOfNode(nsINode& aNode, int32_t aOffset)
|
|||
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::GetInlinePropertyBase(nsIAtom& aProperty,
|
||||
const nsAString* aAttribute,
|
||||
const nsAString* aValue,
|
||||
bool* aFirst,
|
||||
bool* aAny,
|
||||
bool* aAll,
|
||||
nsAString* outValue,
|
||||
bool aCheckDefaults)
|
||||
HTMLEditor::GetInlinePropertyBase(nsIAtom& aProperty,
|
||||
const nsAString* aAttribute,
|
||||
const nsAString* aValue,
|
||||
bool* aFirst,
|
||||
bool* aAny,
|
||||
bool* aAll,
|
||||
nsAString* outValue,
|
||||
bool aCheckDefaults)
|
||||
{
|
||||
*aAny = false;
|
||||
*aAll = true;
|
||||
|
@ -1129,13 +1134,13 @@ nsHTMLEditor::GetInlinePropertyBase(nsIAtom& aProperty,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::GetInlineProperty(nsIAtom *aProperty,
|
||||
const nsAString &aAttribute,
|
||||
const nsAString &aValue,
|
||||
bool *aFirst,
|
||||
bool *aAny,
|
||||
bool *aAll)
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::GetInlineProperty(nsIAtom* aProperty,
|
||||
const nsAString& aAttribute,
|
||||
const nsAString& aValue,
|
||||
bool* aFirst,
|
||||
bool* aAny,
|
||||
bool* aAll)
|
||||
{
|
||||
NS_ENSURE_TRUE(aProperty && aFirst && aAny && aAll, NS_ERROR_NULL_POINTER);
|
||||
const nsAString *att = nullptr;
|
||||
|
@ -1147,14 +1152,14 @@ NS_IMETHODIMP nsHTMLEditor::GetInlineProperty(nsIAtom *aProperty,
|
|||
return GetInlinePropertyBase(*aProperty, att, val, aFirst, aAny, aAll, nullptr);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty,
|
||||
const nsAString &aAttribute,
|
||||
const nsAString &aValue,
|
||||
bool *aFirst,
|
||||
bool *aAny,
|
||||
bool *aAll,
|
||||
nsAString &outValue)
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom* aProperty,
|
||||
const nsAString& aAttribute,
|
||||
const nsAString& aValue,
|
||||
bool* aFirst,
|
||||
bool* aAny,
|
||||
bool* aAll,
|
||||
nsAString& outValue)
|
||||
{
|
||||
NS_ENSURE_TRUE(aProperty && aFirst && aAny && aAll, NS_ERROR_NULL_POINTER);
|
||||
const nsAString *att = nullptr;
|
||||
|
@ -1166,8 +1171,8 @@ NS_IMETHODIMP nsHTMLEditor::GetInlinePropertyWithAttrValue(nsIAtom *aProperty,
|
|||
return GetInlinePropertyBase(*aProperty, att, val, aFirst, aAny, aAll, &outValue);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::RemoveAllInlineProperties()
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::RemoveAllInlineProperties()
|
||||
{
|
||||
AutoEditBatch batchIt(this);
|
||||
AutoRules beginRulesSniffing(this, EditAction::resetTextProperties,
|
||||
|
@ -1178,14 +1183,16 @@ NS_IMETHODIMP nsHTMLEditor::RemoveAllInlineProperties()
|
|||
return ApplyDefaultProperties();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::RemoveInlineProperty(nsIAtom *aProperty, const nsAString &aAttribute)
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::RemoveInlineProperty(nsIAtom* aProperty,
|
||||
const nsAString& aAttribute)
|
||||
{
|
||||
return RemoveInlinePropertyImpl(aProperty, &aAttribute);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom* aProperty,
|
||||
const nsAString* aAttribute)
|
||||
HTMLEditor::RemoveInlinePropertyImpl(nsIAtom* aProperty,
|
||||
const nsAString* aAttribute)
|
||||
{
|
||||
MOZ_ASSERT_IF(aProperty, aAttribute);
|
||||
NS_ENSURE_TRUE(mRules, NS_ERROR_NOT_INITIALIZED);
|
||||
|
@ -1317,18 +1324,20 @@ nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom* aProperty,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::IncreaseFontSize()
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::IncreaseFontSize()
|
||||
{
|
||||
return RelativeFontChange(FontSize::incr);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::DecreaseFontSize()
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::DecreaseFontSize()
|
||||
{
|
||||
return RelativeFontChange(FontSize::decr);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::RelativeFontChange(FontSize aDir)
|
||||
HTMLEditor::RelativeFontChange(FontSize aDir)
|
||||
{
|
||||
ForceCompositionEnd();
|
||||
|
||||
|
@ -1438,10 +1447,10 @@ nsHTMLEditor::RelativeFontChange(FontSize aDir)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::RelativeFontChangeOnTextNode(FontSize aDir,
|
||||
Text& aTextNode,
|
||||
int32_t aStartOffset,
|
||||
int32_t aEndOffset)
|
||||
HTMLEditor::RelativeFontChangeOnTextNode(FontSize aDir,
|
||||
Text& aTextNode,
|
||||
int32_t aStartOffset,
|
||||
int32_t aEndOffset)
|
||||
{
|
||||
// Don't need to do anything if no characters actually selected
|
||||
if (aStartOffset == aEndOffset) {
|
||||
|
@ -1499,9 +1508,9 @@ nsHTMLEditor::RelativeFontChangeOnTextNode(FontSize aDir,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::RelativeFontChangeHelper(int32_t aSizeChange, nsINode* aNode)
|
||||
HTMLEditor::RelativeFontChangeHelper(int32_t aSizeChange,
|
||||
nsINode* aNode)
|
||||
{
|
||||
MOZ_ASSERT(aNode);
|
||||
|
||||
|
@ -1539,9 +1548,9 @@ nsHTMLEditor::RelativeFontChangeHelper(int32_t aSizeChange, nsINode* aNode)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::RelativeFontChangeOnNode(int32_t aSizeChange, nsIContent* aNode)
|
||||
HTMLEditor::RelativeFontChangeOnNode(int32_t aSizeChange,
|
||||
nsIContent* aNode)
|
||||
{
|
||||
MOZ_ASSERT(aNode);
|
||||
// Can only change font size by + or - 1
|
||||
|
@ -1607,7 +1616,8 @@ nsHTMLEditor::RelativeFontChangeOnNode(int32_t aSizeChange, nsIContent* aNode)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetFontFaceState(bool *aMixed, nsAString &outFace)
|
||||
HTMLEditor::GetFontFaceState(bool* aMixed,
|
||||
nsAString& outFace)
|
||||
{
|
||||
NS_ENSURE_TRUE(aMixed, NS_ERROR_FAILURE);
|
||||
*aMixed = true;
|
||||
|
@ -1648,7 +1658,8 @@ nsHTMLEditor::GetFontFaceState(bool *aMixed, nsAString &outFace)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetFontColorState(bool *aMixed, nsAString &aOutColor)
|
||||
HTMLEditor::GetFontColorState(bool* aMixed,
|
||||
nsAString& aOutColor)
|
||||
{
|
||||
NS_ENSURE_TRUE(aMixed, NS_ERROR_NULL_POINTER);
|
||||
*aMixed = true;
|
||||
|
@ -1681,14 +1692,15 @@ nsHTMLEditor::GetFontColorState(bool *aMixed, nsAString &aOutColor)
|
|||
// can handle CSS styles (for instance, Composer can, Messenger can't) and if
|
||||
// the CSS preference is checked
|
||||
nsresult
|
||||
nsHTMLEditor::GetIsCSSEnabled(bool *aIsCSSEnabled)
|
||||
HTMLEditor::GetIsCSSEnabled(bool* aIsCSSEnabled)
|
||||
{
|
||||
*aIsCSSEnabled = IsCSSEnabled();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static bool
|
||||
HasNonEmptyAttribute(dom::Element* aElement, nsIAtom* aName)
|
||||
HasNonEmptyAttribute(Element* aElement,
|
||||
nsIAtom* aName)
|
||||
{
|
||||
MOZ_ASSERT(aElement);
|
||||
|
||||
|
@ -1697,7 +1709,7 @@ HasNonEmptyAttribute(dom::Element* aElement, nsIAtom* aName)
|
|||
}
|
||||
|
||||
bool
|
||||
nsHTMLEditor::HasStyleOrIdOrClass(dom::Element* aElement)
|
||||
HTMLEditor::HasStyleOrIdOrClass(Element* aElement)
|
||||
{
|
||||
MOZ_ASSERT(aElement);
|
||||
|
||||
|
@ -1709,7 +1721,7 @@ nsHTMLEditor::HasStyleOrIdOrClass(dom::Element* aElement)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::RemoveElementIfNoStyleOrIdOrClass(dom::Element& aElement)
|
||||
HTMLEditor::RemoveElementIfNoStyleOrIdOrClass(Element& aElement)
|
||||
{
|
||||
// early way out if node is not the right kind of element
|
||||
if ((!aElement.IsHTMLElement(nsGkAtoms::span) &&
|
||||
|
@ -1720,3 +1732,5 @@ nsHTMLEditor::RemoveElementIfNoStyleOrIdOrClass(dom::Element& aElement)
|
|||
|
||||
return RemoveContainer(&aElement);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
|
||||
#include "EditorUtils.h"
|
||||
#include "HTMLEditUtils.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
|
@ -17,14 +19,12 @@
|
|||
#include "nsEditor.h"
|
||||
#include "nsError.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsISupportsUtils.h"
|
||||
|
@ -40,46 +40,60 @@
|
|||
#include "nscore.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
namespace mozilla {
|
||||
|
||||
/***************************************************************************
|
||||
* stack based helper class for restoring selection after table edit
|
||||
using namespace dom;
|
||||
|
||||
/**
|
||||
* Stack based helper class for restoring selection after table edit.
|
||||
*/
|
||||
class MOZ_STACK_CLASS nsSetSelectionAfterTableEdit
|
||||
class MOZ_STACK_CLASS AutoSelectionSetterAfterTableEdit final
|
||||
{
|
||||
private:
|
||||
nsCOMPtr<nsITableEditor> mEd;
|
||||
nsCOMPtr<nsIDOMElement> mTable;
|
||||
int32_t mCol, mRow, mDirection, mSelected;
|
||||
public:
|
||||
nsSetSelectionAfterTableEdit(nsITableEditor *aEd, nsIDOMElement* aTable,
|
||||
int32_t aRow, int32_t aCol, int32_t aDirection,
|
||||
bool aSelected) :
|
||||
mEd(do_QueryInterface(aEd))
|
||||
{
|
||||
mTable = aTable;
|
||||
mRow = aRow;
|
||||
mCol = aCol;
|
||||
mDirection = aDirection;
|
||||
mSelected = aSelected;
|
||||
}
|
||||
private:
|
||||
nsCOMPtr<nsITableEditor> mTableEditor;
|
||||
nsCOMPtr<nsIDOMElement> mTable;
|
||||
int32_t mCol, mRow, mDirection, mSelected;
|
||||
|
||||
~nsSetSelectionAfterTableEdit()
|
||||
{
|
||||
if (mEd)
|
||||
mEd->SetSelectionAfterTableEdit(mTable, mRow, mCol, mDirection, mSelected);
|
||||
public:
|
||||
AutoSelectionSetterAfterTableEdit(nsITableEditor* aTableEditor,
|
||||
nsIDOMElement* aTable,
|
||||
int32_t aRow,
|
||||
int32_t aCol,
|
||||
int32_t aDirection,
|
||||
bool aSelected)
|
||||
: mTableEditor(aTableEditor)
|
||||
, mTable(aTable)
|
||||
, mCol(aCol)
|
||||
, mRow(aRow)
|
||||
, mDirection(aDirection)
|
||||
, mSelected(aSelected)
|
||||
{
|
||||
}
|
||||
|
||||
~AutoSelectionSetterAfterTableEdit()
|
||||
{
|
||||
if (mTableEditor) {
|
||||
mTableEditor->SetSelectionAfterTableEdit(mTable, mRow, mCol, mDirection,
|
||||
mSelected);
|
||||
}
|
||||
// This is needed to abort the caret reset in the destructor
|
||||
// when one method yields control to another
|
||||
void CancelSetCaret() {mEd = nullptr; mTable = nullptr;}
|
||||
}
|
||||
|
||||
// This is needed to abort the caret reset in the destructor
|
||||
// when one method yields control to another
|
||||
void CancelSetCaret()
|
||||
{
|
||||
mTableEditor = nullptr;
|
||||
mTable = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
// Table Editing helper utilities (not exposed in IDL)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::InsertCell(nsIDOMElement *aCell, int32_t aRowSpan, int32_t aColSpan,
|
||||
bool aAfter, bool aIsHeader, nsIDOMElement **aNewCell)
|
||||
HTMLEditor::InsertCell(nsIDOMElement* aCell,
|
||||
int32_t aRowSpan,
|
||||
int32_t aColSpan,
|
||||
bool aAfter,
|
||||
bool aIsHeader,
|
||||
nsIDOMElement** aNewCell)
|
||||
{
|
||||
NS_ENSURE_TRUE(aCell, NS_ERROR_NULL_POINTER);
|
||||
if (aNewCell) *aNewCell = nullptr;
|
||||
|
@ -129,7 +143,9 @@ nsHTMLEditor::InsertCell(nsIDOMElement *aCell, int32_t aRowSpan, int32_t aColSpa
|
|||
return InsertNode(newCell, cellParent, cellOffset);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::SetColSpan(nsIDOMElement *aCell, int32_t aColSpan)
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::SetColSpan(nsIDOMElement* aCell,
|
||||
int32_t aColSpan)
|
||||
{
|
||||
NS_ENSURE_TRUE(aCell, NS_ERROR_NULL_POINTER);
|
||||
nsAutoString newSpan;
|
||||
|
@ -137,7 +153,9 @@ NS_IMETHODIMP nsHTMLEditor::SetColSpan(nsIDOMElement *aCell, int32_t aColSpan)
|
|||
return SetAttribute(aCell, NS_LITERAL_STRING("colspan"), newSpan);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::SetRowSpan(nsIDOMElement *aCell, int32_t aRowSpan)
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::SetRowSpan(nsIDOMElement* aCell,
|
||||
int32_t aRowSpan)
|
||||
{
|
||||
NS_ENSURE_TRUE(aCell, NS_ERROR_NULL_POINTER);
|
||||
nsAutoString newSpan;
|
||||
|
@ -145,12 +163,9 @@ NS_IMETHODIMP nsHTMLEditor::SetRowSpan(nsIDOMElement *aCell, int32_t aRowSpan)
|
|||
return SetAttribute(aCell, NS_LITERAL_STRING("rowspan"), newSpan);
|
||||
}
|
||||
|
||||
/****************************************************************/
|
||||
|
||||
// Table Editing interface methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::InsertTableCell(int32_t aNumber, bool aAfter)
|
||||
HTMLEditor::InsertTableCell(int32_t aNumber,
|
||||
bool aAfter)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> curCell;
|
||||
|
@ -176,7 +191,9 @@ nsHTMLEditor::InsertTableCell(int32_t aNumber, bool aAfter)
|
|||
NS_ENSURE_TRUE(curCell, NS_ERROR_FAILURE);
|
||||
int32_t newCellIndex = aAfter ? (startColIndex+colSpan) : startColIndex;
|
||||
//We control selection resetting after the insert...
|
||||
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, newCellIndex, ePreviousColumn, false);
|
||||
AutoSelectionSetterAfterTableEdit setCaret(this, table, startRowIndex,
|
||||
newCellIndex, ePreviousColumn,
|
||||
false);
|
||||
//...so suppress Rules System selection munging
|
||||
AutoTransactionsConserveSelection dontChangeSelection(this);
|
||||
|
||||
|
@ -195,9 +212,9 @@ nsHTMLEditor::InsertTableCell(int32_t aNumber, bool aAfter)
|
|||
return res;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode)
|
||||
HTMLEditor::GetFirstRow(nsIDOMElement* aTableElement,
|
||||
nsIDOMNode** aRowNode)
|
||||
{
|
||||
NS_ENSURE_TRUE(aRowNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
@ -264,7 +281,8 @@ nsHTMLEditor::GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetNextRow(nsIDOMNode* aCurrentRowNode, nsIDOMNode **aRowNode)
|
||||
HTMLEditor::GetNextRow(nsIDOMNode* aCurrentRowNode,
|
||||
nsIDOMNode** aRowNode)
|
||||
{
|
||||
NS_ENSURE_TRUE(aRowNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
@ -338,7 +356,8 @@ nsHTMLEditor::GetNextRow(nsIDOMNode* aCurrentRowNode, nsIDOMNode **aRowNode)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::GetLastCellInRow(nsIDOMNode* aRowNode, nsIDOMNode** aCellNode)
|
||||
HTMLEditor::GetLastCellInRow(nsIDOMNode* aRowNode,
|
||||
nsIDOMNode** aCellNode)
|
||||
{
|
||||
NS_ENSURE_TRUE(aCellNode, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
@ -369,7 +388,8 @@ nsHTMLEditor::GetLastCellInRow(nsIDOMNode* aRowNode, nsIDOMNode** aCellNode)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::InsertTableColumn(int32_t aNumber, bool aAfter)
|
||||
HTMLEditor::InsertTableColumn(int32_t aNumber,
|
||||
bool aAfter)
|
||||
{
|
||||
RefPtr<Selection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
|
@ -416,7 +436,9 @@ nsHTMLEditor::InsertTableColumn(int32_t aNumber, bool aAfter)
|
|||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
//We reset caret in destructor...
|
||||
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousRow, false);
|
||||
AutoSelectionSetterAfterTableEdit setCaret(this, table, startRowIndex,
|
||||
startColIndex, ePreviousRow,
|
||||
false);
|
||||
//.. so suppress Rules System selection munging
|
||||
AutoTransactionsConserveSelection dontChangeSelection(this);
|
||||
|
||||
|
@ -496,7 +518,8 @@ nsHTMLEditor::InsertTableColumn(int32_t aNumber, bool aAfter)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::InsertTableRow(int32_t aNumber, bool aAfter)
|
||||
HTMLEditor::InsertTableRow(int32_t aNumber,
|
||||
bool aAfter)
|
||||
{
|
||||
RefPtr<Selection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
|
@ -545,7 +568,9 @@ nsHTMLEditor::InsertTableRow(int32_t aNumber, bool aAfter)
|
|||
}
|
||||
|
||||
//We control selection resetting after the insert...
|
||||
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousColumn, false);
|
||||
AutoSelectionSetterAfterTableEdit setCaret(this, table, startRowIndex,
|
||||
startColIndex, ePreviousColumn,
|
||||
false);
|
||||
//...so suppress Rules System selection munging
|
||||
AutoTransactionsConserveSelection dontChangeSelection(this);
|
||||
|
||||
|
@ -681,7 +706,8 @@ nsHTMLEditor::InsertTableRow(int32_t aNumber, bool aAfter)
|
|||
// XXX Code changed for bug 217717 and now we don't need aSelection param
|
||||
// TODO: Remove aSelection param
|
||||
nsresult
|
||||
nsHTMLEditor::DeleteTable2(nsIDOMElement* aTable, Selection* aSelection)
|
||||
HTMLEditor::DeleteTable2(nsIDOMElement* aTable,
|
||||
Selection* aSelection)
|
||||
{
|
||||
NS_ENSURE_TRUE(aTable, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
@ -695,7 +721,7 @@ nsHTMLEditor::DeleteTable2(nsIDOMElement* aTable, Selection* aSelection)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::DeleteTable()
|
||||
HTMLEditor::DeleteTable()
|
||||
{
|
||||
RefPtr<Selection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
|
@ -710,7 +736,7 @@ nsHTMLEditor::DeleteTable()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::DeleteTableCell(int32_t aNumber)
|
||||
HTMLEditor::DeleteTableCell(int32_t aNumber)
|
||||
{
|
||||
RefPtr<Selection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
|
@ -755,8 +781,11 @@ nsHTMLEditor::DeleteTableCell(int32_t aNumber)
|
|||
res = GetCellIndexes(cell, &startRowIndex, &startColIndex);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
// The setCaret object will call SetSelectionAfterTableEdit in its destructor
|
||||
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousColumn, false);
|
||||
// The setCaret object will call AutoSelectionSetterAfterTableEdit in its
|
||||
// destructor
|
||||
AutoSelectionSetterAfterTableEdit setCaret(this, table, startRowIndex,
|
||||
startColIndex, ePreviousColumn,
|
||||
false);
|
||||
AutoTransactionsConserveSelection dontChangeSelection(this);
|
||||
|
||||
bool checkToDeleteRow = true;
|
||||
|
@ -891,8 +920,11 @@ nsHTMLEditor::DeleteTableCell(int32_t aNumber)
|
|||
{
|
||||
// More than 1 cell in the row
|
||||
|
||||
// The setCaret object will call SetSelectionAfterTableEdit in its destructor
|
||||
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousColumn, false);
|
||||
// The setCaret object will call AutoSelectionSetterAfterTableEdit in its
|
||||
// destructor
|
||||
AutoSelectionSetterAfterTableEdit setCaret(this, table, startRowIndex,
|
||||
startColIndex, ePreviousColumn,
|
||||
false);
|
||||
AutoTransactionsConserveSelection dontChangeSelection(this);
|
||||
|
||||
res = DeleteNode(cell);
|
||||
|
@ -904,7 +936,7 @@ nsHTMLEditor::DeleteTableCell(int32_t aNumber)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::DeleteTableCellContents()
|
||||
HTMLEditor::DeleteTableCellContents()
|
||||
{
|
||||
RefPtr<Selection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
|
@ -941,7 +973,9 @@ nsHTMLEditor::DeleteTableCellContents()
|
|||
NS_ENSURE_SUCCESS(res, res);
|
||||
}
|
||||
|
||||
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousColumn, false);
|
||||
AutoSelectionSetterAfterTableEdit setCaret(this, table, startRowIndex,
|
||||
startColIndex, ePreviousColumn,
|
||||
false);
|
||||
|
||||
while (cell)
|
||||
{
|
||||
|
@ -959,7 +993,7 @@ nsHTMLEditor::DeleteTableCellContents()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::DeleteCellContents(nsIDOMElement *aCell)
|
||||
HTMLEditor::DeleteCellContents(nsIDOMElement* aCell)
|
||||
{
|
||||
NS_ENSURE_TRUE(aCell, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
@ -981,7 +1015,7 @@ nsHTMLEditor::DeleteCellContents(nsIDOMElement *aCell)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::DeleteTableColumn(int32_t aNumber)
|
||||
HTMLEditor::DeleteTableColumn(int32_t aNumber)
|
||||
{
|
||||
RefPtr<Selection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
|
@ -1027,7 +1061,9 @@ nsHTMLEditor::DeleteTableColumn(int32_t aNumber)
|
|||
NS_ENSURE_SUCCESS(res, res);
|
||||
}
|
||||
//We control selection resetting after the insert...
|
||||
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousRow, false);
|
||||
AutoSelectionSetterAfterTableEdit setCaret(this, table, startRowIndex,
|
||||
startColIndex, ePreviousRow,
|
||||
false);
|
||||
|
||||
if (firstCell && rangeCount > 1)
|
||||
{
|
||||
|
@ -1065,7 +1101,8 @@ nsHTMLEditor::DeleteTableColumn(int32_t aNumber)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::DeleteColumn(nsIDOMElement *aTable, int32_t aColIndex)
|
||||
HTMLEditor::DeleteColumn(nsIDOMElement* aTable,
|
||||
int32_t aColIndex)
|
||||
{
|
||||
NS_ENSURE_TRUE(aTable, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
@ -1157,7 +1194,7 @@ nsHTMLEditor::DeleteColumn(nsIDOMElement *aTable, int32_t aColIndex)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::DeleteTableRow(int32_t aNumber)
|
||||
HTMLEditor::DeleteTableRow(int32_t aNumber)
|
||||
{
|
||||
RefPtr<Selection> selection;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
|
@ -1201,7 +1238,9 @@ nsHTMLEditor::DeleteTableRow(int32_t aNumber)
|
|||
}
|
||||
|
||||
//We control selection resetting after the insert...
|
||||
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousRow, false);
|
||||
AutoSelectionSetterAfterTableEdit setCaret(this, table, startRowIndex,
|
||||
startColIndex, ePreviousRow,
|
||||
false);
|
||||
// Don't change selection during deletions
|
||||
AutoTransactionsConserveSelection dontChangeSelection(this);
|
||||
|
||||
|
@ -1257,7 +1296,8 @@ nsHTMLEditor::DeleteTableRow(int32_t aNumber)
|
|||
|
||||
// Helper that doesn't batch or change the selection
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::DeleteRow(nsIDOMElement *aTable, int32_t aRowIndex)
|
||||
HTMLEditor::DeleteRow(nsIDOMElement* aTable,
|
||||
int32_t aRowIndex)
|
||||
{
|
||||
NS_ENSURE_TRUE(aTable, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
@ -1361,7 +1401,7 @@ nsHTMLEditor::DeleteRow(nsIDOMElement *aTable, int32_t aRowIndex)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SelectTable()
|
||||
HTMLEditor::SelectTable()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsresult res = NS_ERROR_FAILURE;
|
||||
|
@ -1378,7 +1418,7 @@ nsHTMLEditor::SelectTable()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SelectTableCell()
|
||||
HTMLEditor::SelectTableCell()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("td"), nullptr, getter_AddRefs(cell));
|
||||
|
@ -1393,7 +1433,8 @@ nsHTMLEditor::SelectTableCell()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndCell)
|
||||
HTMLEditor::SelectBlockOfCells(nsIDOMElement* aStartCell,
|
||||
nsIDOMElement* aEndCell)
|
||||
{
|
||||
NS_ENSURE_TRUE(aStartCell && aEndCell, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
@ -1482,7 +1523,7 @@ nsHTMLEditor::SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndC
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SelectAllTableCells()
|
||||
HTMLEditor::SelectAllTableCells()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("td"), nullptr, getter_AddRefs(cell));
|
||||
|
@ -1545,7 +1586,7 @@ nsHTMLEditor::SelectAllTableCells()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SelectTableRow()
|
||||
HTMLEditor::SelectTableRow()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("td"), nullptr, getter_AddRefs(cell));
|
||||
|
@ -1611,7 +1652,7 @@ nsHTMLEditor::SelectTableRow()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SelectTableColumn()
|
||||
HTMLEditor::SelectTableColumn()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("td"), nullptr, getter_AddRefs(cell));
|
||||
|
@ -1674,7 +1715,7 @@ nsHTMLEditor::SelectTableColumn()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SplitTableCell()
|
||||
HTMLEditor::SplitTableCell()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
|
@ -1701,7 +1742,9 @@ nsHTMLEditor::SplitTableCell()
|
|||
AutoRules beginRulesSniffing(this, EditAction::insertNode, nsIEditor::eNext);
|
||||
|
||||
// We reset selection
|
||||
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousColumn, false);
|
||||
AutoSelectionSetterAfterTableEdit setCaret(this, table, startRowIndex,
|
||||
startColIndex, ePreviousColumn,
|
||||
false);
|
||||
//...so suppress Rules System selection munging
|
||||
AutoTransactionsConserveSelection dontChangeSelection(this);
|
||||
|
||||
|
@ -1736,7 +1779,8 @@ nsHTMLEditor::SplitTableCell()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::CopyCellBackgroundColor(nsIDOMElement *destCell, nsIDOMElement *sourceCell)
|
||||
HTMLEditor::CopyCellBackgroundColor(nsIDOMElement* destCell,
|
||||
nsIDOMElement* sourceCell)
|
||||
{
|
||||
NS_ENSURE_TRUE(destCell && sourceCell, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
@ -1753,9 +1797,12 @@ nsHTMLEditor::CopyCellBackgroundColor(nsIDOMElement *destCell, nsIDOMElement *so
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SplitCellIntoColumns(nsIDOMElement *aTable, int32_t aRowIndex, int32_t aColIndex,
|
||||
int32_t aColSpanLeft, int32_t aColSpanRight,
|
||||
nsIDOMElement **aNewCell)
|
||||
HTMLEditor::SplitCellIntoColumns(nsIDOMElement* aTable,
|
||||
int32_t aRowIndex,
|
||||
int32_t aColIndex,
|
||||
int32_t aColSpanLeft,
|
||||
int32_t aColSpanRight,
|
||||
nsIDOMElement** aNewCell)
|
||||
{
|
||||
NS_ENSURE_TRUE(aTable, NS_ERROR_NULL_POINTER);
|
||||
if (aNewCell) *aNewCell = nullptr;
|
||||
|
@ -1796,9 +1843,12 @@ nsHTMLEditor::SplitCellIntoColumns(nsIDOMElement *aTable, int32_t aRowIndex, int
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SplitCellIntoRows(nsIDOMElement *aTable, int32_t aRowIndex, int32_t aColIndex,
|
||||
int32_t aRowSpanAbove, int32_t aRowSpanBelow,
|
||||
nsIDOMElement **aNewCell)
|
||||
HTMLEditor::SplitCellIntoRows(nsIDOMElement* aTable,
|
||||
int32_t aRowIndex,
|
||||
int32_t aColIndex,
|
||||
int32_t aRowSpanAbove,
|
||||
int32_t aRowSpanBelow,
|
||||
nsIDOMElement** aNewCell)
|
||||
{
|
||||
NS_ENSURE_TRUE(aTable, NS_ERROR_NULL_POINTER);
|
||||
if (aNewCell) *aNewCell = nullptr;
|
||||
|
@ -1910,7 +1960,8 @@ nsHTMLEditor::SplitCellIntoRows(nsIDOMElement *aTable, int32_t aRowIndex, int32_
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElement **aNewCell)
|
||||
HTMLEditor::SwitchTableCellHeaderType(nsIDOMElement* aSourceCell,
|
||||
nsIDOMElement** aNewCell)
|
||||
{
|
||||
nsCOMPtr<Element> sourceCell = do_QueryInterface(aSourceCell);
|
||||
NS_ENSURE_TRUE(sourceCell, NS_ERROR_NULL_POINTER);
|
||||
|
@ -1948,7 +1999,7 @@ nsHTMLEditor::SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElemen
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::JoinTableCells(bool aMergeNonContiguousContents)
|
||||
HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsCOMPtr<nsIDOMElement> targetCell;
|
||||
|
@ -1971,7 +2022,7 @@ nsHTMLEditor::JoinTableCells(bool aMergeNonContiguousContents)
|
|||
//Don't let Rules System change the selection
|
||||
AutoTransactionsConserveSelection dontChangeSelection(this);
|
||||
|
||||
// Note: We dont' use nsSetSelectionAfterTableEdit here so the selection
|
||||
// Note: We dont' use AutoSelectionSetterAfterTableEdit here so the selection
|
||||
// is retained after joining. This leaves the target cell selected
|
||||
// as well as the "non-contiguous" cells, so user can see what happened.
|
||||
|
||||
|
@ -2288,9 +2339,9 @@ nsHTMLEditor::JoinTableCells(bool aMergeNonContiguousContents)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell,
|
||||
nsCOMPtr<nsIDOMElement> aCellToMerge,
|
||||
bool aDeleteCellToMerge)
|
||||
HTMLEditor::MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell,
|
||||
nsCOMPtr<nsIDOMElement> aCellToMerge,
|
||||
bool aDeleteCellToMerge)
|
||||
{
|
||||
nsCOMPtr<dom::Element> targetCell = do_QueryInterface(aTargetCell);
|
||||
nsCOMPtr<dom::Element> cellToMerge = do_QueryInterface(aCellToMerge);
|
||||
|
@ -2338,7 +2389,9 @@ nsHTMLEditor::MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell,
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::FixBadRowSpan(nsIDOMElement *aTable, int32_t aRowIndex, int32_t& aNewRowCount)
|
||||
HTMLEditor::FixBadRowSpan(nsIDOMElement* aTable,
|
||||
int32_t aRowIndex,
|
||||
int32_t& aNewRowCount)
|
||||
{
|
||||
NS_ENSURE_TRUE(aTable, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
@ -2396,7 +2449,9 @@ nsHTMLEditor::FixBadRowSpan(nsIDOMElement *aTable, int32_t aRowIndex, int32_t& a
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::FixBadColSpan(nsIDOMElement *aTable, int32_t aColIndex, int32_t& aNewColCount)
|
||||
HTMLEditor::FixBadColSpan(nsIDOMElement* aTable,
|
||||
int32_t aColIndex,
|
||||
int32_t& aNewColCount)
|
||||
{
|
||||
NS_ENSURE_TRUE(aTable, NS_ERROR_NULL_POINTER);
|
||||
|
||||
|
@ -2454,7 +2509,7 @@ nsHTMLEditor::FixBadColSpan(nsIDOMElement *aTable, int32_t aColIndex, int32_t& a
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable)
|
||||
HTMLEditor::NormalizeTable(nsIDOMElement* aTable)
|
||||
{
|
||||
RefPtr<Selection> selection = GetSelection();
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
|
||||
|
@ -2542,8 +2597,9 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetCellIndexes(nsIDOMElement *aCell,
|
||||
int32_t *aRowIndex, int32_t *aColIndex)
|
||||
HTMLEditor::GetCellIndexes(nsIDOMElement* aCell,
|
||||
int32_t* aRowIndex,
|
||||
int32_t* aColIndex)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRowIndex);
|
||||
*aColIndex=0; // initialize out params
|
||||
|
@ -2577,7 +2633,7 @@ nsHTMLEditor::GetCellIndexes(nsIDOMElement *aCell,
|
|||
}
|
||||
|
||||
nsTableWrapperFrame*
|
||||
nsHTMLEditor::GetTableFrame(nsIDOMElement* aTable)
|
||||
HTMLEditor::GetTableFrame(nsIDOMElement* aTable)
|
||||
{
|
||||
NS_ENSURE_TRUE(aTable, nullptr);
|
||||
|
||||
|
@ -2587,7 +2643,9 @@ nsHTMLEditor::GetTableFrame(nsIDOMElement* aTable)
|
|||
}
|
||||
|
||||
//Return actual number of cells (a cell with colspan > 1 counts as just 1)
|
||||
int32_t nsHTMLEditor::GetNumberOfCellsInRow(nsIDOMElement* aTable, int32_t rowIndex)
|
||||
int32_t
|
||||
HTMLEditor::GetNumberOfCellsInRow(nsIDOMElement* aTable,
|
||||
int32_t rowIndex)
|
||||
{
|
||||
int32_t cellCount = 0;
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
|
@ -2617,12 +2675,10 @@ int32_t nsHTMLEditor::GetNumberOfCellsInRow(nsIDOMElement* aTable, int32_t rowIn
|
|||
return cellCount;
|
||||
}
|
||||
|
||||
/* Not scriptable: For convenience in C++
|
||||
Use GetTableRowCount and GetTableColumnCount from JavaScript
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetTableSize(nsIDOMElement *aTable,
|
||||
int32_t* aRowCount, int32_t* aColCount)
|
||||
HTMLEditor::GetTableSize(nsIDOMElement* aTable,
|
||||
int32_t* aRowCount,
|
||||
int32_t* aColCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRowCount);
|
||||
NS_ENSURE_ARG_POINTER(aColCount);
|
||||
|
@ -2645,12 +2701,17 @@ nsHTMLEditor::GetTableSize(nsIDOMElement *aTable,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetCellDataAt(nsIDOMElement* aTable, int32_t aRowIndex,
|
||||
int32_t aColIndex, nsIDOMElement **aCell,
|
||||
int32_t* aStartRowIndex, int32_t* aStartColIndex,
|
||||
int32_t* aRowSpan, int32_t* aColSpan,
|
||||
int32_t* aActualRowSpan, int32_t* aActualColSpan,
|
||||
bool* aIsSelected)
|
||||
HTMLEditor::GetCellDataAt(nsIDOMElement* aTable,
|
||||
int32_t aRowIndex,
|
||||
int32_t aColIndex,
|
||||
nsIDOMElement** aCell,
|
||||
int32_t* aStartRowIndex,
|
||||
int32_t* aStartColIndex,
|
||||
int32_t* aRowSpan,
|
||||
int32_t* aColSpan,
|
||||
int32_t* aActualRowSpan,
|
||||
int32_t* aActualColSpan,
|
||||
bool* aIsSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aStartRowIndex);
|
||||
NS_ENSURE_ARG_POINTER(aStartColIndex);
|
||||
|
@ -2707,7 +2768,10 @@ nsHTMLEditor::GetCellDataAt(nsIDOMElement* aTable, int32_t aRowIndex,
|
|||
|
||||
// When all you want is the cell
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetCellAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex, nsIDOMElement **aCell)
|
||||
HTMLEditor::GetCellAt(nsIDOMElement* aTable,
|
||||
int32_t aRowIndex,
|
||||
int32_t aColIndex,
|
||||
nsIDOMElement** aCell)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCell);
|
||||
*aCell = nullptr;
|
||||
|
@ -2737,8 +2801,11 @@ nsHTMLEditor::GetCellAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIn
|
|||
|
||||
// When all you want are the rowspan and colspan (not exposed in nsITableEditor)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetCellSpansAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex,
|
||||
int32_t& aActualRowSpan, int32_t& aActualColSpan)
|
||||
HTMLEditor::GetCellSpansAt(nsIDOMElement* aTable,
|
||||
int32_t aRowIndex,
|
||||
int32_t aColIndex,
|
||||
int32_t& aActualRowSpan,
|
||||
int32_t& aActualColSpan)
|
||||
{
|
||||
nsTableWrapperFrame* tableFrame = GetTableFrame(aTable);
|
||||
if (!tableFrame)
|
||||
|
@ -2751,11 +2818,13 @@ nsHTMLEditor::GetCellSpansAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t a
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::GetCellContext(Selection** aSelection,
|
||||
nsIDOMElement **aTable,
|
||||
nsIDOMElement **aCell,
|
||||
nsIDOMNode **aCellParent, int32_t *aCellOffset,
|
||||
int32_t *aRowIndex, int32_t *aColIndex)
|
||||
HTMLEditor::GetCellContext(Selection** aSelection,
|
||||
nsIDOMElement** aTable,
|
||||
nsIDOMElement** aCell,
|
||||
nsIDOMNode** aCellParent,
|
||||
int32_t* aCellOffset,
|
||||
int32_t* aRowIndex,
|
||||
int32_t* aColIndex)
|
||||
{
|
||||
// Initialize return pointers
|
||||
if (aSelection) *aSelection = nullptr;
|
||||
|
@ -2858,7 +2927,8 @@ nsHTMLEditor::GetCellContext(Selection** aSelection,
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLEditor::GetCellFromRange(nsRange* aRange, nsIDOMElement** aCell)
|
||||
HTMLEditor::GetCellFromRange(nsRange* aRange,
|
||||
nsIDOMElement** aCell)
|
||||
{
|
||||
// Note: this might return a node that is outside of the range.
|
||||
// Use carefully.
|
||||
|
@ -2907,7 +2977,8 @@ nsHTMLEditor::GetCellFromRange(nsRange* aRange, nsIDOMElement** aCell)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetFirstSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell)
|
||||
HTMLEditor::GetFirstSelectedCell(nsIDOMRange** aRange,
|
||||
nsIDOMElement** aCell)
|
||||
{
|
||||
NS_ENSURE_TRUE(aCell, NS_ERROR_NULL_POINTER);
|
||||
*aCell = nullptr;
|
||||
|
@ -2945,7 +3016,8 @@ nsHTMLEditor::GetFirstSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetNextSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell)
|
||||
HTMLEditor::GetNextSelectedCell(nsIDOMRange** aRange,
|
||||
nsIDOMElement** aCell)
|
||||
{
|
||||
NS_ENSURE_TRUE(aCell, NS_ERROR_NULL_POINTER);
|
||||
*aCell = nullptr;
|
||||
|
@ -2993,7 +3065,9 @@ nsHTMLEditor::GetNextSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetFirstSelectedCellInTable(int32_t *aRowIndex, int32_t *aColIndex, nsIDOMElement **aCell)
|
||||
HTMLEditor::GetFirstSelectedCellInTable(int32_t* aRowIndex,
|
||||
int32_t* aColIndex,
|
||||
nsIDOMElement** aCell)
|
||||
{
|
||||
NS_ENSURE_TRUE(aCell, NS_ERROR_NULL_POINTER);
|
||||
*aCell = nullptr;
|
||||
|
@ -3028,8 +3102,11 @@ nsHTMLEditor::GetFirstSelectedCellInTable(int32_t *aRowIndex, int32_t *aColIndex
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::SetSelectionAfterTableEdit(nsIDOMElement* aTable, int32_t aRow, int32_t aCol,
|
||||
int32_t aDirection, bool aSelected)
|
||||
HTMLEditor::SetSelectionAfterTableEdit(nsIDOMElement* aTable,
|
||||
int32_t aRow,
|
||||
int32_t aCol,
|
||||
int32_t aDirection,
|
||||
bool aSelected)
|
||||
{
|
||||
NS_ENSURE_TRUE(aTable, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
|
@ -3118,9 +3195,9 @@ nsHTMLEditor::SetSelectionAfterTableEdit(nsIDOMElement* aTable, int32_t aRow, in
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetSelectedOrParentTableElement(nsAString& aTagName,
|
||||
int32_t *aSelectedCount,
|
||||
nsIDOMElement** aTableElement)
|
||||
HTMLEditor::GetSelectedOrParentTableElement(nsAString& aTagName,
|
||||
int32_t* aSelectedCount,
|
||||
nsIDOMElement** aTableElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aTableElement);
|
||||
NS_ENSURE_ARG_POINTER(aSelectedCount);
|
||||
|
@ -3212,7 +3289,8 @@ nsHTMLEditor::GetSelectedOrParentTableElement(nsAString& aTagName,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetSelectedCellsType(nsIDOMElement *aElement, uint32_t *aSelectionType)
|
||||
HTMLEditor::GetSelectedCellsType(nsIDOMElement* aElement,
|
||||
uint32_t* aSelectionType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSelectionType);
|
||||
*aSelectionType = 0;
|
||||
|
@ -3294,7 +3372,9 @@ nsHTMLEditor::GetSelectedCellsType(nsIDOMElement *aElement, uint32_t *aSelection
|
|||
}
|
||||
|
||||
bool
|
||||
nsHTMLEditor::AllCellsInRowSelected(nsIDOMElement *aTable, int32_t aRowIndex, int32_t aNumberOfColumns)
|
||||
HTMLEditor::AllCellsInRowSelected(nsIDOMElement* aTable,
|
||||
int32_t aRowIndex,
|
||||
int32_t aNumberOfColumns)
|
||||
{
|
||||
NS_ENSURE_TRUE(aTable, false);
|
||||
|
||||
|
@ -3323,7 +3403,9 @@ nsHTMLEditor::AllCellsInRowSelected(nsIDOMElement *aTable, int32_t aRowIndex, in
|
|||
}
|
||||
|
||||
bool
|
||||
nsHTMLEditor::AllCellsInColumnSelected(nsIDOMElement *aTable, int32_t aColIndex, int32_t aNumberOfRows)
|
||||
HTMLEditor::AllCellsInColumnSelected(nsIDOMElement* aTable,
|
||||
int32_t aColIndex,
|
||||
int32_t aNumberOfRows)
|
||||
{
|
||||
NS_ENSURE_TRUE(aTable, false);
|
||||
|
||||
|
@ -3350,7 +3432,7 @@ nsHTMLEditor::AllCellsInColumnSelected(nsIDOMElement *aTable, int32_t aColIndex,
|
|||
}
|
||||
|
||||
bool
|
||||
nsHTMLEditor::IsEmptyCell(dom::Element* aCell)
|
||||
HTMLEditor::IsEmptyCell(dom::Element* aCell)
|
||||
{
|
||||
MOZ_ASSERT(aCell);
|
||||
|
||||
|
@ -3377,3 +3459,5 @@ nsHTMLEditor::IsEmptyCell(dom::Element* aCell)
|
|||
NS_ENSURE_SUCCESS(rv, false);
|
||||
return isEmpty;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
|
@ -8,10 +8,11 @@
|
|||
#include "EditorUtils.h"
|
||||
#include "TextEditUtils.h"
|
||||
|
||||
#include "mozilla/OwningNonNull.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Casting.h"
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
#include "mozilla/mozalloc.h"
|
||||
#include "mozilla/OwningNonNull.h"
|
||||
#include "mozilla/SelectionState.h"
|
||||
|
||||
#include "nsAString.h"
|
||||
|
@ -19,7 +20,6 @@
|
|||
#include "nsContentUtils.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsError.h"
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMNode.h"
|
||||
|
@ -34,7 +34,7 @@ using namespace dom;
|
|||
|
||||
const char16_t nbsp = 160;
|
||||
|
||||
WSRunObject::WSRunObject(nsHTMLEditor* aHTMLEditor,
|
||||
WSRunObject::WSRunObject(HTMLEditor* aHTMLEditor,
|
||||
nsINode* aNode,
|
||||
int32_t aOffset)
|
||||
: mNode(aNode)
|
||||
|
@ -52,7 +52,7 @@ WSRunObject::WSRunObject(nsHTMLEditor* aHTMLEditor,
|
|||
GetRuns();
|
||||
}
|
||||
|
||||
WSRunObject::WSRunObject(nsHTMLEditor* aHTMLEditor,
|
||||
WSRunObject::WSRunObject(HTMLEditor* aHTMLEditor,
|
||||
nsIDOMNode* aNode,
|
||||
int32_t aOffset)
|
||||
: mNode(do_QueryInterface(aNode))
|
||||
|
@ -76,7 +76,7 @@ WSRunObject::~WSRunObject()
|
|||
}
|
||||
|
||||
nsresult
|
||||
WSRunObject::ScrubBlockBoundary(nsHTMLEditor* aHTMLEditor,
|
||||
WSRunObject::ScrubBlockBoundary(HTMLEditor* aHTMLEditor,
|
||||
BlockBoundary aBoundary,
|
||||
nsINode* aBlock,
|
||||
int32_t aOffset)
|
||||
|
@ -100,7 +100,7 @@ WSRunObject::ScrubBlockBoundary(nsHTMLEditor* aHTMLEditor,
|
|||
}
|
||||
|
||||
nsresult
|
||||
WSRunObject::PrepareToJoinBlocks(nsHTMLEditor* aHTMLEditor,
|
||||
WSRunObject::PrepareToJoinBlocks(HTMLEditor* aHTMLEditor,
|
||||
Element* aLeftBlock,
|
||||
Element* aRightBlock)
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ WSRunObject::PrepareToJoinBlocks(nsHTMLEditor* aHTMLEditor,
|
|||
}
|
||||
|
||||
nsresult
|
||||
WSRunObject::PrepareToDeleteRange(nsHTMLEditor* aHTMLEditor,
|
||||
WSRunObject::PrepareToDeleteRange(HTMLEditor* aHTMLEditor,
|
||||
nsCOMPtr<nsINode>* aStartNode,
|
||||
int32_t* aStartOffset,
|
||||
nsCOMPtr<nsINode>* aEndNode,
|
||||
|
@ -135,7 +135,7 @@ WSRunObject::PrepareToDeleteRange(nsHTMLEditor* aHTMLEditor,
|
|||
}
|
||||
|
||||
nsresult
|
||||
WSRunObject::PrepareToDeleteNode(nsHTMLEditor* aHTMLEditor,
|
||||
WSRunObject::PrepareToDeleteNode(HTMLEditor* aHTMLEditor,
|
||||
nsIContent* aContent)
|
||||
{
|
||||
NS_ENSURE_TRUE(aContent && aHTMLEditor, NS_ERROR_NULL_POINTER);
|
||||
|
@ -151,7 +151,7 @@ WSRunObject::PrepareToDeleteNode(nsHTMLEditor* aHTMLEditor,
|
|||
}
|
||||
|
||||
nsresult
|
||||
WSRunObject::PrepareToSplitAcrossBlocks(nsHTMLEditor* aHTMLEditor,
|
||||
WSRunObject::PrepareToSplitAcrossBlocks(HTMLEditor* aHTMLEditor,
|
||||
nsCOMPtr<nsINode>* aSplitNode,
|
||||
int32_t* aSplitOffset)
|
||||
{
|
||||
|
@ -1928,7 +1928,7 @@ bool
|
|||
WSRunObject::IsBlockNode(nsINode* aNode)
|
||||
{
|
||||
return aNode && aNode->IsElement() &&
|
||||
nsHTMLEditor::NodeIsBlockStatic(aNode->AsElement());
|
||||
HTMLEditor::NodeIsBlockStatic(aNode->AsElement());
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/Text.h"
|
||||
|
||||
class nsHTMLEditor;
|
||||
class nsIDOMNode;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class HTMLEditor;
|
||||
class HTMLEditRules;
|
||||
struct EditorDOMPoint;
|
||||
|
||||
|
@ -165,13 +165,13 @@ public:
|
|||
enum {eAfter = 1 << 1};
|
||||
enum {eBoth = eBefore | eAfter};
|
||||
|
||||
WSRunObject(nsHTMLEditor* aHTMLEditor, nsINode* aNode, int32_t aOffset);
|
||||
WSRunObject(nsHTMLEditor* aHTMLEditor, nsIDOMNode* aNode, int32_t aOffset);
|
||||
WSRunObject(HTMLEditor* aHTMLEditor, nsINode* aNode, int32_t aOffset);
|
||||
WSRunObject(HTMLEditor* aHTMLEditor, nsIDOMNode* aNode, int32_t aOffset);
|
||||
~WSRunObject();
|
||||
|
||||
// ScrubBlockBoundary removes any non-visible whitespace at the specified
|
||||
// location relative to a block node.
|
||||
static nsresult ScrubBlockBoundary(nsHTMLEditor* aHTMLEditor,
|
||||
static nsresult ScrubBlockBoundary(HTMLEditor* aHTMLEditor,
|
||||
BlockBoundary aBoundary,
|
||||
nsINode* aBlock,
|
||||
int32_t aOffset = -1);
|
||||
|
@ -179,7 +179,7 @@ public:
|
|||
// PrepareToJoinBlocks fixes up ws at the end of aLeftBlock and the
|
||||
// beginning of aRightBlock in preperation for them to be joined. Example
|
||||
// of fixup: trailingws in aLeftBlock needs to be removed.
|
||||
static nsresult PrepareToJoinBlocks(nsHTMLEditor* aHTMLEditor,
|
||||
static nsresult PrepareToJoinBlocks(HTMLEditor* aHTMLEditor,
|
||||
dom::Element* aLeftBlock,
|
||||
dom::Element* aRightBlock);
|
||||
|
||||
|
@ -190,7 +190,7 @@ public:
|
|||
// adjusting ws.
|
||||
// example of fixup: trailingws before {aStartNode,aStartOffset}
|
||||
// needs to be removed.
|
||||
static nsresult PrepareToDeleteRange(nsHTMLEditor* aHTMLEditor,
|
||||
static nsresult PrepareToDeleteRange(HTMLEditor* aHTMLEditor,
|
||||
nsCOMPtr<nsINode>* aStartNode,
|
||||
int32_t* aStartOffset,
|
||||
nsCOMPtr<nsINode>* aEndNode,
|
||||
|
@ -199,7 +199,7 @@ public:
|
|||
// PrepareToDeleteNode fixes up ws before and after aContent in preparation
|
||||
// for aContent to be deleted. Example of fixup: trailingws before
|
||||
// aContent needs to be removed.
|
||||
static nsresult PrepareToDeleteNode(nsHTMLEditor* aHTMLEditor,
|
||||
static nsresult PrepareToDeleteNode(HTMLEditor* aHTMLEditor,
|
||||
nsIContent* aContent);
|
||||
|
||||
// PrepareToSplitAcrossBlocks fixes up ws before and after
|
||||
|
@ -207,7 +207,7 @@ public:
|
|||
// Note that the aSplitNode and aSplitOffset are adjusted in response to
|
||||
// any DOM changes we make while adjusting ws. Example of fixup: normalws
|
||||
// before {aSplitNode,aSplitOffset} needs to end with nbsp.
|
||||
static nsresult PrepareToSplitAcrossBlocks(nsHTMLEditor* aHTMLEditor,
|
||||
static nsresult PrepareToSplitAcrossBlocks(HTMLEditor* aHTMLEditor,
|
||||
nsCOMPtr<nsINode>* aSplitNode,
|
||||
int32_t* aSplitOffset);
|
||||
|
||||
|
@ -398,12 +398,12 @@ protected:
|
|||
WSFragment* mEndRun;
|
||||
|
||||
// Non-owning.
|
||||
nsHTMLEditor* mHTMLEditor;
|
||||
HTMLEditor* mHTMLEditor;
|
||||
|
||||
// Opening this class up for pillaging.
|
||||
friend class HTMLEditRules;
|
||||
// Opening this class up for more pillaging.
|
||||
friend class nsHTMLEditor;
|
||||
friend class HTMLEditor;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -20,6 +20,7 @@ EXPORTS += [
|
|||
|
||||
EXPORTS.mozilla += [
|
||||
'EditorController.h',
|
||||
'HTMLEditor.h',
|
||||
'SelectionState.h',
|
||||
'TextEditRules.h',
|
||||
]
|
||||
|
@ -39,25 +40,25 @@ UNIFIED_SOURCES += [
|
|||
'EditorEventListener.cpp',
|
||||
'EditorUtils.cpp',
|
||||
'EditTransactionBase.cpp',
|
||||
'HTMLAbsPositionEditor.cpp',
|
||||
'HTMLAnonymousNodeEditor.cpp',
|
||||
'HTMLEditor.cpp',
|
||||
'HTMLEditorDataTransfer.cpp',
|
||||
'HTMLEditorEventListener.cpp',
|
||||
'HTMLEditorObjectResizer.cpp',
|
||||
'HTMLEditRules.cpp',
|
||||
'HTMLEditUtils.cpp',
|
||||
'HTMLInlineTableEditor.cpp',
|
||||
'HTMLStyleEditor.cpp',
|
||||
'HTMLTableEditor.cpp',
|
||||
'HTMLURIRefObject.cpp',
|
||||
'InsertNodeTransaction.cpp',
|
||||
'InsertTextTransaction.cpp',
|
||||
'InternetCiter.cpp',
|
||||
'JoinNodeTransaction.cpp',
|
||||
'nsEditor.cpp',
|
||||
'nsHTMLAbsPosition.cpp',
|
||||
'nsHTMLAnonymousUtils.cpp',
|
||||
'nsHTMLDataTransfer.cpp',
|
||||
'nsHTMLEditor.cpp',
|
||||
'nsHTMLEditorStyle.cpp',
|
||||
'nsHTMLInlineTableEditor.cpp',
|
||||
'nsHTMLObjectResizer.cpp',
|
||||
'nsPlaintextDataTransfer.cpp',
|
||||
'nsPlaintextEditor.cpp',
|
||||
'nsTableEditor.cpp',
|
||||
'PlaceholderTransaction.cpp',
|
||||
'SelectionState.cpp',
|
||||
'SetDocumentTitleTransaction.cpp',
|
||||
|
|
|
@ -3256,10 +3256,10 @@ nsEditor::GetLeftmostChild(nsINode *aCurrentNode,
|
|||
bool
|
||||
nsEditor::IsBlockNode(nsINode* aNode)
|
||||
{
|
||||
// stub to be overridden in nsHTMLEditor.
|
||||
// stub to be overridden in HTMLEditor.
|
||||
// screwing around with the class hierarchy here in order
|
||||
// to not duplicate the code in GetNextNode/GetPrevNode
|
||||
// across both nsEditor/nsHTMLEditor.
|
||||
// across both nsEditor/HTMLEditor.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -224,7 +224,7 @@ nsresult nsPlaintextEditor::InsertFromDrop(nsIDOMEvent* aDropEvent)
|
|||
|
||||
bool isCollapsed = selection->Collapsed();
|
||||
|
||||
// Only the nsHTMLEditor::FindUserSelectAllNode returns a node.
|
||||
// Only the HTMLEditor::FindUserSelectAllNode returns a node.
|
||||
nsCOMPtr<nsIDOMNode> userSelectNode = FindUserSelectAllNode(newSelectionParent);
|
||||
if (userSelectNode)
|
||||
{
|
||||
|
|
|
@ -139,7 +139,7 @@ NS_IMETHODIMP nsPlaintextEditor::Init(nsIDOMDocument *aDoc,
|
|||
NS_ENSURE_SUCCESS(rulesRes, rulesRes);
|
||||
|
||||
// mRules may not have been initialized yet, when this is called via
|
||||
// nsHTMLEditor::Init.
|
||||
// HTMLEditor::Init.
|
||||
if (mRules) {
|
||||
mRules->SetInitialValue(aInitialValue);
|
||||
}
|
||||
|
|
|
@ -1566,7 +1566,7 @@ RestyleManager::RestyleForRemove(Element* aContainer,
|
|||
{
|
||||
if (aOldChild->IsRootOfAnonymousSubtree()) {
|
||||
// This should be an assert, but this is called incorrectly in
|
||||
// nsHTMLEditor::DeleteRefToAnonymousNode and the assertions were clogging
|
||||
// HTMLEditor::DeleteRefToAnonymousNode and the assertions were clogging
|
||||
// up the logs. Make it an assert again when that's fixed.
|
||||
MOZ_ASSERT(aOldChild->GetProperty(nsGkAtoms::restylableAnonymousNode),
|
||||
"anonymous nodes should not be in child lists (bug 439258)");
|
||||
|
|
|
@ -139,8 +139,8 @@ using mozilla::dom::AudioChannelAgent;
|
|||
#include "nsEditor.h"
|
||||
#include "nsPlaintextEditor.h"
|
||||
#include "mozilla/EditorController.h" //CID
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "nsTextServicesDocument.h"
|
||||
#include "nsTextServicesCID.h"
|
||||
|
||||
|
@ -156,23 +156,6 @@ using mozilla::dom::AudioChannelAgent;
|
|||
#endif
|
||||
#include "nsParserUtils.h"
|
||||
|
||||
#define NS_EDITORCOMMANDTABLE_CID \
|
||||
{ 0x4f5e62b8, 0xd659, 0x4156, { 0x84, 0xfc, 0x2f, 0x60, 0x99, 0x40, 0x03, 0x69 }}
|
||||
|
||||
#define NS_EDITINGCOMMANDTABLE_CID \
|
||||
{ 0xcb38a746, 0xbeb8, 0x43f3, { 0x94, 0x29, 0x77, 0x96, 0xe1, 0xa9, 0x3f, 0xb4 }}
|
||||
|
||||
#define NS_HAPTICFEEDBACK_CID \
|
||||
{ 0x1f15dbc8, 0xbfaa, 0x45de, \
|
||||
{ 0x8a, 0x46, 0x08, 0xe2, 0xe2, 0x63, 0x26, 0xb0 } }
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPlaintextEditor)
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserUtils)
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTextServicesDocument)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLEditor)
|
||||
|
||||
#include "nsHTMLCanvasFrame.h"
|
||||
|
||||
#include "nsIDOMWebGLRenderingContext.h"
|
||||
|
@ -282,6 +265,26 @@ using mozilla::net::StreamingProtocolControllerService;
|
|||
using mozilla::gmp::GeckoMediaPluginService;
|
||||
using mozilla::dom::NotificationTelemetryService;
|
||||
|
||||
#define NS_EDITORCOMMANDTABLE_CID \
|
||||
{ 0x4f5e62b8, 0xd659, 0x4156, \
|
||||
{ 0x84, 0xfc, 0x2f, 0x60, 0x99, 0x40, 0x03, 0x69 } }
|
||||
|
||||
#define NS_EDITINGCOMMANDTABLE_CID \
|
||||
{ 0xcb38a746, 0xbeb8, 0x43f3, \
|
||||
{ 0x94, 0x29, 0x77, 0x96, 0xe1, 0xa9, 0x3f, 0xb4 } }
|
||||
|
||||
#define NS_HAPTICFEEDBACK_CID \
|
||||
{ 0x1f15dbc8, 0xbfaa, 0x45de, \
|
||||
{ 0x8a, 0x46, 0x08, 0xe2, 0xe2, 0x63, 0x26, 0xb0 } }
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPlaintextEditor)
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserUtils)
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsTextServicesDocument)
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(HTMLEditor)
|
||||
|
||||
// Transformiix
|
||||
/* 5d5d92cd-6bf8-11d9-bf4a-000a95dc234c */
|
||||
#define TRANSFORMIIX_NODESET_CID \
|
||||
|
@ -1086,7 +1089,7 @@ static const mozilla::Module::CIDEntry kLayoutCIDs[] = {
|
|||
{ &kNS_VOLUMESERVICE_CID, true, nullptr, nsVolumeServiceConstructor },
|
||||
#endif
|
||||
{ &kNS_AUDIOCHANNELAGENT_CID, true, nullptr, AudioChannelAgentConstructor },
|
||||
{ &kNS_HTMLEDITOR_CID, false, nullptr, nsHTMLEditorConstructor },
|
||||
{ &kNS_HTMLEDITOR_CID, false, nullptr, HTMLEditorConstructor },
|
||||
{ &kNS_EDITORCONTROLLER_CID, false, nullptr, EditorControllerConstructor },
|
||||
{ &kNS_EDITINGCONTROLLER_CID, false, nullptr, nsEditingControllerConstructor },
|
||||
{ &kNS_EDITORCOMMANDTABLE_CID, false, nullptr, nsEditorCommandTableConstructor },
|
||||
|
|
|
@ -83,7 +83,6 @@
|
|||
#include "nsMenuBarListener.h"
|
||||
#endif
|
||||
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "nsTextServicesDocument.h"
|
||||
|
||||
#ifdef MOZ_WEBSPEECH
|
||||
|
|
|
@ -78,11 +78,13 @@ static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
|
|||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/SelectionBinding.h"
|
||||
#include "mozilla/AsyncEventDispatcher.h"
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/layers/ScrollInputMethods.h"
|
||||
#include "nsViewManager.h"
|
||||
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIHTMLEditor.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using mozilla::layers::ScrollInputMethod;
|
||||
|
|
|
@ -773,7 +773,7 @@ nsClipboard :: FindPlatformHTML ( IDataObject* inDataObject, UINT inIndex,
|
|||
}
|
||||
|
||||
// We want to return the buffer not offset by startOfData because it will be
|
||||
// parsed out later (probably by nsHTMLEditor::ParseCFHTML) when it is still
|
||||
// parsed out later (probably by HTMLEditor::ParseCFHTML) when it is still
|
||||
// in CF_HTML format.
|
||||
|
||||
// We return the byte offset from the start of the data buffer to where the
|
||||
|
|
Загрузка…
Ссылка в новой задаче