[webkit-changes] [WebKit/WebKit] c537ee: Enums in ApplyStyleCommand should be enum classes

Abrar Rahman Protyasha noreply at github.com
Wed Sep 20 17:14:51 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c537ee925021abf80ed011c2111331e875ec13e6
      https://github.com/WebKit/WebKit/commit/c537ee925021abf80ed011c2111331e875ec13e6
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2023-09-20 (Wed, 20 Sep 2023)

  Changed paths:
    M Source/WebCore/editing/ApplyStyleCommand.cpp
    M Source/WebCore/editing/ApplyStyleCommand.h
    M Source/WebCore/editing/Editor.cpp

  Log Message:
  -----------
  Enums in ApplyStyleCommand should be enum classes
https://bugs.webkit.org/show_bug.cgi?id=261774
rdar://problem/115751437

Reviewed by Wenson Hsieh.

ApplyStyleCommand defines three enumerations, namely EPropertyLevel,
InlineStyleRemovalMode, and EAddStyledElement. This patch makes each of
these enums an enum class, narrows down the underlying type, and renames
the enum cases to address redundancy.

We also choose to default initialize the m_propertyLevel attribute of the
AppleStyleCommand class to PropertyLevel::Default through class member
initialization (rather than through explicit mem-init in _some_
constructor overloads). This is not a behavior change, but does make
construction cleaner.

* Source/WebCore/editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::ApplyStyleCommand):
(WebCore::ApplyStyleCommand::doApply):
(WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
(WebCore::ApplyStyleCommand::removeConflictingInlineStyleFromRun):
(WebCore::ApplyStyleCommand::removeInlineStyleFromElement):
(WebCore::ApplyStyleCommand::removeImplicitlyStyledElement):
(WebCore::ApplyStyleCommand::removeCSSStyle):
(WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
(WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
(WebCore::ApplyStyleCommand::removeInlineStyle):
(WebCore::ApplyStyleCommand::addInlineStyleIfNeeded):
(WebCore::ApplyStyleCommand::applyInlineStyleChange):
* Source/WebCore/editing/ApplyStyleCommand.h:
(WebCore::ApplyStyleCommand::create):
(WebCore::ApplyStyleCommand::shouldRemoveInlineStyleFromElement):
* Source/WebCore/editing/Editor.cpp:
(WebCore::Editor::applyParagraphStyle):

Canonical link: https://commits.webkit.org/268223@main




More information about the webkit-changes mailing list