Changeset 177955 in webkit


Ignore:
Timestamp:
Jan 6, 2015, 3:23:58 AM (10 years ago)
Author:
Antti Koivisto
Message:

Font::primaryFontData() should return a reference
https://bugs.webkit.org/show_bug.cgi?id=140081

Reviewed by Darin Adler.

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):

Location:
trunk/Source
Files:
38 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r177954 r177955  
     12015-01-05  Antti Koivisto  <antti@apple.com>
     2
     3        Font::primaryFontData() should return a reference
     4        https://bugs.webkit.org/show_bug.cgi?id=140081
     5
     6        Reviewed by Darin Adler.
     7
     8        It is not null.
     9
     10        Also rename primaryFont() -> primaryFontData().
     11
     12        * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
     13        (AXAttributeStringSetStyle):
     14        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
     15        (AXAttributeStringSetStyle):
     16        * bindings/objc/DOM.mm:
     17        (-[DOMElement _font]):
     18        * editing/cocoa/HTMLConverter.mm:
     19        (_font):
     20        (WebCore::editingAttributedStringFromRange):
     21        * editing/ios/EditorIOS.mm:
     22        (WebCore::Editor::fontForSelection):
     23        (WebCore::Editor::fontAttributesForSelectionStart):
     24        * editing/mac/EditorMac.mm:
     25        (WebCore::Editor::fontForSelection):
     26        (WebCore::Editor::fontAttributesForSelectionStart):
     27        * platform/graphics/Font.cpp:
     28        (WebCore::Font::fastAverageCharWidthIfAvailable):
     29        * platform/graphics/Font.h:
     30        (WebCore::Font::fontMetrics):
     31        (WebCore::Font::spaceWidth):
     32        (WebCore::Font::tabWidth):
     33        (WebCore::Font::primaryFontData):
     34        (WebCore::Font::primaryFont): Deleted.
     35        * platform/graphics/FontFastPath.cpp:
     36        (WebCore::Font::primaryFontHasGlyphForCharacter):
     37        * platform/graphics/FontGlyphs.cpp:
     38        (WebCore::FontGlyphs::determinePitch):
     39        (WebCore::FontGlyphs::glyphDataForSystemFallback):
     40        (WebCore::FontGlyphs::glyphDataForCharacter):
     41        * platform/graphics/FontGlyphs.h:
     42        (WebCore::FontGlyphs::primaryFontData):
     43        (WebCore::FontGlyphs::primarySimpleFontData):
     44        * platform/graphics/WidthIterator.cpp:
     45        (WebCore::WidthIterator::advanceInternal):
     46        * platform/graphics/mac/ComplexTextController.cpp:
     47        (WebCore::ComplexTextController::advance):
     48        (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
     49        * platform/graphics/mac/ComplexTextController.h:
     50        (WebCore::ComplexTextController::ComplexTextRun::create):
     51        (WebCore::ComplexTextController::ComplexTextRun::fontData):
     52        * platform/graphics/mac/ComplexTextControllerCoreText.mm:
     53        (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
     54        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
     55        * platform/graphics/mac/FontMac.mm:
     56        (WebCore::Font::primaryFontDataIsSystemFont):
     57        * platform/graphics/opentype/OpenTypeMathData.cpp:
     58        * platform/graphics/opentype/OpenTypeMathData.h:
     59        * rendering/InlineFlowBox.cpp:
     60        (WebCore::InlineFlowBox::requiresIdeographicBaseline):
     61        * rendering/InlineTextBox.cpp:
     62        (WebCore::InlineTextBox::constructTextRun):
     63        * rendering/RenderBlock.cpp:
     64        (WebCore::RenderBlock::adjustLogicalLeftOffsetForLine):
     65        (WebCore::RenderBlock::adjustLogicalRightOffsetForLine):
     66        (WebCore::constructTextRunInternal):
     67        * rendering/RenderTextControlSingleLine.cpp:
     68        (WebCore::RenderTextControlSingleLine::preferredContentLogicalWidth):
     69        * rendering/RenderThemeIOS.mm:
     70        (WebCore::adjustInputElementButtonStyle):
     71        * rendering/RootInlineBox.cpp:
     72        (WebCore::RootInlineBox::ascentAndDescentForBox):
     73        * rendering/SimpleLineLayout.cpp:
     74        (WebCore::SimpleLineLayout::canUseFor):
     75        * rendering/mathml/RenderMathMLOperator.cpp:
     76        (WebCore::RenderMathMLOperator::getGlyphAssemblyFallBack):
     77        (WebCore::RenderMathMLOperator::getDisplayStyleLargeOperator):
     78        (WebCore::RenderMathMLOperator::findStretchyData):
     79        (WebCore::RenderMathMLOperator::trailingSpaceError):
     80        * rendering/mathml/RenderMathMLRadicalOperator.cpp:
     81        (WebCore::RenderMathMLRadicalOperator::stretchTo):
     82        (WebCore::RenderMathMLRadicalOperator::computePreferredLogicalWidths):
     83        (WebCore::RenderMathMLRadicalOperator::computeLogicalHeight):
     84        (WebCore::RenderMathMLRadicalOperator::paint):
     85        * rendering/mathml/RenderMathMLRoot.cpp:
     86        (WebCore::RenderMathMLRoot::updateStyle):
     87        * rendering/svg/SVGInlineTextBox.cpp:
     88        (WebCore::SVGInlineTextBox::constructTextRun):
     89        * rendering/svg/SVGTextLayoutEngineSpacing.cpp:
     90        (WebCore::SVGTextLayoutEngineSpacing::calculateSVGKerning):
     91        * rendering/svg/SVGTextMetrics.cpp:
     92        (WebCore::SVGTextMetrics::constructTextRun):
     93        (WebCore::SVGTextMetrics::SVGTextMetrics):
     94        * rendering/svg/SVGTextRunRenderingContext.cpp:
     95        (WebCore::missingGlyphForFont):
     96        (WebCore::SVGTextRunRenderingContext::glyphDataForCharacter):
     97
    1982015-01-06  Shivakumar JM  <shiva.jm@samsung.com>
    299
  • trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm

    r176948 r177955  
    17591759   
    17601760    // set basic font info
    1761     AXAttributeStringSetFont(attrString, style.font().primaryFont()->getCTFont(), range);
     1761    AXAttributeStringSetFont(attrString, style.font().primaryFontData().getCTFont(), range);
    17621762               
    17631763    int decor = style.textDecorationsInEffect();
  • trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm

    r177536 r177955  
    849849   
    850850    // set basic font info
    851     AXAttributeStringSetFont(attrString, NSAccessibilityFontTextAttribute, style.font().primaryFont()->getNSFont(), range);
     851    AXAttributeStringSetFont(attrString, NSAccessibilityFontTextAttribute, style.font().primaryFontData().getNSFont(), range);
    852852   
    853853    // set basic colors
  • trunk/Source/WebCore/bindings/objc/DOM.mm

    r177297 r177955  
    670670    if (!renderer)
    671671        return nil;
    672     return renderer->style().font().primaryFont()->getNSFont();
     672    return renderer->style().font().primaryFontData().getNSFont();
    673673}
    674674#else
     
    678678    if (!renderer)
    679679        return nil;
    680     return renderer->style().font().primaryFont()->getCTFont();
     680    return renderer->style().font().primaryFontData().getCTFont();
    681681}
    682682#endif
  • trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm

    r176910 r177955  
    11151115    if (!renderer)
    11161116        return nil;
    1117     return renderer->style().font().primaryFont()->getNSFont();
     1117    return renderer->style().font().primaryFontData().getNSFont();
    11181118}
    11191119#else
     
    11231123    if (!renderer)
    11241124        return nil;
    1125     return (PlatformFont *)renderer->style().font().primaryFont()->getCTFont();
     1125    return (PlatformFont *)renderer->style().font().primaryFontData().getCTFont();
    11261126}
    11271127#endif
     
    25952595        if (style.textDecorationsInEffect() & TextDecorationLineThrough)
    25962596            [attrs.get() setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName];
    2597         if (NSFont *font = style.font().primaryFont()->getNSFont())
     2597        if (NSFont *font = style.font().primaryFontData().getNSFont())
    25982598            [attrs.get() setObject:font forKey:NSFontAttributeName];
    25992599        else
    2600             [attrs.get() setObject:[fontManager convertFont:WebDefaultFont() toSize:style.font().primaryFont()->platformData().size()] forKey:NSFontAttributeName];
     2600            [attrs.get() setObject:[fontManager convertFont:WebDefaultFont() toSize:style.font().primaryFontData().platformData().size()] forKey:NSFontAttributeName];
    26012601        if (style.visitedDependentColor(CSSPropertyColor).alpha())
    26022602            [attrs.get() setObject:nsColor(style.visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName];
  • trunk/Source/WebCore/editing/ios/EditorIOS.mm

    r175549 r177955  
    212212        RenderStyle* style = styleForSelectionStart(&m_frame, nodeToRemove); // sets nodeToRemove
    213213
    214         const SimpleFontData* result = 0;
     214        const SimpleFontData* result = nullptr;
    215215        if (style)
    216             result = style->font().primaryFont();
     216            result = &style->font().primaryFontData();
    217217
    218218        if (nodeToRemove) {
     
    236236                continue;
    237237            // FIXME: Are there any node types that have renderers, but that we should be skipping?
    238             const SimpleFontData* primaryFont = renderer->style().font().primaryFont();
     238            const SimpleFontData& primaryFont = renderer->style().font().primaryFontData();
    239239            if (!font)
    240                 font = primaryFont;
    241             else if (font != primaryFont) {
     240                font = &primaryFont;
     241            else if (font != &primaryFont) {
    242242                hasMultipleFonts = true;
    243243                break;
     
    258258    NSMutableDictionary* result = [NSMutableDictionary dictionary];
    259259   
    260     CTFontRef font = style->font().primaryFont()->getCTFont();
     260    CTFontRef font = style->font().primaryFontData().getCTFont();
    261261    if (font)
    262262        [result setObject:(id)font forKey:NSFontAttributeName];
  • trunk/Source/WebCore/editing/mac/EditorMac.mm

    r175549 r177955  
    114114        RenderStyle* style = styleForSelectionStart(&m_frame, nodeToRemove); // sets nodeToRemove
    115115
    116         const SimpleFontData* result = 0;
     116        const SimpleFontData* result = nullptr;
    117117        if (style)
    118             result = style->font().primaryFont();
     118            result = &style->font().primaryFontData();
    119119
    120120        if (nodeToRemove)
     
    136136                continue;
    137137            // FIXME: Are there any node types that have renderers, but that we should be skipping?
    138             const SimpleFontData* primaryFont = renderer->style().font().primaryFont();
     138            const SimpleFontData& primaryFont = renderer->style().font().primaryFontData();
    139139            if (!font)
    140                 font = primaryFont;
    141             else if (font != primaryFont) {
     140                font = &primaryFont;
     141            else if (font != &primaryFont) {
    142142                hasMultipleFonts = true;
    143143                break;
     
    161161        [result setObject:nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)) forKey:NSBackgroundColorAttributeName];
    162162
    163     if (style->font().primaryFont()->getNSFont())
    164         [result setObject:style->font().primaryFont()->getNSFont() forKey:NSFontAttributeName];
     163    if (style->font().primaryFontData().getNSFont())
     164        [result setObject:style->font().primaryFontData().getNSFont() forKey:NSFontAttributeName];
    165165
    166166    if (style->visitedDependentColor(CSSPropertyColor).isValid() && style->visitedDependentColor(CSSPropertyColor) != Color::black)
  • trunk/Source/WebCore/platform/graphics/Font.cpp

    r177262 r177955  
    507507    bool success = hasValidAverageCharWidth();
    508508    if (success)
    509         width = roundf(primaryFont()->avgCharWidth()); // FIXME: primaryFont() might not correspond to firstFamily().
     509        width = roundf(primaryFontData().avgCharWidth()); // FIXME: primaryFontData() might not correspond to firstFamily().
    510510    return success;
    511511}
  • trunk/Source/WebCore/platform/graphics/Font.h

    r177490 r177955  
    173173    bool isPlatformFont() const { return m_glyphs->isForPlatformFont(); }
    174174
    175     const FontMetrics& fontMetrics() const { return primaryFont()->fontMetrics(); }
    176     float spaceWidth() const { return primaryFont()->spaceWidth() + m_letterSpacing; }
     175    const FontMetrics& fontMetrics() const { return primaryFontData().fontMetrics(); }
     176    float spaceWidth() const { return primaryFontData().spaceWidth() + m_letterSpacing; }
    177177    float tabWidth(const SimpleFontData&, unsigned tabSize, float position) const;
    178     float tabWidth(unsigned tabSize, float position) const { return tabWidth(*primaryFont(), tabSize, position); }
     178    float tabWidth(unsigned tabSize, float position) const { return tabWidth(primaryFontData(), tabSize, position); }
    179179    bool hasValidAverageCharWidth() const;
    180180    bool fastAverageCharWidthIfAvailable(float &width) const; // returns true on success
     
    184184    int emphasisMarkHeight(const AtomicString&) const;
    185185
    186     const SimpleFontData* primaryFont() const;
     186    const SimpleFontData& primaryFontData() const;
    187187    const FontData* fontDataAt(unsigned) const;
    188188    GlyphData glyphDataForCharacter(UChar32 c, bool mirror, FontDataVariant variant = AutoVariant) const
     
    193193    const SimpleFontData* fontDataForCombiningCharacterSequence(const UChar*, size_t length, FontDataVariant) const;
    194194#endif
    195     bool primaryFontHasGlyphForCharacter(UChar32) const;
    196195
    197196    static bool isCJKIdeograph(UChar32);
     
    358357}
    359358
    360 inline const SimpleFontData* Font::primaryFont() const
     359inline const SimpleFontData& Font::primaryFontData() const
    361360{
    362361    ASSERT(m_glyphs);
  • trunk/Source/WebCore/platform/graphics/FontFastPath.cpp

    r177876 r177955  
    4040
    4141namespace WebCore {
    42 
    43 bool Font::primaryFontHasGlyphForCharacter(UChar32 character) const
    44 {
    45     return primaryFont()->glyphForCharacter(character);
    46 }
    4742
    4843// FIXME: This function may not work if the emphasis mark uses a complex script, but none of the
  • trunk/Source/WebCore/platform/graphics/FontGlyphs.cpp

    r177881 r177955  
    7676void FontGlyphs::determinePitch(const FontDescription& description)
    7777{
    78     const FontData* fontData = primaryFontData(description);
    79     if (is<SimpleFontData>(*fontData))
    80         m_pitch = downcast<SimpleFontData>(*fontData).pitch();
     78    const FontData& fontData = *realizeFontDataAt(description, 0);
     79    if (is<SimpleFontData>(fontData))
     80        m_pitch = downcast<SimpleFontData>(fontData).pitch();
    8181    else {
    82         const SegmentedFontData& segmentedFontData = downcast<SegmentedFontData>(*fontData);
     82        const SegmentedFontData& segmentedFontData = downcast<SegmentedFontData>(fontData);
    8383        unsigned numRanges = segmentedFontData.numRanges();
    8484        if (numRanges == 1)
     
    246246{
    247247    // System fallback is character-dependent.
    248     auto* originalFontData = primaryFontData(description)->simpleFontDataForCharacter(c);
     248    auto& primaryFontData = *realizeFontDataAt(description, 0);
     249    auto* originalFontData = primaryFontData.simpleFontDataForCharacter(c);
    249250    if (!originalFontData)
    250         originalFontData = &primaryFontData(description)->simpleFontDataForFirstRange();
     251        originalFontData = &primaryFontData.simpleFontDataForFirstRange();
    251252
    252253    RefPtr<SimpleFontData> systemFallbackFontData = originalFontData->systemFallbackFontDataForCharacter(c, description, m_isForPlatformFont);
     
    365366
    366367    if (variant == AutoVariant) {
    367         if (description.smallCaps() && !primarySimpleFontData(description)->isSVGFont()) {
     368        if (description.smallCaps() && !primarySimpleFontData(description).isSVGFont()) {
    368369            UChar32 upperC = u_toupper(c);
    369370            if (upperC != c) {
     
    386387    RefPtr<GlyphPage>& cachedPage = pageNumber ? m_cachedPages.add(pageNumber, nullptr).iterator->value : m_cachedPageZero;
    387388    if (!cachedPage)
    388         cachedPage = glyphPageFromFontData(pageNumber, *primaryFontData(description));
     389        cachedPage = glyphPageFromFontData(pageNumber, *realizeFontDataAt(description, 0));
    389390
    390391    GlyphData glyphData = cachedPage ? cachedPage->glyphDataForCharacter(c) : GlyphData();
  • trunk/Source/WebCore/platform/graphics/FontGlyphs.h

    r177876 r177955  
    6868    const WidthCache& widthCache() const { return m_widthCache; }
    6969
    70     const SimpleFontData* primarySimpleFontData(const FontDescription&);
    71     const FontData* primaryFontData(const FontDescription& description) { return realizeFontDataAt(description, 0); }
     70    const SimpleFontData& primarySimpleFontData(const FontDescription&);
    7271    WEBCORE_EXPORT const FontData* realizeFontDataAt(const FontDescription&, unsigned index);
    7372
     
    107106};
    108107
    109 inline const SimpleFontData* FontGlyphs::primarySimpleFontData(const FontDescription& description)
     108inline const SimpleFontData& FontGlyphs::primarySimpleFontData(const FontDescription& description)
    110109{
    111110    ASSERT(isMainThread());
    112111    if (!m_cachedPrimarySimpleFontData) {
    113         auto* fontData = primaryFontData(description);
    114         m_cachedPrimarySimpleFontData = fontData->simpleFontDataForCharacter(' ');
     112        auto& fontData = *realizeFontDataAt(description, 0);
     113        m_cachedPrimarySimpleFontData = fontData.simpleFontDataForCharacter(' ');
    115114        if (!m_cachedPrimarySimpleFontData)
    116             m_cachedPrimarySimpleFontData = &fontData->simpleFontDataForFirstRange();
     115            m_cachedPrimarySimpleFontData = &fontData.simpleFontDataForFirstRange();
    117116    }
    118     return m_cachedPrimarySimpleFontData;
     117    return *m_cachedPrimarySimpleFontData;
    119118}
    120119
  • trunk/Source/WebCore/platform/graphics/WidthIterator.cpp

    r177637 r177955  
    167167    FloatRect bounds;
    168168
    169     const SimpleFontData* primaryFont = m_font->primaryFont();
    170     const SimpleFontData* lastFontData = primaryFont;
     169    const SimpleFontData& primaryFontData = m_font->primaryFontData();
     170    const SimpleFontData* lastFontData = &primaryFontData;
    171171    int lastGlyphCount = glyphBuffer ? glyphBuffer->size() : 0;
    172172
     
    212212
    213213            lastFontData = fontData;
    214             if (m_fallbackFonts && fontData != primaryFont) {
     214            if (m_fallbackFonts && fontData != &primaryFontData) {
    215215                // FIXME: This does a little extra work that could be avoided if
    216216                // glyphDataForCharacter() returned whether it chose to use a small caps font.
     
    219219                else {
    220220                    const GlyphData& uppercaseGlyphData = m_font->glyphDataForCharacter(u_toupper(character), rtl);
    221                     if (uppercaseGlyphData.fontData != primaryFont)
     221                    if (uppercaseGlyphData.fontData != &primaryFontData)
    222222                        m_fallbackFonts->add(uppercaseGlyphData.fontData);
    223223                }
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp

    r175824 r177955  
    495495        unsigned g = ltr ? m_glyphInCurrentRun : glyphCount - 1 - m_glyphInCurrentRun;
    496496        unsigned k = leftmostGlyph + g;
    497         if (fallbackFonts && complexTextRun.fontData() != m_font.primaryFont())
    498             fallbackFonts->add(complexTextRun.fontData());
     497        if (fallbackFonts && &complexTextRun.fontData() != &m_font.primaryFontData())
     498            fallbackFonts->add(&complexTextRun.fontData());
    499499
    500500        // We must store the initial advance for the first glyph we are going to draw.
     
    521521
    522522            if (glyphBuffer && !m_characterInCurrentGlyph)
    523                 glyphBuffer->add(m_adjustedGlyphs[k], complexTextRun.fontData(), adjustedAdvance, complexTextRun.indexAt(m_glyphInCurrentRun));
     523                glyphBuffer->add(m_adjustedGlyphs[k], &complexTextRun.fontData(), adjustedAdvance, complexTextRun.indexAt(m_glyphInCurrentRun));
    524524
    525525            unsigned oldCharacterInCurrentGlyph = m_characterInCurrentGlyph;
     
    567567        ComplexTextRun& complexTextRun = *m_complexTextRuns[r];
    568568        unsigned glyphCount = complexTextRun.glyphCount();
    569         const SimpleFontData* fontData = complexTextRun.fontData();
     569        const SimpleFontData& fontData = complexTextRun.fontData();
    570570#if PLATFORM(IOS)
    571         bool isEmoji = fontData->platformData().m_isEmoji;
     571        bool isEmoji = fontData.platformData().m_isEmoji;
    572572#endif
    573573
     
    589589
    590590        bool lastRun = r + 1 == runCount;
    591         bool roundsAdvances = !m_font.isPrinterFont() && fontData->platformData().roundsGlyphAdvances();
    592         float spaceWidth = fontData->spaceWidth() - fontData->syntheticBoldOffset();
     591        bool roundsAdvances = !m_font.isPrinterFont() && fontData.platformData().roundsGlyphAdvances();
     592        float spaceWidth = fontData.spaceWidth() - fontData.syntheticBoldOffset();
    593593        CGFloat roundedSpaceWidth = roundCGFloat(spaceWidth);
    594594        const UChar* cp = complexTextRun.characters();
     
    617617
    618618            bool treatAsSpace = Font::treatAsSpace(ch);
    619             CGGlyph glyph = treatAsSpace ? fontData->spaceGlyph() : glyphs[i];
     619            CGGlyph glyph = treatAsSpace ? fontData.spaceGlyph() : glyphs[i];
    620620            CGSize advance = treatAsSpace ? CGSizeMake(spaceWidth, advances[i].height) : advances[i];
    621621#if PLATFORM(IOS)
     
    625625
    626626            if (ch == '\t' && m_run.allowTabs())
    627                 advance.width = m_font.tabWidth(*fontData, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit);
     627                advance.width = m_font.tabWidth(fontData, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit);
    628628            else if (Font::treatAsZeroWidthSpace(ch) && !treatAsSpace) {
    629629                advance.width = 0;
    630                 glyph = fontData->spaceGlyph();
     630                glyph = fontData.spaceGlyph();
    631631            }
    632632
     
    635635                advance.width = roundedAdvanceWidth;
    636636
    637             advance.width += fontData->syntheticBoldOffset();
     637            advance.width += fontData.syntheticBoldOffset();
    638638
    639639 
     
    642642            // Second, in fixed-pitch fonts we ensure that all glyphs that
    643643            // match the width of the space glyph have the same width as the space glyph.
    644             if (m_run.applyWordRounding() && roundedAdvanceWidth == roundedSpaceWidth && (fontData->pitch() == FixedPitch || glyph == fontData->spaceGlyph()))
    645                 advance.width = fontData->adjustedSpaceWidth();
     644            if (m_run.applyWordRounding() && roundedAdvanceWidth == roundedSpaceWidth && (fontData.pitch() == FixedPitch || glyph == fontData.spaceGlyph()))
     645                advance.width = fontData.adjustedSpaceWidth();
    646646
    647647            if (hasExtraSpacing) {
     
    717717            m_adjustedGlyphs.append(glyph);
    718718           
    719             FloatRect glyphBounds = fontData->boundsForGlyph(glyph);
     719            FloatRect glyphBounds = fontData.boundsForGlyph(glyph);
    720720            glyphBounds.move(glyphOrigin.x, glyphOrigin.y);
    721721            m_minGlyphBoundingBoxX = std::min(m_minGlyphBoundingBoxX, glyphBounds.x());
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h

    r177733 r177955  
    7474    class ComplexTextRun : public RefCounted<ComplexTextRun> {
    7575    public:
    76         static Ref<ComplexTextRun> create(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
     76        static Ref<ComplexTextRun> create(CTRunRef ctRun, const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
    7777        {
    7878            return adoptRef(*new ComplexTextRun(ctRun, fontData, characters, stringLocation, stringLength, runRange));
    7979        }
    8080
    81         static Ref<ComplexTextRun> create(const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
     81        static Ref<ComplexTextRun> create(const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
    8282        {
    8383            return adoptRef(*new ComplexTextRun(fontData, characters, stringLocation, stringLength, ltr));
     
    8585
    8686        unsigned glyphCount() const { return m_glyphCount; }
    87         const SimpleFontData* fontData() const { return m_fontData; }
     87        const SimpleFontData& fontData() const { return m_fontData; }
    8888        const UChar* characters() const { return m_characters; }
    8989        unsigned stringLocation() const { return m_stringLocation; }
     
    101101
    102102    private:
    103         ComplexTextRun(CTRunRef, const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange);
    104         ComplexTextRun(const SimpleFontData*, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr);
     103        ComplexTextRun(CTRunRef, const SimpleFontData&, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange);
     104        ComplexTextRun(const SimpleFontData&, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr);
    105105
    106106        unsigned m_glyphCount;
    107         const SimpleFontData* m_fontData;
     107        const SimpleFontData& m_fontData;
    108108        const UChar* m_characters;
    109109        unsigned m_stringLocation;
  • trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm

    r177876 r177955  
    9595namespace WebCore {
    9696
    97 ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
     97ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
    9898    : m_fontData(fontData)
    9999    , m_characters(characters)
     
    131131// Missing glyphs run constructor. Core Text will not generate a run of missing glyphs, instead falling back on
    132132// glyphs from LastResort. We want to use the primary font's missing glyph in order to match the fast text code path.
    133 ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData* fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
     133ComplexTextController::ComplexTextRun::ComplexTextRun(const SimpleFontData& fontData, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
    134134    : m_fontData(fontData)
    135135    , m_characters(characters)
     
    164164    m_glyphsVector.fill(0, m_glyphCount);
    165165    m_glyphs = m_glyphsVector.data();
    166     m_advancesVector.fill(CGSizeMake(m_fontData->widthForGlyph(0), 0), m_glyphCount);
     166    m_advancesVector.fill(CGSizeMake(m_fontData.widthForGlyph(0), 0), m_glyphCount);
    167167    m_advances = m_advancesVector.data();
    168168}
     
    189189    if (!fontData) {
    190190        // Create a run of missing glyphs from the primary font.
    191         m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation, length, m_run.ltr()));
     191        m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFontData(), cp, stringLocation, length, m_run.ltr()));
    192192        return;
    193193    }
     
    274274                    RetainPtr<CFStringRef> fontName = adoptCF(CTFontCopyPostScriptName(runFont));
    275275                    if (CFEqual(fontName.get(), CFSTR("LastResort"))) {
    276                         m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation + runRange.location, runRange.length, m_run.ltr()));
     276                        m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFontData(), cp, stringLocation + runRange.location, runRange.length, m_run.ltr()));
    277277                        continue;
    278278                    }
     
    290290#endif
    291291                }
    292                 if (m_fallbackFonts && runFontData != m_font.primaryFont())
     292                if (m_fallbackFonts && runFontData != &m_font.primaryFontData())
    293293                    m_fallbackFonts->add(runFontData);
    294294            }
    295295        }
    296         if (m_fallbackFonts && runFontData != m_font.primaryFont())
     296        if (m_fallbackFonts && runFontData != &m_font.primaryFontData())
    297297            m_fallbackFonts->add(fontData);
    298298
    299         m_complexTextRuns.append(ComplexTextRun::create(ctRun, runFontData, cp, stringLocation, length, runRange));
     299        m_complexTextRuns.append(ComplexTextRun::create(ctRun, *runFontData, cp, stringLocation, length, runRange));
    300300    }
    301301}
  • trunk/Source/WebCore/platform/graphics/mac/FontMac.mm

    r177527 r177955  
    594594{
    595595#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED > 1090
    596     const auto* fontData = primaryFont();
    597     return !fontData->isSVGFont() && CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(fontData->platformData().ctFont())).get());
     596    const auto& fontData = primaryFontData();
     597    return !fontData.isSVGFont() && CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(fontData.platformData().ctFont())).get());
    598598#else
    599599    // System fonts are hidden by having a name that begins with a period, so simply search
  • trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.cpp

    r171989 r177955  
    266266
    267267#if ENABLE(OPENTYPE_MATH)
    268 float OpenTypeMathData::getMathConstant(const SimpleFontData* font, MathConstant constant) const
     268float OpenTypeMathData::getMathConstant(const SimpleFontData& font, MathConstant constant) const
    269269{
    270270    int32_t value = 0;
     
    287287        return value / 100.0;
    288288
    289     return value * font->sizePerUnit();
    290 #else
    291 float OpenTypeMathData::getMathConstant(const SimpleFontData*, MathConstant) const
     289    return value * font.sizePerUnit();
     290#else
     291float OpenTypeMathData::getMathConstant(const SimpleFontData&, MathConstant) const
    292292{
    293293    ASSERT_NOT_REACHED();
     
    297297
    298298#if ENABLE(OPENTYPE_MATH)
    299 float OpenTypeMathData::getItalicCorrection(const SimpleFontData* font, Glyph glyph) const
     299float OpenTypeMathData::getItalicCorrection(const SimpleFontData& font, Glyph glyph) const
    300300{
    301301    const OpenType::MATHTable* math = OpenType::validateTable<OpenType::MATHTable>(m_mathBuffer);
     
    309309        return 0;
    310310
    311     return mathItalicsCorrectionInfo->getItalicCorrection(*m_mathBuffer, glyph) * font->sizePerUnit();
    312 #else
    313 float OpenTypeMathData::getItalicCorrection(const SimpleFontData*, Glyph) const
     311    return mathItalicsCorrectionInfo->getItalicCorrection(*m_mathBuffer, glyph) * font.sizePerUnit();
     312#else
     313float OpenTypeMathData::getItalicCorrection(const SimpleFontData&, Glyph) const
    314314{
    315315    ASSERT_NOT_REACHED();
  • trunk/Source/WebCore/platform/graphics/opentype/OpenTypeMathData.h

    r171743 r177955  
    114114    };
    115115
    116     float getMathConstant(const SimpleFontData*, MathConstant) const;
    117     float getItalicCorrection(const SimpleFontData*, Glyph) const;
     116    float getMathConstant(const SimpleFontData&, MathConstant) const;
     117    float getItalicCorrection(const SimpleFontData&, Glyph) const;
    118118    void getMathVariants(Glyph, bool isVertical, Vector<Glyph>& sizeVariants, Vector<AssemblyPart>& assemblyParts) const;
    119119
  • trunk/Source/WebCore/platform/graphics/win/UniscribeController.cpp

    r177909 r177955  
    166166        }
    167167
    168         if (m_fallbackFonts && fontData && nextFontData != fontData && fontData != m_font.primaryFont())
     168        if (m_fallbackFonts && fontData && nextFontData != fontData && fontData != &m_font.primaryFontData())
    169169            m_fallbackFonts->add(fontData);
    170170
     
    180180    int itemLength = m_run.rtl() ? indexOfFontTransition + 1 : length - indexOfFontTransition;
    181181    if (itemLength) {
    182         if (m_fallbackFonts && nextFontData && nextFontData != m_font.primaryFont())
     182        if (m_fallbackFonts && nextFontData && nextFontData != &m_font.primaryFontData())
    183183            m_fallbackFonts->add(nextFontData);
    184184
  • trunk/Source/WebCore/rendering/InlineFlowBox.cpp

    r177377 r177955  
    450450    const RenderStyle& lineStyle = this->lineStyle();
    451451    if (lineStyle.fontDescription().nonCJKGlyphOrientation() == NonCJKGlyphOrientationUpright
    452         || lineStyle.font().primaryFont()->hasVerticalGlyphs())
     452        || lineStyle.font().primaryFontData().hasVerticalGlyphs())
    453453        return true;
    454454
     
    461461                return true;
    462462        } else {
    463             if (child->lineStyle().font().primaryFont()->hasVerticalGlyphs())
     463            if (child->lineStyle().font().primaryFontData().hasVerticalGlyphs())
    464464                return true;
    465465           
  • trunk/Source/WebCore/rendering/InlineTextBox.cpp

    r176298 r177955  
    13891389    TextRun run(string, textPos(), expansion(), expansionBehavior(), direction(), dirOverride() || style.rtlOrdering() == VisualOrder, !renderer().canUseSimpleFontCodePath());
    13901390    run.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
    1391     if (font.primaryFont()->isSVGFont())
     1391    if (font.primaryFontData().isSVGFont())
    13921392        run.setRenderingContext(SVGTextRunRenderingContext::create(renderer()));
    13931393
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r177730 r177955  
    23212321
    23222322    // FIXME: Should letter-spacing apply? This is complicated since it doesn't apply at the edge?
    2323     float maxCharWidth = lineGrid->style().font().primaryFont()->maxCharWidth();
     2323    float maxCharWidth = lineGrid->style().font().primaryFontData().maxCharWidth();
    23242324    if (!maxCharWidth)
    23252325        return left;
     
    23612361
    23622362    // FIXME: Should letter-spacing apply? This is complicated since it doesn't apply at the edge?
    2363     float maxCharWidth = lineGrid->style().font().primaryFont()->maxCharWidth();
     2363    float maxCharWidth = lineGrid->style().font().primaryFontData().maxCharWidth();
    23642364    if (!maxCharWidth)
    23652365        return right;
     
    36953695
    36963696    TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride);
    3697     if (font.primaryFont()->isSVGFont()) {
     3697    if (font.primaryFontData().isSVGFont()) {
    36983698        ASSERT(context); // FIXME: Thread a RenderObject& to this point so we don't have to dereference anything.
    36993699        run.setRenderingContext(SVGTextRunRenderingContext::create(*context));
     
    37153715    }
    37163716    TextRun run(characters, length, 0, 0, expansion, textDirection, directionalOverride);
    3717     if (font.primaryFont()->isSVGFont()) {
     3717    if (font.primaryFontData().isSVGFont()) {
    37183718        ASSERT(context); // FIXME: Thread a RenderObject& to this point so we don't have to dereference anything.
    37193719        run.setRenderingContext(SVGTextRunRenderingContext::create(*context));
  • trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp

    r177259 r177955  
    347347        maxCharWidth = scaleEmToUnits(4027);
    348348    else if (style().font().hasValidAverageCharWidth())
    349         maxCharWidth = roundf(style().font().primaryFont()->maxCharWidth());
     349        maxCharWidth = roundf(style().font().primaryFontData().maxCharWidth());
    350350#endif
    351351
  • trunk/Source/WebCore/rendering/RenderThemeIOS.mm

    r176751 r177955  
    581581   
    582582    RenderObject* renderer = inputElement.renderer();
    583     if (font.primaryFont()->isSVGFont() && !renderer)
     583    if (font.primaryFontData().isSVGFont() && !renderer)
    584584        return;
    585585   
  • trunk/Source/WebCore/rendering/RootInlineBox.cpp

    r177498 r177955  
    902902    const RenderStyle& boxLineStyle = box.lineStyle();
    903903    if (usedFonts && !usedFonts->isEmpty() && (includeFont || (boxLineStyle.lineHeight().isNegative() && includeLeading))) {
    904         usedFonts->append(boxLineStyle.font().primaryFont());
     904        usedFonts->append(&boxLineStyle.font().primaryFontData());
    905905        for (size_t i = 0; i < usedFonts->size(); ++i) {
    906906            const FontMetrics& fontMetrics = usedFonts->at(i)->fontMetrics();
  • trunk/Source/WebCore/rendering/SimpleLineLayout.cpp

    r177219 r177955  
    179179        }
    180180    }
    181     if (style.font().primaryFont()->isSVGFont())
     181    if (style.font().primaryFontData().isSVGFont())
    182182        return false;
    183183    // We assume that all lines have metrics based purely on the primary font.
    184     auto& primaryFontData = *style.font().primaryFont();
     184    auto& primaryFontData = style.font().primaryFontData();
    185185    if (primaryFontData.isLoading())
    186186        return false;
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp

    r177259 r177955  
    15231523        bottom.glyph = extension.glyph;
    15241524
    1525     top.fontData = style().font().primaryFont();
     1525    top.fontData = &style().font().primaryFontData();
    15261526    extension.fontData = top.fontData;
    15271527    bottom.fontData = top.fontData;
     
    15401540    ASSERT(m_isVertical && isLargeOperatorInDisplayStyle());
    15411541
    1542     const auto& primaryFontData = style().font().primaryFont();
     1542    const auto& primaryFontData = style().font().primaryFontData();
    15431543    GlyphData baseGlyph = style().font().glyphDataForCharacter(character, !style().isLeftToRightDirection());
    1544     if (!primaryFontData || !primaryFontData->mathData() || baseGlyph.fontData != primaryFontData)
     1544    if (!primaryFontData.mathData() || baseGlyph.fontData != &primaryFontData)
    15451545        return data;
    15461546
     
    15491549
    15501550    // 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.
    1551     float displayOperatorMinHeight = std::max(baseGlyph.fontData->boundsForGlyph(baseGlyph.glyph).height() * sqrtOfTwoFloat, primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::DisplayOperatorMinHeight));
    1552 
    1553     primaryFontData->mathData()->getMathVariants(baseGlyph.glyph, true, sizeVariants, assemblyParts);
     1551    float displayOperatorMinHeight = std::max(baseGlyph.fontData->boundsForGlyph(baseGlyph.glyph).height() * sqrtOfTwoFloat, primaryFontData.mathData()->getMathConstant(primaryFontData, OpenTypeMathData::DisplayOperatorMinHeight));
     1552
     1553    primaryFontData.mathData()->getMathVariants(baseGlyph.glyph, true, sizeVariants, assemblyParts);
    15541554
    15551555    // We choose the first size variant that is larger than the expected displayOperatorMinHeight and otherwise fallback to the largest variant.
     
    15571557        GlyphData sizeVariant;
    15581558        sizeVariant.glyph = variant;
    1559         sizeVariant.fontData = primaryFontData;
     1559        sizeVariant.fontData = &primaryFontData;
    15601560        data.setSizeVariantMode(sizeVariant);
    15611561        if (boundsForGlyph(sizeVariant).height() >= displayOperatorMinHeight)
     
    15721572    StretchyData assemblyData;
    15731573
    1574     const auto& primaryFontData = style().font().primaryFont();
     1574    const auto& primaryFontData = style().font().primaryFontData();
    15751575    GlyphData baseGlyph = style().font().glyphDataForCharacter(character, !style().isLeftToRightDirection());
    15761576   
    1577     if (primaryFontData && primaryFontData->mathData() && baseGlyph.fontData == primaryFontData) {
     1577    if (primaryFontData.mathData() && baseGlyph.fontData == &primaryFontData) {
    15781578        Vector<Glyph> sizeVariants;
    15791579        Vector<OpenTypeMathData::AssemblyPart> assemblyParts;
    1580         primaryFontData->mathData()->getMathVariants(baseGlyph.glyph, m_isVertical, sizeVariants, assemblyParts);
     1580        primaryFontData.mathData()->getMathVariants(baseGlyph.glyph, m_isVertical, sizeVariants, assemblyParts);
    15811581        // We verify the size variants.
    15821582        for (auto& variant : sizeVariants) {
    15831583            GlyphData sizeVariant;
    15841584            sizeVariant.glyph = variant;
    1585             sizeVariant.fontData = primaryFontData;
     1585            sizeVariant.fontData = &primaryFontData;
    15861586            if (maximumGlyphWidth)
    15871587                *maximumGlyphWidth = std::max(*maximumGlyphWidth, advanceForGlyph(sizeVariant));
     
    19841984LayoutUnit RenderMathMLOperator::trailingSpaceError()
    19851985{
    1986     const auto& primaryFontData = style().font().primaryFont();
    1987     if (!primaryFontData || !primaryFontData->mathData())
     1986    const auto& primaryFontData = style().font().primaryFontData();
     1987    if (!primaryFontData.mathData())
    19881988        return 0;
    19891989
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLRadicalOperator.cpp

    r177259 r177955  
    6464void RenderMathMLRadicalOperator::stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline)
    6565{
    66     const auto& primaryFontData = style().font().primaryFont();
    67     if (!primaryFontData || !primaryFontData->mathData()) {
     66    if (!style().font().primaryFontData().mathData()) {
    6867        // If we do not have an OpenType MATH font, we always make the radical depth a bit larger than the target.
    6968        depthBelowBaseline += gRadicalBottomPointLower;
     
    8584    ASSERT(preferredLogicalWidthsDirty());
    8685
    87     const auto& primaryFontData = style().font().primaryFont();
    88     if (primaryFontData && primaryFontData->mathData()) {
     86    if (style().font().primaryFontData().mathData()) {
    8987        RenderMathMLOperator::computePreferredLogicalWidths();
    9088        return;
     
    9997void RenderMathMLRadicalOperator::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
    10098{
    101     const auto& primaryFontData = style().font().primaryFont();
    102     if (primaryFontData && primaryFontData->mathData()) {
     99    if (style().font().primaryFontData().mathData()) {
    103100        RenderMathMLOperator::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
    104101        return;
     
    115112        return;
    116113
    117     const auto& primaryFontData = style().font().primaryFont();
    118     if (primaryFontData && primaryFontData->mathData()) {
     114    if (style().font().primaryFontData().mathData()) {
    119115        RenderMathMLOperator::paint(info, paintOffset);
    120116        return;
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp

    r177259 r177955  
    209209    m_degreeBottomRaisePercent = 0.6f;
    210210
    211     const auto& primaryFontData = style().font().primaryFont();
    212     if (primaryFontData && primaryFontData->mathData()) {
     211    const auto& primaryFontData = style().font().primaryFontData();
     212    if (auto* mathData = style().font().primaryFontData().mathData()) {
    213213        // FIXME: m_verticalGap should use RadicalDisplayStyleVertical in display mode (https://bugs.webkit.org/show_bug.cgi?id=118737).
    214         m_verticalGap = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalVerticalGap);
    215         m_ruleThickness = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalRuleThickness);
    216         m_extraAscender = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalExtraAscender);
     214        m_verticalGap = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalVerticalGap);
     215        m_ruleThickness = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalRuleThickness);
     216        m_extraAscender = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalExtraAscender);
    217217
    218218        if (!isRenderMathMLSquareRoot()) {
    219             kernBeforeDegree = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalKernBeforeDegree);
    220             kernAfterDegree = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalKernAfterDegree);
    221             m_degreeBottomRaisePercent = primaryFontData->mathData()->getMathConstant(primaryFontData, OpenTypeMathData::RadicalDegreeBottomRaisePercent);
     219            kernBeforeDegree = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalKernBeforeDegree);
     220            kernAfterDegree = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalKernAfterDegree);
     221            m_degreeBottomRaisePercent = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalDegreeBottomRaisePercent);
    222222        }
    223223    }
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r177821 r177955  
    11851185    DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, hyphenMinusString, (&hyphenMinus, 1));
    11861186    DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, hyphenString, (&hyphen, 1));
    1187     return font().primaryFontHasGlyphForCharacter(hyphen) ? hyphenString : hyphenMinusString;
     1187    return font().primaryFontData().glyphForCharacter(hyphen) ? hyphenString : hyphenMinusString;
    11881188}
    11891189
  • trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp

    r176365 r177955  
    423423                , dirOverride() || style->rtlOrdering() == VisualOrder /* directionalOverride */);
    424424
    425     if (style->font().primaryFont()->isSVGFont())
     425    if (style->font().primaryFontData().isSVGFont())
    426426        run.setRenderingContext(SVGTextRunRenderingContext::create(renderer()));
    427427
  • trunk/Source/WebCore/rendering/svg/SVGTextLayoutEngineSpacing.cpp

    r163440 r177955  
    4242{
    4343#if ENABLE(SVG_FONTS)
    44     const SimpleFontData* fontData = m_font.primaryFont();
    45     if (!fontData->isSVGFont()) {
     44    const SimpleFontData& fontData = m_font.primaryFontData();
     45    if (!fontData.isSVGFont()) {
    4646        m_lastGlyph.isValid = false;
    4747        return 0;
    4848    }
    4949
    50     ASSERT(fontData->isCustomFont());
    51     ASSERT(fontData->isSVGFont());
     50    ASSERT(fontData.isCustomFont());
     51    ASSERT(fontData.isSVGFont());
    5252
    53     const SVGFontData* svgFontData = static_cast<const SVGFontData*>(fontData->fontData());
     53    const SVGFontData* svgFontData = static_cast<const SVGFontData*>(fontData.fontData());
    5454    SVGFontFaceElement* svgFontFace = svgFontData->svgFontFaceElement();
    5555    ASSERT(svgFontFace);
  • trunk/Source/WebCore/rendering/svg/SVGTextMetrics.cpp

    r170871 r177955  
    7171                , isOverride(style.unicodeBidi()) /* directionalOverride */);
    7272
    73     if (style.font().primaryFont()->isSVGFont())
     73    if (style.font().primaryFontData().isSVGFont())
    7474        run.setRenderingContext(SVGTextRunRenderingContext::create(text));
    7575
     
    9292SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText& text, unsigned position, unsigned length, float width, const String& glyphName)
    9393{
    94     bool needsContext = text.style().font().primaryFont()->isSVGFont();
     94    bool needsContext = text.style().font().primaryFontData().isSVGFont();
    9595    float scalingFactor = text.scalingFactor();
    9696    ASSERT(scalingFactor);
  • trunk/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp

    r177637 r177955  
    293293static GlyphData missingGlyphForFont(const Font& font)
    294294{
    295     const SimpleFontData* primaryFontData = font.primaryFont();
    296     if (!primaryFontData->isSVGFont())
     295    const SimpleFontData& primaryFontData = font.primaryFontData();
     296    if (!primaryFontData.isSVGFont())
    297297        return GlyphData();
    298298    SVGFontElement* fontElement;
    299299    SVGFontFaceElement* fontFaceElement;
    300     svgFontAndFontFaceElementForFontData(primaryFontData, fontFaceElement, fontElement);
    301     return GlyphData(fontElement->missingGlyph(), primaryFontData);
     300    svgFontAndFontFaceElementForFontData(&primaryFontData, fontFaceElement, fontElement);
     301    return GlyphData(fontElement->missingGlyph(), &primaryFontData);
    302302}
    303303
     
    315315        if (Element* parentRendererElement = elementRenderer.element()) {
    316316            if (is<SVGAltGlyphElement>(*parentRendererElement))
    317                 glyphData.fontData = font.primaryFont();
     317                glyphData.fontData = &font.primaryFontData();
    318318        }
    319319    }
  • trunk/Source/WebKit/mac/WebCoreSupport/PopupMenuMac.mm

    r176236 r177955  
    8282        RetainPtr<NSMutableDictionary> attributes = adoptNS([[NSMutableDictionary alloc] init]);
    8383        if (style.font() != Font()) {
    84             NSFont *font = style.font().primaryFont()->getNSFont();
     84            NSFont *font = style.font().primaryFontData().getNSFont();
    8585            if (!font) {
    86                 CGFloat size = style.font().primaryFont()->platformData().size();
     86                CGFloat size = style.font().primaryFontData().platformData().size();
    8787                font = style.font().weight() < FontWeightBold ? [NSFont systemFontOfSize:size] : [NSFont boldSystemFontOfSize:size];
    8888            }
     
    149149   
    150150    NSPoint location;
    151     NSFont* font = m_client->menuStyle().font().primaryFont()->getNSFont();
     151    NSFont* font = m_client->menuStyle().font().primaryFontData().getNSFont();
    152152
    153153    // These values were borrowed from AppKit to match their placement of the menu.
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm

    r169134 r177955  
    4040#if USE(APPKIT)
    4141    // FIXME: font will be nil here for custom fonts, we should fix that.
    42     NSFont *font = m_popupClient->menuStyle().font().primaryFont()->getNSFont();
     42    NSFont *font = m_popupClient->menuStyle().font().primaryFontData().getNSFont();
    4343    if (!font)
    4444        return;
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r177917 r177955  
    801801        Node* nodeToRemove;
    802802        if (RenderStyle* style = Editor::styleForSelectionStart(&frame, nodeToRemove)) {
    803             CTFontRef font = style->font().primaryFont()->getCTFont();
     803            CTFontRef font = style->font().primaryFontData().getCTFont();
    804804            CTFontSymbolicTraits traits = font ? CTFontGetSymbolicTraits(font) : 0;
    805805           
Note: See TracChangeset for help on using the changeset viewer.