Reviewed by Tim Hatcher.
authoraliceli1 <aliceli1@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Oct 2006 06:43:54 +0000 (06:43 +0000)
committeraliceli1 <aliceli1@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Oct 2006 06:43:54 +0000 (06:43 +0000)
        Fixed a problem where the webview passed to the EditorClient wasn't valid yet.

        * WebCoreSupport/WebEditorClient.h:
        (WebEditorClient::setWebView):
        added webview setter

        * WebCoreSupport/WebEditorClient.mm:
        (WebEditorClient::WebEditorClient):
        add default constructor

        * WebCoreSupport/WebFrameBridge.m:
        (-[WebFrameBridge initMainFrameWithPage:frameName:view:]):
        use [page webView] since _webview isn't valid yet
        (-[WebFrameBridge initSubframeWithOwnerElement:frameName:view:]):
        use webview setter on editorclient

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

WebKit/ChangeLog
WebKit/WebCoreSupport/WebEditorClient.h
WebKit/WebCoreSupport/WebEditorClient.mm
WebKit/WebCoreSupport/WebFrameBridge.m

index dfcefb406b52faf1b8010a5f6d38964598bbf5cd..c34fae21795b5eaf2b348ecd26141b56d317b806 100644 (file)
@@ -1,3 +1,23 @@
+2006-10-20  Alice Liu  <alice.liu@apple.com>
+
+        Reviewed by Tim Hatcher.
+
+        Fixed a problem where the webview passed to the EditorClient wasn't valid yet.  
+
+        * WebCoreSupport/WebEditorClient.h:
+        (WebEditorClient::setWebView):
+        added webview setter
+
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::WebEditorClient):
+        add default constructor
+
+        * WebCoreSupport/WebFrameBridge.m:
+        (-[WebFrameBridge initMainFrameWithPage:frameName:view:]):
+        use [page webView] since _webview isn't valid yet
+        (-[WebFrameBridge initSubframeWithOwnerElement:frameName:view:]):
+        use webview setter on editorclient
+
 2006-10-20  David Hyatt  <hyatt@apple.com>
 
         Tweak cache sizes so that they are back to the way they were,
index f171e81b2135787ee542c202c1181e571e743a2d..2fc23068830de1ef03942626c4fe630710210241 100644 (file)
 class WebEditorClient : public WebCore::EditorClient
 {
 public:
+    WebEditorClient();
     WebEditorClient(WebView* webView);
     ~WebEditorClient();
 
+    void setWebView(WebView* webView) { m_webView = webView; }
     bool shouldDeleteRange(WebCore::Range *range);    
 //    bool shouldBeginEditingInRange(Range *range);
 //    bool shouldEndEditingInRange(Range *range);
index de403a0c2360bab433dfec873e2e5a61c13a9f67..a29fd51f5699ed9c73fb4ce7be4ac5ff4bb5a48f 100644 (file)
 
 using namespace WebCore;
 
+WebEditorClient::WebEditorClient()
+    : m_webView(NULL) 
+{ }
+
 WebEditorClient::WebEditorClient(WebView* webView)
     : m_webView(webView) 
 {
index 8c5493c1a24f2e9705917832e1b2c52d513f879c..c2d9c2a3d418ce9acddfcfa6f572294eaebb953c 100644 (file)
@@ -119,7 +119,7 @@ NSString *WebPluginContainerKey =   @"WebPluginContainer";
 
 - (id)initMainFrameWithPage:(WebPageBridge *)page frameName:(NSString *)name view:(WebFrameView *)view
 {
-    self = [super initMainFrameWithPage:page withEditorClient:new WebEditorClient([view _webView])];
+    self = [super initMainFrameWithPage:page withEditorClient:new WebEditorClient([page webView])];
     _frame = [[WebFrame alloc] _initWithWebFrameView:view webView:[self webView] bridge:self];
 
     ++WebBridgeCount;
@@ -133,9 +133,11 @@ NSString *WebPluginContainerKey =   @"WebPluginContainer";
 
 - (id)initSubframeWithOwnerElement:(WebCoreElement *)ownerElement frameName:(NSString *)name view:(WebFrameView *)view
 {
-    self = [super initSubframeWithOwnerElement:ownerElement withEditorClient:new WebEditorClient([view _webView])];
+    WebEditorClient* editorClient = new WebEditorClient();
+    self = [super initSubframeWithOwnerElement:ownerElement withEditorClient:new WebEditorClient()];
     _frame = [[WebFrame alloc] _initWithWebFrameView:view webView:[self webView] bridge:self];
-
+    editorClient->setWebView([self webView]);
+    editorClient->deref();
     ++WebBridgeCount;
 
     [self setName:name];