Commit e4b01dd1 authored by darin's avatar darin

Reviewed by Ken.

        - added new VisibleRange class; not used yet

        * WebCore.pbproj/project.pbxproj: Added visible_range.h and visible_range.cpp.
        * khtml/editing/visible_range.cpp: Added.
        * khtml/editing/visible_range.h: Added.

        - tweaks

        * kwq/WebCoreBridge.mm: (-[WebCoreBridge alterCurrentSelection:direction:granularity:]):
        Use switch statement instead of if statement so we get a warning if we ever add a new
        granularity.

        * khtml/editing/selection.h: khtml, not DOM, namespace
        * khtml/editing/visible_position.h: Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@7654 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7da66ce9
2004-09-23 Darin Adler <darin@apple.com>
Reviewed by Ken.
- added new VisibleRange class; not used yet
* WebCore.pbproj/project.pbxproj: Added visible_range.h and visible_range.cpp.
* khtml/editing/visible_range.cpp: Added.
* khtml/editing/visible_range.h: Added.
- tweaks
* kwq/WebCoreBridge.mm: (-[WebCoreBridge alterCurrentSelection:direction:granularity:]):
Use switch statement instead of if statement so we get a warning if we ever add a new
granularity.
* khtml/editing/selection.h: khtml, not DOM, namespace
* khtml/editing/visible_position.h: Ditto.
2004-09-23 Darin Adler <darin@apple.com>
Reviewed by Ken.
......@@ -538,6 +538,7 @@
93ABE073070285F600BD91F9,
93ABE075070285F600BD91F9,
932B9835070297DC0032804F,
939FF8EF0702B1B100979E5E,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
......@@ -828,6 +829,7 @@
93ABE070070285F600BD91F9,
93ABE072070285F600BD91F9,
93ABE074070285F600BD91F9,
939FF8EE0702B1B100979E5E,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
......@@ -2044,6 +2046,36 @@
settings = {
};
};
939FF8EC0702B1B100979E5E = {
fileEncoding = 4;
isa = PBXFileReference;
lastKnownFileType = sourcecode.cpp.cpp;
name = visible_range.cpp;
path = editing/visible_range.cpp;
refType = 4;
sourceTree = "<group>";
};
939FF8ED0702B1B100979E5E = {
fileEncoding = 4;
isa = PBXFileReference;
lastKnownFileType = sourcecode.c.h;
name = visible_range.h;
path = editing/visible_range.h;
refType = 4;
sourceTree = "<group>";
};
939FF8EE0702B1B100979E5E = {
fileRef = 939FF8EC0702B1B100979E5E;
isa = PBXBuildFile;
settings = {
};
};
939FF8EF0702B1B100979E5E = {
fileRef = 939FF8ED0702B1B100979E5E;
isa = PBXBuildFile;
settings = {
};
};
93ABCE5D06E1A42E0085925B = {
fileEncoding = 30;
isa = PBXFileReference;
......@@ -3459,6 +3491,8 @@
932B9834070297DC0032804F,
93ABE069070285F600BD91F9,
93ABE068070285F600BD91F9,
939FF8ED0702B1B100979E5E,
939FF8EC0702B1B100979E5E,
93ABE06B070285F600BD91F9,
93ABE06A070285F600BD91F9,
93ABE06D070285F600BD91F9,
......
......@@ -157,6 +157,6 @@ inline bool operator!=(const Selection &a, const Selection &b)
return !(a == b);
}
} // namespace DOM
} // namespace khtml
#endif // KHTML_EDITING_SELECTION_H
......@@ -157,6 +157,6 @@ inline bool operator!=(const Selection &a, const Selection &b)
return !(a == b);
}
} // namespace DOM
} // namespace khtml
#endif // KHTML_EDITING_SELECTION_H
......@@ -53,7 +53,7 @@ public:
Position position() const { return rangeCompliantEquivalent(m_deepPosition); }
Position deepEquivalent() const { return m_deepPosition; }
friend inline bool operator==(const VisiblePosition &a, const VisiblePosition &b);
friend bool operator==(const VisiblePosition &a, const VisiblePosition &b);
VisiblePosition next() const;
VisiblePosition previous() const;
......@@ -109,6 +109,6 @@ VisiblePosition startVisiblePosition(const DOM::RangeImpl *);
VisiblePosition endVisiblePosition(const DOM::Range &);
VisiblePosition endVisiblePosition(const DOM::RangeImpl *);
} // namespace DOM
} // namespace khtml
#endif // KHTML_EDITING_VISIBLE_POSITION_H
/*
* Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "visible_range.h"
/*
* Copyright (C) 2004 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef KHTML_EDITING_VISIBLE_RANGE_H
#define KHTML_EDITING_VISIBLE_RANGE_H
#include "visible_position.h"
namespace khtml {
class VisibleRange
{
public:
typedef DOM::NodeImpl NodeImpl;
typedef DOM::Position Position;
typedef DOM::Range Range;
VisibleRange() { }
VisibleRange(NodeImpl *startContainer, long startOffset, NodeImpl *endContainer, long endOffset);
VisibleRange(const VisiblePosition &);
VisibleRange(const VisiblePosition &, const VisiblePosition &);
VisibleRange(const Range &);
VisibleRange(const Position &);
VisibleRange(const Position &, const Position &);
VisibleRange &operator=(const VisiblePosition &);
VisibleRange &operator=(const Range &);
VisibleRange &operator=(const Position &);
VisiblePosition start() const { return m_start; }
VisiblePosition end() const { return m_end; }
Range range() const;
void clear() { m_start.clear(); m_end.clear(); }
bool isNull() const { return m_start.isNull(); }
bool isCollapsed() const { return m_start == m_end; }
friend inline bool operator==(const VisiblePosition &a, const VisiblePosition &b);
private:
VisiblePosition m_start;
VisiblePosition m_end;
};
inline bool operator==(const VisibleRange &a, const VisibleRange &b)
{
return a.start() == b.start() && a.end() == b.end();
}
inline bool operator!=(const VisibleRange &a, const VisibleRange &b)
{
return !(a == b);
}
} // namespace khtml
#endif
......@@ -1379,10 +1379,21 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
static_cast<Selection::EDirection>(direction),
static_cast<ETextGranularity>(granularity));
// save vertical navigation x position if necessary
// save vertical navigation x position if necessary; many types of motion blow it away
int xPos = KHTMLPart::NoXPosForVerticalArrowNavigation;
if (granularity == WebSelectByLine || granularity == WebSelectByParagraph)
xPos = _part->xPosForVerticalArrowNavigation();
switch (granularity) {
case WebSelectByLine:
case WebSelectByParagraph:
xPos = _part->xPosForVerticalArrowNavigation();
break;
case WebSelectByCharacter:
case WebSelectByWord:
case WebSelectToLineBoundary:
case WebSelectToParagraphBoundary:
case WebSelectToDocumentBoundary:
break;
}
// setting the selection always clears saved vertical navigation x position
_part->setSelection(selection);
......
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