X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c02aa4b3a1cb95dce9232adc99876567085e6aff..f7f8a13c0466725ffffc0cbe9f10da729c3423dd:/src/osx/webview_webkit.mm diff --git a/src/osx/webview_webkit.mm b/src/osx/webview_webkit.mm index 1609dfd59a..a311bb3d34 100644 --- a/src/osx/webview_webkit.mm +++ b/src/osx/webview_webkit.mm @@ -5,7 +5,6 @@ // Author: Jethro Grassie / Kevin Ollivier / Marianne Gagnon // Modified by: // Created: 2004-4-16 -// RCS-ID: $Id$ // Copyright: (c) Jethro Grassie / Kevin Ollivier / Marianne Gagnon // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -645,10 +644,11 @@ void wxWebViewWebKit::SetScrollPos(int pos) wxString wxWebViewWebKit::GetSelectedText() const { - NSString* selection = [[m_webView selectedDOMRange] markupString]; - if (!selection) return wxEmptyString; + DOMRange* dr = [m_webView selectedDOMRange]; + if ( !dr ) + return wxString(); - return wxStringWithNSString(selection); + return wxStringWithNSString([dr toString]); } void wxWebViewWebKit::RunScript(const wxString& javascript) @@ -905,13 +905,11 @@ void wxWebViewWebKit::SelectAll() wxString wxWebViewWebKit::GetSelectedSource() const { - wxString script = ("var range = window.getSelection().getRangeAt(0);" - "var element = document.createElement('div');" - "element.appendChild(range.cloneContents());" - "return element.innerHTML;"); - NSString *result = [m_webView stringByEvaluatingJavaScriptFromString: - wxNSStringWithWxString(script)]; - return wxStringWithNSString(result); + DOMRange* dr = [m_webView selectedDOMRange]; + if ( !dr ) + return wxString(); + + return wxStringWithNSString([dr markupString]); } wxString wxWebViewWebKit::GetPageText() const