WebPageCreationParameters.cpp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. *
  13. * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
  14. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  15. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
  17. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  18. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  19. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  20. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  21. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  22. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  23. * THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. #include "config.h"
  26. #include "WebPageCreationParameters.h"
  27. #include "WebCoreArgumentCoders.h"
  28. namespace WebKit {
  29. void WebPageCreationParameters::encode(CoreIPC::ArgumentEncoder& encoder) const
  30. {
  31. encoder << viewSize;
  32. encoder << isActive;
  33. encoder << isFocused;
  34. encoder << isVisible;
  35. encoder << isInWindow;
  36. encoder << store;
  37. encoder.encodeEnum(drawingAreaType);
  38. encoder << pageGroupData;
  39. encoder << drawsBackground;
  40. encoder << drawsTransparentBackground;
  41. encoder << underlayColor;
  42. encoder << areMemoryCacheClientCallsEnabled;
  43. encoder << useFixedLayout;
  44. encoder << fixedLayoutSize;
  45. encoder.encodeEnum(paginationMode);
  46. encoder << paginationBehavesLikeColumns;
  47. encoder << pageLength;
  48. encoder << gapBetweenPages;
  49. encoder << userAgent;
  50. encoder << sessionState;
  51. encoder << highestUsedBackForwardItemID;
  52. encoder << canRunBeforeUnloadConfirmPanel;
  53. encoder << canRunModal;
  54. encoder << deviceScaleFactor;
  55. encoder << mediaVolume;
  56. encoder << mayStartMediaWhenInWindow;
  57. encoder << minimumLayoutSize;
  58. encoder << autoSizingShouldExpandToViewHeight;
  59. encoder.encodeEnum(scrollPinningBehavior);
  60. #if PLATFORM(MAC)
  61. encoder.encodeEnum(layerHostingMode);
  62. encoder << colorSpace;
  63. #endif
  64. }
  65. bool WebPageCreationParameters::decode(CoreIPC::ArgumentDecoder& decoder, WebPageCreationParameters& parameters)
  66. {
  67. if (!decoder.decode(parameters.viewSize))
  68. return false;
  69. if (!decoder.decode(parameters.isActive))
  70. return false;
  71. if (!decoder.decode(parameters.isFocused))
  72. return false;
  73. if (!decoder.decode(parameters.isVisible))
  74. return false;
  75. if (!decoder.decode(parameters.isInWindow))
  76. return false;
  77. if (!decoder.decode(parameters.store))
  78. return false;
  79. if (!decoder.decodeEnum(parameters.drawingAreaType))
  80. return false;
  81. if (!decoder.decode(parameters.pageGroupData))
  82. return false;
  83. if (!decoder.decode(parameters.drawsBackground))
  84. return false;
  85. if (!decoder.decode(parameters.drawsTransparentBackground))
  86. return false;
  87. if (!decoder.decode(parameters.underlayColor))
  88. return false;
  89. if (!decoder.decode(parameters.areMemoryCacheClientCallsEnabled))
  90. return false;
  91. if (!decoder.decode(parameters.useFixedLayout))
  92. return false;
  93. if (!decoder.decode(parameters.fixedLayoutSize))
  94. return false;
  95. if (!decoder.decodeEnum(parameters.paginationMode))
  96. return false;
  97. if (!decoder.decode(parameters.paginationBehavesLikeColumns))
  98. return false;
  99. if (!decoder.decode(parameters.pageLength))
  100. return false;
  101. if (!decoder.decode(parameters.gapBetweenPages))
  102. return false;
  103. if (!decoder.decode(parameters.userAgent))
  104. return false;
  105. if (!decoder.decode(parameters.sessionState))
  106. return false;
  107. if (!decoder.decode(parameters.highestUsedBackForwardItemID))
  108. return false;
  109. if (!decoder.decode(parameters.canRunBeforeUnloadConfirmPanel))
  110. return false;
  111. if (!decoder.decode(parameters.canRunModal))
  112. return false;
  113. if (!decoder.decode(parameters.deviceScaleFactor))
  114. return false;
  115. if (!decoder.decode(parameters.mediaVolume))
  116. return false;
  117. if (!decoder.decode(parameters.mayStartMediaWhenInWindow))
  118. return false;
  119. if (!decoder.decode(parameters.minimumLayoutSize))
  120. return false;
  121. if (!decoder.decode(parameters.autoSizingShouldExpandToViewHeight))
  122. return false;
  123. if (!decoder.decodeEnum(parameters.scrollPinningBehavior))
  124. return false;
  125. #if PLATFORM(MAC)
  126. if (!decoder.decodeEnum(parameters.layerHostingMode))
  127. return false;
  128. if (!decoder.decode(parameters.colorSpace))
  129. return false;
  130. #endif
  131. return true;
  132. }
  133. } // namespace WebKit