Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: Source/core/editing/Position.cpp

Issue 1286993006: Introduce isRenderedCharacter(Position) function (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-19T12:39:43 Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/editing/Position.h ('k') | Source/core/editing/commands/DeleteSelectionCommand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 } 932 }
933 if (box->containsCaretOffset(m_offset)) { 933 if (box->containsCaretOffset(m_offset)) {
934 // Return false for offsets inside composed characters. 934 // Return false for offsets inside composed characters.
935 return m_offset == 0 || m_offset == textLayoutObject->nextOffset(tex tLayoutObject->previousOffset(m_offset)); 935 return m_offset == 0 || m_offset == textLayoutObject->nextOffset(tex tLayoutObject->previousOffset(m_offset));
936 } 936 }
937 } 937 }
938 938
939 return false; 939 return false;
940 } 940 }
941 941
942 template <typename Strategy> 942 bool isRenderedCharacter(const Position& position)
943 bool PositionAlgorithm<Strategy>::isRenderedCharacter() const
944 { 943 {
945 if (isNull()) 944 if (position.isNull())
946 return false; 945 return false;
947 ASSERT(isOffsetInAnchor()); 946 ASSERT(position.isOffsetInAnchor());
948 if (!anchorNode()->isTextNode()) 947 if (!position.anchorNode()->isTextNode())
949 return false; 948 return false;
950 949
951 LayoutObject* layoutObject = anchorNode()->layoutObject(); 950 LayoutObject* layoutObject = position.anchorNode()->layoutObject();
952 if (!layoutObject) 951 if (!layoutObject)
953 return false; 952 return false;
954 953
955 return toLayoutText(layoutObject)->isRenderedCharacter(offsetInContainerNode ()); 954 return toLayoutText(layoutObject)->isRenderedCharacter(position.offsetInCont ainerNode());
956 } 955 }
957 956
958 template <typename Strategy> 957 template <typename Strategy>
959 InlineBoxPosition PositionAlgorithm<Strategy>::computeInlineBoxPosition(EAffinit y affinity) const 958 InlineBoxPosition PositionAlgorithm<Strategy>::computeInlineBoxPosition(EAffinit y affinity) const
960 { 959 {
961 return computeInlineBoxPosition(affinity, primaryDirectionOf(*anchorNode())) ; 960 return computeInlineBoxPosition(affinity, primaryDirectionOf(*anchorNode())) ;
962 } 961 }
963 962
964 static bool isNonTextLeafChild(LayoutObject* object) 963 static bool isNonTextLeafChild(LayoutObject* object)
965 { 964 {
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 1360
1362 void showTree(const blink::Position* pos) 1361 void showTree(const blink::Position* pos)
1363 { 1362 {
1364 if (pos) 1363 if (pos)
1365 pos->showTreeForThis(); 1364 pos->showTreeForThis();
1366 else 1365 else
1367 fprintf(stderr, "Cannot showTree for (nil)\n"); 1366 fprintf(stderr, "Cannot showTree for (nil)\n");
1368 } 1367 }
1369 1368
1370 #endif 1369 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/Position.h ('k') | Source/core/editing/commands/DeleteSelectionCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698