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

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

Issue 2697313005: Selection API: collapse() should recreate an internal Range. (Closed)
Patch Set: Add NeedsRebaseline for platform-dependent tests Created 3 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
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 2589 matching lines...) Expand 10 before | Expand all | Expand 10 after
2600 2600
2601 void Internals::forceReload(bool bypassCache) { 2601 void Internals::forceReload(bool bypassCache) {
2602 if (!frame()) 2602 if (!frame())
2603 return; 2603 return;
2604 2604
2605 frame()->reload(bypassCache ? FrameLoadTypeReloadBypassingCache 2605 frame()->reload(bypassCache ? FrameLoadTypeReloadBypassingCache
2606 : FrameLoadTypeReloadMainResource, 2606 : FrameLoadTypeReloadMainResource,
2607 ClientRedirectPolicy::NotClientRedirect); 2607 ClientRedirectPolicy::NotClientRedirect);
2608 } 2608 }
2609 2609
2610 Node* Internals::visibleSelectionAnchorNode() {
2611 if (!frame())
2612 return nullptr;
2613 Position position = frame()->selection().base();
2614 return position.isNull() ? nullptr : position.computeContainerNode();
2615 }
2616
2617 unsigned Internals::visibleSelectionAnchorOffset() {
2618 if (!frame())
2619 return 0;
2620 Position position = frame()->selection().base();
2621 return position.isNull() ? 0 : position.computeOffsetInContainerNode();
2622 }
2623
2624 Node* Internals::visibleSelectionFocusNode() {
2625 if (!frame())
2626 return nullptr;
2627 Position position = frame()->selection().extent();
2628 return position.isNull() ? nullptr : position.computeContainerNode();
2629 }
2630
2631 unsigned Internals::visibleSelectionFocusOffset() {
2632 if (!frame())
2633 return 0;
2634 Position position = frame()->selection().extent();
2635 return position.isNull() ? 0 : position.computeOffsetInContainerNode();
2636 }
2637
2610 ClientRect* Internals::selectionBounds(ExceptionState& exceptionState) { 2638 ClientRect* Internals::selectionBounds(ExceptionState& exceptionState) {
2611 if (!frame()) { 2639 if (!frame()) {
2612 exceptionState.throwDOMException( 2640 exceptionState.throwDOMException(
2613 InvalidAccessError, "The document's frame cannot be retrieved."); 2641 InvalidAccessError, "The document's frame cannot be retrieved.");
2614 return nullptr; 2642 return nullptr;
2615 } 2643 }
2616 2644
2617 return ClientRect::create(FloatRect(frame()->selection().bounds())); 2645 return ClientRect::create(FloatRect(frame()->selection().bounds()));
2618 } 2646 }
2619 2647
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
3119 3147
3120 void Internals::crash() { 3148 void Internals::crash() {
3121 CHECK(false) << "Intentional crash"; 3149 CHECK(false) << "Intentional crash";
3122 } 3150 }
3123 3151
3124 void Internals::setIsLowEndDevice(bool isLowEndDevice) { 3152 void Internals::setIsLowEndDevice(bool isLowEndDevice) {
3125 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); 3153 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice);
3126 } 3154 }
3127 3155
3128 } // namespace blink 3156 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/testing/Internals.h ('k') | third_party/WebKit/Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698