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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 DCHECK(visible_position.IsValid()) << visible_position; | 683 DCHECK(visible_position.IsValid()) << visible_position; |
684 Position position = visible_position.DeepEquivalent(); | 684 Position position = visible_position.DeepEquivalent(); |
685 Element* end_block = | 685 Element* end_block = |
686 position.ComputeContainerNode() | 686 position.ComputeContainerNode() |
687 ? EnclosingBlock(position.ComputeContainerNode(), rule) | 687 ? EnclosingBlock(position.ComputeContainerNode(), rule) |
688 : 0; | 688 : 0; |
689 return end_block ? VisiblePosition::LastPositionInNode(end_block) | 689 return end_block ? VisiblePosition::LastPositionInNode(end_block) |
690 : VisiblePosition(); | 690 : VisiblePosition(); |
691 } | 691 } |
692 | 692 |
693 bool InSameBlock(const VisiblePosition& a, const VisiblePosition& b) { | |
694 DCHECK(a.IsValid()) << a; | |
695 DCHECK(b.IsValid()) << b; | |
696 return !a.IsNull() && | |
697 EnclosingBlock(a.DeepEquivalent().ComputeContainerNode()) == | |
698 EnclosingBlock(b.DeepEquivalent().ComputeContainerNode()); | |
699 } | |
700 | |
701 bool IsStartOfBlock(const VisiblePosition& pos) { | 693 bool IsStartOfBlock(const VisiblePosition& pos) { |
702 DCHECK(pos.IsValid()) << pos; | 694 DCHECK(pos.IsValid()) << pos; |
703 return pos.IsNotNull() && | 695 return pos.IsNotNull() && |
704 pos.DeepEquivalent() == | 696 pos.DeepEquivalent() == |
705 StartOfBlock(pos, kCanCrossEditingBoundary).DeepEquivalent(); | 697 StartOfBlock(pos, kCanCrossEditingBoundary).DeepEquivalent(); |
706 } | 698 } |
707 | 699 |
708 bool IsEndOfBlock(const VisiblePosition& pos) { | 700 bool IsEndOfBlock(const VisiblePosition& pos) { |
709 DCHECK(pos.IsValid()) << pos; | 701 DCHECK(pos.IsValid()) << pos; |
710 return pos.IsNotNull() && | 702 return pos.IsNotNull() && |
(...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2620 | 2612 |
2621 IntRect ComputeTextRect(const EphemeralRangeInFlatTree& range) { | 2613 IntRect ComputeTextRect(const EphemeralRangeInFlatTree& range) { |
2622 return EnclosingIntRect(ComputeTextRectTemplate(range)); | 2614 return EnclosingIntRect(ComputeTextRectTemplate(range)); |
2623 } | 2615 } |
2624 | 2616 |
2625 FloatRect ComputeTextFloatRect(const EphemeralRange& range) { | 2617 FloatRect ComputeTextFloatRect(const EphemeralRange& range) { |
2626 return ComputeTextRectTemplate(range); | 2618 return ComputeTextRectTemplate(range); |
2627 } | 2619 } |
2628 | 2620 |
2629 } // namespace blink | 2621 } // namespace blink |
OLD | NEW |