Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit fe5ae74

Browse files
committed
Merge pull request #96 from Hixie/editing
Remove editing code from the C++ side of Sky.
2 parents a8fc98e + 94d9cb2 commit fe5ae74

File tree

112 files changed

+62
-17233
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+62
-17233
lines changed

sky/engine/core/core.gni

+2-83
Original file line numberDiff line numberDiff line change
@@ -324,103 +324,29 @@ sky_core_files = [
324324
"dom/shadow/SelectRuleFeatureSet.h",
325325
"dom/shadow/ShadowRoot.cpp",
326326
"dom/shadow/ShadowRoot.h",
327-
"editing/AppendNodeCommand.cpp",
328-
"editing/AppendNodeCommand.h",
329-
"editing/ApplyBlockElementCommand.cpp",
330-
"editing/ApplyBlockElementCommand.h",
331-
"editing/Caret.cpp",
332-
"editing/Caret.h",
333-
"editing/CompositeEditCommand.cpp",
334-
"editing/CompositeEditCommand.h",
335327
"editing/CompositionUnderline.h",
336328
"editing/CompositionUnderlineRangeFilter.cpp",
337329
"editing/CompositionUnderlineRangeFilter.h",
338-
"editing/DOMSelection.cpp",
339-
"editing/DOMSelection.h",
340-
"editing/DeleteFromTextNodeCommand.cpp",
341-
"editing/DeleteFromTextNodeCommand.h",
342-
"editing/DeleteSelectionCommand.cpp",
343-
"editing/DeleteSelectionCommand.h",
344-
"editing/EditAction.h",
345-
"editing/EditCommand.cpp",
346-
"editing/EditCommand.h",
347-
"editing/EditingBehavior.cpp",
348-
"editing/EditingBehavior.h",
349330
"editing/EditingBoundary.h",
350-
"editing/EditingStyle.cpp",
351-
"editing/EditingStyle.h",
352-
"editing/Editor.cpp",
353-
"editing/Editor.h",
354-
"editing/EditorCommand.cpp",
355-
"editing/EditorKeyBindings.cpp",
356331
"editing/FindOptions.h",
357-
"editing/FrameSelection.cpp",
358-
"editing/FrameSelection.h",
359-
"editing/HTMLInterchange.cpp",
360-
"editing/HTMLInterchange.h",
361-
"editing/InputMethodController.cpp",
362-
"editing/InputMethodController.h",
363-
"editing/InsertIntoTextNodeCommand.cpp",
364-
"editing/InsertIntoTextNodeCommand.h",
365-
"editing/InsertLineBreakCommand.cpp",
366-
"editing/InsertLineBreakCommand.h",
367-
"editing/InsertNodeBeforeCommand.cpp",
368-
"editing/InsertNodeBeforeCommand.h",
369-
"editing/InsertParagraphSeparatorCommand.cpp",
370-
"editing/InsertParagraphSeparatorCommand.h",
371-
"editing/InsertTextCommand.cpp",
372-
"editing/InsertTextCommand.h",
373-
"editing/MoveSelectionCommand.cpp",
374-
"editing/MoveSelectionCommand.h",
332+
"editing/htmlediting.cpp",
333+
"editing/htmlediting.h",
375334
"editing/PlainTextRange.cpp",
376335
"editing/PlainTextRange.h",
377336
"editing/PositionWithAffinity.cpp",
378337
"editing/PositionWithAffinity.h",
379-
"editing/RemoveNodeCommand.cpp",
380-
"editing/RemoveNodeCommand.h",
381-
"editing/RemoveNodePreservingChildrenCommand.cpp",
382-
"editing/RemoveNodePreservingChildrenCommand.h",
383338
"editing/RenderedPosition.cpp",
384339
"editing/RenderedPosition.h",
385-
"editing/ReplaceSelectionCommand.cpp",
386-
"editing/ReplaceSelectionCommand.h",
387-
"editing/SelectionType.h",
388-
"editing/SmartReplace.h",
389-
"editing/SmartReplaceICU.cpp",
390-
"editing/SpellCheckRequester.cpp",
391-
"editing/SpellCheckRequester.h",
392-
"editing/SpellChecker.cpp",
393-
"editing/SpellChecker.h",
394-
"editing/SplitElementCommand.cpp",
395-
"editing/SplitElementCommand.h",
396-
"editing/SplitTextNodeCommand.cpp",
397-
"editing/SplitTextNodeCommand.h",
398340
"editing/TextAffinity.h",
399-
"editing/TextCheckingHelper.cpp",
400-
"editing/TextCheckingHelper.h",
401341
"editing/TextGranularity.h",
402-
"editing/TextInsertionBaseCommand.cpp",
403-
"editing/TextInsertionBaseCommand.h",
404342
"editing/TextIterator.cpp",
405343
"editing/TextIterator.h",
406-
"editing/TypingCommand.cpp",
407-
"editing/TypingCommand.h",
408-
"editing/UndoStack.cpp",
409-
"editing/UndoStack.h",
410-
"editing/UndoStep.h",
411344
"editing/VisiblePosition.cpp",
412345
"editing/VisiblePosition.h",
413-
"editing/VisibleSelection.cpp",
414-
"editing/VisibleSelection.h",
415346
"editing/VisibleUnits.cpp",
416347
"editing/VisibleUnits.h",
417-
"editing/WritingDirection.h",
418-
"editing/htmlediting.cpp",
419-
"editing/htmlediting.h",
420348
"events/BeforeTextInsertedEvent.cpp",
421349
"events/BeforeTextInsertedEvent.h",
422-
"events/CompositionEvent.cpp",
423-
"events/CompositionEvent.h",
424350
"events/ErrorEvent.cpp",
425351
"events/ErrorEvent.h",
426352
"events/Event.cpp",
@@ -500,8 +426,6 @@ sky_core_files = [
500426
"loader/CanvasImageDecoder.h",
501427
"loader/DocumentLoadTiming.cpp",
502428
"loader/DocumentLoadTiming.h",
503-
"loader/EmptyClients.cpp",
504-
"loader/EmptyClients.h",
505429
"loader/FrameLoader.cpp",
506430
"loader/FrameLoader.h",
507431
"loader/FrameLoaderClient.h",
@@ -511,13 +435,11 @@ sky_core_files = [
511435
"loader/UniqueIdentifier.cpp",
512436
"loader/UniqueIdentifier.h",
513437
"page/ChromeClient.h",
514-
"page/EditorClient.h",
515438
"page/FocusController.cpp",
516439
"page/FocusController.h",
517440
"page/FocusType.h",
518441
"page/Page.cpp",
519442
"page/Page.h",
520-
"page/SpellCheckerClient.h",
521443
"painting/Canvas.cpp",
522444
"painting/Canvas.h",
523445
"painting/CanvasColor.cpp",
@@ -761,8 +683,6 @@ core_idl_files = get_path_info([
761683
"dom/Text.idl",
762684
"dom/URL.idl",
763685
"dom/shadow/ShadowRoot.idl",
764-
"editing/Selection.idl",
765-
"events/CompositionEvent.idl",
766686
"events/ErrorEvent.idl",
767687
"events/Event.idl",
768688
"events/GestureEvent.idl",
@@ -836,7 +756,6 @@ core_dependency_idl_files = get_path_info([
836756
# interfaces that inherit from Event, including Event itself
837757
core_event_idl_files = get_path_info([
838758
"css/MediaQueryListEvent.idl",
839-
"events/CompositionEvent.idl",
840759
"events/ErrorEvent.idl",
841760
"events/Event.idl",
842761
"events/GestureEvent.idl",

sky/engine/core/css/SelectorChecker.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "sky/engine/core/css/CSSSelectorList.h"
3232
#include "sky/engine/core/dom/Document.h"
3333
#include "sky/engine/core/dom/shadow/ShadowRoot.h"
34-
#include "sky/engine/core/editing/FrameSelection.h"
3534
#include "sky/engine/core/frame/LocalFrame.h"
3635
#include "sky/engine/core/html/parser/HTMLParserIdioms.h"
3736
#include "sky/engine/core/page/FocusController.h"
@@ -46,8 +45,6 @@ static bool matchesFocusPseudoClass(const Element& element)
4645
LocalFrame* frame = element.document().frame();
4746
if (!frame)
4847
return false;
49-
if (!frame->selection().isFocusedAndActive())
50-
return false;
5148
return true;
5249
}
5350

sky/engine/core/dom/CharacterData.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "sky/engine/core/dom/MutationObserverInterestGroup.h"
2828
#include "sky/engine/core/dom/MutationRecord.h"
2929
#include "sky/engine/core/dom/Text.h"
30-
#include "sky/engine/core/editing/FrameSelection.h"
3130
#include "sky/engine/core/frame/LocalFrame.h"
3231
#include "sky/engine/wtf/CheckedArithmetic.h"
3332

@@ -164,9 +163,6 @@ void CharacterData::setDataAndUpdate(const String& newData, unsigned offsetOfRep
164163
if (isTextNode())
165164
toText(this)->updateTextRenderer(offsetOfReplacedData, oldLength, recalcStyleBehavior);
166165

167-
if (document().frame())
168-
document().frame()->selection().didUpdateCharacterData(this, offsetOfReplacedData, oldLength, newLength);
169-
170166
didModifyData(oldData);
171167
}
172168

sky/engine/core/dom/Document.cpp

+2-20
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#include "sky/engine/core/dom/NodeRenderingTraversal.h"
5757
#include "sky/engine/core/dom/NodeTraversal.h"
5858
#include "sky/engine/core/dom/NodeWithIndex.h"
59+
#include "sky/engine/core/dom/Range.h"
5960
#include "sky/engine/core/dom/RequestAnimationFrameCallback.h"
6061
#include "sky/engine/core/dom/ScriptedAnimationController.h"
6162
#include "sky/engine/core/dom/SelectorQuery.h"
@@ -65,8 +66,7 @@
6566
#include "sky/engine/core/dom/custom/custom_element_registry.h"
6667
#include "sky/engine/core/dom/shadow/ElementShadow.h"
6768
#include "sky/engine/core/dom/shadow/ShadowRoot.h"
68-
#include "sky/engine/core/editing/FrameSelection.h"
69-
#include "sky/engine/core/editing/SpellChecker.h"
69+
#include "sky/engine/core/editing/PositionWithAffinity.h"
7070
#include "sky/engine/core/events/Event.h"
7171
#include "sky/engine/core/events/PageTransitionEvent.h"
7272
#include "sky/engine/core/frame/FrameHost.h"
@@ -1193,13 +1193,6 @@ void Document::nodeChildrenWillBeRemoved(ContainerNode& container)
11931193
for (AttachedRangeSet::const_iterator it = m_ranges.begin(); it != end; ++it)
11941194
(*it)->nodeChildrenWillBeRemoved(container);
11951195
}
1196-
1197-
if (LocalFrame* frame = this->frame()) {
1198-
for (Node* n = container.firstChild(); n; n = n->nextSibling()) {
1199-
frame->selection().nodeWillBeRemoved(*n);
1200-
frame->page()->dragCaretController().nodeWillBeRemoved(*n);
1201-
}
1202-
}
12031196
}
12041197

12051198
void Document::nodeWillBeRemoved(Node& n)
@@ -1209,11 +1202,6 @@ void Document::nodeWillBeRemoved(Node& n)
12091202
for (AttachedRangeSet::const_iterator it = m_ranges.begin(); it != rangesEnd; ++it)
12101203
(*it)->nodeWillBeRemoved(n);
12111204
}
1212-
1213-
if (LocalFrame* frame = this->frame()) {
1214-
frame->selection().nodeWillBeRemoved(n);
1215-
frame->page()->dragCaretController().nodeWillBeRemoved(n);
1216-
}
12171205
}
12181206

12191207
void Document::didInsertText(Node* text, unsigned offset, unsigned length)
@@ -1250,9 +1238,6 @@ void Document::didMergeTextNodes(Text& oldNode, unsigned offset)
12501238
(*it)->didMergeTextNodes(oldNodeWithIndex, offset);
12511239
}
12521240

1253-
if (m_frame)
1254-
m_frame->selection().didMergeTextNodes(oldNode, offset);
1255-
12561241
// FIXME: This should update markers for spelling and grammar checking.
12571242
}
12581243

@@ -1264,9 +1249,6 @@ void Document::didSplitTextNode(Text& oldNode)
12641249
(*it)->didSplitTextNode(oldNode);
12651250
}
12661251

1267-
if (m_frame)
1268-
m_frame->selection().didSplitTextNode(oldNode);
1269-
12701252
// FIXME: This should update markers for spelling and grammar checking.
12711253
}
12721254

