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

Side by Side Diff: sky/engine/core/editing/htmlediting.cpp

Issue 928393003: Remove the concept of document.documentElement (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « sky/engine/core/editing/VisibleUnits.cpp ('k') | sky/engine/core/frame/FrameView.h » ('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, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007 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 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 if (visiblePosition.isNull()) 830 if (visiblePosition.isNull())
831 return 0; 831 return 0;
832 832
833 Position p(visiblePosition.deepEquivalent()); 833 Position p(visiblePosition.deepEquivalent());
834 Document& document = *p.document(); 834 Document& document = *p.document();
835 ShadowRoot* shadowRoot = p.anchorNode()->containingShadowRoot(); 835 ShadowRoot* shadowRoot = p.anchorNode()->containingShadowRoot();
836 836
837 if (shadowRoot) 837 if (shadowRoot)
838 scope = shadowRoot; 838 scope = shadowRoot;
839 else 839 else
840 scope = document.documentElement(); 840 scope = &document;
841 841
842 RefPtr<Range> range = Range::create(document, firstPositionInNode(scope.get( )), p.parentAnchoredEquivalent()); 842 RefPtr<Range> range = Range::create(document, firstPositionInNode(scope.get( )), p.parentAnchoredEquivalent());
843 843
844 return TextIterator::rangeLength(range.get(), true); 844 return TextIterator::rangeLength(range.get(), true);
845 } 845 }
846 846
847 VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope) 847 VisiblePosition visiblePositionForIndex(int index, ContainerNode* scope)
848 { 848 {
849 if (!scope) 849 if (!scope)
850 return VisiblePosition(); 850 return VisiblePosition();
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 // if the selection starts just before a paragraph break, skip over it 925 // if the selection starts just before a paragraph break, skip over it
926 if (isEndOfParagraph(visiblePosition)) 926 if (isEndOfParagraph(visiblePosition))
927 return visiblePosition.next().deepEquivalent().downstream(); 927 return visiblePosition.next().deepEquivalent().downstream();
928 928
929 // otherwise, make sure to be at the start of the first selected node, 929 // otherwise, make sure to be at the start of the first selected node,
930 // instead of possibly at the end of the last node before the selection 930 // instead of possibly at the end of the last node before the selection
931 return visiblePosition.deepEquivalent().downstream(); 931 return visiblePosition.deepEquivalent().downstream();
932 } 932 }
933 933
934 } // namespace blink 934 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/editing/VisibleUnits.cpp ('k') | sky/engine/core/frame/FrameView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698