Changeset 178250 in webkit


Ignore:
Timestamp:
Jan 11, 2015 2:58:09 PM (9 years ago)
Author:
Antti Koivisto
Message:

Remove FontCachePurgePreventer
https://bugs.webkit.org/show_bug.cgi?id=139628

Reviewed by Anders Carlsson.

This stack type is bug prone and invasive. A missing FontCachePurgePreventer in a code that touches fonts is always
a hard-to-detect bug and there are many places that need it. Instead purge the font cache on top of the runloop.

The purge timer could in principle fire in a nested runloop. However we should never have unreferenced
SimpleFontData objects in the stack in such case (GlyphData objects don't currently ref the font) because those
only occur during layout and painting. Layout and painting can't trigger a nested runloops as there would be
bigger problems.

Purging may also be triggered synchronously by a memory notification. That case won't have any GlyphDatas in the stack either.

  • html/canvas/CanvasRenderingContext2D.cpp:

(WebCore::CanvasRenderingContext2D::measureText):
(WebCore::CanvasRenderingContext2D::drawTextInternal):

  • page/FrameView.cpp:

(WebCore::FrameView::layout):
(WebCore::FrameView::paintContents):

  • platform/graphics/FontCache.cpp:

(WebCore::FontCache::FontCache):
(WebCore::FontCache::fontForFamily):
(WebCore::FontCache::purgeTimerFired):
(WebCore::FontCache::purgeInactiveFontData):

  • platform/graphics/FontCache.h:

(WebCore::FontCache::disablePurging): Deleted.
(WebCore::FontCache::enablePurging): Deleted.
(WebCore::FontCachePurgePreventer::FontCachePurgePreventer): Deleted.
(WebCore::FontCachePurgePreventer::~FontCachePurgePreventer): Deleted.

  • platform/graphics/FontFastPath.cpp:

(WebCore::Font::emphasisMarkAscent):
(WebCore::Font::emphasisMarkDescent):
(WebCore::Font::emphasisMarkHeight):
(WebCore::Font::drawEmphasisMarks):

  • platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:

(PlatformCALayerWinInternal::displayCallback):

  • platform/mac/DragImageMac.mm:

(WebCore::widthWithFont):
(WebCore::drawAtPoint):
(WebCore::createDragImageForLink):

  • platform/win/DragImageWin.cpp:

(WebCore::createDragImageForLink):

  • platform/win/WebCoreTextRenderer.cpp:

(WebCore::doDrawTextAtPoint):
(WebCore::WebCoreTextFloatWidth):

  • rendering/InlineTextBox.cpp:

(WebCore::InlineTextBox::localSelectionRect):
(WebCore::InlineTextBox::offsetForPosition):
(WebCore::InlineTextBox::positionForOffset):

  • rendering/RenderImage.cpp:

(WebCore::RenderImage::setImageSizeForAltText):

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::paintIntoLayer):

  • rendering/RenderListBox.cpp:

(WebCore::RenderListBox::updateFromElement):
(WebCore::RenderListBox::paintItemForeground):

  • rendering/RenderMenuList.cpp:

(RenderMenuList::updateOptionsWidth):

  • rendering/RenderThemeIOS.mm:

(WebCore::adjustInputElementButtonStyle):

  • rendering/mathml/RenderMathMLOperator.cpp:

(WebCore::RenderMathMLOperator::updateStyle):

  • rendering/svg/RenderSVGText.cpp:

(WebCore::RenderSVGText::subtreeChildWasAdded):
(WebCore::RenderSVGText::subtreeStyleDidChange):
(WebCore::RenderSVGText::subtreeTextDidChange):
(WebCore::RenderSVGText::removeChild):

  • rendering/svg/SVGInlineTextBox.cpp:

(WebCore::SVGInlineTextBox::selectionRectForTextFragment):

