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

Side by Side Diff: third_party/WebKit/Source/core/editing/VisibleUnits.cpp

Issue 2705113003: Add clean layout DCHECK to mostBackwardCaretPosition() (Closed)
Patch Set: 2017-02-21T17:42:08 Created 3 years, 10 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
OLDNEW
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 2826 matching lines...) Expand 10 before | Expand all | Expand 10 after
2837 if (isAtomicNode(pos.node())) 2837 if (isAtomicNode(pos.node()))
2838 return true; 2838 return true;
2839 2839
2840 return pos.atStartOfNode(); 2840 return pos.atStartOfNode();
2841 } 2841 }
2842 2842
2843 template <typename Strategy> 2843 template <typename Strategy>
2844 static PositionTemplate<Strategy> mostBackwardCaretPosition( 2844 static PositionTemplate<Strategy> mostBackwardCaretPosition(
2845 const PositionTemplate<Strategy>& position, 2845 const PositionTemplate<Strategy>& position,
2846 EditingBoundaryCrossingRule rule) { 2846 EditingBoundaryCrossingRule rule) {
2847 DCHECK(!needsLayoutTreeUpdate(position)) << position;
2847 TRACE_EVENT0("input", "VisibleUnits::mostBackwardCaretPosition"); 2848 TRACE_EVENT0("input", "VisibleUnits::mostBackwardCaretPosition");
2848 2849
2849 Node* startNode = position.anchorNode(); 2850 Node* startNode = position.anchorNode();
2850 if (!startNode) 2851 if (!startNode)
2851 return PositionTemplate<Strategy>(); 2852 return PositionTemplate<Strategy>();
2852 2853
2853 // iterate backward from there, looking for a qualified position 2854 // iterate backward from there, looking for a qualified position
2854 Node* boundary = enclosingVisualBoundary<Strategy>(startNode); 2855 Node* boundary = enclosingVisualBoundary<Strategy>(startNode);
2855 // FIXME: PositionIterator should respect Before and After positions. 2856 // FIXME: PositionIterator should respect Before and After positions.
2856 PositionIteratorAlgorithm<Strategy> lastVisible( 2857 PositionIteratorAlgorithm<Strategy> lastVisible(
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after
3930 3931
3931 VisiblePositionInFlatTree previousPositionOf( 3932 VisiblePositionInFlatTree previousPositionOf(
3932 const VisiblePositionInFlatTree& visiblePosition, 3933 const VisiblePositionInFlatTree& visiblePosition,
3933 EditingBoundaryCrossingRule rule) { 3934 EditingBoundaryCrossingRule rule) {
3934 DCHECK(visiblePosition.isValid()) << visiblePosition; 3935 DCHECK(visiblePosition.isValid()) << visiblePosition;
3935 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>( 3936 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>(
3936 visiblePosition.deepEquivalent(), rule); 3937 visiblePosition.deepEquivalent(), rule);
3937 } 3938 }
3938 3939
3939 } // namespace blink 3940 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698