Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(706)

Side by Side Diff: third_party/WebKit/Source/platform/fonts/Font.cpp

Issue 1746283002: Rename enums/functions that collide in chromium style in platform/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: get-names-13-platform: . Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2006, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. 6 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 394
395 if (codePath(runInfo) != ComplexPath) 395 if (codePath(runInfo) != ComplexPath)
396 return pixelSnappedSelectionRect(selectionRectForSimpleText(run, point, h, from, to, accountForGlyphBounds)); 396 return pixelSnappedSelectionRect(selectionRectForSimpleText(run, point, h, from, to, accountForGlyphBounds));
397 return pixelSnappedSelectionRect(selectionRectForComplexText(run, point, h, from, to)); 397 return pixelSnappedSelectionRect(selectionRectForComplexText(run, point, h, from, to));
398 } 398 }
399 399
400 int Font::offsetForPosition(const TextRun& run, float x, bool includePartialGlyp hs) const 400 int Font::offsetForPosition(const TextRun& run, float x, bool includePartialGlyp hs) const
401 { 401 {
402 FontCachePurgePreventer purgePreventer; 402 FontCachePurgePreventer purgePreventer;
403 403
404 if (codePath(TextRunPaintInfo(run)) != ComplexPath && !fontDescription().typ esettingFeatures()) 404 if (codePath(TextRunPaintInfo(run)) != ComplexPath && !fontDescription().get TypesettingFeatures())
405 return offsetForPositionForSimpleText(run, x, includePartialGlyphs); 405 return offsetForPositionForSimpleText(run, x, includePartialGlyphs);
406 406
407 return offsetForPositionForComplexText(run, x, includePartialGlyphs); 407 return offsetForPositionForComplexText(run, x, includePartialGlyphs);
408 } 408 }
409 409
410 CodePath Font::codePath(const TextRunPaintInfo& runInfo) const 410 CodePath Font::codePath(const TextRunPaintInfo& runInfo) const
411 { 411 {
412 // TODO(eae): Disable the always use complex text feature on Android for now as 412 // TODO(eae): Disable the always use complex text feature on Android for now as
413 // it caused a memory regression for webview. crbug.com/577306 413 // it caused a memory regression for webview. crbug.com/577306
414 #if !OS(ANDROID) 414 #if !OS(ANDROID)
415 if (RuntimeEnabledFeatures::alwaysUseComplexTextEnabled() 415 if (RuntimeEnabledFeatures::alwaysUseComplexTextEnabled()
416 || LayoutTestSupport::alwaysUseComplexTextForTest()) { 416 || LayoutTestSupport::alwaysUseComplexTextForTest()) {
417 return ComplexPath; 417 return ComplexPath;
418 } 418 }
419 #endif 419 #endif
420 420
421 const TextRun& run = runInfo.run; 421 const TextRun& run = runInfo.run;
422 422
423 if (fontDescription().typesettingFeatures() && (runInfo.from || runInfo.to ! = run.length())) 423 if (fontDescription().getTypesettingFeatures() && (runInfo.from || runInfo.t o != run.length()))
424 return ComplexPath; 424 return ComplexPath;
425 425
426 if (m_fontDescription.featureSettings() && m_fontDescription.featureSettings ()->size() > 0) 426 if (m_fontDescription.featureSettings() && m_fontDescription.featureSettings ()->size() > 0)
427 return ComplexPath; 427 return ComplexPath;
428 428
429 if (m_fontDescription.isVerticalBaseline()) 429 if (m_fontDescription.isVerticalBaseline())
430 return ComplexPath; 430 return ComplexPath;
431 431
432 if (m_fontDescription.widthVariant() != RegularWidth) 432 if (m_fontDescription.widthVariant() != RegularWidth)
433 return ComplexPath; 433 return ComplexPath;
434 434
435 if (run.length() > 1 && fontDescription().typesettingFeatures()) 435 if (run.length() > 1 && fontDescription().getTypesettingFeatures())
436 return ComplexPath; 436 return ComplexPath;
437 437
438 // FIXME: This really shouldn't be needed but for some reason the 438 // FIXME: This really shouldn't be needed but for some reason the
439 // TextRendering setting doesn't propagate to typesettingFeatures in time 439 // TextRendering setting doesn't propagate to typesettingFeatures in time
440 // for the prefs width calculation. 440 // for the prefs width calculation.
441 if (fontDescription().textRendering() == OptimizeLegibility || fontDescripti on().textRendering() == GeometricPrecision) 441 if (fontDescription().textRendering() == OptimizeLegibility || fontDescripti on().textRendering() == GeometricPrecision)
442 return ComplexPath; 442 return ComplexPath;
443 443
444 if (run.is8Bit()) 444 if (run.is8Bit())
445 return SimplePath; 445 return SimplePath;
446 446
447 // Start from 0 since drawing and highlighting also measure the characters b efore run->from. 447 // Start from 0 since drawing and highlighting also measure the characters b efore run->from.
448 return Character::characterRangeCodePath(run.characters16(), run.length()); 448 return Character::characterRangeCodePath(run.characters16(), run.length());
449 } 449 }
450 450
451 bool Font::canShapeWordByWord() const 451 bool Font::canShapeWordByWord() const
452 { 452 {
453 if (!m_shapeWordByWordComputed) { 453 if (!m_shapeWordByWordComputed) {
454 m_canShapeWordByWord = computeCanShapeWordByWord(); 454 m_canShapeWordByWord = computeCanShapeWordByWord();
455 m_shapeWordByWordComputed = true; 455 m_shapeWordByWordComputed = true;
456 } 456 }
457 return m_canShapeWordByWord; 457 return m_canShapeWordByWord;
458 }; 458 };
459 459
460 bool Font::computeCanShapeWordByWord() const 460 bool Font::computeCanShapeWordByWord() const
461 { 461 {
462 if (!fontDescription().typesettingFeatures()) 462 if (!fontDescription().getTypesettingFeatures())
463 return true; 463 return true;
464 464
465 const FontPlatformData& platformData = primaryFont()->platformData(); 465 const FontPlatformData& platformData = primaryFont()->platformData();
466 TypesettingFeatures features = fontDescription().typesettingFeatures(); 466 TypesettingFeatures features = fontDescription().getTypesettingFeatures();
467 return !platformData.hasSpaceInLigaturesOrKerning(features); 467 return !platformData.hasSpaceInLigaturesOrKerning(features);
468 }; 468 };
469 469
470 void Font::willUseFontData(UChar32 character) const 470 void Font::willUseFontData(UChar32 character) const
471 { 471 {
472 const FontFamily& family = fontDescription().family(); 472 const FontFamily& family = fontDescription().family();
473 if (m_fontFallbackList && m_fontFallbackList->fontSelector() && !family.fami lyIsEmpty()) 473 if (m_fontFallbackList && m_fontFallbackList->fontSelector() && !family.fami lyIsEmpty())
474 m_fontFallbackList->fontSelector()->willUseFontData(fontDescription(), f amily.family(), character); 474 m_fontFallbackList->fontSelector()->willUseFontData(fontDescription(), f amily.family(), character);
475 } 475 }
476 476
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 { 824 {
825 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); 825 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts();
826 } 826 }
827 827
828 bool Font::isFallbackValid() const 828 bool Font::isFallbackValid() const
829 { 829 {
830 return !m_fontFallbackList || m_fontFallbackList->isValid(); 830 return !m_fontFallbackList || m_fontFallbackList->isValid();
831 } 831 }
832 832
833 } // namespace blink 833 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698