Title: [176789] trunk/Source/WebCore
- Revision
- 176789
- Author
- [email protected]
- Date
- 2014-12-04 03:50:26 -0800 (Thu, 04 Dec 2014)
Log Message
Remove isSpecifiedFont boolean from FontDescription
https://bugs.webkit.org/show_bug.cgi?id=139233
Reviewed by Andreas Kling.
It is barely used.
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyInheritFontFamily):
(WebCore::StyleBuilderCustom::applyValueFontFamily):
* platform/graphics/FontDescription.cpp:
(WebCore::genericFamiliesSet):
(WebCore::FontDescription::hasGenericFirstFamily):
Add a function to test for generic families.
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::FontDescription):
(WebCore::FontDescription::setTextRenderingMode):
(WebCore::FontDescription::operator==):
(WebCore::FontDescription::isSpecifiedFont): Deleted.
(WebCore::FontDescription::setIsSpecifiedFont): Deleted.
* rendering/RenderText.cpp:
(WebCore::RenderText::computeUseBackslashAsYenSymbol):
This is the only client.
Figure out the equivalent information dynamically if needed.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (176788 => 176789)
--- trunk/Source/WebCore/ChangeLog 2014-12-04 10:18:31 UTC (rev 176788)
+++ trunk/Source/WebCore/ChangeLog 2014-12-04 11:50:26 UTC (rev 176789)
@@ -1,3 +1,33 @@
+2014-12-03 Antti Koivisto <[email protected]>
+
+ Remove isSpecifiedFont boolean from FontDescription
+ https://bugs.webkit.org/show_bug.cgi?id=139233
+
+ Reviewed by Andreas Kling.
+
+ It is barely used.
+
+ * css/StyleBuilderCustom.h:
+ (WebCore::StyleBuilderCustom::applyInheritFontFamily):
+ (WebCore::StyleBuilderCustom::applyValueFontFamily):
+ * platform/graphics/FontDescription.cpp:
+ (WebCore::genericFamiliesSet):
+ (WebCore::FontDescription::hasGenericFirstFamily):
+
+ Add a function to test for generic families.
+
+ * platform/graphics/FontDescription.h:
+ (WebCore::FontDescription::FontDescription):
+ (WebCore::FontDescription::setTextRenderingMode):
+ (WebCore::FontDescription::operator==):
+ (WebCore::FontDescription::isSpecifiedFont): Deleted.
+ (WebCore::FontDescription::setIsSpecifiedFont): Deleted.
+ * rendering/RenderText.cpp:
+ (WebCore::RenderText::computeUseBackslashAsYenSymbol):
+
+ This is the only client.
+ Figure out the equivalent information dynamically if needed.
+
2014-12-03 Joonghun Park <[email protected]>
Use std::unique_ptr instead of PassOwnPtr|OwnPtr for Pasteboard
Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (176788 => 176789)
--- trunk/Source/WebCore/css/StyleBuilderCustom.h 2014-12-04 10:18:31 UTC (rev 176788)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h 2014-12-04 11:50:26 UTC (rev 176789)
@@ -911,7 +911,6 @@
FontDescription parentFontDescription = styleResolver.parentStyle()->fontDescription();
fontDescription.setFamilies(parentFontDescription.families());
- fontDescription.setIsSpecifiedFont(parentFontDescription.isSpecifiedFont());
styleResolver.setFontDescription(fontDescription);
}
@@ -929,7 +928,6 @@
for (auto& item : valueList) {
auto& contentValue = downcast<CSSPrimitiveValue>(item.get());
AtomicString family;
- bool isGenericFamily = false;
if (contentValue.isString())
family = contentValue.getStringValue();
else {
@@ -940,37 +938,28 @@
break;
case CSSValueSerif:
family = serifFamily;
- isGenericFamily = true;
break;
case CSSValueSansSerif:
family = sansSerifFamily;
- isGenericFamily = true;
break;
case CSSValueCursive:
family = cursiveFamily;
- isGenericFamily = true;
break;
case CSSValueFantasy:
family = fantasyFamily;
- isGenericFamily = true;
break;
case CSSValueMonospace:
family = monospaceFamily;
- isGenericFamily = true;
break;
case CSSValueWebkitPictograph:
family = pictographFamily;
- isGenericFamily = true;
break;
default:
break;
}
}
-
if (family.isEmpty())
continue;
- if (families.isEmpty())
- fontDescription.setIsSpecifiedFont(!isGenericFamily);
families.uncheckedAppend(family);
}
Modified: trunk/Source/WebCore/platform/graphics/FontDescription.cpp (176788 => 176789)
--- trunk/Source/WebCore/platform/graphics/FontDescription.cpp 2014-12-04 10:18:31 UTC (rev 176788)
+++ trunk/Source/WebCore/platform/graphics/FontDescription.cpp 2014-12-04 11:50:26 UTC (rev 176789)
@@ -30,6 +30,10 @@
#include "config.h"
#include "FontDescription.h"
+#include <wtf/HashSet.h>
+#include <wtf/NeverDestroyed.h>
+#include <wtf/text/AtomicStringHash.h>
+
namespace WebCore {
struct SameSizeAsFontDescription {
@@ -101,6 +105,29 @@
return normalDescription;
}
+static const HashSet<AtomicString>& genericFamiliesSet()
+{
+ static NeverDestroyed<HashSet<AtomicString>> set;
+ if (set.get().isEmpty()) {
+ set.get().add(cursiveFamily);
+ set.get().add(fantasyFamily);
+ set.get().add(monospaceFamily);
+ set.get().add(pictographFamily);
+ set.get().add(sansSerifFamily);
+ set.get().add(serifFamily);
+ set.get().add(standardFamily);
+ }
+ return set.get();
+}
+
+bool FontDescription::hasGenericFirstFamily() const
+{
+ auto& family = firstFamily();
+ if (family.isNull())
+ return false;
+ return genericFamiliesSet().contains(family);
+}
+
#if ENABLE(IOS_TEXT_AUTOSIZING)
bool FontDescription::familiesEqualForTextAutoSizing(const FontDescription& other) const
{
Modified: trunk/Source/WebCore/platform/graphics/FontDescription.h (176788 => 176789)
--- trunk/Source/WebCore/platform/graphics/FontDescription.h 2014-12-04 10:18:31 UTC (rev 176788)
+++ trunk/Source/WebCore/platform/graphics/FontDescription.h 2014-12-04 11:50:26 UTC (rev 176789)
@@ -93,7 +93,6 @@
, m_keywordSize(0)
, m_fontSmoothing(AutoSmoothing)
, m_textRendering(AutoTextRendering)
- , m_isSpecifiedFont(false)
, m_script(USCRIPT_COMMON)
{
}
@@ -127,9 +126,9 @@
FontSmoothingMode fontSmoothing() const { return static_cast<FontSmoothingMode>(m_fontSmoothing); }
TextRenderingMode textRenderingMode() const { return static_cast<TextRenderingMode>(m_textRendering); }
UScriptCode script() const { return static_cast<UScriptCode>(m_script); }
+ bool hasGenericFirstFamily() const;
FontTraitsMask traitsMask() const;
- bool isSpecifiedFont() const { return m_isSpecifiedFont; }
FontOrientation orientation() const { return static_cast<FontOrientation>(m_orientation); }
NonCJKGlyphOrientation nonCJKGlyphOrientation() const { return static_cast<NonCJKGlyphOrientation>(m_nonCJKGlyphOrientation); }
FontWidthVariant widthVariant() const { return static_cast<FontWidthVariant>(m_widthVariant); }
@@ -156,7 +155,6 @@
void setKeywordSize(unsigned s) { m_keywordSize = s; }
void setFontSmoothing(FontSmoothingMode smoothing) { m_fontSmoothing = smoothing; }
void setTextRenderingMode(TextRenderingMode rendering) { m_textRendering = rendering; }
- void setIsSpecifiedFont(bool isSpecifiedFont) { m_isSpecifiedFont = isSpecifiedFont; }
void setOrientation(FontOrientation orientation) { m_orientation = orientation; }
void setNonCJKGlyphOrientation(NonCJKGlyphOrientation orientation) { m_nonCJKGlyphOrientation = orientation; }
void setWidthVariant(FontWidthVariant widthVariant) { m_widthVariant = widthVariant; }
@@ -209,7 +207,6 @@
unsigned m_fontSmoothing : 2; // FontSmoothingMode
unsigned m_textRendering : 2; // TextRenderingMode
- unsigned m_isSpecifiedFont : 1; // True if a web page specifies a non-generic font family as the first font family.
unsigned m_script : 7; // Used to help choose an appropriate font for generic font families.
};
@@ -231,7 +228,6 @@
&& m_keywordSize == other.m_keywordSize
&& m_fontSmoothing == other.m_fontSmoothing
&& m_textRendering == other.m_textRendering
- && m_isSpecifiedFont == other.m_isSpecifiedFont
&& m_orientation == other.m_orientation
&& m_nonCJKGlyphOrientation == other.m_nonCJKGlyphOrientation
&& m_widthVariant == other.m_widthVariant
Modified: trunk/Source/WebCore/rendering/RenderText.cpp (176788 => 176789)
--- trunk/Source/WebCore/rendering/RenderText.cpp 2014-12-04 10:18:31 UTC (rev 176788)
+++ trunk/Source/WebCore/rendering/RenderText.cpp 2014-12-04 11:50:26 UTC (rev 176789)
@@ -213,15 +213,11 @@
bool RenderText::computeUseBackslashAsYenSymbol() const
{
const RenderStyle& style = this->style();
- const FontDescription& fontDescription = style.font().fontDescription();
if (style.font().useBackslashAsYenSymbol())
return true;
- if (fontDescription.isSpecifiedFont())
+ if (!document().decoder() || document().decoder()->encoding().backslashAsCurrencySymbol() == '\\')
return false;
- const TextEncoding* encoding = document().decoder() ? &document().decoder()->encoding() : 0;
- if (encoding && encoding->backslashAsCurrencySymbol() != '\\')
- return true;
- return false;
+ return style.font().fontDescription().hasGenericFirstFamily() || style.font().primaryFontDataIsSystemFont();
}
void RenderText::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes