Changeset 229982 in webkit
- Timestamp:
- Mar 26, 2018 12:09:33 PM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r229979 r229982 1 2018-03-26 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [Extra zoom mode] Add plumbing for next and previous focusable element rects 4 https://bugs.webkit.org/show_bug.cgi?id=184016 5 Work towards <rdar://problem/38758727> 6 7 Reviewed by Tim Horton. 8 9 When building up AssistedNodeInformation, we currently compute the element rect of the current focused element, 10 as well as flags indicating whether or not there are next or previous focusable elements. For 11 <rdar://problem/38758727>, we additionally send the rects of the next or previous focusable elements as well. 12 13 * Shared/AssistedNodeInformation.cpp: 14 (WebKit::AssistedNodeInformation::encode const): 15 (WebKit::AssistedNodeInformation::decode): 16 17 IPC support for nextNodeRect and previousNodeRect. 18 19 * Shared/AssistedNodeInformation.h: 20 * WebProcess/WebPage/ios/WebPageIOS.mm: 21 (WebKit::elementRectInRootViewCoordinates): 22 23 Add a helper to compute an element's rect in root view coordinates. We use this to compute the rects of the 24 current focused element as well as those of the next and previous elements, if any. 25 26 (WebKit::WebPage::getAssistedNodeInformation): 27 (WebKit::hasAssistableElement): Deleted. 28 29 Since we need the next or previous focusable element to get its rect, we don't need this helper anymore. 30 1 31 2018-03-26 Chris Dumez <cdumez@apple.com> 2 32 -
trunk/Source/WebKit/Shared/AssistedNodeInformation.cpp
r229783 r229982 71 71 encoder << nodeFontSize; 72 72 encoder << hasNextNode; 73 encoder << nextNodeRect; 73 74 encoder << hasPreviousNode; 75 encoder << previousNodeRect; 74 76 encoder << isAutocorrect; 75 77 encoder << isRTL; … … 118 120 return false; 119 121 122 if (!decoder.decode(result.nextNodeRect)) 123 return false; 124 120 125 if (!decoder.decode(result.hasPreviousNode)) 126 return false; 127 128 if (!decoder.decode(result.previousNodeRect)) 121 129 return false; 122 130 -
trunk/Source/WebKit/Shared/AssistedNodeInformation.h
r229783 r229982 95 95 double nodeFontSize { 0 }; 96 96 bool hasNextNode { false }; 97 WebCore::IntRect nextNodeRect; 97 98 bool hasPreviousNode { false }; 99 WebCore::IntRect previousNodeRect; 98 100 bool isAutocorrect { false }; 99 101 bool isRTL { false }; -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r229783 r229982 2692 2692 } 2693 2693 2694 static inline bool hasAssistableElement(Node* startNode, Page& page, bool isForward)2695 {2696 return nextAssistableElement(startNode, page, isForward);2697 }2698 2699 2694 void WebPage::focusNextAssistedNode(bool isForward, CallbackID callbackID) 2700 2695 { … … 2707 2702 } 2708 2703 2704 static IntRect elementRectInRootViewCoordinates(const Node& node, const Frame& frame) 2705 { 2706 auto* view = frame.view(); 2707 if (!view) 2708 return { }; 2709 2710 auto* renderer = node.renderer(); 2711 if (!renderer) 2712 return { }; 2713 2714 return view->contentsToRootView(renderer->absoluteBoundingBoxRect()); 2715 } 2716 2709 2717 void WebPage::getAssistedNodeInformation(AssistedNodeInformation& information) 2710 2718 { … … 2717 2725 if (RenderObject* renderer = m_assistedNode->renderer()) { 2718 2726 Frame& elementFrame = m_page->focusController().focusedOrMainFrame(); 2719 information.elementRect = element Frame.view()->contentsToRootView(renderer->absoluteBoundingBoxRect());2727 information.elementRect = elementRectInRootViewCoordinates(*m_assistedNode, elementFrame); 2720 2728 information.nodeFontSize = renderer->style().fontDescription().computedSize(); 2721 2729 … … 2747 2755 information.allowsUserScaling = m_viewportConfiguration.allowsUserScaling(); 2748 2756 information.allowsUserScalingIgnoringAlwaysScalable = m_viewportConfiguration.allowsUserScalingIgnoringAlwaysScalable(); 2749 information.hasNextNode = hasAssistableElement(m_assistedNode.get(), *m_page, true); 2750 information.hasPreviousNode = hasAssistableElement(m_assistedNode.get(), *m_page, false); 2757 if (auto* nextElement = nextAssistableElement(m_assistedNode.get(), *m_page, true)) { 2758 if (auto* frame = nextElement->document().frame()) 2759 information.nextNodeRect = elementRectInRootViewCoordinates(*nextElement, *frame); 2760 information.hasNextNode = true; 2761 } 2762 if (auto* previousElement = nextAssistableElement(m_assistedNode.get(), *m_page, false)) { 2763 if (auto* frame = previousElement->document().frame()) 2764 information.previousNodeRect = elementRectInRootViewCoordinates(*previousElement, *frame); 2765 information.hasPreviousNode = true; 2766 } 2751 2767 information.assistedNodeIdentifier = m_currentAssistedNodeIdentifier; 2752 2768
Note: See TracChangeset
for help on using the changeset viewer.