Skip to content

Commit 9b6e26f

Browse files
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
1 parent 9e30876 commit 9b6e26f

28 files changed

+2372
-2053
lines changed

dom/base/nsDocument.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4372,7 +4372,7 @@ nsDocument::SetStyleSheetApplicableState(StyleSheetHandle aSheet,
43724372

43734373
// We have to always notify, since this will be called for sheets
43744374
// that are children of sheets in our style set, as well as some
4375-
// sheets for nsHTMLEditor.
4375+
// sheets for HTMLEditor.
43764376

43774377
NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetApplicableStateChanged, (aSheet));
43784378

editor/libeditor/CSSEditUtils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "ChangeStyleTransaction.h"
99
#include "mozilla/Assertions.h"
10+
#include "mozilla/HTMLEditor.h"
1011
#include "mozilla/Preferences.h"
1112
#include "mozilla/css/Declaration.h"
1213
#include "mozilla/css/StyleRule.h"
@@ -20,7 +21,6 @@
2021
#include "nsDependentSubstring.h"
2122
#include "nsError.h"
2223
#include "nsGkAtoms.h"
23-
#include "nsHTMLEditor.h"
2424
#include "nsIAtom.h"
2525
#include "nsIContent.h"
2626
#include "nsIDOMCSSStyleDeclaration.h"
@@ -301,7 +301,7 @@ const CSSEditUtils::CSSEquivTable hrAlignEquivTable[] = {
301301
{ CSSEditUtils::eCSSEditableProperty_NONE, 0 }
302302
};
303303

304-
CSSEditUtils::CSSEditUtils(nsHTMLEditor* aHTMLEditor)
304+
CSSEditUtils::CSSEditUtils(HTMLEditor* aHTMLEditor)
305305
: mHTMLEditor(aHTMLEditor)
306306
, mIsCSSPrefChecked(true)
307307
{
@@ -589,7 +589,7 @@ CSSEditUtils::RemoveCSSInlineStyle(nsIDOMNode* aNode,
589589
NS_ENSURE_SUCCESS(res, res);
590590

591591
if (!element->IsHTMLElement(nsGkAtoms::span) ||
592-
nsHTMLEditor::HasAttributes(element)) {
592+
HTMLEditor::HasAttributes(element)) {
593593
return NS_OK;
594594
}
595595

editor/libeditor/CSSEditUtils.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "nscore.h" // for nsAString, nsresult, nullptr
1313

1414
class nsComputedDOMStyle;
15-
class nsHTMLEditor;
1615
class nsIAtom;
1716
class nsIContent;
1817
class nsIDOMCSSStyleDeclaration;
@@ -23,6 +22,7 @@ class nsString;
2322

2423
namespace mozilla {
2524

25+
class HTMLEditor;
2626
namespace dom {
2727
class Element;
2828
} // namespace dom
@@ -36,7 +36,7 @@ typedef void (*nsProcessValueFunc)(const nsAString* aInputString,
3636
class CSSEditUtils final
3737
{
3838
public:
39-
explicit CSSEditUtils(nsHTMLEditor* aEditor);
39+
explicit CSSEditUtils(HTMLEditor* aEditor);
4040
~CSSEditUtils();
4141

4242
enum nsCSSEditableProperty
@@ -454,7 +454,7 @@ class CSSEditUtils final
454454
nsAString& aValue, StyleType aStyleType);
455455

456456
private:
457-
nsHTMLEditor* mHTMLEditor;
457+
HTMLEditor* mHTMLEditor;
458458
bool mIsCSSPrefChecked;
459459
};
460460

editor/libeditor/nsHTMLAbsPosition.cpp renamed to editor/libeditor/HTMLAbsPositionEditor.cpp

Lines changed: 47 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5+
#include "mozilla/HTMLEditor.h"
6+
57
#include <math.h>
68

79
#include "EditorUtils.h"
@@ -20,7 +22,6 @@
2022
#include "nsEditor.h"
2123
#include "nsError.h"
2224
#include "nsGkAtoms.h"
23-
#include "nsHTMLEditor.h"
2425
#include "nsHTMLObjectResizer.h"
2526
#include "nsIContent.h"
2627
#include "nsROCSSPrimitiveValue.h"
@@ -46,13 +47,14 @@
4647
#include "nscore.h"
4748
#include <algorithm>
4849

49-
using namespace mozilla;
50-
using namespace mozilla::dom;
50+
namespace mozilla {
51+
52+
using namespace dom;
5153

5254
#define BLACK_BG_RGB_TRIGGER 0xd0
5355

5456
NS_IMETHODIMP
55-
nsHTMLEditor::AbsolutePositionSelection(bool aEnabled)
57+
HTMLEditor::AbsolutePositionSelection(bool aEnabled)
5658
{
5759
AutoEditBatch beginBatching(this);
5860
AutoRules beginRulesSniffing(this,
@@ -78,7 +80,7 @@ nsHTMLEditor::AbsolutePositionSelection(bool aEnabled)
7880
}
7981

8082
NS_IMETHODIMP
81-
nsHTMLEditor::GetAbsolutelyPositionedSelectionContainer(nsIDOMElement **_retval)
83+
HTMLEditor::GetAbsolutelyPositionedSelectionContainer(nsIDOMElement** _retval)
8284
{
8385
nsAutoString positionStr;
8486
nsCOMPtr<nsINode> node = GetSelectionContainer();
@@ -102,30 +104,31 @@ nsHTMLEditor::GetAbsolutelyPositionedSelectionContainer(nsIDOMElement **_retval)
102104
}
103105

104106
NS_IMETHODIMP
105-
nsHTMLEditor::GetSelectionContainerAbsolutelyPositioned(bool *aIsSelectionContainerAbsolutelyPositioned)
107+
HTMLEditor::GetSelectionContainerAbsolutelyPositioned(
108+
bool* aIsSelectionContainerAbsolutelyPositioned)
106109
{
107110
*aIsSelectionContainerAbsolutelyPositioned = (mAbsolutelyPositionedObject != nullptr);
108111
return NS_OK;
109112
}
110113

111114
NS_IMETHODIMP
112-
nsHTMLEditor::GetAbsolutePositioningEnabled(bool * aIsEnabled)
115+
HTMLEditor::GetAbsolutePositioningEnabled(bool* aIsEnabled)
113116
{
114117
*aIsEnabled = mIsAbsolutelyPositioningEnabled;
115118
return NS_OK;
116119
}
117120

118121
NS_IMETHODIMP
119-
nsHTMLEditor::SetAbsolutePositioningEnabled(bool aIsEnabled)
122+
HTMLEditor::SetAbsolutePositioningEnabled(bool aIsEnabled)
120123
{
121124
mIsAbsolutelyPositioningEnabled = aIsEnabled;
122125
return NS_OK;
123126
}
124127

125128
NS_IMETHODIMP
126-
nsHTMLEditor::RelativeChangeElementZIndex(nsIDOMElement * aElement,
129+
HTMLEditor::RelativeChangeElementZIndex(nsIDOMElement* aElement,
127130
int32_t aChange,
128-
int32_t * aReturn)
131+
int32_t* aReturn)
129132
{
130133
NS_ENSURE_ARG_POINTER(aElement);
131134
NS_ENSURE_ARG_POINTER(aReturn);
@@ -144,7 +147,8 @@ nsHTMLEditor::RelativeChangeElementZIndex(nsIDOMElement * aElement,
144147
}
145148

146149
NS_IMETHODIMP
147-
nsHTMLEditor::SetElementZIndex(nsIDOMElement* aElement, int32_t aZindex)
150+
HTMLEditor::SetElementZIndex(nsIDOMElement* aElement,
151+
int32_t aZindex)
148152
{
149153
nsCOMPtr<Element> element = do_QueryInterface(aElement);
150154
NS_ENSURE_ARG_POINTER(element);
@@ -157,7 +161,7 @@ nsHTMLEditor::SetElementZIndex(nsIDOMElement* aElement, int32_t aZindex)
157161
}
158162

159163
NS_IMETHODIMP
160-
nsHTMLEditor::RelativeChangeZIndex(int32_t aChange)
164+
HTMLEditor::RelativeChangeZIndex(int32_t aChange)
161165
{
162166
AutoEditBatch beginBatching(this);
163167
AutoRules beginRulesSniffing(this,
@@ -182,8 +186,8 @@ nsHTMLEditor::RelativeChangeZIndex(int32_t aChange)
182186
}
183187

184188
NS_IMETHODIMP
185-
nsHTMLEditor::GetElementZIndex(nsIDOMElement * aElement,
186-
int32_t * aZindex)
189+
HTMLEditor::GetElementZIndex(nsIDOMElement* aElement,
190+
int32_t* aZindex)
187191
{
188192
nsCOMPtr<Element> element = do_QueryInterface(aElement);
189193
NS_ENSURE_STATE(element || !aElement);
@@ -227,7 +231,7 @@ nsHTMLEditor::GetElementZIndex(nsIDOMElement * aElement,
227231
}
228232

229233
already_AddRefed<Element>
230-
nsHTMLEditor::CreateGrabber(nsINode* aParentNode)
234+
HTMLEditor::CreateGrabber(nsINode* aParentNode)
231235
{
232236
// let's create a grabber through the element factory
233237
nsCOMPtr<nsIDOMElement> retDOM;
@@ -247,7 +251,7 @@ nsHTMLEditor::CreateGrabber(nsINode* aParentNode)
247251
}
248252

249253
NS_IMETHODIMP
250-
nsHTMLEditor::RefreshGrabber()
254+
HTMLEditor::RefreshGrabber()
251255
{
252256
NS_ENSURE_TRUE(mAbsolutelyPositionedObject, NS_ERROR_NULL_POINTER);
253257

@@ -270,7 +274,7 @@ nsHTMLEditor::RefreshGrabber()
270274
}
271275

272276
NS_IMETHODIMP
273-
nsHTMLEditor::HideGrabber()
277+
HTMLEditor::HideGrabber()
274278
{
275279
nsresult res = mAbsolutelyPositionedObject->UnsetAttr(kNameSpaceID_None,
276280
nsGkAtoms::_moz_abspos,
@@ -298,7 +302,7 @@ nsHTMLEditor::HideGrabber()
298302
}
299303

300304
NS_IMETHODIMP
301-
nsHTMLEditor::ShowGrabberOnElement(nsIDOMElement * aElement)
305+
HTMLEditor::ShowGrabberOnElement(nsIDOMElement* aElement)
302306
{
303307
nsCOMPtr<Element> element = do_QueryInterface(aElement);
304308
NS_ENSURE_ARG_POINTER(element);
@@ -327,7 +331,7 @@ nsHTMLEditor::ShowGrabberOnElement(nsIDOMElement * aElement)
327331
}
328332

329333
nsresult
330-
nsHTMLEditor::StartMoving(nsIDOMElement *aHandle)
334+
HTMLEditor::StartMoving(nsIDOMElement* aHandle)
331335
{
332336
nsCOMPtr<nsINode> parentNode = mGrabber->GetParentNode();
333337

@@ -354,7 +358,7 @@ nsHTMLEditor::StartMoving(nsIDOMElement *aHandle)
354358
}
355359

356360
void
357-
nsHTMLEditor::SnapToGrid(int32_t & newX, int32_t & newY)
361+
HTMLEditor::SnapToGrid(int32_t& newX, int32_t& newY)
358362
{
359363
if (mSnapToGridEnabled && mGridSize) {
360364
newX = (int32_t) floor( ((float)newX / (float)mGridSize) + 0.5f ) * mGridSize;
@@ -363,7 +367,7 @@ nsHTMLEditor::SnapToGrid(int32_t & newX, int32_t & newY)
363367
}
364368

365369
nsresult
366-
nsHTMLEditor::GrabberClicked()
370+
HTMLEditor::GrabberClicked()
367371
{
368372
// add a mouse move listener to the editor
369373
nsresult res = NS_OK;
@@ -385,7 +389,7 @@ nsHTMLEditor::GrabberClicked()
385389
}
386390

387391
nsresult
388-
nsHTMLEditor::EndMoving()
392+
HTMLEditor::EndMoving()
389393
{
390394
if (mPositioningShadow) {
391395
nsCOMPtr<nsIPresShell> ps = GetPresShell();
@@ -421,7 +425,8 @@ nsHTMLEditor::EndMoving()
421425
return CheckSelectionStateForAnonymousButtons(selection);
422426
}
423427
nsresult
424-
nsHTMLEditor::SetFinalPosition(int32_t aX, int32_t aY)
428+
HTMLEditor::SetFinalPosition(int32_t aX,
429+
int32_t aY)
425430
{
426431
nsresult res = EndMoving();
427432
NS_ENSURE_SUCCESS(res, res);
@@ -456,7 +461,8 @@ nsHTMLEditor::SetFinalPosition(int32_t aX, int32_t aY)
456461
}
457462

458463
void
459-
nsHTMLEditor::AddPositioningOffset(int32_t & aX, int32_t & aY)
464+
HTMLEditor::AddPositioningOffset(int32_t& aX,
465+
int32_t& aY)
460466
{
461467
// Get the positioning offset
462468
int32_t positioningOffset =
@@ -467,8 +473,8 @@ nsHTMLEditor::AddPositioningOffset(int32_t & aX, int32_t & aY)
467473
}
468474

469475
NS_IMETHODIMP
470-
nsHTMLEditor::AbsolutelyPositionElement(nsIDOMElement* aElement,
471-
bool aEnabled)
476+
HTMLEditor::AbsolutelyPositionElement(nsIDOMElement* aElement,
477+
bool aEnabled)
472478
{
473479
nsCOMPtr<Element> element = do_QueryInterface(aElement);
474480
NS_ENSURE_ARG_POINTER(element);
@@ -540,36 +546,38 @@ nsHTMLEditor::AbsolutelyPositionElement(nsIDOMElement* aElement,
540546
}
541547

542548
NS_IMETHODIMP
543-
nsHTMLEditor::SetSnapToGridEnabled(bool aEnabled)
549+
HTMLEditor::SetSnapToGridEnabled(bool aEnabled)
544550
{
545551
mSnapToGridEnabled = aEnabled;
546552
return NS_OK;
547553
}
548554

549555
NS_IMETHODIMP
550-
nsHTMLEditor::GetSnapToGridEnabled(bool * aIsEnabled)
556+
HTMLEditor::GetSnapToGridEnabled(bool* aIsEnabled)
551557
{
552558
*aIsEnabled = mSnapToGridEnabled;
553559
return NS_OK;
554560
}
555561

556562
NS_IMETHODIMP
557-
nsHTMLEditor::SetGridSize(uint32_t aSize)
563+
HTMLEditor::SetGridSize(uint32_t aSize)
558564
{
559565
mGridSize = aSize;
560566
return NS_OK;
561567
}
562568

563569
NS_IMETHODIMP
564-
nsHTMLEditor::GetGridSize(uint32_t * aSize)
570+
HTMLEditor::GetGridSize(uint32_t* aSize)
565571
{
566572
*aSize = mGridSize;
567573
return NS_OK;
568574
}
569575

570576
// self-explanatory
571577
NS_IMETHODIMP
572-
nsHTMLEditor::SetElementPosition(nsIDOMElement *aElement, int32_t aX, int32_t aY)
578+
HTMLEditor::SetElementPosition(nsIDOMElement* aElement,
579+
int32_t aX,
580+
int32_t aY)
573581
{
574582
nsCOMPtr<Element> element = do_QueryInterface(aElement);
575583
NS_ENSURE_STATE(element);
@@ -579,7 +587,9 @@ nsHTMLEditor::SetElementPosition(nsIDOMElement *aElement, int32_t aX, int32_t aY
579587
}
580588

581589
void
582-
nsHTMLEditor::SetElementPosition(dom::Element& aElement, int32_t aX, int32_t aY)
590+
HTMLEditor::SetElementPosition(Element& aElement,
591+
int32_t aX,
592+
int32_t aY)
583593
{
584594
AutoEditBatch batchIt(this);
585595
mCSSEditUtils->SetCSSPropertyPixels(aElement, *nsGkAtoms::left, aX);
@@ -588,7 +598,7 @@ nsHTMLEditor::SetElementPosition(dom::Element& aElement, int32_t aX, int32_t aY)
588598

589599
// self-explanatory
590600
NS_IMETHODIMP
591-
nsHTMLEditor::GetPositionedElement(nsIDOMElement ** aReturn)
601+
HTMLEditor::GetPositionedElement(nsIDOMElement** aReturn)
592602
{
593603
nsCOMPtr<nsIDOMElement> ret =
594604
static_cast<nsIDOMElement*>(GetAsDOMNode(mAbsolutelyPositionedObject));
@@ -597,8 +607,8 @@ nsHTMLEditor::GetPositionedElement(nsIDOMElement ** aReturn)
597607
}
598608

599609
nsresult
600-
nsHTMLEditor::CheckPositionedElementBGandFG(nsIDOMElement * aElement,
601-
nsAString & aReturn)
610+
HTMLEditor::CheckPositionedElementBGandFG(nsIDOMElement* aElement,
611+
nsAString& aReturn)
602612
{
603613
// we are going to outline the positioned element and bring it to the
604614
// front to overlap any other element intersecting with it. But
@@ -664,3 +674,5 @@ nsHTMLEditor::CheckPositionedElementBGandFG(nsIDOMElement * aElement,
664674

665675
return NS_OK;
666676
}
677+
678+
} // namespace mozilla

0 commit comments

Comments
 (0)