Commit e9b353e8 authored by eric@webkit.org's avatar eric@webkit.org

Reviewed by Sam Weinig.

        Document our Selection DOM extensions
        (in preparation for re-writing Selection to work with ranges)

        * page/DOMSelection.cpp:
        (WebCore::DOMSelection::type):
        * page/DOMSelection.h:
        * page/DOMSelection.idl:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@40801 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 46b3e265
2009-02-09 Eric Seidel <eric@webkit.org>
Reviewed by Sam Weinig.
Document our Selection DOM extensions
(in preparation for re-writing Selection to work with ranges)
* page/DOMSelection.cpp:
(WebCore::DOMSelection::type):
* page/DOMSelection.h:
* page/DOMSelection.idl:
2009-02-09 Eric Seidel <eric@webkit.org>
Attempt to fix wx build
......@@ -142,6 +142,9 @@ String DOMSelection::type() const
SelectionController* selection = m_frame->selection();
// This is a WebKit DOM extension, incompatible with an IE extension
// IE has this same attribute, but returns "none", "text" and "control"
// http://msdn.microsoft.com/en-us/library/ms534692(VS.85).aspx
if (selection->isNone())
return "None";
if (selection->isCaret())
......
......@@ -50,7 +50,7 @@ namespace WebCore {
Frame* frame() const;
void disconnectFrame();
// Safari VisibleSelection Object API
// Safari Selection Object API
// These methods return the valid equivalents of internal editing positions.
Node* baseNode() const;
Node* extentNode() const;
......@@ -61,7 +61,7 @@ namespace WebCore {
void setPosition(Node*, int offset, ExceptionCode&);
void modify(const String& alter, const String& direction, const String& granularity);
// Mozilla VisibleSelection Object API
// Mozilla Selection Object API
// In Firefox, anchor/focus are the equal to the start/end of the selection,
// but reflect the direction in which the selection was made by the user. That does
// not mean that they are base/extent, since the base/extent don't reflect
......@@ -86,10 +86,8 @@ namespace WebCore {
String toString();
// Microsoft VisibleSelection Object API
// Microsoft Selection Object API
void empty();
//void clear();
//TextRange *createRange();
private:
DOMSelection(Frame*);
......
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
* Copyright (C) 2009 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -28,35 +29,30 @@
module window {
// This is based off of Mozilla's Selection interface
// https://developer.mozilla.org/En/DOM/Selection
interface DOMSelection {
readonly attribute Node anchorNode;
readonly attribute long anchorOffset;
readonly attribute Node focusNode;
readonly attribute long focusOffset;
readonly attribute Node baseNode;
readonly attribute long baseOffset;
readonly attribute Node extentNode;
readonly attribute long extentOffset;
readonly attribute boolean isCollapsed;
readonly attribute DOMString type;
readonly attribute long rangeCount;
void collapse(in Node node, in long index)
raises(DOMException);
void collapseToEnd();
void collapseToStart();
void deleteFromDocument();
boolean containsNode(in Node node, in boolean allowPartial);
void selectAllChildren(in Node node)
raises(DOMException);
void empty();
void setBaseAndExtent(in Node baseNode, in long baseOffset, in Node extentNode, in long extentOffset)
raises(DOMException);
void setPosition(in Node node, in long offset)
raises(DOMException);
void modify(in DOMString alter, in DOMString direction, in DOMString granularity);
void extend(in Node node, in long offset)
raises(DOMException);
Range getRangeAt(in long index)
raises(DOMException);
void removeAllRanges();
......@@ -65,6 +61,26 @@ module window {
#if defined(LANGUAGE_JAVASCRIPT)
[DontEnum] DOMString toString();
#endif
// WebKit extensions
readonly attribute Node baseNode;
readonly attribute long baseOffset;
readonly attribute Node extentNode;
readonly attribute long extentOffset;
// WebKit's "type" accessor returns "None", "Range" and "Caret"
// IE's type accessor returns "none", "text" and "control"
readonly attribute DOMString type;
void modify(in DOMString alter, in DOMString direction, in DOMString granularity);
void setBaseAndExtent(in Node baseNode, in long baseOffset, in Node extentNode, in long extentOffset)
raises(DOMException);
void setPosition(in Node node, in long offset)
raises(DOMException);
// IE extentions
// http://msdn.microsoft.com/en-us/library/ms535869(VS.85).aspx
void empty();
};
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment