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

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

Issue 2331783002: Fix tab is invisible when the next stop is close (Closed)
Patch Set: Cleanup Created 4 years, 3 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/Source/platform/fonts/shaping/HarfBuzzShaper.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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 m_runs.insert(pos, std::move(run)); 355 m_runs.insert(pos, std::move(run));
356 break; 356 break;
357 } 357 }
358 } 358 }
359 } 359 }
360 // If we didn't find an existing slot to place it, append. 360 // If we didn't find an existing slot to place it, append.
361 if (run) 361 if (run)
362 m_runs.append(std::move(run)); 362 m_runs.append(std::move(run));
363 } 363 }
364 364
365 PassRefPtr<ShapeResult> ShapeResult::createForTabulationCharacters(const Font* f ont,
366 const TextRun& textRun, float positionOffset, unsigned count)
367 {
368 const SimpleFontData* fontData = font->primaryFont();
369 std::unique_ptr<ShapeResult::RunInfo> run = wrapUnique(new ShapeResult::RunI nfo(fontData,
370 // Tab characters are always LTR or RTL, not TTB, even when isVerticalAn yUpright().
371 textRun.rtl() ? HB_DIRECTION_RTL : HB_DIRECTION_LTR,
372 HB_SCRIPT_COMMON, 0, count, count));
373 float position = textRun.xPos() + positionOffset;
374 float startPosition = position;
375 for (unsigned i = 0; i < count; i++) {
376 float advance = font->tabWidth(*fontData, textRun.getTabSize(), position );
377 run->m_glyphData[i].characterIndex = i;
378 run->setGlyphAndPositions(i, fontData->spaceGlyph(), advance, 0, 0);
379 position += advance;
380 }
381 run->m_width = position - startPosition;
382
383 RefPtr<ShapeResult> result = ShapeResult::create(font, count, textRun.direct ion());
384 result->m_width = run->m_width;
385 result->m_numGlyphs = count;
386 DCHECK_EQ(result->m_numGlyphs, count); // no overflow
387 result->m_hasVerticalOffsets = fontData->platformData().isVerticalAnyUpright ();
388 result->m_runs.append(std::move(run));
389 return result.release();
390 }
391
365 } // namespace blink 392 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzShaper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698