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

Side by Side Diff: Source/core/dom/PositionIterator.h

Issue 20681004: Make first-letter style to work with editing Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 2013-09-20T18:27:32 Created 7 years, 3 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) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 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 13 matching lines...) Expand all
24 */ 24 */
25 25
26 #ifndef PositionIterator_h 26 #ifndef PositionIterator_h
27 #define PositionIterator_h 27 #define PositionIterator_h
28 28
29 #include "core/dom/Node.h" 29 #include "core/dom/Node.h"
30 #include "core/dom/Position.h" 30 #include "core/dom/Position.h"
31 31
32 namespace WebCore { 32 namespace WebCore {
33 33
34 class RenderObject;
35
34 // A Position iterator with constant-time 36 // A Position iterator with constant-time
35 // increment, decrement, and several predicates on the Position it is at. 37 // increment, decrement, and several predicates on the Position it is at.
36 // Conversion to/from Position is O(n) in the offset. 38 // Conversion to/from Position is O(n) in the offset.
37 class PositionIterator { 39 class PositionIterator {
38 public: 40 public:
39 PositionIterator() 41 PositionIterator()
40 : m_anchorNode(0) 42 : m_anchorNode(0)
41 , m_nodeAfterPositionInAnchor(0) 43 , m_nodeAfterPositionInAnchor(0)
42 , m_offsetInAnchor(0) 44 , m_offsetInAnchor(0)
43 { 45 {
44 } 46 }
45 47
46 PositionIterator(const Position& pos) 48 PositionIterator(const Position& pos)
47 : m_anchorNode(pos.anchorNode()) 49 : m_anchorNode(pos.anchorNode())
48 , m_nodeAfterPositionInAnchor(m_anchorNode->childNode(pos.deprecatedEdit ingOffset())) 50 , m_nodeAfterPositionInAnchor(m_anchorNode->childNode(pos.deprecatedEdit ingOffset()))
49 , m_offsetInAnchor(m_nodeAfterPositionInAnchor ? 0 : pos.deprecatedEditi ngOffset()) 51 , m_offsetInAnchor(m_nodeAfterPositionInAnchor ? 0 : pos.deprecatedEditi ngOffset())
50 { 52 {
51 } 53 }
52 operator Position() const; 54 operator Position() const;
53 55
54 void increment(); 56 void increment();
55 void decrement(); 57 void decrement();
56 58
57 Node* node() const { return m_anchorNode; } 59 Node* node() const { return m_anchorNode; }
58 int offsetInLeafNode() const { return m_offsetInAnchor; } 60 int offsetInLeafNode() const { return m_offsetInAnchor; }
61 RenderObject* renderer() const;
59 62
60 bool atStart() const; 63 bool atStart() const;
61 bool atEnd() const; 64 bool atEnd() const;
62 bool atStartOfNode() const; 65 bool atStartOfNode() const;
63 bool atEndOfNode() const; 66 bool atEndOfNode() const;
64 bool isCandidate() const; 67 bool isCandidate() const;
65 68
66 private: 69 private:
67 Node* m_anchorNode; 70 Node* m_anchorNode;
68 Node* m_nodeAfterPositionInAnchor; // If this is non-null, m_nodeAfterPositi onInAnchor->parentNode() == m_anchorNode; 71 Node* m_nodeAfterPositionInAnchor; // If this is non-null, m_nodeAfterPositi onInAnchor->parentNode() == m_anchorNode;
69 int m_offsetInAnchor; 72 int m_offsetInAnchor;
70 }; 73 };
71 74
72 } // namespace WebCore 75 } // namespace WebCore
73 76
74 #endif // PositionIterator_h 77 #endif // PositionIterator_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698