WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
patch
primary-font-reference.patch (text/plain), 64.63 KB, created by
Antti Koivisto
on 2015-01-05 09:23:07 PST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Antti Koivisto
Created:
2015-01-05 09:23:07 PST
Size:
64.63 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 177909) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,100 @@ >+2015-01-05 Antti Koivisto <antti@apple.com> >+ >+ Font::primaryFontData() should return a reference >+ https://bugs.webkit.org/show_bug.cgi?id=140081 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ It is not null. >+ >+ Also rename primaryFont() -> primaryFontData(). >+ >+ * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: >+ (AXAttributeStringSetStyle): >+ * accessibility/mac/WebAccessibilityObjectWrapperMac.mm: >+ (AXAttributeStringSetStyle): >+ * bindings/objc/DOM.mm: >+ (-[DOMElement _font]): >+ * editing/cocoa/HTMLConverter.mm: >+ (_font): >+ (WebCore::editingAttributedStringFromRange): >+ * editing/ios/EditorIOS.mm: >+ (WebCore::Editor::fontForSelection): >+ (WebCore::Editor::fontAttributesForSelectionStart): >+ * editing/mac/EditorMac.mm: >+ (WebCore::Editor::fontForSelection): >+ (WebCore::Editor::fontAttributesForSelectionStart): >+ * platform/graphics/Font.cpp: >+ (WebCore::Font::fastAverageCharWidthIfAvailable): >+ * platform/graphics/Font.h: >+ (WebCore::Font::fontMetrics): >+ (WebCore::Font::spaceWidth): >+ (WebCore::Font::tabWidth): >+ (WebCore::Font::primaryFontData): >+ (WebCore::Font::primaryFont): Deleted. >+ * platform/graphics/FontFastPath.cpp: >+ (WebCore::Font::primaryFontHasGlyphForCharacter): >+ * platform/graphics/FontGlyphs.cpp: >+ (WebCore::FontGlyphs::determinePitch): >+ (WebCore::FontGlyphs::glyphDataForSystemFallback): >+ (WebCore::FontGlyphs::glyphDataForCharacter): >+ * platform/graphics/FontGlyphs.h: >+ (WebCore::FontGlyphs::primaryFontData): >+ (WebCore::FontGlyphs::primarySimpleFontData): >+ * platform/graphics/WidthIterator.cpp: >+ (WebCore::WidthIterator::advanceInternal): >+ * platform/graphics/mac/ComplexTextController.cpp: >+ (WebCore::ComplexTextController::advance): >+ (WebCore::ComplexTextController::adjustGlyphsAndAdvances): >+ * platform/graphics/mac/ComplexTextController.h: >+ (WebCore::ComplexTextController::ComplexTextRun::create): >+ (WebCore::ComplexTextController::ComplexTextRun::fontData): >+ * platform/graphics/mac/ComplexTextControllerCoreText.mm: >+ (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): >+ (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): >+ * platform/graphics/mac/FontMac.mm: >+ (WebCore::Font::primaryFontDataIsSystemFont): >+ * platform/graphics/opentype/OpenTypeMathData.cpp: >+ * platform/graphics/opentype/OpenTypeMathData.h: >+ * rendering/InlineFlowBox.cpp: >+ (WebCore::InlineFlowBox::requiresIdeographicBaseline): >+ * rendering/InlineTextBox.cpp: >+ (WebCore::InlineTextBox::constructTextRun): >+ * rendering/RenderBlock.cpp: >+ (WebCore::RenderBlock::adjustLogicalLeftOffsetForLine): >+ (WebCore::RenderBlock::adjustLogicalRightOffsetForLine): >+ (WebCore::constructTextRunInternal): >+ * rendering/RenderTextControlSingleLine.cpp: >+ (WebCore::RenderTextControlSingleLine::preferredContentLogicalWidth): >+ * rendering/RenderThemeIOS.mm: >+ (WebCore::adjustInputElementButtonStyle): >+ * rendering/RootInlineBox.cpp: >+ (WebCore::RootInlineBox::ascentAndDescentForBox): >+ * rendering/SimpleLineLayout.cpp: >+ (WebCore::SimpleLineLayout::canUseFor): >+ * rendering/mathml/RenderMathMLOperator.cpp: >+ (WebCore::RenderMathMLOperator::getGlyphAssemblyFallBack): >+ (WebCore::RenderMathMLOperator::getDisplayStyleLargeOperator): >+ (WebCore::RenderMathMLOperator::findStretchyData): >+ (WebCore::RenderMathMLOperator::trailingSpaceError): >+ * rendering/mathml/RenderMathMLRadicalOperator.cpp: >+ (WebCore::RenderMathMLRadicalOperator::stretchTo): >+ (WebCore::RenderMathMLRadicalOperator::computePreferredLogicalWidths): >+ (WebCore::RenderMathMLRadicalOperator::computeLogicalHeight): >+ (WebCore::RenderMathMLRadicalOperator::paint): >+ * rendering/mathml/RenderMathMLRoot.cpp: >+ (WebCore::RenderMathMLRoot::updateStyle): >+ * rendering/svg/SVGInlineTextBox.cpp: >+ (WebCore::SVGInlineTextBox::constructTextRun): >+ * rendering/svg/SVGTextLayoutEngineSpacing.cpp: >+ (WebCore::SVGTextLayoutEngineSpacing::calculateSVGKerning): >+ * rendering/svg/SVGTextMetrics.cpp: >+ (WebCore::SVGTextMetrics::constructTextRun): >+ (WebCore::SVGTextMetrics::SVGTextMetrics): >+ * rendering/svg/SVGTextRunRenderingContext.cpp: >+ (WebCore::missingGlyphForFont): >+ (WebCore::SVGTextRunRenderingContext::glyphDataForCharacter): >+ > 2015-01-05 peavo@outlook.com <peavo@outlook.com> > > [WinCairo] Crash when font data pointer is null. >Index: Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm >=================================================================== >--- Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (revision 177908) >+++ Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (working copy) >@@ -1758,7 +1758,7 @@ static void AXAttributeStringSetStyle(NS > RenderStyle& style = renderer->style(); > > // set basic font info >- AXAttributeStringSetFont(attrString, style.font().primaryFont()->getCTFont(), range); >+ AXAttributeStringSetFont(attrString, style.font().primaryFontData().getCTFont(), range); > > int decor = style.textDecorationsInEffect(); > if ((decor & (TextDecorationUnderline | TextDecorationLineThrough)) != 0) { >Index: Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm >=================================================================== >--- Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (revision 177908) >+++ Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (working copy) >@@ -848,7 +848,7 @@ static void AXAttributeStringSetStyle(NS > const RenderStyle& style = renderer->style(); > > // set basic font info >- AXAttributeStringSetFont(attrString, NSAccessibilityFontTextAttribute, style.font().primaryFont()->getNSFont(), range); >+ AXAttributeStringSetFont(attrString, NSAccessibilityFontTextAttribute, style.font().primaryFontData().getNSFont(), range); > > // set basic colors > AXAttributeStringSetColor(attrString, NSAccessibilityForegroundColorTextAttribute, nsColor(style.visitedDependentColor(CSSPropertyColor)), range); >Index: Source/WebCore/bindings/objc/DOM.mm >=================================================================== >--- Source/WebCore/bindings/objc/DOM.mm (revision 177908) >+++ Source/WebCore/bindings/objc/DOM.mm (working copy) >@@ -669,7 +669,7 @@ - (NSFont *)_font > auto renderer = core(self)->renderer(); > if (!renderer) > return nil; >- return renderer->style().font().primaryFont()->getNSFont(); >+ return renderer->style().font().primaryFontData().getNSFont(); > } > #else > - (CTFontRef)_font >@@ -677,7 +677,7 @@ - (CTFontRef)_font > RenderObject* renderer = core(self)->renderer(); > if (!renderer) > return nil; >- return renderer->style().font().primaryFont()->getCTFont(); >+ return renderer->style().font().primaryFontData().getCTFont(); > } > #endif > >Index: Source/WebCore/editing/cocoa/HTMLConverter.mm >=================================================================== >--- Source/WebCore/editing/cocoa/HTMLConverter.mm (revision 177908) >+++ Source/WebCore/editing/cocoa/HTMLConverter.mm (working copy) >@@ -1114,7 +1114,7 @@ static PlatformFont *_font(Element& elem > auto renderer = element.renderer(); > if (!renderer) > return nil; >- return renderer->style().font().primaryFont()->getNSFont(); >+ return renderer->style().font().primaryFontData().getNSFont(); > } > #else > static PlatformFont *_font(Element& element) >@@ -1122,7 +1122,7 @@ static PlatformFont *_font(Element& elem > auto renderer = element.renderer(); > if (!renderer) > return nil; >- return (PlatformFont *)renderer->style().font().primaryFont()->getCTFont(); >+ return (PlatformFont *)renderer->style().font().primaryFontData().getCTFont(); > } > #endif > >@@ -2594,10 +2594,10 @@ NSAttributedString *editingAttributedStr > [attrs.get() setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName]; > if (style.textDecorationsInEffect() & TextDecorationLineThrough) > [attrs.get() setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName]; >- if (NSFont *font = style.font().primaryFont()->getNSFont()) >+ if (NSFont *font = style.font().primaryFontData().getNSFont()) > [attrs.get() setObject:font forKey:NSFontAttributeName]; > else >- [attrs.get() setObject:[fontManager convertFont:WebDefaultFont() toSize:style.font().primaryFont()->platformData().size()] forKey:NSFontAttributeName]; >+ [attrs.get() setObject:[fontManager convertFont:WebDefaultFont() toSize:style.font().primaryFontData().platformData().size()] forKey:NSFontAttributeName]; > if (style.visitedDependentColor(CSSPropertyColor).alpha()) > [attrs.get() setObject:nsColor(style.visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName]; > else >Index: Source/WebCore/editing/ios/EditorIOS.mm >=================================================================== >--- Source/WebCore/editing/ios/EditorIOS.mm (revision 177908) >+++ Source/WebCore/editing/ios/EditorIOS.mm (working copy) >@@ -211,9 +211,9 @@ const SimpleFontData* Editor::fontForSel > Node* nodeToRemove; > RenderStyle* style = styleForSelectionStart(&m_frame, nodeToRemove); // sets nodeToRemove > >- const SimpleFontData* result = 0; >+ const SimpleFontData* result = nullptr; > if (style) >- result = style->font().primaryFont(); >+ result = &style->font().primaryFontData(); > > if (nodeToRemove) { > ExceptionCode ec; >@@ -235,10 +235,10 @@ const SimpleFontData* Editor::fontForSel > if (!renderer) > continue; > // FIXME: Are there any node types that have renderers, but that we should be skipping? >- const SimpleFontData* primaryFont = renderer->style().font().primaryFont(); >+ const SimpleFontData& primaryFont = renderer->style().font().primaryFontData(); > if (!font) >- font = primaryFont; >- else if (font != primaryFont) { >+ font = &primaryFont; >+ else if (font != &primaryFont) { > hasMultipleFonts = true; > break; > } >@@ -257,7 +257,7 @@ NSDictionary* Editor::fontAttributesForS > > NSMutableDictionary* result = [NSMutableDictionary dictionary]; > >- CTFontRef font = style->font().primaryFont()->getCTFont(); >+ CTFontRef font = style->font().primaryFontData().getCTFont(); > if (font) > [result setObject:(id)font forKey:NSFontAttributeName]; > >Index: Source/WebCore/editing/mac/EditorMac.mm >=================================================================== >--- Source/WebCore/editing/mac/EditorMac.mm (revision 177908) >+++ Source/WebCore/editing/mac/EditorMac.mm (working copy) >@@ -113,9 +113,9 @@ const SimpleFontData* Editor::fontForSel > Node* nodeToRemove; > RenderStyle* style = styleForSelectionStart(&m_frame, nodeToRemove); // sets nodeToRemove > >- const SimpleFontData* result = 0; >+ const SimpleFontData* result = nullptr; > if (style) >- result = style->font().primaryFont(); >+ result = &style->font().primaryFontData(); > > if (nodeToRemove) > nodeToRemove->remove(ASSERT_NO_EXCEPTION); >@@ -135,10 +135,10 @@ const SimpleFontData* Editor::fontForSel > if (!renderer) > continue; > // FIXME: Are there any node types that have renderers, but that we should be skipping? >- const SimpleFontData* primaryFont = renderer->style().font().primaryFont(); >+ const SimpleFontData& primaryFont = renderer->style().font().primaryFontData(); > if (!font) >- font = primaryFont; >- else if (font != primaryFont) { >+ font = &primaryFont; >+ else if (font != &primaryFont) { > hasMultipleFonts = true; > break; > } >@@ -160,8 +160,8 @@ NSDictionary* Editor::fontAttributesForS > if (style->visitedDependentColor(CSSPropertyBackgroundColor).isValid() && style->visitedDependentColor(CSSPropertyBackgroundColor).alpha() != 0) > [result setObject:nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)) forKey:NSBackgroundColorAttributeName]; > >- if (style->font().primaryFont()->getNSFont()) >- [result setObject:style->font().primaryFont()->getNSFont() forKey:NSFontAttributeName]; >+ if (style->font().primaryFontData().getNSFont()) >+ [result setObject:style->font().primaryFontData().getNSFont() forKey:NSFontAttributeName]; > > if (style->visitedDependentColor(CSSPropertyColor).isValid() && style->visitedDependentColor(CSSPropertyColor) != Color::black) > [result setObject:nsColor(style->visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName]; >Index: Source/WebCore/platform/graphics/Font.cpp >=================================================================== >--- Source/WebCore/platform/graphics/Font.cpp (revision 177908) >+++ Source/WebCore/platform/graphics/Font.cpp (working copy) >@@ -506,7 +506,7 @@ bool Font::fastAverageCharWidthIfAvailab > { > bool success = hasValidAverageCharWidth(); > if (success) >- width = roundf(primaryFont()->avgCharWidth()); // FIXME: primaryFont() might not correspond to firstFamily(). >+ width = roundf(primaryFontData().avgCharWidth()); // FIXME: primaryFontData() might not correspond to firstFamily(). > return success; > } > >Index: Source/WebCore/platform/graphics/Font.h >=================================================================== >--- Source/WebCore/platform/graphics/Font.h (revision 177908) >+++ Source/WebCore/platform/graphics/Font.h (working copy) >@@ -172,10 +172,10 @@ public: > > bool isPlatformFont() const { return m_glyphs->isForPlatformFont(); } > >- const FontMetrics& fontMetrics() const { return primaryFont()->fontMetrics(); } >- float spaceWidth() const { return primaryFont()->spaceWidth() + m_letterSpacing; } >+ const FontMetrics& fontMetrics() const { return primaryFontData().fontMetrics(); } >+ float spaceWidth() const { return primaryFontData().spaceWidth() + m_letterSpacing; } > float tabWidth(const SimpleFontData&, unsigned tabSize, float position) const; >- float tabWidth(unsigned tabSize, float position) const { return tabWidth(*primaryFont(), tabSize, position); } >+ float tabWidth(unsigned tabSize, float position) const { return tabWidth(primaryFontData(), tabSize, position); } > bool hasValidAverageCharWidth() const; > bool fastAverageCharWidthIfAvailable(float &width) const; // returns true on success > >@@ -183,7 +183,7 @@ public: > int emphasisMarkDescent(const AtomicString&) const; > int emphasisMarkHeight(const AtomicString&) const; > >- const SimpleFontData* primaryFont() const; >+ const SimpleFontData& primaryFontData() const; > const FontData* fontDataAt(unsigned) const; > GlyphData glyphDataForCharacter(UChar32 c, bool mirror, FontDataVariant variant = AutoVariant) const > { >@@ -192,7 +192,6 @@ public: > #if PLATFORM(COCOA) > const SimpleFontData* fontDataForCombiningCharacterSequence(const UChar*, size_t length, FontDataVariant) const; > #endif >- bool primaryFontHasGlyphForCharacter(UChar32) const; > > static bool isCJKIdeograph(UChar32); > static bool isCJKIdeographOrSymbol(UChar32); >@@ -357,7 +356,7 @@ inline Font::~Font() > { > } > >-inline const SimpleFontData* Font::primaryFont() const >+inline const SimpleFontData& Font::primaryFontData() const > { > ASSERT(m_glyphs); > return m_glyphs->primarySimpleFontData(m_fontDescription); >Index: Source/WebCore/platform/graphics/FontFastPath.cpp >=================================================================== >--- Source/WebCore/platform/graphics/FontFastPath.cpp (revision 177908) >+++ Source/WebCore/platform/graphics/FontFastPath.cpp (working copy) >@@ -40,11 +40,6 @@ using namespace Unicode; > > namespace WebCore { > >-bool Font::primaryFontHasGlyphForCharacter(UChar32 character) const >-{ >- return primaryFont()->glyphForCharacter(character); >-} >- > // FIXME: This function may not work if the emphasis mark uses a complex script, but none of the > // standard emphasis marks do so. > bool Font::getEmphasisMarkGlyphData(const AtomicString& mark, GlyphData& glyphData) const >Index: Source/WebCore/platform/graphics/FontGlyphs.cpp >=================================================================== >--- Source/WebCore/platform/graphics/FontGlyphs.cpp (revision 177908) >+++ Source/WebCore/platform/graphics/FontGlyphs.cpp (working copy) >@@ -75,11 +75,11 @@ void FontGlyphs::releaseFontData() > > void FontGlyphs::determinePitch(const FontDescription& description) > { >- const FontData* fontData = primaryFontData(description); >- if (is<SimpleFontData>(*fontData)) >- m_pitch = downcast<SimpleFontData>(*fontData).pitch(); >+ const FontData& fontData = primaryFontData(description); >+ if (is<SimpleFontData>(fontData)) >+ m_pitch = downcast<SimpleFontData>(fontData).pitch(); > else { >- const SegmentedFontData& segmentedFontData = downcast<SegmentedFontData>(*fontData); >+ const SegmentedFontData& segmentedFontData = downcast<SegmentedFontData>(fontData); > unsigned numRanges = segmentedFontData.numRanges(); > if (numRanges == 1) > m_pitch = segmentedFontData.rangeAt(0).fontData()->pitch(); >@@ -245,9 +245,9 @@ static GlyphData glyphDataForNonCJKChara > GlyphData FontGlyphs::glyphDataForSystemFallback(UChar32 c, const FontDescription& description, FontDataVariant variant) > { > // System fallback is character-dependent. >- auto* originalFontData = primaryFontData(description)->simpleFontDataForCharacter(c); >+ auto* originalFontData = primaryFontData(description).simpleFontDataForCharacter(c); > if (!originalFontData) >- originalFontData = &primaryFontData(description)->simpleFontDataForFirstRange(); >+ originalFontData = &primaryFontData(description).simpleFontDataForFirstRange(); > > RefPtr<SimpleFontData> systemFallbackFontData = originalFontData->systemFallbackFontDataForCharacter(c, description, m_isForPlatformFont); > if (!systemFallbackFontData) >@@ -364,7 +364,7 @@ GlyphData FontGlyphs::glyphDataForCharac > ASSERT(isMainThread()); > > if (variant == AutoVariant) { >- if (description.smallCaps() && !primarySimpleFontData(description)->isSVGFont()) { >+ if (description.smallCaps() && !primarySimpleFontData(description).isSVGFont()) { > UChar32 upperC = u_toupper(c); > if (upperC != c) { > c = upperC; >@@ -385,7 +385,7 @@ GlyphData FontGlyphs::glyphDataForCharac > > RefPtr<GlyphPage>& cachedPage = pageNumber ? m_cachedPages.add(pageNumber, nullptr).iterator->value : m_cachedPageZero; > if (!cachedPage) >- cachedPage = glyphPageFromFontData(pageNumber, *primaryFontData(description)); >+ cachedPage = glyphPageFromFontData(pageNumber, primaryFontData(description)); > > GlyphData glyphData = cachedPage ? cachedPage->glyphDataForCharacter(c) : GlyphData(); > if (!glyphData.glyph) { >Index: Source/WebCore/platform/graphics/FontGlyphs.h >=================================================================== >--- Source/WebCore/platform/graphics/FontGlyphs.h (revision 177908) >+++ Source/WebCore/platform/graphics/FontGlyphs.h (working copy) >@@ -67,14 +67,15 @@ public: > WidthCache& widthCache() { return m_widthCache; } > const WidthCache& widthCache() const { return m_widthCache; } > >- const SimpleFontData* primarySimpleFontData(const FontDescription&); >- const FontData* primaryFontData(const FontDescription& description) { return realizeFontDataAt(description, 0); } >+ const SimpleFontData& primarySimpleFontData(const FontDescription&); > WEBCORE_EXPORT const FontData* realizeFontDataAt(const FontDescription&, unsigned index); > > private: > FontGlyphs(PassRefPtr<FontSelector>); > FontGlyphs(const FontPlatformData&); > >+ const FontData& primaryFontData(const FontDescription& description) { return *realizeFontDataAt(description, 0); } >+ > GlyphData glyphDataForSystemFallback(UChar32, const FontDescription&, FontDataVariant); > GlyphData glyphDataForNormalVariant(UChar32, const FontDescription&); > GlyphData glyphDataForVariant(UChar32, const FontDescription&, FontDataVariant, unsigned fallbackLevel); >@@ -106,16 +107,16 @@ inline bool FontGlyphs::isFixedPitch(con > return m_pitch == FixedPitch; > }; > >-inline const SimpleFontData* FontGlyphs::primarySimpleFontData(const FontDescription& description) >+inline const SimpleFontData& FontGlyphs::primarySimpleFontData(const FontDescription& description) > { > ASSERT(isMainThread()); > if (!m_cachedPrimarySimpleFontData) { >- auto* fontData = primaryFontData(description); >- m_cachedPrimarySimpleFontData = fontData->simpleFontDataForCharacter(' '); >+ auto& fontData = primaryFontData(description); >+ m_cachedPrimarySimpleFontData = fontData.simpleFontDataForCharacter(' '); > if (!m_cachedPrimarySimpleFontData) >- m_cachedPrimarySimpleFontData = &fontData->simpleFontDataForFirstRange(); >+ m_cachedPrimarySimpleFontData = &fontData.simpleFontDataForFirstRange(); > } >- return m_cachedPrimarySimpleFontData; >+ return *m_cachedPrimarySimpleFontData; > } > > } >Index: Source/WebCore/platform/graphics/WidthIterator.cpp >=================================================================== >--- Source/WebCore/platform/graphics/WidthIterator.cpp (revision 177908) >+++ Source/WebCore/platform/graphics/WidthIterator.cpp (working copy) >@@ -166,8 +166,8 @@ inline unsigned WidthIterator::advanceIn > float lastRoundingWidth = m_finalRoundingWidth; > FloatRect bounds; > >- const SimpleFontData* primaryFont = m_font->primaryFont(); >- const SimpleFontData* lastFontData = primaryFont; >+ const SimpleFontData& primaryFontData = m_font->primaryFontData(); >+ const SimpleFontData* lastFontData = &primaryFontData; > int lastGlyphCount = glyphBuffer ? glyphBuffer->size() : 0; > > UChar32 character = 0; >@@ -211,14 +211,14 @@ inline unsigned WidthIterator::advanceIn > } > > lastFontData = fontData; >- if (m_fallbackFonts && fontData != primaryFont) { >+ if (m_fallbackFonts && fontData != &primaryFontData) { > // FIXME: This does a little extra work that could be avoided if > // glyphDataForCharacter() returned whether it chose to use a small caps font. > if (!m_font->isSmallCaps() || character == u_toupper(character)) > m_fallbackFonts->add(fontData); > else { > const GlyphData& uppercaseGlyphData = m_font->glyphDataForCharacter(u_toupper(character), rtl); >- if (uppercaseGlyphData.fontData != primaryFont) >+ if (uppercaseGlyphData.fontData != &primaryFontData) > m_fallbackFonts->add(uppercaseGlyphData.fontData); > } > } >Index: Source/WebCore/platform/graphics/mac/ComplexTextController.cpp >=================================================================== >--- Source/WebCore/platform/graphics/mac/ComplexTextController.cpp (revision 177908) >+++ Source/WebCore/platform/graphics/mac/ComplexTextController.cpp (working copy) >@@ -494,8 +494,8 @@ void ComplexTextController::advance(unsi > size_t glyphCount = complexTextRun.glyphCount(); > unsigned g = ltr ? m_glyphInCurrentRun : glyphCount - 1 - m_glyphInCurrentRun; > unsigned k = leftmostGlyph + g; >- if (fallbackFonts && complexTextRun.fontData() != m_font.primaryFont()) >- fallbackFonts->add(complexTextRun.fontData()); >+ if (fallbackFonts && &complexTextRun.fontData() != &m_font.primaryFontData()) >+ fallbackFonts->add(&complexTextRun.fontData()); > > // We must store the initial advance for the first glyph we are going to draw. > // When leftmostGlyph is 0, it represents the first glyph to draw, taking into >@@ -520,7 +520,7 @@ void ComplexTextController::advance(unsi > return; > > if (glyphBuffer && !m_characterInCurrentGlyph) >- glyphBuffer->add(m_adjustedGlyphs[k], complexTextRun.fontData(), adjustedAdvance, complexTextRun.indexAt(m_glyphInCurrentRun)); >+ glyphBuffer->add(m_adjustedGlyphs[k], &complexTextRun.fontData(), adjustedAdvance, complexTextRun.indexAt(m_glyphInCurrentRun)); > > unsigned oldCharacterInCurrentGlyph = m_characterInCurrentGlyph; > m_characterInCurrentGlyph = std::min(m_currentCharacter - complexTextRun.stringLocation(), glyphEndOffset) - glyphStartOffset; >@@ -566,9 +566,9 @@ void ComplexTextController::adjustGlyphs > for (size_t r = 0; r < runCount; ++r) { > ComplexTextRun& complexTextRun = *m_complexTextRuns[r]; > unsigned glyphCount = complexTextRun.glyphCount(); >- const SimpleFontData* fontData = complexTextRun.fontData(); >+ const SimpleFontData& fontData = complexTextRun.fontData(); > #if PLATFORM(IOS) >- bool isEmoji = fontData->platformData().m_isEmoji; >+ bool isEmoji = fontData.platformData().m_isEmoji; > #endif > > // Represent the initial advance for a text run by adjusting the advance >@@ -588,8 +588,8 @@ void ComplexTextController::adjustGlyphs > const CGSize* advances = complexTextRun.advances(); > > bool lastRun = r + 1 == runCount; >- bool roundsAdvances = !m_font.isPrinterFont() && fontData->platformData().roundsGlyphAdvances(); >- float spaceWidth = fontData->spaceWidth() - fontData->syntheticBoldOffset(); >+ bool roundsAdvances = !m_font.isPrinterFont() && fontData.platformData().roundsGlyphAdvances(); >+ float spaceWidth = fontData.spaceWidth() - fontData.syntheticBoldOffset(); > CGFloat roundedSpaceWidth = roundCGFloat(spaceWidth); > const UChar* cp = complexTextRun.characters(); > CGPoint glyphOrigin = CGPointZero; >@@ -616,7 +616,7 @@ void ComplexTextController::adjustGlyphs > nextCh = *(m_complexTextRuns[r + 1]->characters() + m_complexTextRuns[r + 1]->indexAt(0)); > > bool treatAsSpace = Font::treatAsSpace(ch); >- CGGlyph glyph = treatAsSpace ? fontData->spaceGlyph() : glyphs[i]; >+ CGGlyph glyph = treatAsSpace ? fontData.spaceGlyph() : glyphs[i]; > CGSize advance = treatAsSpace ? CGSizeMake(spaceWidth, advances[i].height) : advances[i]; > #if PLATFORM(IOS) > if (isEmoji && advance.width) >@@ -624,25 +624,25 @@ void ComplexTextController::adjustGlyphs > #endif > > if (ch == '\t' && m_run.allowTabs()) >- advance.width = m_font.tabWidth(*fontData, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit); >+ advance.width = m_font.tabWidth(fontData, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit); > else if (Font::treatAsZeroWidthSpace(ch) && !treatAsSpace) { > advance.width = 0; >- glyph = fontData->spaceGlyph(); >+ glyph = fontData.spaceGlyph(); > } > > float roundedAdvanceWidth = roundf(advance.width); > if (roundsAdvances) > advance.width = roundedAdvanceWidth; > >- advance.width += fontData->syntheticBoldOffset(); >+ advance.width += fontData.syntheticBoldOffset(); > > > // We special case spaces in two ways when applying word rounding. > // First, we round spaces to an adjusted width in all fonts. > // Second, in fixed-pitch fonts we ensure that all glyphs that > // match the width of the space glyph have the same width as the space glyph. >- if (m_run.applyWordRounding() && roundedAdvanceWidth == roundedSpaceWidth && (fontData->pitch() == FixedPitch || glyph == fontData->spaceGlyph())) >- advance.width = fontData->adjustedSpaceWidth(); >+ if (m_run.applyWordRounding() && roundedAdvanceWidth == roundedSpaceWidth && (fontData.pitch() == FixedPitch || glyph == fontData.spaceGlyph())) >+ advance.width = fontData.adjustedSpaceWidth(); > > if (hasExtraSpacing) { > // If we're a glyph with an advance, go ahead and add in letter-spacing. >@@ -716,7 +716,7 @@ void ComplexTextController::adjustGlyphs > m_adjustedAdvances.append(advance); > m_adjustedGlyphs.append(glyph); > >- FloatRect glyphBounds = fontData->boundsForGlyph(glyph); >+ FloatRect glyphBounds = fontData.boundsForGlyph(glyph); > glyphBounds.move(glyphOrigin.x, glyphOrigin.y); > m_minGlyphBoundingBoxX = std::min(m_minGlyphBoundingBoxX, glyphBounds.x()); > m_maxGlyphBoundingBoxX = std::max(m_maxGlyphBoundingBoxX, glyphBounds.maxX()); >Index: Source/WebCore/platform/graphics/mac/ComplexTextController.h >=================================================================== >--- Source/WebCore/platform/graphics/mac/ComplexTextController.h (revision 177908) >+++ Source/WebCore/platform/graphics/mac/ComplexTextController.h (working copy) >@@ -73,18 +73,18 @@ public: > private: > class ComplexTextRun : public RefCounted<ComplexTextRun> { > public: >- static Ref<ComplexTextRun> create(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange) >+ static Ref<ComplexTextRun> create(CTRunRef ctRun, const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange) > { > return adoptRef(*new ComplexTextRun(ctRun, fontData, characters, stringLocation, stringLength, runRange)); > } > >- static Ref<ComplexTextRun> create(const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr) >+ static Ref<ComplexTextRun> create(const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr) > { > return adoptRef(*new ComplexTextRun(fontData, characters, stringLocation, stringLength, ltr)); > } > > unsigned glyphCount() const { return m_glyphCount; } >- const SimpleFontData* fontData() const { return m_fontData; } >+ const SimpleFontData& fontData() const { return m_fontData; } > const UChar* characters() const { return m_characters; } > unsigned stringLocation() const { return m_stringLocation; } > size_t stringLength() const { return m_stringLength; } >@@ -100,11 +100,11 @@ private: > void setIsNonMonotonic(); > > private: >- ComplexTextRun(CTRunRef, const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange); >- ComplexTextRun(const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr); >+ ComplexTextRun(CTRunRef, const SimpleFontData&, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange); >+ ComplexTextRun(const SimpleFontData&, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr); > > unsigned m_glyphCount; >- const SimpleFontData* m_fontData; >+ const SimpleFontData& m_fontData; > const UChar* m_characters; > unsigned m_stringLocation; > size_t m_stringLength; >Index: Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm >=================================================================== >--- Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm (revision 177908) >+++ Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm (working copy) >@@ -94,7 +94,7 @@ - (id)objectAtIndex:(NSUInteger)index > > namespace WebCore { > >-ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange) >+ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange) > : m_fontData(fontData) > , m_characters(characters) > , m_stringLocation(stringLocation) >@@ -130,7 +130,7 @@ ComplexTextController::ComplexTextRun::C > > // Missing glyphs run constructor. Core Text will not generate a run of missing glyphs, instead falling back on > // glyphs from LastResort. We want to use the primary font's missing glyph in order to match the fast text code path. >-ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr) >+ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr) > : m_fontData(fontData) > , m_characters(characters) > , m_stringLocation(stringLocation) >@@ -163,7 +163,7 @@ ComplexTextController::ComplexTextRun::C > // Synthesize a run of missing glyphs. > m_glyphsVector.fill(0, m_glyphCount); > m_glyphs = m_glyphsVector.data(); >- m_advancesVector.fill(CGSizeMake(m_fontData->widthForGlyph(0), 0), m_glyphCount); >+ m_advancesVector.fill(CGSizeMake(m_fontData.widthForGlyph(0), 0), m_glyphCount); > m_advances = m_advancesVector.data(); > } > >@@ -188,7 +188,7 @@ void ComplexTextController::collectCompl > { > if (!fontData) { > // Create a run of missing glyphs from the primary font. >- m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation, length, m_run.ltr())); >+ m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFontData(), cp, stringLocation, length, m_run.ltr())); > return; > } > >@@ -273,7 +273,7 @@ void ComplexTextController::collectCompl > // NSFontRenderingMode. > RetainPtr<CFStringRef> fontName = adoptCF(CTFontCopyPostScriptName(runFont)); > if (CFEqual(fontName.get(), CFSTR("LastResort"))) { >- m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation + runRange.location, runRange.length, m_run.ltr())); >+ m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFontData(), cp, stringLocation + runRange.location, runRange.length, m_run.ltr())); > continue; > } > runFontData = fontCache().getCachedFontData(m_font.fontDescription(), fontName.get(), false, FontCache::DoNotRetain).get(); >@@ -289,14 +289,14 @@ void ComplexTextController::collectCompl > ASSERT(runFontData); > #endif > } >- if (m_fallbackFonts && runFontData != m_font.primaryFont()) >+ if (m_fallbackFonts && runFontData != &m_font.primaryFontData()) > m_fallbackFonts->add(runFontData); > } > } >- if (m_fallbackFonts && runFontData != m_font.primaryFont()) >+ if (m_fallbackFonts && runFontData != &m_font.primaryFontData()) > m_fallbackFonts->add(fontData); > >- m_complexTextRuns.append(ComplexTextRun::create(ctRun, runFontData, cp, stringLocation, length, runRange)); >+ m_complexTextRuns.append(ComplexTextRun::create(ctRun, *runFontData, cp, stringLocation, length, runRange)); > } > } > >Index: Source/WebCore/platform/graphics/mac/FontMac.mm >=================================================================== >--- Source/WebCore/platform/graphics/mac/FontMac.mm (revision 177908) >+++ Source/WebCore/platform/graphics/mac/FontMac.mm (working copy) >@@ -593,8 +593,8 @@ DashArray Font::dashesForIntersectionsWi > bool Font::primaryFontDataIsSystemFont() const > { > #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED > 1090 >- const auto* fontData = primaryFont(); >- return !fontData->isSVGFont() && CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(fontData->platformData().ctFont())).get()); >+ const auto& fontData = primaryFontData(); >+ return !fontData.isSVGFont() && CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(fontData.platformData().ctFont())).get()); > #else > // System fonts are hidden by having a name that begins with a period, so simply search > // for that here rather than try to keep the list up to date. >Index: Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp >=================================================================== >--- Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp (revision 177908) >+++ Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp (working copy) >@@ -265,7 +265,7 @@ OpenTypeMathData::~OpenTypeMathData() > } > > #if ENABLE(OPENTYPE_MATH) >-float OpenTypeMathData::getMathConstant(const SimpleFontData* font, MathConstant constant) const >+float OpenTypeMathData::getMathConstant(const SimpleFontData& font, MathConstant constant) const > { > int32_t value = 0; > >@@ -286,9 +286,9 @@ float OpenTypeMathData::getMathConstant( > if (constant == ScriptPercentScaleDown || constant == ScriptScriptPercentScaleDown || constant == RadicalDegreeBottomRaisePercent) > return value / 100.0; > >- return value * font->sizePerUnit(); >+ return value * font.sizePerUnit(); > #else >-float OpenTypeMathData::getMathConstant(const SimpleFontData*, MathConstant) const >+float OpenTypeMathData::getMathConstant(const SimpleFontData&, MathConstant) const > { > ASSERT_NOT_REACHED(); > return 0; >@@ -296,7 +296,7 @@ float OpenTypeMathData::getMathConstant( > } > > #if ENABLE(OPENTYPE_MATH) >-float OpenTypeMathData::getItalicCorrection(const SimpleFontData* font, Glyph glyph) const >+float OpenTypeMathData::getItalicCorrection(const SimpleFontData& font, Glyph glyph) const > { > const OpenType::MATHTable* math = OpenType::validateTable<OpenType::MATHTable>(m_mathBuffer); > ASSERT(math); >@@ -308,9 +308,9 @@ float OpenTypeMathData::getItalicCorrect > if (!mathItalicsCorrectionInfo) > return 0; > >- return mathItalicsCorrectionInfo->getItalicCorrection(*m_mathBuffer, glyph) * font->sizePerUnit(); >+ return mathItalicsCorrectionInfo->getItalicCorrection(*m_mathBuffer, glyph) * font.sizePerUnit(); > #else >-float OpenTypeMathData::getItalicCorrection(const SimpleFontData*, Glyph) const >+float OpenTypeMathData::getItalicCorrection(const SimpleFontData&, Glyph) const > { > ASSERT_NOT_REACHED(); > return 0; >Index: Source/WebCore/platform/graphics/opentype/OpenTypeMathData.h >=================================================================== >--- Source/WebCore/platform/graphics/opentype/OpenTypeMathData.h (revision 177908) >+++ Source/WebCore/platform/graphics/opentype/OpenTypeMathData.h (working copy) >@@ -113,8 +113,8 @@ public: > bool isExtender; > }; > >- float getMathConstant(const SimpleFontData*, MathConstant) const; >- float getItalicCorrection(const SimpleFontData*, Glyph) const; >+ float getMathConstant(const SimpleFontData&, MathConstant) const; >+ float getItalicCorrection(const SimpleFontData&, Glyph) const; > void getMathVariants(Glyph, bool isVertical, Vector<Glyph>& sizeVariants, Vector<AssemblyPart>& assemblyParts) const; > > private: >Index: Source/WebCore/platform/graphics/win/UniscribeController.cpp >=================================================================== >--- Source/WebCore/platform/graphics/win/UniscribeController.cpp (revision 177908) >+++ Source/WebCore/platform/graphics/win/UniscribeController.cpp (working copy) >@@ -165,7 +165,7 @@ void UniscribeController::advance(unsign > smallCapsBuffer[index] = forceSmallCaps ? c : newC; > } > >- if (m_fallbackFonts && nextFontData != fontData && fontData != m_font.primaryFont()) >+ if (m_fallbackFonts && nextFontData != fontData && fontData != &m_font.primaryFontData()) > m_fallbackFonts->add(fontData); > > if (nextFontData != fontData || nextIsSmallCaps != isSmallCaps) { >@@ -179,7 +179,7 @@ void UniscribeController::advance(unsign > > int itemLength = m_run.rtl() ? indexOfFontTransition + 1 : length - indexOfFontTransition; > if (itemLength) { >- if (m_fallbackFonts && nextFontData != m_font.primaryFont()) >+ if (m_fallbackFonts && nextFontData != &m_font.primaryFontData()) > m_fallbackFonts->add(nextFontData); > > int itemStart = m_run.rtl() ? 0 : indexOfFontTransition; >Index: Source/WebCore/rendering/InlineFlowBox.cpp >=================================================================== >--- Source/WebCore/rendering/InlineFlowBox.cpp (revision 177908) >+++ Source/WebCore/rendering/InlineFlowBox.cpp (working copy) >@@ -449,7 +449,7 @@ bool InlineFlowBox::requiresIdeographicB > > const RenderStyle& lineStyle = this->lineStyle(); > if (lineStyle.fontDescription().nonCJKGlyphOrientation() == NonCJKGlyphOrientationUpright >- || lineStyle.font().primaryFont()->hasVerticalGlyphs()) >+ || lineStyle.font().primaryFontData().hasVerticalGlyphs()) > return true; > > for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) { >@@ -460,7 +460,7 @@ bool InlineFlowBox::requiresIdeographicB > if (downcast<InlineFlowBox>(*child).requiresIdeographicBaseline(textBoxDataMap)) > return true; > } else { >- if (child->lineStyle().font().primaryFont()->hasVerticalGlyphs()) >+ if (child->lineStyle().font().primaryFontData().hasVerticalGlyphs()) > return true; > > const Vector<const SimpleFontData*>* usedFonts = nullptr; >Index: Source/WebCore/rendering/InlineTextBox.cpp >=================================================================== >--- Source/WebCore/rendering/InlineTextBox.cpp (revision 177908) >+++ Source/WebCore/rendering/InlineTextBox.cpp (working copy) >@@ -1388,7 +1388,7 @@ TextRun InlineTextBox::constructTextRun( > > TextRun run(string, textPos(), expansion(), expansionBehavior(), direction(), dirOverride() || style.rtlOrdering() == VisualOrder, !renderer().canUseSimpleFontCodePath()); > run.setTabSize(!style.collapseWhiteSpace(), style.tabSize()); >- if (font.primaryFont()->isSVGFont()) >+ if (font.primaryFontData().isSVGFont()) > run.setRenderingContext(SVGTextRunRenderingContext::create(renderer())); > > // Propagate the maximum length of the characters buffer to the TextRun, even when we're only processing a substring. >Index: Source/WebCore/rendering/RenderBlock.cpp >=================================================================== >--- Source/WebCore/rendering/RenderBlock.cpp (revision 177908) >+++ Source/WebCore/rendering/RenderBlock.cpp (working copy) >@@ -2320,7 +2320,7 @@ LayoutUnit RenderBlock::adjustLogicalLef > return left; > > // FIXME: Should letter-spacing apply? This is complicated since it doesn't apply at the edge? >- float maxCharWidth = lineGrid->style().font().primaryFont()->maxCharWidth(); >+ float maxCharWidth = lineGrid->style().font().primaryFontData().maxCharWidth(); > if (!maxCharWidth) > return left; > >@@ -2360,7 +2360,7 @@ LayoutUnit RenderBlock::adjustLogicalRig > return right; > > // FIXME: Should letter-spacing apply? This is complicated since it doesn't apply at the edge? >- float maxCharWidth = lineGrid->style().font().primaryFont()->maxCharWidth(); >+ float maxCharWidth = lineGrid->style().font().primaryFontData().maxCharWidth(); > if (!maxCharWidth) > return right; > >@@ -3694,7 +3694,7 @@ static inline TextRun constructTextRunIn > bool directionalOverride = style.rtlOrdering() == VisualOrder; > > TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride); >- if (font.primaryFont()->isSVGFont()) { >+ if (font.primaryFontData().isSVGFont()) { > ASSERT(context); // FIXME: Thread a RenderObject& to this point so we don't have to dereference anything. > run.setRenderingContext(SVGTextRunRenderingContext::create(*context)); > } >@@ -3714,7 +3714,7 @@ static inline TextRun constructTextRunIn > directionalOverride |= isOverride(style.unicodeBidi()); > } > TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride); >- if (font.primaryFont()->isSVGFont()) { >+ if (font.primaryFontData().isSVGFont()) { > ASSERT(context); // FIXME: Thread a RenderObject& to this point so we don't have to dereference anything. > run.setRenderingContext(SVGTextRunRenderingContext::create(*context)); > } >Index: Source/WebCore/rendering/RenderTextControlSingleLine.cpp >=================================================================== >--- Source/WebCore/rendering/RenderTextControlSingleLine.cpp (revision 177908) >+++ Source/WebCore/rendering/RenderTextControlSingleLine.cpp (working copy) >@@ -346,7 +346,7 @@ LayoutUnit RenderTextControlSingleLine:: > if (family == "Lucida Grande") > maxCharWidth = scaleEmToUnits(4027); > else if (style().font().hasValidAverageCharWidth()) >- maxCharWidth = roundf(style().font().primaryFont()->maxCharWidth()); >+ maxCharWidth = roundf(style().font().primaryFontData().maxCharWidth()); > #endif > > // For text inputs, IE adds some extra width. >Index: Source/WebCore/rendering/RenderThemeIOS.mm >=================================================================== >--- Source/WebCore/rendering/RenderThemeIOS.mm (revision 177908) >+++ Source/WebCore/rendering/RenderThemeIOS.mm (working copy) >@@ -580,7 +580,7 @@ static void adjustInputElementButtonStyl > Font font = style.font(); > > RenderObject* renderer = inputElement.renderer(); >- if (font.primaryFont()->isSVGFont() && !renderer) >+ if (font.primaryFontData().isSVGFont() && !renderer) > return; > > FontCachePurgePreventer fontCachePurgePreventer; >Index: Source/WebCore/rendering/RootInlineBox.cpp >=================================================================== >--- Source/WebCore/rendering/RootInlineBox.cpp (revision 177908) >+++ Source/WebCore/rendering/RootInlineBox.cpp (working copy) >@@ -901,7 +901,7 @@ void RootInlineBox::ascentAndDescentForB > > const RenderStyle& boxLineStyle = box.lineStyle(); > if (usedFonts && !usedFonts->isEmpty() && (includeFont || (boxLineStyle.lineHeight().isNegative() && includeLeading))) { >- usedFonts->append(boxLineStyle.font().primaryFont()); >+ usedFonts->append(&boxLineStyle.font().primaryFontData()); > for (size_t i = 0; i < usedFonts->size(); ++i) { > const FontMetrics& fontMetrics = usedFonts->at(i)->fontMetrics(); > int usedFontAscent = fontMetrics.ascent(baselineType()); >Index: Source/WebCore/rendering/SimpleLineLayout.cpp >=================================================================== >--- Source/WebCore/rendering/SimpleLineLayout.cpp (revision 177908) >+++ Source/WebCore/rendering/SimpleLineLayout.cpp (working copy) >@@ -178,10 +178,10 @@ bool canUseFor(const RenderBlockFlow& fl > } > } > } >- if (style.font().primaryFont()->isSVGFont()) >+ if (style.font().primaryFontData().isSVGFont()) > return false; > // We assume that all lines have metrics based purely on the primary font. >- auto& primaryFontData = *style.font().primaryFont(); >+ auto& primaryFontData = style.font().primaryFontData(); > if (primaryFontData.isLoading()) > return false; > for (const auto& textRenderer : childrenOfType<RenderText>(flow)) { >Index: Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp >=================================================================== >--- Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (revision 177908) >+++ Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (working copy) >@@ -1522,7 +1522,7 @@ bool RenderMathMLOperator::getGlyphAssem > if (!bottom.glyph) > bottom.glyph = extension.glyph; > >- top.fontData = style().font().primaryFont(); >+ top.fontData = &style().font().primaryFontData(); > extension.fontData = top.fontData; > bottom.fontData = top.fontData; > if (middle.glyph) >@@ -1539,24 +1539,24 @@ RenderMathMLOperator::StretchyData Rende > > ASSERT(m_isVertical && isLargeOperatorInDisplayStyle()); > >- const auto& primaryFontData = style().font().primaryFont(); >+ const auto& primaryFontData = style().font().primaryFontData(); > GlyphData baseGlyph = style().font().glyphDataForCharacter(character, !style().isLeftToRightDirection()); >- if (!primaryFontData || !primaryFontData->mathData() || baseGlyph.fontData != primaryFontData) >+ if (!primaryFontData.mathData() || baseGlyph.fontData != &primaryFontData) > return data; > > Vector<Glyph> sizeVariants; > Vector<OpenTypeMathData::AssemblyPart> assemblyParts; > > // The value of displayOperatorMinHeight is sometimes too small, so we ensure that it is at least \sqrt{2} times the size of the base glyph. >- float displayOperatorMinHeight = std::max(baseGlyph.fontData->boundsForGlyph(baseGlyph.glyph).height() * sqrtOfTwoFloat, primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::DisplayOperatorMinHeight)); >+ float displayOperatorMinHeight = std::max(baseGlyph.fontData->boundsForGlyph(baseGlyph.glyph).height() * sqrtOfTwoFloat, primaryFontData.mathData()->getMathConstant(primaryFontData, OpenTypeMathData::DisplayOperatorMinHeight)); > >- primaryFontData->mathData()->getMathVariants(baseGlyph.glyph, true, sizeVariants, assemblyParts); >+ primaryFontData.mathData()->getMathVariants(baseGlyph.glyph, true, sizeVariants, assemblyParts); > > // We choose the first size variant that is larger than the expected displayOperatorMinHeight and otherwise fallback to the largest variant. > for (auto& variant : sizeVariants) { > GlyphData sizeVariant; > sizeVariant.glyph = variant; >- sizeVariant.fontData = primaryFontData; >+ sizeVariant.fontData = &primaryFontData; > data.setSizeVariantMode(sizeVariant); > if (boundsForGlyph(sizeVariant).height() >= displayOperatorMinHeight) > return data; >@@ -1571,18 +1571,18 @@ RenderMathMLOperator::StretchyData Rende > StretchyData data; > StretchyData assemblyData; > >- const auto& primaryFontData = style().font().primaryFont(); >+ const auto& primaryFontData = style().font().primaryFontData(); > GlyphData baseGlyph = style().font().glyphDataForCharacter(character, !style().isLeftToRightDirection()); > >- if (primaryFontData && primaryFontData->mathData() && baseGlyph.fontData == primaryFontData) { >+ if (primaryFontData.mathData() && baseGlyph.fontData == &primaryFontData) { > Vector<Glyph> sizeVariants; > Vector<OpenTypeMathData::AssemblyPart> assemblyParts; >- primaryFontData->mathData()->getMathVariants(baseGlyph.glyph, m_isVertical, sizeVariants, assemblyParts); >+ primaryFontData.mathData()->getMathVariants(baseGlyph.glyph, m_isVertical, sizeVariants, assemblyParts); > // We verify the size variants. > for (auto& variant : sizeVariants) { > GlyphData sizeVariant; > sizeVariant.glyph = variant; >- sizeVariant.fontData = primaryFontData; >+ sizeVariant.fontData = &primaryFontData; > if (maximumGlyphWidth) > *maximumGlyphWidth = std::max(*maximumGlyphWidth, advanceForGlyph(sizeVariant)); > else { >@@ -1983,8 +1983,8 @@ void RenderMathMLOperator::paintChildren > > LayoutUnit RenderMathMLOperator::trailingSpaceError() > { >- const auto& primaryFontData = style().font().primaryFont(); >- if (!primaryFontData || !primaryFontData->mathData()) >+ const auto& primaryFontData = style().font().primaryFontData(); >+ if (!primaryFontData.mathData()) > return 0; > > // For OpenType MATH font, the layout is based on RenderMathOperator for which the preferred width is sometimes overestimated (bug https://bugs.webkit.org/show_bug.cgi?id=130326). >Index: Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.cpp >=================================================================== >--- Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.cpp (revision 177908) >+++ Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.cpp (working copy) >@@ -63,8 +63,7 @@ RenderMathMLRadicalOperator::RenderMathM > > void RenderMathMLRadicalOperator::stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline) > { >- const auto& primaryFontData = style().font().primaryFont(); >- if (!primaryFontData || !primaryFontData->mathData()) { >+ if (!style().font().primaryFontData().mathData()) { > // If we do not have an OpenType MATH font, we always make the radical depth a bit larger than the target. > depthBelowBaseline += gRadicalBottomPointLower; > } >@@ -84,8 +83,7 @@ void RenderMathMLRadicalOperator::comput > { > ASSERT(preferredLogicalWidthsDirty()); > >- const auto& primaryFontData = style().font().primaryFont(); >- if (primaryFontData && primaryFontData->mathData()) { >+ if (style().font().primaryFontData().mathData()) { > RenderMathMLOperator::computePreferredLogicalWidths(); > return; > } >@@ -98,8 +96,7 @@ void RenderMathMLRadicalOperator::comput > > void RenderMathMLRadicalOperator::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const > { >- const auto& primaryFontData = style().font().primaryFont(); >- if (primaryFontData && primaryFontData->mathData()) { >+ if (style().font().primaryFontData().mathData()) { > RenderMathMLOperator::computeLogicalHeight(logicalHeight, logicalTop, computedValues); > return; > } >@@ -114,8 +111,7 @@ void RenderMathMLRadicalOperator::paint( > if (info.context->paintingDisabled() || info.phase != PaintPhaseForeground || style().visibility() != VISIBLE) > return; > >- const auto& primaryFontData = style().font().primaryFont(); >- if (primaryFontData && primaryFontData->mathData()) { >+ if (style().font().primaryFontData().mathData()) { > RenderMathMLOperator::paint(info, paintOffset); > return; > } >Index: Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp >=================================================================== >--- Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp (revision 177908) >+++ Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp (working copy) >@@ -208,17 +208,17 @@ void RenderMathMLRoot::updateStyle() > LayoutUnit kernAfterDegree = -10 * style().font().size() / 18; > m_degreeBottomRaisePercent = 0.6f; > >- const auto& primaryFontData = style().font().primaryFont(); >- if (primaryFontData && primaryFontData->mathData()) { >+ const auto& primaryFontData = style().font().primaryFontData(); >+ if (auto* mathData = style().font().primaryFontData().mathData()) { > // FIXME: m_verticalGap should use RadicalDisplayStyleVertical in display mode (https://bugs.webkit.org/show_bug.cgi?id=118737). >- m_verticalGap = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalVerticalGap); >- m_ruleThickness = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalRuleThickness); >- m_extraAscender = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalExtraAscender); >+ m_verticalGap = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalVerticalGap); >+ m_ruleThickness = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalRuleThickness); >+ m_extraAscender = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalExtraAscender); > > if (!isRenderMathMLSquareRoot()) { >- kernBeforeDegree = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalKernBeforeDegree); >- kernAfterDegree = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalKernAfterDegree); >- m_degreeBottomRaisePercent = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalDegreeBottomRaisePercent); >+ kernBeforeDegree = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalKernBeforeDegree); >+ kernAfterDegree = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalKernAfterDegree); >+ m_degreeBottomRaisePercent = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalDegreeBottomRaisePercent); > } > } > >Index: Source/WebCore/rendering/style/RenderStyle.cpp >=================================================================== >--- Source/WebCore/rendering/style/RenderStyle.cpp (revision 177908) >+++ Source/WebCore/rendering/style/RenderStyle.cpp (working copy) >@@ -1184,7 +1184,7 @@ const AtomicString& RenderStyle::hyphenS > // FIXME: This should depend on locale. > DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, hyphenMinusString, (&hyphenMinus, 1)); > DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, hyphenString, (&hyphen, 1)); >- return font().primaryFontHasGlyphForCharacter(hyphen) ? hyphenString : hyphenMinusString; >+ return font().primaryFontData().glyphForCharacter(hyphen) ? hyphenString : hyphenMinusString; > } > > const AtomicString& RenderStyle::textEmphasisMarkString() const >Index: Source/WebCore/rendering/svg/SVGInlineTextBox.cpp >=================================================================== >--- Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (revision 177908) >+++ Source/WebCore/rendering/svg/SVGInlineTextBox.cpp (working copy) >@@ -422,7 +422,7 @@ TextRun SVGInlineTextBox::constructTextR > , direction() > , dirOverride() || style->rtlOrdering() == VisualOrder /* directionalOverride */); > >- if (style->font().primaryFont()->isSVGFont()) >+ if (style->font().primaryFontData().isSVGFont()) > run.setRenderingContext(SVGTextRunRenderingContext::create(renderer())); > > run.disableRoundingHacks(); >Index: Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.cpp >=================================================================== >--- Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.cpp (revision 177908) >+++ Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.cpp (working copy) >@@ -41,16 +41,16 @@ SVGTextLayoutEngineSpacing::SVGTextLayou > float SVGTextLayoutEngineSpacing::calculateSVGKerning(bool isVerticalText, const SVGTextMetrics::Glyph& currentGlyph) > { > #if ENABLE(SVG_FONTS) >- const SimpleFontData* fontData = m_font.primaryFont(); >- if (!fontData->isSVGFont()) { >+ const SimpleFontData& fontData = m_font.primaryFontData(); >+ if (!fontData.isSVGFont()) { > m_lastGlyph.isValid = false; > return 0; > } > >- ASSERT(fontData->isCustomFont()); >- ASSERT(fontData->isSVGFont()); >+ ASSERT(fontData.isCustomFont()); >+ ASSERT(fontData.isSVGFont()); > >- const SVGFontData* svgFontData = static_cast<const SVGFontData*>(fontData->fontData()); >+ const SVGFontData* svgFontData = static_cast<const SVGFontData*>(fontData.fontData()); > SVGFontFaceElement* svgFontFace = svgFontData->svgFontFaceElement(); > ASSERT(svgFontFace); > >Index: Source/WebCore/rendering/svg/SVGTextMetrics.cpp >=================================================================== >--- Source/WebCore/rendering/svg/SVGTextMetrics.cpp (revision 177908) >+++ Source/WebCore/rendering/svg/SVGTextMetrics.cpp (working copy) >@@ -70,7 +70,7 @@ TextRun SVGTextMetrics::constructTextRun > , style.direction() > , isOverride(style.unicodeBidi()) /* directionalOverride */); > >- if (style.font().primaryFont()->isSVGFont()) >+ if (style.font().primaryFontData().isSVGFont()) > run.setRenderingContext(SVGTextRunRenderingContext::create(text)); > > run.disableRoundingHacks(); >@@ -91,7 +91,7 @@ SVGTextMetrics SVGTextMetrics::measureCh > > SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText& text, unsigned position, unsigned length, float width, const String& glyphName) > { >- bool needsContext = text.style().font().primaryFont()->isSVGFont(); >+ bool needsContext = text.style().font().primaryFontData().isSVGFont(); > float scalingFactor = text.scalingFactor(); > ASSERT(scalingFactor); > >Index: Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp >=================================================================== >--- Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp (revision 177908) >+++ Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp (working copy) >@@ -292,13 +292,13 @@ void SVGTextRunRenderingContext::drawSVG > > static GlyphData missingGlyphForFont(const Font& font) > { >- const SimpleFontData* primaryFontData = font.primaryFont(); >- if (!primaryFontData->isSVGFont()) >+ const SimpleFontData& primaryFontData = font.primaryFontData(); >+ if (!primaryFontData.isSVGFont()) > return GlyphData(); > SVGFontElement* fontElement; > SVGFontFaceElement* fontFaceElement; >- svgFontAndFontFaceElementForFontData(primaryFontData, fontFaceElement, fontElement); >- return GlyphData(fontElement->missingGlyph(), primaryFontData); >+ svgFontAndFontFaceElementForFontData(&primaryFontData, fontFaceElement, fontElement); >+ return GlyphData(fontElement->missingGlyph(), &primaryFontData); > } > > GlyphData SVGTextRunRenderingContext::glyphDataForCharacter(const Font& font, WidthIterator& iterator, UChar32 character, bool mirror, int currentCharacter, unsigned& advanceLength, String& normalizedSpacesStringCache) >@@ -314,7 +314,7 @@ GlyphData SVGTextRunRenderingContext::gl > auto& elementRenderer = is<RenderElement>(renderer()) ? downcast<RenderElement>(renderer()) : *renderer().parent(); > if (Element* parentRendererElement = elementRenderer.element()) { > if (is<SVGAltGlyphElement>(*parentRendererElement)) >- glyphData.fontData = font.primaryFont(); >+ glyphData.fontData = &font.primaryFontData(); > } > } > >Index: Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm >=================================================================== >--- Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm (revision 177908) >+++ Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm (working copy) >@@ -39,7 +39,7 @@ void WebPopupMenu::setUpPlatformData(con > { > #if USE(APPKIT) > // FIXME: font will be nil here for custom fonts, we should fix that. >- NSFont *font = m_popupClient->menuStyle().font().primaryFont()->getNSFont(); >+ NSFont *font = m_popupClient->menuStyle().font().primaryFontData().getNSFont(); > if (!font) > return; > >Index: Source/WebKit2/WebProcess/WebPage/WebPage.cpp >=================================================================== >--- Source/WebKit2/WebProcess/WebPage/WebPage.cpp (revision 177908) >+++ Source/WebKit2/WebProcess/WebPage/WebPage.cpp (working copy) >@@ -800,7 +800,7 @@ EditorState WebPage::editorState() const > if (!selection.isNone()) { > Node* nodeToRemove; > if (RenderStyle* style = Editor::styleForSelectionStart(&frame, nodeToRemove)) { >- CTFontRef font = style->font().primaryFont()->getCTFont(); >+ CTFontRef font = style->font().primaryFontData().getCTFont(); > CTFontSymbolicTraits traits = font ? CTFontGetSymbolicTraits(font) : 0; > > if (traits & kCTFontTraitBold) >Index: Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm >=================================================================== >--- Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm (revision 177908) >+++ Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm (working copy) >@@ -81,9 +81,9 @@ void PopupMenuMac::populate() > PopupMenuStyle style = m_client->itemStyle(i); > RetainPtr<NSMutableDictionary> attributes = adoptNS([[NSMutableDictionary alloc] init]); > if (style.font() != Font()) { >- NSFont *font = style.font().primaryFont()->getNSFont(); >+ NSFont *font = style.font().primaryFontData().getNSFont(); > if (!font) { >- CGFloat size = style.font().primaryFont()->platformData().size(); >+ CGFloat size = style.font().primaryFontData().platformData().size(); > font = style.font().weight() < FontWeightBold ? [NSFont systemFontOfSize:size] : [NSFont boldSystemFontOfSize:size]; > } > [attributes setObject:font forKey:NSFontAttributeName]; >@@ -148,7 +148,7 @@ void PopupMenuMac::show(const IntRect& r > NSMenu* menu = [m_popup menu]; > > NSPoint location; >- NSFont* font = m_client->menuStyle().font().primaryFont()->getNSFont(); >+ NSFont* font = m_client->menuStyle().font().primaryFontData().getNSFont(); > > // These values were borrowed from AppKit to match their placement of the menu. > const int popOverHorizontalAdjust = -10;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 140081
:
243977
|
243978