diff --git a/sky/engine/bindings/scripts/dart_types.py b/sky/engine/bindings/scripts/dart_types.py index 7642b46d6d1..a47a1e29839 100644 --- a/sky/engine/bindings/scripts/dart_types.py +++ b/sky/engine/bindings/scripts/dart_types.py @@ -128,6 +128,13 @@ CPP_SPECIAL_CONVERSION_RULES = { 'TransferMode': 'SkXfermode::Mode', 'FilterQuality': 'SkFilterQuality', 'PaintingStyle': 'SkPaint::Style', + # TODO(abarth): Give these better C++ types. + 'FontStyle': 'int', + 'FontWeight': 'int', + 'TextAlign': 'int', + 'TextBaseline': 'int', + 'TextDecoration': 'int', + 'TextDecorationStyle': 'int', } @@ -381,6 +388,12 @@ DART_TO_CPP_VALUE = { 'TransferMode': pass_by_value_format('TransferMode', ''), 'FilterQuality': pass_by_value_format('FilterQuality', ''), 'PaintingStyle': pass_by_value_format('PaintingStyle', ''), + 'FontStyle': pass_by_value_format('FontStyle', ''), + 'FontWeight': pass_by_value_format('FontWeight', ''), + 'TextAlign': pass_by_value_format('TextAlign', ''), + 'TextBaseline': pass_by_value_format('TextBaseline', ''), + 'TextDecoration': pass_by_value_format('TextDecoration', ''), + 'TextDecorationStyle': pass_by_value_format('TextDecorationStyle', ''), 'MojoDataPipeConsumer': pass_by_value_format('mojo::ScopedDataPipeConsumerHandle'), } diff --git a/sky/engine/core/core.gni b/sky/engine/core/core.gni index 52ed9b3353d..e43ca63befe 100644 --- a/sky/engine/core/core.gni +++ b/sky/engine/core/core.gni @@ -625,6 +625,20 @@ sky_core_files = [ "script/dom_dart_state.cc", "script/dom_dart_state.h", "script/monitor.h", + "text/FontStyle.h", + "text/FontWeight.h", + "text/Paragraph.cpp", + "text/Paragraph.h", + "text/ParagraphBuilder.cpp", + "text/ParagraphBuilder.h", + "text/ParagraphStyle.cpp", + "text/ParagraphStyle.h", + "text/TextAlign.h", + "text/TextBaseline.h", + "text/TextDecoration.h", + "text/TextDecorationStyle.h", + "text/TextStyle.cpp", + "text/TextStyle.h", "view/EventCallback.h", "view/FrameCallback.h", "view/View.cpp", @@ -690,6 +704,10 @@ core_idl_files = get_path_info([ "painting/PictureRecorder.idl", "painting/RRect.idl", "painting/Shader.idl", + "text/Paragraph.idl", + "text/ParagraphBuilder.idl", + "text/ParagraphStyle.idl", + "text/TextStyle.idl", "view/EventCallback.idl", "view/FrameCallback.idl", "view/View.idl", @@ -712,6 +730,12 @@ core_dart_files = get_path_info([ "painting/RSTransform.dart", "painting/Size.dart", "painting/TransferMode.dart", + "text/FontStyle.dart", + "text/FontWeight.dart", + "text/TextAlign.dart", + "text/TextBaseline.dart", + "text/TextDecoration.dart", + "text/TextDecorationStyle.dart", ], "abspath") diff --git a/sky/engine/core/text/FontStyle.dart b/sky/engine/core/text/FontStyle.dart new file mode 100644 index 00000000000..679194cb434 --- /dev/null +++ b/sky/engine/core/text/FontStyle.dart @@ -0,0 +1,17 @@ +// Copyright 2015 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. + +part of dart.sky; + +/// Whether to slant the glyphs in the font +enum FontStyle { + /// Use the upright glyphs + normal, + + /// Use glyphs designed for slanting + italic, + + /// Use the upright glyphs but slant them during painting + oblique // TODO(abarth): Remove. We don't really support this value. +} diff --git a/sky/engine/core/text/FontStyle.h b/sky/engine/core/text/FontStyle.h new file mode 100644 index 00000000000..ad9d38a675b --- /dev/null +++ b/sky/engine/core/text/FontStyle.h @@ -0,0 +1,20 @@ +// Copyright 2015 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. + +#ifndef SKY_ENGINE_CORE_TEXT_FONTSTYLE_H_ +#define SKY_ENGINE_CORE_TEXT_FONTSTYLE_H_ + +#include "sky/engine/tonic/dart_converter.h" + +namespace blink { + +class FontStyle {}; + +template <> +struct DartConverter + : public DartConverterEnum {}; + +} // namespace blink + +#endif // SKY_ENGINE_CORE_TEXT_FONTSTYLE_H_ diff --git a/sky/engine/core/text/FontWeight.dart b/sky/engine/core/text/FontWeight.dart new file mode 100644 index 00000000000..1d629d7c7e1 --- /dev/null +++ b/sky/engine/core/text/FontWeight.dart @@ -0,0 +1,35 @@ +// Copyright 2015 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. + +part of dart.sky; + +/// The thickness of the glyphs used to draw the text +enum FontWeight { + /// Thin, the least thick + w100, + + /// Extra-light + w200, + + /// Light + w300, + + /// Normal / regular / plain + w400, + + /// Medium + w500, + + /// Semi-bold + w600, + + /// Bold + w700, + + /// Extra-bold + w800, + + /// Black, the most thick + w900 +} diff --git a/sky/engine/core/text/FontWeight.h b/sky/engine/core/text/FontWeight.h new file mode 100644 index 00000000000..81401652113 --- /dev/null +++ b/sky/engine/core/text/FontWeight.h @@ -0,0 +1,20 @@ +// Copyright 2015 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. + +#ifndef SKY_ENGINE_CORE_TEXT_FONTWEIGHT_H_ +#define SKY_ENGINE_CORE_TEXT_FONTWEIGHT_H_ + +#include "sky/engine/tonic/dart_converter.h" + +namespace blink { + +class FontWeight {}; + +template <> +struct DartConverter + : public DartConverterEnum {}; + +} // namespace blink + +#endif // SKY_ENGINE_CORE_TEXT_FONTWEIGHT_H_ diff --git a/sky/engine/core/text/Paragraph.cpp b/sky/engine/core/text/Paragraph.cpp new file mode 100644 index 00000000000..268eb7c30fc --- /dev/null +++ b/sky/engine/core/text/Paragraph.cpp @@ -0,0 +1,55 @@ +// Copyright 2015 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. + +#include "sky/engine/core/text/ParagraphBuilder.h" + +namespace blink { + +Paragraph::Paragraph() +{ +} + +Paragraph::~Paragraph() +{ +} + +double Paragraph::width() +{ + return 0.0; +} + +double Paragraph::height() +{ + return 0.0; +} + +double Paragraph::minIntrinsicWidth() +{ + return 0.0; +} + +double Paragraph::maxIntrinsicWidth() +{ + return 0.0; +} + +double Paragraph::alphabeticBaseline() +{ + return 0.0; +} + +double Paragraph::ideographicBaseline() +{ + return 0.0; +} + +void Paragraph::layout() +{ +} + +void Paragraph::paint(Canvas* canvas, const Offset& offset) +{ +} + +} // namespace blink diff --git a/sky/engine/core/text/Paragraph.h b/sky/engine/core/text/Paragraph.h new file mode 100644 index 00000000000..c0a4fc8430b --- /dev/null +++ b/sky/engine/core/text/Paragraph.h @@ -0,0 +1,58 @@ +// Copyright 2015 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. + +#ifndef SKY_ENGINE_CORE_TEXT_PARAGRAPH_H_ +#define SKY_ENGINE_CORE_TEXT_PARAGRAPH_H_ + +#include "sky/engine/tonic/dart_wrappable.h" +#include "sky/engine/wtf/PassRefPtr.h" +#include "sky/engine/wtf/RefCounted.h" +#include "sky/engine/core/painting/Canvas.h" +#include "sky/engine/core/painting/Offset.h" + +namespace blink { + +class Paragraph : public RefCounted, public DartWrappable { + DEFINE_WRAPPERTYPEINFO(); +public: + static PassRefPtr create() { + return adoptRef(new Paragraph()); + } + + ~Paragraph() override; + + double minWidth() const { return m_minWidth; } + void setMinWidth(double value) { m_minWidth = value; } + + double maxWidth() const { return m_maxWidth; } + void setMaxWidth(double value) { m_maxWidth = value; } + + double minHeight() const { return m_minHeight; } + void setMinHeight(double value) { m_minHeight = value; } + + double maxHeight() const { return m_maxHeight; } + void setMaxHeight(double value) { m_maxHeight = value; } + + double width(); + double height(); + double minIntrinsicWidth(); + double maxIntrinsicWidth(); + double alphabeticBaseline(); + double ideographicBaseline(); + + void layout(); + void paint(Canvas* canvas, const Offset& offset); + +private: + double m_minWidth; + double m_maxWidth; + double m_minHeight; + double m_maxHeight; + + explicit Paragraph(); +}; + +} // namespace blink + +#endif // SKY_ENGINE_CORE_TEXT_PARAGRAPH_H_ diff --git a/sky/engine/core/text/Paragraph.idl b/sky/engine/core/text/Paragraph.idl new file mode 100644 index 00000000000..34c5693e97b --- /dev/null +++ b/sky/engine/core/text/Paragraph.idl @@ -0,0 +1,22 @@ +// Copyright 2015 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. + +interface Paragraph { + // Inputs to layout + attribute double minWidth; + attribute double maxWidth; + attribute double minHeight; + attribute double maxHeight; + + // Outputs from layout + readonly attribute double width; + readonly attribute double height; + readonly attribute double minIntrinsicWidth; // Intrinsic width if all wrappable points wrap. + readonly attribute double maxIntrinsicWidth; // Intrinsic width if no wrappable points wrap. + readonly attribute double alphabeticBaseline; // Distance from top to alphabetic baseline of first line + readonly attribute double ideographicBaseline; // Distance from top to ideographic baseline of first line + + void layout(); + void paint(Canvas canvas, Offset offset); +}; diff --git a/sky/engine/core/text/ParagraphBuilder.cpp b/sky/engine/core/text/ParagraphBuilder.cpp new file mode 100644 index 00000000000..c0dc32d676f --- /dev/null +++ b/sky/engine/core/text/ParagraphBuilder.cpp @@ -0,0 +1,34 @@ +// Copyright 2015 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. + +#include "sky/engine/core/text/ParagraphBuilder.h" + +namespace blink { + +ParagraphBuilder::ParagraphBuilder() +{ +} + +ParagraphBuilder::~ParagraphBuilder() +{ +} + +void ParagraphBuilder::pushStyle(TextStyle* style) +{ +} + +void ParagraphBuilder::pop() +{ +} + +void ParagraphBuilder::addText(const String& text) +{ +} + +PassRefPtr ParagraphBuilder::build(ParagraphStyle* style) +{ + return nullptr; +} + +} // namespace blink diff --git a/sky/engine/core/text/ParagraphBuilder.h b/sky/engine/core/text/ParagraphBuilder.h new file mode 100644 index 00000000000..4eaa86f790f --- /dev/null +++ b/sky/engine/core/text/ParagraphBuilder.h @@ -0,0 +1,39 @@ +// Copyright 2015 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. + +#ifndef SKY_ENGINE_CORE_TEXT_PARAGRAPHBUILDER_H_ +#define SKY_ENGINE_CORE_TEXT_PARAGRAPHBUILDER_H_ + +#include "sky/engine/core/text/Paragraph.h" +#include "sky/engine/core/text/ParagraphStyle.h" +#include "sky/engine/core/text/TextStyle.h" +#include "sky/engine/tonic/dart_wrappable.h" +#include "sky/engine/wtf/PassRefPtr.h" +#include "sky/engine/wtf/RefCounted.h" + +namespace blink { + +class ParagraphBuilder : public RefCounted, public DartWrappable { + DEFINE_WRAPPERTYPEINFO(); +public: + static PassRefPtr create() { + return adoptRef(new ParagraphBuilder()); + } + + ~ParagraphBuilder() override; + + void pushStyle(TextStyle* style); + void pop(); + + void addText(const String& text); + + PassRefPtr build(ParagraphStyle* style); + +private: + explicit ParagraphBuilder(); +}; + +} // namespace blink + +#endif // SKY_ENGINE_CORE_TEXT_PARAGRAPHBUILDER_H_ diff --git a/sky/engine/core/text/ParagraphBuilder.idl b/sky/engine/core/text/ParagraphBuilder.idl new file mode 100644 index 00000000000..923a56e7234 --- /dev/null +++ b/sky/engine/core/text/ParagraphBuilder.idl @@ -0,0 +1,14 @@ +// Copyright 2015 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. + +[ + Constructor(), +] interface ParagraphBuilder { + void pushStyle(TextStyle style); + void pop(); + + void addText(DOMString text); + + Paragraph build(ParagraphStyle style); +}; diff --git a/sky/engine/core/text/ParagraphStyle.cpp b/sky/engine/core/text/ParagraphStyle.cpp new file mode 100644 index 00000000000..205f8d693fa --- /dev/null +++ b/sky/engine/core/text/ParagraphStyle.cpp @@ -0,0 +1,17 @@ +// Copyright 2015 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. + +#include "sky/engine/core/text/ParagraphStyle.h" + +namespace blink { + +ParagraphStyle::ParagraphStyle(int align, double lineHeight, int textBaseline) +{ +} + +ParagraphStyle::~ParagraphStyle() +{ +} + +} // namespace blink diff --git a/sky/engine/core/text/ParagraphStyle.h b/sky/engine/core/text/ParagraphStyle.h new file mode 100644 index 00000000000..b2f65e746e5 --- /dev/null +++ b/sky/engine/core/text/ParagraphStyle.h @@ -0,0 +1,31 @@ +// Copyright 2015 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. + +#ifndef SKY_ENGINE_CORE_TEXT_PARAGRAPHSTYLE_H_ +#define SKY_ENGINE_CORE_TEXT_PARAGRAPHSTYLE_H_ + +#include "sky/engine/core/text/TextAlign.h" +#include "sky/engine/core/text/TextBaseline.h" +#include "sky/engine/tonic/dart_wrappable.h" +#include "sky/engine/wtf/PassRefPtr.h" +#include "sky/engine/wtf/RefCounted.h" + +namespace blink { + +class ParagraphStyle : public RefCounted, public DartWrappable { + DEFINE_WRAPPERTYPEINFO(); +public: + static PassRefPtr create(int align = 0, double lineHeight = 0.0, int textBaseline = 0) { + return adoptRef(new ParagraphStyle(align, lineHeight, textBaseline)); + } + + ~ParagraphStyle() override; + +private: + explicit ParagraphStyle(int align, double lineHeight, int textBaseline); +}; + +} // namespace blink + +#endif // SKY_ENGINE_CORE_TEXT_PARAGRAPHSTYLE_H_ diff --git a/sky/engine/core/text/ParagraphStyle.idl b/sky/engine/core/text/ParagraphStyle.idl new file mode 100644 index 00000000000..05a1b887303 --- /dev/null +++ b/sky/engine/core/text/ParagraphStyle.idl @@ -0,0 +1,12 @@ +// Copyright 2015 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. + +[ + Constructor( + [Named] optional TextAlign align, + [Named] optional double lineHeight, + [Named] optional TextBaseline textBaseline + ) +] interface ParagraphStyle { +}; diff --git a/sky/engine/core/text/TextAlign.dart b/sky/engine/core/text/TextAlign.dart new file mode 100644 index 00000000000..66e665dde72 --- /dev/null +++ b/sky/engine/core/text/TextAlign.dart @@ -0,0 +1,17 @@ +// Copyright 2015 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. + +part of dart.sky; + +/// Whether to align text horizontally +enum TextAlign { + /// Align the text on the left edge of the container + left, + + /// Align the text on the right edge of the container + right, + + /// Align the text in the center of the container + center +} diff --git a/sky/engine/core/text/TextAlign.h b/sky/engine/core/text/TextAlign.h new file mode 100644 index 00000000000..c1edb154420 --- /dev/null +++ b/sky/engine/core/text/TextAlign.h @@ -0,0 +1,20 @@ +// Copyright 2015 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. + +#ifndef SKY_ENGINE_CORE_TEXT_TEXTALIGN_H_ +#define SKY_ENGINE_CORE_TEXT_TEXTALIGN_H_ + +#include "sky/engine/tonic/dart_converter.h" + +namespace blink { + +class TextAlign {}; + +template <> +struct DartConverter + : public DartConverterEnum {}; + +} // namespace blink + +#endif // SKY_ENGINE_CORE_TEXT_TEXTALIGN_H_ diff --git a/sky/engine/core/text/TextBaseline.dart b/sky/engine/core/text/TextBaseline.dart new file mode 100644 index 00000000000..9dd6eb6e74f --- /dev/null +++ b/sky/engine/core/text/TextBaseline.dart @@ -0,0 +1,14 @@ +// Copyright 2015 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. + +part of dart.sky; + +/// A horizontal line used for aligning text +enum TextBaseline { + // The horizontal line used to align the bottom of glyphs for alphabetic characters + alphabetic, + + // The horizontal line used to align ideographic characters + ideographic +} diff --git a/sky/engine/core/text/TextBaseline.h b/sky/engine/core/text/TextBaseline.h new file mode 100644 index 00000000000..2e8040b6429 --- /dev/null +++ b/sky/engine/core/text/TextBaseline.h @@ -0,0 +1,20 @@ +// Copyright 2015 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. + +#ifndef SKY_ENGINE_CORE_TEXT_TEXTBASELINE_H_ +#define SKY_ENGINE_CORE_TEXT_TEXTBASELINE_H_ + +#include "sky/engine/tonic/dart_converter.h" + +namespace blink { + +class TextBaseline {}; + +template <> +struct DartConverter + : public DartConverterEnum {}; + +} // namespace blink + +#endif // SKY_ENGINE_CORE_TEXT_TEXTALIGN_H_ diff --git a/sky/engine/core/text/TextDecoration.dart b/sky/engine/core/text/TextDecoration.dart new file mode 100644 index 00000000000..724c9a13871 --- /dev/null +++ b/sky/engine/core/text/TextDecoration.dart @@ -0,0 +1,20 @@ +// Copyright 2015 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. + +part of dart.sky; + +/// A linear decoration to draw near the text +enum TextDecoration { + /// Do not draw a decoration + none, + + /// Draw a line underneath each line of text + underline, + + /// Draw a line above each line of text + overline, + + /// Draw a line through each line of text + lineThrough +} diff --git a/sky/engine/core/text/TextDecoration.h b/sky/engine/core/text/TextDecoration.h new file mode 100644 index 00000000000..400983955eb --- /dev/null +++ b/sky/engine/core/text/TextDecoration.h @@ -0,0 +1,19 @@ +// Copyright 2015 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. + +#ifndef SKY_ENGINE_CORE_TEXT_TEXTDECORATION_H_ +#define SKY_ENGINE_CORE_TEXT_TEXTDECORATION_H_ + +#include "sky/engine/core/rendering/style/RenderStyleConstants.h" +#include "sky/engine/tonic/dart_converter.h" + +namespace blink { + +template <> +struct DartConverter + : public DartConverterEnum {}; + +} // namespace blink + +#endif // SKY_ENGINE_CORE_TEXT_TEXTDECORATION_H_ diff --git a/sky/engine/core/text/TextDecorationStyle.dart b/sky/engine/core/text/TextDecorationStyle.dart new file mode 100644 index 00000000000..e92a362af2c --- /dev/null +++ b/sky/engine/core/text/TextDecorationStyle.dart @@ -0,0 +1,23 @@ +// Copyright 2015 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. + +part of dart.sky; + +/// The style in which to draw a text decoration +enum TextDecorationStyle { + /// Draw a solid line + solid, + + /// Draw two lines + double, + + /// Draw a dotted line + dotted, + + /// Draw a dashed line + dashed, + + /// Draw a sinusoidal line + wavy +} diff --git a/sky/engine/core/text/TextDecorationStyle.h b/sky/engine/core/text/TextDecorationStyle.h new file mode 100644 index 00000000000..1ae553f3d6e --- /dev/null +++ b/sky/engine/core/text/TextDecorationStyle.h @@ -0,0 +1,19 @@ +// Copyright 2015 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. + +#ifndef SKY_ENGINE_CORE_TEXT_TEXTDECORATIONSTYLE_H_ +#define SKY_ENGINE_CORE_TEXT_TEXTDECORATIONSTYLE_H_ + +#include "sky/engine/core/rendering/style/RenderStyleConstants.h" +#include "sky/engine/tonic/dart_converter.h" + +namespace blink { + +template <> +struct DartConverter + : public DartConverterEnum {}; + +} // namespace blink + +#endif // SKY_ENGINE_CORE_TEXT_TEXTDECORATIONSTYLE_H_ diff --git a/sky/engine/core/text/TextStyle.cpp b/sky/engine/core/text/TextStyle.cpp new file mode 100644 index 00000000000..199fc23fe73 --- /dev/null +++ b/sky/engine/core/text/TextStyle.cpp @@ -0,0 +1,25 @@ +// Copyright 2015 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. + +#include "sky/engine/core/text/TextStyle.h" + +namespace blink { + +TextStyle::TextStyle( + SkColor color, + const String& fontFamily, + double fontSize, + int fontWeight, + int fontStyle, + const Vector& decoration, + SkColor decorationColor, + int decorationStyle) +{ +} + +TextStyle::~TextStyle() +{ +} + +} // namespace blink diff --git a/sky/engine/core/text/TextStyle.h b/sky/engine/core/text/TextStyle.h new file mode 100644 index 00000000000..b114e5b9c81 --- /dev/null +++ b/sky/engine/core/text/TextStyle.h @@ -0,0 +1,62 @@ +// Copyright 2015 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. + +#ifndef SKY_ENGINE_CORE_TEXT_TEXTSTYLE_H_ +#define SKY_ENGINE_CORE_TEXT_TEXTSTYLE_H_ + +#include "sky/engine/core/painting/CanvasColor.h" +#include "sky/engine/core/text/FontStyle.h" +#include "sky/engine/core/text/FontWeight.h" +#include "sky/engine/core/text/TextDecoration.h" +#include "sky/engine/core/text/TextDecorationStyle.h" +#include "sky/engine/tonic/dart_wrappable.h" +#include "sky/engine/wtf/PassRefPtr.h" +#include "sky/engine/wtf/RefCounted.h" +#include "sky/engine/wtf/Vector.h" + +namespace blink { + +class TextStyle : public RefCounted, public DartWrappable { + DEFINE_WRAPPERTYPEINFO(); +public: + static PassRefPtr create( + SkColor color = SK_ColorWHITE, + const String& fontFamily = nullAtom, + double fontSize = 0.0, + int fontWeight = 0, + int fontStyle = 0, + const Vector& decoration = Vector(), + SkColor decorationColor = SK_ColorWHITE, + int decorationStyle = 0 + ) { + return adoptRef(new TextStyle( + color, + fontFamily, + fontSize, + fontWeight, + fontStyle, + decoration, + decorationColor, + decorationStyle + )); + } + + ~TextStyle() override; + +private: + explicit TextStyle( + SkColor color, + const String& fontFamily, + double fontSize, + int fontWeight, + int fontStyle, + const Vector& decoration, + SkColor decorationColor, + int decorationStyle + ); +}; + +} // namespace blink + +#endif // SKY_ENGINE_CORE_TEXT_TEXTSTYLE_H_ diff --git a/sky/engine/core/text/TextStyle.idl b/sky/engine/core/text/TextStyle.idl new file mode 100644 index 00000000000..424d43272f6 --- /dev/null +++ b/sky/engine/core/text/TextStyle.idl @@ -0,0 +1,17 @@ +// Copyright 2015 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. + +[ + Constructor( + [Named] optional Color color, + [Named] optional DOMString fontFamily, + [Named] optional double fontSize, + [Named] optional FontWeight fontWeight, + [Named] optional FontStyle fontStyle, + [Named] optional sequence decoration, + [Named] optional Color decorationColor, + [Named] optional TextDecorationStyle decorationStyle + ) +] interface TextStyle { +};