Commit 1c1a9d54 authored by Kagami Sascha Rosylight's avatar Kagami Sascha Rosylight
Browse files

Bug 1767998 - Apply readability-make-member-function-const on editor/libeditor r=masayuki

parent 8209aad0
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -806,7 +806,7 @@ NS_IMETHODIMP EditorBase::GetDocument(Document** aDocument) {
  return NS_WARN_IF(!*aDocument) ? NS_ERROR_NOT_INITIALIZED : NS_OK;
}

already_AddRefed<nsIWidget> EditorBase::GetWidget() {
already_AddRefed<nsIWidget> EditorBase::GetWidget() const {
  nsPresContext* presContext = GetPresContext();
  if (NS_WARN_IF(!presContext)) {
    return nullptr;
@@ -1931,7 +1931,7 @@ nsresult EditorBase::RemoveAttributeWithTransaction(Element& aElement,
  return rv;
}

nsresult EditorBase::MarkElementDirty(Element& aElement) {
nsresult EditorBase::MarkElementDirty(Element& aElement) const {
  // Mark the node dirty, but not for webpages (bug 599983)
  if (!OutputsMozDirty()) {
    return NS_OK;
@@ -2710,7 +2710,7 @@ void EditorBase::CloneAttributesWithTransaction(Element& aDestElement,
  }
}

nsresult EditorBase::ScrollSelectionFocusIntoView() {
nsresult EditorBase::ScrollSelectionFocusIntoView() const {
  nsISelectionController* selectionController = GetSelectionController();
  if (!selectionController) {
    return NS_OK;
@@ -4864,7 +4864,8 @@ nsresult EditorBase::DeleteRangesWithTransaction(
  return rv;
}

already_AddRefed<Element> EditorBase::CreateHTMLContent(const nsAtom* aTag) {
already_AddRefed<Element> EditorBase::CreateHTMLContent(
    const nsAtom* aTag) const {
  MOZ_ASSERT(aTag);

  RefPtr<Document> document = GetDocument();
@@ -4886,7 +4887,7 @@ already_AddRefed<Element> EditorBase::CreateHTMLContent(const nsAtom* aTag) {
}

already_AddRefed<nsTextNode> EditorBase::CreateTextNode(
    const nsAString& aData) {
    const nsAString& aData) const {
  MOZ_ASSERT(IsEditActionDataAvailable());

  Document* document = GetDocument();
+9 −7
Original line number Diff line number Diff line
@@ -201,7 +201,7 @@ class EditorBase : public nsIEditor,
  nsPresContext* GetPresContext() const;
  already_AddRefed<nsCaret> GetCaret() const;

  already_AddRefed<nsIWidget> GetWidget();
  already_AddRefed<nsIWidget> GetWidget() const;

  nsISelectionController* GetSelectionController() const;

@@ -1768,13 +1768,13 @@ class EditorBase : public nsIEditor,
   *
   * @param aTag        Tag you want.
   */
  already_AddRefed<Element> CreateHTMLContent(const nsAtom* aTag);
  already_AddRefed<Element> CreateHTMLContent(const nsAtom* aTag) const;

  /**
   * Creates text node which is marked as "maybe modified frequently" and
   * "maybe masked" if this is a password editor.
   */
  already_AddRefed<nsTextNode> CreateTextNode(const nsAString& aData);
  already_AddRefed<nsTextNode> CreateTextNode(const nsAString& aData) const;

  /**
   * DoInsertText(), DoDeleteText(), DoReplaceText() and DoSetText() are
@@ -1811,7 +1811,8 @@ class EditorBase : public nsIEditor,
   *
   * @param aElement    The element for which to insert formatting.
   */
  [[nodiscard]] MOZ_CAN_RUN_SCRIPT nsresult MarkElementDirty(Element& aElement);
  [[nodiscard]] MOZ_CAN_RUN_SCRIPT nsresult
  MarkElementDirty(Element& aElement) const;

  MOZ_CAN_RUN_SCRIPT nsresult
  DoTransactionInternal(nsITransaction* aTransaction);
@@ -2359,7 +2360,8 @@ class EditorBase : public nsIEditor,
   * the editor's sync/async settings for reflowing, painting, and scrolling
   * match.
   */
  [[nodiscard]] MOZ_CAN_RUN_SCRIPT nsresult ScrollSelectionFocusIntoView();
  [[nodiscard]] MOZ_CAN_RUN_SCRIPT nsresult
  ScrollSelectionFocusIntoView() const;

  virtual nsresult InstallEventListeners();
  virtual void CreateEventListeners();
@@ -2379,9 +2381,9 @@ class EditorBase : public nsIEditor,
  /**
   * Return true if spellchecking should be enabled for this editor.
   */
  bool GetDesiredSpellCheckState();
  [[nodiscard]] bool GetDesiredSpellCheckState();

  bool CanEnableSpellCheck() {
  [[nodiscard]] bool CanEnableSpellCheck() const {
    // Check for password/readonly/disabled, which are not spellchecked
    // regardless of DOM. Also, check to see if spell check should be skipped
    // or not.
+1 −1
Original line number Diff line number Diff line
@@ -491,7 +491,7 @@ nsresult HTMLEditor::StartMoving() {
  return NS_OK;  // XXX Looks like nobody refers this result
}

void HTMLEditor::SnapToGrid(int32_t& newX, int32_t& newY) {
void HTMLEditor::SnapToGrid(int32_t& newX, int32_t& newY) const {
  if (mSnapToGridEnabled && mGridSize) {
    newX = (int32_t)floor(((float)newX / (float)mGridSize) + 0.5f) * mGridSize;
    newY = (int32_t)floor(((float)newY / (float)mGridSize) + 0.5f) * mGridSize;
+1 −1
Original line number Diff line number Diff line
@@ -6044,7 +6044,7 @@ nsresult HTMLEditor::SetReturnInParagraphCreatesNewParagraph(
  return NS_OK;
}

bool HTMLEditor::GetReturnInParagraphCreatesNewParagraph() {
bool HTMLEditor::GetReturnInParagraphCreatesNewParagraph() const {
  return mCRInParagraphCreatesParagraph;
}

+5 −4
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ class HTMLEditor final : public EditorBase,
    return aEditor ? aEditor->GetAsHTMLEditor() : nullptr;
  }

  bool GetReturnInParagraphCreatesNewParagraph();
  [[nodiscard]] bool GetReturnInParagraphCreatesNewParagraph() const;

  // EditorBase overrides
  MOZ_CAN_RUN_SCRIPT NS_IMETHOD BeginningOfDocument() final;
@@ -2380,7 +2380,7 @@ class HTMLEditor final : public EditorBase,
   */
  [[nodiscard]] MOZ_CAN_RUN_SCRIPT nsresult
  ComputeTargetRanges(nsIEditor::EDirection aDirectionAndAmount,
                      AutoRangeArray& aRangesToDelete);
                      AutoRangeArray& aRangesToDelete) const;

  /**
   * This method handles "delete selection" commands.
@@ -4215,7 +4215,8 @@ class HTMLEditor final : public EditorBase,
    eWidth,
    eHeight,
  };
  int32_t GetNewResizingIncrement(int32_t aX, int32_t aY, ResizeAt aResizeAt);
  [[nodiscard]] int32_t GetNewResizingIncrement(int32_t aX, int32_t aY,
                                                ResizeAt aResizeAt) const;

  [[nodiscard]] MOZ_CAN_RUN_SCRIPT nsresult StartResizing(Element& aHandle);
  int32_t GetNewResizingX(int32_t aX, int32_t aY);
@@ -4281,7 +4282,7 @@ class HTMLEditor final : public EditorBase,
  MOZ_CAN_RUN_SCRIPT nsresult StartMoving();
  MOZ_CAN_RUN_SCRIPT nsresult SetFinalPosition(int32_t aX, int32_t aY);
  void AddPositioningOffset(int32_t& aX, int32_t& aY);
  void SnapToGrid(int32_t& newX, int32_t& newY);
  void SnapToGrid(int32_t& newX, int32_t& newY) const;
  nsresult GrabberClicked();
  MOZ_CAN_RUN_SCRIPT nsresult EndMoving();
  [[nodiscard]] MOZ_CAN_RUN_SCRIPT nsresult
Loading