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

Side by Side Diff: Source/platform/fonts/shaping/HarfBuzzShaper.cpp

Issue 648633003: Unify selection rect snapping logic (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « Source/platform/fonts/Font.cpp ('k') | 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) 2012 Google Inc. All rights reserved. 2 * Copyright (c) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 BlackBerry Limited. All rights reserved. 3 * Copyright (C) 2013 BlackBerry Limited. 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 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 if (!m_run.rtl()) 1139 if (!m_run.rtl())
1140 currentX += m_harfBuzzRuns[i]->width(); 1140 currentX += m_harfBuzzRuns[i]->width();
1141 } 1141 }
1142 1142
1143 // The position in question might be just after the text. 1143 // The position in question might be just after the text.
1144 if (!foundFromX) 1144 if (!foundFromX)
1145 fromX = 0; 1145 fromX = 0;
1146 if (!foundToX) 1146 if (!foundToX)
1147 toX = m_run.rtl() ? 0 : m_totalWidth; 1147 toX = m_run.rtl() ? 0 : m_totalWidth;
1148 1148
1149 if (fromX < toX) { 1149 if (fromX < toX)
1150 return Font::pixelSnappedSelectionRect( 1150 return FloatRect(point.x() + fromX, point.y(), toX - fromX, height);
1151 point.x() + fromX, point.x() + toX, 1151 return FloatRect(point.x() + toX, point.y(), fromX - toX, height);
1152 point.y(), height);
1153 }
1154
1155 return Font::pixelSnappedSelectionRect(
1156 point.x() + toX, point.x() + fromX,
1157 point.y(), height);
1158 } 1152 }
1159 1153
1160 } // namespace blink 1154 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/Font.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698