Diff
Modified: trunk/Source/WebCore/ChangeLog (191870 => 191871)
--- trunk/Source/WebCore/ChangeLog 2015-11-02 00:48:03 UTC (rev 191870)
+++ trunk/Source/WebCore/ChangeLog 2015-11-02 00:52:46 UTC (rev 191871)
@@ -1,3 +1,47 @@
+2015-11-01 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ Clean up some CSS & Font code
+ https://bugs.webkit.org/show_bug.cgi?id=150767
+
+ Reviewed by Darin Adler.
+
+ This patch migrates some CSS code to use references instead of pointers.
+ It also migrates some Font code to use RefPtr instead of PassRefPtr.
+
+ No new tests because there is no behavior change.
+
+ * css/CSSDefaultStyleSheets.cpp:
+ (WebCore::CSSDefaultStyleSheets::loadFullDefaultStyle):
+ (WebCore::CSSDefaultStyleSheets::loadSimpleDefaultStyle):
+ (WebCore::CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement):
+ * css/CSSFontSelector.cpp:
+ (WebCore::createFontFace):
+ (WebCore::CSSFontSelector::addFontFaceRule):
+ * css/CSSFontSelector.h:
+ * css/DocumentRuleSets.cpp:
+ (WebCore::DocumentRuleSets::initUserStyle):
+ (WebCore::DocumentRuleSets::collectRulesFromUserStyleSheets):
+ (WebCore::DocumentRuleSets::appendAuthorStyleSheets):
+ * css/RuleSet.cpp:
+ (WebCore::RuleSet::addChildRules):
+ (WebCore::RuleSet::addRulesFromSheet):
+ * css/RuleSet.h:
+ * css/StyleInvalidationAnalysis.cpp:
+ (WebCore::StyleInvalidationAnalysis::StyleInvalidationAnalysis):
+ * platform/graphics/Font.cpp:
+ (WebCore::Font::verticalRightOrientationFont):
+ (WebCore::Font::uprightOrientationFont):
+ (WebCore::Font::smallCapsFont):
+ (WebCore::Font::emphasisMarkFont):
+ (WebCore::Font::brokenIdeographFont):
+ (WebCore::Font::nonSyntheticItalicFont):
+ (WebCore::Font::createScaledFont):
+ * platform/graphics/Font.h:
+ (WebCore::Font::variantFont):
+ * platform/graphics/cocoa/FontCocoa.mm:
+ (WebCore::Font::platformCreateScaledFont):
+ * svg/SVGFontFaceElement.h:
+
2015-11-01 Darin Adler <da...@apple.com>
Remove some dead and unneeded code (ScrollbarThemeSafari, RenderThemeSafari, OPENCL, a little color space logic)
Modified: trunk/Source/WebCore/css/CSSDefaultStyleSheets.cpp (191870 => 191871)
--- trunk/Source/WebCore/css/CSSDefaultStyleSheets.cpp 2015-11-02 00:48:03 UTC (rev 191870)
+++ trunk/Source/WebCore/css/CSSDefaultStyleSheets.cpp 2015-11-02 00:52:46 UTC (rev 191871)
@@ -127,13 +127,13 @@
// Strict-mode rules.
String defaultRules = String(htmlUserAgentStyleSheet, sizeof(htmlUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraDefaultStyleSheet();
defaultStyleSheet = parseUASheet(defaultRules);
- defaultStyle->addRulesFromSheet(defaultStyleSheet, screenEval());
- defaultPrintStyle->addRulesFromSheet(defaultStyleSheet, printEval());
+ defaultStyle->addRulesFromSheet(*defaultStyleSheet, screenEval());
+ defaultPrintStyle->addRulesFromSheet(*defaultStyleSheet, printEval());
// Quirks-mode rules.
String quirksRules = String(quirksUserAgentStyleSheet, sizeof(quirksUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraQuirksStyleSheet();
quirksStyleSheet = parseUASheet(quirksRules);
- defaultQuirksStyle->addRulesFromSheet(quirksStyleSheet, screenEval());
+ defaultQuirksStyle->addRulesFromSheet(*quirksStyleSheet, screenEval());
}
void CSSDefaultStyleSheets::loadSimpleDefaultStyle()
@@ -147,7 +147,7 @@
defaultQuirksStyle = std::make_unique<RuleSet>().release();
simpleDefaultStyleSheet = parseUASheet(simpleUserAgentStyleSheet, strlen(simpleUserAgentStyleSheet));
- defaultStyle->addRulesFromSheet(simpleDefaultStyleSheet, screenEval());
+ defaultStyle->addRulesFromSheet(*simpleDefaultStyleSheet, screenEval());
// No need to initialize quirks sheet yet as there are no quirk rules for elements allowed in simple default style.
}
@@ -166,7 +166,7 @@
if (plugInsRules.isEmpty())
plugInsRules = String(plugInsUserAgentStyleSheet, sizeof(plugInsUserAgentStyleSheet));
plugInsStyleSheet = parseUASheet(plugInsRules);
- defaultStyle->addRulesFromSheet(plugInsStyleSheet, screenEval());
+ defaultStyle->addRulesFromSheet(*plugInsStyleSheet, screenEval());
changedDefaultStyle = true;
}
}
@@ -177,8 +177,8 @@
if (mediaRules.isEmpty())
mediaRules = String(mediaControlsUserAgentStyleSheet, sizeof(mediaControlsUserAgentStyleSheet)) + RenderTheme::themeForPage(element.document().page())->extraMediaControlsStyleSheet();
mediaControlsStyleSheet = parseUASheet(mediaRules);
- defaultStyle->addRulesFromSheet(mediaControlsStyleSheet, screenEval());
- defaultPrintStyle->addRulesFromSheet(mediaControlsStyleSheet, printEval());
+ defaultStyle->addRulesFromSheet(*mediaControlsStyleSheet, screenEval());
+ defaultPrintStyle->addRulesFromSheet(*mediaControlsStyleSheet, printEval());
changedDefaultStyle = true;
}
}
@@ -188,8 +188,8 @@
if (!imageControlsStyleSheet) {
String imageControlsRules = RenderTheme::themeForPage(element.document().page())->imageControlsStyleSheet();
imageControlsStyleSheet = parseUASheet(imageControlsRules);
- defaultStyle->addRulesFromSheet(imageControlsStyleSheet, screenEval());
- defaultPrintStyle->addRulesFromSheet(imageControlsStyleSheet, printEval());
+ defaultStyle->addRulesFromSheet(*imageControlsStyleSheet, screenEval());
+ defaultPrintStyle->addRulesFromSheet(*imageControlsStyleSheet, printEval());
changedDefaultStyle = true;
}
}
@@ -198,8 +198,8 @@
if (!svgStyleSheet) {
// SVG rules.
svgStyleSheet = parseUASheet(svgUserAgentStyleSheet, sizeof(svgUserAgentStyleSheet));
- defaultStyle->addRulesFromSheet(svgStyleSheet, screenEval());
- defaultPrintStyle->addRulesFromSheet(svgStyleSheet, printEval());
+ defaultStyle->addRulesFromSheet(*svgStyleSheet, screenEval());
+ defaultPrintStyle->addRulesFromSheet(*svgStyleSheet, printEval());
changedDefaultStyle = true;
}
}
@@ -208,8 +208,8 @@
if (!mathMLStyleSheet) {
// MathML rules.
mathMLStyleSheet = parseUASheet(mathmlUserAgentStyleSheet, sizeof(mathmlUserAgentStyleSheet));
- defaultStyle->addRulesFromSheet(mathMLStyleSheet, screenEval());
- defaultPrintStyle->addRulesFromSheet(mathMLStyleSheet, printEval());
+ defaultStyle->addRulesFromSheet(*mathMLStyleSheet, screenEval());
+ defaultPrintStyle->addRulesFromSheet(*mathMLStyleSheet, printEval());
changedDefaultStyle = true;
}
}
@@ -219,8 +219,8 @@
if (!fullscreenStyleSheet && element.document().webkitIsFullScreen()) {
String fullscreenRules = String(fullscreenUserAgentStyleSheet, sizeof(fullscreenUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraFullScreenStyleSheet();
fullscreenStyleSheet = parseUASheet(fullscreenRules);
- defaultStyle->addRulesFromSheet(fullscreenStyleSheet, screenEval());
- defaultQuirksStyle->addRulesFromSheet(fullscreenStyleSheet, screenEval());
+ defaultStyle->addRulesFromSheet(*fullscreenStyleSheet, screenEval());
+ defaultQuirksStyle->addRulesFromSheet(*fullscreenStyleSheet, screenEval());
changedDefaultStyle = true;
}
#endif // ENABLE(FULLSCREEN_API)
Modified: trunk/Source/WebCore/css/CSSFontSelector.cpp (191870 => 191871)
--- trunk/Source/WebCore/css/CSSFontSelector.cpp 2015-11-02 00:48:03 UTC (rev 191870)
+++ trunk/Source/WebCore/css/CSSFontSelector.cpp 2015-11-02 00:52:46 UTC (rev 191871)
@@ -178,13 +178,13 @@
return static_cast<FontTraitsMask>(traitsMask);
}
-static Ref<CSSFontFace> createFontFace(CSSValueList& srcList, FontTraitsMask traitsMask, Document* document, const StyleRuleFontFace* fontFaceRule, bool isInitiatingElementInUserAgentShadowTree)
+static Ref<CSSFontFace> createFontFace(CSSValueList& srcList, FontTraitsMask traitsMask, Document* document, const StyleRuleFontFace& fontFaceRule, bool isInitiatingElementInUserAgentShadowTree)
{
RefPtr<CSSFontFaceRule> rule;
#if ENABLE(FONT_LOAD_EVENTS)
// FIXME: https://bugs.webkit.org/show_bug.cgi?id=112116 - This CSSFontFaceRule has no parent.
if (RuntimeEnabledFeatures::sharedFeatures().fontLoadEventsEnabled())
- rule = static_pointer_cast<CSSFontFaceRule>(fontFaceRule->createCSSOMWrapper());
+ rule = static_pointer_cast<CSSFontFaceRule>(fontFaceRule.createCSSOMWrapper());
#else
UNUSED_PARAM(fontFaceRule);
#endif
@@ -203,7 +203,7 @@
foundSVGFont = item.isSVGFontFaceSrc() || item.svgFontFaceElement();
#endif
if (!item.isLocal()) {
- Settings* settings = document ? document->frame() ? &document->frame()->settings() : 0 : 0;
+ Settings* settings = document ? document->settings() : nullptr;
bool allowDownloading = foundSVGFont || (settings && settings->downloadableBinaryFontsEnabled());
if (allowDownloading && item.isSupportedFormat() && document) {
CachedFont* cachedFont = item.cachedFont(document, foundSVGFont, isInitiatingElementInUserAgentShadowTree);
@@ -277,9 +277,9 @@
return result;
}
-void CSSFontSelector::addFontFaceRule(const StyleRuleFontFace* fontFaceRule, bool isInitiatingElementInUserAgentShadowTree)
+void CSSFontSelector::addFontFaceRule(const StyleRuleFontFace& fontFaceRule, bool isInitiatingElementInUserAgentShadowTree)
{
- const StyleProperties& style = fontFaceRule->properties();
+ const StyleProperties& style = fontFaceRule.properties();
RefPtr<CSSValue> fontFamily = style.getPropertyCSSValue(CSSPropertyFontFamily);
RefPtr<CSSValue> src = ""
RefPtr<CSSValue> unicodeRange = style.getPropertyCSSValue(CSSPropertyUnicodeRange);
Modified: trunk/Source/WebCore/css/CSSFontSelector.h (191870 => 191871)
--- trunk/Source/WebCore/css/CSSFontSelector.h 2015-11-02 00:48:03 UTC (rev 191870)
+++ trunk/Source/WebCore/css/CSSFontSelector.h 2015-11-02 00:52:46 UTC (rev 191871)
@@ -66,7 +66,7 @@
void clearDocument();
- void addFontFaceRule(const StyleRuleFontFace*, bool isInitiatingElementInUserAgentShadowTree);
+ void addFontFaceRule(const StyleRuleFontFace&, bool isInitiatingElementInUserAgentShadowTree);
void fontLoaded();
virtual void fontCacheInvalidated() override;
Modified: trunk/Source/WebCore/css/DocumentRuleSets.cpp (191870 => 191871)
--- trunk/Source/WebCore/css/DocumentRuleSets.cpp 2015-11-02 00:48:03 UTC (rev 191870)
+++ trunk/Source/WebCore/css/DocumentRuleSets.cpp 2015-11-02 00:52:46 UTC (rev 191871)
@@ -50,7 +50,7 @@
{
auto tempUserStyle = std::make_unique<RuleSet>();
if (CSSStyleSheet* pageUserSheet = extensionStyleSheets.pageUserSheet())
- tempUserStyle->addRulesFromSheet(&pageUserSheet->contents(), medium, &resolver);
+ tempUserStyle->addRulesFromSheet(pageUserSheet->contents(), medium, &resolver);
collectRulesFromUserStyleSheets(extensionStyleSheets.injectedUserStyleSheets(), *tempUserStyle, medium, resolver);
collectRulesFromUserStyleSheets(extensionStyleSheets.documentUserStyleSheets(), *tempUserStyle, medium, resolver);
if (tempUserStyle->ruleCount() > 0 || tempUserStyle->pageRules().size() > 0)
@@ -61,7 +61,7 @@
{
for (unsigned i = 0; i < userSheets.size(); ++i) {
ASSERT(userSheets[i]->contents().isUserStyleSheet());
- userStyle.addRulesFromSheet(&userSheets[i]->contents(), medium, &resolver);
+ userStyle.addRulesFromSheet(userSheets[i]->contents(), medium, &resolver);
}
}
@@ -91,7 +91,7 @@
ASSERT(!cssSheet->disabled());
if (cssSheet->mediaQueries() && !medium->eval(cssSheet->mediaQueries(), resolver))
continue;
- m_authorStyle->addRulesFromSheet(&cssSheet->contents(), *medium, resolver);
+ m_authorStyle->addRulesFromSheet(cssSheet->contents(), *medium, resolver);
inspectorCSSOMWrappers.collectFromStyleSheetIfNeeded(cssSheet.get());
}
m_authorStyle->shrinkToFit();
Modified: trunk/Source/WebCore/css/RuleSet.cpp (191870 => 191871)
--- trunk/Source/WebCore/css/RuleSet.cpp 2015-11-02 00:48:03 UTC (rev 191870)
+++ trunk/Source/WebCore/css/RuleSet.cpp 2015-11-02 00:52:46 UTC (rev 191871)
@@ -339,7 +339,7 @@
addChildRules(mediaRule.childRules(), medium, resolver, hasDocumentSecurityOrigin, isInitiatingElementInUserAgentShadowTree, addRuleFlags);
} else if (is<StyleRuleFontFace>(*rule) && resolver) {
// Add this font face to our set.
- resolver->document().fontSelector().addFontFaceRule(downcast<StyleRuleFontFace>(rule.get()), isInitiatingElementInUserAgentShadowTree);
+ resolver->document().fontSelector().addFontFaceRule(downcast<StyleRuleFontFace>(*rule.get()), isInitiatingElementInUserAgentShadowTree);
resolver->invalidateMatchedPropertiesCache();
} else if (is<StyleRuleKeyframes>(*rule) && resolver)
resolver->addKeyframeStyle(downcast<StyleRuleKeyframes>(rule.get()));
@@ -358,24 +358,20 @@
}
}
-void RuleSet::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvaluator& medium, StyleResolver* resolver)
+void RuleSet::addRulesFromSheet(StyleSheetContents& sheet, const MediaQueryEvaluator& medium, StyleResolver* resolver)
{
- ASSERT(sheet);
-
- const Vector<RefPtr<StyleRuleImport>>& importRules = sheet->importRules();
- for (unsigned i = 0; i < importRules.size(); ++i) {
- StyleRuleImport* importRule = importRules[i].get();
- if (importRule->styleSheet() && (!importRule->mediaQueries() || medium.eval(importRule->mediaQueries(), resolver)))
- addRulesFromSheet(importRule->styleSheet(), medium, resolver);
+ for (auto& rule : sheet.importRules()) {
+ if (rule->styleSheet() && (!rule->mediaQueries() || medium.eval(rule->mediaQueries(), resolver)))
+ addRulesFromSheet(*rule->styleSheet(), medium, resolver);
}
- bool hasDocumentSecurityOrigin = resolver && resolver->document().securityOrigin()->canRequest(sheet->baseURL());
+ bool hasDocumentSecurityOrigin = resolver && resolver->document().securityOrigin()->canRequest(sheet.baseURL());
AddRuleFlags addRuleFlags = static_cast<AddRuleFlags>((hasDocumentSecurityOrigin ? RuleHasDocumentSecurityOrigin : 0));
// FIXME: Skip Content Security Policy check when stylesheet is in a user agent shadow tree.
// See <https://bugs.webkit.org/show_bug.cgi?id=146663>.
bool isInitiatingElementInUserAgentShadowTree = false;
- addChildRules(sheet->childRules(), medium, resolver, hasDocumentSecurityOrigin, isInitiatingElementInUserAgentShadowTree, addRuleFlags);
+ addChildRules(sheet.childRules(), medium, resolver, hasDocumentSecurityOrigin, isInitiatingElementInUserAgentShadowTree, addRuleFlags);
if (m_autoShrinkToFitEnabled)
shrinkToFit();
Modified: trunk/Source/WebCore/css/RuleSet.h (191870 => 191871)
--- trunk/Source/WebCore/css/RuleSet.h 2015-11-02 00:48:03 UTC (rev 191870)
+++ trunk/Source/WebCore/css/RuleSet.h 2015-11-02 00:52:46 UTC (rev 191871)
@@ -159,7 +159,7 @@
typedef Vector<RuleData, 1> RuleDataVector;
typedef HashMap<AtomicStringImpl*, std::unique_ptr<RuleDataVector>> AtomRuleMap;
- void addRulesFromSheet(StyleSheetContents*, const MediaQueryEvaluator&, StyleResolver* = 0);
+ void addRulesFromSheet(StyleSheetContents&, const MediaQueryEvaluator&, StyleResolver* = 0);
void addStyleRule(StyleRule*, AddRuleFlags);
void addRule(StyleRule*, unsigned selectorIndex, AddRuleFlags);
Modified: trunk/Source/WebCore/css/StyleInvalidationAnalysis.cpp (191870 => 191871)
--- trunk/Source/WebCore/css/StyleInvalidationAnalysis.cpp 2015-11-02 00:48:03 UTC (rev 191870)
+++ trunk/Source/WebCore/css/StyleInvalidationAnalysis.cpp 2015-11-02 00:52:46 UTC (rev 191871)
@@ -82,7 +82,7 @@
m_ruleSets.resetAuthorStyle();
for (auto& sheet : sheets)
- m_ruleSets.authorStyle()->addRulesFromSheet(sheet, mediaQueryEvaluator);
+ m_ruleSets.authorStyle()->addRulesFromSheet(*sheet, mediaQueryEvaluator);
m_hasShadowPseudoElementRulesInAuthorSheet = m_ruleSets.authorStyle()->hasShadowPseudoElementRules();
}
Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (191870 => 191871)
--- trunk/Source/WebCore/platform/graphics/Font.cpp 2015-11-02 00:48:03 UTC (rev 191870)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp 2015-11-02 00:52:46 UTC (rev 191871)
@@ -265,7 +265,7 @@
return page->glyphDataForCharacter(character);
}
-PassRefPtr<Font> Font::verticalRightOrientationFont() const
+const Font& Font::verticalRightOrientationFont() const
{
if (!m_derivedFontData)
m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont());
@@ -275,40 +275,40 @@
m_derivedFontData->verticalRightOrientation = create(verticalRightPlatformData, isCustomFont(), false, true);
}
ASSERT(m_derivedFontData->verticalRightOrientation != this);
- return m_derivedFontData->verticalRightOrientation;
+ return *m_derivedFontData->verticalRightOrientation;
}
-PassRefPtr<Font> Font::uprightOrientationFont() const
+const Font& Font::uprightOrientationFont() const
{
if (!m_derivedFontData)
m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont());
if (!m_derivedFontData->uprightOrientation)
m_derivedFontData->uprightOrientation = create(m_platformData, isCustomFont(), false, true);
ASSERT(m_derivedFontData->uprightOrientation != this);
- return m_derivedFontData->uprightOrientation;
+ return *m_derivedFontData->uprightOrientation;
}
-PassRefPtr<Font> Font::smallCapsFont(const FontDescription& fontDescription) const
+const Font* Font::smallCapsFont(const FontDescription& fontDescription) const
{
if (!m_derivedFontData)
m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont());
if (!m_derivedFontData->smallCaps)
m_derivedFontData->smallCaps = createScaledFont(fontDescription, smallCapsFontSizeMultiplier);
ASSERT(m_derivedFontData->smallCaps != this);
- return m_derivedFontData->smallCaps;
+ return m_derivedFontData->smallCaps.get();
}
-PassRefPtr<Font> Font::emphasisMarkFont(const FontDescription& fontDescription) const
+const Font* Font::emphasisMarkFont(const FontDescription& fontDescription) const
{
if (!m_derivedFontData)
m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont());
if (!m_derivedFontData->emphasisMark)
m_derivedFontData->emphasisMark = createScaledFont(fontDescription, emphasisMarkFontSizeMultiplier);
ASSERT(m_derivedFontData->emphasisMark != this);
- return m_derivedFontData->emphasisMark;
+ return m_derivedFontData->emphasisMark.get();
}
-PassRefPtr<Font> Font::brokenIdeographFont() const
+const Font& Font::brokenIdeographFont() const
{
if (!m_derivedFontData)
m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont());
@@ -317,10 +317,10 @@
m_derivedFontData->brokenIdeograph->m_isBrokenIdeographFallback = true;
}
ASSERT(m_derivedFontData->brokenIdeograph != this);
- return m_derivedFontData->brokenIdeograph;
+ return *m_derivedFontData->brokenIdeograph;
}
-PassRefPtr<Font> Font::nonSyntheticItalicFont() const
+const Font& Font::nonSyntheticItalicFont() const
{
if (!m_derivedFontData)
m_derivedFontData = std::make_unique<DerivedFontData>(isCustomFont());
@@ -332,7 +332,7 @@
m_derivedFontData->nonSyntheticItalic = create(nonSyntheticItalicFontPlatformData, isCustomFont());
}
ASSERT(m_derivedFontData->nonSyntheticItalic != this);
- return m_derivedFontData->nonSyntheticItalic;
+ return *m_derivedFontData->nonSyntheticItalic;
}
#ifndef NDEBUG
@@ -363,7 +363,7 @@
{
}
-PassRefPtr<Font> Font::createScaledFont(const FontDescription& fontDescription, float scaleFactor) const
+RefPtr<Font> Font::createScaledFont(const FontDescription& fontDescription, float scaleFactor) const
{
if (isSVGFont())
return nullptr;
Modified: trunk/Source/WebCore/platform/graphics/Font.h (191870 => 191871)
--- trunk/Source/WebCore/platform/graphics/Font.h 2015-11-02 00:48:03 UTC (rev 191870)
+++ trunk/Source/WebCore/platform/graphics/Font.h 2015-11-02 00:52:46 UTC (rev 191871)
@@ -100,12 +100,12 @@
const OpenTypeVerticalData* verticalData() const { return m_verticalData.get(); }
#endif
- PassRefPtr<Font> smallCapsFont(const FontDescription&) const;
- PassRefPtr<Font> emphasisMarkFont(const FontDescription&) const;
- PassRefPtr<Font> brokenIdeographFont() const;
- PassRefPtr<Font> nonSyntheticItalicFont() const;
+ const Font* smallCapsFont(const FontDescription&) const;
+ const Font* emphasisMarkFont(const FontDescription&) const;
+ const Font& brokenIdeographFont() const;
+ const Font& nonSyntheticItalicFont() const;
- PassRefPtr<Font> variantFont(const FontDescription& description, FontVariant variant) const
+ const Font* variantFont(const FontDescription& description, FontVariant variant) const
{
switch (variant) {
case SmallCapsVariant:
@@ -113,7 +113,7 @@
case EmphasisMarkVariant:
return emphasisMarkFont(description);
case BrokenIdeographVariant:
- return brokenIdeographFont();
+ return &brokenIdeographFont();
case AutoVariant:
case NormalVariant:
break;
@@ -122,8 +122,8 @@
return const_cast<Font*>(this);
}
- PassRefPtr<Font> verticalRightOrientationFont() const;
- PassRefPtr<Font> uprightOrientationFont() const;
+ const Font& verticalRightOrientationFont() const;
+ const Font& uprightOrientationFont() const;
bool hasVerticalGlyphs() const { return m_hasVerticalGlyphs; }
bool isTextOrientationFallback() const { return m_isTextOrientationFallback; }
@@ -228,8 +228,8 @@
void initCharWidths();
- PassRefPtr<Font> createScaledFont(const FontDescription&, float scaleFactor) const;
- PassRefPtr<Font> platformCreateScaledFont(const FontDescription&, float scaleFactor) const;
+ RefPtr<Font> createScaledFont(const FontDescription&, float scaleFactor) const;
+ RefPtr<Font> platformCreateScaledFont(const FontDescription&, float scaleFactor) const;
void removeFromSystemFallbackCache();
Modified: trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp (191870 => 191871)
--- trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp 2015-11-02 00:48:03 UTC (rev 191870)
+++ trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp 2015-11-02 00:52:46 UTC (rev 191871)
@@ -285,7 +285,7 @@
#if PLATFORM(COCOA) || USE(CAIRO)
static GlyphData glyphDataForCJKCharacterWithoutSyntheticItalic(UChar32 character, GlyphData& data)
{
- GlyphData nonItalicData = data.font->nonSyntheticItalicFont()->glyphDataForCharacter(character);
+ GlyphData nonItalicData = data.font->nonSyntheticItalicFont().glyphDataForCharacter(character);
if (nonItalicData.font)
return nonItalicData;
return data;
@@ -295,7 +295,7 @@
static GlyphData glyphDataForNonCJKCharacterWithGlyphOrientation(UChar32 character, NonCJKGlyphOrientation orientation, const GlyphData& data)
{
if (orientation == NonCJKGlyphOrientationUpright || shouldIgnoreRotation(character)) {
- GlyphData uprightData = data.font->uprightOrientationFont()->glyphDataForCharacter(character);
+ GlyphData uprightData = data.font->uprightOrientationFont().glyphDataForCharacter(character);
// If the glyphs are the same, then we know we can just use the horizontal glyph rotated vertically to be upright.
if (data.glyph == uprightData.glyph)
return data;
@@ -304,7 +304,7 @@
if (uprightData.font)
return uprightData;
} else if (orientation == NonCJKGlyphOrientationVerticalRight) {
- GlyphData verticalRightData = data.font->verticalRightOrientationFont()->glyphDataForCharacter(character);
+ GlyphData verticalRightData = data.font->verticalRightOrientationFont().glyphDataForCharacter(character);
// If the glyphs are distinct, we will make the assumption that the font has a vertical-right glyph baked
// into it.
if (data.glyph != verticalRightData.glyph)
@@ -363,11 +363,9 @@
if (data.font) {
// The variantFont function should not normally return 0.
// But if it does, we will just render the capital letter big.
- RefPtr<Font> variantFont = data.font->variantFont(description, variant);
- if (!variantFont)
- return data;
-
- return variantFont->glyphDataForCharacter(c);
+ if (const Font* variantFont = data.font->variantFont(description, variant))
+ return variantFont->glyphDataForCharacter(c);
+ return data;
}
}
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (191870 => 191871)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm 2015-11-02 00:48:03 UTC (rev 191870)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm 2015-11-02 00:52:46 UTC (rev 191871)
@@ -719,21 +719,21 @@
if (font->platformData().orientation() == Vertical) {
if (isCJKIdeographOrSymbol(baseCharacter) && !font->hasVerticalGlyphs()) {
variant = BrokenIdeographVariant;
- font = font->brokenIdeographFont().get();
+ font = &font->brokenIdeographFont();
} else if (m_fontDescription.nonCJKGlyphOrientation() == NonCJKGlyphOrientationVerticalRight) {
- Font* verticalRightFont = font->verticalRightOrientationFont().get();
- Glyph verticalRightGlyph = verticalRightFont->glyphForCharacter(baseCharacter);
+ const Font& verticalRightFont = font->verticalRightOrientationFont();
+ Glyph verticalRightGlyph = verticalRightFont.glyphForCharacter(baseCharacter);
if (verticalRightGlyph == baseCharacterGlyphData.glyph)
- font = verticalRightFont;
+ font = &verticalRightFont;
} else {
- Font* uprightFont = font->uprightOrientationFont().get();
- Glyph uprightGlyph = uprightFont->glyphForCharacter(baseCharacter);
+ const Font& uprightFont = font->uprightOrientationFont();
+ Glyph uprightGlyph = uprightFont.glyphForCharacter(baseCharacter);
if (uprightGlyph != baseCharacterGlyphData.glyph)
- font = uprightFont;
+ font = &uprightFont;
}
}
} else {
- if (const Font* variantFont = font->variantFont(m_fontDescription, variant).get())
+ if (const Font* variantFont = font->variantFont(m_fontDescription, variant))
font = variantFont;
}
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm (191870 => 191871)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm 2015-11-02 00:48:03 UTC (rev 191870)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm 2015-11-02 00:52:46 UTC (rev 191871)
@@ -245,7 +245,7 @@
else
xHeight = scaleEmToUnits(CGFontGetXHeight(m_platformData.cgFont()), unitsPerEm) * pointSize;
} else
- xHeight = verticalRightOrientationFont()->fontMetrics().xHeight();
+ xHeight = verticalRightOrientationFont().fontMetrics().xHeight();
m_fontMetrics.setUnitsPerEm(unitsPerEm);
m_fontMetrics.setAscent(ascent);
@@ -308,7 +308,7 @@
{
}
-PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription&, float scaleFactor) const
+RefPtr<Font> Font::platformCreateScaledFont(const FontDescription&, float scaleFactor) const
{
#if !CORETEXT_WEB_FONTS
if (isCustomFont()) {
Modified: trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp (191870 => 191871)
--- trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp 2015-11-02 00:48:03 UTC (rev 191870)
+++ trunk/Source/WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp 2015-11-02 00:52:46 UTC (rev 191871)
@@ -115,7 +115,7 @@
initCharWidths();
}
-PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const
+RefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const
{
ASSERT(m_platformData.scaledFont());
FontDescription scaledFontDescription = fontDescription;
Modified: trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp (191870 => 191871)
--- trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp 2015-11-02 00:48:03 UTC (rev 191870)
+++ trunk/Source/WebCore/platform/graphics/win/SimpleFontDataWin.cpp 2015-11-02 00:52:46 UTC (rev 191871)
@@ -122,7 +122,7 @@
delete m_scriptFontProperties;
}
-PassRefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const
+RefPtr<Font> Font::platformCreateScaledFont(const FontDescription& fontDescription, float scaleFactor) const
{
float scaledSize = scaleFactor * m_platformData.size();
if (isCustomFont()) {
Modified: trunk/Source/WebCore/svg/SVGFontFaceElement.h (191870 => 191871)
--- trunk/Source/WebCore/svg/SVGFontFaceElement.h 2015-11-02 00:48:03 UTC (rev 191870)
+++ trunk/Source/WebCore/svg/SVGFontFaceElement.h 2015-11-02 00:52:46 UTC (rev 191871)
@@ -50,7 +50,7 @@
SVGFontElement* associatedFontElement() const;
void rebuildFontFace();
- StyleRuleFontFace* fontFaceRule() const { return m_fontFaceRule.get(); }
+ const StyleRuleFontFace& fontFaceRule() const { return m_fontFaceRule.get(); }
private:
SVGFontFaceElement(const QualifiedName&, Document&);
@@ -63,7 +63,7 @@
virtual bool rendererIsNeeded(const RenderStyle&) override { return false; }
- RefPtr<StyleRuleFontFace> m_fontFaceRule;
+ Ref<StyleRuleFontFace> m_fontFaceRule;
SVGFontElement* m_fontElement;
};