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

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

Issue 2231623002: Prevent integer overflow in ComputedStyle::outlineOutsetExtent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added layout test Created 4 years, 4 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/fast/css/outline-offset-large-expected.html ('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 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 reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. 4 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "platform/RuntimeEnabledFeatures.h" 45 #include "platform/RuntimeEnabledFeatures.h"
46 #include "platform/fonts/Font.h" 46 #include "platform/fonts/Font.h"
47 #include "platform/fonts/FontSelector.h" 47 #include "platform/fonts/FontSelector.h"
48 #include "platform/geometry/FloatRoundedRect.h" 48 #include "platform/geometry/FloatRoundedRect.h"
49 #include "platform/graphics/GraphicsContext.h" 49 #include "platform/graphics/GraphicsContext.h"
50 #include "platform/transforms/RotateTransformOperation.h" 50 #include "platform/transforms/RotateTransformOperation.h"
51 #include "platform/transforms/ScaleTransformOperation.h" 51 #include "platform/transforms/ScaleTransformOperation.h"
52 #include "platform/transforms/TranslateTransformOperation.h" 52 #include "platform/transforms/TranslateTransformOperation.h"
53 #include "wtf/MathExtras.h" 53 #include "wtf/MathExtras.h"
54 #include "wtf/PtrUtil.h" 54 #include "wtf/PtrUtil.h"
55 #include "wtf/SaturatedArithmetic.h"
55 #include <algorithm> 56 #include <algorithm>
56 #include <memory> 57 #include <memory>
57 58
58 namespace blink { 59 namespace blink {
59 60
60 struct SameSizeAsBorderValue { 61 struct SameSizeAsBorderValue {
61 RGBA32 m_color; 62 RGBA32 m_color;
62 unsigned m_width; 63 unsigned m_width;
63 }; 64 };
64 65
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 { 1778 {
1778 m_rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = pat h; 1779 m_rareNonInheritedData.access()->m_transform.access()->m_motion.m_path = pat h;
1779 } 1780 }
1780 1781
1781 int ComputedStyle::outlineOutsetExtent() const 1782 int ComputedStyle::outlineOutsetExtent() const
1782 { 1783 {
1783 if (!hasOutline()) 1784 if (!hasOutline())
1784 return 0; 1785 return 0;
1785 if (outlineStyleIsAuto()) 1786 if (outlineStyleIsAuto())
1786 return GraphicsContext::focusRingOutsetExtent(outlineOffset(), outlineWi dth()); 1787 return GraphicsContext::focusRingOutsetExtent(outlineOffset(), outlineWi dth());
1787 return std::max(0, outlineWidth() + outlineOffset()); 1788 return std::max(0, saturatedAddition(outlineWidth(), outlineOffset()));
1788 } 1789 }
1789 1790
1790 bool ComputedStyle::columnRuleEquivalent(const ComputedStyle* otherStyle) const 1791 bool ComputedStyle::columnRuleEquivalent(const ComputedStyle* otherStyle) const
1791 { 1792 {
1792 return columnRuleStyle() == otherStyle->columnRuleStyle() 1793 return columnRuleStyle() == otherStyle->columnRuleStyle()
1793 && columnRuleWidth() == otherStyle->columnRuleWidth() 1794 && columnRuleWidth() == otherStyle->columnRuleWidth()
1794 && visitedDependentColor(CSSPropertyColumnRuleColor) == otherStyle->visi tedDependentColor(CSSPropertyColumnRuleColor); 1795 && visitedDependentColor(CSSPropertyColumnRuleColor) == otherStyle->visi tedDependentColor(CSSPropertyColumnRuleColor);
1795 } 1796 }
1796 1797
1797 TextEmphasisMark ComputedStyle::getTextEmphasisMark() const 1798 TextEmphasisMark ComputedStyle::getTextEmphasisMark() const
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1958 if (value < 0) 1959 if (value < 0)
1959 fvalue -= 0.5f; 1960 fvalue -= 0.5f;
1960 else 1961 else
1961 fvalue += 0.5f; 1962 fvalue += 0.5f;
1962 } 1963 }
1963 1964
1964 return roundForImpreciseConversion<int>(fvalue / zoomFactor); 1965 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
1965 } 1966 }
1966 1967
1967 } // namespace blink 1968 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css/outline-offset-large-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698