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

Side by Side Diff: third_party/WebKit/Source/core/editing/Position.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2009 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 template <typename Strategy> 43 template <typename Strategy>
44 const TreeScope* PositionTemplate<Strategy>::commonAncestorTreeScope(const Posit ionTemplate<Strategy>& a, const PositionTemplate<Strategy>& b) 44 const TreeScope* PositionTemplate<Strategy>::commonAncestorTreeScope(const Posit ionTemplate<Strategy>& a, const PositionTemplate<Strategy>& b)
45 { 45 {
46 if (!a.computeContainerNode() || !b.computeContainerNode()) 46 if (!a.computeContainerNode() || !b.computeContainerNode())
47 return nullptr; 47 return nullptr;
48 return a.computeContainerNode()->treeScope().commonAncestorTreeScope(b.compu teContainerNode()->treeScope()); 48 return a.computeContainerNode()->treeScope().commonAncestorTreeScope(b.compu teContainerNode()->treeScope());
49 } 49 }
50 50
51 51
52 template <typename Strategy> 52 template <typename Strategy>
53 PositionTemplate<Strategy> PositionTemplate<Strategy>::editingPositionOf(PassRef PtrWillBeRawPtr<Node> anchorNode, int offset) 53 PositionTemplate<Strategy> PositionTemplate<Strategy>::editingPositionOf(RawPtr< Node> anchorNode, int offset)
54 { 54 {
55 if (!anchorNode || anchorNode->isTextNode()) 55 if (!anchorNode || anchorNode->isTextNode())
56 return PositionTemplate<Strategy>(anchorNode, offset); 56 return PositionTemplate<Strategy>(anchorNode, offset);
57 57
58 if (!Strategy::editingIgnoresContent(anchorNode.get())) 58 if (!Strategy::editingIgnoresContent(anchorNode.get()))
59 return PositionTemplate<Strategy>(anchorNode, offset); 59 return PositionTemplate<Strategy>(anchorNode, offset);
60 60
61 if (offset == 0) 61 if (offset == 0)
62 return PositionTemplate<Strategy>(anchorNode, PositionAnchorType::Before Anchor); 62 return PositionTemplate<Strategy>(anchorNode, PositionAnchorType::Before Anchor);
63 63
64 // Note: |offset| can be >= 1, if |anchorNode| have child nodes, e.g. 64 // Note: |offset| can be >= 1, if |anchorNode| have child nodes, e.g.
65 // using Node.appendChild() to add a child node TEXTAREA. 65 // using Node.appendChild() to add a child node TEXTAREA.
66 ASSERT(offset >= 1); 66 ASSERT(offset >= 1);
67 return PositionTemplate<Strategy>(anchorNode, PositionAnchorType::AfterAncho r); 67 return PositionTemplate<Strategy>(anchorNode, PositionAnchorType::AfterAncho r);
68 } 68 }
69 69
70 template <typename Strategy> 70 template <typename Strategy>
71 PositionTemplate<Strategy>::PositionTemplate(PassRefPtrWillBeRawPtr<Node> anchor Node, PositionAnchorType anchorType) 71 PositionTemplate<Strategy>::PositionTemplate(RawPtr<Node> anchorNode, PositionAn chorType anchorType)
72 : m_anchorNode(anchorNode) 72 : m_anchorNode(anchorNode)
73 , m_offset(0) 73 , m_offset(0)
74 , m_anchorType(anchorType) 74 , m_anchorType(anchorType)
75 { 75 {
76 if (!m_anchorNode) { 76 if (!m_anchorNode) {
77 m_anchorType = PositionAnchorType::OffsetInAnchor; 77 m_anchorType = PositionAnchorType::OffsetInAnchor;
78 return; 78 return;
79 } 79 }
80 if (m_anchorNode->isTextNode()) { 80 if (m_anchorNode->isTextNode()) {
81 ASSERT(m_anchorType == PositionAnchorType::BeforeAnchor || m_anchorType == PositionAnchorType::AfterAnchor); 81 ASSERT(m_anchorType == PositionAnchorType::BeforeAnchor || m_anchorType == PositionAnchorType::AfterAnchor);
82 return; 82 return;
83 } 83 }
84 ASSERT(canBeAnchorNode(m_anchorNode.get())); 84 ASSERT(canBeAnchorNode(m_anchorNode.get()));
85 ASSERT(m_anchorType != PositionAnchorType::OffsetInAnchor); 85 ASSERT(m_anchorType != PositionAnchorType::OffsetInAnchor);
86 } 86 }
87 87
88 template <typename Strategy> 88 template <typename Strategy>
89 PositionTemplate<Strategy>::PositionTemplate(PassRefPtrWillBeRawPtr<Node> anchor Node, int offset) 89 PositionTemplate<Strategy>::PositionTemplate(RawPtr<Node> anchorNode, int offset )
90 : m_anchorNode(anchorNode) 90 : m_anchorNode(anchorNode)
91 , m_offset(offset) 91 , m_offset(offset)
92 , m_anchorType(PositionAnchorType::OffsetInAnchor) 92 , m_anchorType(PositionAnchorType::OffsetInAnchor)
93 { 93 {
94 if (m_anchorNode) 94 if (m_anchorNode)
95 ASSERT(offset >= 0); 95 ASSERT(offset >= 0);
96 else 96 else
97 ASSERT(offset == 0); 97 ASSERT(offset == 0);
98 ASSERT(canBeAnchorNode(m_anchorNode.get())); 98 ASSERT(canBeAnchorNode(m_anchorNode.get()));
99 } 99 }
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 537
538 void showTree(const blink::Position* pos) 538 void showTree(const blink::Position* pos)
539 { 539 {
540 if (pos) 540 if (pos)
541 pos->showTreeForThis(); 541 pos->showTreeForThis();
542 else 542 else
543 fprintf(stderr, "Cannot showTree for (nil)\n"); 543 fprintf(stderr, "Cannot showTree for (nil)\n");
544 } 544 }
545 545
546 #endif 546 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/Position.h ('k') | third_party/WebKit/Source/core/editing/PositionIterator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698