Skip to content
Permalink
Browse files
[GTK] [CMake] Add support for building the DOM bindings
https://bugs.webkit.org/show_bug.cgi?id=116375

Reviewed by Gustavo Noronha Silva.

The CMake build is more complete than the autotools counterpart, so autotools doesn't consider
some supplemental IDL attributes when building the DOM bindings. To prevent API breaks we should
protect these attributes from DOM binding generation.

* Modules/battery/BatteryManager.idl: Protect non-GObject DOM bound methods by C preprocessor checks.
* Modules/battery/NavigatorBattery.idl: Ditto.
* Modules/mediastream/HTMLMediaElementMediaStream.idl: Ditto.
* Modules/networkinfo/NavigatorNetworkInfoConnection.idl: Ditto.
* Modules/networkinfo/NetworkInfoConnection.idl: Ditto.
* PlatformGTK.cmake: Add build steps for building the bindings.
* dom/Document.idl: Protect non-GObject DOM bound methods by C preprocessor checks.
* html/HTMLMediaElement.idl: Ditto.

Canonical link: https://commits.webkit.org/143574@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@160367 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
mrobinson committed Dec 10, 2013
1 parent c11e604 commit 74a184cd643ff60f6f3a96e939f972dac6a1c201
@@ -1,3 +1,23 @@
2013-12-10 Martin Robinson <mrobinson@igalia.com>

[GTK] [CMake] Add support for building the DOM bindings
https://bugs.webkit.org/show_bug.cgi?id=116375

Reviewed by Gustavo Noronha Silva.

The CMake build is more complete than the autotools counterpart, so autotools doesn't consider
some supplemental IDL attributes when building the DOM bindings. To prevent API breaks we should
protect these attributes from DOM binding generation.

* Modules/battery/BatteryManager.idl: Protect non-GObject DOM bound methods by C preprocessor checks.
* Modules/battery/NavigatorBattery.idl: Ditto.
* Modules/mediastream/HTMLMediaElementMediaStream.idl: Ditto.
* Modules/networkinfo/NavigatorNetworkInfoConnection.idl: Ditto.
* Modules/networkinfo/NetworkInfoConnection.idl: Ditto.
* PlatformGTK.cmake: Add build steps for building the bindings.
* dom/Document.idl: Protect non-GObject DOM bound methods by C preprocessor checks.
* html/HTMLMediaElement.idl: Ditto.

2013-12-10 Martin Robinson <mrobinson@igalia.com>

Various fixes for the CMake GTK+ build
@@ -18,6 +18,7 @@
*/

// http://dev.w3.org/2009/dap/system-info/battery-status.html
#if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_OBJECT
[
NoInterfaceObject,
Conditional=BATTERY_STATUS,
@@ -43,4 +44,4 @@
optional boolean useCapture);
[RaisesException] boolean dispatchEvent(Event event);
};

#endif
@@ -17,9 +17,10 @@
* Boston, MA 02110-1301, USA.
*/

#if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT
[
Conditional=BATTERY_STATUS,
] partial interface Navigator {
readonly attribute BatteryManager webkitBattery;
};

#endif
@@ -27,5 +27,7 @@
Conditional=VIDEO&MEDIA_STREAM,
] partial interface HTMLMediaElement
{
#if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT
attribute MediaStream? srcObject;
#endif
};
@@ -17,9 +17,10 @@
* Boston, MA 02110-1301, USA.
*/

#if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT
[
Conditional=NETWORK_INFO,
] partial interface Navigator {
readonly attribute NetworkInfoConnection webkitConnection;
};

#endif
@@ -20,6 +20,7 @@
*/

// http://dvcs.w3.org/hg/dap/raw-file/tip/network-api/index.html
#if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT
[
NoInterfaceObject,
Conditional=NETWORK_INFO,
@@ -40,3 +41,4 @@
optional boolean useCapture);
[RaisesException] boolean dispatchEvent(Event evt);
};
#endif
@@ -360,3 +360,257 @@ if (ENABLE_WEB_AUDIO)
DESTINATION
"${DATA_INSTALL_DIR}/resources/audio")
endif ()

if (ENABLE_WEBKIT2)
set(DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR ${DERIVED_SOURCES_DIR}/webkitdom)

include_directories(
"${WebCore_INCLUDE_DIRECTORIES}"
"${DERIVED_SOURCES_DIR}"
"${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}"
)

