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

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

Issue 2709473003: Add internals.textAffinity (Closed)
Patch Set: update 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 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 if (!frame()) { 906 if (!frame()) {
907 exceptionState.throwDOMException( 907 exceptionState.throwDOMException(
908 InvalidAccessError, "The document's frame cannot be retrieved."); 908 InvalidAccessError, "The document's frame cannot be retrieved.");
909 return ClientRect::create(); 909 return ClientRect::create();
910 } 910 }
911 911
912 m_document->updateStyleAndLayoutIgnorePendingStylesheets(); 912 m_document->updateStyleAndLayoutIgnorePendingStylesheets();
913 return ClientRect::create(frame()->selection().absoluteCaretBounds()); 913 return ClientRect::create(frame()->selection().absoluteCaretBounds());
914 } 914 }
915 915
916 String Internals::textAffinity() {
917 if (frame()
918 ->page()
919 ->focusController()
920 .focusedFrame()
921 ->selection()
922 .selectionInDOMTree()
923 .affinity() == TextAffinity::Upstream) {
924 return "Upstream";
925 }
926 return "Downstream";
927 }
928
916 ClientRect* Internals::boundingBox(Element* element) { 929 ClientRect* Internals::boundingBox(Element* element) {
917 DCHECK(element); 930 DCHECK(element);
918 931
919 element->document().updateStyleAndLayoutIgnorePendingStylesheets(); 932 element->document().updateStyleAndLayoutIgnorePendingStylesheets();
920 LayoutObject* layoutObject = element->layoutObject(); 933 LayoutObject* layoutObject = element->layoutObject();
921 if (!layoutObject) 934 if (!layoutObject)
922 return ClientRect::create(); 935 return ClientRect::create();
923 return ClientRect::create( 936 return ClientRect::create(
924 layoutObject->absoluteBoundingBoxRectIgnoringTransforms()); 937 layoutObject->absoluteBoundingBoxRectIgnoringTransforms());
925 } 938 }
(...skipping 2221 matching lines...) Expand 10 before | Expand all | Expand 10 after
3147 3160
3148 void Internals::crash() { 3161 void Internals::crash() {
3149 CHECK(false) << "Intentional crash"; 3162 CHECK(false) << "Intentional crash";
3150 } 3163 }
3151 3164
3152 void Internals::setIsLowEndDevice(bool isLowEndDevice) { 3165 void Internals::setIsLowEndDevice(bool isLowEndDevice) {
3153 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); 3166 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice);
3154 } 3167 }
3155 3168
3156 } // namespace blink 3169 } // 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