wiki:AddingFeatures

Version 10 (modified by Laszlo Gombos, 8 years ago) (diff)

wtf/FeatureDefines.h has the defaults for all the feature flags

Introduction

The policy for adding new (major) features to WebKit is:

  • Send email to webkit-dev describing the feature and linking to the tracking bug.
  • If necessary, add an ENABLE flag for the feature.

How to add an ENABLE flag

By adding a build definition for ENABLE_FEATURE it allows code/preprocessor to test using ENABLE(FEATURE). You'll need to edit at least the following files:

  • Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig
  • Source/WebCore/Configurations/FeatureDefines.xcconfig
  • Source/WebKit/mac/Configurations/FeatureDefines.xcconfig
  • Source/WebKit2/Configurations/FeatureDefines.xcconfig
  • Source/WebCore/GNUmakefile.features.am.in
  • Source/WebKit/chromium/features.gypi
  • Source/cmake/WebKitFeatures.cmake
  • Source/cmakeconfig.h.cmake
  • Source/WTF/wtf/FeatureDefines.h
  • Tools/Scripts/webkitperl/FeatureList.pm
  • Tools/qmake/mkspecs/features/features.pri
  • WebKitLibraries/win/tools/vsprops/FeatureDefines.vsprops
  • WebKitLibraries/win/tools/vsprops/FeatureDefinesCairo.vsprops

Note that only defines the feature. To turn the feature on, you'll need to edit the build configurations for each port. (TODO: page describing where each configuration is?)

After adding a feature, please add it to the list in the wiki

Activating a feature for CMAKE based ports

  • Edit Source/cmake/Options<Port>.cmake, e.g. OptionsEfl.cmake and set a default value for this feature.
  • Edit Tools/Scripts/webkitperl/FeatureList.pm to default enable this for the same port, e.g add a isPort() statement to the default setting assignment.

Activating a feature for Autotools based ports

At the moment only the GTK port is using this build system

  • You only need to add the feature define to Source/WebCore/GNUmakefile.features.am.in. In most cases the feature define specified there will, at the time of adding, default to 0. The feature define values used in this file indicate the status of feature support by the GTK port in release versions, so please leave decision of changing these values to the GTK port maintainers (or at least consult them on any changes you'd like to make).
  • You're welcome to enable the feature define for the GTK port in Tools/Scripts/webkitperl/FeatureList.pm if the feature does not rely on any port-specific implementations (or if you're not willing to implement them) and would like to have the GTK port run feature's layout tests for you. The feature define values specified in this file override those in Source/WebCore/GNUmakefile.features.am.in when using build-webkit (i.e. when using development build, for instance on BuildBot builders).
  • Adding new features usually included changes to configure.ac where the developer was expected to add a new configuration option for the feature. This is not the case anymore. A configuration option should only be added if the feature implementation for the GTK port introduces a dependency (for instance video support relies on GStreamer, hence there's a configuration option available).