diff options
Diffstat (limited to 'Source/WebCore/bindings/gobject')
16 files changed, 1934 insertions, 0 deletions
diff --git a/Source/WebCore/bindings/gobject/ConvertToUTF8String.cpp b/Source/WebCore/bindings/gobject/ConvertToUTF8String.cpp new file mode 100644 index 0000000..67375e4 --- /dev/null +++ b/Source/WebCore/bindings/gobject/ConvertToUTF8String.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2008 Luke Kenneth Casson Leighton <lkcl@lkcl.net> + * Copyright (C) 2010 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "ConvertToUTF8String.h" + +#include "KURL.h" +#include "PlatformString.h" +#include <wtf/text/CString.h> + +#include <glib.h> + +gchar* convertToUTF8String(WTF::String const& s) +{ + return g_strdup(s.utf8().data()); +} + +gchar* convertToUTF8String(WebCore::KURL const& s) +{ + return g_strdup(s.string().utf8().data()); +} + diff --git a/Source/WebCore/bindings/gobject/ConvertToUTF8String.h b/Source/WebCore/bindings/gobject/ConvertToUTF8String.h new file mode 100644 index 0000000..bc234cf --- /dev/null +++ b/Source/WebCore/bindings/gobject/ConvertToUTF8String.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2008 Luke Kenneth Casson Leighton <lkcl@lkcl.net> + * Copyright (C) 2010 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef ConvertToUTF8String_h +#define ConvertToUTF8String_h + +#include <wtf/Forward.h> + +namespace WebCore { +class KURL; +} + +typedef char gchar; + +gchar* convertToUTF8String(WTF::String const& s); +gchar* convertToUTF8String(WebCore::KURL const& s); + +#endif /* ConvertToUTF8String_h */ diff --git a/Source/WebCore/bindings/gobject/DOMObjectCache.cpp b/Source/WebCore/bindings/gobject/DOMObjectCache.cpp new file mode 100644 index 0000000..2e7f106 --- /dev/null +++ b/Source/WebCore/bindings/gobject/DOMObjectCache.cpp @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "DOMObjectCache.h" + +#include "Document.h" +#include "Node.h" +#include "glib-object.h" +#include <wtf/HashMap.h> + +namespace WebKit { + +typedef struct { + GObject* object; + WebCore::Frame* frame; + guint timesReturned; +} DOMObjectCacheData; + +typedef HashMap<void*, DOMObjectCacheData*> DOMObjectMap; + +static DOMObjectMap& domObjects() +{ + static DOMObjectMap staticDOMObjects; + return staticDOMObjects; +} + +static WebCore::Frame* getFrameFromHandle(void* objectHandle) +{ + WebCore::Node* node = static_cast<WebCore::Node*>(objectHandle); + if (!node->inDocument()) + return 0; + WebCore::Document* document = node->document(); + if (!document) + return 0; + return document->frame(); +} + +void DOMObjectCache::forget(void* objectHandle) +{ + DOMObjectCacheData* cacheData = domObjects().get(objectHandle); + ASSERT(cacheData); + g_slice_free(DOMObjectCacheData, cacheData); + domObjects().take(objectHandle); +} + +static void weakRefNotify(gpointer data, GObject* zombie) +{ + gboolean* objectDead = static_cast<gboolean*>(data); + *objectDead = TRUE; +} + +void DOMObjectCache::clearByFrame(WebCore::Frame* frame) +{ + Vector<DOMObjectCacheData*> toUnref; + + // Unreffing the objects removes them from the cache in their + // finalize method, so just save them to do that while we are not + // iterating the cache itself. + DOMObjectMap::iterator end = domObjects().end(); + for (DOMObjectMap::iterator iter = domObjects().begin(); iter != end; ++iter) { + DOMObjectCacheData* data = iter->second; + ASSERT(data); + if ((!frame || data->frame == frame) && data->timesReturned) + toUnref.append(data); + } + + Vector<DOMObjectCacheData*>::iterator last = toUnref.end(); + for (Vector<DOMObjectCacheData*>::iterator it = toUnref.begin(); it != last; ++it) { + DOMObjectCacheData* data = *it; + // We can't really know what the user has done with the DOM + // objects, so in case any of the external references to them + // were unreffed (but not all, otherwise the object would be + // dead and out of the cache) we'll add a weak ref before we + // start to get rid of the cache's own references; if the + // object dies in the middle of the process, we'll just stop. + gboolean objectDead = FALSE; + g_object_weak_ref(data->object, weakRefNotify, &objectDead); + // We need to check objectDead first, otherwise the cache data + // might be garbage already. + while (!objectDead && data->timesReturned > 0) { + // If this is the last unref we are going to do, + // disconnect the weak ref. We cannot do it afterwards + // because the object might be dead at that point. + if (data->timesReturned == 1) + g_object_weak_unref(data->object, weakRefNotify, &objectDead); + data->timesReturned--; + g_object_unref(data->object); + } + } +} + +DOMObjectCache::~DOMObjectCache() +{ + clearByFrame(); +} + +void* DOMObjectCache::get(void* objectHandle) +{ + DOMObjectCacheData* data = domObjects().get(objectHandle); + if (!data) + return 0; + + // We want to add one ref each time a wrapper is returned, so that + // the user can manually unref them if he chooses to. + ASSERT(data->object); + data->timesReturned++; + return g_object_ref(data->object); +} + +void* DOMObjectCache::put(void* objectHandle, void* wrapper) +{ + if (domObjects().get(objectHandle)) + return wrapper; + + DOMObjectCacheData* data = g_slice_new(DOMObjectCacheData); + data->object = static_cast<GObject*>(wrapper); + data->frame = 0; + data->timesReturned = 1; + + domObjects().set(objectHandle, data); + return wrapper; +} + +void* DOMObjectCache::put(WebCore::Node* objectHandle, void* wrapper) +{ + // call the ::put version that takes void* to do the basic cache + // insertion work + put(static_cast<void*>(objectHandle), wrapper); + + DOMObjectCacheData* data = domObjects().get(objectHandle); + ASSERT(data); + + data->frame = getFrameFromHandle(objectHandle); + + return wrapper; +} + +} diff --git a/Source/WebCore/bindings/gobject/DOMObjectCache.h b/Source/WebCore/bindings/gobject/DOMObjectCache.h new file mode 100644 index 0000000..568e8b6 --- /dev/null +++ b/Source/WebCore/bindings/gobject/DOMObjectCache.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DOMObjectCache_h +#define DOMObjectCache_h + +namespace WebCore { +class Node; +class Frame; +}; + +namespace WebKit { +class DOMObjectCache { +public: + static void* get(void* objectHandle); + static void* put(void* objectHandle, void* wrapper); + static void* put(WebCore::Node* objectHandle, void* wrapper); + static void clearByFrame(WebCore::Frame* frame = 0); + static void forget(void* objectHandle); + ~DOMObjectCache(); +}; +} // namespace WebKit + +#endif diff --git a/Source/WebCore/bindings/gobject/GNUmakefile.am b/Source/WebCore/bindings/gobject/GNUmakefile.am new file mode 100644 index 0000000..b4f98d1 --- /dev/null +++ b/Source/WebCore/bindings/gobject/GNUmakefile.am @@ -0,0 +1,427 @@ +webkitgtk_gdom_built_sources += \ + DerivedSources/webkit/WebKitDOMAttr.cpp \ + DerivedSources/webkit/WebKitDOMAttrPrivate.h \ + DerivedSources/webkit/WebKitDOMBarInfo.cpp \ + DerivedSources/webkit/WebKitDOMBarInfoPrivate.h \ + DerivedSources/webkit/WebKitDOMBlob.cpp \ + DerivedSources/webkit/WebKitDOMBlobPrivate.h \ + DerivedSources/webkit/WebKitDOMCDATASection.cpp \ + DerivedSources/webkit/WebKitDOMCDATASectionPrivate.h \ + DerivedSources/webkit/WebKitDOMCharacterData.cpp \ + DerivedSources/webkit/WebKitDOMCharacterDataPrivate.h \ + DerivedSources/webkit/WebKitDOMComment.cpp \ + DerivedSources/webkit/WebKitDOMCommentPrivate.h \ + DerivedSources/webkit/WebKitDOMConsole.cpp \ + DerivedSources/webkit/WebKitDOMConsolePrivate.h \ + DerivedSources/webkit/WebKitDOMCSSRule.cpp \ + DerivedSources/webkit/WebKitDOMCSSRuleList.cpp \ + DerivedSources/webkit/WebKitDOMCSSRuleListPrivate.h \ + DerivedSources/webkit/WebKitDOMCSSRulePrivate.h \ + DerivedSources/webkit/WebKitDOMCSSStyleDeclaration.cpp \ + DerivedSources/webkit/WebKitDOMCSSStyleDeclarationPrivate.h \ + DerivedSources/webkit/WebKitDOMCSSStyleSheet.cpp \ + DerivedSources/webkit/WebKitDOMCSSStyleSheetPrivate.h \ + DerivedSources/webkit/WebKitDOMCSSValue.cpp \ + DerivedSources/webkit/WebKitDOMCSSValuePrivate.h \ + DerivedSources/webkit/WebKitDOMDatabase.cpp \ + DerivedSources/webkit/WebKitDOMDatabasePrivate.h \ + DerivedSources/webkit/WebKitDOMDocument.cpp \ + DerivedSources/webkit/WebKitDOMDocumentFragment.cpp \ + DerivedSources/webkit/WebKitDOMDocumentFragmentPrivate.h \ + DerivedSources/webkit/WebKitDOMDocumentPrivate.h \ + DerivedSources/webkit/WebKitDOMDocumentType.cpp \ + DerivedSources/webkit/WebKitDOMDocumentTypePrivate.h \ + DerivedSources/webkit/WebKitDOMDOMApplicationCache.cpp \ + DerivedSources/webkit/WebKitDOMDOMApplicationCachePrivate.h \ + DerivedSources/webkit/WebKitDOMDOMImplementation.cpp \ + DerivedSources/webkit/WebKitDOMDOMImplementationPrivate.h \ + DerivedSources/webkit/WebKitDOMDOMMimeTypeArray.cpp \ + DerivedSources/webkit/WebKitDOMDOMMimeTypeArrayPrivate.h \ + DerivedSources/webkit/WebKitDOMDOMMimeType.cpp \ + DerivedSources/webkit/WebKitDOMDOMMimeTypePrivate.h \ + DerivedSources/webkit/WebKitDOMDOMPluginArray.cpp \ + DerivedSources/webkit/WebKitDOMDOMPluginArrayPrivate.h \ + DerivedSources/webkit/WebKitDOMDOMPlugin.cpp \ + DerivedSources/webkit/WebKitDOMDOMPluginPrivate.h \ + DerivedSources/webkit/WebKitDOMDOMSelection.cpp \ + DerivedSources/webkit/WebKitDOMDOMSelectionPrivate.h \ + DerivedSources/webkit/WebKitDOMDOMStringList.cpp \ + DerivedSources/webkit/WebKitDOMDOMStringListPrivate.h \ + DerivedSources/webkit/WebKitDOMDOMStringMap.cpp \ + DerivedSources/webkit/WebKitDOMDOMStringMapPrivate.h \ + DerivedSources/webkit/WebKitDOMDOMSettableTokenList.cpp \ + DerivedSources/webkit/WebKitDOMDOMSettableTokenListPrivate.h \ + DerivedSources/webkit/WebKitDOMDOMTokenList.cpp \ + DerivedSources/webkit/WebKitDOMDOMTokenListPrivate.h \ + DerivedSources/webkit/WebKitDOMDOMWindow.cpp \ + DerivedSources/webkit/WebKitDOMDOMWindowPrivate.h \ + DerivedSources/webkit/WebKitDOMElement.cpp \ + DerivedSources/webkit/WebKitDOMElementPrivate.h \ + DerivedSources/webkit/WebKitDOMEntityReference.cpp \ + DerivedSources/webkit/WebKitDOMEntityReferencePrivate.h \ + DerivedSources/webkit/WebKitDOMEvent.cpp \ + DerivedSources/webkit/WebKitDOMEventPrivate.h \ + DerivedSources/webkit/WebKitDOMEventTargetPrivate.h \ + DerivedSources/webkit/WebKitDOMFile.cpp \ + DerivedSources/webkit/WebKitDOMFileList.cpp \ + DerivedSources/webkit/WebKitDOMFileListPrivate.h \ + DerivedSources/webkit/WebKitDOMFilePrivate.h \ + DerivedSources/webkit/WebKitDOMHistory.cpp \ + DerivedSources/webkit/WebKitDOMHistoryPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLAnchorElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLAnchorElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLAppletElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLAppletElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLAreaElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLAreaElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLBaseElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLBaseElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLBaseFontElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLBaseFontElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLBlockquoteElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLBlockquoteElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLBodyElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLBodyElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLBRElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLBRElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLButtonElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLButtonElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLCanvasElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLCanvasElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLCollection.cpp \ + DerivedSources/webkit/WebKitDOMHTMLCollectionPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLDetailsElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLDetailsElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLDirectoryElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLDirectoryElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLDivElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLDivElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLDListElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLDListElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLDocument.cpp \ + DerivedSources/webkit/WebKitDOMHTMLDocumentPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLEmbedElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLEmbedElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLFieldSetElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLFieldSetElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLFontElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLFontElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLFormElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLFormElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLFrameElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLFrameElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLFrameSetElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLFrameSetElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLHeadElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLHeadElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLHeadingElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLHeadingElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLHRElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLHRElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLHtmlElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLHtmlElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLIFrameElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLIFrameElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLImageElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLImageElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLInputElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLInputElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLIsIndexElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLIsIndexElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLLabelElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLLabelElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLLegendElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLLegendElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLLIElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLLIElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLLinkElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLLinkElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLMapElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLMapElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLMarqueeElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLMarqueeElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLMediaElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLMediaElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLMenuElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLMenuElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLMetaElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLMetaElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLModElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLModElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLObjectElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLObjectElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLOListElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLOListElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLOptGroupElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLOptGroupElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLOptionElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLOptionElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLOptionsCollection.cpp \ + DerivedSources/webkit/WebKitDOMHTMLOptionsCollectionPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLParagraphElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLParagraphElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLParamElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLParamElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLPreElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLPreElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLQuoteElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLQuoteElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLScriptElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLScriptElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLSelectElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLSelectElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLStyleElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLStyleElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLTableCaptionElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLTableCaptionElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLTableCellElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLTableCellElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLTableColElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLTableColElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLTableElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLTableElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLTableRowElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLTableRowElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLTableSectionElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLTableSectionElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLTextAreaElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLTextAreaElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLTitleElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLTitleElementPrivate.h \ + DerivedSources/webkit/WebKitDOMHTMLUListElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLUListElementPrivate.h \ + DerivedSources/webkit/WebKitDOMLocation.cpp \ + DerivedSources/webkit/WebKitDOMLocationPrivate.h \ + DerivedSources/webkit/WebKitDOMMediaError.cpp \ + DerivedSources/webkit/WebKitDOMMediaErrorPrivate.h \ + DerivedSources/webkit/WebKitDOMMediaList.cpp \ + DerivedSources/webkit/WebKitDOMMediaListPrivate.h \ + DerivedSources/webkit/WebKitDOMMediaQueryList.cpp \ + DerivedSources/webkit/WebKitDOMMediaQueryListPrivate.h \ + DerivedSources/webkit/WebKitDOMMemoryInfo.cpp \ + DerivedSources/webkit/WebKitDOMMemoryInfoPrivate.h \ + DerivedSources/webkit/WebKitDOMMessagePort.cpp \ + DerivedSources/webkit/WebKitDOMMessagePortPrivate.h \ + DerivedSources/webkit/WebKitDOMMouseEvent.cpp \ + DerivedSources/webkit/WebKitDOMMouseEventPrivate.h \ + DerivedSources/webkit/WebKitDOMNamedNodeMap.cpp \ + DerivedSources/webkit/WebKitDOMNamedNodeMapPrivate.h \ + DerivedSources/webkit/WebKitDOMNavigator.cpp \ + DerivedSources/webkit/WebKitDOMNavigatorPrivate.h \ + DerivedSources/webkit/WebKitDOMNode.cpp \ + DerivedSources/webkit/WebKitDOMNodeFilter.cpp \ + DerivedSources/webkit/WebKitDOMNodeFilterPrivate.h \ + DerivedSources/webkit/WebKitDOMNodeIterator.cpp \ + DerivedSources/webkit/WebKitDOMNodeIteratorPrivate.h \ + DerivedSources/webkit/WebKitDOMNodeList.cpp \ + DerivedSources/webkit/WebKitDOMNodeListPrivate.h \ + DerivedSources/webkit/WebKitDOMNodePrivate.h \ + DerivedSources/webkit/WebKitDOMProcessingInstruction.cpp \ + DerivedSources/webkit/WebKitDOMProcessingInstructionPrivate.h \ + DerivedSources/webkit/WebKitDOMRange.cpp \ + DerivedSources/webkit/WebKitDOMRangePrivate.h \ + DerivedSources/webkit/WebKitDOMScreen.cpp \ + DerivedSources/webkit/WebKitDOMScreenPrivate.h \ + DerivedSources/webkit/WebKitDOMStorage.cpp \ + DerivedSources/webkit/WebKitDOMStoragePrivate.h \ + DerivedSources/webkit/WebKitDOMStyleMedia.cpp \ + DerivedSources/webkit/WebKitDOMStyleMediaPrivate.h \ + DerivedSources/webkit/WebKitDOMStyleSheet.cpp \ + DerivedSources/webkit/WebKitDOMStyleSheetList.cpp \ + DerivedSources/webkit/WebKitDOMStyleSheetListPrivate.h \ + DerivedSources/webkit/WebKitDOMStyleSheetPrivate.h \ + DerivedSources/webkit/WebKitDOMText.cpp \ + DerivedSources/webkit/WebKitDOMTextPrivate.h \ + DerivedSources/webkit/WebKitDOMTimeRanges.cpp \ + DerivedSources/webkit/WebKitDOMTimeRangesPrivate.h \ + DerivedSources/webkit/WebKitDOMTreeWalker.cpp \ + DerivedSources/webkit/WebKitDOMTreeWalkerPrivate.h \ + DerivedSources/webkit/WebKitDOMUIEvent.cpp \ + DerivedSources/webkit/WebKitDOMUIEventPrivate.h \ + DerivedSources/webkit/WebKitDOMValidityState.cpp \ + DerivedSources/webkit/WebKitDOMValidityStatePrivate.h \ + DerivedSources/webkit/WebKitDOMWebKitPoint.cpp \ + DerivedSources/webkit/WebKitDOMWebKitPointPrivate.h \ + DerivedSources/webkit/WebKitDOMXPathExpression.cpp \ + DerivedSources/webkit/WebKitDOMXPathExpressionPrivate.h \ + DerivedSources/webkit/WebKitDOMXPathNSResolver.cpp \ + DerivedSources/webkit/WebKitDOMXPathNSResolverPrivate.h \ + DerivedSources/webkit/WebKitDOMXPathResult.cpp \ + DerivedSources/webkit/WebKitDOMXPathResultPrivate.h + +webkitgtk_built_h_api += \ + DerivedSources/webkit/WebKitDOMCSSRule.h \ + DerivedSources/webkit/WebKitDOMCSSRuleList.h \ + DerivedSources/webkit/WebKitDOMCSSStyleDeclaration.h \ + DerivedSources/webkit/WebKitDOMCSSStyleSheet.h \ + DerivedSources/webkit/WebKitDOMCSSValue.h \ + DerivedSources/webkit/WebKitDOMMediaList.h \ + DerivedSources/webkit/WebKitDOMMediaQueryList.h \ + DerivedSources/webkit/WebKitDOMStyleMedia.h \ + DerivedSources/webkit/WebKitDOMStyleSheet.h \ + DerivedSources/webkit/WebKitDOMStyleSheetList.h \ + DerivedSources/webkit/WebKitDOMAttr.h \ + DerivedSources/webkit/WebKitDOMCDATASection.h \ + DerivedSources/webkit/WebKitDOMCharacterData.h \ + DerivedSources/webkit/WebKitDOMComment.h \ + DerivedSources/webkit/WebKitDOMDocument.h \ + DerivedSources/webkit/WebKitDOMDocumentFragment.h \ + DerivedSources/webkit/WebKitDOMDocumentType.h \ + DerivedSources/webkit/WebKitDOMDOMImplementation.h \ + DerivedSources/webkit/WebKitDOMDOMSettableTokenList.h \ + DerivedSources/webkit/WebKitDOMDOMStringList.h \ + DerivedSources/webkit/WebKitDOMDOMStringMap.h \ + DerivedSources/webkit/WebKitDOMDOMTokenList.h \ + DerivedSources/webkit/WebKitDOMElement.h \ + DerivedSources/webkit/WebKitDOMEntityReference.h \ + DerivedSources/webkit/WebKitDOMEvent.h \ + DerivedSources/webkit/WebKitDOMMessagePort.h \ + DerivedSources/webkit/WebKitDOMMouseEvent.h \ + DerivedSources/webkit/WebKitDOMNamedNodeMap.h \ + DerivedSources/webkit/WebKitDOMNode.h \ + DerivedSources/webkit/WebKitDOMNodeFilter.h \ + DerivedSources/webkit/WebKitDOMNodeIterator.h \ + DerivedSources/webkit/WebKitDOMNodeList.h \ + DerivedSources/webkit/WebKitDOMProcessingInstruction.h \ + DerivedSources/webkit/WebKitDOMRange.h \ + DerivedSources/webkit/WebKitDOMText.h \ + DerivedSources/webkit/WebKitDOMTreeWalker.h \ + DerivedSources/webkit/WebKitDOMUIEvent.h \ + DerivedSources/webkit/WebKitDOMBlob.h \ + DerivedSources/webkit/WebKitDOMFile.h \ + DerivedSources/webkit/WebKitDOMFileList.h \ + DerivedSources/webkit/WebKitDOMHTMLAnchorElement.h \ + DerivedSources/webkit/WebKitDOMHTMLAppletElement.h \ + DerivedSources/webkit/WebKitDOMHTMLAreaElement.h \ + DerivedSources/webkit/WebKitDOMHTMLBaseElement.h \ + DerivedSources/webkit/WebKitDOMHTMLBaseFontElement.h \ + DerivedSources/webkit/WebKitDOMHTMLBlockquoteElement.h \ + DerivedSources/webkit/WebKitDOMHTMLBodyElement.h \ + DerivedSources/webkit/WebKitDOMHTMLBRElement.h \ + DerivedSources/webkit/WebKitDOMHTMLButtonElement.h \ + DerivedSources/webkit/WebKitDOMHTMLCanvasElement.h \ + DerivedSources/webkit/WebKitDOMHTMLCollection.h \ + DerivedSources/webkit/WebKitDOMHTMLDirectoryElement.h \ + DerivedSources/webkit/WebKitDOMHTMLDivElement.h \ + DerivedSources/webkit/WebKitDOMHTMLDListElement.h \ + DerivedSources/webkit/WebKitDOMHTMLDocument.h \ + DerivedSources/webkit/WebKitDOMHTMLDetailsElement.h \ + DerivedSources/webkit/WebKitDOMHTMLElement.h \ + DerivedSources/webkit/WebKitDOMHTMLEmbedElement.h \ + DerivedSources/webkit/WebKitDOMHTMLFieldSetElement.h \ + DerivedSources/webkit/WebKitDOMHTMLFontElement.h \ + DerivedSources/webkit/WebKitDOMHTMLFormElement.h \ + DerivedSources/webkit/WebKitDOMHTMLFrameElement.h \ + DerivedSources/webkit/WebKitDOMHTMLFrameSetElement.h \ + DerivedSources/webkit/WebKitDOMHTMLHeadElement.h \ + DerivedSources/webkit/WebKitDOMHTMLHeadingElement.h \ + DerivedSources/webkit/WebKitDOMHTMLHRElement.h \ + DerivedSources/webkit/WebKitDOMHTMLHtmlElement.h \ + DerivedSources/webkit/WebKitDOMHTMLIFrameElement.h \ + DerivedSources/webkit/WebKitDOMHTMLImageElement.h \ + DerivedSources/webkit/WebKitDOMHTMLInputElement.h \ + DerivedSources/webkit/WebKitDOMHTMLIsIndexElement.h \ + DerivedSources/webkit/WebKitDOMHTMLLabelElement.h \ + DerivedSources/webkit/WebKitDOMHTMLLegendElement.h \ + DerivedSources/webkit/WebKitDOMHTMLLIElement.h \ + DerivedSources/webkit/WebKitDOMHTMLLinkElement.h \ + DerivedSources/webkit/WebKitDOMHTMLMapElement.h \ + DerivedSources/webkit/WebKitDOMHTMLMarqueeElement.h \ + DerivedSources/webkit/WebKitDOMHTMLMediaElement.h \ + DerivedSources/webkit/WebKitDOMHTMLMenuElement.h \ + DerivedSources/webkit/WebKitDOMHTMLMetaElement.h \ + DerivedSources/webkit/WebKitDOMHTMLModElement.h \ + DerivedSources/webkit/WebKitDOMHTMLObjectElement.h \ + DerivedSources/webkit/WebKitDOMHTMLOListElement.h \ + DerivedSources/webkit/WebKitDOMHTMLOptGroupElement.h \ + DerivedSources/webkit/WebKitDOMHTMLOptionElement.h \ + DerivedSources/webkit/WebKitDOMHTMLOptionsCollection.h \ + DerivedSources/webkit/WebKitDOMHTMLParagraphElement.h \ + DerivedSources/webkit/WebKitDOMHTMLParamElement.h \ + DerivedSources/webkit/WebKitDOMHTMLPreElement.h \ + DerivedSources/webkit/WebKitDOMHTMLQuoteElement.h \ + DerivedSources/webkit/WebKitDOMHTMLScriptElement.h \ + DerivedSources/webkit/WebKitDOMHTMLSelectElement.h \ + DerivedSources/webkit/WebKitDOMHTMLStyleElement.h \ + DerivedSources/webkit/WebKitDOMHTMLTableElement.h \ + DerivedSources/webkit/WebKitDOMHTMLTableCaptionElement.h \ + DerivedSources/webkit/WebKitDOMHTMLTableColElement.h \ + DerivedSources/webkit/WebKitDOMHTMLTableSectionElement.h \ + DerivedSources/webkit/WebKitDOMHTMLTableCellElement.h \ + DerivedSources/webkit/WebKitDOMHTMLTextAreaElement.h \ + DerivedSources/webkit/WebKitDOMHTMLTitleElement.h \ + DerivedSources/webkit/WebKitDOMHTMLTableRowElement.h \ + DerivedSources/webkit/WebKitDOMHTMLUListElement.h \ + DerivedSources/webkit/WebKitDOMMediaError.h \ + DerivedSources/webkit/WebKitDOMTimeRanges.h \ + DerivedSources/webkit/WebKitDOMValidityState.h \ + DerivedSources/webkit/WebKitDOMDOMApplicationCache.h \ + DerivedSources/webkit/WebKitDOMBarInfo.h \ + DerivedSources/webkit/WebKitDOMConsole.h \ + DerivedSources/webkit/WebKitDOMDOMWindow.h \ + DerivedSources/webkit/WebKitDOMDOMSelection.h \ + DerivedSources/webkit/WebKitDOMEventTarget.h \ + DerivedSources/webkit/WebKitDOMHistory.h \ + DerivedSources/webkit/WebKitDOMLocation.h \ + DerivedSources/webkit/WebKitDOMMemoryInfo.h \ + DerivedSources/webkit/WebKitDOMObject.h \ + DerivedSources/webkit/WebKitDOMNavigator.h \ + DerivedSources/webkit/WebKitDOMScreen.h \ + DerivedSources/webkit/WebKitDOMWebKitPoint.h \ + DerivedSources/webkit/WebKitDOMDOMMimeType.h \ + DerivedSources/webkit/WebKitDOMDOMMimeTypeArray.h \ + DerivedSources/webkit/WebKitDOMDOMPlugin.h \ + DerivedSources/webkit/WebKitDOMDOMPluginArray.h \ + DerivedSources/webkit/WebKitDOMDatabase.h \ + DerivedSources/webkit/WebKitDOMStorage.h \ + DerivedSources/webkit/WebKitDOMXPathExpression.h \ + DerivedSources/webkit/WebKitDOMXPathNSResolver.h \ + DerivedSources/webkit/WebKitDOMXPathResult.h \ + DerivedSources/webkit/webkitdom.h \ + DerivedSources/webkit/webkitdomdefines.h + +if ENABLE_GEOLOCATION +webkitgtk_built_h_api += \ + $(top_builddir)/DerivedSources/webkit/WebKitDOMGeolocation.h +webkitgtk_gdom_built_sources += \ + DerivedSources/webkit/WebKitDOMGeolocation.cpp \ + DerivedSources/webkit/WebKitDOMGeolocationPrivate.h +endif + +if ENABLE_VIDEO +webkitgtk_built_h_api += \ + $(top_builddir)/DerivedSources/webkit/WebKitDOMHTMLAudioElement.h +webkitgtk_gdom_built_sources += \ + DerivedSources/webkit/WebKitDOMHTMLAudioElement.cpp \ + DerivedSources/webkit/WebKitDOMHTMLAudioElementPrivate.h +endif + +gdom_class_list := $(subst WebKitDOM,, $(filter-out %Private, $(basename $(notdir $(webkitgtk_gdom_built_sources))))) +gdom_class_list += Object EventTarget +DerivedSources/webkit/webkitdom.h: $(WebCore)/bindings/scripts/gobject-generate-headers.pl $(WebCore)/bindings/gobject/GNUmakefile.am + $(AM_V_GEN)echo $(gdom_class_list) | $(PERL) $< gdom > $@ + +DerivedSources/webkit/webkitdomdefines.h: $(WebCore)/bindings/scripts/gobject-generate-headers.pl $(WebCore)/bindings/gobject/GNUmakefile.am + $(AM_V_GEN)echo $(gdom_class_list) | $(PERL) $< defines > $@ + +# Because WebCore/bindings/gobject/WebKitDOMObject.h is static source but is also a distributed header +# required by other distributed headers (both static and auto-generated), need to move this to the +# DerivedSources/webkit directory. The reason is that we want all header files distributed in the +# include/webkit-x.y/webkit directory, but do not want to name the WebCore/bindings/gobject directory +# "webkit", as that's a bit presumptuous for a GTK binding. +$(top_builddir)/DerivedSources/webkit/WebKitDOMObject.h: $(WebCore)/bindings/gobject/WebKitDOMObject.h + $(AM_V_GEN)cp -f $< $@ + +$(top_builddir)/DerivedSources/webkit/WebKitDOMEventTarget.h: $(WebCore)/bindings/gobject/WebKitDOMEventTarget.h + $(AM_V_GEN)cp -f $< $@ + +$(top_builddir)/DerivedSources/webkit/WebKitDOMEventTargetPrivate.h: $(WebCore)/bindings/gobject/WebKitDOMEventTargetPrivate.h + $(AM_V_GEN)cp -f $< $@ + +# Filter out SVG for now +gdom_feature_defines := $(filter-out ENABLE-SVG%, $(FEATURE_DEFINES)) +DerivedSources/webkit/WebKitDOM%.cpp DerivedSources/webkit/WebKitDOM%.h DerivedSources/webkit/WebKitDOM%Private.h:: %.idl $(SCRIPTS_BINDINGS) $(WebCore)/bindings/scripts/CodeGeneratorGObject.pm + $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $(WebCore)/bindings/scripts/generate-bindings.pl --include $(WebCore)/dom --include $(WebCore)/html --include $(WebCore)/css --include $(WebCore)/page --include $(WebCore)/xml --include $(WebCore)/svg --outputDir "$(GENSOURCES_WEBKIT)" --defines "LANGUAGE_GOBJECT=1 $(gdom_feature_defines)" --generator GObject $< + diff --git a/Source/WebCore/bindings/gobject/GObjectEventListener.cpp b/Source/WebCore/bindings/gobject/GObjectEventListener.cpp new file mode 100644 index 0000000..27432b9 --- /dev/null +++ b/Source/WebCore/bindings/gobject/GObjectEventListener.cpp @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "GObjectEventListener.h" + +#include "Event.h" +#include "EventListener.h" +#include "webkit/WebKitDOMEvent.h" +#include "webkit/WebKitDOMEventPrivate.h" +#include <glib-object.h> +#include <glib.h> +#include <wtf/HashMap.h> + +namespace WebCore { + +GObjectEventListener::GObjectEventListener(GObject* object, DOMWindow* window, Node* node, const char* domEventName, const char* signalName) + : EventListener(GObjectEventListenerType) + , m_object(object) + , m_coreNode(node) + , m_coreWindow(window) + , m_domEventName(domEventName) + , m_signalName(signalName) +{ + ASSERT(!m_coreWindow || !m_coreNode); + + g_object_weak_ref(object, reinterpret_cast<GWeakNotify>(GObjectEventListener::gobjectDestroyedCallback), this); +} + +GObjectEventListener::~GObjectEventListener() +{ + if (!m_coreWindow && !m_coreNode) + return; + g_object_weak_unref(m_object, reinterpret_cast<GWeakNotify>(GObjectEventListener::gobjectDestroyedCallback), this); +} + +void GObjectEventListener::gobjectDestroyed() +{ + ASSERT(!m_coreWindow || !m_coreNode); + + // We must set m_coreWindow and m_coreNode to null, because removeEventListener may call the + // destructor as a side effect and we must be in the proper state to prevent g_object_weak_unref. + if (DOMWindow* window = m_coreWindow) { + m_coreWindow = 0; + window->removeEventListener(m_domEventName.data(), this, false); + return; + } + + Node* node = m_coreNode; + m_coreNode = 0; // See above. + node->removeEventListener(m_domEventName.data(), this, false); +} + +void GObjectEventListener::handleEvent(ScriptExecutionContext*, Event* event) +{ + gboolean handled = FALSE; + WebKitDOMEvent* gobjectEvent = WEBKIT_DOM_EVENT(WebKit::kit(event)); + g_signal_emit_by_name(m_object, m_signalName.data(), gobjectEvent, &handled); + g_object_unref(gobjectEvent); +} + +bool GObjectEventListener::operator==(const EventListener& listener) +{ + if (const GObjectEventListener* gobjectEventListener = GObjectEventListener::cast(&listener)) + return m_signalName == gobjectEventListener->m_signalName && m_object == gobjectEventListener->m_object; + + return false; +} + +} diff --git a/Source/WebCore/bindings/gobject/GObjectEventListener.h b/Source/WebCore/bindings/gobject/GObjectEventListener.h new file mode 100644 index 0000000..ef1637a --- /dev/null +++ b/Source/WebCore/bindings/gobject/GObjectEventListener.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef GObjectEventListener_h +#define GObjectEventListener_h + +#include "DOMWindow.h" +#include "EventListener.h" +#include "Node.h" + +#include <wtf/RefPtr.h> +#include <wtf/text/CString.h> + +typedef struct _GObject GObject; + +namespace WebCore { + +class GObjectEventListener : public EventListener { +public: + + static void addEventListener(GObject* object, DOMWindow* window, const char* domEventName, const char* signalName) + { + RefPtr<GObjectEventListener> listener(adoptRef(new GObjectEventListener(object, window, 0, domEventName, signalName))); + window->addEventListener(domEventName, listener.release(), false); + } + + static void addEventListener(GObject* object, Node* node, const char* domEventName, const char* signalName) + { + RefPtr<GObjectEventListener> listener(adoptRef(new GObjectEventListener(object, 0, node, domEventName, signalName))); + node->addEventListener(domEventName, listener.release(), false); + } + + static void gobjectDestroyedCallback(GObjectEventListener* listener, GObject*) + { + listener->gobjectDestroyed(); + } + + static const GObjectEventListener* cast(const EventListener* listener) + { + return listener->type() == GObjectEventListenerType + ? static_cast<const GObjectEventListener*>(listener) + : 0; + } + + virtual bool operator==(const EventListener& other); + +private: + GObjectEventListener(GObject*, DOMWindow*, Node*, const char* domEventName, const char* signalName); + ~GObjectEventListener(); + void gobjectDestroyed(); + + virtual void handleEvent(ScriptExecutionContext*, Event*); + + GObject* m_object; + + // We do not need to keep a reference to these WebCore objects, because + // we only use them when the GObject and thus the WebCore object is alive. + Node* m_coreNode; + DOMWindow* m_coreWindow; + CString m_domEventName; + CString m_signalName; +}; +} // namespace WebCore + +#endif diff --git a/Source/WebCore/bindings/gobject/WebKitDOMBinding.cpp b/Source/WebCore/bindings/gobject/WebKitDOMBinding.cpp new file mode 100644 index 0000000..a9b0897 --- /dev/null +++ b/Source/WebCore/bindings/gobject/WebKitDOMBinding.cpp @@ -0,0 +1,151 @@ +/* + * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) + * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007 Samuel Weinig <sam@webkit.org> + * Copyright (C) 2008 Luke Kenneth Casson Leighton <lkcl@lkcl.net> + * Copyright (C) 2008 Martin Soto <soto@freedesktop.org> + * Copyright (C) 2009, 2010 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "WebKitDOMBinding.h" + +#include "DOMObjectCache.h" +#include "Element.h" +#include "Event.h" +#include "EventException.h" +#include "HTMLNames.h" +#include "MouseEvent.h" +#include "UIEvent.h" +#include "WebKitDOMDOMWindowPrivate.h" +#include "WebKitDOMElementPrivate.h" +#include "WebKitDOMEventPrivate.h" +#include "WebKitDOMNode.h" +#include "WebKitDOMNodePrivate.h" +#include "WebKitHTMLElementWrapperFactory.h" +#include "webkit/WebKitDOMMouseEventPrivate.h" +#include "webkit/WebKitDOMUIEventPrivate.h" + +namespace WebKit { + +using namespace WebCore; +using namespace WebCore::HTMLNames; + +// kit methods + +static gpointer createWrapper(Node* node) +{ + ASSERT(node); + ASSERT(node->nodeType()); + + gpointer wrappedNode = 0; + + switch (node->nodeType()) { + case Node::ELEMENT_NODE: + if (node->isHTMLElement()) + wrappedNode = createHTMLElementWrapper(static_cast<HTMLElement*>(node)); + else + wrappedNode = wrapElement(static_cast<Element*>(node)); + break; + default: + wrappedNode = wrapNode(node); + break; + } + + return DOMObjectCache::put(node, wrappedNode); +} + +WebKitDOMNode* kit(Node* node) +{ + if (!node) + return 0; + + gpointer kitNode = DOMObjectCache::get(node); + if (kitNode) + return static_cast<WebKitDOMNode*>(kitNode); + + return static_cast<WebKitDOMNode*>(createWrapper(node)); +} + +WebKitDOMElement* kit(Element* element) +{ + if (!element) + return 0; + + gpointer kitElement = DOMObjectCache::get(element); + if (kitElement) + return static_cast<WebKitDOMElement*>(kitElement); + + gpointer wrappedElement; + + if (element->isHTMLElement()) + wrappedElement = createHTMLElementWrapper(static_cast<HTMLElement*>(element)); + else + wrappedElement = wrapElement(element); + + return static_cast<WebKitDOMElement*>(DOMObjectCache::put(element, wrappedElement)); +} + +WebKitDOMEvent* kit(Event* event) +{ + if (!event) + return 0; + + gpointer kitEvent = DOMObjectCache::get(event); + if (kitEvent) + return static_cast<WebKitDOMEvent*>(kitEvent); + + gpointer wrappedEvent; + + if (event->isMouseEvent()) + wrappedEvent = wrapMouseEvent(static_cast<MouseEvent*>(event)); + else if (event->isUIEvent()) + wrappedEvent = wrapUIEvent(static_cast<UIEvent*>(event)); + else + wrappedEvent = wrapEvent(event); + + return static_cast<WebKitDOMEvent*>(DOMObjectCache::put(event, wrappedEvent)); +} + +static gpointer wrapEventTarget(EventTarget* target) +{ + ASSERT(target); + + gpointer wrappedTarget = 0; + + if (target->toNode()) { + Node* node = target->toNode(); + wrappedTarget = wrapNode(node); + } else if (target->toDOMWindow()) { + DOMWindow* window = target->toDOMWindow(); + wrappedTarget = wrapDOMWindow(window); + } + + return DOMObjectCache::put(target, wrappedTarget); +} + +WebKitDOMEventTarget* kit(WebCore::EventTarget* obj) +{ + g_return_val_if_fail(obj, 0); + + if (gpointer ret = DOMObjectCache::get(obj)) + return static_cast<WebKitDOMEventTarget*>(ret); + + return static_cast<WebKitDOMEventTarget*>(DOMObjectCache::put(obj, WebKit::wrapEventTarget(obj))); +} + +} // namespace WebKit diff --git a/Source/WebCore/bindings/gobject/WebKitDOMBinding.h b/Source/WebCore/bindings/gobject/WebKitDOMBinding.h new file mode 100644 index 0000000..ca7840e --- /dev/null +++ b/Source/WebCore/bindings/gobject/WebKitDOMBinding.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) + * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007 Samuel Weinig <sam@webkit.org> + * Copyright (C) 2008 Luke Kenneth Casson Leighton <lkcl@lkcl.net> + * Copyright (C) 2008 Martin Soto <soto@freedesktop.org> + * Copyright (C) 2009-2010 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebKitDOMBinding_h +#define WebKitDOMBinding_h + +#include "webkit/webkitdomdefines.h" +#include <glib.h> + +namespace WebCore { +class Node; +class Element; +class Event; +class EventTarget; +} // namespace WebCore + +namespace WebKit { +WebKitDOMNode* kit(WebCore::Node* node); +WebKitDOMElement* kit(WebCore::Element* element); +WebKitDOMEvent* kit(WebCore::Event* event); +WebKitDOMEventTarget* kit(WebCore::EventTarget* target); +} // namespace WebKit + +#endif // WebKitDOMBinding_h diff --git a/Source/WebCore/bindings/gobject/WebKitDOMEventTarget.cpp b/Source/WebCore/bindings/gobject/WebKitDOMEventTarget.cpp new file mode 100644 index 0000000..f2b1a94 --- /dev/null +++ b/Source/WebCore/bindings/gobject/WebKitDOMEventTarget.cpp @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * This file is derived by hand from an automatically generated file. + * Keeping it up-to-date could potentially be done by adding + * a make_names.pl generator, or by writing a separate + * generater which takes JSHTMLElementWrapperFactory.h as input. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebKitDOMEventTarget.h" + +#include "EventTarget.h" +#include "WebKitDOMEvent.h" + +typedef WebKitDOMEventTargetIface WebKitDOMEventTargetInterface; +#if GLIB_CHECK_VERSION(2, 24, 0) +G_DEFINE_INTERFACE(WebKitDOMEventTarget, webkit_dom_event_target, G_TYPE_OBJECT) +#else +static void webkit_dom_event_target_default_init(WebKitDOMEventTargetIface*); + +GType webkit_dom_event_target_get_type(void) +{ + static volatile gsize typeIdVolatile = 0; + + if (g_once_init_enter(&typeIdVolatile)) { + GType typeId = g_type_register_static_simple(G_TYPE_INTERFACE, + g_intern_static_string("WebKitDOMEventTarget"), + sizeof(WebKitDOMEventTargetInterface), + (GClassInitFunc)webkit_dom_event_target_default_init, + 0, + static_cast<GInstanceInitFunc>(0), + static_cast<GTypeFlags>(0)); + g_type_interface_add_prerequisite(typeId, G_TYPE_OBJECT); + g_once_init_leave(&typeIdVolatile, typeId); + } + + return typeIdVolatile; +} +#endif + +static void webkit_dom_event_target_default_init(WebKitDOMEventTargetIface*) +{ +} + +void webkit_dom_event_target_dispatch_event(WebKitDOMEventTarget* target, WebKitDOMEvent* event, GError** error) +{ + WebKitDOMEventTargetIface* iface; + + g_return_if_fail(WEBKIT_DOM_IS_EVENT_TARGET(target)); + g_return_if_fail(WEBKIT_DOM_IS_EVENT(event)); + + iface = WEBKIT_DOM_EVENT_TARGET_GET_IFACE(target); + + if (iface->dispatch_event) + iface->dispatch_event(target, event, error); +} + +namespace WebKit { + +WebCore::EventTarget* core(WebKitDOMEventTarget* request) +{ + g_return_val_if_fail(request, 0); + + WebCore::EventTarget* coreObject = static_cast<WebCore::EventTarget*>(WEBKIT_DOM_OBJECT(request)->coreObject); + g_return_val_if_fail(coreObject, 0); + + return coreObject; +} + +} // namespace WebKit + diff --git a/Source/WebCore/bindings/gobject/WebKitDOMEventTarget.h b/Source/WebCore/bindings/gobject/WebKitDOMEventTarget.h new file mode 100644 index 0000000..206abc7 --- /dev/null +++ b/Source/WebCore/bindings/gobject/WebKitDOMEventTarget.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef WebKitDOMEventTarget_h +#define WebKitDOMEventTarget_h + +#include "webkit/webkitdomdefines.h" +#include <glib-object.h> +#include <webkit/webkitdefines.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_DOM_EVENT_TARGET (webkit_dom_event_target_get_type ()) +#define WEBKIT_DOM_EVENT_TARGET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), WEBKIT_TYPE_DOM_EVENT_TARGET, WebKitDOMEventTarget)) +#define WEBKIT_DOM_EVENT_TARGET_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), WEBKIT_TYPE_DOM_EVENT_TARGET, WebKitDOMEventTargetIface)) +#define WEBKIT_DOM_IS_EVENT_TARGET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), WEBKIT_TYPE_DOM_EVENT_TARGET)) +#define WEBKIT_DOM_EVENT_TARGET_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), WEBKIT_TYPE_DOM_EVENT_TARGET, WebKitDOMEventTargetIface)) + +typedef struct _WebKitDOMEventTargetIface WebKitDOMEventTargetIface; + +struct _WebKitDOMEventTargetIface { + GTypeInterface gIface; + + /* virtual table */ + void (* dispatch_event)(WebKitDOMEventTarget* target, + WebKitDOMEvent* event, + GError** error); +}; + + +WEBKIT_API GType webkit_dom_event_target_get_type(void) G_GNUC_CONST; + +WEBKIT_API void webkit_dom_event_target_dispatch_event(WebKitDOMEventTarget *target, + WebKitDOMEvent *event, + GError **error); + +G_END_DECLS + +#endif /* WebKitDOMEventTarget_h */ diff --git a/Source/WebCore/bindings/gobject/WebKitDOMEventTargetPrivate.h b/Source/WebCore/bindings/gobject/WebKitDOMEventTargetPrivate.h new file mode 100644 index 0000000..4741409 --- /dev/null +++ b/Source/WebCore/bindings/gobject/WebKitDOMEventTargetPrivate.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2010 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef WebKitDOMEventTargetPrivate_h +#define WebKitDOMEventTargetPrivate_h + +#include "EventTarget.h" +#include <glib-object.h> +#include <webkit/WebKitDOMEventTarget.h> + +namespace WebKit { +WebCore::EventTarget* +core(WebKitDOMEventTarget *request); +} // namespace WebKit + +#endif /* WebKitDOMEventTargetPrivate_h */ diff --git a/Source/WebCore/bindings/gobject/WebKitDOMObject.cpp b/Source/WebCore/bindings/gobject/WebKitDOMObject.cpp new file mode 100644 index 0000000..d8452ac --- /dev/null +++ b/Source/WebCore/bindings/gobject/WebKitDOMObject.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2008 Luke Kenneth Casson Leighton <lkcl@lkcl.net> + * Copyright (C) 2008 Martin Soto <soto@freedesktop.org> + * Copyright (C) 2008 Alp Toker <alp@atoker.com> + * Copyright (C) 2008 Apple Inc. + * Copyright (C) 2009 Igalia S.L. + */ +#include "config.h" +#include "WebKitDOMObject.h" + +#include "glib-object.h" +#include "WebKitDOMBinding.h" + +enum { + PROP_0, + PROP_CORE_OBJECT +}; + +G_DEFINE_TYPE(WebKitDOMObject, webkit_dom_object, G_TYPE_OBJECT); + +static void webkit_dom_object_init(WebKitDOMObject* object) +{ +} + +static void webkit_dom_object_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) +{ + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + +static void webkit_dom_object_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec) +{ + switch (prop_id) { + case PROP_CORE_OBJECT: + WEBKIT_DOM_OBJECT(object)->coreObject = g_value_get_pointer(value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); + break; + } +} + +static void webkit_dom_object_class_init(WebKitDOMObjectClass* klass) +{ + GObjectClass* gobjectClass = G_OBJECT_CLASS(klass); + gobjectClass->set_property = webkit_dom_object_set_property; + gobjectClass->get_property = webkit_dom_object_get_property; + + g_object_class_install_property(gobjectClass, + PROP_CORE_OBJECT, + g_param_spec_pointer("core-object", + "Core Object", + "The WebCore object the WebKitDOMObject wraps", + static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY))); +} + diff --git a/Source/WebCore/bindings/gobject/WebKitDOMObject.h b/Source/WebCore/bindings/gobject/WebKitDOMObject.h new file mode 100644 index 0000000..b99c57c --- /dev/null +++ b/Source/WebCore/bindings/gobject/WebKitDOMObject.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2008 Luke Kenneth Casson Leighton <lkcl@lkcl.net> + * Copyright (C) 2008 Martin Soto <soto@freedesktop.org> + * Copyright (C) 2008 Alp Toker <alp@atoker.com> + * Copyright (C) 2008 Apple Inc. + * Copyright (C) 2009 Igalia S.L. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + + +#ifndef WebKitDOMObject_h +#define WebKitDOMObject_h + +#include "glib-object.h" +#include "webkit/webkitdomdefines.h" +#include <webkit/webkitdefines.h> + +G_BEGIN_DECLS + +#define WEBKIT_TYPE_DOM_OBJECT (webkit_dom_object_get_type()) +#define WEBKIT_DOM_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_DOM_OBJECT, WebKitDOMObject)) +#define WEBKIT_DOM_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_DOM_OBJECT, WebKitDOMObjectClass)) +#define WEBKIT_IS_DOM_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_DOM_OBJECT)) +#define WEBKIT_IS_DOM_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_DOM_OBJECT)) +#define WEBKIT_DOM_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_DOM_OBJECT, WebKitDOMObjectClass)) + +typedef struct _WebKitDOMObjectPrivate WebKitDOMObjectPrivate; + +struct _WebKitDOMObject { + GObject parentInstance; + + gpointer coreObject; +}; + +struct _WebKitDOMObjectClass { + GObjectClass parentClass; +}; + +WEBKIT_API GType +webkit_dom_object_get_type(void); + +G_END_DECLS + +#endif /* WebKitDOMObject_h */ diff --git a/Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp b/Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp new file mode 100644 index 0000000..da420ae --- /dev/null +++ b/Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp @@ -0,0 +1,541 @@ +/* + * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2008 Luke Kenneth Casson Leighton <lkcl@lkcl.net> + * Copyright (C) 2008 Martin Soto <soto@freedesktop.org> + * Copyright (C) 2010 Igalia S.L. + * + * This file is derived by hand from an automatically generated file. + * Keeping it up-to-date could potentially be done by adding + * a make_names.pl generator, or by writing a separate + * generater which takes JSHTMLElementWrapperFactory.h as input. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebKitHTMLElementWrapperFactory.h" + +#include "HTMLAnchorElement.h" +#include "HTMLAppletElement.h" +#include "HTMLAreaElement.h" +#include "HTMLAudioElement.h" +#include "HTMLBRElement.h" +#include "HTMLBaseElement.h" +#include "HTMLBaseFontElement.h" +#include "HTMLBlockquoteElement.h" +#include "HTMLBodyElement.h" +#include "HTMLButtonElement.h" +#include "HTMLCanvasElement.h" +#include "HTMLDListElement.h" +#include "HTMLDirectoryElement.h" +#include "HTMLDivElement.h" +#include "HTMLEmbedElement.h" +#include "HTMLFieldSetElement.h" +#include "HTMLFontElement.h" +#include "HTMLFormElement.h" +#include "HTMLFrameElement.h" +#include "HTMLFrameSetElement.h" +#include "HTMLHRElement.h" +#include "HTMLHeadElement.h" +#include "HTMLHeadingElement.h" +#include "HTMLHtmlElement.h" +#include "HTMLIFrameElement.h" +#include "HTMLImageElement.h" +#include "HTMLInputElement.h" +#include "HTMLIsIndexElement.h" +#include "HTMLLIElement.h" +#include "HTMLLabelElement.h" +#include "HTMLLegendElement.h" +#include "HTMLLinkElement.h" +#include "HTMLMapElement.h" +#include "HTMLMarqueeElement.h" +#include "HTMLMenuElement.h" +#include "HTMLMetaElement.h" +#include "HTMLModElement.h" +#include "HTMLNames.h" +#include "HTMLOListElement.h" +#include "HTMLObjectElement.h" +#include "HTMLOptGroupElement.h" +#include "HTMLOptionElement.h" +#include "HTMLParagraphElement.h" +#include "HTMLParamElement.h" +#include "HTMLPreElement.h" +#include "HTMLQuoteElement.h" +#include "HTMLScriptElement.h" +#include "HTMLSelectElement.h" +#include "HTMLStyleElement.h" +#include "HTMLTableCaptionElement.h" +#include "HTMLTableCellElement.h" +#include "HTMLTableColElement.h" +#include "HTMLTableElement.h" +#include "HTMLTableRowElement.h" +#include "HTMLTableSectionElement.h" +#include "HTMLTextAreaElement.h" +#include "HTMLTitleElement.h" +#include "HTMLUListElement.h" + +#include "webkit/WebKitDOMHTMLAnchorElementPrivate.h" +#include "webkit/WebKitDOMHTMLAppletElementPrivate.h" +#include "webkit/WebKitDOMHTMLAreaElementPrivate.h" +#include "webkit/WebKitDOMHTMLBRElementPrivate.h" +#include "webkit/WebKitDOMHTMLBaseElementPrivate.h" +#include "webkit/WebKitDOMHTMLBaseFontElementPrivate.h" +#include "webkit/WebKitDOMHTMLBlockquoteElementPrivate.h" +#include "webkit/WebKitDOMHTMLBodyElementPrivate.h" +#include "webkit/WebKitDOMHTMLButtonElementPrivate.h" +#include "webkit/WebKitDOMHTMLCanvasElementPrivate.h" +#include "webkit/WebKitDOMHTMLDListElementPrivate.h" +#include "webkit/WebKitDOMHTMLDirectoryElementPrivate.h" +#include "webkit/WebKitDOMHTMLDivElementPrivate.h" +#include "webkit/WebKitDOMHTMLElementPrivate.h" +#include "webkit/WebKitDOMHTMLEmbedElementPrivate.h" +#include "webkit/WebKitDOMHTMLFieldSetElementPrivate.h" +#include "webkit/WebKitDOMHTMLFontElementPrivate.h" +#include "webkit/WebKitDOMHTMLFormElementPrivate.h" +#include "webkit/WebKitDOMHTMLFrameElementPrivate.h" +#include "webkit/WebKitDOMHTMLFrameSetElementPrivate.h" +#include "webkit/WebKitDOMHTMLHRElementPrivate.h" +#include "webkit/WebKitDOMHTMLHeadElementPrivate.h" +#include "webkit/WebKitDOMHTMLHeadingElementPrivate.h" +#include "webkit/WebKitDOMHTMLHtmlElementPrivate.h" +#include "webkit/WebKitDOMHTMLIFrameElementPrivate.h" +#include "webkit/WebKitDOMHTMLImageElementPrivate.h" +#include "webkit/WebKitDOMHTMLInputElementPrivate.h" +#include "webkit/WebKitDOMHTMLIsIndexElementPrivate.h" +#include "webkit/WebKitDOMHTMLLIElementPrivate.h" +#include "webkit/WebKitDOMHTMLLabelElementPrivate.h" +#include "webkit/WebKitDOMHTMLLegendElementPrivate.h" +#include "webkit/WebKitDOMHTMLLinkElementPrivate.h" +#include "webkit/WebKitDOMHTMLMapElementPrivate.h" +#include "webkit/WebKitDOMHTMLMarqueeElementPrivate.h" +#include "webkit/WebKitDOMHTMLMenuElementPrivate.h" +#include "webkit/WebKitDOMHTMLMetaElementPrivate.h" +#include "webkit/WebKitDOMHTMLModElementPrivate.h" +#include "webkit/WebKitDOMHTMLOListElementPrivate.h" +#include "webkit/WebKitDOMHTMLObjectElementPrivate.h" +#include "webkit/WebKitDOMHTMLOptGroupElementPrivate.h" +#include "webkit/WebKitDOMHTMLOptionElementPrivate.h" +#include "webkit/WebKitDOMHTMLParagraphElementPrivate.h" +#include "webkit/WebKitDOMHTMLParamElementPrivate.h" +#include "webkit/WebKitDOMHTMLPreElementPrivate.h" +#include "webkit/WebKitDOMHTMLQuoteElementPrivate.h" +#include "webkit/WebKitDOMHTMLScriptElementPrivate.h" +#include "webkit/WebKitDOMHTMLSelectElementPrivate.h" +#include "webkit/WebKitDOMHTMLStyleElementPrivate.h" +#include "webkit/WebKitDOMHTMLTableCaptionElementPrivate.h" +#include "webkit/WebKitDOMHTMLTableCellElementPrivate.h" +#include "webkit/WebKitDOMHTMLTableColElementPrivate.h" +#include "webkit/WebKitDOMHTMLTableElementPrivate.h" +#include "webkit/WebKitDOMHTMLTableRowElementPrivate.h" +#include "webkit/WebKitDOMHTMLTableSectionElementPrivate.h" +#include "webkit/WebKitDOMHTMLTextAreaElementPrivate.h" +#include "webkit/WebKitDOMHTMLTitleElementPrivate.h" +#include "webkit/WebKitDOMHTMLUListElementPrivate.h" +#include "webkit/webkitdom.h" + +#if ENABLE(VIDEO) +#include "webkit/WebKitDOMHTMLAudioElementPrivate.h" +#endif + +#include <wtf/text/CString.h> + +namespace WebKit { + +using namespace WebCore; +using namespace WebCore::HTMLNames; + +typedef gpointer (*CreateHTMLElementWrapperFunction)(PassRefPtr<HTMLElement>); + +static gpointer createAnchorWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLAnchorElement(static_cast<HTMLAnchorElement*>(element.get())); +} + +static gpointer createAppletWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLAppletElement(static_cast<HTMLAppletElement*>(element.get())); +} + +static gpointer createAreaWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLAreaElement(static_cast<HTMLAreaElement*>(element.get())); +} + +#if ENABLE(VIDEO) +static gpointer createAudioWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLAudioElement(static_cast<HTMLAudioElement*>(element.get())); +} +#endif + +static gpointer createBaseWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLBaseElement(static_cast<HTMLBaseElement*>(element.get())); +} + +static gpointer createBaseFontWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLBaseFontElement(static_cast<HTMLBaseFontElement*>(element.get())); +} + +static gpointer createBlockquoteWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLBlockquoteElement(static_cast<HTMLBlockquoteElement*>(element.get())); +} + +static gpointer createBodyWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLBodyElement(static_cast<HTMLBodyElement*>(element.get())); +} + +static gpointer createBRWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLBRElement(static_cast<HTMLBRElement*>(element.get())); +} + +static gpointer createButtonWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLButtonElement(static_cast<HTMLButtonElement*>(element.get())); +} + +static gpointer createCanvasWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLCanvasElement(static_cast<HTMLCanvasElement*>(element.get())); +} + +static gpointer createTableCaptionWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLTableCaptionElement(static_cast<HTMLTableCaptionElement*>(element.get())); +} + +static gpointer createTableColWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLTableColElement(static_cast<HTMLTableColElement*>(element.get())); +} + +static gpointer createModWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLModElement(static_cast<HTMLModElement*>(element.get())); +} + +static gpointer createDirectoryWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLDirectoryElement(static_cast<HTMLDirectoryElement*>(element.get())); +} + +static gpointer createDivWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLDivElement(static_cast<HTMLDivElement*>(element.get())); +} + +static gpointer createDListWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLDListElement(static_cast<HTMLDListElement*>(element.get())); +} + +static gpointer createEmbedWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLEmbedElement(static_cast<HTMLEmbedElement*>(element.get())); +} + +static gpointer createFieldSetWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLFieldSetElement(static_cast<HTMLFieldSetElement*>(element.get())); +} + +static gpointer createFontWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLFontElement(static_cast<HTMLFontElement*>(element.get())); +} + +static gpointer createFormWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLFormElement(static_cast<HTMLFormElement*>(element.get())); +} + +static gpointer createFrameWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLFrameElement(static_cast<HTMLFrameElement*>(element.get())); +} + +static gpointer createFrameSetWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLFrameSetElement(static_cast<HTMLFrameSetElement*>(element.get())); +} + +static gpointer createHeadingWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLHeadingElement(static_cast<HTMLHeadingElement*>(element.get())); +} + +static gpointer createHeadWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLHeadElement(static_cast<HTMLHeadElement*>(element.get())); +} + +static gpointer createHRWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLHRElement(static_cast<HTMLHRElement*>(element.get())); +} + +static gpointer createHtmlWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLHtmlElement(static_cast<HTMLHtmlElement*>(element.get())); +} + +static gpointer createIFrameWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLIFrameElement(static_cast<HTMLIFrameElement*>(element.get())); +} + +static gpointer createImageWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLImageElement(static_cast<HTMLImageElement*>(element.get())); +} + +static gpointer createInputWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLInputElement(static_cast<HTMLInputElement*>(element.get())); +} + +static gpointer createIsIndexWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLIsIndexElement(static_cast<HTMLIsIndexElement*>(element.get())); +} + +static gpointer createLabelWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLLabelElement(static_cast<HTMLLabelElement*>(element.get())); +} + +static gpointer createLegendWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLLegendElement(static_cast<HTMLLegendElement*>(element.get())); +} + +static gpointer createLIWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLLIElement(static_cast<HTMLLIElement*>(element.get())); +} + +static gpointer createLinkWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLLinkElement(static_cast<HTMLLinkElement*>(element.get())); +} + +static gpointer createMapWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLMapElement(static_cast<HTMLMapElement*>(element.get())); +} + +static gpointer createMarqueeWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLMarqueeElement(static_cast<HTMLMarqueeElement*>(element.get())); +} + +static gpointer createMenuWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLMenuElement(static_cast<HTMLMenuElement*>(element.get())); +} + +static gpointer createMetaWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLMetaElement(static_cast<HTMLMetaElement*>(element.get())); +} + +static gpointer createObjectWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLObjectElement(static_cast<HTMLObjectElement*>(element.get())); +} + +static gpointer createOListWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLOListElement(static_cast<HTMLOListElement*>(element.get())); +} + +static gpointer createOptGroupWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLOptGroupElement(static_cast<HTMLOptGroupElement*>(element.get())); +} + +static gpointer createOptionWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLOptionElement(static_cast<HTMLOptionElement*>(element.get())); +} + +static gpointer createParagraphWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLParagraphElement(static_cast<HTMLParagraphElement*>(element.get())); +} + +static gpointer createParamWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLParamElement(static_cast<HTMLParamElement*>(element.get())); +} + +static gpointer createPreWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLPreElement(static_cast<HTMLPreElement*>(element.get())); +} + +static gpointer createQuoteWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLQuoteElement(static_cast<HTMLQuoteElement*>(element.get())); +} + +static gpointer createScriptWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLScriptElement(static_cast<HTMLScriptElement*>(element.get())); +} + +static gpointer createSelectWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLSelectElement(static_cast<HTMLSelectElement*>(element.get())); +} + +static gpointer createStyleWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLStyleElement(static_cast<HTMLStyleElement*>(element.get())); +} + +static gpointer createTableWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLTableElement(static_cast<HTMLTableElement*>(element.get())); +} + +static gpointer createTableSectionWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLTableSectionElement(static_cast<HTMLTableSectionElement*>(element.get())); +} + +static gpointer createTableCellWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLTableCellElement(static_cast<HTMLTableCellElement*>(element.get())); +} + +static gpointer createTextAreaWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLTextAreaElement(static_cast<HTMLTextAreaElement*>(element.get())); +} + +static gpointer createTitleWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLTitleElement(static_cast<HTMLTitleElement*>(element.get())); +} + +static gpointer createTableRowWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLTableRowElement(static_cast<HTMLTableRowElement*>(element.get())); +} + +static gpointer createUListWrapper(PassRefPtr<HTMLElement> element) +{ + return wrapHTMLUListElement(static_cast<HTMLUListElement*>(element.get())); +} + +gpointer createHTMLElementWrapper(PassRefPtr<WebCore::HTMLElement> element) +{ + static HashMap<WTF::AtomicStringImpl*, CreateHTMLElementWrapperFunction> map; + if (map.isEmpty()) { + map.set(aTag.localName().impl(), createAnchorWrapper); + map.set(appletTag.localName().impl(), createAppletWrapper); +#if ENABLE(VIDEO) + map.set(audioTag.localName().impl(), createAudioWrapper); +#endif + map.set(areaTag.localName().impl(), createAreaWrapper); + map.set(baseTag.localName().impl(), createBaseWrapper); + map.set(basefontTag.localName().impl(), createBaseFontWrapper); + map.set(blockquoteTag.localName().impl(), createBlockquoteWrapper); + map.set(bodyTag.localName().impl(), createBodyWrapper); + map.set(brTag.localName().impl(), createBRWrapper); + map.set(buttonTag.localName().impl(), createButtonWrapper); + map.set(canvasTag.localName().impl(), createCanvasWrapper); + map.set(captionTag.localName().impl(), createTableCaptionWrapper); + map.set(colTag.localName().impl(), createTableColWrapper); + map.set(delTag.localName().impl(), createModWrapper); + map.set(dirTag.localName().impl(), createDirectoryWrapper); + map.set(divTag.localName().impl(), createDivWrapper); + map.set(dlTag.localName().impl(), createDListWrapper); + map.set(embedTag.localName().impl(), createEmbedWrapper); + map.set(fieldsetTag.localName().impl(), createFieldSetWrapper); + map.set(fontTag.localName().impl(), createFontWrapper); + map.set(formTag.localName().impl(), createFormWrapper); + map.set(frameTag.localName().impl(), createFrameWrapper); + map.set(framesetTag.localName().impl(), createFrameSetWrapper); + map.set(h1Tag.localName().impl(), createHeadingWrapper); + map.set(headTag.localName().impl(), createHeadWrapper); + map.set(hrTag.localName().impl(), createHRWrapper); + map.set(htmlTag.localName().impl(), createHtmlWrapper); + map.set(iframeTag.localName().impl(), createIFrameWrapper); + map.set(imgTag.localName().impl(), createImageWrapper); + map.set(inputTag.localName().impl(), createInputWrapper); + map.set(isindexTag.localName().impl(), createIsIndexWrapper); + map.set(labelTag.localName().impl(), createLabelWrapper); + map.set(legendTag.localName().impl(), createLegendWrapper); + map.set(liTag.localName().impl(), createLIWrapper); + map.set(linkTag.localName().impl(), createLinkWrapper); + map.set(mapTag.localName().impl(), createMapWrapper); + map.set(marqueeTag.localName().impl(), createMarqueeWrapper); + map.set(menuTag.localName().impl(), createMenuWrapper); + map.set(metaTag.localName().impl(), createMetaWrapper); + map.set(objectTag.localName().impl(), createObjectWrapper); + map.set(olTag.localName().impl(), createOListWrapper); + map.set(optgroupTag.localName().impl(), createOptGroupWrapper); + map.set(optionTag.localName().impl(), createOptionWrapper); + map.set(pTag.localName().impl(), createParagraphWrapper); + map.set(paramTag.localName().impl(), createParamWrapper); + map.set(preTag.localName().impl(), createPreWrapper); + map.set(qTag.localName().impl(), createQuoteWrapper); + map.set(scriptTag.localName().impl(), createScriptWrapper); + map.set(selectTag.localName().impl(), createSelectWrapper); + map.set(styleTag.localName().impl(), createStyleWrapper); + map.set(tableTag.localName().impl(), createTableWrapper); + map.set(tbodyTag.localName().impl(), createTableSectionWrapper); + map.set(tdTag.localName().impl(), createTableCellWrapper); + map.set(textareaTag.localName().impl(), createTextAreaWrapper); + map.set(titleTag.localName().impl(), createTitleWrapper); + map.set(trTag.localName().impl(), createTableRowWrapper); + map.set(ulTag.localName().impl(), createUListWrapper); + map.set(colgroupTag.localName().impl(), createTableColWrapper); + map.set(h2Tag.localName().impl(), createHeadingWrapper); + map.set(h3Tag.localName().impl(), createHeadingWrapper); + map.set(h4Tag.localName().impl(), createHeadingWrapper); + map.set(h5Tag.localName().impl(), createHeadingWrapper); + map.set(h6Tag.localName().impl(), createHeadingWrapper); + map.set(imageTag.localName().impl(), createImageWrapper); + map.set(insTag.localName().impl(), createModWrapper); + map.set(keygenTag.localName().impl(), createSelectWrapper); + map.set(listingTag.localName().impl(), createPreWrapper); + map.set(tfootTag.localName().impl(), createTableSectionWrapper); + map.set(thTag.localName().impl(), createTableCellWrapper); + map.set(theadTag.localName().impl(), createTableSectionWrapper); + map.set(xmpTag.localName().impl(), createPreWrapper); + } + + CreateHTMLElementWrapperFunction createWrapperFunction = + map.get(element->localName().impl()); + if (createWrapperFunction) + return createWrapperFunction(element); + return wrapHTMLElement(element.get()); +} + +} diff --git a/Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.h b/Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.h new file mode 100644 index 0000000..2677891 --- /dev/null +++ b/Source/WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2005 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2010 Igalia S.L. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef WebKitHTMLElementWrapperFactory_h +#define WebKitHTMLElementWrapperFactory_h + +#include "HTMLElement.h" +#include "glib-object.h" + +#include <wtf/Forward.h> + +namespace WebCore { +class HTMLElement; +} + +namespace WebKit { +gpointer createHTMLElementWrapper(PassRefPtr<WebCore::HTMLElement>); +} + +#endif // WebKitHTMLElementWrapperFactory_h |