Skip to content
Permalink
Browse files
[Qt] Avoid calling QFont::detach too often from FontQt
https://bugs.webkit.org/show_bug.cgi?id=35569

The letter- and wordspacing is inside the WebCore::Font class,
our QFont is located in the WebCore::FontPlatformData. Everytime
we need to use a QFont inside WebCore::Font we are calling the
font method which gets the QFont from the WebCore::FontPlatformData
and is applying the letter- and wordspacing. Internally this
will attempt to detach the QFont...

Avoid calling setLetterSpacing and setWordSpacing on QFont if
the WebCore::Font has the default applied.

* platform/graphics/qt/FontQt.cpp:
(WebCore::Font::font):

Canonical link: https://commits.webkit.org/46815@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@55518 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
zecke committed Mar 4, 2010
1 parent f50e882 commit 0e7ffe31c4396250d92eac1305335440730f5288
Showing 2 changed files with 24 additions and 2 deletions.
@@ -1,3 +1,23 @@
2010-03-02 Holger Hans Peter Freyther <zecke@selfish.org>

Reviewed by Simon Hausmann.

[Qt] Avoid calling QFont::detach too often from FontQt
https://bugs.webkit.org/show_bug.cgi?id=35569

The letter- and wordspacing is inside the WebCore::Font class,
our QFont is located in the WebCore::FontPlatformData. Everytime
we need to use a QFont inside WebCore::Font we are calling the
font method which gets the QFont from the WebCore::FontPlatformData
and is applying the letter- and wordspacing. Internally this
will attempt to detach the QFont...

Avoid calling setLetterSpacing and setWordSpacing on QFont if
the WebCore::Font has the default applied.

* platform/graphics/qt/FontQt.cpp:
(WebCore::Font::font):

2010-03-04 Alexander Pavlov <apavlov@chromium.org>

Reviewed by Pavel Feldman.
@@ -219,8 +219,10 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, const IntPoint&
QFont Font::font() const
{
QFont f = primaryFont()->getQtFont();
f.setLetterSpacing(QFont::AbsoluteSpacing, m_letterSpacing);
f.setWordSpacing(m_wordSpacing);
if (m_letterSpacing != 0)
f.setLetterSpacing(QFont::AbsoluteSpacing, m_letterSpacing);
if (m_wordSpacing != 0)
f.setWordSpacing(m_wordSpacing);
return f;
}

0 comments on commit 0e7ffe3

Please sign in to comment.