blob: b9919d67087192229c05c3873ff9f20129128fd0 [file] [log] [blame]
mjs84e724c2005-05-24 07:21:47 +00001/*
darin@apple.com48ac3c42008-06-14 08:46:51 +00002 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
mjs84e724c2005-05-24 07:21:47 +00003 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
mjs@apple.com92047332014-03-15 04:08:27 +000013 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
mjs84e724c2005-05-24 07:21:47 +000014 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
mjs@apple.com92047332014-03-15 04:08:27 +000016 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
mjs84e724c2005-05-24 07:21:47 +000017 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
commit-queue@webkit.org553e8d32016-11-12 08:57:21 +000026#pragma once
mjs84e724c2005-05-24 07:21:47 +000027
darina68e0432006-02-14 21:40:54 +000028#include "EditCommand.h"
mjs84e724c2005-05-24 07:21:47 +000029
darinb9481ed2006-03-20 02:57:59 +000030namespace WebCore {
mjs84e724c2005-05-24 07:21:47 +000031
darin@apple.com48ac3c42008-06-14 08:46:51 +000032class Text;
33
34class SplitTextNodeCommand : public SimpleEditCommand {
mjs84e724c2005-05-24 07:21:47 +000035public:
cdumez@apple.com2fecce72017-05-05 05:09:56 +000036 static Ref<SplitTextNodeCommand> create(Ref<Text>&& node, int offset)
darin@apple.com48ac3c42008-06-14 08:46:51 +000037 {
cdumez@apple.com2fecce72017-05-05 05:09:56 +000038 return adoptRef(*new SplitTextNodeCommand(WTFMove(node), offset));
darin@apple.com48ac3c42008-06-14 08:46:51 +000039 }
40
41private:
cdumez@apple.com2fecce72017-05-05 05:09:56 +000042 SplitTextNodeCommand(Ref<Text>&&, int offset);
darind7d82ce2006-01-13 10:07:39 +000043
darin@apple.com11ff47c2016-03-04 16:47:55 +000044 void doApply() override;
45 void doUnapply() override;
46 void doReapply() override;
rniwa@webkit.orgdbe05e82010-07-26 08:19:12 +000047 void insertText1AndTrimText2();
rniwa@webkit.org3045bc32011-12-10 21:35:06 +000048
49#ifndef NDEBUG
darin@apple.com11ff47c2016-03-04 16:47:55 +000050 void getNodesInCommand(HashSet<Node*>&) override;
rniwa@webkit.org3045bc32011-12-10 21:35:06 +000051#endif
mjs84e724c2005-05-24 07:21:47 +000052
darinf4b05b22006-07-10 05:20:17 +000053 RefPtr<Text> m_text1;
cdumez@apple.com2fecce72017-05-05 05:09:56 +000054 Ref<Text> m_text2;
adele704e8bb2005-09-16 22:42:30 +000055 unsigned m_offset;
mjs84e724c2005-05-24 07:21:47 +000056};
57
darinb9481ed2006-03-20 02:57:59 +000058} // namespace WebCore