Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. |
| 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 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1920 } | 1920 } |
| 1921 | 1921 |
| 1922 template <typename Strategy> | 1922 template <typename Strategy> |
| 1923 static InlineBoxPosition computeInlineBoxPositionTemplate(const PositionTemplate <Strategy>& position, TextAffinity affinity, TextDirection primaryDirection) | 1923 static InlineBoxPosition computeInlineBoxPositionTemplate(const PositionTemplate <Strategy>& position, TextAffinity affinity, TextDirection primaryDirection) |
| 1924 { | 1924 { |
| 1925 InlineBox* inlineBox = nullptr; | 1925 InlineBox* inlineBox = nullptr; |
| 1926 int caretOffset = position.computeEditingOffset(); | 1926 int caretOffset = position.computeEditingOffset(); |
| 1927 Node* const anchorNode = position.anchorNode(); | 1927 Node* const anchorNode = position.anchorNode(); |
| 1928 LayoutObject* layoutObject = anchorNode->isShadowRoot() ? toShadowRoot(ancho rNode)->host()->layoutObject() : anchorNode->layoutObject(); | 1928 LayoutObject* layoutObject = anchorNode->isShadowRoot() ? toShadowRoot(ancho rNode)->host()->layoutObject() : anchorNode->layoutObject(); |
| 1929 | 1929 |
| 1930 if (!layoutObject) | |
|
yosin_UTC9
2016/03/15 06:20:40
We should assume |computeInlineBoxPosition()| call
| |
| 1931 return InlineBoxPosition(); | |
| 1932 | |
| 1930 if (!layoutObject->isText()) { | 1933 if (!layoutObject->isText()) { |
| 1931 inlineBox = 0; | 1934 inlineBox = 0; |
| 1932 if (canHaveChildrenForEditing(anchorNode) && layoutObject->isLayoutBlock Flow() && hasRenderedNonAnonymousDescendantsWithHeight(layoutObject)) { | 1935 if (canHaveChildrenForEditing(anchorNode) && layoutObject->isLayoutBlock Flow() && hasRenderedNonAnonymousDescendantsWithHeight(layoutObject)) { |
| 1933 // Try a visually equivalent position with possibly opposite | 1936 // Try a visually equivalent position with possibly opposite |
| 1934 // editability. This helps in case |this| is in an editable block | 1937 // editability. This helps in case |this| is in an editable block |
| 1935 // but surrounded by non-editable positions. It acts to negate the | 1938 // but surrounded by non-editable positions. It acts to negate the |
| 1936 // logic at the beginning of | 1939 // logic at the beginning of |
| 1937 // |LayoutObject::createPositionWithAffinity()|. | 1940 // |LayoutObject::createPositionWithAffinity()|. |
| 1938 PositionTemplate<Strategy> equivalent = downstreamIgnoringEditingBou ndaries(position); | 1941 PositionTemplate<Strategy> equivalent = downstreamIgnoringEditingBou ndaries(position); |
| 1939 if (equivalent == position) { | 1942 if (equivalent == position) { |
| (...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3252 { | 3255 { |
| 3253 return previousPositionOfAlgorithm<EditingStrategy>(visiblePosition, rule); | 3256 return previousPositionOfAlgorithm<EditingStrategy>(visiblePosition, rule); |
| 3254 } | 3257 } |
| 3255 | 3258 |
| 3256 VisiblePositionInFlatTree previousPositionOf(const VisiblePositionInFlatTree& vi siblePosition, EditingBoundaryCrossingRule rule) | 3259 VisiblePositionInFlatTree previousPositionOf(const VisiblePositionInFlatTree& vi siblePosition, EditingBoundaryCrossingRule rule) |
| 3257 { | 3260 { |
| 3258 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>(visiblePositio n, rule); | 3261 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>(visiblePositio n, rule); |
| 3259 } | 3262 } |
| 3260 | 3263 |
| 3261 } // namespace blink | 3264 } // namespace blink |
| OLD | NEW |