Title: [193439] branches/safari-601.1.46-branch
Revision
193439
Author
timo...@apple.com
Date
2015-12-04 12:51:26 -0800 (Fri, 04 Dec 2015)

Log Message

Merge r187249. rdar://problem/23581597

Modified Paths

Added Paths

Diff

Modified: branches/safari-601.1.46-branch/LayoutTests/ChangeLog (193438 => 193439)


--- branches/safari-601.1.46-branch/LayoutTests/ChangeLog	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/LayoutTests/ChangeLog	2015-12-04 20:51:26 UTC (rev 193439)
@@ -1,5 +1,25 @@
 2015-12-04  Timothy Hatcher  <timo...@apple.com>
 
+        Merge r187249. rdar://problem/23581597
+
+    2015-07-23  Devin Rousso  <drou...@apple.com>
+
+            Web Inspector: Add a function to CSSCompletions to get a list of supported system fonts
+            https://bugs.webkit.org/show_bug.cgi?id=147009
+
+            Reviewed by Joseph Pecoraro.
+
+            Skip the get-system-fonts test until it is implemented.
+            * platform/efl/TestExpectations:
+            * platform/gtk/TestExpectations:
+            * platform/win/TestExpectations:
+
+            Added the get-system-fonts test that returns the list of system fonts.
+            * inspector/css/get-system-fonts-expected.html:
+            * inspector/css/get-system-fonts.html:
+
+2015-12-04  Timothy Hatcher  <timo...@apple.com>
+
         Merge r187211. rdar://problem/23581597
 
     2015-07-22  Joseph Pecoraro  <pecor...@apple.com>

Added: branches/safari-601.1.46-branch/LayoutTests/inspector/css/get-system-fonts-expected.txt (0 => 193439)


