2 * Copyright (C) 2014 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
27 #include "RemoteScrollingCoordinatorTransaction.h"
29 #include "ArgumentCoders.h"
30 #include "MessageDecoder.h"
31 #include "MessageEncoder.h"
32 #include "WebCoreArgumentCoders.h"
33 #include <WebCore/GraphicsLayer.h>
34 #include <WebCore/ScrollingStateFixedNode.h>
35 #include <WebCore/ScrollingStateScrollingNode.h>
36 #include <WebCore/ScrollingStateStickyNode.h>
37 #include <WebCore/ScrollingStateTree.h>
38 #include <WebCore/TextStream.h>
39 #include <wtf/text/CString.h>
40 #include <wtf/text/StringBuilder.h>
42 #include <wtf/HashMap.h>
44 using namespace WebCore;
46 #if ENABLE(ASYNC_SCROLLING)
50 template<> struct ArgumentCoder<ScrollingStateNode> {
51 static void encode(ArgumentEncoder&, const ScrollingStateNode&);
52 static bool decode(ArgumentDecoder&, ScrollingStateNode&);
55 template<> struct ArgumentCoder<ScrollingStateScrollingNode> {
56 static void encode(ArgumentEncoder&, const ScrollingStateScrollingNode&);
57 static bool decode(ArgumentDecoder&, ScrollingStateScrollingNode&);
60 template<> struct ArgumentCoder<ScrollingStateFixedNode> {
61 static void encode(ArgumentEncoder&, const ScrollingStateFixedNode&);
62 static bool decode(ArgumentDecoder&, ScrollingStateFixedNode&);
65 template<> struct ArgumentCoder<ScrollingStateStickyNode> {
66 static void encode(ArgumentEncoder&, const ScrollingStateStickyNode&);
67 static bool decode(ArgumentDecoder&, ScrollingStateStickyNode&);
74 void ArgumentCoder<ScrollingStateNode>::encode(ArgumentEncoder& encoder, const ScrollingStateNode& node)
76 encoder.encodeEnum(node.nodeType());
77 encoder << node.scrollingNodeID();
78 encoder << node.parentNodeID();
79 encoder << node.changedProperties();
81 if (node.hasChangedProperty(ScrollingStateNode::ScrollLayer))
82 encoder << static_cast<GraphicsLayer::PlatformLayerID>(node.layer());
85 bool ArgumentCoder<ScrollingStateNode>::decode(ArgumentDecoder& decoder, ScrollingStateNode& node)
87 // nodeType, scrollingNodeID and parentNodeID have already been decoded by the caller in order to create the node.
88 ScrollingStateNode::ChangedProperties changedProperties;
89 if (!decoder.decode(changedProperties))
92 node.setChangedProperties(changedProperties);
93 if (node.hasChangedProperty(ScrollingStateNode::ScrollLayer)) {
94 GraphicsLayer::PlatformLayerID layerID;
95 if (!decoder.decode(layerID))
97 node.setLayer(layerID);
103 #define SCROLLING_NODE_ENCODE(property, getter) \
104 if (node.hasChangedProperty(ScrollingStateScrollingNode::property)) \
105 encoder << node.getter();
107 #define SCROLLING_NODE_ENCODE_ENUM(property, getter) \
108 if (node.hasChangedProperty(ScrollingStateScrollingNode::property)) \
109 encoder.encodeEnum(node.getter());
111 void ArgumentCoder<ScrollingStateScrollingNode>::encode(ArgumentEncoder& encoder, const ScrollingStateScrollingNode& node)
113 encoder << static_cast<const ScrollingStateNode&>(node);
115 SCROLLING_NODE_ENCODE(ViewportSize, viewportSize)
116 SCROLLING_NODE_ENCODE(TotalContentsSize, totalContentsSize)
117 SCROLLING_NODE_ENCODE(ScrollPosition, scrollPosition)
118 SCROLLING_NODE_ENCODE(ScrollOrigin, scrollOrigin)
119 SCROLLING_NODE_ENCODE(FrameScaleFactor, frameScaleFactor)
120 SCROLLING_NODE_ENCODE(NonFastScrollableRegion, nonFastScrollableRegion)
121 SCROLLING_NODE_ENCODE(WheelEventHandlerCount, wheelEventHandlerCount)
122 SCROLLING_NODE_ENCODE(ReasonsForSynchronousScrolling, synchronousScrollingReasons)
123 SCROLLING_NODE_ENCODE(ScrollableAreaParams, scrollableAreaParameters)
124 SCROLLING_NODE_ENCODE_ENUM(BehaviorForFixedElements, scrollBehaviorForFixedElements)
125 SCROLLING_NODE_ENCODE(RequestedScrollPosition, requestedScrollPosition)
126 SCROLLING_NODE_ENCODE(RequestedScrollPosition, requestedScrollPositionRepresentsProgrammaticScroll)
127 SCROLLING_NODE_ENCODE(HeaderHeight, headerHeight)
128 SCROLLING_NODE_ENCODE(FooterHeight, footerHeight)
129 SCROLLING_NODE_ENCODE(TopContentInset, topContentInset)
131 if (node.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer))
132 encoder << static_cast<GraphicsLayer::PlatformLayerID>(node.scrolledContentsLayer());
134 if (node.hasChangedProperty(ScrollingStateScrollingNode::CounterScrollingLayer))
135 encoder << static_cast<GraphicsLayer::PlatformLayerID>(node.counterScrollingLayer());
137 if (node.hasChangedProperty(ScrollingStateScrollingNode::InsetClipLayer))
138 encoder << static_cast<GraphicsLayer::PlatformLayerID>(node.insetClipLayer());
140 if (node.hasChangedProperty(ScrollingStateScrollingNode::ContentShadowLayer))
141 encoder << static_cast<GraphicsLayer::PlatformLayerID>(node.contentShadowLayer());
144 #define SCROLLING_NODE_DECODE(property, type, setter) \
145 if (node.hasChangedProperty(ScrollingStateScrollingNode::property)) { \
147 if (!decoder.decode(decodedValue)) \
149 node.setter(decodedValue); \
152 #define SCROLLING_NODE_DECODE_ENUM(property, type, setter) \
153 if (node.hasChangedProperty(ScrollingStateScrollingNode::property)) { \
155 if (!decoder.decodeEnum(decodedValue)) \
157 node.setter(decodedValue); \
160 bool ArgumentCoder<ScrollingStateScrollingNode>::decode(ArgumentDecoder& decoder, ScrollingStateScrollingNode& node)
162 if (!decoder.decode(static_cast<ScrollingStateNode&>(node)))
165 SCROLLING_NODE_DECODE(ViewportSize, FloatSize, setViewportSize);
166 SCROLLING_NODE_DECODE(TotalContentsSize, IntSize, setTotalContentsSize);
167 SCROLLING_NODE_DECODE(ScrollPosition, FloatPoint, setScrollPosition);
168 SCROLLING_NODE_DECODE(ScrollOrigin, IntPoint, setScrollOrigin);
169 SCROLLING_NODE_DECODE(FrameScaleFactor, float, setFrameScaleFactor);
170 SCROLLING_NODE_DECODE(NonFastScrollableRegion, Region, setNonFastScrollableRegion);
171 SCROLLING_NODE_DECODE(WheelEventHandlerCount, int, setWheelEventHandlerCount);
172 SCROLLING_NODE_DECODE(ReasonsForSynchronousScrolling, SynchronousScrollingReasons, setSynchronousScrollingReasons);
173 SCROLLING_NODE_DECODE(ScrollableAreaParams, ScrollableAreaParameters, setScrollableAreaParameters);
174 SCROLLING_NODE_DECODE_ENUM(BehaviorForFixedElements, ScrollBehaviorForFixedElements, setScrollBehaviorForFixedElements);
176 if (node.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) {
177 FloatPoint scrollPosition;
178 if (!decoder.decode(scrollPosition))
181 bool representsProgrammaticScroll;
182 if (!decoder.decode(representsProgrammaticScroll))
185 node.setRequestedScrollPosition(scrollPosition, representsProgrammaticScroll);
188 SCROLLING_NODE_DECODE(HeaderHeight, int, setHeaderHeight);
189 SCROLLING_NODE_DECODE(FooterHeight, int, setFooterHeight);
190 SCROLLING_NODE_DECODE(TopContentInset, float, setTopContentInset);
192 if (node.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer)) {
193 GraphicsLayer::PlatformLayerID layerID;
194 if (!decoder.decode(layerID))
196 node.setScrolledContentsLayer(layerID);
199 if (node.hasChangedProperty(ScrollingStateScrollingNode::CounterScrollingLayer)) {
200 GraphicsLayer::PlatformLayerID layerID;
201 if (!decoder.decode(layerID))
203 node.setCounterScrollingLayer(layerID);
206 if (node.hasChangedProperty(ScrollingStateScrollingNode::InsetClipLayer)) {
207 GraphicsLayer::PlatformLayerID layerID;
208 if (!decoder.decode(layerID))
210 node.setInsetClipLayer(layerID);
213 if (node.hasChangedProperty(ScrollingStateScrollingNode::ContentShadowLayer)) {
214 GraphicsLayer::PlatformLayerID layerID;
215 if (!decoder.decode(layerID))
217 node.setContentShadowLayer(layerID);
223 void ArgumentCoder<ScrollingStateFixedNode>::encode(ArgumentEncoder& encoder, const ScrollingStateFixedNode& node)
225 encoder << static_cast<const ScrollingStateNode&>(node);
227 if (node.hasChangedProperty(ScrollingStateFixedNode::ViewportConstraints))
228 encoder << node.viewportConstraints();
231 bool ArgumentCoder<ScrollingStateFixedNode>::decode(ArgumentDecoder& decoder, ScrollingStateFixedNode& node)
233 if (!decoder.decode(static_cast<ScrollingStateNode&>(node)))
236 if (node.hasChangedProperty(ScrollingStateFixedNode::ViewportConstraints)) {
237 FixedPositionViewportConstraints decodedValue;
238 if (!decoder.decode(decodedValue))
240 node.updateConstraints(decodedValue);
246 void ArgumentCoder<ScrollingStateStickyNode>::encode(ArgumentEncoder& encoder, const ScrollingStateStickyNode& node)
248 encoder << static_cast<const ScrollingStateNode&>(node);
250 if (node.hasChangedProperty(ScrollingStateStickyNode::ViewportConstraints))
251 encoder << node.viewportConstraints();
254 bool ArgumentCoder<ScrollingStateStickyNode>::decode(ArgumentDecoder& decoder, ScrollingStateStickyNode& node)
256 if (!decoder.decode(static_cast<ScrollingStateNode&>(node)))
259 if (node.hasChangedProperty(ScrollingStateStickyNode::ViewportConstraints)) {
260 StickyPositionViewportConstraints decodedValue;
261 if (!decoder.decode(decodedValue))
263 node.updateConstraints(decodedValue);
271 static void encodeNodeAndDescendants(IPC::ArgumentEncoder& encoder, const ScrollingStateNode& stateNode)
273 switch (stateNode.nodeType()) {
274 case FrameScrollingNode:
275 case OverflowScrollingNode:
276 encoder << toScrollingStateScrollingNode(stateNode);
279 encoder << toScrollingStateFixedNode(stateNode);
282 encoder << toScrollingStateStickyNode(stateNode);
286 if (!stateNode.children())
289 for (size_t i = 0; i < stateNode.children()->size(); ++i) {
290 const OwnPtr<ScrollingStateNode>& child = stateNode.children()->at(i);
291 encodeNodeAndDescendants(encoder, *child.get());
295 void RemoteScrollingCoordinatorTransaction::encode(IPC::ArgumentEncoder& encoder) const
297 int numNodes = m_scrollingStateTree ? m_scrollingStateTree->nodeCount() : 0;
300 bool hasNewRootNode = m_scrollingStateTree ? m_scrollingStateTree->hasNewRootStateNode() : false;
301 encoder << hasNewRootNode;
303 if (m_scrollingStateTree) {
304 encoder << m_scrollingStateTree->hasChangedProperties();
306 if (const ScrollingStateNode* rootNode = m_scrollingStateTree->rootStateNode())
307 encodeNodeAndDescendants(encoder, *rootNode);
309 encoder << m_scrollingStateTree->removedNodes();
311 encoder << Vector<ScrollingNodeID>();
314 bool RemoteScrollingCoordinatorTransaction::decode(IPC::ArgumentDecoder& decoder, RemoteScrollingCoordinatorTransaction& transaction)
316 return transaction.decode(decoder);
319 bool RemoteScrollingCoordinatorTransaction::decode(IPC::ArgumentDecoder& decoder)
322 if (!decoder.decode(numNodes))
326 if (!decoder.decode(hasNewRootNode))
329 m_scrollingStateTree = ScrollingStateTree::create();
331 bool hasChangedProperties;
332 if (!decoder.decode(hasChangedProperties))
335 m_scrollingStateTree->setHasChangedProperties(hasChangedProperties);
337 for (int i = 0; i < numNodes; ++i) {
338 ScrollingNodeType nodeType;
339 if (!decoder.decodeEnum(nodeType))
342 ScrollingNodeID nodeID;
343 if (!decoder.decode(nodeID))
346 ScrollingNodeID parentNodeID;
347 if (!decoder.decode(parentNodeID))
350 m_scrollingStateTree->attachNode(nodeType, nodeID, parentNodeID);
351 ScrollingStateNode* newNode = m_scrollingStateTree->stateNodeForID(nodeID);
353 ASSERT(!parentNodeID || newNode->parent());
356 case FrameScrollingNode:
357 case OverflowScrollingNode:
358 if (!decoder.decode(*toScrollingStateScrollingNode(newNode)))
362 if (!decoder.decode(*toScrollingStateFixedNode(newNode)))
366 if (!decoder.decode(*toScrollingStateStickyNode(newNode)))
372 m_scrollingStateTree->setHasNewRootStateNode(hasNewRootNode);
375 Vector<ScrollingNodeID> removedNodes;
376 if (!decoder.decode(removedNodes))
379 if (removedNodes.size())
380 m_scrollingStateTree->setRemovedNodes(removedNodes);
385 #if !defined(NDEBUG) || !LOG_DISABLED
387 class RemoteScrollingTreeTextStream : public TextStream {
389 using TextStream::operator<<;
391 RemoteScrollingTreeTextStream()
396 RemoteScrollingTreeTextStream& operator<<(FloatRect);
397 RemoteScrollingTreeTextStream& operator<<(ScrollingNodeType);
399 RemoteScrollingTreeTextStream& operator<<(const FixedPositionViewportConstraints&);
400 RemoteScrollingTreeTextStream& operator<<(const StickyPositionViewportConstraints&);
402 void dump(const ScrollingStateTree&, bool changedPropertiesOnly = true);
404 void dump(const ScrollingStateNode&, bool changedPropertiesOnly = true);
405 void dump(const ScrollingStateScrollingNode&, bool changedPropertiesOnly = true);
406 void dump(const ScrollingStateFixedNode&, bool changedPropertiesOnly = true);
407 void dump(const ScrollingStateStickyNode&, bool changedPropertiesOnly = true);
409 void increaseIndent() { ++m_indent; }
410 void decreaseIndent() { --m_indent; ASSERT(m_indent >= 0); }
415 void recursiveDumpNodes(const ScrollingStateNode&, bool changedPropertiesOnly);
420 void RemoteScrollingTreeTextStream::writeIndent()
422 for (int i = 0; i < m_indent; ++i)
427 static void dumpProperty(RemoteScrollingTreeTextStream& ts, String name, T value)
432 ts << "(" << name << " ";
437 RemoteScrollingTreeTextStream& RemoteScrollingTreeTextStream::operator<<(FloatRect rect)
439 RemoteScrollingTreeTextStream& ts = *this;
440 ts << rect.x() << " " << rect.y() << " " << rect.width() << " " << rect.height();
444 RemoteScrollingTreeTextStream& RemoteScrollingTreeTextStream::operator<<(ScrollingNodeType nodeType)
446 RemoteScrollingTreeTextStream& ts = *this;
449 case FrameScrollingNode: ts << "frame-scrolling"; break;
450 case OverflowScrollingNode: ts << "overflow-scrolling"; break;
451 case FixedNode: ts << "fixed"; break;
452 case StickyNode: ts << "sticky"; break;
458 RemoteScrollingTreeTextStream& RemoteScrollingTreeTextStream::operator<<(const FixedPositionViewportConstraints& constraints)
460 RemoteScrollingTreeTextStream& ts = *this;
462 dumpProperty(ts, "viewport-rect-at-last-layout", constraints.viewportRectAtLastLayout());
463 dumpProperty(ts, "layer-position-at-last-layout", constraints.layerPositionAtLastLayout());
468 RemoteScrollingTreeTextStream& RemoteScrollingTreeTextStream::operator<<(const StickyPositionViewportConstraints& constraints)
470 RemoteScrollingTreeTextStream& ts = *this;
472 dumpProperty(ts, "sticky-position-at-last-layout", constraints.stickyOffsetAtLastLayout());
473 dumpProperty(ts, "layer-position-at-last-layout", constraints.layerPositionAtLastLayout());
478 void RemoteScrollingTreeTextStream::dump(const ScrollingStateNode& node, bool changedPropertiesOnly)
480 RemoteScrollingTreeTextStream& ts = *this;
482 ts << "(node " << node.scrollingNodeID();
484 dumpProperty(ts, "type", node.nodeType());
486 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateNode::ScrollLayer))
487 dumpProperty(ts, "layer", static_cast<GraphicsLayer::PlatformLayerID>(node.layer()));
489 switch (node.nodeType()) {
490 case FrameScrollingNode:
491 case OverflowScrollingNode:
492 dump(toScrollingStateScrollingNode(node), changedPropertiesOnly);
495 dump(toScrollingStateFixedNode(node), changedPropertiesOnly);
498 dump(toScrollingStateStickyNode(node), changedPropertiesOnly);
503 void RemoteScrollingTreeTextStream::dump(const ScrollingStateScrollingNode& node, bool changedPropertiesOnly)
505 RemoteScrollingTreeTextStream& ts = *this;
507 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ViewportSize))
508 dumpProperty(ts, "viewport-size", node.viewportSize());
510 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize))
511 dumpProperty(ts, "total-contents-size", node.totalContentsSize());
513 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrollPosition))
514 dumpProperty(ts, "scroll-position", node.scrollPosition());
516 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrollOrigin))
517 dumpProperty(ts, "scroll-origin", node.scrollOrigin());
519 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::FrameScaleFactor))
520 dumpProperty(ts, "frame-scale-factor", node.frameScaleFactor());
522 // FIXME: dump nonFastScrollableRegion
523 // FIXME: dump wheelEventHandlerCount
524 // FIXME: dump synchronousScrollingReasons
525 // FIXME: dump scrollableAreaParameters
526 // FIXME: dump scrollBehaviorForFixedElements
528 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::RequestedScrollPosition)) {
529 dumpProperty(ts, "requested-scroll-position", node.requestedScrollPosition());
530 dumpProperty(ts, "requested-scroll-position-is-programatic", node.requestedScrollPositionRepresentsProgrammaticScroll());
533 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::HeaderHeight))
534 dumpProperty(ts, "header-height", node.headerHeight());
536 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::FooterHeight))
537 dumpProperty(ts, "footer-height", node.footerHeight());
539 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::TopContentInset))
540 dumpProperty(ts, "top-content-inset", node.topContentInset());
542 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ScrolledContentsLayer))
543 dumpProperty(ts, "scrolled-contents-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.scrolledContentsLayer()));
545 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::CounterScrollingLayer))
546 dumpProperty(ts, "counter-scrolling-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.counterScrollingLayer()));
548 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::InsetClipLayer))
549 dumpProperty(ts, "clip-inset-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.insetClipLayer()));
551 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::ContentShadowLayer))
552 dumpProperty(ts, "content-shadow-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.contentShadowLayer()));
554 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::HeaderLayer))
555 dumpProperty(ts, "header-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.headerLayer()));
557 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateScrollingNode::FooterLayer))
558 dumpProperty(ts, "footer-layer", static_cast<GraphicsLayer::PlatformLayerID>(node.footerLayer()));
561 void RemoteScrollingTreeTextStream::dump(const ScrollingStateFixedNode& node, bool changedPropertiesOnly)
563 RemoteScrollingTreeTextStream& ts = *this;
565 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateFixedNode::ViewportConstraints))
566 ts << node.viewportConstraints();
569 void RemoteScrollingTreeTextStream::dump(const ScrollingStateStickyNode& node, bool changedPropertiesOnly)
571 RemoteScrollingTreeTextStream& ts = *this;
573 if (!changedPropertiesOnly || node.hasChangedProperty(ScrollingStateFixedNode::ViewportConstraints))
574 ts << node.viewportConstraints();
577 void RemoteScrollingTreeTextStream::recursiveDumpNodes(const ScrollingStateNode& node, bool changedPropertiesOnly)
579 RemoteScrollingTreeTextStream& ts = *this;
584 dump(node, changedPropertiesOnly);
586 if (node.children()) {
593 for (auto& childNode : *node.children())
594 recursiveDumpNodes(*childNode, changedPropertiesOnly);
605 void RemoteScrollingTreeTextStream::dump(const ScrollingStateTree& stateTree, bool changedPropertiesOnly)
607 RemoteScrollingTreeTextStream& ts = *this;
609 dumpProperty(ts, "has changed properties", stateTree.hasChangedProperties());
610 dumpProperty(ts, "has new root node", stateTree.hasNewRootStateNode());
612 if (stateTree.rootStateNode())
613 recursiveDumpNodes(*stateTree.rootStateNode(), changedPropertiesOnly);
615 if (!stateTree.removedNodes().isEmpty())
616 dumpProperty<Vector<ScrollingNodeID>>(ts, "removed-nodes", stateTree.removedNodes());
619 WTF::CString RemoteScrollingCoordinatorTransaction::description() const
621 RemoteScrollingTreeTextStream ts;
626 ts << "(scrolling state tree";
628 if (m_scrollingStateTree) {
629 if (!m_scrollingStateTree->hasChangedProperties())
630 ts << " - no changes";
632 ts.dump(*m_scrollingStateTree.get());
639 return ts.release().utf8();
642 void RemoteScrollingCoordinatorTransaction::dump() const
644 fprintf(stderr, "%s", description().data());
648 } // namespace WebKit
650 #else // !ENABLE(ASYNC_SCROLLING)
654 void RemoteScrollingCoordinatorTransaction::encode(IPC::ArgumentEncoder&) const
658 bool RemoteScrollingCoordinatorTransaction::decode(IPC::ArgumentDecoder& decoder, RemoteScrollingCoordinatorTransaction& transaction)
663 } // namespace WebKit
665 #endif // ENABLE(ASYNC_SCROLLING)