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

Side by Side Diff: third_party/WebKit/WebCore/platform/graphics/chromium/FontChromiumWin.cpp

Issue 62158: Preflight crash fix for bug 9796.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007 Apple Computer, Inc. 2 * Copyright (C) 2006, 2007 Apple Computer, Inc.
3 * Copyright (c) 2006, 2007, 2008, 2009, Google Inc. All rights reserved. 3 * Copyright (c) 2006, 2007, 2008, 2009, Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 // This case really really sucks. There is no convenient way to estimate 316 // This case really really sucks. There is no convenient way to estimate
317 // the bounding box. So we run Uniscribe twice. If we find this happens a 317 // the bounding box. So we run Uniscribe twice. If we find this happens a
318 // lot, the way to fix it is to make the extra layer after the 318 // lot, the way to fix it is to make the extra layer after the
319 // UniscribeHelper has measured the text. 319 // UniscribeHelper has measured the text.
320 IntPoint intPoint(lroundf(m_point.x()), 320 IntPoint intPoint(lroundf(m_point.x()),
321 lroundf(m_point.y())); 321 lroundf(m_point.y()));
322 322
323 UniscribeHelperTextRun state(m_run, *m_font); 323 UniscribeHelperTextRun state(m_run, *m_font);
324 int left = lroundf(m_point.x()) + state.characterToX(m_from); 324 int left = lroundf(m_point.x()) + state.characterToX(m_from);
325 int right = lroundf(m_point.x()) + state.characterToX(m_to); 325 int right = lroundf(m_point.x()) + state.characterToX(m_to);
326
327 // Adjust for RTL script since we just want to know the text bounds.
328 if (left > right)
329 std::swap(left, right);
326 330
327 // This algorithm for estimating how much extra space we need (the text may 331 // This algorithm for estimating how much extra space we need (the text may
328 // go outside the selection rect) is based roughly on 332 // go outside the selection rect) is based roughly on
329 // TransparencyAwareGlyphPainter::estimateTextBounds above. 333 // TransparencyAwareGlyphPainter::estimateTextBounds above.
330 return IntRect(left - (m_font->ascent() + m_font->descent()) / 2, 334 return IntRect(left - (m_font->ascent() + m_font->descent()) / 2,
331 m_point.y() - m_font->ascent() - m_font->lineGap(), 335 m_point.y() - m_font->ascent() - m_font->lineGap(),
332 (right - left) + m_font->ascent() + m_font->descent(), 336 (right - left) + m_font->ascent() + m_font->descent(),
333 m_font->lineSpacing()); 337 m_font->lineSpacing());
334 } 338 }
335 339
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 int charIndex = state.xToCharacter(x); 475 int charIndex = state.xToCharacter(x);
472 476
473 // XToCharacter will return -1 if the position is before the first 477 // XToCharacter will return -1 if the position is before the first
474 // character (we get called like this sometimes). 478 // character (we get called like this sometimes).
475 if (charIndex < 0) 479 if (charIndex < 0)
476 charIndex = 0; 480 charIndex = 0;
477 return charIndex; 481 return charIndex;
478 } 482 }
479 483
480 } // namespace WebCore 484 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698