Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Side by Side Diff: Source/core/editing/VisiblePosition.h

Issue 15017002: WebFrame::selectRange and moveCaret should behave like mouse selection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 28 matching lines...) Expand all
39 #define VP_DEFAULT_AFFINITY DOWNSTREAM 39 #define VP_DEFAULT_AFFINITY DOWNSTREAM
40 40
41 // Callers who do not know where on the line the position is, 41 // Callers who do not know where on the line the position is,
42 // but would like UPSTREAM if at a line break or DOWNSTREAM 42 // but would like UPSTREAM if at a line break or DOWNSTREAM
43 // otherwise, need a clear way to specify that. The 43 // otherwise, need a clear way to specify that. The
44 // constructors auto-correct UPSTREAM to DOWNSTREAM if the 44 // constructors auto-correct UPSTREAM to DOWNSTREAM if the
45 // position is not at a line break. 45 // position is not at a line break.
46 #define VP_UPSTREAM_IF_POSSIBLE UPSTREAM 46 #define VP_UPSTREAM_IF_POSSIBLE UPSTREAM
47 47
48 class InlineBox; 48 class InlineBox;
49 class LayoutPoint;
49 class Node; 50 class Node;
51 class VisibleSelection;
50 52
51 class VisiblePosition { 53 class VisiblePosition {
52 public: 54 public:
53 // NOTE: UPSTREAM affinity will be used only if pos is at end of a wrapped l ine, 55 // NOTE: UPSTREAM affinity will be used only if pos is at end of a wrapped l ine,
54 // otherwise it will be converted to DOWNSTREAM 56 // otherwise it will be converted to DOWNSTREAM
55 VisiblePosition() : m_affinity(VP_DEFAULT_AFFINITY) { } 57 VisiblePosition() : m_affinity(VP_DEFAULT_AFFINITY) { }
56 VisiblePosition(const Position&, EAffinity = VP_DEFAULT_AFFINITY); 58 VisiblePosition(const Position&, EAffinity = VP_DEFAULT_AFFINITY);
57 59
58 void clear() { m_deepPosition.clear(); } 60 void clear() { m_deepPosition.clear(); }
59 61
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 bool setStart(Range*, const VisiblePosition&); 134 bool setStart(Range*, const VisiblePosition&);
133 bool setEnd(Range*, const VisiblePosition&); 135 bool setEnd(Range*, const VisiblePosition&);
134 VisiblePosition startVisiblePosition(const Range*, EAffinity); 136 VisiblePosition startVisiblePosition(const Range*, EAffinity);
135 VisiblePosition endVisiblePosition(const Range*, EAffinity); 137 VisiblePosition endVisiblePosition(const Range*, EAffinity);
136 138
137 Element* enclosingBlockFlowElement(const VisiblePosition&); 139 Element* enclosingBlockFlowElement(const VisiblePosition&);
138 140
139 bool isFirstVisiblePositionInNode(const VisiblePosition&, const Node*); 141 bool isFirstVisiblePositionInNode(const VisiblePosition&, const Node*);
140 bool isLastVisiblePositionInNode(const VisiblePosition&, const Node*); 142 bool isLastVisiblePositionInNode(const VisiblePosition&, const Node*);
141 143
144 VisiblePosition visiblePositionRespectingEditingBoundary(const VisibleSelection& currentSelection, const LayoutPoint& localPoint, Node* targetNode);
leviw_travelin_and_unemployed 2013/05/21 19:21:40 The dependency on VisibleSelection here is wrong.
cjhopman 2013/05/22 23:45:10 Done.
145
142 } // namespace WebCore 146 } // namespace WebCore
143 147
144 #ifndef NDEBUG 148 #ifndef NDEBUG
145 // Outside the WebCore namespace for ease of invocation from gdb. 149 // Outside the WebCore namespace for ease of invocation from gdb.
146 void showTree(const WebCore::VisiblePosition*); 150 void showTree(const WebCore::VisiblePosition*);
147 void showTree(const WebCore::VisiblePosition&); 151 void showTree(const WebCore::VisiblePosition&);
148 #endif 152 #endif
149 153
150 #endif // VisiblePosition_h 154 #endif // VisiblePosition_h
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/tests/data/select_range_span_editable.html ('k') | Source/core/editing/VisiblePosition.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698