--- branches/safari-601.1.46-branch/LayoutTests/inspector/css/get-system-fonts-expected.txt	                        (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/inspector/css/get-system-fonts-expected.txt	2015-12-04 20:51:26 UTC (rev 193439)
@@ -0,0 +1,4 @@
+Has at least 5 fonts: true
+PASS: Includes Arial
+PASS: Includes Times
+

Added: branches/safari-601.1.46-branch/LayoutTests/inspector/css/get-system-fonts.html (0 => 193439)


--- branches/safari-601.1.46-branch/LayoutTests/inspector/css/get-system-fonts.html	                        (rev 0)
+++ branches/safari-601.1.46-branch/LayoutTests/inspector/css/get-system-fonts.html	2015-12-04 20:51:26 UTC (rev 193439)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script type="text/_javascript_" src=""
+<script>
+// Testing that we can get the fonts on the system and that the fonts contain some universal fonts (arial, times, etc).
+function test() {
+    function hasFontFamily(fontFamilies, fontFamily) {
+        return (fontFamilies.includes(fontFamily) ? "PASS: Includes " : "FAIL: Missing ") + fontFamily;
+    }
+
+    function fontFamilyNamesCallback(error, fontFamilyNames) {
+        InspectorTest.assert(!error, "Error in getting font family names.");
+
+        if (!error) {
+            InspectorTest.log("Has at least 5 fonts: " + (fontFamilyNames.length >= 5));
+            InspectorTest.log(hasFontFamily(fontFamilyNames, "Arial"));
+            InspectorTest.log(hasFontFamily(fontFamilyNames, "Times"));
+        }
+
+        InspectorTest.completeTest();
+    }
+    CSSAgent.getSupportedSystemFontFamilyNames(fontFamilyNamesCallback);
+}
+</script>
+</head>
+<body _onload_="runTest()"></body>
+</html>

Modified: branches/safari-601.1.46-branch/LayoutTests/platform/efl/TestExpectations (193438 => 193439)


--- branches/safari-601.1.46-branch/LayoutTests/platform/efl/TestExpectations	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/LayoutTests/platform/efl/TestExpectations	2015-12-04 20:51:26 UTC (rev 193439)
@@ -663,6 +663,8 @@
 
 #webkit.org/b/142158 inspector-protocol/dom/remove-multiple-nodes.html [ Crash Pass ]
 
+webkit.org/b/147018 inspector/css/get-system-fonts.html [ Skip ]
+
 #////////////////////////////////////////////////////////////////////////////////////////
 # FLAKY TESTS
 #////////////////////////////////////////////////////////////////////////////////////////

Modified: branches/safari-601.1.46-branch/LayoutTests/platform/win/TestExpectations (193438 => 193439)


--- branches/safari-601.1.46-branch/LayoutTests/platform/win/TestExpectations	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/LayoutTests/platform/win/TestExpectations	2015-12-04 20:51:26 UTC (rev 193439)
@@ -2355,6 +2355,8 @@
 inspector/css/selector-specificity.html [ Skip ]
 inspector/css/pseudo-element-matches.html [ Skip ]
 
+webkit.org/b/147017 inspector/css/get-system-fonts.html [ Skip ]
+
 # Inspector Protocol
 webkit.org/b/140510 inspector-protocol/debugger/terminate-dedicated-worker-while-paused.html [ Skip ]  # Crashing
 inspector-protocol/debugger/pause-on-assert.html [ Skip ]

Modified: branches/safari-601.1.46-branch/Source/_javascript_Core/ChangeLog (193438 => 193439)


--- branches/safari-601.1.46-branch/Source/_javascript_Core/ChangeLog	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/Source/_javascript_Core/ChangeLog	2015-12-04 20:51:26 UTC (rev 193439)
@@ -1,5 +1,18 @@
 2015-12-04  Timothy Hatcher  <timo...@apple.com>
 
+        Merge r187249. rdar://problem/23581597
+
+    2015-07-23  Devin Rousso  <drou...@apple.com>
+
+            Web Inspector: Add a function to CSSCompletions to get a list of supported system fonts
+            https://bugs.webkit.org/show_bug.cgi?id=147009
+
+            Reviewed by Joseph Pecoraro.
+
+            * inspector/protocol/CSS.json: Added getSupportedSystemFontFamilyNames function.
+
+2015-12-04  Timothy Hatcher  <timo...@apple.com>
+
         Merge r187211. rdar://problem/23581597
 
     2015-07-22  Joseph Pecoraro  <pecor...@apple.com>

Modified: branches/safari-601.1.46-branch/Source/_javascript_Core/inspector/protocol/CSS.json (193438 => 193439)


--- branches/safari-601.1.46-branch/Source/_javascript_Core/inspector/protocol/CSS.json	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/Source/_javascript_Core/inspector/protocol/CSS.json	2015-12-04 20:51:26 UTC (rev 193439)
@@ -348,6 +348,13 @@
             "description": "Returns all supported CSS property names."
         },
         {
+            "name": "getSupportedSystemFontFamilyNames",
+            "returns": [
+                { "name": "fontFamilyNames", "type": "array", "items": { "type": "string" }, "description": "Supported system font families." }
+            ],
+            "description": "Returns all supported system font family names."
+        },
+        {
             "name": "forcePseudoState",
             "parameters": [
                 { "name": "nodeId", "$ref": "DOM.NodeId", "description": "The element id for which to force the pseudo state." },

Modified: branches/safari-601.1.46-branch/Source/WebCore/ChangeLog (193438 => 193439)


--- branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/Source/WebCore/ChangeLog	2015-12-04 20:51:26 UTC (rev 193439)
@@ -1,5 +1,32 @@
 2015-12-04  Timothy Hatcher  <timo...@apple.com>
 
+        Merge r187249. rdar://problem/23581597
+
+    2015-07-23  Devin Rousso  <drou...@apple.com>
+
+            Web Inspector: Add a function to CSSCompletions to get a list of supported system fonts
+            https://bugs.webkit.org/show_bug.cgi?id=147009
+
+            Reviewed by Joseph Pecoraro.
+
+            Test: inspector/css/get-system-fonts.html
+
+            * inspector/InspectorCSSAgent.cpp:
+            (WebCore::InspectorCSSAgent::getSupportedSystemFontFamilyNames):
+            Gets the list of system fonts (implemented in each platform) and returns that list.
+            * inspector/InspectorCSSAgent.h:
+            * platform/graphics/FontCache.h:
+            * platform/graphics/freetype/FontCacheFreeType.cpp:
+            (WebCore::FontCache::systemFontFamilies):
+            * platform/graphics/ios/FontCacheIOS.mm:
+            (WebCore::FontCache::systemFontFamilies):
+            * platform/graphics/mac/FontCacheMac.mm:
+            (WebCore::FontCache::systemFontFamilies):
+            * platform/graphics/win/FontCacheWin.cpp:
+            (WebCore::FontCache::systemFontFamilies):
+
+2015-12-04  Timothy Hatcher  <timo...@apple.com>
+
         Merge r187211. rdar://problem/23581597
 
     2015-07-22  Joseph Pecoraro  <pecor...@apple.com>

Modified: branches/safari-601.1.46-branch/Source/WebCore/inspector/InspectorCSSAgent.cpp (193438 => 193439)


--- branches/safari-601.1.46-branch/Source/WebCore/inspector/InspectorCSSAgent.cpp	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/Source/WebCore/inspector/InspectorCSSAgent.cpp	2015-12-04 20:51:26 UTC (rev 193439)
@@ -36,6 +36,7 @@
 #include "ContentSecurityPolicy.h"
 #include "DOMWindow.h"
 #include "ExceptionCodePlaceholder.h"
+#include "FontCache.h"
 #include "HTMLHeadElement.h"
 #include "HTMLStyleElement.h"
 #include "InspectorDOMAgent.h"
@@ -708,6 +709,17 @@
     cssProperties = WTF::move(properties);
 }
 
+void InspectorCSSAgent::getSupportedSystemFontFamilyNames(ErrorString&, RefPtr<Inspector::Protocol::Array<String>>& fontFamilyNames)
+{
+    auto families = Inspector::Protocol::Array<String>::create();
+
+    Vector<String> systemFontFamilies = FontCache::singleton().systemFontFamilies();
+    for (const auto& familyName : systemFontFamilies)
+        families->addItem(familyName);
+
+    fontFamilyNames = WTF::move(families);
+}
+
 void InspectorCSSAgent::forcePseudoState(ErrorString& errorString, int nodeId, const InspectorArray& forcedPseudoClasses)
 {
     Element* element = m_domAgent->assertElement(errorString, nodeId);

Modified: branches/safari-601.1.46-branch/Source/WebCore/inspector/InspectorCSSAgent.h (193438 => 193439)


--- branches/safari-601.1.46-branch/Source/WebCore/inspector/InspectorCSSAgent.h	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/Source/WebCore/inspector/InspectorCSSAgent.h	2015-12-04 20:51:26 UTC (rev 193439)
@@ -119,6 +119,7 @@
     virtual void setRuleSelector(ErrorString&, const Inspector::InspectorObject& ruleId, const String& selector, RefPtr<Inspector::Protocol::CSS::CSSRule>& result) override;
     virtual void addRule(ErrorString&, int contextNodeId, const String& selector, RefPtr<Inspector::Protocol::CSS::CSSRule>& result) override;
     virtual void getSupportedCSSProperties(ErrorString&, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::CSS::CSSPropertyInfo>>& result) override;
+    virtual void getSupportedSystemFontFamilyNames(ErrorString&, RefPtr<Inspector::Protocol::Array<String>>& result) override;
     virtual void forcePseudoState(ErrorString&, int nodeId, const Inspector::InspectorArray& forcedPseudoClasses) override;
     virtual void getNamedFlowCollection(ErrorString&, int documentNodeId, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::CSS::NamedFlow>>& result) override;
 

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/FontCache.h (193438 => 193439)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/FontCache.h	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/FontCache.h	2015-12-04 20:51:26 UTC (rev 193439)
@@ -110,10 +110,9 @@
 public:
     WEBCORE_EXPORT static FontCache& singleton();
 
-    // This method is implemented by the platform.
+    // These methods are implemented by the platform.
     RefPtr<Font> systemFallbackForCharacters(const FontDescription&, const Font* originalFontData, bool isPlatformFont, const UChar* characters, unsigned length);
-
-    // Also implemented by the platform.
+    Vector<String> systemFontFamilies();
     void platformInit();
 
 #if PLATFORM(IOS)

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp (193438 => 193439)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp	2015-12-04 20:51:26 UTC (rev 193439)
@@ -98,6 +98,13 @@
     return fontForPlatformData(alternateFontData);
 }
 
+Vector<String> FontCache::systemFontFamilies()
+{
+    // FIXME: <https://webkit.org/b/147018> Web Inspector: [Freetype] Allow inspector to retrieve a list of system fonts
+    Vector<String> fontFamilies;
+    return fontFamilies;
+}
+
 Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescription)
 {
     // We want to return a fallback font here, otherwise the logic preventing FontConfig

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm (193438 => 193439)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm	2015-12-04 20:51:26 UTC (rev 193439)
@@ -462,6 +462,13 @@
     return lastResortFallbackFont(description);
 }
 
