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

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

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: Fix README.md Created 4 years, 2 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 ASSERT(page); 228 ASSERT(page);
229 229
230 if (!sFeaturesBackup) 230 if (!sFeaturesBackup)
231 sFeaturesBackup = new RuntimeEnabledFeatures::Backup; 231 sFeaturesBackup = new RuntimeEnabledFeatures::Backup;
232 sFeaturesBackup->restore(); 232 sFeaturesBackup->restore();
233 page->setIsCursorVisible(true); 233 page->setIsCursorVisible(true);
234 page->setPageScaleFactor(1); 234 page->setPageScaleFactor(1);
235 page->deprecatedLocalMainFrame() 235 page->deprecatedLocalMainFrame()
236 ->view() 236 ->view()
237 ->layoutViewportScrollableArea() 237 ->layoutViewportScrollableArea()
238 ->setScrollPosition(IntPoint(0, 0), ProgrammaticScroll); 238 ->setScrollOffset(ScrollOffset(), ProgrammaticScroll);
239 overrideUserPreferredLanguages(Vector<AtomicString>()); 239 overrideUserPreferredLanguages(Vector<AtomicString>());
240 if (!page->deprecatedLocalMainFrame() 240 if (!page->deprecatedLocalMainFrame()
241 ->spellChecker() 241 ->spellChecker()
242 .isSpellCheckingEnabled()) 242 .isSpellCheckingEnabled())
243 page->deprecatedLocalMainFrame() 243 page->deprecatedLocalMainFrame()
244 ->spellChecker() 244 ->spellChecker()
245 .toggleSpellCheckingEnabled(); 245 .toggleSpellCheckingEnabled();
246 if (page->deprecatedLocalMainFrame()->editor().isOverwriteModeEnabled()) 246 if (page->deprecatedLocalMainFrame()->editor().isOverwriteModeEnabled())
247 page->deprecatedLocalMainFrame()->editor().toggleOverwriteModeEnabled(); 247 page->deprecatedLocalMainFrame()->editor().toggleOverwriteModeEnabled();
248 248
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
1057 if (!document->view()) { 1057 if (!document->view()) {
1058 exceptionState.throwDOMException(InvalidAccessError, 1058 exceptionState.throwDOMException(InvalidAccessError,
1059 "The document provided is invalid."); 1059 "The document provided is invalid.");
1060 return; 1060 return;
1061 } 1061 }
1062 1062
1063 FrameView* frameView = document->view(); 1063 FrameView* frameView = document->view();
1064 bool scrollbarsSuppressedOldValue = frameView->scrollbarsSuppressed(); 1064 bool scrollbarsSuppressedOldValue = frameView->scrollbarsSuppressed();
1065 1065
1066 frameView->setScrollbarsSuppressed(false); 1066 frameView->setScrollbarsSuppressed(false);
1067 frameView->setScrollOffsetFromInternals(IntPoint(x, y)); 1067 frameView->updateScrollOffsetFromInternals(IntSize(x, y));
1068 frameView->setScrollbarsSuppressed(scrollbarsSuppressedOldValue); 1068 frameView->setScrollbarsSuppressed(scrollbarsSuppressedOldValue);
1069 } 1069 }
1070 1070
1071 String Internals::viewportAsText(Document* document, 1071 String Internals::viewportAsText(Document* document,
1072 float, 1072 float,
1073 int availableWidth, 1073 int availableWidth,
1074 int availableHeight, 1074 int availableHeight,
1075 ExceptionState& exceptionState) { 1075 ExceptionState& exceptionState) {
1076 ASSERT(document); 1076 ASSERT(document);
1077 if (!document->page()) { 1077 if (!document->page()) {
(...skipping 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after
2902 } 2902 }
2903 2903
2904 int Internals::visualViewportWidth() { 2904 int Internals::visualViewportWidth() {
2905 if (!frame()) 2905 if (!frame())
2906 return 0; 2906 return 0;
2907 2907
2908 return expandedIntSize(frame()->host()->visualViewport().visibleRect().size()) 2908 return expandedIntSize(frame()->host()->visualViewport().visibleRect().size())
2909 .width(); 2909 .width();
2910 } 2910 }
2911 2911
2912 double Internals::visualViewportScrollX() { 2912 float Internals::visualViewportScrollX() {
2913 if (!frame()) 2913 if (!frame())
2914 return 0; 2914 return 0;
2915 2915
2916 return frame()->view()->getScrollableArea()->scrollPositionDouble().x(); 2916 return frame()->view()->getScrollableArea()->scrollOffset().width();
2917 } 2917 }
2918 2918
2919 double Internals::visualViewportScrollY() { 2919 float Internals::visualViewportScrollY() {
2920 if (!frame()) 2920 if (!frame())
2921 return 0; 2921 return 0;
2922 2922
2923 return frame()->view()->getScrollableArea()->scrollPositionDouble().y(); 2923 return frame()->view()->getScrollableArea()->scrollOffset().height();
2924 } 2924 }
2925 2925
2926 ValueIterable<int>::IterationSource* Internals::startIteration( 2926 ValueIterable<int>::IterationSource* Internals::startIteration(
2927 ScriptState*, 2927 ScriptState*,
2928 ExceptionState&) { 2928 ExceptionState&) {
2929 return new InternalsIterationSource(); 2929 return new InternalsIterationSource();
2930 } 2930 }
2931 2931
2932 bool Internals::isUseCounted(Document* document, int useCounterId) { 2932 bool Internals::isUseCounted(Document* document, int useCounterId) {
2933 if (useCounterId < 0 || useCounterId >= UseCounter::NumberOfFeatures) 2933 if (useCounterId < 0 || useCounterId >= UseCounter::NumberOfFeatures)
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
3023 return ClientRect::create(); 3023 return ClientRect::create();
3024 3024
3025 return ClientRect::create(FloatRect(node->layoutObject()->visualRect())); 3025 return ClientRect::create(FloatRect(node->layoutObject()->visualRect()));
3026 } 3026 }
3027 3027
3028 void Internals::crash() { 3028 void Internals::crash() {
3029 CHECK(false) << "Intentional crash"; 3029 CHECK(false) << "Intentional crash";
3030 } 3030 }
3031 3031
3032 } // namespace blink 3032 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/testing/Internals.h ('k') | third_party/WebKit/Source/modules/accessibility/AXObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698