| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 } | 434 } |
| 435 if (end_box->IsInlineTextBox() && end_node->IsTextNode()) { | 435 if (end_box->IsInlineTextBox() && end_node->IsTextNode()) { |
| 436 InlineTextBox* end_text_box = ToInlineTextBox(end_box); | 436 InlineTextBox* end_text_box = ToInlineTextBox(end_box); |
| 437 int end_offset = end_text_box->Start(); | 437 int end_offset = end_text_box->Start(); |
| 438 if (!end_text_box->IsLineBreak()) | 438 if (!end_text_box->IsLineBreak()) |
| 439 end_offset += end_text_box->Len(); | 439 end_offset += end_text_box->Len(); |
| 440 return CreateVisiblePosition( | 440 return CreateVisiblePosition( |
| 441 PositionTemplate<Strategy>(ToText(end_node), end_offset), | 441 PositionTemplate<Strategy>(ToText(end_node), end_offset), |
| 442 VP_UPSTREAM_IF_POSSIBLE); | 442 VP_UPSTREAM_IF_POSSIBLE); |
| 443 } | 443 } |
| 444 return CreateVisiblePosition(PositionTemplate<Strategy>::AfterNode(end_node), | 444 return CreateVisiblePosition(PositionTemplate<Strategy>::AfterNode(*end_node), |
| 445 VP_UPSTREAM_IF_POSSIBLE); | 445 VP_UPSTREAM_IF_POSSIBLE); |
| 446 } | 446 } |
| 447 | 447 |
| 448 // TODO(yosin) Rename this function to reflect the fact it ignores bidi levels. | 448 // TODO(yosin) Rename this function to reflect the fact it ignores bidi levels. |
| 449 template <typename Strategy> | 449 template <typename Strategy> |
| 450 static VisiblePositionTemplate<Strategy> EndOfLineAlgorithm( | 450 static VisiblePositionTemplate<Strategy> EndOfLineAlgorithm( |
| 451 const VisiblePositionTemplate<Strategy>& current_position) { | 451 const VisiblePositionTemplate<Strategy>& current_position) { |
| 452 DCHECK(current_position.IsValid()) << current_position; | 452 DCHECK(current_position.IsValid()) << current_position; |
| 453 // TODO(yosin) this is the current behavior that might need to be fixed. | 453 // TODO(yosin) this is the current behavior that might need to be fixed. |
| 454 // Please refer to https://bugs.webkit.org/show_bug.cgi?id=49107 for detail. | 454 // Please refer to https://bugs.webkit.org/show_bug.cgi?id=49107 for detail. |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 // to the end of the line we're on. | 747 // to the end of the line we're on. |
| 748 Element* root_element = HasEditableStyle(*node, editable_type) | 748 Element* root_element = HasEditableStyle(*node, editable_type) |
| 749 ? RootEditableElement(*node, editable_type) | 749 ? RootEditableElement(*node, editable_type) |
| 750 : node->GetDocument().documentElement(); | 750 : node->GetDocument().documentElement(); |
| 751 if (!root_element) | 751 if (!root_element) |
| 752 return VisiblePosition(); | 752 return VisiblePosition(); |
| 753 return VisiblePosition::LastPositionInNode(root_element); | 753 return VisiblePosition::LastPositionInNode(root_element); |
| 754 } | 754 } |
| 755 | 755 |
| 756 } // namespace blink | 756 } // namespace blink |
| OLD | NEW |