Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Include default value in Experimental Feature information
https://bugs.webkit.org/show_bug.cgi?id=165509
<rdar://problems/29547177>

Reviewed by Tim Horton.

Add a defaultValue member variable to experimental
features, both the C++ and ObjC interfaces.

* UIProcess/API/APIExperimentalFeature.cpp:
(API::ExperimentalFeature::create):
(API::ExperimentalFeature::ExperimentalFeature):
* UIProcess/API/APIExperimentalFeature.h:
* UIProcess/API/Cocoa/_WKExperimentalFeature.h:
* UIProcess/API/Cocoa/_WKExperimentalFeature.mm:
(-[_WKExperimentalFeature description]):
(-[_WKExperimentalFeature defaultValue]):
* UIProcess/WebPreferences.cpp:
(WebKit::createExperimentalFeaturesVector):

Canonical link: https://commits.webkit.org/183110@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209443 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
grorg committed Dec 7, 2016
1 parent e0d50c7 commit 96a71c3
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 7 deletions.
22 changes: 22 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,25 @@
2016-12-06 Dean Jackson <dino@apple.com>

Include default value in Experimental Feature information
https://bugs.webkit.org/show_bug.cgi?id=165509
<rdar://problems/29547177>

Reviewed by Tim Horton.

Add a defaultValue member variable to experimental
features, both the C++ and ObjC interfaces.

* UIProcess/API/APIExperimentalFeature.cpp:
(API::ExperimentalFeature::create):
(API::ExperimentalFeature::ExperimentalFeature):
* UIProcess/API/APIExperimentalFeature.h:
* UIProcess/API/Cocoa/_WKExperimentalFeature.h:
* UIProcess/API/Cocoa/_WKExperimentalFeature.mm:
(-[_WKExperimentalFeature description]):
(-[_WKExperimentalFeature defaultValue]):
* UIProcess/WebPreferences.cpp:
(WebKit::createExperimentalFeaturesVector):

2016-12-06 Commit Queue <commit-queue@webkit.org>

Unreviewed, rolling out r209391.
Expand Down
7 changes: 4 additions & 3 deletions Source/WebKit2/UIProcess/API/APIExperimentalFeature.cpp
Expand Up @@ -28,15 +28,16 @@

namespace API {

Ref<ExperimentalFeature> ExperimentalFeature::create(const WTF::String& name, const WTF::String& key, const WTF::String& details)
Ref<ExperimentalFeature> ExperimentalFeature::create(const WTF::String& name, const WTF::String& key, const WTF::String& details, bool defaultValue)
{
return adoptRef(*new ExperimentalFeature(name, key, details));
return adoptRef(*new ExperimentalFeature(name, key, details, defaultValue));
}

ExperimentalFeature::ExperimentalFeature(const WTF::String& name, const WTF::String& key, const WTF::String& details)
ExperimentalFeature::ExperimentalFeature(const WTF::String& name, const WTF::String& key, const WTF::String& details, bool defaultValue)
: m_name(name)
, m_key(key)
, m_details(details)
, m_defaultValue(defaultValue)
{
}

Expand Down
6 changes: 4 additions & 2 deletions Source/WebKit2/UIProcess/API/APIExperimentalFeature.h
Expand Up @@ -33,19 +33,21 @@ namespace API {

class ExperimentalFeature final : public ObjectImpl<Object::Type::ExperimentalFeature> {
public:
static Ref<ExperimentalFeature> create(const WTF::String& name, const WTF::String& key, const WTF::String& details);
static Ref<ExperimentalFeature> create(const WTF::String& name, const WTF::String& key, const WTF::String& details, bool defaultValue);
virtual ~ExperimentalFeature();

WTF::String name() const { return m_name; }
WTF::String key() const { return m_key; }
WTF::String details() const { return m_details; }
bool defaultValue() const { return m_defaultValue; }

private:
explicit ExperimentalFeature(const WTF::String& name, const WTF::String& key, const WTF::String& details);
explicit ExperimentalFeature(const WTF::String& name, const WTF::String& key, const WTF::String& details, bool defaultValue);

WTF::String m_name;
WTF::String m_key;
WTF::String m_details;
bool m_defaultValue;
};

}
Expand Down
Expand Up @@ -35,6 +35,7 @@ WK_CLASS_AVAILABLE(macosx(10.12), ios(10.0))
@property (nonatomic, readonly, copy) NSString *key;
@property (nonatomic, readonly, copy) NSString *name;
@property (nonatomic, readonly, copy) NSString *details;
@property (nonatomic, readonly) BOOL defaultValue;

@end

Expand Down
7 changes: 6 additions & 1 deletion Source/WebKit2/UIProcess/API/Cocoa/_WKExperimentalFeature.mm
Expand Up @@ -39,7 +39,7 @@ - (void)dealloc

- (NSString *)description
{
return [NSString stringWithFormat:@"<%@: %p; name = %@; key = { %@ }>", NSStringFromClass(self.class), self, self.name, self.key];
return [NSString stringWithFormat:@"<%@: %p; name = %@; key = %@; defaultValue = %s >", NSStringFromClass(self.class), self, self.name, self.key, self.defaultValue ? "on" : "off"];
}

- (NSString *)name
Expand All @@ -57,6 +57,11 @@ - (NSString *)details
return _experimentalFeature->details();
}

- (BOOL)defaultValue
{
return _experimentalFeature->defaultValue();
}

#pragma mark WKObject protocol implementation

- (API::Object&)_apiObject
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit2/UIProcess/WebPreferences.cpp
Expand Up @@ -218,7 +218,7 @@ static Vector<RefPtr<API::Object>> createExperimentalFeaturesVector()
Vector<RefPtr<API::Object>> features;

#define ADD_EXPERIMENTAL_PREFERENCE_DESCRIPTION(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \
features.append(API::ExperimentalFeature::create(HumanReadableName, #KeyUpper, HumanReadableDescription)); \
features.append(API::ExperimentalFeature::create(HumanReadableName, #KeyUpper, HumanReadableDescription, DefaultValue)); \

FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(ADD_EXPERIMENTAL_PREFERENCE_DESCRIPTION)

Expand Down

0 comments on commit 96a71c3

Please sign in to comment.