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

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

Issue 2758683002: Replace ASSERT_NOT_REACHED with NOTREACHED in core/layout/ (Closed)
Patch Set: Rebase with latest Created 3 years, 9 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
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 14 matching lines...) Expand all
25 #include "core/svg/SVGTextContentElement.h" 25 #include "core/svg/SVGTextContentElement.h"
26 26
27 namespace blink { 27 namespace blink {
28 28
29 namespace { 29 namespace {
30 30
31 float calculateTextAnchorShift(const ComputedStyle& style, float length) { 31 float calculateTextAnchorShift(const ComputedStyle& style, float length) {
32 bool isLTR = style.isLeftToRightDirection(); 32 bool isLTR = style.isLeftToRightDirection();
33 switch (style.svgStyle().textAnchor()) { 33 switch (style.svgStyle().textAnchor()) {
34 default: 34 default:
35 ASSERT_NOT_REACHED(); 35 NOTREACHED();
36 case TA_START: 36 case TA_START:
37 return isLTR ? 0 : -length; 37 return isLTR ? 0 : -length;
38 case TA_MIDDLE: 38 case TA_MIDDLE:
39 return -length / 2; 39 return -length / 2;
40 case TA_END: 40 case TA_END:
41 return isLTR ? -length : 0; 41 return isLTR ? -length : 0;
42 } 42 }
43 } 43 }
44 44
45 bool needsTextAnchorAdjustment(const ComputedStyle& style) { 45 bool needsTextAnchorAdjustment(const ComputedStyle& style) {
46 bool isLTR = style.isLeftToRightDirection(); 46 bool isLTR = style.isLeftToRightDirection();
47 switch (style.svgStyle().textAnchor()) { 47 switch (style.svgStyle().textAnchor()) {
48 default: 48 default:
49 ASSERT_NOT_REACHED(); 49 NOTREACHED();
50 case TA_START: 50 case TA_START:
51 return !isLTR; 51 return !isLTR;
52 case TA_MIDDLE: 52 case TA_MIDDLE:
53 return true; 53 return true;
54 case TA_END: 54 case TA_END:
55 return isLTR; 55 return isLTR;
56 } 56 }
57 } 57 }
58 58
59 class ChunkLengthAccumulator { 59 class ChunkLengthAccumulator {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 Vector<SVGTextFragment>& fragments) { 293 Vector<SVGTextFragment>& fragments) {
294 for (SVGTextFragment& fragment : fragments) { 294 for (SVGTextFragment& fragment : fragments) {
295 if (isVerticalText) 295 if (isVerticalText)
296 fragment.y += textAnchorShift; 296 fragment.y += textAnchorShift;
297 else 297 else
298 fragment.x += textAnchorShift; 298 fragment.x += textAnchorShift;
299 } 299 }
300 } 300 }
301 301
302 } // namespace blink 302 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698