PlatformWebViewManx.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Copyright (C) 2010 Apple Inc. All rights reserved.
  3. * Copyright (C) 2010 University of Szeged. All rights reserved.
  4. * Copyright (C) 2010 Igalia S.L.
  5. * Copyright (C) 2013 Sony Computer Entertainment Inc.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  17. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  18. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  19. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  20. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  21. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  22. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  26. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. #include "config.h"
  29. #include "PlatformWebView.h"
  30. namespace WTR {
  31. PlatformWebView::PlatformWebView(WKContextRef context, WKPageGroupRef pageGroup, WKPageRef /* relatedPage */, WKDictionaryRef)
  32. : m_window(0)
  33. , m_windowIsKey(true)
  34. {
  35. WKViewClient viewClient = {0};
  36. viewClient.version = kWKViewClientCurrentVersion;
  37. viewClient.clientInfo = this;
  38. viewClient.viewSize = viewSize;
  39. m_view = WKViewCreate(context, pageGroup, &viewClient);
  40. }
  41. PlatformWebView::~PlatformWebView()
  42. {
  43. }
  44. WKSize PlatformWebView::viewSize(WKViewRef view, const void* clientInfo)
  45. {
  46. // Chosen a view size of 800 x 600 for LayoutTests, to remain consistent
  47. // with LayoutTest's requirement and with expected results
  48. return WKSizeMake(800, 600);
  49. }
  50. void PlatformWebView::resizeTo(unsigned width, unsigned height)
  51. {
  52. }
  53. WKPageRef PlatformWebView::page()
  54. {
  55. return WKViewGetPage(m_view);
  56. }
  57. void PlatformWebView::focus()
  58. {
  59. }
  60. WKRect PlatformWebView::windowFrame()
  61. {
  62. // This method returns a default frame size of 800 x 600
  63. // because m_window is currently not used.
  64. WKRect frame;
  65. frame.origin.x = 0;
  66. frame.origin.y = 0;
  67. frame.size.width = 800;
  68. frame.size.height = 600;
  69. return frame;
  70. }
  71. void PlatformWebView::setWindowFrame(WKRect frame)
  72. {
  73. resizeTo(frame.size.width, frame.size.height);
  74. }
  75. void PlatformWebView::addChromeInputField()
  76. {
  77. }
  78. void PlatformWebView::removeChromeInputField()
  79. {
  80. }
  81. void PlatformWebView::makeWebViewFirstResponder()
  82. {
  83. }
  84. WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage()
  85. {
  86. return 0;
  87. }
  88. void PlatformWebView::didInitializeClients()
  89. {
  90. }
  91. } // namespace WTR