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

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

Issue 1982313002: Re-evaluate ShapeResult::m_hasVerticalOffsets after applying spacing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « third_party/WebKit/LayoutTests/fast/text/vertical-spacing-crash-expected.txt ('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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 234
235 // Skip if it's not a grapheme cluster boundary. 235 // Skip if it's not a grapheme cluster boundary.
236 if (i + 1 < run->m_glyphData.size() 236 if (i + 1 < run->m_glyphData.size()
237 && glyphData.characterIndex == run->m_glyphData[i + 1].character Index) { 237 && glyphData.characterIndex == run->m_glyphData[i + 1].character Index) {
238 // In RTL, marks need the same letter-spacing offset as the base . 238 // In RTL, marks need the same letter-spacing offset as the base .
239 if (textRun.rtl() && spacing.letterSpacing()) { 239 if (textRun.rtl() && spacing.letterSpacing()) {
240 offsetX = offsetY = 0; 240 offsetX = offsetY = 0;
241 offset = spacing.letterSpacing(); 241 offset = spacing.letterSpacing();
242 glyphData.offset.expand(offsetX, offsetY); 242 glyphData.offset.expand(offsetX, offsetY);
243 } 243 }
244 continue; 244 } else {
245 offsetX = offsetY = 0;
246 float space = spacing.computeSpacing(textRun,
247 run->m_startIndex + glyphData.characterIndex, offset);
248 glyphData.advance += space;
249 totalSpaceForRun += space;
250 if (textRun.rtl()) {
251 // In RTL, spacing should be added to left side of glyphs.
252 offset += space;
253 }
254 glyphData.offset.expand(offsetX, offsetY);
245 } 255 }
246 256 m_hasVerticalOffsets |= (glyphData.offset.height() != 0);
247 offsetX = offsetY = 0;
248 float space = spacing.computeSpacing(textRun,
249 run->m_startIndex + glyphData.characterIndex, offset);
250 glyphData.advance += space;
251 totalSpaceForRun += space;
252 if (textRun.rtl()) {
253 // In RTL, spacing should be added to left side of glyphs.
254 offset += space;
255 }
256 glyphData.offset.expand(offsetX, offsetY);
257 } 257 }
258 run->m_width += totalSpaceForRun; 258 run->m_width += totalSpaceForRun;
259 totalSpace += totalSpaceForRun; 259 totalSpace += totalSpaceForRun;
260 } 260 }
261 m_width += totalSpace; 261 m_width += totalSpace;
262 if (spacing.isVerticalOffset()) 262 if (spacing.isVerticalOffset())
263 m_glyphBoundingBox.setHeight(m_glyphBoundingBox.height() + totalSpace); 263 m_glyphBoundingBox.setHeight(m_glyphBoundingBox.height() + totalSpace);
264 else 264 else
265 m_glyphBoundingBox.setWidth(m_glyphBoundingBox.width() + totalSpace); 265 m_glyphBoundingBox.setWidth(m_glyphBoundingBox.width() + totalSpace);
266 } 266 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 break; 348 break;
349 } 349 }
350 } 350 }
351 } 351 }
352 // If we didn't find an existing slot to place it, append. 352 // If we didn't find an existing slot to place it, append.
353 if (run) 353 if (run)
354 m_runs.append(run.release()); 354 m_runs.append(run.release());
355 } 355 }
356 356
357 } // namespace blink 357 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/text/vertical-spacing-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698