ModifySelectionListLevel.h [plain text]
#pragma once
#include "CompositeEditCommand.h"
namespace WebCore {
class ModifySelectionListLevelCommand : public CompositeEditCommand {
protected:
explicit ModifySelectionListLevelCommand(Document&);
void appendSiblingNodeRange(Node* startNode, Node* endNode, Element* newParent);
void insertSiblingNodeRangeBefore(Node* startNode, Node* endNode, Node* refNode);
void insertSiblingNodeRangeAfter(Node* startNode, Node* endNode, Node* refNode);
private:
bool preservesTypingStyle() const override;
};
class IncreaseSelectionListLevelCommand : public ModifySelectionListLevelCommand {
public:
static bool canIncreaseSelectionListLevel(Document*);
static RefPtr<Node> increaseSelectionListLevel(Document*);
static RefPtr<Node> increaseSelectionListLevelOrdered(Document*);
static RefPtr<Node> increaseSelectionListLevelUnordered(Document*);
private:
enum Type { InheritedListType, OrderedList, UnorderedList };
static RefPtr<Node> increaseSelectionListLevel(Document*, Type);
static Ref<IncreaseSelectionListLevelCommand> create(Document& document, Type type)
{
return adoptRef(*new IncreaseSelectionListLevelCommand(document, type));
}
IncreaseSelectionListLevelCommand(Document&, Type);
void doApply() override;
Type m_listType;
RefPtr<Node> m_listElement;
};
class DecreaseSelectionListLevelCommand : public ModifySelectionListLevelCommand {
public:
static bool canDecreaseSelectionListLevel(Document*);
static void decreaseSelectionListLevel(Document*);
private:
static Ref<DecreaseSelectionListLevelCommand> create(Document& document)
{
return adoptRef(*new DecreaseSelectionListLevelCommand(document));
}
explicit DecreaseSelectionListLevelCommand(Document&);
void doApply() override;
};
}