WebViewportArguments.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #ifndef WebViewportArguments_h
  19. #define WebViewportArguments_h
  20. #include "BlackBerryGlobal.h"
  21. #include "BlackBerryPlatformMisc.h"
  22. // Not for public API purpose.
  23. namespace WebCore {
  24. class ViewportArguments;
  25. }
  26. namespace BlackBerry {
  27. namespace WebKit {
  28. class WebPage;
  29. /**
  30. * A class designed to expose a meta viewport fallback.
  31. *
  32. * This class simply wraps a WebCore::ViewportArguments. It can be
  33. * instantiated by the WebPageClient and supplied to a WebPage to
  34. * provide a userViewportArguments object that can be used whenever
  35. * there is no meta viewport tag provided in any loaded html.
  36. */
  37. class BLACKBERRY_EXPORT WebViewportArguments {
  38. public:
  39. WebViewportArguments();
  40. ~WebViewportArguments();
  41. // This matches the enum found in WebCore::ViewportArguments
  42. enum {
  43. ValueAuto = -1,
  44. ValueDeviceWidth = -2,
  45. ValueDeviceHeight = -3,
  46. };
  47. float zoom() const;
  48. void setZoom(float);
  49. float minZoom() const;
  50. void setMinZoom(float);
  51. float maxZoom() const;
  52. void setMaxZoom(float);
  53. float width() const;
  54. void setWidth(float);
  55. float height() const;
  56. void setHeight(float);
  57. float devicePixelRatio() const;
  58. void setDevicePixelRatio(float);
  59. float userZoom() const;
  60. void setUserZoom(float);
  61. bool operator==(const WebViewportArguments &other);
  62. bool operator!=(const WebViewportArguments &other);
  63. private:
  64. WebCore::ViewportArguments* d;
  65. private:
  66. friend class WebPage;
  67. DISABLE_COPY(WebViewportArguments)
  68. };
  69. } // namespace WebKit
  70. } // namespace BlackBerry
  71. #endif // WebViewportArguments_h