sky/engine/core/dom/Document.idl

-3
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@ callback CustomElementConstructor = Element ();
5353
Range caretRangeFromPoint([Default=Undefined] optional long x,
5454
[Default=Undefined] optional long y);
5555

56-
// Mozilla extensions
57-
Selection getSelection();
58-
5956
// HTML 5
6057
readonly attribute Element activeElement;
6158
boolean hasFocus();

sky/engine/core/dom/DocumentMarkerController.h

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#define SKY_ENGINE_CORE_DOM_DOCUMENTMARKERCONTROLLER_H_
2929

3030
#include "sky/engine/core/dom/DocumentMarker.h"
31+
#include "sky/engine/core/dom/Range.h"
3132
#include "sky/engine/platform/geometry/IntRect.h"
3233
#include "sky/engine/platform/heap/Handle.h"
3334
#include "sky/engine/wtf/HashMap.h"

sky/engine/core/dom/Element.cpp

-12
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
#include "sky/engine/core/dom/custom/custom_element.h"
5757
#include "sky/engine/core/dom/shadow/InsertionPoint.h"
5858
#include "sky/engine/core/dom/shadow/ShadowRoot.h"
59-
#include "sky/engine/core/editing/FrameSelection.h"
6059
#include "sky/engine/core/editing/TextIterator.h"
6160
#include "sky/engine/core/editing/htmlediting.h"
6261
#include "sky/engine/core/frame/FrameView.h"
@@ -1094,17 +1093,6 @@ void Element::updateFocusAppearance(bool /*restorePreviousSelection*/)
10941093
RefPtr<LocalFrame> frame(document().frame());
10951094
if (!frame)
10961095
return;
1097-
1098-
// When focusing an editable element in an iframe, don't reset the selection if it already contains a selection.
1099-
if (this == frame->selection().rootEditableElement())
1100-
return;
1101-
1102-
// FIXME: We should restore the previous selection if there is one.
1103-
VisibleSelection newSelection = VisibleSelection(firstPositionInOrBeforeNode(this), DOWNSTREAM);
1104-
// Passing DoNotSetFocus as this function is called after FocusController::setFocusedElement()
1105-
// and we don't want to change the focus to a new Element.
1106-
frame->selection().setSelection(newSelection, FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle | FrameSelection::DoNotSetFocus);
1107-
frame->selection().revealSelection();
11081096
}
11091097
}
11101098

