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

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

Issue 2387883002: Use float for scroll offset. (Closed)
Patch Set: 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 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 if (!document->view()) { 1044 if (!document->view()) {
1045 exceptionState.throwDOMException(InvalidAccessError, 1045 exceptionState.throwDOMException(InvalidAccessError,
1046 "The document provided is invalid."); 1046 "The document provided is invalid.");
1047 return; 1047 return;
1048 } 1048 }
1049 1049
1050 FrameView* frameView = document->view(); 1050 FrameView* frameView = document->view();
1051 bool scrollbarsSuppressedOldValue = frameView->scrollbarsSuppressed(); 1051 bool scrollbarsSuppressedOldValue = frameView->scrollbarsSuppressed();
1052 1052
1053 frameView->setScrollbarsSuppressed(false); 1053 frameView->setScrollbarsSuppressed(false);
1054 frameView->updateScrollPositionFromInternals(IntPoint(x, y)); 1054 frameView->updateScrollOffsetFromInternals(IntSize(x, y));
1055 frameView->setScrollbarsSuppressed(scrollbarsSuppressedOldValue); 1055 frameView->setScrollbarsSuppressed(scrollbarsSuppressedOldValue);
1056 } 1056 }
1057 1057
1058 String Internals::viewportAsText(Document* document, 1058 String Internals::viewportAsText(Document* document,
1059 float, 1059 float,
1060 int availableWidth, 1060 int availableWidth,
1061 int availableHeight, 1061 int availableHeight,
1062 ExceptionState& exceptionState) { 1062 ExceptionState& exceptionState) {
1063 ASSERT(document); 1063 ASSERT(document);
1064 if (!document->page()) { 1064 if (!document->page()) {
(...skipping 1821 matching lines...) Expand 10 before | Expand all | Expand 10 after
2886 } 2886 }
2887 2887
2888 int Internals::visualViewportWidth() { 2888 int Internals::visualViewportWidth() {
2889 if (!frame()) 2889 if (!frame())
2890 return 0; 2890 return 0;
2891 2891
2892 return expandedIntSize(frame()->host()->visualViewport().visibleRect().size()) 2892 return expandedIntSize(frame()->host()->visualViewport().visibleRect().size())
2893 .width(); 2893 .width();
2894 } 2894 }
2895 2895
2896 double Internals::visualViewportScrollX() { 2896 float Internals::visualViewportScrollX() {
2897 if (!frame()) 2897 if (!frame())
2898 return 0; 2898 return 0;
2899 2899
2900 return frame()->view()->getScrollableArea()->scrollPositionDouble().x(); 2900 return frame()->view()->getScrollableArea()->scrollOffset().width();
2901 } 2901 }
2902 2902
2903 double Internals::visualViewportScrollY() { 2903 float Internals::visualViewportScrollY() {
2904 if (!frame()) 2904 if (!frame())
2905 return 0; 2905 return 0;
2906 2906
2907 return frame()->view()->getScrollableArea()->scrollPositionDouble().y(); 2907 return frame()->view()->getScrollableArea()->scrollOffset().height();
2908 } 2908 }
2909 2909
2910 ValueIterable<int>::IterationSource* Internals::startIteration( 2910 ValueIterable<int>::IterationSource* Internals::startIteration(
2911 ScriptState*, 2911 ScriptState*,
2912 ExceptionState&) { 2912 ExceptionState&) {
2913 return new InternalsIterationSource(); 2913 return new InternalsIterationSource();
2914 } 2914 }
2915 2915
2916 bool Internals::isUseCounted(Document* document, int useCounterId) { 2916 bool Internals::isUseCounted(Document* document, int useCounterId) {
2917 if (useCounterId < 0 || useCounterId >= UseCounter::NumberOfFeatures) 2917 if (useCounterId < 0 || useCounterId >= UseCounter::NumberOfFeatures)
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
3007 return ClientRect::create(); 3007 return ClientRect::create();
3008 3008
3009 return ClientRect::create(FloatRect(node->layoutObject()->visualRect())); 3009 return ClientRect::create(FloatRect(node->layoutObject()->visualRect()));
3010 } 3010 }
3011 3011
3012 void Internals::crash() { 3012 void Internals::crash() {
3013 CHECK(false) << "Intentional crash"; 3013 CHECK(false) << "Intentional crash";
3014 } 3014 }
3015 3015
3016 } // namespace blink 3016 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698