+Vector<String> FontCache::systemFontFamilies()
+{
+    // FIXME: <https://webkit.org/b/147033> Web Inspector: [iOS] Allow inspector to retrieve a list of system fonts
+    Vector<String> fontFamilies;
+    return fontFamilies;
+}
+
 RefPtr<Font> FontCache::similarFont(const FontDescription& description)
 {
     // Attempt to find an appropriate font using a match based on the presence of keywords in

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (193438 => 193439)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/FontCacheMac.mm	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/mac/FontCacheMac.mm	2015-12-04 20:51:26 UTC (rev 193439)
@@ -527,6 +527,26 @@
     return fontForPlatformData(alternateFont);
 }
 
+Vector<String> FontCache::systemFontFamilies()
+{
+    Vector<String> fontFamilies;
+    RetainPtr<CFArrayRef> availableFontFamilies = adoptCF(CTFontManagerCopyAvailableFontFamilyNames());
+    CFIndex count = CFArrayGetCount(availableFontFamilies.get());
+    for (CFIndex i = 0; i < count; ++i) {
+        CFStringRef fontName = static_cast<CFStringRef>(CFArrayGetValueAtIndex(availableFontFamilies.get(), i));
+        if (CFGetTypeID(fontName) != CFStringGetTypeID()) {
+            ASSERT_NOT_REACHED();
+            continue;
+        }
+        // We don't want to make the hidden system fonts visible and since they
+        // all begin with a period, ignore all fonts that begin with a period.
+        if (CFStringHasPrefix(fontName, CFSTR(".")))
+            continue;
+        fontFamilies.append(fontName);
+    }
+    return fontFamilies;
+}
+
 RefPtr<Font> FontCache::similarFont(const FontDescription& description)
 {
     // Attempt to find an appropriate font using a match based on 

Modified: branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/win/FontCacheWin.cpp (193438 => 193439)


--- branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/win/FontCacheWin.cpp	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/Source/WebCore/platform/graphics/win/FontCacheWin.cpp	2015-12-04 20:51:26 UTC (rev 193439)
@@ -309,6 +309,13 @@
     return fontData.release();
 }
 
