| 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 26 matching lines...) Expand all Loading... |
| 37 #include "platform/geometry/IntSize.h" | 37 #include "platform/geometry/IntSize.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 // This class harmonizes the viewport (particularly page scale) constraints from | 41 // This class harmonizes the viewport (particularly page scale) constraints from |
| 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 blink::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 blink::PageScaleConstraints& pageDefinedConstraints() const { return m
_pageDefinedConstraints; } |
| 52 void updatePageDefinedConstraints(const WebCore::ViewportDescription&, WebCo
re::Length legacyFallbackWidth); | 52 void updatePageDefinedConstraints(const blink::ViewportDescription&, blink::
Length legacyFallbackWidth); |
| 53 void adjustForAndroidWebViewQuirks(const WebCore::ViewportDescription&, int
layoutFallbackWidth, float deviceScaleFactor, bool supportTargetDensityDPI, bool
wideViewportQuirkEnabled, bool useWideViewport, bool loadWithOverviewMode, bool
nonUserScalableQuirkEnabled); | 53 void adjustForAndroidWebViewQuirks(const blink::ViewportDescription&, int la
youtFallbackWidth, float deviceScaleFactor, bool supportTargetDensityDPI, bool w
ideViewportQuirkEnabled, bool useWideViewport, bool loadWithOverviewMode, bool n
onUserScalableQuirkEnabled); |
| 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 blink::PageScaleConstraints& userAgentConstraints() const { return m_u
serAgentConstraints; } |
| 58 void setUserAgentConstraints(const WebCore::PageScaleConstraints&); | 58 void setUserAgentConstraints(const blink::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 blink::PageScaleConstraints& finalConstraints() const { return m_final
Constraints; } |
| 63 void computeFinalConstraints(); | 63 void computeFinalConstraints(); |
| 64 void adjustFinalConstraintsToContentsSize(WebCore::IntSize contentsSize, int
nonOverlayScrollbarWidth); | 64 void adjustFinalConstraintsToContentsSize(blink::IntSize contentsSize, int n
onOverlayScrollbarWidth); |
| 65 | 65 |
| 66 void didChangeContentsSize(WebCore::IntSize contentsSize, float pageScaleFac
tor); | 66 void didChangeContentsSize(blink::IntSize contentsSize, float pageScaleFacto
r); |
| 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 void didChangeViewSize(const WebCore::IntSize&); | 76 void didChangeViewSize(const blink::IntSize&); |
| 77 | 77 |
| 78 WebCore::IntSize mainFrameSize(const WebCore::IntSize& contentsSize) const; | 78 blink::IntSize mainFrameSize(const blink::IntSize& contentsSize) const; |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 WebCore::PageScaleConstraints computeConstraintsStack() const; | 81 blink::PageScaleConstraints computeConstraintsStack() const; |
| 82 | 82 |
| 83 WebCore::PageScaleConstraints m_pageDefinedConstraints; | 83 blink::PageScaleConstraints m_pageDefinedConstraints; |
| 84 WebCore::PageScaleConstraints m_userAgentConstraints; | 84 blink::PageScaleConstraints m_userAgentConstraints; |
| 85 WebCore::PageScaleConstraints m_finalConstraints; | 85 blink::PageScaleConstraints m_finalConstraints; |
| 86 | 86 |
| 87 int m_lastContentsWidth; | 87 int m_lastContentsWidth; |
| 88 WebCore::IntSize m_viewSize; | 88 blink::IntSize m_viewSize; |
| 89 | 89 |
| 90 bool m_needsReset; | 90 bool m_needsReset; |
| 91 bool m_constraintsDirty; | 91 bool m_constraintsDirty; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 } // namespace WebCore | 94 } // namespace blink |
| 95 | 95 |
| 96 #endif // PageScaleConstraintsSet_h | 96 #endif // PageScaleConstraintsSet_h |
| OLD | NEW |