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

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 1315543002: Introduce createRange(const EphemeralRange&) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights 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 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 } 1020 }
1021 1021
1022 PassRefPtrWillBeRawPtr<Range> Internals::rangeFromLocationAndLength(Element* sco pe, int rangeLocation, int rangeLength) 1022 PassRefPtrWillBeRawPtr<Range> Internals::rangeFromLocationAndLength(Element* sco pe, int rangeLocation, int rangeLength)
1023 { 1023 {
1024 ASSERT(scope); 1024 ASSERT(scope);
1025 1025
1026 // TextIterator depends on Layout information, make sure layout it up to dat e. 1026 // TextIterator depends on Layout information, make sure layout it up to dat e.
1027 scope->document().updateLayoutIgnorePendingStylesheets(); 1027 scope->document().updateLayoutIgnorePendingStylesheets();
1028 1028
1029 const EphemeralRange range = PlainTextRange(rangeLocation, rangeLocation + r angeLength).createRange(*scope); 1029 const EphemeralRange range = PlainTextRange(rangeLocation, rangeLocation + r angeLength).createRange(*scope);
1030 if (range.isNull()) 1030 if (range.isNull())
tkent 2015/08/24 09:38:05 We can remove these two lines.
yosin_UTC9 2015/08/24 13:19:22 Done
1031 return nullptr; 1031 return nullptr;
1032 return Range::create(range.document(), range.startPosition(), range.endPosit ion()); 1032 return createRange(range);
1033 } 1033 }
1034 1034
1035 unsigned Internals::locationFromRange(Element* scope, const Range* range) 1035 unsigned Internals::locationFromRange(Element* scope, const Range* range)
1036 { 1036 {
1037 ASSERT(scope && range); 1037 ASSERT(scope && range);
1038 // PlainTextRange depends on Layout information, make sure layout it up to d ate. 1038 // PlainTextRange depends on Layout information, make sure layout it up to d ate.
1039 scope->document().updateLayoutIgnorePendingStylesheets(); 1039 scope->document().updateLayoutIgnorePendingStylesheets();
1040 1040
1041 return PlainTextRange::create(*scope, *range).start(); 1041 return PlainTextRange::create(*scope, *range).start();
1042 } 1042 }
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
2482 2482
2483 return animator->setScrollbarsVisibleForTesting(visible); 2483 return animator->setScrollbarsVisibleForTesting(visible);
2484 } 2484 }
2485 2485
2486 void Internals::forceRestrictIFramePermissions() 2486 void Internals::forceRestrictIFramePermissions()
2487 { 2487 {
2488 RuntimeEnabledFeatures::setRestrictIFramePermissionsEnabled(true); 2488 RuntimeEnabledFeatures::setRestrictIFramePermissionsEnabled(true);
2489 } 2489 }
2490 2490
2491 } // namespace blink 2491 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698