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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2751653003: Replace ASSERT and ASSERT_NOT_REACHED in core/style/ (Closed)
Patch Set: Replace ASSERT and ASSERT_NOT_REACHED in core/style/ 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) 1999 Antti Koivisto (koivisto@kde.org) 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
4 * reserved. 4 * reserved.
5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 } 453 }
454 454
455 return 0; 455 return 0;
456 } 456 }
457 457
458 ComputedStyle* ComputedStyle::addCachedPseudoStyle( 458 ComputedStyle* ComputedStyle::addCachedPseudoStyle(
459 PassRefPtr<ComputedStyle> pseudo) { 459 PassRefPtr<ComputedStyle> pseudo) {
460 if (!pseudo) 460 if (!pseudo)
461 return 0; 461 return 0;
462 462
463 ASSERT(pseudo->styleType() > PseudoIdNone); 463 DCHECK_GT(pseudo->styleType(), PseudoIdNone);
464 464
465 ComputedStyle* result = pseudo.get(); 465 ComputedStyle* result = pseudo.get();
466 466
467 if (!m_cachedPseudoStyles) 467 if (!m_cachedPseudoStyles)
468 m_cachedPseudoStyles = WTF::wrapUnique(new PseudoStyleCache); 468 m_cachedPseudoStyles = WTF::wrapUnique(new PseudoStyleCache);
469 469
470 m_cachedPseudoStyles->push_back(pseudo); 470 m_cachedPseudoStyles->push_back(pseudo);
471 471
472 return result; 472 return result;
473 } 473 }
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 case TextEmphasisMarkSesame: { 1655 case TextEmphasisMarkSesame: {
1656 DEFINE_STATIC_LOCAL(AtomicString, filledSesameString, 1656 DEFINE_STATIC_LOCAL(AtomicString, filledSesameString,
1657 (&sesameDotCharacter, 1)); 1657 (&sesameDotCharacter, 1));
1658 DEFINE_STATIC_LOCAL(AtomicString, openSesameString, 1658 DEFINE_STATIC_LOCAL(AtomicString, openSesameString,
1659 (&whiteSesameDotCharacter, 1)); 1659 (&whiteSesameDotCharacter, 1));
1660 return getTextEmphasisFill() == TextEmphasisFillFilled 1660 return getTextEmphasisFill() == TextEmphasisFillFilled
1661 ? filledSesameString 1661 ? filledSesameString
1662 : openSesameString; 1662 : openSesameString;
1663 } 1663 }
1664 case TextEmphasisMarkAuto: 1664 case TextEmphasisMarkAuto:
1665 ASSERT_NOT_REACHED(); 1665 NOTREACHED();
1666 return nullAtom; 1666 return nullAtom;
1667 } 1667 }
1668 1668
1669 ASSERT_NOT_REACHED(); 1669 NOTREACHED();
1670 return nullAtom; 1670 return nullAtom;
1671 } 1671 }
1672 1672
1673 CSSAnimationData& ComputedStyle::accessAnimations() { 1673 CSSAnimationData& ComputedStyle::accessAnimations() {
1674 if (!m_rareNonInheritedData.access()->m_animations) 1674 if (!m_rareNonInheritedData.access()->m_animations)
1675 m_rareNonInheritedData.access()->m_animations = CSSAnimationData::create(); 1675 m_rareNonInheritedData.access()->m_animations = CSSAnimationData::create();
1676 return *m_rareNonInheritedData->m_animations; 1676 return *m_rareNonInheritedData->m_animations;
1677 } 1677 }
1678 1678
1679 CSSTransitionData& ComputedStyle::accessTransitions() { 1679 CSSTransitionData& ComputedStyle::accessTransitions() {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1962 desc.setLetterSpacing(letterSpacing); 1962 desc.setLetterSpacing(letterSpacing);
1963 setFontDescription(desc); 1963 setFontDescription(desc);
1964 font().update(currentFontSelector); 1964 font().update(currentFontSelector);
1965 } 1965 }
1966 1966
1967 void ComputedStyle::setTextAutosizingMultiplier(float multiplier) { 1967 void ComputedStyle::setTextAutosizingMultiplier(float multiplier) {
1968 SET_VAR(m_styleInheritedData, textAutosizingMultiplier, multiplier); 1968 SET_VAR(m_styleInheritedData, textAutosizingMultiplier, multiplier);
1969 1969
1970 float size = specifiedFontSize(); 1970 float size = specifiedFontSize();
1971 1971
1972 ASSERT(std::isfinite(size)); 1972 DCHECK(std::isfinite(size));
1973 if (!std::isfinite(size) || size < 0) 1973 if (!std::isfinite(size) || size < 0)
1974 size = 0; 1974 size = 0;
1975 else 1975 else
1976 size = std::min(maximumAllowedFontSize, size); 1976 size = std::min(maximumAllowedFontSize, size);
1977 1977
1978 FontSelector* currentFontSelector = font().getFontSelector(); 1978 FontSelector* currentFontSelector = font().getFontSelector();
1979 FontDescription desc(getFontDescription()); 1979 FontDescription desc(getFontDescription());
1980 desc.setSpecifiedSize(size); 1980 desc.setSpecifiedSize(size);
1981 desc.setComputedSize(size); 1981 desc.setComputedSize(size);
1982 1982
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2156 case CSSPropertyStopColor: 2156 case CSSPropertyStopColor:
2157 result = stopColor(); 2157 result = stopColor();
2158 break; 2158 break;
2159 case CSSPropertyWebkitTapHighlightColor: 2159 case CSSPropertyWebkitTapHighlightColor:
2160 result = tapHighlightColor(); 2160 result = tapHighlightColor();
2161 break; 2161 break;
2162 case CSSPropertyTextDecorationColor: 2162 case CSSPropertyTextDecorationColor:
2163 result = decorationColorIncludingFallback(visitedLink); 2163 result = decorationColorIncludingFallback(visitedLink);
2164 break; 2164 break;
2165 default: 2165 default:
2166 ASSERT_NOT_REACHED(); 2166 NOTREACHED();
2167 break; 2167 break;
2168 } 2168 }
2169 2169
2170 if (!result.isCurrentColor()) 2170 if (!result.isCurrentColor())
2171 return result.getColor(); 2171 return result.getColor();
2172 2172
2173 // FIXME: Treating styled borders with initial color differently causes 2173 // FIXME: Treating styled borders with initial color differently causes
2174 // problems, see crbug.com/316559, crbug.com/276231 2174 // problems, see crbug.com/316559, crbug.com/276231
2175 if (!visitedLink && 2175 if (!visitedLink &&
2176 (borderStyle == BorderStyleInset || borderStyle == BorderStyleOutset || 2176 (borderStyle == BorderStyleInset || borderStyle == BorderStyleOutset ||
(...skipping 28 matching lines...) Expand all
2205 2205
2206 const BorderValue& ComputedStyle::borderBefore() const { 2206 const BorderValue& ComputedStyle::borderBefore() const {
2207 switch (getWritingMode()) { 2207 switch (getWritingMode()) {
2208 case WritingMode::kHorizontalTb: 2208 case WritingMode::kHorizontalTb:
2209 return borderTop(); 2209 return borderTop();
2210 case WritingMode::kVerticalLr: 2210 case WritingMode::kVerticalLr:
2211 return borderLeft(); 2211 return borderLeft();
2212 case WritingMode::kVerticalRl: 2212 case WritingMode::kVerticalRl:
2213 return borderRight(); 2213 return borderRight();
2214 } 2214 }
2215 ASSERT_NOT_REACHED(); 2215 NOTREACHED();
2216 return borderTop(); 2216 return borderTop();
2217 } 2217 }
2218 2218
2219 const BorderValue& ComputedStyle::borderAfter() const { 2219 const BorderValue& ComputedStyle::borderAfter() const {
2220 switch (getWritingMode()) { 2220 switch (getWritingMode()) {
2221 case WritingMode::kHorizontalTb: 2221 case WritingMode::kHorizontalTb:
2222 return borderBottom(); 2222 return borderBottom();
2223 case WritingMode::kVerticalLr: 2223 case WritingMode::kVerticalLr:
2224 return borderRight(); 2224 return borderRight();
2225 case WritingMode::kVerticalRl: 2225 case WritingMode::kVerticalRl:
2226 return borderLeft(); 2226 return borderLeft();
2227 } 2227 }
2228 ASSERT_NOT_REACHED(); 2228 NOTREACHED();
2229 return borderBottom(); 2229 return borderBottom();
2230 } 2230 }
2231 2231
2232 const BorderValue& ComputedStyle::borderStart() const { 2232 const BorderValue& ComputedStyle::borderStart() const {
2233 if (isHorizontalWritingMode()) 2233 if (isHorizontalWritingMode())
2234 return isLeftToRightDirection() ? borderLeft() : borderRight(); 2234 return isLeftToRightDirection() ? borderLeft() : borderRight();
2235 return isLeftToRightDirection() ? borderTop() : borderBottom(); 2235 return isLeftToRightDirection() ? borderTop() : borderBottom();
2236 } 2236 }
2237 2237
2238 const BorderValue& ComputedStyle::borderEnd() const { 2238 const BorderValue& ComputedStyle::borderEnd() const {
2239 if (isHorizontalWritingMode()) 2239 if (isHorizontalWritingMode())
2240 return isLeftToRightDirection() ? borderRight() : borderLeft(); 2240 return isLeftToRightDirection() ? borderRight() : borderLeft();
2241 return isLeftToRightDirection() ? borderBottom() : borderTop(); 2241 return isLeftToRightDirection() ? borderBottom() : borderTop();
2242 } 2242 }
2243 2243
2244 float ComputedStyle::borderBeforeWidth() const { 2244 float ComputedStyle::borderBeforeWidth() const {
2245 switch (getWritingMode()) { 2245 switch (getWritingMode()) {
2246 case WritingMode::kHorizontalTb: 2246 case WritingMode::kHorizontalTb:
2247 return borderTopWidth(); 2247 return borderTopWidth();
2248 case WritingMode::kVerticalLr: 2248 case WritingMode::kVerticalLr:
2249 return borderLeftWidth(); 2249 return borderLeftWidth();
2250 case WritingMode::kVerticalRl: 2250 case WritingMode::kVerticalRl:
2251 return borderRightWidth(); 2251 return borderRightWidth();
2252 } 2252 }
2253 ASSERT_NOT_REACHED(); 2253 NOTREACHED();
2254 return borderTopWidth(); 2254 return borderTopWidth();
2255 } 2255 }
2256 2256
2257 float ComputedStyle::borderAfterWidth() const { 2257 float ComputedStyle::borderAfterWidth() const {
2258 switch (getWritingMode()) { 2258 switch (getWritingMode()) {
2259 case WritingMode::kHorizontalTb: 2259 case WritingMode::kHorizontalTb:
2260 return borderBottomWidth(); 2260 return borderBottomWidth();
2261 case WritingMode::kVerticalLr: 2261 case WritingMode::kVerticalLr:
2262 return borderRightWidth(); 2262 return borderRightWidth();
2263 case WritingMode::kVerticalRl: 2263 case WritingMode::kVerticalRl:
2264 return borderLeftWidth(); 2264 return borderLeftWidth();
2265 } 2265 }
2266 ASSERT_NOT_REACHED(); 2266 NOTREACHED();
2267 return borderBottomWidth(); 2267 return borderBottomWidth();
2268 } 2268 }
2269 2269
2270 float ComputedStyle::borderStartWidth() const { 2270 float ComputedStyle::borderStartWidth() const {
2271 if (isHorizontalWritingMode()) 2271 if (isHorizontalWritingMode())
2272 return isLeftToRightDirection() ? borderLeftWidth() : borderRightWidth(); 2272 return isLeftToRightDirection() ? borderLeftWidth() : borderRightWidth();
2273 return isLeftToRightDirection() ? borderTopWidth() : borderBottomWidth(); 2273 return isLeftToRightDirection() ? borderTopWidth() : borderBottomWidth();
2274 } 2274 }
2275 2275
2276 float ComputedStyle::borderEndWidth() const { 2276 float ComputedStyle::borderEndWidth() const {
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2499 if (value < 0) 2499 if (value < 0)
2500 fvalue -= 0.5f; 2500 fvalue -= 0.5f;
2501 else 2501 else
2502 fvalue += 0.5f; 2502 fvalue += 0.5f;
2503 } 2503 }
2504 2504
2505 return roundForImpreciseConversion<int>(fvalue / zoomFactor); 2505 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
2506 } 2506 }
2507 2507
2508 } // namespace blink 2508 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ClipPathOperation.h ('k') | third_party/WebKit/Source/core/style/ContentData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698