Changeset 69616 in webkit
- Timestamp:
- Oct 12, 2010 4:10:36 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit2/ChangeLog
r69614 r69616 1 2010-10-12 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Start fleshing out find page overlays 6 https://bugs.webkit.org/show_bug.cgi?id=47559 7 8 * UIProcess/API/C/WKAPICast.h: 9 (WebKit::toFindOptions): 10 Handle the kWKFindOptionsShowFindIndicator flag. 11 12 * WebKit2.pro: 13 * WebKit2.xcodeproj/project.pbxproj: 14 Add new files. 15 16 * WebProcess/WebPage/FindController.cpp: 17 (WebKit::FindController::FindController): 18 Initialize the find page overlay. 19 20 (WebKit::FindController::findString): 21 Hide or show the find page overlay. 22 23 (WebKit::FindController::findPageOverlayDestroyed): 24 Null out the find page overlay. 25 26 * WebProcess/WebPage/FindPageOverlay.cpp: Added. 27 * WebProcess/WebPage/FindPageOverlay.h: Added. 28 Add stubbed out FindPageOverlay class. 29 30 * WebProcess/WebPage/PageOverlay.cpp: Added. 31 (WebKit::PageOverlay::setPage): 32 Set the parent web page. 33 34 (WebKit::PageOverlay::setNeedsDisplay): 35 Invalidate the parent web page. 36 37 * WebProcess/WebPage/WebPage.cpp: 38 (WebKit::WebPage::drawRect): 39 If there's a page overlay, ask it to draw on top of the page contents. 40 41 (WebKit::WebPage::installPageOverlay): 42 Set the page overlay. 43 44 (WebKit::WebPage::uninstallPageOverlay): 45 Clear the page overlay. 46 47 * win/WebKit2.vcproj: 48 Add new files. 49 1 50 2010-10-12 Jessie Berlin <jberlin@apple.com> 2 51 -
trunk/WebKit2/UIProcess/API/C/WKAPICast.h
r69325 r69616 140 140 if (wkFindOptions & kWKFindOptionsShowOverlay) 141 141 findOptions |= FindOptionsShowOverlay; 142 if (wkFindOptions & kWKFindOptionsShowFindIndicator) 143 findOptions |= FindOptionsShowFindIndicator; 142 144 143 145 return static_cast<FindOptions>(findOptions); -
trunk/WebKit2/WebKit2.pro
r69598 r69616 297 297 WebProcess/WebPage/DrawingArea.h \ 298 298 WebProcess/WebPage/FindController.h \ 299 WebProcess/WebPage/FindPageOverlay.h \ 300 WebProcess/WebPage/PageOverlay.h \ 299 301 WebProcess/WebPage/WebEditCommand.h \ 300 302 WebProcess/WebPage/WebFrame.h \ … … 434 436 WebProcess/WebPage/DrawingArea.cpp \ 435 437 WebProcess/WebPage/FindController.cpp \ 438 WebProcess/WebPage/FindPageOverlay.cpp \ 439 WebProcess/WebPage/PageOverlay.cpp \ 436 440 WebProcess/WebPage/WebEditCommand.cpp \ 437 441 WebProcess/WebPage/WebFrame.cpp \ -
trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj
r69604 r69616 124 124 1A90C1F41264FD71003E44D4 /* FindController.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A90C1F21264FD71003E44D4 /* FindController.h */; }; 125 125 1A90C1F51264FD71003E44D4 /* FindController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A90C1F31264FD71003E44D4 /* FindController.cpp */; }; 126 1A90C23712650717003E44D4 /* PageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A90C23512650717003E44D4 /* PageOverlay.h */; }; 127 1A90C23812650717003E44D4 /* PageOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A90C23612650717003E44D4 /* PageOverlay.cpp */; }; 128 1A90C2A312650C60003E44D4 /* FindPageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A90C2A112650C60003E44D4 /* FindPageOverlay.h */; }; 129 1A90C2A412650C60003E44D4 /* FindPageOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A90C2A212650C60003E44D4 /* FindPageOverlay.cpp */; }; 126 130 1AA1CC5D100FA1A10078DEBC /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */; }; 127 131 1AA1CD07100FA1BA0078DEBC /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1AA1CD06100FA1BA0078DEBC /* Carbon.framework */; }; … … 585 589 1A90C1F21264FD71003E44D4 /* FindController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindController.h; sourceTree = "<group>"; }; 586 590 1A90C1F31264FD71003E44D4 /* FindController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FindController.cpp; sourceTree = "<group>"; }; 591 1A90C23512650717003E44D4 /* PageOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageOverlay.h; sourceTree = "<group>"; }; 592 1A90C23612650717003E44D4 /* PageOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageOverlay.cpp; sourceTree = "<group>"; }; 593 1A90C2A112650C60003E44D4 /* FindPageOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FindPageOverlay.h; sourceTree = "<group>"; }; 594 1A90C2A212650C60003E44D4 /* FindPageOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FindPageOverlay.cpp; sourceTree = "<group>"; }; 587 595 1AA1C79A100E7FC50078DEBC /* WebCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 588 596 1AA1C7DE100E846E0078DEBC /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; … … 1314 1322 1A90C1F31264FD71003E44D4 /* FindController.cpp */, 1315 1323 1A90C1F21264FD71003E44D4 /* FindController.h */, 1324 1A90C2A212650C60003E44D4 /* FindPageOverlay.cpp */, 1325 1A90C2A112650C60003E44D4 /* FindPageOverlay.h */, 1316 1326 0F5265B111DD37680006D33C /* LayerBackedDrawingArea.cpp */, 1317 1327 0F5265B211DD37680006D33C /* LayerBackedDrawingArea.h */, 1328 1A90C23612650717003E44D4 /* PageOverlay.cpp */, 1329 1A90C23512650717003E44D4 /* PageOverlay.h */, 1318 1330 BC72B9F811E6476B001EB4EA /* WebBackForwardListProxy.cpp */, 1319 1331 BC72B9F911E6476B001EB4EA /* WebBackForwardListProxy.h */, … … 2006 2018 1A90C1EE1264FD50003E44D4 /* FindOptions.h in Headers */, 2007 2019 1A90C1F41264FD71003E44D4 /* FindController.h in Headers */, 2020 1A90C23712650717003E44D4 /* PageOverlay.h in Headers */, 2021 1A90C2A312650C60003E44D4 /* FindPageOverlay.h in Headers */, 2008 2022 ); 2009 2023 runOnlyForDeploymentPostprocessing = 0; … … 2310 2324 1AC41AC81263C88300054E94 /* BinarySemaphore.cpp in Sources */, 2311 2325 1A90C1F51264FD71003E44D4 /* FindController.cpp in Sources */, 2326 1A90C23812650717003E44D4 /* PageOverlay.cpp in Sources */, 2327 1A90C2A412650C60003E44D4 /* FindPageOverlay.cpp in Sources */, 2312 2328 ); 2313 2329 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebKit2/WebProcess/WebPage/FindController.cpp
r69598 r69616 26 26 #include "FindController.h" 27 27 28 #include "FindPageOverlay.h" 28 29 #include "WebPage.h" 29 30 #include <WebCore/Frame.h> … … 36 37 FindController::FindController(WebPage* webPage) 37 38 : m_webPage(webPage) 39 , m_findPageOverlay(0) 38 40 { 39 41 } … … 57 59 Frame* selectedFrame = frameWithSelection(m_webPage->corePage()); 58 60 61 bool shouldShowOverlay = false; 62 59 63 if (!found) { 60 64 // We didn't find the string, clear all text matches. … … 64 68 if (selectedFrame) 65 69 selectedFrame->selection()->clear(); 70 } else { 71 // FIXME: We need to show the find indicator here. 66 72 73 shouldShowOverlay = findOptions & FindOptionsShowOverlay; 74 } 75 76 if (!shouldShowOverlay) { 77 if (m_findPageOverlay) { 78 // Get rid of the overlay. 79 m_webPage->uninstallPageOverlay(); 80 } 81 82 ASSERT(!m_findPageOverlay); 67 83 return; 84 } 85 86 if (!m_findPageOverlay) { 87 OwnPtr<FindPageOverlay> findPageOverlay = FindPageOverlay::create(this); 88 m_findPageOverlay = findPageOverlay.get(); 89 m_webPage->installPageOverlay(findPageOverlay.release()); 90 } else { 91 // The page overlay needs to be repainted. 92 m_findPageOverlay->setNeedsDisplay(); 68 93 } 69 94 } … … 74 99 } 75 100 101 void FindController::findPageOverlayDestroyed() 102 { 103 ASSERT(m_findPageOverlay); 104 m_findPageOverlay = 0; 105 } 106 76 107 } // namespace WebKit -
trunk/WebKit2/WebProcess/WebPage/FindController.h
r69598 r69616 37 37 namespace WebKit { 38 38 39 class FindPageOverlay; 39 40 class WebPage; 40 41 … … 48 49 void hideFindUI(); 49 50 51 void findPageOverlayDestroyed(); 52 50 53 private: 51 54 WebPage* m_webPage; 55 FindPageOverlay* m_findPageOverlay; 52 56 }; 53 57 -
trunk/WebKit2/WebProcess/WebPage/FindPageOverlay.cpp
r69614 r69616 24 24 */ 25 25 26 #ifndef FindController_h 27 #define FindController_h 26 #include "FindPageOverlay.h" 28 27 29 #include "FindOptions.h" 30 #include <wtf/Forward.h> 31 #include <wtf/Noncopyable.h> 28 #include "FindController.h" 29 #include <WebCore/GraphicsContext.h> 32 30 33 namespace WebCore { 34 class Frame; 35 } 31 using namespace WebCore; 36 32 37 33 namespace WebKit { 38 34 39 class WebPage; 35 PassOwnPtr<FindPageOverlay> FindPageOverlay::create(FindController* findController) 36 { 37 return adoptPtr(new FindPageOverlay(findController)); 38 } 40 39 41 class FindController { 42 WTF_MAKE_NONCOPYABLE(FindController); 40 FindPageOverlay::FindPageOverlay(FindController* findController) 41 : m_findController(findController) 42 { 43 } 43 44 44 public: 45 explicit FindController(WebPage*); 45 FindPageOverlay::~FindPageOverlay() 46 { 47 m_findController->findPageOverlayDestroyed(); 48 } 46 49 47 void findString(const String&, FindDirection, FindOptions, unsigned maxNumMatches); 48 void hideFindUI(); 50 void FindPageOverlay::drawRect(GraphicsContext& graphicsContext, const IntRect& dirtyRect) 51 { 52 // FIXME: Draw something. 53 } 49 54 50 private:51 WebPage* m_webPage;52 };53 55 54 56 } // namespace WebKit 55 56 #endif // FindController_h -
trunk/WebKit2/WebProcess/WebPage/FindPageOverlay.h
r69614 r69616 24 24 */ 25 25 26 #ifndef Find Controller_h27 #define Find Controller_h26 #ifndef FindPageOverlay_h 27 #define FindPageOverlay_h 28 28 29 #include "FindOptions.h" 30 #include <wtf/Forward.h> 31 #include <wtf/Noncopyable.h> 32 33 namespace WebCore { 34 class Frame; 35 } 29 #include "PageOverlay.h" 30 #include <wtf/PassOwnPtr.h> 36 31 37 32 namespace WebKit { 38 33 39 class WebPage;34 class FindController; 40 35 41 class FindController { 42 WTF_MAKE_NONCOPYABLE(FindController); 43 36 class FindPageOverlay : public PageOverlay { 44 37 public: 45 explicit FindController(WebPage*); 46 47 void findString(const String&, FindDirection, FindOptions, unsigned maxNumMatches); 48 void hideFindUI(); 38 static PassOwnPtr<FindPageOverlay> create(FindController*); 39 virtual ~FindPageOverlay(); 49 40 50 41 private: 51 WebPage* m_webPage; 42 explicit FindPageOverlay(FindController*); 43 44 // PageOverlay. 45 virtual void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect); 46 47 FindController* m_findController; 52 48 }; 53 49 54 50 } // namespace WebKit 55 51 56 #endif // Find Controller_h52 #endif // FindPageOverlay_h -
trunk/WebKit2/WebProcess/WebPage/PageOverlay.cpp
r69614 r69616 24 24 */ 25 25 26 #ifndef FindController_h 27 #define FindController_h 26 #include "PageOverlay.h" 28 27 29 #include "FindOptions.h" 30 #include <wtf/Forward.h> 31 #include <wtf/Noncopyable.h> 28 #include "WebPage.h" 32 29 33 namespace WebCore { 34 class Frame; 35 } 30 using namespace WebCore; 36 31 37 32 namespace WebKit { 38 33 39 class WebPage; 34 PageOverlay::PageOverlay() 35 : m_webPage(0) 36 { 37 } 40 38 41 class FindController { 42 WTF_MAKE_NONCOPYABLE(FindController); 39 PageOverlay::~PageOverlay() 40 { 41 } 43 42 44 public: 45 explicit FindController(WebPage*); 43 void PageOverlay::setPage(WebPage* webPage) 44 { 45 ASSERT(!m_webPage); 46 46 47 void findString(const String&, FindDirection, FindOptions, unsigned maxNumMatches); 48 void hideFindUI(); 47 m_webPage = webPage; 48 setNeedsDisplay(); 49 } 49 50 50 private: 51 WebPage* m_webPage; 52 }; 51 void PageOverlay::setNeedsDisplay() 52 { 53 m_webPage->drawingArea()->setNeedsDisplay(IntRect(IntPoint(), m_webPage->size())); 54 } 53 55 54 56 } // namespace WebKit 55 56 #endif // FindController_h -
trunk/WebKit2/WebProcess/WebPage/PageOverlay.h
r69614 r69616 24 24 */ 25 25 26 #ifndef FindController_h27 #define FindController_h26 #ifndef PageOverlay_h 27 #define PageOverlay_h 28 28 29 #include "FindOptions.h"30 #include <wtf/Forward.h>31 29 #include <wtf/Noncopyable.h> 32 30 33 31 namespace WebCore { 34 class Frame; 32 class GraphicsContext; 33 class IntRect; 35 34 } 36 35 … … 39 38 class WebPage; 40 39 41 class FindController{42 WTF_MAKE_NONCOPYABLE( FindController);40 class PageOverlay { 41 WTF_MAKE_NONCOPYABLE(PageOverlay); 43 42 44 43 public: 45 explicit FindController(WebPage*); 44 virtual ~PageOverlay(); 45 virtual void drawRect(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect) = 0; 46 47 void setPage(WebPage*); 48 void setNeedsDisplay(); 46 49 47 void findString(const String&, FindDirection, FindOptions, unsigned maxNumMatches); 48 void hideFindUI();50 protected: 51 PageOverlay(); 49 52 50 53 private: … … 54 57 } // namespace WebKit 55 58 56 #endif // FindController_h59 #endif // PageOverlay_h -
trunk/WebKit2/WebProcess/WebPage/WebPage.cpp
r69598 r69616 31 31 #include "MessageID.h" 32 32 #include "NetscapePlugin.h" 33 #include "PageOverlay.h" 33 34 #include "PluginProcessConnection.h" 34 35 #include "PluginProcessConnectionManager.h" … … 383 384 m_mainFrame->coreFrame()->view()->paint(&graphicsContext, rect); 384 385 graphicsContext.restore(); 386 387 if (m_pageOverlay) { 388 graphicsContext.save(); 389 graphicsContext.clip(rect); 390 m_pageOverlay->drawRect(graphicsContext, rect); 391 graphicsContext.restore(); 392 } 385 393 } 386 394 … … 423 431 return; 424 432 return frame->setPageAndTextZoomFactors(static_cast<float>(pageZoomFactor), static_cast<float>(textZoomFactor)); 433 } 434 435 void WebPage::installPageOverlay(PassOwnPtr<PageOverlay> pageOverlay) 436 { 437 m_pageOverlay = pageOverlay; 438 m_pageOverlay->setPage(this); 439 } 440 441 void WebPage::uninstallPageOverlay() 442 { 443 m_pageOverlay = 0; 425 444 } 426 445 -
trunk/WebKit2/WebProcess/WebPage/WebPage.h
r69598 r69616 65 65 66 66 class DrawingArea; 67 class PageOverlay; 67 68 class PluginView; 68 69 class WebEvent; … … 157 158 HWND nativeWindow() const { return m_nativeWindow; } 158 159 #endif 160 161 void installPageOverlay(PassOwnPtr<PageOverlay>); 162 void uninstallPageOverlay(); 159 163 160 164 static const WebEvent* currentEvent(); … … 253 257 254 258 FindController m_findController; 259 OwnPtr<PageOverlay> m_pageOverlay; 255 260 256 261 uint64_t m_pageID; -
trunk/WebKit2/win/WebKit2.vcproj
r69598 r69616 1045 1045 </File> 1046 1046 <File 1047 RelativePath="..\WebProcess\WebPage\FindPageOverlay.cpp" 1048 > 1049 </File> 1050 <File 1051 RelativePath="..\WebProcess\WebPage\FindPageOverlay.h" 1052 > 1053 </File> 1054 <File 1055 RelativePath="..\WebProcess\WebPage\PageOverlay.cpp" 1056 > 1057 </File> 1058 <File 1059 RelativePath="..\WebProcess\WebPage\PageOverlay.h" 1060 > 1061 </File> 1062 <File 1047 1063 RelativePath="..\WebProcess\WebPage\WebBackForwardListProxy.cpp" 1048 1064 > -
trunk/WebKitTools/ChangeLog
r69597 r69616 1 2010-10-12 Anders Carlsson <andersca@apple.com> 2 3 Reviewed by Sam Weinig. 4 5 Start fleshing out find page overlays 6 https://bugs.webkit.org/show_bug.cgi?id=47559 7 8 * MiniBrowser/mac/BrowserWindowController.m: 9 (-[BrowserWindowController find:]): 10 Pass kWKFindOptionsShowOverlay to WKPageFindString. 11 1 12 2010-10-12 Robert Hogan <robert@webkit.org> 2 13 -
trunk/WebKitTools/MiniBrowser/mac/BrowserWindowController.m
r69595 r69616 670 670 671 671 WKPageFindString(_webView.pageRef, string, kWKFindDirectionForward, 672 kWKFindOptionsCaseInsensitive | kWKFindOptionsWrapAround | kWKFindOptionsShowFindIndicator , 100);672 kWKFindOptionsCaseInsensitive | kWKFindOptionsWrapAround | kWKFindOptionsShowFindIndicator | kWKFindOptionsShowOverlay, 100); 673 673 } 674 674
Note: See TracChangeset
for help on using the changeset viewer.