list(APPEND GObjectDOMBindings_SOURCES
bindings/gobject/ConvertToUTF8String.cpp
bindings/gobject/ConvertToUTF8String.h
bindings/gobject/DOMObjectCache.cpp
bindings/gobject/DOMObjectCache.h
bindings/gobject/GObjectEventListener.cpp
bindings/gobject/GObjectEventListener.h
bindings/gobject/WebKitDOMCustom.cpp
bindings/gobject/WebKitDOMCustom.h
bindings/gobject/WebKitDOMEventTarget.cpp
bindings/gobject/WebKitDOMEventTarget.h
bindings/gobject/WebKitDOMEventTargetPrivate.h
bindings/gobject/WebKitDOMHTMLPrivate.cpp
bindings/gobject/WebKitDOMHTMLPrivate.h
bindings/gobject/WebKitDOMObject.cpp
bindings/gobject/WebKitDOMObject.h
bindings/gobject/WebKitDOMPrivate.cpp
bindings/gobject/WebKitDOMPrivate.h
${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomdefines.h
${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdom.h
)

list(APPEND GObjectDOMBindings_IDL_FILES
Modules/battery/BatteryManager.idl
Modules/gamepad/Gamepad.idl
Modules/gamepad/GamepadList.idl
Modules/geolocation/Geolocation.idl
Modules/quota/StorageInfo.idl
Modules/quota/StorageQuota.idl
Modules/webdatabase/Database.idl

css/CSSRule.idl
css/CSSRuleList.idl
css/CSSStyleDeclaration.idl
css/CSSStyleSheet.idl
css/CSSValue.idl
css/DOMWindowCSS.idl
css/MediaList.idl
css/MediaQueryList.idl
css/StyleMedia.idl
css/StyleSheet.idl
css/StyleSheetList.idl

dom/Attr.idl
dom/CDATASection.idl
dom/CharacterData.idl
dom/Comment.idl
dom/DOMImplementation.idl
dom/DOMNamedFlowCollection.idl
dom/DOMStringList.idl
dom/DOMStringMap.idl
dom/Document.idl
dom/DocumentFragment.idl
dom/DocumentType.idl
dom/Element.idl
dom/EntityReference.idl
dom/Event.idl
dom/KeyboardEvent.idl
dom/MessagePort.idl
dom/MouseEvent.idl
dom/NamedNodeMap.idl
dom/Node.idl
dom/NodeFilter.idl
dom/NodeIterator.idl
dom/NodeList.idl
dom/ProcessingInstruction.idl
dom/Range.idl
dom/ShadowRoot.idl
dom/Text.idl
dom/TreeWalker.idl
dom/UIEvent.idl
dom/WebKitNamedFlow.idl
dom/WheelEvent.idl

fileapi/Blob.idl
fileapi/File.idl
fileapi/FileList.idl

html/DOMSettableTokenList.idl
html/DOMTokenList.idl
html/HTMLAnchorElement.idl
html/HTMLAppletElement.idl
html/HTMLAreaElement.idl
html/HTMLBRElement.idl
html/HTMLBaseElement.idl
html/HTMLBaseFontElement.idl
html/HTMLBodyElement.idl
html/HTMLButtonElement.idl
html/HTMLCanvasElement.idl
html/HTMLCollection.idl
html/HTMLDListElement.idl
html/HTMLDetailsElement.idl
html/HTMLDirectoryElement.idl
html/HTMLDivElement.idl
html/HTMLDocument.idl
html/HTMLElement.idl
html/HTMLEmbedElement.idl
html/HTMLFieldSetElement.idl
html/HTMLFontElement.idl
html/HTMLFormElement.idl
html/HTMLFrameElement.idl
html/HTMLFrameSetElement.idl
html/HTMLHRElement.idl
html/HTMLHeadElement.idl
html/HTMLHeadingElement.idl
html/HTMLHtmlElement.idl
html/HTMLIFrameElement.idl
html/HTMLImageElement.idl
html/HTMLInputElement.idl
html/HTMLKeygenElement.idl
html/HTMLLIElement.idl
html/HTMLLabelElement.idl
html/HTMLLegendElement.idl
html/HTMLLinkElement.idl
html/HTMLMapElement.idl
html/HTMLMarqueeElement.idl
html/HTMLMediaElement.idl
html/HTMLMenuElement.idl
html/HTMLMetaElement.idl
html/HTMLModElement.idl
html/HTMLOListElement.idl
html/HTMLObjectElement.idl
html/HTMLOptGroupElement.idl
html/HTMLOptionElement.idl
html/HTMLOptionsCollection.idl
html/HTMLParagraphElement.idl
html/HTMLParamElement.idl
html/HTMLPreElement.idl
html/HTMLQuoteElement.idl
html/HTMLScriptElement.idl
html/HTMLSelectElement.idl
html/HTMLStyleElement.idl
html/HTMLTableCaptionElement.idl
html/HTMLTableCellElement.idl
html/HTMLTableColElement.idl
html/HTMLTableElement.idl
html/HTMLTableRowElement.idl
html/HTMLTableSectionElement.idl
html/HTMLTextAreaElement.idl
html/HTMLTitleElement.idl
html/HTMLUListElement.idl
html/MediaController.idl
html/MediaError.idl
html/TimeRanges.idl
html/ValidityState.idl

loader/appcache/DOMApplicationCache.idl

page/BarProp.idl
page/Console.idl
page/DOMSecurityPolicy.idl
page/DOMSelection.idl
page/DOMWindow.idl
page/History.idl
page/Location.idl
page/Navigator.idl
page/Performance.idl
page/PerformanceEntry.idl
page/PerformanceEntryList.idl
page/PerformanceNavigation.idl
page/PerformanceTiming.idl
page/Screen.idl
page/WebKitPoint.idl

plugins/DOMMimeType.idl
plugins/DOMMimeTypeArray.idl
plugins/DOMPlugin.idl
plugins/DOMPluginArray.idl

storage/Storage.idl

xml/XPathExpression.idl
xml/XPathNSResolver.idl
xml/XPathResult.idl
)

if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
list(APPEND GObjectDOMBindings_IDL_FILES
html/HTMLAudioElement.idl
html/HTMLVideoElement.idl

html/track/AudioTrack.idl
html/track/AudioTrackList.idl
html/track/TextTrack.idl
html/track/TextTrackCue.idl
html/track/TextTrackCueList.idl
html/track/TextTrackList.idl
html/track/TrackEvent.idl
html/track/VideoTrack.idl
html/track/VideoTrackList.idl
)
endif ()

foreach (file Custom EventTarget Object Deprecated ${GObjectDOMBindings_IDL_FILES})
get_filename_component(file ${file} NAME_WE)
list(APPEND GObjectDOMBindings_CLASS_LIST ${file})
endforeach ()

set(GOBJECT_DOM_BINDINGS_FEATURES_DEFINES "LANGUAGE_GOBJECT=1 ${FEATURE_DEFINES_WITH_SPACE_SEPARATOR}")
string(REPLACE "ENABLE_INDEXED_DATABASE=1" "" GOBJECT_DOM_BINDINGS_FEATURES_DEFINES ${GOBJECT_DOM_BINDINGS_FEATURES_DEFINES})
string(REPLACE REGEX "ENABLE_SVG[A-Z_]+=1" "" GOBJECT_DOM_BINDINGS_FEATURES_DEFINES ${GOBJECT_DOM_BINDINGS_FEATURES_DEFINES})

file(MAKE_DIRECTORY ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR})

add_custom_command(
OUTPUT ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomdefines.h
COMMAND echo ${GObjectDOMBindings_CLASS_LIST} | ${PERL_EXECUTABLE} ${WEBCORE_DIR}/bindings/scripts/gobject-generate-headers.pl defines > ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdomdefines.h
)

add_custom_command(
OUTPUT ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdom.h
COMMAND echo ${GObjectDOMBindings_CLASS_LIST} | ${PERL_EXECUTABLE} ${WEBCORE_DIR}/bindings/scripts/gobject-generate-headers.pl gdom > ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}/webkitdom.h
)

