Chromium Code Reviews| Index: third_party/WebKit/Source/core/testing/Internals.cpp |
| diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp |
| index 6512225803bfc9d5c2817b8acd221033ec046fb7..0a3247b22c221277b9be9ccf27ffbc5314289703 100644 |
| --- a/third_party/WebKit/Source/core/testing/Internals.cpp |
| +++ b/third_party/WebKit/Source/core/testing/Internals.cpp |
| @@ -1066,14 +1066,32 @@ static bool ParseColor(const String& value, |
| return true; |
| } |
| +static WTF::Optional<CompositionMarker::Thickness> ThicknessFrom( |
| + const String& thickness) { |
| + if (EqualIgnoringASCIICase(thickness, "kThin")) |
|
yosin_UTC9
2017/05/29 05:22:08
Let's use "thin" and "thick" as MarkerTypeForm().
|
| + return CompositionMarker::Thickness::kThin; |
| + if (EqualIgnoringASCIICase(thickness, "kThick")) |
| + return CompositionMarker::Thickness::kThick; |
| + return WTF::nullopt; |
| +} |
| + |
| void Internals::addCompositionMarker(const Range* range, |
| const String& underline_color_value, |
| - bool thick, |
| + const String& thickness_value, |
|
yosin_UTC9
2017/05/29 05:22:08
Good catch! (^_^)b
|
| const String& background_color_value, |
| ExceptionState& exception_state) { |
| DCHECK(range); |
| range->OwnerDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); |
| + WTF::Optional<CompositionMarker::Thickness> thickness = |
| + ThicknessFrom(thickness_value); |
| + if (!thickness) { |
| + exception_state.ThrowDOMException( |
| + kSyntaxError, |
| + "The thickness provided ('" + thickness_value + "') is invalid."); |
| + return; |
| + } |
| + |
| Color underline_color; |
| Color background_color; |
| if (ParseColor(underline_color_value, underline_color, exception_state, |
| @@ -1081,7 +1099,8 @@ void Internals::addCompositionMarker(const Range* range, |
| ParseColor(background_color_value, background_color, exception_state, |
| "Invalid background color.")) { |
| range->OwnerDocument().Markers().AddCompositionMarker( |
| - EphemeralRange(range), underline_color, thick, background_color); |
| + EphemeralRange(range), underline_color, thickness.value(), |
| + background_color); |
| } |
| } |