| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 template <typename Strategy> | 143 template <typename Strategy> |
| 144 PositionTemplate<Strategy>::PositionTemplate(const PositionTemplate& other) | 144 PositionTemplate<Strategy>::PositionTemplate(const PositionTemplate& other) |
| 145 : anchor_node_(other.anchor_node_), | 145 : anchor_node_(other.anchor_node_), |
| 146 offset_(other.offset_), | 146 offset_(other.offset_), |
| 147 anchor_type_(other.anchor_type_) {} | 147 anchor_type_(other.anchor_type_) {} |
| 148 | 148 |
| 149 // -- | 149 // -- |
| 150 | 150 |
| 151 template <typename Strategy> | 151 template <typename Strategy> |
| 152 Node* PositionTemplate<Strategy>::ComputeContainerNode() const { | 152 Node* PositionTemplate<Strategy>::ComputeContainerNode() const { |
| 153 TRACE_EVENT0("blink", "Position::ComputeContainerNode"); |
| 153 if (!anchor_node_) | 154 if (!anchor_node_) |
| 154 return 0; | 155 return 0; |
| 155 | 156 |
| 156 switch (AnchorType()) { | 157 switch (AnchorType()) { |
| 157 case PositionAnchorType::kBeforeChildren: | 158 case PositionAnchorType::kBeforeChildren: |
| 158 case PositionAnchorType::kAfterChildren: | 159 case PositionAnchorType::kAfterChildren: |
| 159 case PositionAnchorType::kOffsetInAnchor: | 160 case PositionAnchorType::kOffsetInAnchor: |
| 160 return anchor_node_.Get(); | 161 return anchor_node_.Get(); |
| 161 case PositionAnchorType::kBeforeAnchor: | 162 case PositionAnchorType::kBeforeAnchor: |
| 162 case PositionAnchorType::kAfterAnchor: | 163 case PositionAnchorType::kAfterAnchor: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 174 int new_offset = 0; | 175 int new_offset = 0; |
| 175 for (Node* node = Strategy::FirstChild(*anchor_node); | 176 for (Node* node = Strategy::FirstChild(*anchor_node); |
| 176 node && new_offset < offset; node = Strategy::NextSibling(*node)) | 177 node && new_offset < offset; node = Strategy::NextSibling(*node)) |
| 177 new_offset++; | 178 new_offset++; |
| 178 | 179 |
| 179 return new_offset; | 180 return new_offset; |
| 180 } | 181 } |
| 181 | 182 |
| 182 template <typename Strategy> | 183 template <typename Strategy> |
| 183 int PositionTemplate<Strategy>::ComputeOffsetInContainerNode() const { | 184 int PositionTemplate<Strategy>::ComputeOffsetInContainerNode() const { |
| 185 TRACE_EVENT0("blink", "Position::ComputeOffsetInContainerNode"); |
| 184 if (!anchor_node_) | 186 if (!anchor_node_) |
| 185 return 0; | 187 return 0; |
| 186 | 188 |
| 187 switch (AnchorType()) { | 189 switch (AnchorType()) { |
| 188 case PositionAnchorType::kBeforeChildren: | 190 case PositionAnchorType::kBeforeChildren: |
| 189 return 0; | 191 return 0; |
| 190 case PositionAnchorType::kAfterChildren: | 192 case PositionAnchorType::kAfterChildren: |
| 191 return LastOffsetInNode(anchor_node_.Get()); | 193 return LastOffsetInNode(anchor_node_.Get()); |
| 192 case PositionAnchorType::kOffsetInAnchor: | 194 case PositionAnchorType::kOffsetInAnchor: |
| 193 return MinOffsetForNode<Strategy>(anchor_node_.Get(), offset_); | 195 return MinOffsetForNode<Strategy>(anchor_node_.Get(), offset_); |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 } | 716 } |
| 715 | 717 |
| 716 void showTree(const blink::Position* pos) { | 718 void showTree(const blink::Position* pos) { |
| 717 if (pos) | 719 if (pos) |
| 718 pos->ShowTreeForThis(); | 720 pos->ShowTreeForThis(); |
| 719 else | 721 else |
| 720 LOG(INFO) << "Cannot showTree for <null>"; | 722 LOG(INFO) << "Cannot showTree for <null>"; |
| 721 } | 723 } |
| 722 | 724 |
| 723 #endif | 725 #endif |
| OLD | NEW |