+Vector<String> FontCache::systemFontFamilies()
+{
+    // FIXME: <https://webkit.org/b/147017> Web Inspector: [Win] Allow inspector to retrieve a list of system fonts
+    Vector<String> fontFamilies;
+    return fontFamilies;
+}
+
 RefPtr<Font> FontCache::fontFromDescriptionAndLogFont(const FontDescription& fontDescription, const LOGFONT& font, AtomicString& outFontFamilyName)
 {
     AtomicString familyName = String(font.lfFaceName, wcsnlen(font.lfFaceName, LF_FACESIZE));

Modified: branches/safari-601.1.46-branch/Source/WebInspectorUI/ChangeLog (193438 => 193439)


--- branches/safari-601.1.46-branch/Source/WebInspectorUI/ChangeLog	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/Source/WebInspectorUI/ChangeLog	2015-12-04 20:51:26 UTC (rev 193439)
@@ -1,5 +1,28 @@
 2015-12-04  Timothy Hatcher  <timo...@apple.com>
 
+        Merge r187249. rdar://problem/23581597
+
+    2015-07-23  Devin Rousso  <drou...@apple.com>
+
+            Web Inspector: Add a function to CSSCompletions to get a list of supported system fonts
+            https://bugs.webkit.org/show_bug.cgi?id=147009
+
+            Reviewed by Joseph Pecoraro.
+
+            * UserInterface/Base/Main.js:
+            (WebInspector.loaded):
+            (WebInspector.activateExtraDomains):
+            * UserInterface/Base/Test.js:
+            (WebInspector.loaded):
+            * UserInterface/Models/CSSCompletions.js:
+            (WebInspector.CSSCompletions.requestCSSCompletions.fontFamilyNamesCallback):
+            (WebInspector.CSSCompletions.requestCSSCompletions):
+            Now also grabs the list of system font family names and adds that list to the existing completion
+            list for both font and font-family in CSSKeywordCompletions.
+            (WebInspector.CSSCompletions.requestCSSNameCompletions): Deleted.
+
+2015-12-04  Timothy Hatcher  <timo...@apple.com>
+
         Merge r187211. rdar://problem/23581597
 
     2015-07-22  Joseph Pecoraro  <pecor...@apple.com>

Modified: branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Base/Main.js (193438 => 193439)


--- branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Base/Main.js	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Base/Main.js	2015-12-04 20:51:26 UTC (rev 193439)
@@ -90,7 +90,7 @@
         InspectorAgent.enable();
 
     // Perform one-time tasks.
-    WebInspector.CSSCompletions.requestCSSNameCompletions();
+    WebInspector.CSSCompletions.requestCSSCompletions();
     this._generateDisclosureTriangleImages();
 
     // Listen for the ProvisionalLoadStarted event before registering for events so our code gets called before any managers or sidebars.
@@ -501,7 +501,7 @@
 
     this.notifications.dispatchEventToListeners(WebInspector.Notification.ExtraDomainsActivated, {"domains": domains});
 
-    WebInspector.CSSCompletions.requestCSSNameCompletions();
+    WebInspector.CSSCompletions.requestCSSCompletions();
 
     this._updateReloadToolbarButton();
     this._updateDownloadToolbarButton();

Modified: branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Base/Test.js (193438 => 193439)


--- branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Base/Test.js	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Base/Test.js	2015-12-04 20:51:26 UTC (rev 193439)
@@ -69,7 +69,7 @@
     ConsoleAgent.enable();
 
     // Perform one-time tasks.
-    WebInspector.CSSCompletions.requestCSSNameCompletions();
+    WebInspector.CSSCompletions.requestCSSCompletions();
 
     // Global settings.
     this.showShadowDOMSetting = new WebInspector.Setting("show-shadow-dom", true);

Modified: branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js (193438 => 193439)


--- branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js	2015-12-04 20:51:12 UTC (rev 193438)
+++ branches/safari-601.1.46-branch/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js	2015-12-04 20:51:26 UTC (rev 193439)
@@ -76,7 +76,7 @@
 
     // Static
 
-    static requestCSSNameCompletions()
+    static requestCSSCompletions()
     {
         if (WebInspector.CSSCompletions.cssNameCompletions)
             return;
@@ -158,8 +158,21 @@
             updateCodeMirrorCSSMode("text/x-scss");
         }
 
-        if (window.CSSAgent)
+        function fontFamilyNamesCallback(error, fontFamilyNames)
+        {
+            if (error)
+                return;
+
+            WebInspector.CSSKeywordCompletions.addPropertyCompletionValues("font-family", fontFamilyNames);
+            WebInspector.CSSKeywordCompletions.addPropertyCompletionValues("font", fontFamilyNames);
+        }
+
+        if (window.CSSAgent) {
             CSSAgent.getSupportedCSSProperties(propertyNamesCallback);
+
+            if (CSSAgent.getSupportedSystemFontFamilyNames)
+                CSSAgent.getSupportedSystemFontFamilyNames(fontFamilyNamesCallback);
+        }
     }
 
     // Public
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to