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

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

Issue 2709473003: Add internals.textAffinity (Closed)
Patch Set: 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 .affinity() == TextAffinity::Upstream) {
yosin_UTC9 2017/02/21 02:21:13 Could you write as: ->selection().selectionInDOMTr
yoichio 2017/02/21 04:38:22 Done.
923 return "Upstream";
924 }
925 return "Downstream";
926 }
927
916 ClientRect* Internals::boundingBox(Element* element) { 928 ClientRect* Internals::boundingBox(Element* element) {
917 DCHECK(element); 929 DCHECK(element);
918 930
919 element->document().updateStyleAndLayoutIgnorePendingStylesheets(); 931 element->document().updateStyleAndLayoutIgnorePendingStylesheets();
920 LayoutObject* layoutObject = element->layoutObject(); 932 LayoutObject* layoutObject = element->layoutObject();
921 if (!layoutObject) 933 if (!layoutObject)
922 return ClientRect::create(); 934 return ClientRect::create();
923 return ClientRect::create( 935 return ClientRect::create(
924 layoutObject->absoluteBoundingBoxRectIgnoringTransforms()); 936 layoutObject->absoluteBoundingBoxRectIgnoringTransforms());
925 } 937 }
(...skipping 2221 matching lines...) Expand 10 before | Expand all | Expand 10 after
3147 3159
3148 void Internals::crash() { 3160 void Internals::crash() {
3149 CHECK(false) << "Intentional crash"; 3161 CHECK(false) << "Intentional crash";
3150 } 3162 }
3151 3163
3152 void Internals::setIsLowEndDevice(bool isLowEndDevice) { 3164 void Internals::setIsLowEndDevice(bool isLowEndDevice) {
3153 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); 3165 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice);
3154 } 3166 }
3155 3167
3156 } // namespace blink 3168 } // 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