Commit a63b5f5a authored by darin's avatar darin

WebCore:

        Reviewed and landed by Darin.

        - name changes to prepare for fixing bugzilla bug 4582

        Renamed khtml::Selection to khtml::SelectionController since it's far more
        than just the selection position itself. Also renamed WebSelectionDirection
        WebSelectionGranularity and their constants to have a WebBridge prefix so they
        don't collide with possible public enums with a similar purpose.

        * ForwardingHeaders/editing/SelectionController.h: Added.
        * ForwardingHeaders/editing/selection.h: Removed.
        * WebCore.xcodeproj/project.pbxproj: Added new files, removed old files.

        * khtml/editing/SelectionController.cpp: New name for selection.cpp, contents renamed.
        * khtml/editing/SelectionController.h: New name for selection.h, contents renamed.

        * khtml/editing/selection.cpp: Removed.
        * khtml/editing/selection.h: Removed.

        * khtml/ecma/kjs_window.cpp:
        * khtml/editing/apply_style_command.cpp:
        * khtml/editing/break_blockquote_command.cpp:
        * khtml/editing/composite_edit_command.cpp:
        * khtml/editing/composite_edit_command.h:
        * khtml/editing/delete_selection_command.cpp:
        * khtml/editing/delete_selection_command.h:
        * khtml/editing/edit_command.cpp:
        * khtml/editing/edit_command.h:
        * khtml/editing/htmlediting.h:
        * khtml/editing/insert_line_break_command.cpp:
        * khtml/editing/insert_paragraph_separator_command.cpp:
        * khtml/editing/insert_text_command.cpp:
        * khtml/editing/jsediting.cpp:
        * khtml/editing/move_selection_command.cpp:
        * khtml/editing/replace_selection_command.cpp:
        * khtml/editing/typing_command.cpp:
        * khtml/khtml_part.cpp:
        * khtml/khtml_part.h:
        * khtml/khtmlpart_p.h:
        * khtml/rendering/render_block.cpp:
        * khtml/xml/dom_docimpl.cpp:
        * khtml/xml/dom_nodeimpl.cpp:
        * kwq/KWQAccObject.mm:
        * kwq/KWQKHTMLPart.h:
        * kwq/KWQKHTMLPart.mm:
        * kwq/KWQRenderTreeDebug.cpp:
        * kwq/WebCoreBridge.h:
        * kwq/WebCoreBridge.mm:
        Renaming.

WebKit:

        Reviewed and landed by Darin.

        - name changes to prepare for fixing bugzilla bug 4582

        * WebView.subproj/WebHTMLView.m: Changed names to match WebCore changes.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@10606 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0ef483d5
