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

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

Issue 2350163002: Prevent LayoutTest setting -1 page scale factor. (Closed)
Patch Set: Apply the comments. 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after
1871 if (!document || !document->page()) { 1871 if (!document || !document->page()) {
1872 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's page cannot be retrieved." : "No context document can be obtained."); 1872 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's page cannot be retrieved." : "No context document can be obtained.");
1873 return 0; 1873 return 0;
1874 } 1874 }
1875 Page* page = document->page(); 1875 Page* page = document->page();
1876 return page->frameHost().visualViewport().pageScale(); 1876 return page->frameHost().visualViewport().pageScale();
1877 } 1877 }
1878 1878
1879 void Internals::setPageScaleFactor(float scaleFactor, ExceptionState& exceptionS tate) 1879 void Internals::setPageScaleFactor(float scaleFactor, ExceptionState& exceptionS tate)
1880 { 1880 {
1881 if (scaleFactor <= 0)
1882 return;
1881 Document* document = contextDocument(); 1883 Document* document = contextDocument();
1882 if (!document || !document->page()) { 1884 if (!document || !document->page()) {
1883 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's page cannot be retrieved." : "No context document can be obtained."); 1885 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's page cannot be retrieved." : "No context document can be obtained.");
1884 return; 1886 return;
1885 } 1887 }
1886 Page* page = document->page(); 1888 Page* page = document->page();
1887 page->frameHost().visualViewport().setScale(scaleFactor); 1889 page->frameHost().visualViewport().setScale(scaleFactor);
1888 } 1890 }
1889 1891
1890 void Internals::setPageScaleFactorLimits(float minScaleFactor, float maxScaleFac tor, ExceptionState& exceptionState) 1892 void Internals::setPageScaleFactorLimits(float minScaleFactor, float maxScaleFac tor, ExceptionState& exceptionState)
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
2670 2672
2671 return ClientRect::create(FloatRect(node->layoutObject()->visualRect())); 2673 return ClientRect::create(FloatRect(node->layoutObject()->visualRect()));
2672 } 2674 }
2673 2675
2674 void Internals::crash() 2676 void Internals::crash()
2675 { 2677 {
2676 CHECK(false) << "Intentional crash"; 2678 CHECK(false) << "Intentional crash";
2677 } 2679 }
2678 2680
2679 } // namespace blink 2681 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698