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

Side by Side Diff: WebCore/rendering/RenderListMarker.cpp

Issue 437065: Merge WebKit 51201: Do not assert when a high number is used for roman numera... (Closed) Base URL: svn://chrome-svn/chrome/branches/WebKit/249/
Patch Set: Created 11 years 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 | « LayoutTests/fast/lists/ol-start-roman-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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv ed.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 30 matching lines...) Expand all
41 const int cMarkerPadding = 7; 41 const int cMarkerPadding = 7;
42 42
43 static String toRoman(int number, bool upper) 43 static String toRoman(int number, bool upper)
44 { 44 {
45 // FIXME: CSS3 describes how to make this work for much larger numbers, 45 // FIXME: CSS3 describes how to make this work for much larger numbers,
46 // using overbars and special characters. It also specifies the characters 46 // using overbars and special characters. It also specifies the characters
47 // in the range U+2160 to U+217F instead of standard ASCII ones. 47 // in the range U+2160 to U+217F instead of standard ASCII ones.
48 if (number < 1 || number > 3999) 48 if (number < 1 || number > 3999)
49 return String::number(number); 49 return String::number(number);
50 50
51 const int lettersSize = 12; // big enough for three each of I, X, C, and M 51 // Big enough to store largest roman number less than 3999 which
52 // is 3888 (MMMDCCCLXXXVIII)
53 const int lettersSize = 15;
52 UChar letters[lettersSize]; 54 UChar letters[lettersSize];
53 55
54 int length = 0; 56 int length = 0;
55 const UChar ldigits[] = { 'i', 'v', 'x', 'l', 'c', 'd', 'm' }; 57 const UChar ldigits[] = { 'i', 'v', 'x', 'l', 'c', 'd', 'm' };
56 const UChar udigits[] = { 'I', 'V', 'X', 'L', 'C', 'D', 'M' }; 58 const UChar udigits[] = { 'I', 'V', 'X', 'L', 'C', 'D', 'M' };
57 const UChar* digits = upper ? udigits : ldigits; 59 const UChar* digits = upper ? udigits : ldigits;
58 int d = 0; 60 int d = 0;
59 do { 61 do {
60 int num = number % 10; 62 int num = number % 10;
61 if (num % 5 < 4) 63 if (num % 5 < 4)
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 897
896 if (clipToVisibleContent) 898 if (clipToVisibleContent)
897 computeRectForRepaint(repaintContainer, rect); 899 computeRectForRepaint(repaintContainer, rect);
898 else 900 else
899 rect = localToContainerQuad(FloatRect(rect), repaintContainer).enclosing BoundingBox(); 901 rect = localToContainerQuad(FloatRect(rect), repaintContainer).enclosing BoundingBox();
900 902
901 return rect; 903 return rect;
902 } 904 }
903 905
904 } // namespace WebCore 906 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/lists/ol-start-roman-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698