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

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

Issue 319083004: Oilpan: add Element/Node Member fields to stack allocated objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | Source/core/dom/PositionIterator.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) 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 17 matching lines...) Expand all
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 // A Position iterator with constant-time 34 // A Position iterator with constant-time
35 // increment, decrement, and several predicates on the Position it is at. 35 // increment, decrement, and several predicates on the Position it is at.
36 // Conversion to/from Position is O(n) in the offset. 36 // Conversion to/from Position is O(n) in the offset.
37 class PositionIterator { 37 class PositionIterator {
38 STACK_ALLOCATED();
38 public: 39 public:
39 PositionIterator() 40 PositionIterator()
40 : m_anchorNode(0) 41 : m_anchorNode(nullptr)
41 , m_nodeAfterPositionInAnchor(0) 42 , m_nodeAfterPositionInAnchor(nullptr)
42 , m_offsetInAnchor(0) 43 , m_offsetInAnchor(0)
43 { 44 {
44 } 45 }
45 46
46 PositionIterator(const Position& pos) 47 PositionIterator(const Position& pos)
47 : m_anchorNode(pos.anchorNode()) 48 : m_anchorNode(pos.anchorNode())
48 , m_nodeAfterPositionInAnchor(m_anchorNode->traverseToChildAt(pos.deprec atedEditingOffset())) 49 , m_nodeAfterPositionInAnchor(m_anchorNode->traverseToChildAt(pos.deprec atedEditingOffset()))
49 , m_offsetInAnchor(m_nodeAfterPositionInAnchor ? 0 : pos.deprecatedEditi ngOffset()) 50 , m_offsetInAnchor(m_nodeAfterPositionInAnchor ? 0 : pos.deprecatedEditi ngOffset())
50 { 51 {
51 } 52 }
52 operator Position() const; 53 operator Position() const;
53 54
54 void increment(); 55 void increment();
55 void decrement(); 56 void decrement();
56 57
57 Node* node() const { return m_anchorNode; } 58 Node* node() const { return m_anchorNode; }
58 int offsetInLeafNode() const { return m_offsetInAnchor; } 59 int offsetInLeafNode() const { return m_offsetInAnchor; }
59 60
60 bool atStart() const; 61 bool atStart() const;
61 bool atEnd() const; 62 bool atEnd() const;
62 bool atStartOfNode() const; 63 bool atStartOfNode() const;
63 bool atEndOfNode() const; 64 bool atEndOfNode() const;
64 bool isCandidate() const; 65 bool isCandidate() const;
65 66
66 private: 67 private:
67 Node* m_anchorNode; 68 RawPtrWillBeMember<Node> m_anchorNode;
68 Node* m_nodeAfterPositionInAnchor; // If this is non-null, m_nodeAfterPositi onInAnchor->parentNode() == m_anchorNode; 69 RawPtrWillBeMember<Node> m_nodeAfterPositionInAnchor; // If this is non-null , m_nodeAfterPositionInAnchor->parentNode() == m_anchorNode;
69 int m_offsetInAnchor; 70 int m_offsetInAnchor;
70 }; 71 };
71 72
72 } // namespace WebCore 73 } // namespace WebCore
73 74
74 #endif // PositionIterator_h 75 #endif // PositionIterator_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/PositionIterator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698