Title: [187615] trunk/Source/WebCore
- Revision
- 187615
- Author
- mmaxfi...@apple.com
- Date
- 2015-07-30 16:07:09 -0700 (Thu, 30 Jul 2015)
Log Message
Clean up makeFontCascadeCacheKey()
https://bugs.webkit.org/show_bug.cgi?id=147430
Reviewed by Benjamin Poulain.
FontDescriptionKey is designed to encapsulate all the cacheable properties of a FontDescription.
However, a higher-level cache, FontCascadeCacheKey, was taking some values from FontDescriptions.
The fact that there wasn't a bug before is just a happy coincidence. This patch moves those bits
from the higher-level cache and puts them into FontDescriptionKey where they belong.
No new tests because there is no behavior change.
* platform/graphics/FontCache.h:
(WebCore::FontDescriptionKey::makeFlagKey):
* platform/graphics/FontCascade.cpp:
(WebCore::operator==):
(WebCore::makeFontSelectorFlags): Deleted.
(WebCore::makeFontCascadeCacheKey): Deleted.
(WebCore::computeFontCascadeCacheHash): Deleted.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (187614 => 187615)
--- trunk/Source/WebCore/ChangeLog 2015-07-30 22:56:20 UTC (rev 187614)
+++ trunk/Source/WebCore/ChangeLog 2015-07-30 23:07:09 UTC (rev 187615)
@@ -1,3 +1,25 @@
+2015-07-30 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ Clean up makeFontCascadeCacheKey()
+ https://bugs.webkit.org/show_bug.cgi?id=147430
+
+ Reviewed by Benjamin Poulain.
+
+ FontDescriptionKey is designed to encapsulate all the cacheable properties of a FontDescription.
+ However, a higher-level cache, FontCascadeCacheKey, was taking some values from FontDescriptions.
+ The fact that there wasn't a bug before is just a happy coincidence. This patch moves those bits
+ from the higher-level cache and puts them into FontDescriptionKey where they belong.
+
+ No new tests because there is no behavior change.
+
+ * platform/graphics/FontCache.h:
+ (WebCore::FontDescriptionKey::makeFlagKey):
+ * platform/graphics/FontCascade.cpp:
+ (WebCore::operator==):
+ (WebCore::makeFontSelectorFlags): Deleted.
+ (WebCore::makeFontCascadeCacheKey): Deleted.
+ (WebCore::computeFontCascadeCacheHash): Deleted.
+
2015-07-18 Matt Rajca <mra...@apple.com>
[Mac] Media Session: add support for more telephony interruptions
Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (187614 => 187615)
--- trunk/Source/WebCore/platform/graphics/FontCache.h 2015-07-30 22:56:20 UTC (rev 187614)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h 2015-07-30 23:07:09 UTC (rev 187615)
@@ -79,7 +79,10 @@
{ }
static unsigned makeFlagKey(const FontDescription& description)
{
- return static_cast<unsigned>(description.fontSynthesis()) << 6
+ static_assert(USCRIPT_CODE_LIMIT < 0x1000, "Script code must fit in an unsigned along with the other flags");
+ return static_cast<unsigned>(description.script()) << 9
+ | static_cast<unsigned>(description.smallCaps()) << 8
+ | static_cast<unsigned>(description.fontSynthesis()) << 6
| static_cast<unsigned>(description.widthVariant()) << 4
| static_cast<unsigned>(description.nonCJKGlyphOrientation()) << 3
| static_cast<unsigned>(description.orientation()) << 2
Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (187614 => 187615)
--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp 2015-07-30 22:56:20 UTC (rev 187614)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp 2015-07-30 23:07:09 UTC (rev 187615)
@@ -183,7 +183,6 @@
Vector<AtomicString, 3> families;
unsigned fontSelectorId;
unsigned fontSelectorVersion;
- unsigned fontSelectorFlags;
};
struct FontCascadeCacheEntry {
@@ -203,7 +202,7 @@
{
if (a.fontDescriptionKey != b.fontDescriptionKey)
return false;
- if (a.fontSelectorId != b.fontSelectorId || a.fontSelectorVersion != b.fontSelectorVersion || a.fontSelectorFlags != b.fontSelectorFlags)
+ if (a.fontSelectorId != b.fontSelectorId || a.fontSelectorVersion != b.fontSelectorVersion)
return false;
if (a.families.size() != b.families.size())
return false;
@@ -231,11 +230,6 @@
value->fonts.get().widthCache().clear();
}
-static unsigned makeFontSelectorFlags(const FontDescription& description)
-{
- return static_cast<unsigned>(description.script()) << 1 | static_cast<unsigned>(description.smallCaps());
-}
-
static FontCascadeCacheKey makeFontCascadeCacheKey(const FontDescription& description, FontSelector* fontSelector)
{
FontCascadeCacheKey key;
@@ -244,7 +238,6 @@
key.families.append(description.familyAt(i));
key.fontSelectorId = fontSelector ? fontSelector->uniqueId() : 0;
key.fontSelectorVersion = fontSelector ? fontSelector->version() : 0;
- key.fontSelectorFlags = fontSelector && fontSelector->resolvesFamilyFor(description) ? makeFontSelectorFlags(description) : 0;
return key;
}
@@ -256,7 +249,6 @@
hashCodes.uncheckedAppend(key.fontDescriptionKey.computeHash());
hashCodes.uncheckedAppend(key.fontSelectorId);
hashCodes.uncheckedAppend(key.fontSelectorVersion);
- hashCodes.uncheckedAppend(key.fontSelectorFlags);
for (unsigned i = 0; i < key.families.size(); ++i)
hashCodes.uncheckedAppend(key.families[i].impl() ? CaseFoldingHash::hash(key.families[i]) : 0);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes