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

Side by Side Diff: third_party/WebKit/WebCore/dom/Position.h

Issue 21165: Revert the merge. Mac build is mysteriously broken. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 10 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
« no previous file with comments | « third_party/WebKit/WebCore/dom/Node.idl ('k') | third_party/WebKit/WebCore/dom/Position.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 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 22 matching lines...) Expand all
33 33
34 namespace WebCore { 34 namespace WebCore {
35 35
36 class CSSComputedStyleDeclaration; 36 class CSSComputedStyleDeclaration;
37 class Element; 37 class Element;
38 class InlineBox; 38 class InlineBox;
39 class Node; 39 class Node;
40 class Range; 40 class Range;
41 class RenderObject; 41 class RenderObject;
42 42
43 enum PositionMoveType { 43 enum EUsingComposedCharacters { NotUsingComposedCharacters = false, UsingCompose dCharacters = true };
44 CodePoint, // Move by a single code point.
45 Character, // Move to the next Unicode character break.
46 BackwardDeletion // Subject to platform conventions.
47 };
48 44
49 // FIXME: Reduce the number of operations we have on a Position. 45 // FIXME: Reduce the number of operations we have on a Position.
50 // This should be more like a humble struct, without so many different 46 // This should be more like a humble struct, without so many different
51 // member functions. We should find better homes for these functions. 47 // member functions. We should find better homes for these functions.
52 48
53 class Position { 49 class Position {
54 public: 50 public:
55 RefPtr<Node> container; 51 RefPtr<Node> container;
56 int posOffset; // to be renamed to offset when we get rid of offset() 52 int posOffset; // to be renamed to offset when we get rid of offset()
57 53
58 Position() : posOffset(0) { } 54 Position() : posOffset(0) { }
59 Position(PassRefPtr<Node> c, int o) : container(c), posOffset(o) { } 55 Position(PassRefPtr<Node> c, int o) : container(c), posOffset(o) { }
60 56
61 void clear() { container.clear(); posOffset = 0; } 57 void clear() { container.clear(); posOffset = 0; }
62 58
63 Node* node() const { return container.get(); } 59 Node* node() const { return container.get(); }
64 int offset() const { return posOffset; } 60 int offset() const { return posOffset; }
65 Element* documentElement() const; 61 Element* documentElement() const;
66 62
67 bool isNull() const { return !container; } 63 bool isNull() const { return !container; }
68 bool isNotNull() const { return container; } 64 bool isNotNull() const { return container; }
69 65
70 Element* element() const; 66 Element* element() const;
71 PassRefPtr<CSSComputedStyleDeclaration> computedStyle() const; 67 PassRefPtr<CSSComputedStyleDeclaration> computedStyle() const;
72 68
73 // Move up or down the DOM by one position. 69 // Move up or down the DOM by one position.
74 // Offsets are computed using render text for nodes that have renderers - bu t note that even when 70 // Offsets are computed using render text for nodes that have renderers - bu t note that even when
75 // using composed characters, the result may be inside a single user-visible character if a ligature is formed. 71 // using composed characters, the result may be inside a single user-visible character if a ligature is formed.
76 Position previous(PositionMoveType = CodePoint) const; 72 Position previous(EUsingComposedCharacters usingComposedCharacters=NotUsingC omposedCharacters) const;
77 Position next(PositionMoveType = CodePoint) const; 73 Position next(EUsingComposedCharacters usingComposedCharacters=NotUsingCompo sedCharacters) const;
78 static int uncheckedPreviousOffset(const Node*, int current); 74 static int uncheckedPreviousOffset(const Node*, int current);
79 static int uncheckedPreviousOffsetForBackwardDeletion(const Node*, int curre nt);
80 static int uncheckedNextOffset(const Node*, int current); 75 static int uncheckedNextOffset(const Node*, int current);
81 76
82 bool atStart() const; 77 bool atStart() const;
83 bool atEnd() const; 78 bool atEnd() const;
84 79
85 // FIXME: Make these non-member functions and put them somewhere in the edit ing directory. 80 // FIXME: Make these non-member functions and put them somewhere in the edit ing directory.
86 // These aren't really basic "position" operations. More high level editing helper functions. 81 // These aren't really basic "position" operations. More high level editing helper functions.
87 Position leadingWhitespacePosition(EAffinity, bool considerNonCollapsibleWhi tespace = false) const; 82 Position leadingWhitespacePosition(EAffinity, bool considerNonCollapsibleWhi tespace = false) const;
88 Position trailingWhitespacePosition(EAffinity, bool considerNonCollapsibleWh itespace = false) const; 83 Position trailingWhitespacePosition(EAffinity, bool considerNonCollapsibleWh itespace = false) const;
89 84
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 126
132 } // namespace WebCore 127 } // namespace WebCore
133 128
134 #ifndef NDEBUG 129 #ifndef NDEBUG
135 // Outside the WebCore namespace for ease of invocation from gdb. 130 // Outside the WebCore namespace for ease of invocation from gdb.
136 void showTree(const WebCore::Position&); 131 void showTree(const WebCore::Position&);
137 void showTree(const WebCore::Position*); 132 void showTree(const WebCore::Position*);
138 #endif 133 #endif
139 134
140 #endif // Position_h 135 #endif // Position_h
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/dom/Node.idl ('k') | third_party/WebKit/WebCore/dom/Position.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698