Commit 742f5c21 authored by bashi@chromium.org's avatar bashi@chromium.org

This is an attempt to re-land r181610. The CL was reverted due to build...

This is an attempt to re-land r181610. The CL was reverted due to build breakage, but I couldn't reproduce the link error.

TBR=haraken@chromium.org,keishi@chromium.org

The original description:

Add FontFaceDescriptors IDL dictionary

To follow the spec[1]. This is the first place to use IDL dictionary
execept for testing, so this CL also includes build related changes.
Existing tests(e.g. fast/css/fontface-constructor-error.html) should
cover this change.

[1] http://dev.w3.org/csswg/css-font-loading/#fontface-interface

BUG=403150
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=181610

Review URL: https://codereview.chromium.org/556543003

git-svn-id: svn://svn.chromium.org/blink/trunk@181631 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 7a0ce880
......@@ -8,6 +8,10 @@ import("//third_party/WebKit/Source/core/core.gni")
# Don't actually read idl.gypi since that just defines variables in terms of
# others, which gypi_to_gn doesn't handle.
core_definition_idl_files =
core_dictionary_idl_files +
core_idl_files
core_testing_definition_idl_files =
core_testing_dictionary_idl_files +
webcore_testing_idl_files
......@@ -15,13 +19,13 @@ core_testing_definition_idl_files =
# IDL file lists; see: http://www.chromium.org/developers/web-idl-interfaces
# Interface IDL files: generate individual bindings (includes testing)
core_interface_idl_files =
core_idl_files +
core_definition_idl_files +
core_testing_definition_idl_files +
generated_webcore_testing_idl_files
# Static IDL files
core_static_interface_idl_files =
core_idl_files +
core_definition_idl_files +
core_testing_definition_idl_files
core_static_dependency_idl_files =
core_dependency_idl_files +
......
......@@ -11,6 +11,10 @@
],
'variables': {
'core_definition_idl_files': [
'<@(core_dictionary_idl_files)',
'<@(core_idl_files)',
],
'core_testing_definition_idl_files': [
'<@(core_testing_dictionary_idl_files)',
'<@(webcore_testing_idl_files)',
......@@ -19,15 +23,15 @@
# IDL file lists; see: http://www.chromium.org/developers/web-idl-interfaces
# Interface IDL files: generate individual bindings (includes testing)
'core_interface_idl_files': [
'<@(core_idl_files)',
'<@(core_definition_idl_files)',
'<@(core_testing_definition_idl_files)',
'<@(generated_webcore_testing_idl_files)',
],
# Write lists of main IDL files to a file, so that the command lines don't
# exceed OS length limits.
'core_idl_files_list': '<|(core_idl_files_list.tmp <@(core_idl_files))',
'core_dictionary_idl_files_list': '<|(core_dictionary_idl_files_list.tmp <@(core_testing_dictionary_idl_files))',
'core_idl_files_list': '<|(core_idl_files_list.tmp <@(core_definition_idl_files))',
'core_dictionary_idl_files_list': '<|(core_dictionary_idl_files_list.tmp <@(core_dictionary_idl_files) <@(core_testing_dictionary_idl_files))',
# Dependency IDL files: don't generate individual bindings, but do process
# in IDL dependency computation, and count as build dependencies
......@@ -58,7 +62,7 @@
# Static IDL files
'core_static_interface_idl_files': [
'<@(core_idl_files)',
'<@(core_definition_idl_files)',
'<@(core_testing_definition_idl_files)',
],
'core_static_dependency_idl_files': [
......
......@@ -21,7 +21,7 @@ group("bindings_core_v8_generated") {
# bindings_core_generated_aggregate in Source/bindings/core/v8/generated.gyp
aggregate_generated_bindings("bindings_core_v8_generated_aggregate") {
sources = core_idl_files
sources = core_definition_idl_files
component_dir = "core"
outputs = bindings_core_generated_aggregate_files
}
......@@ -34,10 +34,7 @@ idl_compiler("bindings_core_v8_generated_individual") {
# bindings_core_dictionary_impl_generated in Source/bindings/core/v8/generated.gyp
idl_dictionary("bindings_core_dictionary_impl_generated") {
# FIXME: Add 'core_dictionary_idl_files' to sources
# See comment on core/core.gypi
sources = core_testing_dictionary_idl_files
# FIXME: Add 'generated_core_dictionary_files' to outputs
# See comment on core/core.gypi
outputs = generated_core_testing_dictionary_files
sources = core_dictionary_idl_files + core_testing_dictionary_idl_files
outputs = generated_core_dictionary_files +
generated_core_testing_dictionary_files
}
......@@ -131,8 +131,7 @@
'../../modules/generated.gyp:interfaces_info',
],
'sources': [
# FIXME: Add '<@(core_dictionary_idl_files)',
# See comment on core/core.gypi
'<@(core_dictionary_idl_files)',
'<@(core_testing_dictionary_idl_files)',
],
'actions': [{
......@@ -149,8 +148,7 @@
'<(bindings_modules_output_dir)/InterfacesInfoModules.pickle',
],
'outputs': [
# FIXME: Add '<@(generated_core_dictionary_files)',
# See comment on core/core.gypi
'<@(generated_core_dictionary_files)',
'<@(generated_core_testing_dictionary_files)',
],
'action': [
......
......@@ -342,6 +342,8 @@ source_set("core_generated") {
# These files include all the .cpp files generated from the .idl files
# in webcore_files.
sources += bindings_core_generated_aggregate_files
# IDL dictionary impl files generated by IDL compiler
sources += generated_core_dictionary_files
sources += [
# Additional .cpp files for HashTools.h
......
......@@ -18,6 +18,8 @@ _gypi = exec_script(
# Files for which bindings (.cpp and .h files) will be generated.
core_idl_files = get_path_info(_gypi.core_idl_files, "abspath")
core_dictionary_idl_files =
get_path_info(_gypi.core_dictionary_idl_files, "abspath")
core_testing_dictionary_idl_files =
get_path_info(_gypi.core_testing_dictionary_idl_files, "abspath")
......@@ -37,6 +39,8 @@ webcore_testing_idl_files =
get_path_info(_gypi.webcore_testing_idl_files, "abspath")
webcore_testing_dependency_idl_files =
get_path_info(_gypi.webcore_testing_dependency_idl_files, "abspath")
generated_core_dictionary_files =
get_path_info(_gypi.generated_core_dictionary_files, "abspath")
generated_core_testing_dictionary_files =
get_path_info(_gypi.generated_core_testing_dictionary_files, "abspath")
generated_webcore_testing_idl_files =
......
......@@ -281,8 +281,7 @@
'<(blink_core_output_dir)/CSSPropertyMetadata.cpp',
# IDL dictionary impl files generated by IDL compiler
# FIXME: Add '<@(generated_core_dictionary_files)',
# See comment on core/core.gypi
'<@(generated_core_dictionary_files)',
],
'conditions': [
['OS=="win" and component=="shared_library"', {
......
......@@ -3336,18 +3336,13 @@
'svg/properties/SVGAnimatedProperty.cpp',
'svg/properties/SVGPropertyTearOff.cpp',
],
# FIXME: http://crbug.com/403150
# Add 'core_dictionary_idl_files' and
# 'generated_core_dictionary_files' variables.
# The variables should contain IDL dictionary files and generated files
# They would look like below:
# 'core_dictionary_idl_files': [
# 'css/FontFaceDescriptors.idl',
# ],
# 'generated_core_dictionary_files': [
# '<(blink_core_output_dir)/css/FontFaceDescriptors.cpp',
# '<(blink_core_output_dir)/css/FontFaceDescriptors.h',
# ],
'core_dictionary_idl_files': [
'css/FontFaceDescriptors.idl',
],
'generated_core_dictionary_files': [
'<(blink_core_output_dir)/css/FontFaceDescriptors.cpp',
'<(blink_core_output_dir)/css/FontFaceDescriptors.h',
],
'core_testing_dictionary_idl_files': [
'testing/InternalDictionary.idl',
],
......
......@@ -31,7 +31,6 @@
#include "config.h"
#include "core/css/FontFace.h"
#include "bindings/core/v8/Dictionary.h"
#include "bindings/core/v8/ExceptionState.h"
#include "bindings/core/v8/ScriptState.h"
#include "core/CSSValueKeywords.h"
......@@ -42,6 +41,7 @@
#include "core/css/CSSPrimitiveValue.h"
#include "core/css/CSSUnicodeRangeValue.h"
#include "core/css/CSSValueList.h"
#include "core/css/FontFaceDescriptors.h"
#include "core/css/LocalFontFaceSource.h"
#include "core/css/RemoteFontFaceSource.h"
#include "core/css/StylePropertySet.h"
......@@ -70,7 +70,7 @@ static PassRefPtrWillBeRawPtr<CSSValue> parseCSSValue(const Document* document,
return parsedStyle->getPropertyCSSValue(propertyID);
}
PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, const String& source, const Dictionary& descriptors)
PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, const String& source, const FontFaceDescriptors* descriptors)
{
RefPtrWillBeRawPtr<FontFace> fontFace = adoptRefWillBeNoop(new FontFace(context, family, descriptors));
......@@ -82,14 +82,14 @@ PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, con
return fontFace.release();
}
PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, PassRefPtr<ArrayBuffer> source, const Dictionary& descriptors)
PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, PassRefPtr<ArrayBuffer> source, const FontFaceDescriptors* descriptors)
{
RefPtrWillBeRawPtr<FontFace> fontFace = adoptRefWillBeNoop(new FontFace(context, family, descriptors));
fontFace->initCSSFontFace(static_cast<const unsigned char*>(source->data()), source->byteLength());
return fontFace.release();
}
PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, PassRefPtr<ArrayBufferView> source, const Dictionary& descriptors)
PassRefPtrWillBeRawPtr<FontFace> FontFace::create(ExecutionContext* context, const AtomicString& family, PassRefPtr<ArrayBufferView> source, const FontFaceDescriptors* descriptors)
{
RefPtrWillBeRawPtr<FontFace> fontFace = adoptRefWillBeNoop(new FontFace(context, family, descriptors));
fontFace->initCSSFontFace(static_cast<const unsigned char*>(source->baseAddress()), source->byteLength());
......@@ -130,24 +130,17 @@ FontFace::FontFace()
{
}
FontFace::FontFace(ExecutionContext* context, const AtomicString& family, const Dictionary& descriptors)
FontFace::FontFace(ExecutionContext* context, const AtomicString& family, const FontFaceDescriptors* descriptors)
: m_family(family)
, m_status(Unloaded)
{
Document* document = toDocument(context);
String value;
if (DictionaryHelper::get(descriptors, "style", value))
setPropertyFromString(document, value, CSSPropertyFontStyle);
if (DictionaryHelper::get(descriptors, "weight", value))
setPropertyFromString(document, value, CSSPropertyFontWeight);
if (DictionaryHelper::get(descriptors, "stretch", value))
setPropertyFromString(document, value, CSSPropertyFontStretch);
if (DictionaryHelper::get(descriptors, "unicodeRange", value))
setPropertyFromString(document, value, CSSPropertyUnicodeRange);
if (DictionaryHelper::get(descriptors, "variant", value))
setPropertyFromString(document, value, CSSPropertyFontVariant);
if (DictionaryHelper::get(descriptors, "featureSettings", value))
setPropertyFromString(document, value, CSSPropertyWebkitFontFeatureSettings);
setPropertyFromString(document, descriptors->style(), CSSPropertyFontStyle);
setPropertyFromString(document, descriptors->weight(), CSSPropertyFontWeight);
// FIXME: we don't implement 'font-strech' property yet so we can't set the property.
setPropertyFromString(document, descriptors->unicodeRange(), CSSPropertyUnicodeRange);
setPropertyFromString(document, descriptors->variant(), CSSPropertyFontVariant);
setPropertyFromString(document, descriptors->featureSettings(), CSSPropertyWebkitFontFeatureSettings);
}
FontFace::~FontFace()
......
......@@ -49,6 +49,7 @@ class CSSValueList;
class Dictionary;
class Document;
class ExceptionState;
class FontFaceDescriptors;
class StylePropertySet;
class StyleRuleFontFace;
......@@ -57,9 +58,9 @@ class FontFace : public RefCountedWillBeGarbageCollectedFinalized<FontFace>, pub
public:
enum LoadStatus { Unloaded, Loading, Loaded, Error };
static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const AtomicString& family, PassRefPtr<ArrayBuffer> source, const Dictionary&);
static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const AtomicString& family, PassRefPtr<ArrayBufferView>, const Dictionary&);
static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const AtomicString& family, const String& source, const Dictionary&);
static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const AtomicString& family, PassRefPtr<ArrayBuffer> source, const FontFaceDescriptors*);
static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const AtomicString& family, PassRefPtr<ArrayBufferView>, const FontFaceDescriptors*);
static PassRefPtrWillBeRawPtr<FontFace> create(ExecutionContext*, const AtomicString& family, const String& source, const FontFaceDescriptors*);
static PassRefPtrWillBeRawPtr<FontFace> create(Document*, const StyleRuleFontFace*);
~FontFace();
......@@ -108,7 +109,7 @@ public:
private:
FontFace();
FontFace(ExecutionContext*, const AtomicString& family, const Dictionary& descriptors);
FontFace(ExecutionContext*, const AtomicString& family, const FontFaceDescriptors*);
void initCSSFontFace(Document*, PassRefPtrWillBeRawPtr<CSSValue> src);
void initCSSFontFace(const unsigned char* data, unsigned size);
......
......@@ -39,9 +39,9 @@ enum FontFaceLoadStatus {
[
// FIXME: should be union type http://crbug.com/240176
Constructor(DOMString family, DOMString source, optional Dictionary descriptors),
Constructor(DOMString family, ArrayBuffer source, optional Dictionary descriptors),
Constructor(DOMString family, ArrayBufferView source, optional Dictionary descriptors),
Constructor(DOMString family, DOMString source, optional FontFaceDescriptors descriptors),
Constructor(DOMString family, ArrayBuffer source, optional FontFaceDescriptors descriptors),
Constructor(DOMString family, ArrayBufferView source, optional FontFaceDescriptors descriptors),
ConstructorCallWith=ExecutionContext,
WillBeGarbageCollected,
] interface FontFace {
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
GarbageCollected
] dictionary FontFaceDescriptors {
DOMString style = "normal";
DOMString weight = "normal";
DOMString stretch = "normal";
DOMString unicodeRange = "U+0-10FFFF";
DOMString variant = "normal";
DOMString featureSettings = "normal";
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment