OLD | NEW |
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // the meta viewport tag and other sources. | 42 // the meta viewport tag and other sources. |
43 class PageScaleConstraintsSet { | 43 class PageScaleConstraintsSet { |
44 public: | 44 public: |
45 PageScaleConstraintsSet(); | 45 PageScaleConstraintsSet(); |
46 | 46 |
47 WebCore::PageScaleConstraints defaultConstraints() const; | 47 WebCore::PageScaleConstraints defaultConstraints() const; |
48 | 48 |
49 // Settings defined in the website's viewport tag, if viewport tag support | 49 // Settings defined in the website's viewport tag, if viewport tag support |
50 // is enabled. | 50 // is enabled. |
51 const WebCore::PageScaleConstraints& pageDefinedConstraints() const { return
m_pageDefinedConstraints; } | 51 const WebCore::PageScaleConstraints& pageDefinedConstraints() const { return
m_pageDefinedConstraints; } |
52 void updatePageDefinedConstraints(const WebCore::ViewportDescription&, WebCo
re::IntSize viewSize, WebCore::Length legacyFallbackWidth); | 52 void updatePageDefinedConstraints(const WebCore::ViewportDescription&, WebCo
re::Length legacyFallbackWidth); |
53 void adjustForAndroidWebViewQuirks(const WebCore::ViewportDescription&, WebC
ore::IntSize viewSize, int layoutFallbackWidth, float deviceScaleFactor, bool su
pportTargetDensityDPI, bool wideViewportQuirkEnabled, bool useWideViewport, bool
loadWithOverviewMode, bool nonUserScalableQuirkEnabled); | 53 void adjustForAndroidWebViewQuirks(const WebCore::ViewportDescription&, int
layoutFallbackWidth, float deviceScaleFactor, bool supportTargetDensityDPI, bool
wideViewportQuirkEnabled, bool useWideViewport, bool loadWithOverviewMode, bool
nonUserScalableQuirkEnabled); |
54 | 54 |
55 // Constraints may also be set from Chromium -- this overrides any | 55 // Constraints may also be set from Chromium -- this overrides any |
56 // page-defined values. | 56 // page-defined values. |
57 const WebCore::PageScaleConstraints& userAgentConstraints() const { return m
_userAgentConstraints; } | 57 const WebCore::PageScaleConstraints& userAgentConstraints() const { return m
_userAgentConstraints; } |
58 void setUserAgentConstraints(const WebCore::PageScaleConstraints&); | 58 void setUserAgentConstraints(const WebCore::PageScaleConstraints&); |
59 | 59 |
60 // Actual computed values, taking into account the above plus the current | 60 // Actual computed values, taking into account the above plus the current |
61 // viewport size and document width. | 61 // viewport size and document width. |
62 const WebCore::PageScaleConstraints& finalConstraints() const { return m_fin
alConstraints; } | 62 const WebCore::PageScaleConstraints& finalConstraints() const { return m_fin
alConstraints; } |
63 void computeFinalConstraints(); | 63 void computeFinalConstraints(); |
64 void adjustFinalConstraintsToContentsSize(WebCore::IntSize viewSize, WebCore
::IntSize contentsSize, int nonOverlayScrollbarWidth); | 64 void adjustFinalConstraintsToContentsSize(WebCore::IntSize contentsSize, int
nonOverlayScrollbarWidth); |
65 | 65 |
66 void didChangeContentsSize(WebCore::IntSize contentsSize, float pageScaleFac
tor); | 66 void didChangeContentsSize(WebCore::IntSize contentsSize, float pageScaleFac
tor); |
67 | 67 |
68 // This should be set to true on each page load to note that the page scale | 68 // This should be set to true on each page load to note that the page scale |
69 // factor needs to be reset to its initial value. | 69 // factor needs to be reset to its initial value. |
70 void setNeedsReset(bool); | 70 void setNeedsReset(bool); |
71 bool needsReset() const { return m_needsReset; } | 71 bool needsReset() const { return m_needsReset; } |
72 | 72 |
73 // This is set when one of the inputs to finalConstraints changes. | 73 // This is set when one of the inputs to finalConstraints changes. |
74 bool constraintsDirty() const { return m_constraintsDirty; } | 74 bool constraintsDirty() const { return m_constraintsDirty; } |
75 | 75 |
76 WebCore::IntSize mainFrameSize(const WebCore::IntSize& viewportSize, const W
ebCore::IntSize& contentsSize) const; | 76 void didChangeViewSize(const WebCore::IntSize&); |
| 77 |
| 78 WebCore::IntSize mainFrameSize(const WebCore::IntSize& contentsSize) const; |
77 | 79 |
78 private: | 80 private: |
79 WebCore::PageScaleConstraints computeConstraintsStack() const; | 81 WebCore::PageScaleConstraints computeConstraintsStack() const; |
80 | 82 |
81 WebCore::PageScaleConstraints m_pageDefinedConstraints; | 83 WebCore::PageScaleConstraints m_pageDefinedConstraints; |
82 WebCore::PageScaleConstraints m_userAgentConstraints; | 84 WebCore::PageScaleConstraints m_userAgentConstraints; |
83 WebCore::PageScaleConstraints m_finalConstraints; | 85 WebCore::PageScaleConstraints m_finalConstraints; |
84 | 86 |
85 int m_lastContentsWidth; | 87 int m_lastContentsWidth; |
| 88 WebCore::IntSize m_viewSize; |
86 | 89 |
87 bool m_needsReset; | 90 bool m_needsReset; |
88 bool m_constraintsDirty; | 91 bool m_constraintsDirty; |
89 }; | 92 }; |
90 | 93 |
91 } // namespace WebCore | 94 } // namespace WebCore |
92 | 95 |
93 #endif // PageScaleConstraintsSet_h | 96 #endif // PageScaleConstraintsSet_h |
OLD | NEW |