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

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

Issue 23467007: Have Range constructor take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 static VisiblePosition previousBoundary(const VisiblePosition& c, BoundarySearch Function searchFunction) 448 static VisiblePosition previousBoundary(const VisiblePosition& c, BoundarySearch Function searchFunction)
449 { 449 {
450 Position pos = c.deepEquivalent(); 450 Position pos = c.deepEquivalent();
451 Node* boundary = pos.parentEditingBoundary(); 451 Node* boundary = pos.parentEditingBoundary();
452 if (!boundary) 452 if (!boundary)
453 return VisiblePosition(); 453 return VisiblePosition();
454 454
455 Document& d = boundary->document(); 455 Document& d = boundary->document();
456 Position start = createLegacyEditingPosition(boundary, 0).parentAnchoredEqui valent(); 456 Position start = createLegacyEditingPosition(boundary, 0).parentAnchoredEqui valent();
457 Position end = pos.parentAnchoredEquivalent(); 457 Position end = pos.parentAnchoredEquivalent();
458 RefPtr<Range> searchRange = Range::create(&d); 458 RefPtr<Range> searchRange = Range::create(d);
459 459
460 Vector<UChar, 1024> string; 460 Vector<UChar, 1024> string;
461 unsigned suffixLength = 0; 461 unsigned suffixLength = 0;
462 462
463 TrackExceptionState es; 463 TrackExceptionState es;
464 if (requiresContextForWordBoundary(c.characterBefore())) { 464 if (requiresContextForWordBoundary(c.characterBefore())) {
465 RefPtr<Range> forwardsScanRange(d.createRange()); 465 RefPtr<Range> forwardsScanRange(d.createRange());
466 forwardsScanRange->setEndAfter(boundary, es); 466 forwardsScanRange->setEndAfter(boundary, es);
467 forwardsScanRange->setStart(end.deprecatedNode(), end.deprecatedEditingO ffset(), es); 467 forwardsScanRange->setStart(end.deprecatedNode(), end.deprecatedEditingO ffset(), es);
468 TextIterator forwardsIterator(forwardsScanRange.get()); 468 TextIterator forwardsIterator(forwardsScanRange.get());
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 { 1407 {
1408 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c); 1408 return direction == LTR ? logicalStartOfLine(c) : logicalEndOfLine(c);
1409 } 1409 }
1410 1410
1411 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire ction) 1411 VisiblePosition rightBoundaryOfLine(const VisiblePosition& c, TextDirection dire ction)
1412 { 1412 {
1413 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c); 1413 return direction == LTR ? logicalEndOfLine(c) : logicalStartOfLine(c);
1414 } 1414 }
1415 1415
1416 } 1416 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698