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

Side by Side Diff: third_party/WebKit/Source/core/frame/PageScaleConstraints.cpp

Issue 2350163002: Prevent LayoutTest setting -1 page scale factor. (Closed)
Patch Set: Rewrite the test. 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 minimumScale = other.minimumScale; 51 minimumScale = other.minimumScale;
52 if (other.maximumScale != -1) 52 if (other.maximumScale != -1)
53 maximumScale = other.maximumScale; 53 maximumScale = other.maximumScale;
54 if (!other.layoutSize.isZero()) 54 if (!other.layoutSize.isZero())
55 layoutSize = other.layoutSize; 55 layoutSize = other.layoutSize;
56 clampAll(); 56 clampAll();
57 } 57 }
58 58
59 float PageScaleConstraints::clampToConstraints(float pageScaleFactor) const 59 float PageScaleConstraints::clampToConstraints(float pageScaleFactor) const
60 { 60 {
61 if (pageScaleFactor == -1)
bokan 2016/09/19 19:01:21 I don't think this is the right way to fix this. -
62 return pageScaleFactor;
63 if (minimumScale != -1) 61 if (minimumScale != -1)
64 pageScaleFactor = std::max(pageScaleFactor, minimumScale); 62 pageScaleFactor = std::max(pageScaleFactor, minimumScale);
65 if (maximumScale != -1) 63 if (maximumScale != -1)
66 pageScaleFactor = std::min(pageScaleFactor, maximumScale); 64 pageScaleFactor = std::min(pageScaleFactor, maximumScale);
67 return pageScaleFactor; 65 return pageScaleFactor;
68 } 66 }
69 67
70 void PageScaleConstraints::clampAll() 68 void PageScaleConstraints::clampAll()
71 { 69 {
72 if (minimumScale != -1 && maximumScale != -1) 70 if (minimumScale != -1 && maximumScale != -1)
(...skipping 25 matching lines...) Expand all
98 96
99 bool PageScaleConstraints::operator==(const PageScaleConstraints& other) const 97 bool PageScaleConstraints::operator==(const PageScaleConstraints& other) const
100 { 98 {
101 return layoutSize == other.layoutSize 99 return layoutSize == other.layoutSize
102 && initialScale == other.initialScale 100 && initialScale == other.initialScale
103 && minimumScale == other.minimumScale 101 && minimumScale == other.minimumScale
104 && maximumScale == other.maximumScale; 102 && maximumScale == other.maximumScale;
105 } 103 }
106 104
107 } // namespace blink 105 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698