Location:
trunk/Source
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r178249 r178250  
     12015-01-11  Antti Koivisto  <antti@apple.com>
     2
     3        Remove FontCachePurgePreventer
     4        https://bugs.webkit.org/show_bug.cgi?id=139628
     5
     6        Reviewed by Anders Carlsson.
     7
     8        This stack type is bug prone and invasive. A missing FontCachePurgePreventer in a code that touches fonts is always
     9        a hard-to-detect bug and there are many places that need it. Instead purge the font cache on top of the runloop.
     10
     11        The purge timer could in principle fire in a nested runloop. However we should never have unreferenced
     12        SimpleFontData objects in the stack in such case (GlyphData objects don't currently ref the font) because those
     13        only occur during layout and painting. Layout and painting can't trigger a nested runloops as there would be
     14        bigger problems.
     15
     16        Purging may also be triggered synchronously by a memory notification. That case won't have any GlyphDatas in the stack either.
     17
     18        * html/canvas/CanvasRenderingContext2D.cpp:
     19        (WebCore::CanvasRenderingContext2D::measureText):
     20        (WebCore::CanvasRenderingContext2D::drawTextInternal):
     21        * page/FrameView.cpp:
     22        (WebCore::FrameView::layout):
     23        (WebCore::FrameView::paintContents):
     24        * platform/graphics/FontCache.cpp:
     25        (WebCore::FontCache::FontCache):
     26        (WebCore::FontCache::fontForFamily):
     27        (WebCore::FontCache::purgeTimerFired):
     28        (WebCore::FontCache::purgeInactiveFontData):
     29        * platform/graphics/FontCache.h:
     30        (WebCore::FontCache::disablePurging): Deleted.
     31        (WebCore::FontCache::enablePurging): Deleted.
     32        (WebCore::FontCachePurgePreventer::FontCachePurgePreventer): Deleted.
     33        (WebCore::FontCachePurgePreventer::~FontCachePurgePreventer): Deleted.
     34        * platform/graphics/FontFastPath.cpp:
     35        (WebCore::Font::emphasisMarkAscent):
     36        (WebCore::Font::emphasisMarkDescent):
     37        (WebCore::Font::emphasisMarkHeight):
     38        (WebCore::Font::drawEmphasisMarks):
     39        * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
     40        (PlatformCALayerWinInternal::displayCallback):
     41        * platform/mac/DragImageMac.mm:
     42        (WebCore::widthWithFont):
     43        (WebCore::drawAtPoint):
     44        (WebCore::createDragImageForLink):
     45        * platform/win/DragImageWin.cpp:
     46        (WebCore::createDragImageForLink):
     47        * platform/win/WebCoreTextRenderer.cpp:
     48        (WebCore::doDrawTextAtPoint):
     49        (WebCore::WebCoreTextFloatWidth):
     50        * rendering/InlineTextBox.cpp:
     51        (WebCore::InlineTextBox::localSelectionRect):
     52        (WebCore::InlineTextBox::offsetForPosition):
     53        (WebCore::InlineTextBox::positionForOffset):
     54        * rendering/RenderImage.cpp:
     55        (WebCore::RenderImage::setImageSizeForAltText):
     56        * rendering/RenderLayerBacking.cpp:
     57        (WebCore::RenderLayerBacking::paintIntoLayer):
     58        * rendering/RenderListBox.cpp:
     59        (WebCore::RenderListBox::updateFromElement):
     60        (WebCore::RenderListBox::paintItemForeground):
     61        * rendering/RenderMenuList.cpp:
     62        (RenderMenuList::updateOptionsWidth):
     63        * rendering/RenderThemeIOS.mm:
     64        (WebCore::adjustInputElementButtonStyle):
     65        * rendering/mathml/RenderMathMLOperator.cpp:
     66        (WebCore::RenderMathMLOperator::updateStyle):
     67        * rendering/svg/RenderSVGText.cpp:
     68        (WebCore::RenderSVGText::subtreeChildWasAdded):
     69        (WebCore::RenderSVGText::subtreeStyleDidChange):
     70        (WebCore::RenderSVGText::subtreeTextDidChange):
     71        (WebCore::RenderSVGText::removeChild):
     72        * rendering/svg/SVGInlineTextBox.cpp:
     73        (WebCore::SVGInlineTextBox::selectionRectForTextFragment):
     74
    1752015-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
    276
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp

    r174676 r178250  
    4343#include "ExceptionCodePlaceholder.h"
    4444#include "FloatQuad.h"
    45 #include "FontCache.h"
    4645#include "GraphicsContext.h"
    4746#include "HTMLImageElement.h"
     
    22582257PassRefPtr<TextMetrics> CanvasRenderingContext2D::measureText(const String& text)
    22592258{
    2260     FontCachePurgePreventer fontCachePurgePreventer;
    2261 
    22622259    RefPtr<TextMetrics> metrics = TextMetrics::create();
    22632260
     
    22902287    if (fill && gradient && gradient->isZeroSize())
    22912288        return;
    2292 
    2293     FontCachePurgePreventer fontCachePurgePreventer;
    22942289
    22952290    const Font& font = accessFont();
  • trunk/Source/WebCore/page/FrameView.cpp

    r178038 r178250  
    4141#include "FloatRect.h"
    4242#include "FocusController.h"
    43 #include "FontCache.h"
    4443#include "FontLoader.h"
    4544#include "FrameLoader.h"
     
    12231222    }
    12241223
    1225     FontCachePurgePreventer fontCachePurgePreventer;
    12261224    RenderLayer* layer;
    12271225
     
    38473845    willPaintContents(context, dirtyRect, paintingState);
    38483846
    3849     FontCachePurgePreventer fontCachePurgePreventer;
    3850 
    38513847    // m_nodeToDraw is used to draw only one element (and its descendants)
    38523848    RenderObject* renderer = m_nodeToDraw ? m_nodeToDraw->renderer() : nullptr;
  • trunk/Source/WebCore/platform/graphics/FontCache.cpp

    r178180 r178250  
    9494
    9595FontCache::FontCache()
    96     : m_purgePreventCount(0)
     96    : m_purgeTimer(*this, &FontCache::purgeTimerFired)
    9797{
    9898}
     
    373373const int cTargetInactiveFontData = 100;
    374374#else
    375 const int cMaxInactiveFontData = 225;
     375const int cMaxInactiveFontData = 5;
    376376const int cTargetInactiveFontData = 200;
    377377#endif
     
    382382RefPtr<SimpleFontData> FontCache::fontForFamily(const FontDescription& fontDescription, const AtomicString& family, bool checkingAlternateName)
    383383{
     384    if (!m_purgeTimer.isActive())
     385        m_purgeTimer.startOneShot(std::chrono::milliseconds::zero());
     386
    384387    FontPlatformData* platformData = getCachedFontPlatformData(fontDescription, family, checkingAlternateName);
    385388    if (!platformData)
     
    400403
    401404    return *addResult.iterator->value;
     405}
     406
     407void FontCache::purgeTimerFired()
     408{
     409    purgeInactiveFontDataIfNeeded();
    402410}
    403411
     
    420428{
    421429    pruneUnreferencedEntriesFromFontGlyphsCache();
    422 
    423     if (m_purgePreventCount)
    424         return;
    425430
    426431#if PLATFORM(IOS)
  • trunk/Source/WebCore/platform/graphics/FontCache.h

    r178180 r178250  
    3232
    3333#include "FontDescription.h"
     34#include "Timer.h"
    3435#include <limits.h>
    3536#include <wtf/Forward.h>
     
    104105
    105106class FontCache {
    106     friend class FontCachePurgePreventer;
    107107    friend class WTF::NeverDestroyed<FontCache>;
    108108
     
    164164    ~FontCache();
    165165
    166     void disablePurging() { m_purgePreventCount++; }
    167     void enablePurging()
    168     {
    169         ASSERT(m_purgePreventCount);
    170         if (!--m_purgePreventCount)
    171             purgeInactiveFontDataIfNeeded();
    172     }
     166    void purgeTimerFired();
    173167
    174     void WEBCORE_EXPORT purgeInactiveFontDataIfNeeded();
     168    void purgeInactiveFontDataIfNeeded();
    175169
    176170    // FIXME: This method should eventually be removed.
     
    184178    std::unique_ptr<FontPlatformData> createFontPlatformData(const FontDescription&, const AtomicString& family);
    185179
    186     // Don't purge if this count is > 0;
    187     int m_purgePreventCount;
     180    Timer m_purgeTimer;
    188181
    189182#if PLATFORM(COCOA)
     
    196189WEBCORE_EXPORT FontCache& fontCache();
    197190
    198 class FontCachePurgePreventer {
    199 public:
    200     FontCachePurgePreventer() { fontCache().disablePurging(); }
    201     ~FontCachePurgePreventer() { fontCache().enablePurging(); }
    202 };
    203 
    204191}
    205192
  • trunk/Source/WebCore/platform/graphics/FontFastPath.cpp

    r177955 r178250  
    2525
    2626#include "FloatRect.h"
    27 #include "FontCache.h"
    2827#include "FontGlyphs.h"
    2928#include "GlyphBuffer.h"
     
    7069int Font::emphasisMarkAscent(const AtomicString& mark) const
    7170{
    72     FontCachePurgePreventer purgePreventer;
    73    
    7471    GlyphData markGlyphData;
    7572    if (!getEmphasisMarkGlyphData(mark, markGlyphData))
     
    8683int Font::emphasisMarkDescent(const AtomicString& mark) const
    8784{
    88     FontCachePurgePreventer purgePreventer;
    89    
    9085    GlyphData markGlyphData;
    9186    if (!getEmphasisMarkGlyphData(mark, markGlyphData))
     
    10297int Font::emphasisMarkHeight(const AtomicString& mark) const
    10398{
    104     FontCachePurgePreventer purgePreventer;
    105 
    10699    GlyphData markGlyphData;
    107100    if (!getEmphasisMarkGlyphData(mark, markGlyphData))
     
    241234void Font::drawEmphasisMarks(GraphicsContext* context, const TextRun& run, const GlyphBuffer& glyphBuffer, const AtomicString& mark, const FloatPoint& point) const
    242235{
    243     FontCachePurgePreventer purgePreventer;
    244    
    245236    GlyphData markGlyphData;
    246237    if (!getEmphasisMarkGlyphData(mark, markGlyphData))
  • trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWinInternal.cpp

    r175700 r178250  
    2929
    3030#include "Font.h"
    31 #include "FontCache.h"
    3231#include "GraphicsContext.h"
    3332#include "PlatformCALayer.h"
     
    132131
    133132    if (owner()->owner()->platformCALayerShowRepaintCounter(owner())) {
    134         FontCachePurgePreventer fontCachePurgePreventer;
    135 
    136133        String text = String::number(owner()->owner()->platformCALayerIncrementRepaintCount(owner()));
    137134
  • trunk/Source/WebCore/platform/mac/DragImageMac.mm

    r177876 r178250  
    3030#import "BitmapImage.h"
    3131#import "Font.h"
    32 #import "FontCache.h"
    3332#import "FontDescription.h"
    3433#import "FontSelector.h"
     
    193192   
    194193    if (canUseFastRenderer(buffer.data(), length)) {
    195         FontCachePurgePreventer fontCachePurgePreventer;
    196 
    197194        Font webCoreFont(FontPlatformData(font, [font pointSize]), ![[NSGraphicsContext currentContext] isDrawingToScreen]);
    198195        TextRun run(buffer.data(), length);
     
    219216   
    220217    if (canUseFastRenderer(buffer.data(), length)) {
    221         FontCachePurgePreventer fontCachePurgePreventer;
    222 
    223218        // The following is a half-assed attempt to match AppKit's rounding rules for drawAtPoint.
    224219        // It's probably incorrect for high DPI.
     
    273268DragImageRef createDragImageForLink(URL& url, const String& title, FontRenderingMode)
    274269{
    275     FontCachePurgePreventer fontCachePurgePreventer;
    276 
    277270    NSString *label = nsStringNilIfEmpty(title);
    278271    NSURL *cocoaURL = url;
  • trunk/Source/WebCore/platform/win/DragImageWin.cpp

    r173949 r178250  
    2929#include "FloatRoundedRect.h"
    3030#include "Font.h"
    31 #include "FontCache.h"
    3231#include "FontDescription.h"
    3332#include "FontSelector.h"
     
    127126    const Font* labelFont;
    128127    const Font* urlFont;
    129     FontCachePurgePreventer fontCachePurgePreventer;
    130128
    131129    if (fontRenderingMode == AlternateRenderingMode) {
  • trunk/Source/WebCore/platform/win/WebCoreTextRenderer.cpp

    r166063 r178250  
    2727
    2828#include "Font.h"
    29 #include "FontCache.h"
    3029#include "FontDescription.h"
    3130#include "GraphicsContext.h"
     
    4948static void doDrawTextAtPoint(GraphicsContext& context, const String& text, const IntPoint& point, const Font& font, const Color& color, int underlinedIndex)
    5049{
    51     FontCachePurgePreventer fontCachePurgePreventer;
    52 
    5350    TextRun run(text);
    5451
     
    9592float WebCoreTextFloatWidth(const String& text, const Font& font)
    9693{
    97     FontCachePurgePreventer fontCachePurgePreventer;
    98 
    9994    return StringTruncator::width(text, font, StringTruncator::EnableRoundingHacks);
    10095}
  • trunk/Source/WebCore/rendering/InlineTextBox.cpp

    r177955 r178250  
    3131#include "Editor.h"
    3232#include "EllipsisBox.h"
    33 #include "FontCache.h"
    3433#include "Frame.h"
    3534#include "GraphicsContext.h"
     
    264263    if (sPos > ePos)
    265264        return LayoutRect();
    266 
    267     FontCachePurgePreventer fontCachePurgePreventer;
    268265
    269266    LayoutUnit selectionTop = this->selectionTop();
     
    13321329        return isLeftToRightDirection() ? 0 : len();
    13331330
    1334     FontCachePurgePreventer fontCachePurgePreventer;
    1335 
    13361331    const RenderStyle& lineStyle = this->lineStyle();
    13371332    const Font& font = fontToUse(lineStyle, renderer());
     
    13461341    if (isLineBreak())
    13471342        return logicalLeft();
    1348 
    1349     FontCachePurgePreventer fontCachePurgePreventer;
    13501343
    13511344    const RenderStyle& lineStyle = this->lineStyle();
  • trunk/Source/WebCore/rendering/RenderImage.cpp

    r177259 r178250  
    193193    // we have an alt and the user meant it (its not a text we invented)
    194194    if (!m_altText.isEmpty()) {
    195         FontCachePurgePreventer fontCachePurgePreventer;
    196 
    197195        const Font& font = style().font();
    198196        IntSize paddedTextSize(paddingWidth + std::min(ceilf(font.width(RenderBlock::constructTextRun(this, font, m_altText, style()))), maxAltTextWidth), paddingHeight + std::min(font.fontMetrics().height(), maxAltTextHeight));
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r178176 r178250  
    3434#include "Chrome.h"
    3535#include "FilterEffectRenderer.h"
    36 #include "FontCache.h"
    3736#include "FrameView.h"
    3837#include "GraphicsContext.h"
     
    21862185    }
    21872186
    2188     FontCachePurgePreventer fontCachePurgePreventer;
    2189    
    21902187    RenderLayer::PaintLayerFlags paintFlags = 0;
    21912188    if (paintingPhase & GraphicsLayerPaintBackground)
  • trunk/Source/WebCore/rendering/RenderListBox.cpp

    r177259 r178250  
    3737#include "EventHandler.h"
    3838#include "FocusController.h"
    39 #include "FontCache.h"
    4039#include "Frame.h"
    4140#include "FrameSelection.h"
     
    106105void RenderListBox::updateFromElement()
    107106{
    108     FontCachePurgePreventer fontCachePurgePreventer;
    109 
    110107    if (m_optionsChanged) {
    111108        const Vector<HTMLElement*>& listItems = selectElement().listItems();
     
    373370void RenderListBox::paintItemForeground(PaintInfo& paintInfo, const LayoutPoint& paintOffset, int listIndex)
    374371{
    375     FontCachePurgePreventer fontCachePurgePreventer;
    376 
    377372    const Vector<HTMLElement*>& listItems = selectElement().listItems();
    378373    HTMLElement* listItemElement = listItems[listIndex];
  • trunk/Source/WebCore/rendering/RenderMenuList.cpp

    r177259 r178250  
    3030#include "CSSFontSelector.h"
    3131#include "Chrome.h"
    32 #include "FontCache.h"
    3332#include "Frame.h"
    3433#include "FrameView.h"
     
    210209    const Vector<HTMLElement*>& listItems = selectElement().listItems();
    211210    int size = listItems.size();   
    212     FontCachePurgePreventer fontCachePurgePreventer;
    213211
    214212    for (int i = 0; i < size; ++i) {
  • trunk/Source/WebCore/rendering/RenderThemeIOS.mm

    r178229 r178250  
    584584        return;
    585585   
    586     FontCachePurgePreventer fontCachePurgePreventer;
    587586    float maximumWidth = localizedDateCache().maximumWidthForDateType(dateType, font, RenderThemeMeasureTextClient(font, *renderer, style));
    588587
  • trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp

    r177955 r178250  
    3333#include "RenderMathMLOperator.h"
    3434
    35 #include "FontCache.h"
    3635#include "FontSelector.h"
    3736#include "MathMLNames.h"
     
    16601659void RenderMathMLOperator::updateStyle()
    16611660{
    1662     FontCachePurgePreventer fontCachePurgePreventer;
    1663 
    16641661    ASSERT(firstChild());
    16651662    if (!firstChild())
  • trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp

    r177259 r178250  
    2929
    3030#include "FloatQuad.h"
    31 #include "FontCache.h"
    3231#include "GraphicsContext.h"
    3332#include "HitTestRequest.h"
     
    171170        return;
    172171
    173     // Always protect the cache before clearing text positioning elements when the cache will subsequently be rebuilt.
    174     FontCachePurgePreventer fontCachePurgePreventer;
    175 
    176172    // The positioning elements cache doesn't include the new 'child' yet. Clear the
    177173    // cache, as the next buildLayoutAttributesForTextRenderer() call rebuilds it.
     
    296292    // Only update the metrics cache, but not the text positioning element cache
    297293    // nor the layout attributes cached in the leaf #text renderers.
    298     FontCachePurgePreventer fontCachePurgePreventer;
    299294    for (RenderObject* descendant = text; descendant; descendant = descendant->nextInPreOrder(text)) {
    300295        if (is<RenderSVGInlineText>(*descendant))
     
    317312        return;
    318313    }
    319 
    320     // Always protect the cache before clearing text positioning elements when the cache will subsequently be rebuilt.
    321     FontCachePurgePreventer fontCachePurgePreventer;
    322314
    323315    // The positioning elements cache depends on the size of each text renderer in the
     
    545537
    546538    Vector<SVGTextLayoutAttributes*, 2> affectedAttributes;
    547     FontCachePurgePreventer fontCachePurgePreventer;
    548539    subtreeChildWillBeRemoved(&child, affectedAttributes);
    549540    RenderSVGBlock::removeChild(child);
  • trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp

    r177955 r178250  
    2323#include "SVGInlineTextBox.h"
    2424
    25 #include "FontCache.h"
    2625#include "Frame.h"
    2726#include "FrameView.h"
     
    114113    ASSERT_WITH_SECURITY_IMPLICATION(startPosition < endPosition);
    115114    ASSERT(style);
    116 
    117     FontCachePurgePreventer fontCachePurgePreventer;
    118115
    119116    float scalingFactor = renderer().scalingFactor();
  • trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm

    r168047 r178250  
    3030
    3131#import <WebCore/Font.h>
    32 #import <WebCore/FontCache.h>
    3332#import <WebCore/GraphicsContext.h>
    3433#import <WebCore/TextRun.h>
     
    101100        if (!flipped)
    102101            CGContextScaleCTM(cgContext, 1, -1);
    103 
    104         FontCachePurgePreventer fontCachePurgePreventer;
    105102
    106103        Font webCoreFont(FontPlatformData(font, [font pointSize]), ![nsContext isDrawingToScreen], fontSmoothingIsAllowed ? AutoSmoothing : Antialiased);
     
    150147
    151148    if (canUseFastRenderer(buffer.data(), length)) {
    152         FontCachePurgePreventer fontCachePurgePreventer;
    153 
    154149        Font webCoreFont(FontPlatformData(font, [font pointSize]), ![[NSGraphicsContext currentContext] isDrawingToScreen]);
    155150        TextRun run(buffer.data(), length);
  • trunk/Source/WebKit/mac/Misc/WebStringTruncator.mm

    r166448 r178250  
    3131#import "WebSystemInterface.h"
    3232#import <WebCore/Font.h>
    33 #import <WebCore/FontCache.h>
    3433#import <WebCore/FontPlatformData.h>
    3534#import <WebCore/StringTruncator.h>
     
    6160{
    6261    static NeverDestroyed<RetainPtr<NSFont>> menuFont = [NSFont menuFontOfSize:0];
    63     WebCore::FontCachePurgePreventer fontCachePurgePreventer;
    6462    return WebCore::StringTruncator::centerTruncate(string, maxWidth, fontFromNSFont(menuFont.get().get()));
    6563}
     
    6765+ (NSString *)centerTruncateString:(NSString *)string toWidth:(float)maxWidth withFont:(NSFont *)font
    6866{
    69     WebCore::FontCachePurgePreventer fontCachePurgePreventer;
    7067    return WebCore::StringTruncator::centerTruncate(string, maxWidth, fontFromNSFont(font));
    7168}
     
    7370+ (NSString *)rightTruncateString:(NSString *)string toWidth:(float)maxWidth withFont:(NSFont *)font
    7471{
    75     WebCore::FontCachePurgePreventer fontCachePurgePreventer;
    7672    return WebCore::StringTruncator::rightTruncate(string, maxWidth, fontFromNSFont(font));
    7773}
     
    7975+ (float)widthOfString:(NSString *)string font:(NSFont *)font
    8076{
    81     WebCore::FontCachePurgePreventer fontCachePurgePreventer;
    8277    return WebCore::StringTruncator::width(string, fontFromNSFont(font));
    8378}
  • trunk/Source/WebKit/mac/WebView/WebHTMLView.mm

    r178133 r178250  
    48794879    fontDescription.setWeight(bold ? FontWeight900 : FontWeight500);
    48804880    fontDescription.setSpecifiedSize(pointSize);
    4881     FontCachePurgePreventer purgePreventer;
    48824881    RefPtr<SimpleFontData> simpleFontData = fontCache().fontForFamily(fontDescription, familyName);
    48834882    return [simpleFontData->platformData().nsFont() fontName];
  • trunk/Source/WebKit/win/WebKitGraphics.cpp

    r176892 r178250  
    3232
    3333#include <WebCore/Font.h>
    34 #include <WebCore/FontCache.h>
    3534#include <WebCore/FontDescription.h>
    3635#include <WebCore/FontSelector.h>
     
    115114    ASSERT(buffer);
    116115
    117     FontCachePurgePreventer fontCachePurgePreventer;
    118 
    119116    String result = StringTruncator::centerTruncate(String(text, length), width, makeFont(description), StringTruncator::EnableRoundingHacks);
    120117    StringView(result).getCharactersWithUpconvert(buffer);
     
    126123{
    127124    ASSERT(buffer);
    128 
    129     FontCachePurgePreventer fontCachePurgePreventer;
    130125
    131126    String result = StringTruncator::rightTruncate(String(text, length), width, makeFont(description), StringTruncator::EnableRoundingHacks);
Note: See TracChangeset for help on using the changeset viewer.