[webkit-help] Problem extending WebViewUndoableEditing

Alexander Shulgin alexander.shulgin at yessoftware.com
Fri Aug 20 08:30:07 PDT 2010


Hi,

I'm trying to add this functionality which will allow us to execute 
arbitrary undoable content editing commands.

I've added new editing command interface like this:

@interface WebEditingCommand : NSObject {
}
- (void)apply;
- (void)unapply;
- (void)reapply;
@end

In WebKit/mac/WebView/WebView.h I've extended WebViewUndoableEditing 
like this:

@interface WebView (WebViewUndoableEditing)
- (void)replaceSelectionWithNode:(DOMNode *)node;
- (void)replaceSelectionWithText:(NSString *)text;
- (void)replaceSelectionWithMarkupString:(NSString *)markupString;
- (void)replaceSelectionWithArchive:(WebArchive *)archive;
- (void)deleteSelection;
- (void)applyStyle:(DOMCSSStyleDeclaration *)style;

// *** added this line:
- (void)applyEditingCommand:(WebEditingCommand *)command;
@end

Then I've added a new C++ class CustomWebCoreEditingCommand which is 
inherited from WebCore::SimpleEditCommand (please see attached files) 
and put it under WebKit/mac/WebCoreSupport.  Also added these new files 
to XCode project.

Now then I compile the whole thing I get these linker errors:

Undefined symbols:
   "__ZNK7WebCore11EditCommand19isInsertTextCommandEv", referenced from:
       __ZTV27CustomWebCoreEditingCommand in CustomWebCoreEditingCommand.o
       __ZTVN7WebCore17SimpleEditCommandE in CustomWebCoreEditingCommand.o
   "__ZN7WebCore11EditCommand9doReapplyEv", referenced from:
       __ZTVN7WebCore17SimpleEditCommandE in CustomWebCoreEditingCommand.o
...
(more messages like this all related to WebCore::EditCommand::something)

For no obvious reason it complains about not being able to find these 
symbols from WebCore::EditCommand, while they are certainly there in the 
WebCore library...  I even checked with nm tool to see if name mangling 
is the same, and it is.

I originally tried it with ObjC++ files which gave me exactly the same 
linking problem.  So now I tried to separate C++ and ObjectiveC 
(square-bracket calls on WebEditingCommand interface moved to 
WebEditingCommandCppBridge.mm file), but to no avail.

Later I noticed there are several C++ classes in WebCoreSupport folder 
which inherit some WebCore class but use some ObjC syntax w/o any 
problem.  Why doesn't this work for my class?

Am I missing something?

--
Regards,
Alex
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CustomWebCoreEditingCommand.cpp
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20100820/395e077e/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CustomWebCoreEditingCommand.h
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20100820/395e077e/attachment.h>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: WebEditingCommand.h
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20100820/395e077e/attachment-0001.h>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: WebEditingCommandCppBridge.h
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20100820/395e077e/attachment-0002.h>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: WebEditingCommandCppBridge.mm
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20100820/395e077e/attachment-0001.ksh>


More information about the webkit-help mailing list