sky/engine/core/dom/TreeScope.cpp

-21
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include "sky/engine/core/dom/TreeScopeAdopter.h"
3737
#include "sky/engine/core/dom/shadow/ElementShadow.h"
3838
#include "sky/engine/core/dom/shadow/ShadowRoot.h"
39-
#include "sky/engine/core/editing/DOMSelection.h"
4039
#include "sky/engine/core/frame/FrameView.h"
4140
#include "sky/engine/core/frame/LocalFrame.h"
4241
#include "sky/engine/core/page/FocusController.h"
@@ -74,11 +73,6 @@ TreeScope::~TreeScope()
7473
ASSERT(!m_guardRefCount);
7574
m_rootNode->setTreeScope(0);
7675

77-
if (m_selection) {
78-
m_selection->clearTreeScope();
79-
m_selection = nullptr;
80-
}
81-
8276
if (m_parentTreeScope)
8377
m_parentTreeScope->guardDeref();
8478
}
@@ -192,21 +186,6 @@ Element* TreeScope::elementFromPoint(int x, int y) const
192186
return toElement(node);
193187
}
194188

195-
DOMSelection* TreeScope::getSelection() const
196-
{
197-
if (!rootNode().document().frame())
198-
return 0;
199-
200-
if (m_selection)
201-
return m_selection.get();
202-
203-
// FIXME: The correct selection in Shadow DOM requires that Position can have a ShadowRoot
204-
// as a container.
205-
// See https://bugs.webkit.org/show_bug.cgi?id=82697
206-
m_selection = DOMSelection::create(this);
207-
return m_selection.get();
208-
}
209-
210189
void TreeScope::adoptIfNeeded(Node& node)
211190
{
212191
ASSERT(this);

sky/engine/core/dom/TreeScope.h

-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
namespace blink {
3535

3636
class ContainerNode;
37-
class DOMSelection;
3837
class Document;
3938
class Element;
4039
class HitTestResult;
@@ -68,8 +67,6 @@ class TreeScope {
6867
// For accessibility.
6968
bool shouldCacheLabelsByForAttribute() const { return m_labelsByForAttribute; }
7069

71-
DOMSelection* getSelection() const;
72-
7370
// Used by the basic DOM mutation methods (e.g., appendChild()).
7471
void adoptIfNeeded(Node&);
7572

@@ -156,8 +153,6 @@ class TreeScope {
156153
OwnPtr<DocumentOrderedMap> m_imageMapsByName;
157154
OwnPtr<DocumentOrderedMap> m_labelsByForAttribute;
158155

159-
mutable RefPtr<DOMSelection> m_selection;
160-
161156
int m_guardRefCount;
162157
};
163158

sky/engine/core/dom/shadow/ShadowRoot.idl

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ interface ShadowRoot : DocumentFragment {
2828
readonly attribute Element activeElement;
2929

3030
[RaisesException] Node cloneNode([Named] optional boolean deep = true);
31-
Selection getSelection();
3231
Element getElementById([Default=Undefined] optional DOMString elementId);
3332

3433
Element elementFromPoint([Default=Undefined] optional long x,

0 commit comments

Comments
 (0)