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

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

Issue 1177173007: Templatize FrameSelection::setNonDirectionalSelectionIfNeede function (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-06-18T14:23:09 Created 5 years, 6 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/VisibleSelection.h ('k') | no next file » | 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 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, 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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 const unsigned nodeLength = position.anchorNode()->lengthOfContents(); 864 const unsigned nodeLength = position.anchorNode()->lengthOfContents();
865 return offset <= nodeLength; 865 return offset <= nodeLength;
866 } 866 }
867 867
868 void VisibleSelection::validatePositionsIfNeeded() 868 void VisibleSelection::validatePositionsIfNeeded()
869 { 869 {
870 if (!isValidPosition(m_base) || !isValidPosition(m_extent) || !isValidPositi on(m_start) || !isValidPosition(m_end)) 870 if (!isValidPosition(m_base) || !isValidPosition(m_extent) || !isValidPositi on(m_start) || !isValidPosition(m_end))
871 validate(); 871 validate();
872 } 872 }
873 873
874 bool VisibleSelection::InDOMTree::equalSelections(const VisibleSelection& select ion1, const VisibleSelection& selection2)
875 {
876 return selection1 == selection2;
877 }
878
874 #ifndef NDEBUG 879 #ifndef NDEBUG
875 880
876 void VisibleSelection::debugPosition() const 881 void VisibleSelection::debugPosition() const
877 { 882 {
878 fprintf(stderr, "VisibleSelection ===============\n"); 883 fprintf(stderr, "VisibleSelection ===============\n");
879 884
880 if (!m_start.anchorNode()) 885 if (!m_start.anchorNode())
881 fputs("pos: null", stderr); 886 fputs("pos: null", stderr);
882 else if (m_start == m_end) { 887 else if (m_start == m_end) {
883 fprintf(stderr, "pos: %s ", m_start.anchorNode()->nodeName().utf8().da ta()); 888 fprintf(stderr, "pos: %s ", m_start.anchorNode()->nodeName().utf8().da ta());
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 sel.showTreeForThis(); 940 sel.showTreeForThis();
936 } 941 }
937 942
938 void showTree(const blink::VisibleSelection* sel) 943 void showTree(const blink::VisibleSelection* sel)
939 { 944 {
940 if (sel) 945 if (sel)
941 sel->showTreeForThis(); 946 sel->showTreeForThis();
942 } 947 }
943 948
944 #endif 949 #endif
OLDNEW
« no previous file with comments | « Source/core/editing/VisibleSelection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698