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

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: 2015-08-24T22:18:16 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
« no previous file with comments | « Source/core/editing/spellcheck/TextCheckingHelper.cpp ('k') | Source/web/WebRange.cpp » ('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) 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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 mainFrame->scrollableArea()->scrollIntoRect(LayoutRect(boundsInRootContent), FloatRect(x, y, w, h)); 1019 mainFrame->scrollableArea()->scrollIntoRect(LayoutRect(boundsInRootContent), FloatRect(x, y, w, h));
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 return createRange(PlainTextRange(rangeLocation, rangeLocation + rangeLength ).createRange(*scope));
1030 if (range.isNull())
1031 return nullptr;
1032 return Range::create(range.document(), range.startPosition(), range.endPosit ion());
1033 } 1030 }
1034 1031
1035 unsigned Internals::locationFromRange(Element* scope, const Range* range) 1032 unsigned Internals::locationFromRange(Element* scope, const Range* range)
1036 { 1033 {
1037 ASSERT(scope && range); 1034 ASSERT(scope && range);
1038 // PlainTextRange depends on Layout information, make sure layout it up to d ate. 1035 // PlainTextRange depends on Layout information, make sure layout it up to d ate.
1039 scope->document().updateLayoutIgnorePendingStylesheets(); 1036 scope->document().updateLayoutIgnorePendingStylesheets();
1040 1037
1041 return PlainTextRange::create(*scope, *range).start(); 1038 return PlainTextRange::create(*scope, *range).start();
1042 } 1039 }
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after
2482 2479
2483 return animator->setScrollbarsVisibleForTesting(visible); 2480 return animator->setScrollbarsVisibleForTesting(visible);
2484 } 2481 }
2485 2482
2486 void Internals::forceRestrictIFramePermissions() 2483 void Internals::forceRestrictIFramePermissions()
2487 { 2484 {
2488 RuntimeEnabledFeatures::setRestrictIFramePermissionsEnabled(true); 2485 RuntimeEnabledFeatures::setRestrictIFramePermissionsEnabled(true);
2489 } 2486 }
2490 2487
2491 } // namespace blink 2488 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/spellcheck/TextCheckingHelper.cpp ('k') | Source/web/WebRange.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698