2005-09-23 Duncan Wilcox <duncan@mclink.it>
Reviewed and landed by Darin.
- name changes to prepare for fixing bugzilla bug 4582
Renamed khtml::Selection to khtml::SelectionController since it's far more
than just the selection position itself. Also renamed WebSelectionDirection
WebSelectionGranularity and their constants to have a WebBridge prefix so they
don't collide with possible public enums with a similar purpose.
* ForwardingHeaders/editing/SelectionController.h: Added.
* ForwardingHeaders/editing/selection.h: Removed.
* WebCore.xcodeproj/project.pbxproj: Added new files, removed old files.
* khtml/editing/SelectionController.cpp: New name for selection.cpp, contents renamed.
* khtml/editing/SelectionController.h: New name for selection.h, contents renamed.
* khtml/editing/selection.cpp: Removed.
* khtml/editing/selection.h: Removed.
* khtml/ecma/kjs_window.cpp:
* khtml/editing/apply_style_command.cpp:
* khtml/editing/break_blockquote_command.cpp:
* khtml/editing/composite_edit_command.cpp:
* khtml/editing/composite_edit_command.h:
* khtml/editing/delete_selection_command.cpp:
* khtml/editing/delete_selection_command.h:
* khtml/editing/edit_command.cpp:
* khtml/editing/edit_command.h:
* khtml/editing/htmlediting.h:
* khtml/editing/insert_line_break_command.cpp:
* khtml/editing/insert_paragraph_separator_command.cpp:
* khtml/editing/insert_text_command.cpp:
* khtml/editing/jsediting.cpp:
* khtml/editing/move_selection_command.cpp:
* khtml/editing/replace_selection_command.cpp:
* khtml/editing/typing_command.cpp:
* khtml/khtml_part.cpp:
* khtml/khtml_part.h:
* khtml/khtmlpart_p.h:
* khtml/rendering/render_block.cpp:
* khtml/xml/dom_docimpl.cpp:
* khtml/xml/dom_nodeimpl.cpp:
* kwq/KWQAccObject.mm:
* kwq/KWQKHTMLPart.h:
* kwq/KWQKHTMLPart.mm:
* kwq/KWQRenderTreeDebug.cpp:
* kwq/WebCoreBridge.h:
* kwq/WebCoreBridge.mm:
Renaming.
2005-09-23 Darin Adler <darin@apple.com>
Reviewed by Eric.
......
......@@ -363,7 +363,7 @@
93F199EF08245E59001E9ABC /* KWQFormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B641F206E28C5C0055F610 /* KWQFormData.h */; };
93F199F008245E59001E9ABC /* WebCoreView.h in Headers */ = {isa = PBXBuildFile; fileRef = BE855F7F0701E83500239769 /* WebCoreView.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F199F108245E59001E9ABC /* WebDashboardRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = 5150C2A10702629000AF642C /* WebDashboardRegion.h */; settings = {ATTRIBUTES = (Private, ); }; };
93F199F208245E59001E9ABC /* selection.h in Headers */ = {isa = PBXBuildFile; fileRef = 93ABE067070285F600BD91F9 /* selection.h */; };
93F199F208245E59001E9ABC /* SelectionController.h in Headers */ = {isa = PBXBuildFile; fileRef = 93ABE067070285F600BD91F9 /* SelectionController.h */; settings = {ATTRIBUTES = (); }; };
93F199F308245E59001E9ABC /* visible_position.h in Headers */ = {isa = PBXBuildFile; fileRef = 93ABE069070285F600BD91F9 /* visible_position.h */; };
93F199F408245E59001E9ABC /* visible_text.h in Headers */ = {isa = PBXBuildFile; fileRef = 93ABE06B070285F600BD91F9 /* visible_text.h */; };
93F199F508245E59001E9ABC /* visible_units.h in Headers */ = {isa = PBXBuildFile; fileRef = 93ABE06D070285F600BD91F9 /* visible_units.h */; };
......@@ -608,7 +608,7 @@
93F19B0608245E59001E9ABC /* KWQFormData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93B641F106E28C5C0055F610 /* KWQFormData.mm */; };
93F19B0708245E59001E9ABC /* WebCoreView.m in Sources */ = {isa = PBXBuildFile; fileRef = BE8560510701F91100239769 /* WebCoreView.m */; };
93F19B0808245E59001E9ABC /* WebDashboardRegion.m in Sources */ = {isa = PBXBuildFile; fileRef = 5150C2A50702629800AF642C /* WebDashboardRegion.m */; };
93F19B0908245E59001E9ABC /* selection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93ABE066070285F600BD91F9 /* selection.cpp */; };
93F19B0908245E59001E9ABC /* SelectionController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93ABE066070285F600BD91F9 /* SelectionController.cpp */; };
93F19B0A08245E59001E9ABC /* visible_position.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93ABE068070285F600BD91F9 /* visible_position.cpp */; };
93F19B0B08245E59001E9ABC /* visible_text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93ABE06A070285F600BD91F9 /* visible_text.cpp */; };
93F19B0C08245E59001E9ABC /* visible_units.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93ABE06C070285F600BD91F9 /* visible_units.cpp */; };
......@@ -1173,7 +1173,7 @@
A8212BB508794A2300677359 /* KWQFormData.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B641F206E28C5C0055F610 /* KWQFormData.h */; };
A8212BB608794A2300677359 /* WebCoreView.h in Headers */ = {isa = PBXBuildFile; fileRef = BE855F7F0701E83500239769 /* WebCoreView.h */; settings = {ATTRIBUTES = (Private, ); }; };
A8212BB708794A2300677359 /* WebDashboardRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = 5150C2A10702629000AF642C /* WebDashboardRegion.h */; settings = {ATTRIBUTES = (Private, ); }; };
A8212BB808794A2300677359 /* selection.h in Headers */ = {isa = PBXBuildFile; fileRef = 93ABE067070285F600BD91F9 /* selection.h */; };
A8212BB808794A2300677359 /* SelectionController.h in Headers */ = {isa = PBXBuildFile; fileRef = 93ABE067070285F600BD91F9 /* SelectionController.h */; };
A8212BB908794A2300677359 /* visible_position.h in Headers */ = {isa = PBXBuildFile; fileRef = 93ABE069070285F600BD91F9 /* visible_position.h */; };
A8212BBA08794A2300677359 /* visible_text.h in Headers */ = {isa = PBXBuildFile; fileRef = 93ABE06B070285F600BD91F9 /* visible_text.h */; };
A8212BBB08794A2300677359 /* visible_units.h in Headers */ = {isa = PBXBuildFile; fileRef = 93ABE06D070285F600BD91F9 /* visible_units.h */; };
......@@ -1452,7 +1452,7 @@
A8212CD408794A2300677359 /* KWQFormData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93B641F106E28C5C0055F610 /* KWQFormData.mm */; };
A8212CD508794A2300677359 /* WebCoreView.m in Sources */ = {isa = PBXBuildFile; fileRef = BE8560510701F91100239769 /* WebCoreView.m */; };
A8212CD608794A2300677359 /* WebDashboardRegion.m in Sources */ = {isa = PBXBuildFile; fileRef = 5150C2A50702629800AF642C /* WebDashboardRegion.m */; };
A8212CD708794A2300677359 /* selection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93ABE066070285F600BD91F9 /* selection.cpp */; };
A8212CD708794A2300677359 /* SelectionController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93ABE066070285F600BD91F9 /* SelectionController.cpp */; };
A8212CD808794A2300677359 /* visible_position.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93ABE068070285F600BD91F9 /* visible_position.cpp */; };
A8212CD908794A2300677359 /* visible_text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93ABE06A070285F600BD91F9 /* visible_text.cpp */; };
A8212CDA08794A2300677359 /* visible_units.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93ABE06C070285F600BD91F9 /* visible_units.cpp */; };
......@@ -2525,8 +2525,8 @@
939FF8ED0702B1B100979E5E /* visible_range.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = visible_range.h; path = editing/visible_range.h; sourceTree = "<group>"; };
93ABCE5D06E1A42E0085925B /* formdata.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = formdata.cpp; sourceTree = "<group>"; };
93ABCE5E06E1A42E0085925B /* formdata.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = formdata.h; sourceTree = "<group>"; };
93ABE066070285F600BD91F9 /* selection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = selection.cpp; path = editing/selection.cpp; sourceTree = "<group>"; };
93ABE067070285F600BD91F9 /* selection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = selection.h; path = editing/selection.h; sourceTree = "<group>"; };
93ABE066070285F600BD91F9 /* SelectionController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SelectionController.cpp; path = editing/SelectionController.cpp; sourceTree = "<group>"; };
93ABE067070285F600BD91F9 /* SelectionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SelectionController.h; path = editing/SelectionController.h; sourceTree = "<group>"; };
93ABE068070285F600BD91F9 /* visible_position.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = visible_position.cpp; path = editing/visible_position.cpp; sourceTree = "<group>"; };
93ABE069070285F600BD91F9 /* visible_position.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = visible_position.h; path = editing/visible_position.h; sourceTree = "<group>"; };
93ABE06A070285F600BD91F9 /* visible_text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = visible_text.cpp; path = editing/visible_text.cpp; sourceTree = "<group>"; };
......@@ -6251,8 +6251,8 @@
BE02D4E7066F908A0076809F /* jsediting.cpp */,
9378D9FA07640A46004B97BF /* markup.h */,
9378D9F907640A46004B97BF /* markup.cpp */,
93ABE067070285F600BD91F9 /* selection.h */,
93ABE066070285F600BD91F9 /* selection.cpp */,
93ABE067070285F600BD91F9 /* SelectionController.h */,
93ABE066070285F600BD91F9 /* SelectionController.cpp */,
BECE67BD07087B250007C14B /* text_affinity.h */,
932B9834070297DC0032804F /* text_granularity.h */,
93ABE069070285F600BD91F9 /* visible_position.h */,
......@@ -7233,7 +7233,7 @@
93F199EF08245E59001E9ABC /* KWQFormData.h in Headers */,
93F199F008245E59001E9ABC /* WebCoreView.h in Headers */,
93F199F108245E59001E9ABC /* WebDashboardRegion.h in Headers */,
93F199F208245E59001E9ABC /* selection.h in Headers */,
93F199F208245E59001E9ABC /* SelectionController.h in Headers */,
93F199F308245E59001E9ABC /* visible_position.h in Headers */,
93F199F408245E59001E9ABC /* visible_text.h in Headers */,
93F199F508245E59001E9ABC /* visible_units.h in Headers */,
......@@ -7581,7 +7581,7 @@
A8212BB508794A2300677359 /* KWQFormData.h in Headers */,
A8212BB608794A2300677359 /* WebCoreView.h in Headers */,
A8212BB708794A2300677359 /* WebDashboardRegion.h in Headers */,
A8212BB808794A2300677359 /* selection.h in Headers */,
A8212BB808794A2300677359 /* SelectionController.h in Headers */,
A8212BB908794A2300677359 /* visible_position.h in Headers */,
A8212BBA08794A2300677359 /* visible_text.h in Headers */,
A8212BBB08794A2300677359 /* visible_units.h in Headers */,
......@@ -9542,7 +9542,7 @@
93F19B0608245E59001E9ABC /* KWQFormData.mm in Sources */,
93F19B0708245E59001E9ABC /* WebCoreView.m in Sources */,
93F19B0808245E59001E9ABC /* WebDashboardRegion.m in Sources */,
93F19B0908245E59001E9ABC /* selection.cpp in Sources */,
93F19B0908245E59001E9ABC /* SelectionController.cpp in Sources */,
93F19B0A08245E59001E9ABC /* visible_position.cpp in Sources */,
93F19B0B08245E59001E9ABC /* visible_text.cpp in Sources */,
93F19B0C08245E59001E9ABC /* visible_units.cpp in Sources */,
......@@ -9816,7 +9816,7 @@
A8212CD408794A2300677359 /* KWQFormData.mm in Sources */,
A8212CD508794A2300677359 /* WebCoreView.m in Sources */,
A8212CD608794A2300677359 /* WebDashboardRegion.m in Sources */,
A8212CD708794A2300677359 /* selection.cpp in Sources */,
A8212CD708794A2300677359 /* SelectionController.cpp in Sources */,
A8212CD808794A2300677359 /* visible_position.cpp in Sources */,
A8212CD908794A2300677359 /* visible_text.cpp in Sources */,
A8212CDA08794A2300677359 /* visible_units.cpp in Sources */,
......@@ -59,7 +59,7 @@
#include "dom/dom_string.h"
#include "dom/dom_node.h"
#include "editing/htmlediting.h"
#include "editing/selection.h"
#include "editing/SelectionController.h"
#include "xml/dom2_eventsimpl.h"
#include "xml/dom2_rangeimpl.h"
#include "xml/dom_docimpl.h"
......@@ -2574,11 +2574,11 @@ ValueImp *Selection::getValueProperty(ExecState *exec, int token) const
return Boolean(!m_part->selection().isRange());
case _Type: {
switch (m_part->selection().state()) {
case khtml::Selection::NONE:
case khtml::SelectionController::NONE:
return String("None");
case khtml::Selection::CARET:
case khtml::SelectionController::CARET:
return String("Caret");
case khtml::Selection::RANGE:
case khtml::SelectionController::RANGE:
return String("Range");
}
}
......@@ -2620,15 +2620,15 @@ ValueImp *SelectionFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, con
switch (id) {
case Selection::Collapse:
TypingCommand::closeTyping(part->lastEditCommand());
part->setSelection(khtml::Selection(Position(toNode(args[0]), args[1]->toInt32(exec)), khtml::SEL_DEFAULT_AFFINITY));
part->setSelection(khtml::SelectionController(Position(toNode(args[0]), args[1]->toInt32(exec)), khtml::SEL_DEFAULT_AFFINITY));
break;
case Selection::CollapseToEnd:
TypingCommand::closeTyping(part->lastEditCommand());
part->setSelection(khtml::Selection(part->selection().end(), part->selection().endAffinity()));
part->setSelection(khtml::SelectionController(part->selection().end(), part->selection().endAffinity()));
break;
case Selection::CollapseToStart:
TypingCommand::closeTyping(part->lastEditCommand());
part->setSelection(khtml::Selection(part->selection().start(), part->selection().startAffinity()));
part->setSelection(khtml::SelectionController(part->selection().start(), part->selection().startAffinity()));
break;
case Selection::Empty:
TypingCommand::closeTyping(part->lastEditCommand());
......@@ -2638,27 +2638,27 @@ ValueImp *SelectionFunc::callAsFunction(ExecState *exec, ObjectImp *thisObj, con
TypingCommand::closeTyping(part->lastEditCommand());
Position base(toNode(args[0]), args[1]->toInt32(exec));
Position extent(toNode(args[2]), args[3]->toInt32(exec));
part->setSelection(khtml::Selection(base, khtml::SEL_DEFAULT_AFFINITY, extent, khtml::SEL_DEFAULT_AFFINITY));
part->setSelection(khtml::SelectionController(base, khtml::SEL_DEFAULT_AFFINITY, extent, khtml::SEL_DEFAULT_AFFINITY));
break;
}
case Selection::SetPosition:
TypingCommand::closeTyping(part->lastEditCommand());
part->setSelection(khtml::Selection(Position(toNode(args[0]), args[1]->toInt32(exec)), khtml::SEL_DEFAULT_AFFINITY));
part->setSelection(khtml::SelectionController(Position(toNode(args[0]), args[1]->toInt32(exec)), khtml::SEL_DEFAULT_AFFINITY));
break;
case Selection::Modify: {
TypingCommand::closeTyping(part->lastEditCommand());
khtml::Selection s(part->selection());
khtml::Selection::EAlter alter = khtml::Selection::MOVE;
khtml::SelectionController s(part->selection());
khtml::SelectionController::EAlter alter = khtml::SelectionController::MOVE;
if (args[0]->toString(exec).domString().lower() == "extend")
alter = khtml::Selection::EXTEND;
alter = khtml::SelectionController::EXTEND;
DOMString directionString = args[1]->toString(exec).domString().lower();
khtml::Selection::EDirection direction = khtml::Selection::FORWARD;
khtml::SelectionController::EDirection direction = khtml::SelectionController::FORWARD;
if (directionString == "backward")
direction = khtml::Selection::BACKWARD;
direction = khtml::SelectionController::BACKWARD;
else if (directionString == "left")
direction = khtml::Selection::LEFT;
direction = khtml::SelectionController::LEFT;
if (directionString == "right")
direction = khtml::Selection::RIGHT;
direction = khtml::SelectionController::RIGHT;
khtml::ETextGranularity granularity = khtml::CHARACTER;
DOMString granularityString = args[2]->toString(exec).domString().lower();
if (granularityString == "word")
......
......@@ -23,7 +23,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "selection.h"
#include "SelectionController.h"
#include <qevent.h>
#include <qpainter.h>
......@@ -61,47 +61,47 @@ using DOM::RangeImpl;
namespace khtml {
Selection::Selection()
SelectionController::SelectionController()
{
init(DOWNSTREAM);
}
Selection::Selection(const Position &pos, EAffinity affinity)
SelectionController::SelectionController(const Position &pos, EAffinity affinity)
: m_base(pos), m_extent(pos)
{
init(affinity);
validate();
}
Selection::Selection(const RangeImpl *r, EAffinity baseAffinity, EAffinity extentAffinity)
SelectionController::SelectionController(const RangeImpl *r, EAffinity baseAffinity, EAffinity extentAffinity)
: m_base(startPosition(r)), m_extent(endPosition(r))
{
init(baseAffinity);
validate();
}
Selection::Selection(const Position &base, EAffinity baseAffinity, const Position &extent, EAffinity extentAffinity)
SelectionController::SelectionController(const Position &base, EAffinity baseAffinity, const Position &extent, EAffinity extentAffinity)
: m_base(base), m_extent(extent)
{
init(baseAffinity);
validate();
}
Selection::Selection(const VisiblePosition &visiblePos)
SelectionController::SelectionController(const VisiblePosition &visiblePos)
: m_base(visiblePos.position()), m_extent(visiblePos.position())
{
init(visiblePos.affinity());
validate();
}
Selection::Selection(const VisiblePosition &base, const VisiblePosition &extent)
SelectionController::SelectionController(const VisiblePosition &base, const VisiblePosition &extent)
: m_base(base.position()), m_extent(extent.position())
{
init(base.affinity());
validate();
}
Selection::Selection(const Selection &o)
SelectionController::SelectionController(const SelectionController &o)
: m_base(o.m_base), m_extent(o.m_extent)
, m_start(o.m_start), m_end(o.m_end)
, m_state(o.m_state), m_affinity(o.m_affinity)
......@@ -120,7 +120,7 @@ Selection::Selection(const Selection &o)
}
}
void Selection::init(EAffinity affinity)
void SelectionController::init(EAffinity affinity)
{
// FIXME: set extentAffinity
m_state = NONE;
......@@ -130,7 +130,7 @@ void Selection::init(EAffinity affinity)
m_modifyBiasSet = false;
}
Selection &Selection::operator=(const Selection &o)
SelectionController &SelectionController::operator=(const SelectionController &o)
{
m_base = o.m_base;
m_extent = o.m_extent;
......@@ -157,7 +157,7 @@ Selection &Selection::operator=(const Selection &o)
return *this;
}
void Selection::moveTo(const VisiblePosition &pos)
void SelectionController::moveTo(const VisiblePosition &pos)
{
// FIXME: use extentAffinity
m_affinity = pos.affinity();
......@@ -166,7 +166,7 @@ void Selection::moveTo(const VisiblePosition &pos)
validate();
}
void Selection::moveTo(const VisiblePosition &base, const VisiblePosition &extent)
void SelectionController::moveTo(const VisiblePosition &base, const VisiblePosition &extent)
{
// FIXME: use extentAffinity
m_affinity = base.affinity();
......@@ -175,7 +175,7 @@ void Selection::moveTo(const VisiblePosition &base, const VisiblePosition &exten
validate();
}
void Selection::moveTo(const Selection &o)
void SelectionController::moveTo(const SelectionController &o)
{
// FIXME: copy extentAffinity
m_affinity = o.m_affinity;
......@@ -184,7 +184,7 @@ void Selection::moveTo(const Selection &o)
validate();
}
void Selection::moveTo(const Position &pos, EAffinity affinity)
void SelectionController::moveTo(const Position &pos, EAffinity affinity)
{
// FIXME: use extentAffinity
m_affinity = affinity;
......@@ -193,7 +193,7 @@ void Selection::moveTo(const Position &pos, EAffinity affinity)
validate();
}
void Selection::moveTo(const RangeImpl *r, EAffinity baseAffinity, EAffinity extentAffinity)
void SelectionController::moveTo(const RangeImpl *r, EAffinity baseAffinity, EAffinity extentAffinity)
{
// FIXME: use extentAffinity
m_affinity = baseAffinity;
......@@ -202,7 +202,7 @@ void Selection::moveTo(const RangeImpl *r, EAffinity baseAffinity, EAffinity ext
validate();
}
void Selection::moveTo(const Position &base, EAffinity baseAffinity, const Position &extent, EAffinity extentAffinity)
void SelectionController::moveTo(const Position &base, EAffinity baseAffinity, const Position &extent, EAffinity extentAffinity)
{
// FIXME: use extentAffinity
m_affinity = baseAffinity;
......@@ -211,7 +211,7 @@ void Selection::moveTo(const Position &base, EAffinity baseAffinity, const Posit
validate();
}
void Selection::setModifyBias(EAlter alter, EDirection direction)
void SelectionController::setModifyBias(EAlter alter, EDirection direction)
{
switch (alter) {
case MOVE:
......@@ -238,7 +238,7 @@ void Selection::setModifyBias(EAlter alter, EDirection direction)
}
}
VisiblePosition Selection::modifyExtendingRightForward(ETextGranularity granularity)
VisiblePosition SelectionController::modifyExtendingRightForward(ETextGranularity granularity)
{
VisiblePosition pos(m_extent, m_affinity);
switch (granularity) {
......@@ -268,7 +268,7 @@ VisiblePosition Selection::modifyExtendingRightForward(ETextGranularity granular
return pos;
}
VisiblePosition Selection::modifyMovingRightForward(ETextGranularity granularity)
VisiblePosition SelectionController::modifyMovingRightForward(ETextGranularity granularity)
{
VisiblePosition pos;
switch (granularity) {
......@@ -305,7 +305,7 @@ VisiblePosition Selection::modifyMovingRightForward(ETextGranularity granularity
return pos;
}
VisiblePosition Selection::modifyExtendingLeftBackward(ETextGranularity granularity)
VisiblePosition SelectionController::modifyExtendingLeftBackward(ETextGranularity granularity)
{
VisiblePosition pos(m_extent, m_affinity);
switch (granularity) {
......@@ -334,7 +334,7 @@ VisiblePosition Selection::modifyExtendingLeftBackward(ETextGranularity granular
return pos;
}
VisiblePosition Selection::modifyMovingLeftBackward(ETextGranularity granularity)
VisiblePosition SelectionController::modifyMovingLeftBackward(ETextGranularity granularity)
{
VisiblePosition pos;
switch (granularity) {
......@@ -366,7 +366,7 @@ VisiblePosition Selection::modifyMovingLeftBackward(ETextGranularity granularity
return pos;
}
bool Selection::modify(EAlter alter, EDirection dir, ETextGranularity granularity)
bool SelectionController::modify(EAlter alter, EDirection dir, ETextGranularity granularity)
{
setModifyBias(alter, dir);
......@@ -423,7 +423,7 @@ static bool caretY(const VisiblePosition &c, int &y)
return true;
}
bool Selection::modify(EAlter alter, int verticalDistance)
bool SelectionController::modify(EAlter alter, int verticalDistance)
{
if (verticalDistance == 0)
return false;
......@@ -490,7 +490,7 @@ bool Selection::modify(EAlter alter, int verticalDistance)
return true;
}
bool Selection::expandUsingGranularity(ETextGranularity granularity)
bool SelectionController::expandUsingGranularity(ETextGranularity granularity)
{
if (isNone())
return false;
......@@ -498,7 +498,7 @@ bool Selection::expandUsingGranularity(ETextGranularity granularity)
return true;
}
int Selection::xPosForVerticalArrowNavigation(EPositionType type, bool recalc) const
int SelectionController::xPosForVerticalArrowNavigation(EPositionType type, bool recalc) const
{
int x = 0;
......@@ -543,7 +543,7 @@ int Selection::xPosForVerticalArrowNavigation(EPositionType type, bool recalc) c
return x;
}
void Selection::clear()
void SelectionController::clear()
{
m_affinity = SEL_DEFAULT_AFFINITY;
m_base.clear();
......@@ -551,21 +551,21 @@ void Selection::clear()
validate();
}
void Selection::setBase(const VisiblePosition &pos)
void SelectionController::setBase(const VisiblePosition &pos)
{
m_affinity = pos.affinity();
m_base = pos.deepEquivalent();
validate();
}
void Selection::setExtent(const VisiblePosition &pos)
void SelectionController::setExtent(const VisiblePosition &pos)
{
// FIXME: Support extentAffinity
m_extent = pos.deepEquivalent();
validate();
}
void Selection::setBaseAndExtent(const VisiblePosition &base, const VisiblePosition &extent)
void SelectionController::setBaseAndExtent(const VisiblePosition &base, const VisiblePosition &extent)
{
// FIXME: Support extentAffinity
m_affinity = base.affinity();
......@@ -575,14 +575,14 @@ void Selection::setBaseAndExtent(const VisiblePosition &base, const VisiblePosit
}
void Selection::setBase(const Position &pos, EAffinity baseAffinity)
void SelectionController::setBase(const Position &pos, EAffinity baseAffinity)
{
m_affinity = baseAffinity;
m_base = pos;
validate();
}
void Selection::setExtent(const Position &pos, EAffinity extentAffinity)
void SelectionController::setExtent(const Position &pos, EAffinity extentAffinity)
{
// FIXME: Support extentAffinity for real
m_affinity = extentAffinity;
......@@ -590,7 +590,7 @@ void Selection::setExtent(const Position &pos, EAffinity extentAffinity)
validate();
}
void Selection::setBaseAndExtent(const Position &base, EAffinity baseAffinity, const Position &extent, EAffinity extentAffinity)
void SelectionController::setBaseAndExtent(const Position &base, EAffinity baseAffinity, const Position &extent, EAffinity extentAffinity)
{
// FIXME: extentAffinity
m_affinity = baseAffinity;
......@@ -599,12 +599,12 @@ void Selection::setBaseAndExtent(const Position &base, EAffinity baseAffinity, c
validate();
}
void Selection::setNeedsLayout(bool flag)
void SelectionController::setNeedsLayout(bool flag)
{
m_needsLayout = flag;
}
SharedPtr<RangeImpl> Selection::toRange() const
SharedPtr<RangeImpl> SelectionController::toRange() const
{
if (isNone())
return SharedPtr<RangeImpl>();
......@@ -653,18 +653,18 @@ SharedPtr<RangeImpl> Selection::toRange() const
SharedPtr<RangeImpl> result(new RangeImpl(s.node()->docPtr()));
result->setStart(s.node(), s.offset(), exceptionCode);
if (exceptionCode) {
ERROR("Exception setting Range start from Selection: %d", exceptionCode);
ERROR("Exception setting Range start from SelectionController: %d", exceptionCode);
return SharedPtr<RangeImpl>();
}
result->setEnd(e.node(), e.offset(), exceptionCode);
if (exceptionCode) {
ERROR("Exception setting Range end from Selection: %d", exceptionCode);
ERROR("Exception setting Range end from SelectionController: %d", exceptionCode);
return SharedPtr<RangeImpl>();
}
return result;
}
void Selection::layout()
void SelectionController::layout()
{
if (isNone() || !m_start.node()->inDocument() || !m_end.node()->inDocument()) {
m_caretRect = QRect();
......@@ -714,25 +714,25 @@ void Selection::layout()
m_needsLayout = false;
}
QRect Selection::caretRect() const
QRect SelectionController::caretRect() const
{
if (m_needsLayout) {
const_cast<Selection *>(this)->layout();
const_cast<SelectionController *>(this)->layout();
}
return m_caretRect;
}
QRect Selection::expectedVisibleRect() const
QRect SelectionController::expectedVisibleRect() const
{
if (m_needsLayout) {
const_cast<Selection *>(this)->layout();
const_cast<SelectionController *>(this)->layout();
}
return m_expectedVisibleRect;
}
QRect Selection::caretRepaintRect() const
QRect SelectionController::caretRepaintRect() const
{
// FIXME: Add one pixel of slop on each side to make sure we don't leave behind artifacts.
QRect r = caretRect();
......@@ -741,7 +741,7 @@ QRect Selection::caretRepaintRect() const
return QRect(r.left() - 1, r.top() - 1, r.width() + 2, r.height() + 2);
}
void Selection::needsCaretRepaint()
void SelectionController::needsCaretRepaint()
{
if (!isCaret())
return;
......@@ -774,7 +774,7 @@ void Selection::needsCaretRepaint()
v->updateContents(caretRepaintRect(), false);
}
void Selection::paintCaret(QPainter *p, const QRect &rect)
void SelectionController::paintCaret(QPainter *p, const QRect &rect)
{
if (m_state != CARET)
return;
......@@ -786,7 +786,7 @@ void Selection::paintCaret(QPainter *p, const QRect &rect)
p->fillRect(m_caretRect & rect, QBrush());
}
void Selection::validate(ETextGranularity granularity)
void SelectionController::validate(ETextGranularity granularity)
{
// Move the selection to rendered positions, if possible.
Position originalBase(m_base);
......@@ -933,7 +933,7 @@ void Selection::validate(ETextGranularity granularity)
#endif
}
void Selection::debugRenderer(RenderObject *r, bool selected) const
void SelectionController::debugRenderer(RenderObject *r, bool selected) const
{
if (r->node()->isElementNode()) {
ElementImpl *element = static_cast<ElementImpl *>(r->node());
......@@ -1006,7 +1006,7 @@ void Selection::debugRenderer(RenderObject *r, bool selected) const
}
}
void Selection::debugPosition() const
void SelectionController::debugPosition() const
{
if (!m_start.node())
return;
......@@ -1015,18 +1015,18 @@ void Selection::debugPosition() const
//RenderObject *r = 0;
fprintf(stderr, "Selection =================\n");
fprintf(stderr, "SelectionController =================\n");
if (m_start == m_end) {
Position pos = m_start;
fprintf(stderr, "pos: %s %p:%d\n", pos.node()->nodeName().qstring().latin1(), pos.node(), pos.offset());
fprintf(stderr, "pos: %s %p:%ld\n", pos.node()->nodeName().qstring().latin1(), pos.node(), pos.offset());
}
else {
Position pos = m_start;