2011-03-01 Jeff Miller <jeffm@apple.com>
authorjeffm@apple.com <jeffm@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Mar 2011 14:52:31 +0000 (14:52 +0000)
committerjeffm@apple.com <jeffm@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Mar 2011 14:52:31 +0000 (14:52 +0000)
        Reviewed by Darin Adler.

        Expose some selection state fields in WKPage
        https://bugs.webkit.org/show_bug.cgi?id=55541

        Added WKPageCanDelete(), WKPageHasSelectedRange(), and WKPageIsContentEditable() so we can enable some
        Edit menu items properly on Windows when using WebKit2.

        * UIProcess/API/C/WKPage.cpp:
        (WKPageCanDelete): Added.
        (WKPageHasSelectedRange): Added.
        (WKPageIsContentEditable): Added.
        * UIProcess/API/C/WKPage.h: Added new functions.
        * UIProcess/WebPageProxy.h:
        (WebKit::WebPageProxy::canDelete): Added.
        (WebKit::WebPageProxy::hasSelectedRange): Added.
        (WebKit::WebPageProxy::isContentEditable): Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@80125 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKPage.cpp
Source/WebKit2/UIProcess/API/C/WKPage.h
Source/WebKit2/UIProcess/WebPageProxy.h

index 00c4e06..22f7012 100644 (file)
@@ -1,3 +1,23 @@
+2011-03-01  Jeff Miller  <jeffm@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Expose some selection state fields in WKPage
+        https://bugs.webkit.org/show_bug.cgi?id=55541
+        
+        Added WKPageCanDelete(), WKPageHasSelectedRange(), and WKPageIsContentEditable() so we can enable some
+        Edit menu items properly on Windows when using WebKit2.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageCanDelete): Added.
+        (WKPageHasSelectedRange): Added.
+        (WKPageIsContentEditable): Added.
+        * UIProcess/API/C/WKPage.h: Added new functions.
+        * UIProcess/WebPageProxy.h:
+        (WebKit::WebPageProxy::canDelete): Added.
+        (WebKit::WebPageProxy::hasSelectedRange): Added.
+        (WebKit::WebPageProxy::isContentEditable): Added.
+
 2011-03-01  Mark Rowe  <mrowe@apple.com>
 
         Hide the typeinfo name symbols for std::exception and std::bad_alloc too.
index b6c44aa..f70bb9e 100644 (file)
@@ -316,6 +316,21 @@ bool WKPageIsPinnedToRightSide(WKPageRef pageRef)
     return toImpl(pageRef)->isPinnedToRightSide();
 }
 
+bool WKPageCanDelete(WKPageRef pageRef)
+{
+    return toImpl(pageRef)->canDelete();
+}
+
+bool WKPageHasSelectedRange(WKPageRef pageRef)
+{
+    return toImpl(pageRef)->hasSelectedRange();
+}
+
+bool WKPageIsContentEditable(WKPageRef pageRef)
+{
+    return toImpl(pageRef)->isContentEditable();
+}
+
 void WKPageFindString(WKPageRef pageRef, WKStringRef string, WKFindOptions options, unsigned maxMatchCount)
 {
     toImpl(pageRef)->findString(toImpl(string)->string(), toFindOptions(options), maxMatchCount);
index f014e51..91ccf78 100644 (file)
@@ -323,6 +323,10 @@ WK_EXPORT bool WKPageHasVerticalScrollbar(WKPageRef page);
 WK_EXPORT bool WKPageIsPinnedToLeftSide(WKPageRef page);
 WK_EXPORT bool WKPageIsPinnedToRightSide(WKPageRef page);
 
+WK_EXPORT bool WKPageCanDelete(WKPageRef page);
+WK_EXPORT bool WKPageHasSelectedRange(WKPageRef page);
+WK_EXPORT bool WKPageIsContentEditable(WKPageRef page);
+
 WK_EXPORT void WKPageFindString(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount);
 WK_EXPORT void WKPageHideFindUI(WKPageRef page);
 WK_EXPORT void WKPageCountStringMatches(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount);
index df98acb..849e96d 100644 (file)
@@ -202,6 +202,9 @@ public:
     void validateMenuItem(const String& commandName);
 
     const SelectionState& selectionState() const { return m_selectionState; }
+    bool canDelete() const { return hasSelectedRange() && isContentEditable(); }
+    bool hasSelectedRange() const { return m_selectionState.selectedRangeLength; }
+    bool isContentEditable() const { return m_selectionState.isContentEditable; }
 
 #if PLATFORM(MAC)
     void updateWindowIsVisible(bool windowIsVisible);