-
-
Notifications
You must be signed in to change notification settings - Fork 95
Complete remaining standards roadmap slices #539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
40eff26
Improve mixed-script text rendering
wieslawsoltes d37add6
Load W3C document webfonts
wieslawsoltes 0367624
Add deterministic system colors
wieslawsoltes 5849de8
Clarify animateColor semantics
wieslawsoltes 4dc1bcb
Cover recursive resource policies
wieslawsoltes 1db9c22
Promote W3C standards rows
wieslawsoltes 50b5445
Split remaining standards roadmap
wieslawsoltes dc29916
Refresh W3C Chrome references
wieslawsoltes fb7ec23
Scope document font providers
wieslawsoltes 7a4ecd4
Make WOFF font tests platform neutral
wieslawsoltes f315eb3
Fix document font fallback handling
wieslawsoltes e73c8e2
Load document fonts from stylesheets
wieslawsoltes 8480146
Avoid double RTL fallback span ordering
wieslawsoltes a558b49
Respect media for stylesheet font faces
wieslawsoltes 0ca5767
Allow data URI font format sniffing
wieslawsoltes 56cc739
Fix baseline scan and system color keyword
wieslawsoltes e6c7877
Preserve percent encoded data font bytes
wieslawsoltes bb8d48e
Preserve document font run family
wieslawsoltes 1a9d217
Narrow document font run fallback
wieslawsoltes da9896e
Fix run font fallback target build
wieslawsoltes 44f6a65
Scope system colors during animation
wieslawsoltes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| // Copyright (c) Wiesław Šoltés. All rights reserved. | ||
| // Licensed under the MIT license. See LICENSE file in the project root for details. | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Drawing; | ||
| using System.Threading; | ||
|
|
||
| namespace Svg | ||
| { | ||
| public interface ISvgSystemColorProvider | ||
| { | ||
| bool TryGetColor(string name, out Color color); | ||
| } | ||
|
|
||
| public sealed class SvgDictionarySystemColorProvider : ISvgSystemColorProvider | ||
| { | ||
| private readonly IReadOnlyDictionary<string, Color> _colors; | ||
|
|
||
| public SvgDictionarySystemColorProvider(IDictionary<string, Color> colors) | ||
| { | ||
| if (colors == null) | ||
| { | ||
| throw new ArgumentNullException(nameof(colors)); | ||
| } | ||
|
|
||
| _colors = new Dictionary<string, Color>(colors, StringComparer.OrdinalIgnoreCase); | ||
| } | ||
|
|
||
| public bool TryGetColor(string name, out Color color) | ||
| { | ||
| if (name == null) | ||
| { | ||
| color = Color.Empty; | ||
| return false; | ||
| } | ||
|
|
||
| return _colors.TryGetValue(name.Trim(), out color); | ||
| } | ||
| } | ||
|
|
||
| public sealed class SvgFixedSystemColorProvider : ISvgSystemColorProvider | ||
| { | ||
| public static SvgFixedSystemColorProvider Instance { get; } = new SvgFixedSystemColorProvider(); | ||
|
|
||
| private static readonly IReadOnlyDictionary<string, Color> s_colors = new Dictionary<string, Color>(StringComparer.OrdinalIgnoreCase) | ||
| { | ||
| ["ActiveBorder"] = FromRgb(0xD4, 0xD0, 0xC8), | ||
| ["ActiveCaption"] = FromRgb(0x0A, 0x24, 0x6A), | ||
| ["AppWorkspace"] = FromRgb(0x80, 0x80, 0x80), | ||
| ["Background"] = FromRgb(0x3A, 0x6E, 0xA5), | ||
| ["ButtonFace"] = FromRgb(0xD4, 0xD0, 0xC8), | ||
| ["ButtonHighlight"] = FromRgb(0xFF, 0xFF, 0xFF), | ||
| ["ButtonShadow"] = FromRgb(0x80, 0x80, 0x80), | ||
| ["ButtonText"] = FromRgb(0x00, 0x00, 0x00), | ||
| ["CaptionText"] = FromRgb(0xFF, 0xFF, 0xFF), | ||
| ["GrayText"] = FromRgb(0x80, 0x80, 0x80), | ||
| ["Highlight"] = FromRgb(0x0A, 0x24, 0x6A), | ||
| ["HighlightText"] = FromRgb(0xFF, 0xFF, 0xFF), | ||
| ["InactiveBorder"] = FromRgb(0xD4, 0xD0, 0xC8), | ||
| ["InactiveCaption"] = FromRgb(0x80, 0x80, 0x80), | ||
| ["InactiveCaptionText"] = FromRgb(0xD4, 0xD0, 0xC8), | ||
| ["InfoBackground"] = FromRgb(0xFF, 0xFF, 0xE1), | ||
| ["InfoText"] = FromRgb(0x00, 0x00, 0x00), | ||
| ["Menu"] = FromRgb(0xD4, 0xD0, 0xC8), | ||
| ["MenuText"] = FromRgb(0x00, 0x00, 0x00), | ||
| ["Scrollbar"] = FromRgb(0xD4, 0xD0, 0xC8), | ||
| ["ThreeDDarkShadow"] = FromRgb(0x40, 0x40, 0x40), | ||
| ["ThreeDFace"] = FromRgb(0xD4, 0xD0, 0xC8), | ||
| ["ThreeDHighlight"] = FromRgb(0xE3, 0xE3, 0xE3), | ||
| ["ThreeDLightShadow"] = FromRgb(0xFF, 0xFF, 0xFF), | ||
|
wieslawsoltes marked this conversation as resolved.
|
||
| ["ThreeDShadow"] = FromRgb(0x80, 0x80, 0x80), | ||
| ["Window"] = FromRgb(0xFF, 0xFF, 0xFF), | ||
| ["WindowFrame"] = FromRgb(0x00, 0x00, 0x00), | ||
| ["WindowText"] = FromRgb(0x00, 0x00, 0x00) | ||
| }; | ||
|
|
||
| private SvgFixedSystemColorProvider() | ||
| { | ||
| } | ||
|
|
||
| public bool TryGetColor(string name, out Color color) | ||
| { | ||
| if (name == null) | ||
| { | ||
| color = Color.Empty; | ||
| return false; | ||
| } | ||
|
|
||
| return s_colors.TryGetValue(name.Trim(), out color); | ||
| } | ||
|
|
||
| private static Color FromRgb(int red, int green, int blue) | ||
| => Color.FromArgb(255, red, green, blue); | ||
| } | ||
|
|
||
| public static class SvgSystemColorResolver | ||
| { | ||
| private static readonly AsyncLocal<ISvgSystemColorProvider> s_scopedProvider = new AsyncLocal<ISvgSystemColorProvider>(); | ||
| private static ISvgSystemColorProvider s_defaultProvider = SvgFixedSystemColorProvider.Instance; | ||
|
|
||
| public static ISvgSystemColorProvider DefaultProvider | ||
| { | ||
| get { return s_defaultProvider; } | ||
| set { s_defaultProvider = value ?? throw new ArgumentNullException(nameof(value)); } | ||
| } | ||
|
|
||
| public static bool TryGetColor(string name, out Color color) | ||
| { | ||
| var provider = s_scopedProvider.Value ?? s_defaultProvider; | ||
| return provider.TryGetColor(name, out color); | ||
| } | ||
|
|
||
| public static IDisposable PushProvider(ISvgSystemColorProvider provider) | ||
| { | ||
| var previous = s_scopedProvider.Value; | ||
| s_scopedProvider.Value = provider; | ||
| return new Scope(previous); | ||
| } | ||
|
|
||
| private sealed class Scope : IDisposable | ||
| { | ||
| private readonly ISvgSystemColorProvider _previous; | ||
| private bool _disposed; | ||
|
|
||
| public Scope(ISvgSystemColorProvider previous) | ||
| { | ||
| _previous = previous; | ||
| } | ||
|
|
||
| public void Dispose() | ||
| { | ||
| if (_disposed) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| s_scopedProvider.Value = _previous; | ||
| _disposed = true; | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.