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

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

Issue 2320303002: Reset VisualViewport position after same page navigation (Closed)
Patch Set: update comment Created 4 years, 3 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 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1831 String Internals::pageSizeAndMarginsInPixels(int pageNumber, int width, int heig ht, int marginTop, int marginRight, int marginBottom, int marginLeft, ExceptionS tate& exceptionState) const 1831 String Internals::pageSizeAndMarginsInPixels(int pageNumber, int width, int heig ht, int marginTop, int marginRight, int marginBottom, int marginLeft, ExceptionS tate& exceptionState) const
1832 { 1832 {
1833 if (!frame()) { 1833 if (!frame()) {
1834 exceptionState.throwDOMException(InvalidAccessError, "No frame is availa ble."); 1834 exceptionState.throwDOMException(InvalidAccessError, "No frame is availa ble.");
1835 return String(); 1835 return String();
1836 } 1836 }
1837 1837
1838 return PrintContext::pageSizeAndMarginsInPixels(frame(), pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft); 1838 return PrintContext::pageSizeAndMarginsInPixels(frame(), pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft);
1839 } 1839 }
1840 1840
1841 float Internals::pageScaleFactor(ExceptionState& exceptionState)
1842 {
1843 Document* document = contextDocument();
1844 if (!document || !document->page()) {
1845 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's page cannot be retrieved." : "No context document can be obtained.");
1846 return 0;
1847 }
1848 Page* page = document->page();
1849 return page->frameHost().visualViewport().pageScale();
1850 }
1851
1841 void Internals::setPageScaleFactor(float scaleFactor, ExceptionState& exceptionS tate) 1852 void Internals::setPageScaleFactor(float scaleFactor, ExceptionState& exceptionS tate)
1842 { 1853 {
1843 Document* document = contextDocument(); 1854 Document* document = contextDocument();
1844 if (!document || !document->page()) { 1855 if (!document || !document->page()) {
1845 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's page cannot be retrieved." : "No context document can be obtained."); 1856 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's page cannot be retrieved." : "No context document can be obtained.");
1846 return; 1857 return;
1847 } 1858 }
1848 Page* page = document->page(); 1859 Page* page = document->page();
1849 page->frameHost().visualViewport().setScale(scaleFactor); 1860 page->frameHost().visualViewport().setScale(scaleFactor);
1850 } 1861 }
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
2627 2638
2628 return ClientRect::create(FloatRect(node->layoutObject()->visualRect())); 2639 return ClientRect::create(FloatRect(node->layoutObject()->visualRect()));
2629 } 2640 }
2630 2641
2631 void Internals::crash() 2642 void Internals::crash()
2632 { 2643 {
2633 CHECK(false) << "Intentional crash"; 2644 CHECK(false) << "Intentional crash";
2634 } 2645 }
2635 2646
2636 } // namespace blink 2647 } // 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