OLD | NEW |
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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 } | 236 } |
237 | 237 |
238 template <typename Strategy> | 238 template <typename Strategy> |
239 int PositionTemplate<Strategy>::ComputeEditingOffset() const { | 239 int PositionTemplate<Strategy>::ComputeEditingOffset() const { |
240 if (IsAfterAnchorOrAfterChildren()) | 240 if (IsAfterAnchorOrAfterChildren()) |
241 return Strategy::LastOffsetForEditing(anchor_node_.Get()); | 241 return Strategy::LastOffsetForEditing(anchor_node_.Get()); |
242 return offset_; | 242 return offset_; |
243 } | 243 } |
244 | 244 |
245 template <typename Strategy> | 245 template <typename Strategy> |
246 Node* PositionTemplate<Strategy>::ComputeNodeBeforePosition() const { | 246 const Node* PositionTemplate<Strategy>::ComputeNodeBeforePosition() const { |
247 if (!anchor_node_) | 247 if (!anchor_node_) |
248 return 0; | 248 return 0; |
249 switch (AnchorType()) { | 249 switch (AnchorType()) { |
250 case PositionAnchorType::kBeforeChildren: | 250 case PositionAnchorType::kBeforeChildren: |
251 return 0; | 251 return 0; |
252 case PositionAnchorType::kAfterChildren: | 252 case PositionAnchorType::kAfterChildren: |
253 return Strategy::LastChild(*anchor_node_); | 253 return Strategy::LastChild(*anchor_node_); |
254 case PositionAnchorType::kOffsetInAnchor: | 254 case PositionAnchorType::kOffsetInAnchor: |
255 return offset_ ? Strategy::ChildAt(*anchor_node_, offset_ - 1) : 0; | 255 return offset_ ? Strategy::ChildAt(*anchor_node_, offset_ - 1) : 0; |
256 case PositionAnchorType::kBeforeAnchor: | 256 case PositionAnchorType::kBeforeAnchor: |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 } | 711 } |
712 | 712 |
713 void showTree(const blink::Position* pos) { | 713 void showTree(const blink::Position* pos) { |
714 if (pos) | 714 if (pos) |
715 pos->ShowTreeForThis(); | 715 pos->ShowTreeForThis(); |
716 else | 716 else |
717 LOG(INFO) << "Cannot showTree for <null>"; | 717 LOG(INFO) << "Cannot showTree for <null>"; |
718 } | 718 } |
719 | 719 |
720 #endif | 720 #endif |
OLD | NEW |