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

Side by Side Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 787073006: Fix number handling in accumulatePixelsAndPercent. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Release parsedCalculation Created 5 years, 11 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 | « LayoutTests/css3/calc/calc-with-percent-and-number-in-line-height-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) 2003 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. 9 * Copyright (C) 2012 Intel Corporation. All rights reserved.
10 * 10 *
(...skipping 4666 matching lines...) Expand 10 before | Expand all | Expand 10 after
4677 bool CSSPropertyParser::parseLineHeight(bool important) 4677 bool CSSPropertyParser::parseLineHeight(bool important)
4678 { 4678 {
4679 CSSParserValue* value = m_valueList->current(); 4679 CSSParserValue* value = m_valueList->current();
4680 CSSValueID id = value->id; 4680 CSSValueID id = value->id;
4681 bool validPrimitive = false; 4681 bool validPrimitive = false;
4682 // normal | <number> | <length> | <percentage> | inherit 4682 // normal | <number> | <length> | <percentage> | inherit
4683 if (id == CSSValueNormal) 4683 if (id == CSSValueNormal)
4684 validPrimitive = true; 4684 validPrimitive = true;
4685 else 4685 else
4686 validPrimitive = (!id && validUnit(value, FNumber | FLength | FPercent | FNonNeg)); 4686 validPrimitive = (!id && validUnit(value, FNumber | FLength | FPercent | FNonNeg));
4687 // The line-height property can accept both percents and numbers but additiv e opertaions are
4688 // not permitted on them in calc() expressions.
4689 if (m_parsedCalculation && m_parsedCalculation->category() == CalcPercentNum ber) {
4690 validPrimitive = false;
4691 m_parsedCalculation.release();
4692 }
4687 if (validPrimitive && (!m_valueList->next() || inShorthand())) 4693 if (validPrimitive && (!m_valueList->next() || inShorthand()))
4688 addProperty(CSSPropertyLineHeight, parseValidPrimitive(id, value), impor tant); 4694 addProperty(CSSPropertyLineHeight, parseValidPrimitive(id, value), impor tant);
4689 return validPrimitive; 4695 return validPrimitive;
4690 } 4696 }
4691 4697
4692 bool CSSPropertyParser::parseFontSize(bool important) 4698 bool CSSPropertyParser::parseFontSize(bool important)
4693 { 4699 {
4694 CSSParserValue* value = m_valueList->current(); 4700 CSSParserValue* value = m_valueList->current();
4695 CSSValueID id = value->id; 4701 CSSValueID id = value->id;
4696 bool validPrimitive = false; 4702 bool validPrimitive = false;
(...skipping 3873 matching lines...) Expand 10 before | Expand all | Expand 10 after
8570 } 8576 }
8571 } 8577 }
8572 8578
8573 if (!list->length()) 8579 if (!list->length())
8574 return nullptr; 8580 return nullptr;
8575 8581
8576 return list.release(); 8582 return list.release();
8577 } 8583 }
8578 8584
8579 } // namespace blink 8585 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/css3/calc/calc-with-percent-and-number-in-line-height-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698