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

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

Issue 1360083003: Tweak asserts for dominant-baseline in SVGTextLayoutEngineBaseline (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/LayoutTests/svg/custom/dominant-baseline-propagation-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. All rights reserved. 2 * Copyright (C) Research In Motion Limited 2010. 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 default: 50 default:
51 ASSERT_NOT_REACHED(); 51 ASSERT_NOT_REACHED();
52 return 0; 52 return 0;
53 } 53 }
54 } 54 }
55 55
56 EAlignmentBaseline SVGTextLayoutEngineBaseline::dominantBaselineToAlignmentBasel ine(bool isVerticalText, const LayoutObject* textLayoutObject) const 56 EAlignmentBaseline SVGTextLayoutEngineBaseline::dominantBaselineToAlignmentBasel ine(bool isVerticalText, const LayoutObject* textLayoutObject) const
57 { 57 {
58 ASSERT(textLayoutObject); 58 ASSERT(textLayoutObject);
59 ASSERT(textLayoutObject->style()); 59 ASSERT(textLayoutObject->style());
60 ASSERT(textLayoutObject->parent());
61 ASSERT(textLayoutObject->parent()->style());
62 60
63 const SVGComputedStyle& style = textLayoutObject->style()->svgStyle(); 61 const SVGComputedStyle& style = textLayoutObject->style()->svgStyle();
64 62
65 EDominantBaseline baseline = style.dominantBaseline(); 63 EDominantBaseline baseline = style.dominantBaseline();
66 if (baseline == DB_AUTO) { 64 if (baseline == DB_AUTO) {
67 if (isVerticalText) 65 if (isVerticalText)
68 baseline = DB_CENTRAL; 66 baseline = DB_CENTRAL;
69 else 67 else
70 baseline = DB_ALPHABETIC; 68 baseline = DB_ALPHABETIC;
71 } 69 }
72 70
73 switch (baseline) { 71 switch (baseline) {
74 case DB_USE_SCRIPT: 72 case DB_USE_SCRIPT:
75 // FIXME: The dominant-baseline and the baseline-table components are se t by determining the predominant script of the character data content. 73 // TODO(fs): The dominant-baseline and the baseline-table components
74 // are set by determining the predominant script of the character data
75 // content.
76 return AB_ALPHABETIC; 76 return AB_ALPHABETIC;
77 case DB_NO_CHANGE: 77 case DB_NO_CHANGE:
78 ASSERT(textLayoutObject->parent());
78 return dominantBaselineToAlignmentBaseline(isVerticalText, textLayoutObj ect->parent()); 79 return dominantBaselineToAlignmentBaseline(isVerticalText, textLayoutObj ect->parent());
79 case DB_RESET_SIZE: 80 case DB_RESET_SIZE:
81 ASSERT(textLayoutObject->parent());
80 return dominantBaselineToAlignmentBaseline(isVerticalText, textLayoutObj ect->parent()); 82 return dominantBaselineToAlignmentBaseline(isVerticalText, textLayoutObj ect->parent());
81 case DB_IDEOGRAPHIC: 83 case DB_IDEOGRAPHIC:
82 return AB_IDEOGRAPHIC; 84 return AB_IDEOGRAPHIC;
83 case DB_ALPHABETIC: 85 case DB_ALPHABETIC:
84 return AB_ALPHABETIC; 86 return AB_ALPHABETIC;
85 case DB_HANGING: 87 case DB_HANGING:
86 return AB_HANGING; 88 return AB_HANGING;
87 case DB_MATHEMATICAL: 89 case DB_MATHEMATICAL:
88 return AB_MATHEMATICAL; 90 return AB_MATHEMATICAL;
89 case DB_CENTRAL: 91 case DB_CENTRAL:
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 } 226 }
225 227
226 // Horizontal advance calculation. 228 // Horizontal advance calculation.
227 if (angle && !orientationIsMultiplyOf180Degrees) 229 if (angle && !orientationIsMultiplyOf180Degrees)
228 return metrics.height(); 230 return metrics.height();
229 231
230 return metrics.width(); 232 return metrics.width();
231 } 233 }
232 234
233 } 235 }
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/custom/dominant-baseline-propagation-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698