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

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

Issue 1248453004: Change Font::offsetForPositionForComplexText to use CachingWordShapeIterator (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 4 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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 { 697 {
698 CachingWordShaper& shaper = m_fontFallbackList->cachingWordShaper(); 698 CachingWordShaper& shaper = m_fontFallbackList->cachingWordShaper();
699 float width = shaper.width(this, run, fallbackFonts, glyphBounds); 699 float width = shaper.width(this, run, fallbackFonts, glyphBounds);
700 return width; 700 return width;
701 } 701 }
702 702
703 // Return the code point index for the given |x| offset into the text run. 703 // Return the code point index for the given |x| offset into the text run.
704 int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, 704 int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat,
705 bool includePartialGlyphs) const 705 bool includePartialGlyphs) const
706 { 706 {
707 HarfBuzzShaper shaper(this, run); 707 CachingWordShaper& shaper = m_fontFallbackList->cachingWordShaper();
708 RefPtr<ShapeResult> shapeResult = shaper.shapeResult(); 708 return shaper.offsetForPosition(this, run, xFloat);
709 if (!shapeResult)
710 return 0;
711 return shapeResult->offsetForPosition(xFloat);
712 } 709 }
713 710
714 // Return the rectangle for selecting the given range of code-points in the Text Run. 711 // Return the rectangle for selecting the given range of code-points in the Text Run.
715 FloatRect Font::selectionRectForComplexText(const TextRun& run, 712 FloatRect Font::selectionRectForComplexText(const TextRun& run,
716 const FloatPoint& point, int height, int from, int to) const 713 const FloatPoint& point, int height, int from, int to) const
717 { 714 {
718 CachingWordShaper& shaper = m_fontFallbackList->cachingWordShaper(); 715 CachingWordShaper& shaper = m_fontFallbackList->cachingWordShaper();
719 return shaper.selectionRect(this, run, point, height, from, to); 716 return shaper.selectionRect(this, run, point, height, from, to);
720 } 717 }
721 718
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 { 828 {
832 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts(); 829 return m_fontFallbackList && m_fontFallbackList->loadingCustomFonts();
833 } 830 }
834 831
835 bool Font::isFallbackValid() const 832 bool Font::isFallbackValid() const
836 { 833 {
837 return !m_fontFallbackList || m_fontFallbackList->isValid(); 834 return !m_fontFallbackList || m_fontFallbackList->isValid();
838 } 835 }
839 836
840 } // namespace blink 837 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698