add_custom_target(fake-installed-webkitdom-headers
COMMAND ln -n -s -f ${WEBCORE_DIR}/bindings/gobject/* ${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}
)

GENERATE_BINDINGS(GObjectDOMBindings_SOURCES
"${GObjectDOMBindings_IDL_FILES}"
"${WEBCORE_DIR}"
"${IDL_INCLUDES}"
"${GOBJECT_DOM_BINDINGS_FEATURES_DEFINES}"
${DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR}
WebKitDOM GObject
${IDL_ATTRIBUTES_FILE}
${SUPPLEMENTAL_DEPENDENCY_FILE}
${WINDOW_CONSTRUCTORS_FILE}
${WORKERGLOBALSCOPE_CONSTRUCTORS_FILE}
${SHAREDWORKERGLOBALSCOPE_CONSTRUCTORS_FILE}
${DEDICATEDWORKERGLOBALSCOPE_CONSTRUCTORS_FILE})

add_definitions(-DBUILDING_WEBKIT)

add_library(GObjectDOMBindings STATIC ${GObjectDOMBindings_SOURCES})

WEBKIT_SET_EXTRA_COMPILER_FLAGS(GObjectDOMBindings)

add_dependencies(GObjectDOMBindings
WebCore
fake-installed-webkitdom-headers
)
endif ()

@@ -239,7 +239,7 @@
[Conditional=FONT_LOAD_EVENTS] readonly attribute FontLoader fontloader;
#endif

#if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
#if (!defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C) && (!defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT)
// Event handler DOM attributes
[NotEnumerable] attribute EventListener onabort;
[NotEnumerable] attribute EventListener onblur;
@@ -108,15 +108,18 @@
[ImplementedAs=setMediaKeys] void webkitSetMediaKeys(MediaKeys mediaKeys);
#endif

#if defined(ENABLE_VIDEO_TRACK) && ENABLE_VIDEO_TRACK
#if defined(ENABLE_VIDEO_TRACK) && ENABLE_VIDEO_TRACK && (!defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT)
[RaisesException] TextTrack addTextTrack(DOMString kind, optional DOMString label, optional DOMString language);
readonly attribute AudioTrackList audioTracks;
readonly attribute TextTrackList textTracks;
readonly attribute VideoTrackList videoTracks;
#endif

[Reflect, TreatNullAs=NullString] attribute DOMString mediaGroup;

#if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT
[CustomSetter] attribute MediaController controller;

#endif

[Conditional=MEDIA_SOURCE] VideoPlaybackQuality getVideoPlaybackQuality();
};

0 comments on commit 74a184c

Please sign in to comment.