Changeset 208666 in webkit
- Timestamp:
- Nov 12, 2016, 11:19:07 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r208662 r208666 1 2016-11-12 Simon Fraser <simon.fraser@apple.com> 2 3 Add a way to get the UI-side scrolling tree as text via UIScriptController 4 https://bugs.webkit.org/show_bug.cgi?id=164697 5 6 Reviewed by Zalan Bujtas. 7 8 Add a test that dumps the scrolling state tree with a fixed element. 9 10 * scrollingcoordinator/ios/ui-scrolling-tree-expected.txt: Added. 11 * scrollingcoordinator/ios/ui-scrolling-tree.html: Added. 12 1 13 2016-11-12 Simon Fraser <simon.fraser@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r208663 r208666 1 2016-11-12 Simon Fraser <simon.fraser@apple.com> 2 3 Add a way to get the UI-side scrolling tree as text via UIScriptController 4 https://bugs.webkit.org/show_bug.cgi?id=164697 5 6 Reviewed by Zalan Bujtas. 7 8 Add dumping to ScrollingTreeNode and subclasses (previously, we could only dump 9 the scrolling state tree). This re-uses the flags used for state tree dumping. 10 11 NodeIDs are not dumped by default because they can depend on earlier tests. 12 13 Test: scrollingcoordinator/ios/ui-scrolling-tree.html 14 15 * page/scrolling/ScrollingStateNode.h: 16 * page/scrolling/ScrollingTree.cpp: 17 (WebCore::ScrollingTree::scrollingTreeAsText): 18 * page/scrolling/ScrollingTree.h: 19 * page/scrolling/ScrollingTreeFrameScrollingNode.cpp: 20 (WebCore::ScrollingTreeFrameScrollingNode::dumpProperties): 21 * page/scrolling/ScrollingTreeFrameScrollingNode.h: 22 * page/scrolling/ScrollingTreeNode.cpp: 23 (WebCore::ScrollingTreeNode::dumpProperties): 24 (WebCore::ScrollingTreeNode::dump): 25 * page/scrolling/ScrollingTreeNode.h: 26 * page/scrolling/ScrollingTreeScrollingNode.cpp: 27 (WebCore::ScrollingTreeScrollingNode::dumpProperties): 28 * page/scrolling/ScrollingTreeScrollingNode.h: 29 * page/scrolling/mac/ScrollingTreeFixedNode.h: 30 * page/scrolling/mac/ScrollingTreeFixedNode.mm: 31 (WebCore::ScrollingTreeFixedNode::dumpProperties): 32 * page/scrolling/mac/ScrollingTreeStickyNode.h: 33 * page/scrolling/mac/ScrollingTreeStickyNode.mm: 34 (WebCore::ScrollingTreeStickyNode::dumpProperties): 35 1 36 2016-11-12 Darin Adler <darin@apple.com> 2 37 -
trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h
r208179 r208666 41 41 42 42 enum ScrollingStateTreeAsTextBehaviorFlags { 43 ScrollingStateTreeAsTextBehaviorNormal = 0, 44 ScrollingStateTreeAsTextBehaviorIncludeLayerIDs = 1 << 0, 45 ScrollingStateTreeAsTextBehaviorDebug = ScrollingStateTreeAsTextBehaviorIncludeLayerIDs 43 ScrollingStateTreeAsTextBehaviorNormal = 0, 44 ScrollingStateTreeAsTextBehaviorIncludeLayerIDs = 1 << 0, 45 ScrollingStateTreeAsTextBehaviorIncludeNodeIDs = 1 << 1, 46 ScrollingStateTreeAsTextBehaviorIncludeLayerPositions = 1 << 2, 47 ScrollingStateTreeAsTextBehaviorDebug = ScrollingStateTreeAsTextBehaviorIncludeLayerIDs | ScrollingStateTreeAsTextBehaviorIncludeNodeIDs | ScrollingStateTreeAsTextBehaviorIncludeLayerPositions 46 48 }; 47 49 typedef unsigned ScrollingStateTreeAsTextBehavior; -
trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp
r208503 r208666 382 382 } 383 383 384 String ScrollingTree::scrollingTreeAsText() 385 { 386 TextStream ts(TextStream::LineMode::MultipleLine); 387 388 TextStream::GroupScope scope(ts); 389 ts << "scrolling tree"; 390 391 if (m_latchedNode) 392 ts.dumpProperty("latched node", m_latchedNode); 393 394 if (m_mainFrameScrollPosition != IntPoint()) 395 ts.dumpProperty("main frame scroll position", m_mainFrameScrollPosition); 396 397 { 398 LockHolder lock(m_mutex); 399 if (m_rootNode) { 400 TextStream::GroupScope scope(ts); 401 m_rootNode->dump(ts, ScrollingStateTreeAsTextBehaviorIncludeLayerPositions); 402 } 403 } 404 405 return ts.release(); 406 } 407 384 408 } // namespace WebCore 385 409 -
trunk/Source/WebCore/page/scrolling/ScrollingTree.h
r208503 r208666 146 146 } 147 147 148 WEBCORE_EXPORT String scrollingTreeAsText(); 149 148 150 protected: 149 151 void setMainFrameScrollPosition(FloatPoint); -
trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp
r208662 r208666 134 134 } 135 135 136 void ScrollingTreeFrameScrollingNode::dumpProperties(TextStream& ts, ScrollingStateTreeAsTextBehavior) const 137 { 138 ts << "frame scrolling node"; 139 140 ts.dumpProperty("layout viewport", m_layoutViewport); 141 ts.dumpProperty("min layoutViewport origin", m_minLayoutViewportOrigin); 142 ts.dumpProperty("max layoutViewport origin", m_maxLayoutViewportOrigin); 143 144 if (m_frameScaleFactor != 1) 145 ts.dumpProperty("frame scale factor", m_frameScaleFactor); 146 if (m_topContentInset) 147 ts.dumpProperty("top content inset", m_topContentInset); 148 149 if (m_headerHeight) 150 ts.dumpProperty("header height", m_headerHeight); 151 if (m_footerHeight) 152 ts.dumpProperty("footer height", m_footerHeight); 153 if (m_synchronousScrollingReasons) 154 ts.dumpProperty("synchronous scrolling reasons", ScrollingCoordinator::synchronousScrollingReasonsAsText(m_synchronousScrollingReasons)); 155 156 ts.dumpProperty("behavior for fixed", m_behaviorForFixed); 157 if (m_fixedElementsLayoutRelativeToFrame) 158 ts.dumpProperty("fixed elements lay out relative to frame", m_fixedElementsLayoutRelativeToFrame); 159 } 160 161 136 162 } // namespace WebCore 137 163 -
trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h
r208503 r208666 77 77 78 78 private: 79 void dumpProperties(TextStream&, ScrollingStateTreeAsTextBehavior) const override; 80 79 81 FloatRect m_layoutViewport; 80 82 FloatPoint m_minLayoutViewportOrigin; -
trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp
r185231 r208666 30 30 31 31 #include "ScrollingStateTree.h" 32 #include "TextStream.h" 32 33 33 34 namespace WebCore { … … 73 74 } 74 75 76 void ScrollingTreeNode::dumpProperties(TextStream& ts, ScrollingStateTreeAsTextBehavior behavior) const 77 { 78 if (behavior & ScrollingStateTreeAsTextBehaviorIncludeNodeIDs) 79 ts.dumpProperty("nodeID", scrollingNodeID()); 80 } 81 82 void ScrollingTreeNode::dump(TextStream& ts, ScrollingStateTreeAsTextBehavior behavior) const 83 { 84 dumpProperties(ts, behavior); 85 86 if (m_children) { 87 for (auto& child : *m_children) { 88 TextStream::GroupScope scope(ts); 89 child->dump(ts, behavior); 90 } 91 } 92 } 93 75 94 } // namespace WebCore 76 95 -
trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h
r208395 r208666 31 31 #include "ScrollTypes.h" 32 32 #include "ScrollingCoordinator.h" 33 #include "ScrollingStateNode.h" 33 34 #include <wtf/RefCounted.h> 34 35 #include <wtf/TypeCasts.h> … … 37 38 38 39 class ScrollingStateFixedNode; 39 class ScrollingStateNode;40 40 class ScrollingStateScrollingNode; 41 41 … … 67 67 void removeChild(ScrollingTreeNode*); 68 68 69 WEBCORE_EXPORT void dump(TextStream&, ScrollingStateTreeAsTextBehavior) const; 70 69 71 protected: 70 72 ScrollingTreeNode(ScrollingTree&, ScrollingNodeType, ScrollingNodeID); … … 72 74 73 75 std::unique_ptr<ScrollingTreeChildrenVector> m_children; 76 77 WEBCORE_EXPORT virtual void dumpProperties(TextStream&, ScrollingStateTreeAsTextBehavior) const; 74 78 75 79 private: -
trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp
r208503 r208666 31 31 #include "ScrollingStateTree.h" 32 32 #include "ScrollingTree.h" 33 #include "TextStream.h" 33 34 34 35 namespace WebCore { … … 125 126 } 126 127 128 void ScrollingTreeScrollingNode::dumpProperties(TextStream& ts, ScrollingStateTreeAsTextBehavior behavior) const 129 { 130 ScrollingTreeNode::dumpProperties(ts, behavior); 131 ts.dumpProperty("scrollable area size", m_scrollableAreaSize); 132 ts.dumpProperty("total content size", m_totalContentsSize); 133 if (m_totalContentsSizeForRubberBand != m_totalContentsSize) 134 ts.dumpProperty("total content size for rubber band", m_totalContentsSizeForRubberBand); 135 if (m_reachableContentsSize != m_totalContentsSize) 136 ts.dumpProperty("reachable content size", m_reachableContentsSize); 137 ts.dumpProperty("scrollable area size", m_lastCommittedScrollPosition); 138 if (m_scrollOrigin != IntPoint()) 139 ts.dumpProperty("scrollable area size", m_scrollOrigin); 140 141 #if ENABLE(CSS_SCROLL_SNAP) 142 if (m_horizontalSnapOffsets.size()) 143 ts.dumpProperty("horizontal snap offsets", m_horizontalSnapOffsets); 144 145 if (m_verticalSnapOffsets.size()) 146 ts.dumpProperty("horizontal snap offsets", m_verticalSnapOffsets); 147 148 if (m_currentHorizontalSnapPointIndex) 149 ts.dumpProperty("current horizontal snap point index", m_verticalSnapOffsets); 150 151 if (m_currentVerticalSnapPointIndex) 152 ts.dumpProperty("current vertical snap point index", m_currentVerticalSnapPointIndex); 153 154 #endif 155 } 127 156 128 157 } // namespace WebCore -
trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h
r208503 r208666 93 93 bool canHaveScrollbars() const { return m_scrollableAreaParameters.horizontalScrollbarMode != ScrollbarAlwaysOff || m_scrollableAreaParameters.verticalScrollbarMode != ScrollbarAlwaysOff; } 94 94 95 WEBCORE_EXPORT void dumpProperties(TextStream&, ScrollingStateTreeAsTextBehavior) const override; 96 95 97 private: 96 98 FloatSize m_scrollableAreaSize; -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.h
r208395 r208666 50 50 void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta) override; 51 51 52 void dumpProperties(TextStream&, ScrollingStateTreeAsTextBehavior) const override; 53 52 54 FixedPositionViewportConstraints m_constraints; 53 55 RetainPtr<CALayer> m_layer; -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm
r208395 r208666 31 31 #include "ScrollingStateFixedNode.h" 32 32 #include "ScrollingTree.h" 33 #include "TextStream.h" 33 34 #include <QuartzCore/CALayer.h> 34 35 … … 87 88 } 88 89 90 void ScrollingTreeFixedNode::dumpProperties(TextStream& ts, ScrollingStateTreeAsTextBehavior behavior) const 91 { 92 ts << "fixed node"; 93 ScrollingTreeNode::dumpProperties(ts, behavior); 94 ts.dumpProperty("fixed constraints", m_constraints); 95 96 if (behavior & ScrollingStateTreeAsTextBehaviorIncludeLayerPositions) { 97 FloatRect layerBounds = [m_layer bounds]; 98 FloatPoint anchorPoint = [m_layer anchorPoint]; 99 FloatPoint position = [m_layer position]; 100 FloatPoint layerTopLeft = position - toFloatSize(anchorPoint) * layerBounds.size() + m_constraints.alignmentOffset(); 101 ts.dumpProperty("layer top left", layerTopLeft); 102 } 103 } 104 89 105 } // namespace WebCore 90 106 -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.h
r208395 r208666 50 50 void updateLayersAfterAncestorChange(const ScrollingTreeNode& changedNode, const FloatRect& fixedPositionRect, const FloatSize& cumulativeDelta) override; 51 51 52 void dumpProperties(TextStream&, ScrollingStateTreeAsTextBehavior) const override; 53 52 54 StickyPositionViewportConstraints m_constraints; 53 55 RetainPtr<CALayer> m_layer; -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm
r208395 r208666 33 33 #include "ScrollingTreeFrameScrollingNode.h" 34 34 #include "ScrollingTreeOverflowScrollingNode.h" 35 #include "TextStream.h" 35 36 #include <QuartzCore/CALayer.h> 36 37 … … 102 103 } 103 104 105 void ScrollingTreeStickyNode::dumpProperties(TextStream& ts, ScrollingStateTreeAsTextBehavior behavior) const 106 { 107 ts << "sticky node"; 108 109 ScrollingTreeNode::dumpProperties(ts, behavior); 110 ts.dumpProperty("sticky constraints", m_constraints); 111 112 if (behavior & ScrollingStateTreeAsTextBehaviorIncludeLayerPositions) { 113 FloatRect layerBounds = [m_layer bounds]; 114 FloatPoint anchorPoint = [m_layer anchorPoint]; 115 FloatPoint position = [m_layer position]; 116 FloatPoint layerTopLeft = position - toFloatSize(anchorPoint) * layerBounds.size() + m_constraints.alignmentOffset(); 117 ts.dumpProperty("layer top left", layerTopLeft); 118 } 119 } 120 104 121 } // namespace WebCore 105 122 -
trunk/Source/WebKit2/ChangeLog
r208665 r208666 1 2016-11-12 Simon Fraser <simon.fraser@apple.com> 2 3 Add a way to get the UI-side scrolling tree as text via UIScriptController 4 https://bugs.webkit.org/show_bug.cgi?id=164697 5 6 Reviewed by Zalan Bujtas. 7 8 Add a property to WKWebView to retrieve the scrolling tree as text, for testing. 9 Expose it via the RemoteScrollingCoordinatorProxy. 10 11 * UIProcess/API/Cocoa/WKWebView.mm: 12 (-[WKWebView _scrollingTreeAsText]): 13 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 14 * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp: 15 (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeAsText): 16 * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h: 17 1 18 2016-11-12 Daniel Bates <dabates@apple.com> 2 19 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r208509 r208666 4688 4688 } 4689 4689 4690 - (NSString *)_scrollingTreeAsText 4691 { 4692 WebKit::RemoteScrollingCoordinatorProxy* coordinator = _page->scrollingCoordinatorProxy(); 4693 if (!coordinator) 4694 return @""; 4695 4696 return coordinator->scrollingTreeAsText(); 4697 } 4698 4690 4699 #endif // PLATFORM(IOS) 4691 4700 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
r208452 r208666 286 286 @property (nonatomic, readonly) NSArray<UIView *> *_uiTextSelectionRectViews WK_API_AVAILABLE(ios(WK_IOS_TBA)); 287 287 288 @property (nonatomic, readonly) NSString *_scrollingTreeAsText WK_API_AVAILABLE(ios(WK_IOS_TBA)); 289 288 290 #endif 289 291 -
trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp
r208503 r208666 186 186 } 187 187 188 String RemoteScrollingCoordinatorProxy::scrollingTreeAsText() const 189 { 190 if (m_scrollingTree) 191 return m_scrollingTree->scrollingTreeAsText(); 192 193 return emptyString(); 194 } 195 188 196 } // namespace WebKit 189 197 -
trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h
r208503 r208666 95 95 #endif 96 96 97 String scrollingTreeAsText() const; 98 97 99 private: 98 100 void connectStateNodeLayers(WebCore::ScrollingStateTree&, const RemoteLayerTreeHost&); -
trunk/Tools/ChangeLog
r208655 r208666 1 2016-11-12 Simon Fraser <simon.fraser@apple.com> 2 3 Add a way to get the UI-side scrolling tree as text via UIScriptController 4 https://bugs.webkit.org/show_bug.cgi?id=164697 5 6 Reviewed by Zalan Bujtas. 7 8 Add UIScriptController::scrollingTreeAsText(), which gets the state of the scrolling 9 tree in the UI process, including the current positions of CALayers. This will be used 10 to test UI-side scrolling and visual viewports. 11 12 * DumpRenderTree/ios/UIScriptControllerIOS.mm: 13 (WTR::UIScriptController::scrollingTreeAsText): 14 * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: 15 * TestRunnerShared/UIScriptContext/UIScriptController.cpp: 16 (WTR::UIScriptController::scrollingTreeAsText): 17 * TestRunnerShared/UIScriptContext/UIScriptController.h: 18 * WebKitTestRunner/ios/UIScriptControllerIOS.mm: 19 (WTR::UIScriptController::scrollingTreeAsText): 20 1 21 2016-11-12 Wenson Hsieh <wenson_hsieh@apple.com> 2 22 -
trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm
r208624 r208666 220 220 } 221 221 222 JSRetainPtr<JSStringRef> UIScriptController::scrollingTreeAsText() const 223 { 224 return nullptr; 225 } 226 222 227 } 223 228 -
trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
r208624 r208666 160 160 void removeAllDynamicDictionaries(); 161 161 162 readonly attribute DOMString scrollingTreeAsText; 163 162 164 void uiScriptComplete(DOMString result); 163 165 }; -
trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp
r208624 r208666 283 283 } 284 284 285 JSRetainPtr<JSStringRef> UIScriptController::scrollingTreeAsText() const 286 { 287 return nullptr; 288 } 289 285 290 void UIScriptController::platformSetDidStartFormControlInteractionCallback() 286 291 { -
trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
r208624 r208666 28 28 29 29 #include "JSWrappable.h" 30 #include <JavaScriptCore/JSRetainPtr.h> 30 31 #include <wtf/Ref.h> 31 32 … … 120 121 void insertText(JSStringRef, int location, int length); 121 122 void removeAllDynamicDictionaries(); 123 124 JSRetainPtr<JSStringRef> scrollingTreeAsText() const; 122 125 123 126 void uiScriptComplete(JSStringRef result); -
trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
r208624 r208666 400 400 } 401 401 402 JSRetainPtr<JSStringRef> UIScriptController::scrollingTreeAsText() const 403 { 404 TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView(); 405 return JSStringCreateWithCFString((CFStringRef)[webView _scrollingTreeAsText]); 406 } 407 402 408 void UIScriptController::platformSetDidStartFormControlInteractionCallback() 403 409 {
Note:
See TracChangeset
for help on using the changeset viewer.