Skip to content

Commit

Permalink
Bug 1260651 part.56 Rename nsHTMLEditor to mozilla::HTMLEditor and re…
Browse files Browse the repository at this point in the history
…lated 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
  • Loading branch information
masayuki-nakano committed Jul 9, 2016
1 parent 7ed638d commit 953e771
Show file tree
Hide file tree
Showing 28 changed files with 2,372 additions and 2,053 deletions.
2 changes: 1 addition & 1 deletion dom/base/nsDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
6 changes: 3 additions & 3 deletions editor/libeditor/CSSEditUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -301,7 +301,7 @@ const CSSEditUtils::CSSEquivTable hrAlignEquivTable[] = {
{ CSSEditUtils::eCSSEditableProperty_NONE, 0 }
};

CSSEditUtils::CSSEditUtils(nsHTMLEditor* aHTMLEditor)
CSSEditUtils::CSSEditUtils(HTMLEditor* aHTMLEditor)
: mHTMLEditor(aHTMLEditor)
, mIsCSSPrefChecked(true)
{
Expand Down Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions editor/libeditor/CSSEditUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "nscore.h" // for nsAString, nsresult, nullptr

class nsComputedDOMStyle;
class nsHTMLEditor;
class nsIAtom;
class nsIContent;
class nsIDOMCSSStyleDeclaration;
Expand All @@ -23,6 +22,7 @@ class nsString;

namespace mozilla {

class HTMLEditor;
namespace dom {
class Element;
} // namespace dom
Expand All @@ -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
Expand Down Expand Up @@ -454,7 +454,7 @@ class CSSEditUtils final
nsAString& aValue, StyleType aStyleType);

private:
nsHTMLEditor* mHTMLEditor;
HTMLEditor* mHTMLEditor;
bool mIsCSSPrefChecked;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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,
Expand All @@ -78,7 +80,7 @@ nsHTMLEditor::AbsolutePositionSelection(bool aEnabled)
}

NS_IMETHODIMP
nsHTMLEditor::GetAbsolutelyPositionedSelectionContainer(nsIDOMElement **_retval)
HTMLEditor::GetAbsolutelyPositionedSelectionContainer(nsIDOMElement** _retval)
{
nsAutoString positionStr;
nsCOMPtr<nsINode> node = GetSelectionContainer();
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -247,7 +251,7 @@ nsHTMLEditor::CreateGrabber(nsINode* aParentNode)
}

NS_IMETHODIMP
nsHTMLEditor::RefreshGrabber()
HTMLEditor::RefreshGrabber()
{
NS_ENSURE_TRUE(mAbsolutelyPositionedObject, NS_ERROR_NULL_POINTER);

Expand All @@ -270,7 +274,7 @@ nsHTMLEditor::RefreshGrabber()
}

NS_IMETHODIMP
nsHTMLEditor::HideGrabber()
HTMLEditor::HideGrabber()
{
nsresult res = mAbsolutelyPositionedObject->UnsetAttr(kNameSpaceID_None,
nsGkAtoms::_moz_abspos,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -327,7 +331,7 @@ nsHTMLEditor::ShowGrabberOnElement(nsIDOMElement * aElement)
}

nsresult
nsHTMLEditor::StartMoving(nsIDOMElement *aHandle)
HTMLEditor::StartMoving(nsIDOMElement* aHandle)
{
nsCOMPtr<nsINode> parentNode = mGrabber->GetParentNode();

Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -385,7 +389,7 @@ nsHTMLEditor::GrabberClicked()
}

nsresult
nsHTMLEditor::EndMoving()
HTMLEditor::EndMoving()
{
if (mPositioningShadow) {
nsCOMPtr<nsIPresShell> ps = GetPresShell();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 =
Expand All @@ -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);
Expand Down Expand Up @@ -540,36 +546,38 @@ 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;
}

// 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);
Expand All @@ -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);
Expand All @@ -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));
Expand All @@ -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
Expand Down Expand Up @@ -664,3 +674,5 @@ nsHTMLEditor::CheckPositionedElementBGandFG(nsIDOMElement * aElement,

return NS_OK;
}

} // namespace mozilla
Loading

0 comments on commit 953e771

Please sign in to comment.