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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/SVGTextMetricsBuilder.cpp

Issue 2005023005: Use the right TextRun length when checking for surrogate pairs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 6 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/svg/text/unpaired-surrogate-with-trailing-char-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) Research In Motion Limited 2010-2012. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010-2012. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 22 matching lines...) Expand all
33 #include "wtf/Vector.h" 33 #include "wtf/Vector.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 namespace { 37 namespace {
38 38
39 inline bool characterStartsSurrogatePair(const TextRun& run, unsigned index) 39 inline bool characterStartsSurrogatePair(const TextRun& run, unsigned index)
40 { 40 {
41 if (!U16_IS_LEAD(run[index])) 41 if (!U16_IS_LEAD(run[index]))
42 return false; 42 return false;
43 if (index + 1 >= static_cast<unsigned>(run.charactersLength())) 43 if (index + 1 >= static_cast<unsigned>(run.length()))
44 return false; 44 return false;
45 return U16_IS_TRAIL(run[index + 1]); 45 return U16_IS_TRAIL(run[index + 1]);
46 } 46 }
47 47
48 class SVGTextMetricsCalculator { 48 class SVGTextMetricsCalculator {
49 public: 49 public:
50 SVGTextMetricsCalculator(LineLayoutSVGInlineText); 50 SVGTextMetricsCalculator(LineLayoutSVGInlineText);
51 ~SVGTextMetricsCalculator(); 51 ~SVGTextMetricsCalculator();
52 52
53 bool advancePosition(); 53 bool advancePosition();
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 { 351 {
352 walkTree(textRoot, &text); 352 walkTree(textRoot, &text);
353 } 353 }
354 354
355 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(LayoutSVGText& textR oot, SVGCharacterDataMap& allCharactersMap) 355 void SVGTextMetricsBuilder::buildMetricsAndLayoutAttributes(LayoutSVGText& textR oot, SVGCharacterDataMap& allCharactersMap)
356 { 356 {
357 walkTree(textRoot, nullptr, &allCharactersMap); 357 walkTree(textRoot, nullptr, &allCharactersMap);
358 } 358 }
359 359
360 } // namespace blink 360 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/text/unpaired-surrogate-with-trailing-char-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698