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

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, 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
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 template <typename Strategy> 45 template <typename Strategy>
46 const TreeScope* PositionTemplate<Strategy>::commonAncestorTreeScope(const Posit ionTemplate<Strategy>& a, const PositionTemplate<Strategy>& b) 46 const TreeScope* PositionTemplate<Strategy>::commonAncestorTreeScope(const Posit ionTemplate<Strategy>& a, const PositionTemplate<Strategy>& b)
47 { 47 {
48 if (!a.computeContainerNode() || !b.computeContainerNode()) 48 if (!a.computeContainerNode() || !b.computeContainerNode())
49 return nullptr; 49 return nullptr;
50 return a.computeContainerNode()->treeScope().commonAncestorTreeScope(b.compu teContainerNode()->treeScope()); 50 return a.computeContainerNode()->treeScope().commonAncestorTreeScope(b.compu teContainerNode()->treeScope());
51 } 51 }
52 52
53 53
54 template <typename Strategy> 54 template <typename Strategy>
55 PositionTemplate<Strategy> PositionTemplate<Strategy>::editingPositionOf(PassRef PtrWillBeRawPtr<Node> anchorNode, int offset) 55 PositionTemplate<Strategy> PositionTemplate<Strategy>::editingPositionOf(RawPtr< Node> anchorNode, int offset)
56 { 56 {
57 if (!anchorNode || anchorNode->isTextNode()) 57 if (!anchorNode || anchorNode->isTextNode())
58 return PositionTemplate<Strategy>(anchorNode, offset); 58 return PositionTemplate<Strategy>(anchorNode, offset);
59 59
60 if (!Strategy::editingIgnoresContent(anchorNode.get())) 60 if (!Strategy::editingIgnoresContent(anchorNode.get()))
61 return PositionTemplate<Strategy>(anchorNode, offset); 61 return PositionTemplate<Strategy>(anchorNode, offset);
62 62
63 if (offset == 0) 63 if (offset == 0)
64 return PositionTemplate<Strategy>(anchorNode, PositionAnchorType::Before Anchor); 64 return PositionTemplate<Strategy>(anchorNode, PositionAnchorType::Before Anchor);
65 65
66 // Note: |offset| can be >= 1, if |anchorNode| have child nodes, e.g. 66 // Note: |offset| can be >= 1, if |anchorNode| have child nodes, e.g.
67 // using Node.appendChild() to add a child node TEXTAREA. 67 // using Node.appendChild() to add a child node TEXTAREA.
68 ASSERT(offset >= 1); 68 ASSERT(offset >= 1);
69 return PositionTemplate<Strategy>(anchorNode, PositionAnchorType::AfterAncho r); 69 return PositionTemplate<Strategy>(anchorNode, PositionAnchorType::AfterAncho r);
70 } 70 }
71 71
72 template <typename Strategy> 72 template <typename Strategy>
73 PositionTemplate<Strategy>::PositionTemplate(PassRefPtrWillBeRawPtr<Node> anchor Node, PositionAnchorType anchorType) 73 PositionTemplate<Strategy>::PositionTemplate(RawPtr<Node> anchorNode, PositionAn chorType anchorType)
74 : m_anchorNode(anchorNode) 74 : m_anchorNode(anchorNode)
75 , m_offset(0) 75 , m_offset(0)
76 , m_anchorType(anchorType) 76 , m_anchorType(anchorType)
77 { 77 {
78 if (!m_anchorNode) { 78 if (!m_anchorNode) {
79 m_anchorType = PositionAnchorType::OffsetInAnchor; 79 m_anchorType = PositionAnchorType::OffsetInAnchor;
80 return; 80 return;
81 } 81 }
82 if (m_anchorNode->isTextNode()) { 82 if (m_anchorNode->isTextNode()) {
83 ASSERT(m_anchorType == PositionAnchorType::BeforeAnchor || m_anchorType == PositionAnchorType::AfterAnchor); 83 ASSERT(m_anchorType == PositionAnchorType::BeforeAnchor || m_anchorType == PositionAnchorType::AfterAnchor);
84 return; 84 return;
85 } 85 }
86 ASSERT(canBeAnchorNode(m_anchorNode.get())); 86 ASSERT(canBeAnchorNode(m_anchorNode.get()));
87 ASSERT(m_anchorType != PositionAnchorType::OffsetInAnchor); 87 ASSERT(m_anchorType != PositionAnchorType::OffsetInAnchor);
88 } 88 }
89 89
90 template <typename Strategy> 90 template <typename Strategy>
91 PositionTemplate<Strategy>::PositionTemplate(PassRefPtrWillBeRawPtr<Node> anchor Node, int offset) 91 PositionTemplate<Strategy>::PositionTemplate(RawPtr<Node> anchorNode, int offset )
92 : m_anchorNode(anchorNode) 92 : m_anchorNode(anchorNode)
93 , m_offset(offset) 93 , m_offset(offset)
94 , m_anchorType(PositionAnchorType::OffsetInAnchor) 94 , m_anchorType(PositionAnchorType::OffsetInAnchor)
95 { 95 {
96 if (m_anchorNode) 96 if (m_anchorNode)
97 ASSERT(offset >= 0); 97 ASSERT(offset >= 0);
98 else 98 else
99 ASSERT(offset == 0); 99 ASSERT(offset == 0);
100 ASSERT(canBeAnchorNode(m_anchorNode.get())); 100 ASSERT(canBeAnchorNode(m_anchorNode.get()));
101 } 101 }
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 539
540 void showTree(const blink::Position* pos) 540 void showTree(const blink::Position* pos)
541 { 541 {
542 if (pos) 542 if (pos)
543 pos->showTreeForThis(); 543 pos->showTreeForThis();
544 else 544 else
545 fprintf(stderr, "Cannot showTree for (nil)\n"); 545 fprintf(stderr, "Cannot showTree for (nil)\n");
546 } 546 }
547 547
548 #endif 548 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698