Title: [282807] trunk/Source/WebCore
Revision
282807
Author
[email protected]
Date
2021-09-21 02:21:45 -0700 (Tue, 21 Sep 2021)

Log Message

Push font-palette-values data into CSSFontSelector
https://bugs.webkit.org/show_bug.cgi?id=230447

Reviewed by Antti Koivisto.

In https://bugs.webkit.org/show_bug.cgi?id=230337 I added parsing support for font-palette-values.
This patch pushes the parsed data down into CSSFontSelector, so it can be passed into the font
creation routines. The data is retained, so it's always possible to query the CSSFontSelector for
the state of the world regarding font palettes.

No new tests because there is no behavior change. This querying functionality will be hooked up
in https://bugs.webkit.org/show_bug.cgi?id=230449.

* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::buildStarted):
(WebCore::CSSFontSelector::addFontPaletteValuesRule):
(WebCore::CSSFontSelector::fontRangesForFamily):
* css/CSSFontSelector.h:
* style/RuleSet.cpp:
(WebCore::Style::RuleSet::Builder::addChildRules):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (282806 => 282807)


--- trunk/Source/WebCore/ChangeLog	2021-09-21 08:24:36 UTC (rev 282806)
+++ trunk/Source/WebCore/ChangeLog	2021-09-21 09:21:45 UTC (rev 282807)
@@ -1,5 +1,28 @@
 2021-09-21  Myles C. Maxfield  <[email protected]>
 
+        Push font-palette-values data into CSSFontSelector
+        https://bugs.webkit.org/show_bug.cgi?id=230447
+
+        Reviewed by Antti Koivisto.
+
+        In https://bugs.webkit.org/show_bug.cgi?id=230337 I added parsing support for font-palette-values.
+        This patch pushes the parsed data down into CSSFontSelector, so it can be passed into the font
+        creation routines. The data is retained, so it's always possible to query the CSSFontSelector for
+        the state of the world regarding font palettes.
+
+        No new tests because there is no behavior change. This querying functionality will be hooked up
+        in https://bugs.webkit.org/show_bug.cgi?id=230449.
+
+        * css/CSSFontSelector.cpp:
+        (WebCore::CSSFontSelector::buildStarted):
+        (WebCore::CSSFontSelector::addFontPaletteValuesRule):
+        (WebCore::CSSFontSelector::fontRangesForFamily):
+        * css/CSSFontSelector.h:
+        * style/RuleSet.cpp:
+        (WebCore::Style::RuleSet::Builder::addChildRules):
+
+2021-09-21  Myles C. Maxfield  <[email protected]>
+
         Parsing support for font-palette-values
         https://bugs.webkit.org/show_bug.cgi?id=230337
 

Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (282806 => 282807)


--- trunk/Source/WebCore/css/CSSFontSelector.cpp	2021-09-21 08:24:36 UTC (rev 282806)
+++ trunk/Source/WebCore/css/CSSFontSelector.cpp	2021-09-21 09:21:45 UTC (rev 282807)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007, 2008, 2011, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2021 Apple Inc. All rights reserved.
  *           (C) 2007, 2008 Nikolas Zimmermann <[email protected]>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -135,6 +135,8 @@
         if (face.cssConnection())
             m_cssConnectionsPossiblyToRemove.add(&face);
     }
+
+    m_paletteFamilyMap.clear();
 }
 
 void CSSFontSelector::buildCompleted()
@@ -229,6 +231,15 @@
     ++m_version;
 }
 
+void CSSFontSelector::addFontPaletteValuesRule(StyleRuleFontPaletteValues& fontPaletteValuesRule)
+{
+    m_paletteFamilyMap.ensure(std::make_pair(fontPaletteValuesRule.fontFamily(), fontPaletteValuesRule.name()), [&] () {
+        return fontPaletteValuesRule.fontPaletteValues();
+    });
+
+    ++m_version;
+}
+
 void CSSFontSelector::registerForInvalidationCallbacks(FontSelectorClient& client)
 {
     m_clients.add(&client);
@@ -320,6 +331,8 @@
             familyForLookup = *genericFamilyOptional;
     };
 
+    // FIXME https://bugs.webkit.org/show_bug.cgi?id=230449: Query for font palette data and pass it into the font creation routines.
+
     if (resolveGenericFamilyFirst)
         resolveAndAssignGenericFamily();
     Document* document = is<Document>(m_context.get()) ? &downcast<Document>(*m_context) : nullptr;

Modified: trunk/Source/WebCore/css/CSSFontSelector.h (282806 => 282807)


--- trunk/Source/WebCore/css/CSSFontSelector.h	2021-09-21 08:24:36 UTC (rev 282806)
+++ trunk/Source/WebCore/css/CSSFontSelector.h	2021-09-21 09:21:45 UTC (rev 282807)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007, 2008, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2021 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -70,6 +70,7 @@
     void buildCompleted();
 
     void addFontFaceRule(StyleRuleFontFace&, bool isInitiatingElementInUserAgentShadowTree);
+    void addFontPaletteValuesRule(StyleRuleFontPaletteValues&);
 
     FontCache& fontCache() const final { return m_fontCache.get(); }
     void fontCacheInvalidated() final;
@@ -125,6 +126,8 @@
     Ref<CSSFontFaceSet> m_cssFontFaceSet;
     HashSet<FontSelectorClient*> m_clients;
 
+    HashMap<std::pair<AtomString, AtomString>, FontPaletteValues> m_paletteFamilyMap;
+
     HashSet<RefPtr<CSSFontFace>> m_cssConnectionsPossiblyToRemove;
     HashSet<RefPtr<StyleRuleFontFace>> m_cssConnectionsEncounteredDuringBuild;
 

Modified: trunk/Source/WebCore/style/RuleSet.cpp (282806 => 282807)


--- trunk/Source/WebCore/style/RuleSet.cpp	2021-09-21 08:24:36 UTC (rev 282806)
+++ trunk/Source/WebCore/style/RuleSet.cpp	2021-09-21 09:21:45 UTC (rev 282807)
@@ -2,7 +2,7 @@
  * Copyright (C) 1999 Lars Knoll ([email protected])
  *           (C) 2004-2005 Allan Sandfeld Jensen ([email protected])
  * Copyright (C) 2006, 2007 Nicholas Shanks ([email protected])
- * Copyright (C) 2005-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2005-2021 Apple Inc. All rights reserved.
  * Copyright (C) 2007 Alexey Proskuryakov <[email protected]>
  * Copyright (C) 2007, 2008 Eric Seidel <[email protected]>
  * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
@@ -358,6 +358,14 @@
             mediaQueryCollector.didMutateResolver();
             continue;
         }
+        if (is<StyleRuleFontPaletteValues>(*rule)) {
+            if (resolver) {
+                resolver->document().fontSelector().addFontPaletteValuesRule(downcast<StyleRuleFontPaletteValues>(*rule.get()));
+                resolver->invalidateMatchedDeclarationsCache();
+            }
+            mediaQueryCollector.didMutateResolver();
+            continue;
+        }
         if (is<StyleRuleKeyframes>(*rule)) {
             if (resolver)
                 resolver->addKeyframeStyle(downcast<StyleRuleKeyframes>(*rule));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to