Changeset 167830 in webkit
- Timestamp:
- Apr 25, 2014 3:22:14 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r167828 r167830 1 2014-04-25 Brady Eidson <beidson@apple.com> 2 3 Add a selection overlay. 4 <rdar://problem/16727797> and https://bugs.webkit.org/show_bug.cgi?id=132200 5 6 Reviewed by David Hyatt. 7 8 No new tests (WK2 feature in development). 9 10 * WebCore.xcodeproj/project.pbxproj: 11 12 Add a SelectionRectGathterer class. 13 It creates a Notifier (given a RenderView) then accepts Rects from the RenderView. 14 When the Notifier is destroyed, the appropriate EditorClient is notified of the gathered rects. 15 * editing/SelectionRectGatherer.cpp: Added. 16 (WebCore::SelectionRectGatherer::SelectionRectGatherer): 17 (WebCore::SelectionRectGatherer::addRect): 18 (WebCore::SelectionRectGatherer::addRects): 19 (WebCore::SelectionRectGatherer::Notifier::Notifier): 20 (WebCore::SelectionRectGatherer::Notifier::~Notifier): 21 (WebCore::SelectionRectGatherer::clearAndCreateNotifier): 22 * editing/SelectionRectGatherer.h: Added. 23 24 * page/EditorClient.h: 25 (WebCore::EditorClient::selectionRectsDidChange): 26 27 * rendering/RenderView.cpp: 28 (WebCore::RenderView::RenderView): 29 (WebCore::RenderView::setSelection): Clear the gatherer’s rects then create a Notifier. 30 (WebCore::RenderView::setSubtreeSelection): Give all the selection rects to be painted to 31 the SelectionRectGatherer. 32 * rendering/RenderView.h: 33 1 34 2014-04-08 Jer Noble <jer.noble@apple.com> 2 35 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r167730 r167830 1818 1818 513F14530AB634C400094DDF /* IconLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 513F14510AB634C400094DDF /* IconLoader.cpp */; }; 1819 1819 513F14540AB634C400094DDF /* IconLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 513F14520AB634C400094DDF /* IconLoader.h */; }; 1820 51405C88190B014400754F94 /* SelectionRectGatherer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51405C86190B014400754F94 /* SelectionRectGatherer.cpp */; }; 1821 51405C89190B014400754F94 /* SelectionRectGatherer.h in Headers */ = {isa = PBXBuildFile; fileRef = 51405C87190B014400754F94 /* SelectionRectGatherer.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1820 1822 514B3F730C722047000530DF /* FileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 514B3F720C722047000530DF /* FileSystem.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1821 1823 514B3F760C722055000530DF /* FileSystemMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514B3F750C722055000530DF /* FileSystemMac.mm */; }; … … 8809 8811 513F14510AB634C400094DDF /* IconLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconLoader.cpp; sourceTree = "<group>"; }; 8810 8812 513F14520AB634C400094DDF /* IconLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconLoader.h; sourceTree = "<group>"; }; 8813 51405C86190B014400754F94 /* SelectionRectGatherer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectionRectGatherer.cpp; sourceTree = "<group>"; }; 8814 51405C87190B014400754F94 /* SelectionRectGatherer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionRectGatherer.h; sourceTree = "<group>"; }; 8811 8815 514B3F720C722047000530DF /* FileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystem.h; sourceTree = "<group>"; }; 8812 8816 514B3F750C722055000530DF /* FileSystemMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FileSystemMac.mm; sourceTree = "<group>"; }; … … 17191 17195 93309DBA099E64910056E581 /* ReplaceSelectionCommand.cpp */, 17192 17196 93309DBB099E64910056E581 /* ReplaceSelectionCommand.h */, 17197 51405C86190B014400754F94 /* SelectionRectGatherer.cpp */, 17198 51405C87190B014400754F94 /* SelectionRectGatherer.h */, 17193 17199 93309DC0099E64910056E581 /* SetNodeAttributeCommand.cpp */, 17194 17200 93309DC1099E64910056E581 /* SetNodeAttributeCommand.h */, … … 23643 23649 859A9C4F0AA5E3BD00B694B2 /* DOMHTMLStyleElement.h in Headers */, 23644 23650 85E711C70AC5D5350053270F /* DOMHTMLStyleElementInternal.h in Headers */, 23651 51405C89190B014400754F94 /* SelectionRectGatherer.h in Headers */, 23645 23652 85DF821D0AA7849E00486AD7 /* DOMHTMLTableCaptionElement.h in Headers */, 23646 23653 85E711C80AC5D5350053270F /* DOMHTMLTableCaptionElementInternal.h in Headers */, … … 28521 28528 85031B490A44EFC700F992E0 /* MutationEvent.cpp in Sources */, 28522 28529 C6F0900E14327B6100685849 /* MutationObserver.cpp in Sources */, 28530 51405C88190B014400754F94 /* SelectionRectGatherer.cpp in Sources */, 28523 28531 D6E528A3149A926D00EFE1F3 /* MutationObserverInterestGroup.cpp in Sources */, 28524 28532 D6E276AF14637455001D280A /* MutationObserverRegistration.cpp in Sources */, -
trunk/Source/WebCore/page/EditorClient.h
r166818 r167830 56 56 class HTMLElement; 57 57 class KeyboardEvent; 58 class LayoutRect; 58 59 class Node; 59 60 class Range; … … 183 184 #endif 184 185 186 #if ENABLE(SERVICE_CONTROLS) 187 virtual void selectionRectsDidChange(const Vector<LayoutRect>&) { } 188 #endif 189 185 190 // Support for global selections, used on platforms like the X Window System that treat 186 191 // selection as a type of clipboard. -
trunk/Source/WebCore/rendering/RenderView.cpp
r167675 r167830 73 73 , m_hasSoftwareFilters(false) 74 74 #endif 75 #if ENABLE(SERVICE_CONTROLS) 76 , m_selectionRectGatherer(*this) 77 #endif 75 78 { 76 79 setIsRenderView(); … … 761 764 void RenderView::setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos, SelectionRepaintMode blockRepaintMode) 762 765 { 766 #if ENABLE(SERVICE_CONTROLS) 767 // Clear the current rects and create a notifier for the new rects we are about to gather. 768 // The Notifier updates the Editor when it goes out of scope and is destroyed. 769 std::unique_ptr<SelectionRectGatherer::Notifier> rectNotifier = m_selectionRectGatherer.clearAndCreateNotifier(); 770 #endif // ENABLE(SERVICE_CONTROLS) 771 763 772 // Make sure both our start and end objects are defined. 764 773 // Check www.msnbc.com and try clicking around to find the case where this happened. … … 934 943 while (o && o != stop) { 935 944 if ((o->canBeSelectionLeaf() || o == start || o == end) && o->selectionState() != SelectionNone) { 936 newSelectedObjects.set(o, std::make_unique<RenderSelectionInfo>(o, true)); 945 std::unique_ptr<RenderSelectionInfo> selectionInfo = std::make_unique<RenderSelectionInfo>(o, true); 946 947 #if ENABLE(SERVICE_CONTROLS) 948 m_selectionRectGatherer.addRect(selectionInfo->rect()); 949 #endif 950 951 newSelectedObjects.set(o, std::move(selectionInfo)); 952 937 953 RenderBlock* cb = o->containingBlock(); 938 954 while (cb && !cb->isRenderView()) { … … 942 958 blockInfo = std::make_unique<RenderBlockSelectionInfo>(cb); 943 959 cb = cb->containingBlock(); 960 961 #if ENABLE(SERVICE_CONTROLS) 962 m_selectionRectGatherer.addRects(blockInfo->rects()); 963 #endif 944 964 } 945 965 } -
trunk/Source/WebCore/rendering/RenderView.h
r167652 r167830 33 33 #include <wtf/OwnPtr.h> 34 34 35 #if ENABLE(SERVICE_CONTROLS) 36 #include "SelectionRectGatherer.h" 37 #endif 38 35 39 namespace WebCore { 36 40 … … 355 359 356 360 HashSet<RenderElement*> m_renderersWithPausedImageAnimation; 361 362 #if ENABLE(SERVICE_CONTROLS) 363 SelectionRectGatherer m_selectionRectGatherer; 364 #endif 357 365 }; 358 366 -
trunk/Source/WebKit2/ChangeLog
r167826 r167830 1 2014-04-25 Brady Eidson <beidson@apple.com> 2 3 Add a selection overlay. 4 <rdar://problem/16727797> and https://bugs.webkit.org/show_bug.cgi?id=132200 5 6 Reviewed by David Hyatt. 7 8 * WebKit2.xcodeproj/project.pbxproj: 9 10 * WebProcess/WebCoreSupport/WebEditorClient.cpp: 11 (WebKit::WebEditorClient::selectionRectsDidChange): Pass the new selection rects on 12 to the selection overlay controller. 13 * WebProcess/WebCoreSupport/WebEditorClient.h: 14 15 * WebProcess/WebPage/SelectionOverlayController.cpp: Added. 16 (WebKit::SelectionOverlayController::SelectionOverlayController): 17 (WebKit::SelectionOverlayController::createOverlayIfNeeded): 18 (WebKit::SelectionOverlayController::destroyOverlay): 19 (WebKit::SelectionOverlayController::pageOverlayDestroyed): 20 (WebKit::SelectionOverlayController::willMoveToWebPage): 21 (WebKit::SelectionOverlayController::didMoveToWebPage): 22 (WebKit::SelectionOverlayController::selectionRectsDidChange): 23 (WebKit::SelectionOverlayController::drawRect): 24 (WebKit::SelectionOverlayController::mouseEvent): 25 * WebProcess/WebPage/SelectionOverlayController.h: Added. 26 (WebKit::SelectionOverlayController::create): 27 * WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm: Added. 28 (WebKit::SelectionOverlayController::drawRect): 29 (WebKit::SelectionOverlayController::mouseEvent): 30 (WebKit::SelectionOverlayController::handleClick): 31 (WebKit::SelectionOverlayController::clearHighlight): 32 33 * WebProcess/WebPage/WebPage.cpp: 34 (WebKit::WebPage::selectionOverlayController): 35 * WebProcess/WebPage/WebPage.h: 36 1 37 2014-04-25 Enrica Casucci <enrica@apple.com> 2 38 -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r167633 r167830 906 906 51E35209180F5D6B00E53BE9 /* DatabaseServiceEntryPoint.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E35208180F5D6B00E53BE9 /* DatabaseServiceEntryPoint.mm */; }; 907 907 51E3B67F16F266B3009968DC /* NetworkResourceLoaderMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E3B67E16F266B3009968DC /* NetworkResourceLoaderMac.mm */; }; 908 51EF124E19098522008A6532 /* SelectionOverlayController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51EF124C19098522008A6532 /* SelectionOverlayController.cpp */; }; 909 51EF124F19098523008A6532 /* SelectionOverlayController.h in Headers */ = {isa = PBXBuildFile; fileRef = 51EF124D19098522008A6532 /* SelectionOverlayController.h */; }; 910 51EF125119098531008A6532 /* SelectionOverlayControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51EF125019098531008A6532 /* SelectionOverlayControllerMac.mm */; }; 908 911 51EFC1CF1524E62500C9A938 /* WKBundleDOMWindowExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FA2D541521118600C1BA0B /* WKBundleDOMWindowExtension.h */; settings = {ATTRIBUTES = (Private, ); }; }; 909 912 51F060E01654317F00F3281B /* WebResourceLoaderMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F060DE1654317500F3281B /* WebResourceLoaderMessages.h */; }; … … 2758 2761 51E35208180F5D6B00E53BE9 /* DatabaseServiceEntryPoint.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DatabaseServiceEntryPoint.mm; sourceTree = "<group>"; }; 2759 2762 51E3B67E16F266B3009968DC /* NetworkResourceLoaderMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkResourceLoaderMac.mm; sourceTree = "<group>"; }; 2763 51EF124C19098522008A6532 /* SelectionOverlayController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectionOverlayController.cpp; sourceTree = "<group>"; }; 2764 51EF124D19098522008A6532 /* SelectionOverlayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionOverlayController.h; sourceTree = "<group>"; }; 2765 51EF125019098531008A6532 /* SelectionOverlayControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SelectionOverlayControllerMac.mm; sourceTree = "<group>"; }; 2760 2766 51F060DD1654317500F3281B /* WebResourceLoaderMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebResourceLoaderMessageReceiver.cpp; sourceTree = "<group>"; }; 2761 2767 51F060DE1654317500F3281B /* WebResourceLoaderMessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebResourceLoaderMessages.h; sourceTree = "<group>"; }; … … 5317 5323 2D140EAD18F37BE0005E75A0 /* PageOverlayController.cpp */, 5318 5324 2D140EAE18F37BE0005E75A0 /* PageOverlayController.h */, 5325 51EF124C19098522008A6532 /* SelectionOverlayController.cpp */, 5326 51EF124D19098522008A6532 /* SelectionOverlayController.h */, 5319 5327 519EF58F18EF77210003B7F4 /* TelephoneNumberOverlayController.cpp */, 5320 5328 519EF59018EF77210003B7F4 /* TelephoneNumberOverlayController.h */, … … 6072 6080 1AB16ADC1648598400290D62 /* RemoteLayerTreeDrawingArea.h */, 6073 6081 1AB16ADB1648598400290D62 /* RemoteLayerTreeDrawingArea.mm */, 6082 51EF125019098531008A6532 /* SelectionOverlayControllerMac.mm */, 6074 6083 519EF58D18EF770D0003B7F4 /* TelephoneNumberOverlayControllerMac.mm */, 6075 6084 1AAF263714687C39004A1E8A /* TiledCoreAnimationDrawingArea.h */, … … 7347 7356 1F7506B61859165700EC0FF7 /* WKWebProcessPlugInNodeHandleInternal.h in Headers */, 7348 7357 1F7506B51859165400EC0FF7 /* WKWebProcessPlugInScriptWorldInternal.h in Headers */, 7358 51EF124F19098523008A6532 /* SelectionOverlayController.h in Headers */, 7349 7359 373CEAD6185417AE008C363D /* WKNSData.h in Headers */, 7350 7360 1AB8A1F018400B0000E9AE69 /* WKPageFormClient.h in Headers */, … … 8448 8458 F62A76B812B1B25F0005F1B6 /* WebDatabaseManagerProxyMessageReceiver.cpp in Sources */, 8449 8459 517DD5C5180DC3E10081660B /* DatabaseProcessProxyMac.mm in Sources */, 8460 51EF125119098531008A6532 /* SelectionOverlayControllerMac.mm in Sources */, 8450 8461 BC111A5D112F4FBB00337BAB /* WebDragClient.cpp in Sources */, 8451 8462 C574A37712E6099D002DFE98 /* WebDragClientMac.mm in Sources */, … … 8590 8601 33F9D5B91312F1EE000D683F /* WebResourceCacheManagerCFNet.cpp in Sources */, 8591 8602 33367655130C9ECA006C9DE2 /* WebResourceCacheManagerMessageReceiver.cpp in Sources */, 8603 51EF124E19098522008A6532 /* SelectionOverlayController.cpp in Sources */, 8592 8604 33367635130C99B2006C9DE2 /* WebResourceCacheManagerProxy.cpp in Sources */, 8593 8605 33367657130C9ECA006C9DE2 /* WebResourceCacheManagerProxyMessageReceiver.cpp in Sources */, -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
r167388 r167830 28 28 29 29 #include "EditorState.h" 30 #include "SelectionOverlayController.h" 30 31 #include "TelephoneNumberOverlayController.h" 31 32 #include "WebCoreArgumentCoders.h" … … 532 533 #endif 533 534 535 #if ENABLE(SERVICE_CONTROLS) 536 void WebEditorClient::selectionRectsDidChange(const Vector<LayoutRect>& rects) 537 { 538 m_page->selectionOverlayController().selectionRectsDidChange(rects); 539 } 540 #endif // ENABLE(SERVICE_CONTROLS) 541 534 542 } // namespace WebKit -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h
r167116 r167830 171 171 virtual void selectedTelephoneNumberRangesChanged(const Vector<RefPtr<WebCore::Range>>&) override; 172 172 #endif 173 #if ENABLE(SERVICE_CONTROLS) 174 virtual void selectionRectsDidChange(const Vector<WebCore::LayoutRect>&) override; 175 #endif 173 176 174 177 WebPage* m_page; -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r167786 r167830 50 50 #include "PluginView.h" 51 51 #include "PrintInfo.h" 52 #include "SelectionOverlayController.h" 52 53 #include "SessionState.h" 53 54 #include "SessionTracker.h" … … 4571 4572 #endif 4572 4573 4574 #if ENABLE(SERVICE_CONTROLS) 4575 SelectionOverlayController& WebPage::selectionOverlayController() 4576 { 4577 if (!m_selectionOverlayController) 4578 m_selectionOverlayController = SelectionOverlayController::create(this); 4579 4580 return *m_selectionOverlayController; 4581 } 4582 #endif 4583 4573 4584 void WebPage::didChangeScrollOffsetForFrame(Frame* frame) 4574 4585 { -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r167786 r167830 141 141 class PageOverlay; 142 142 class PluginView; 143 class SelectionOverlayController; 143 144 class SessionState; 144 145 class VisibleContentRectUpdateInfo; … … 784 785 void handleTelephoneNumberClick(const String& number, const WebCore::IntPoint&); 785 786 #endif 787 #if ENABLE(SERVICE_CONTROLS) 788 SelectionOverlayController& selectionOverlayController(); 789 #endif 786 790 787 791 void didChangeScrollOffsetForFrame(WebCore::Frame*); … … 1201 1205 RefPtr<TelephoneNumberOverlayController> m_telephoneNumberOverlayController; 1202 1206 #endif 1207 #if ENABLE(SERVICE_CONTROLS) 1208 RefPtr<SelectionOverlayController> m_selectionOverlayController; 1209 #endif 1203 1210 1204 1211 PageOverlayController m_pageOverlayController;
Note: See TracChangeset
for help on using the changeset viewer.