OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
12 * | 12 * |
13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
17 * | 17 * |
18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 #ifndef ComputedStyle_h | 25 #ifndef ComputedStyle_h |
26 #define ComputedStyle_h | 26 #define ComputedStyle_h |
27 | 27 |
28 #include "core/CSSPropertyNames.h" | 28 #include "core/CSSPropertyNames.h" |
29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
30 #include "core/css/CSSPrimitiveValue.h" | |
31 #include "core/style/BorderValue.h" | 30 #include "core/style/BorderValue.h" |
32 #include "core/style/CounterDirectives.h" | 31 #include "core/style/CounterDirectives.h" |
33 #include "core/style/DataRef.h" | 32 #include "core/style/DataRef.h" |
34 #include "core/style/ComputedStyleConstants.h" | 33 #include "core/style/ComputedStyleConstants.h" |
35 #include "core/style/LineClampValue.h" | 34 #include "core/style/LineClampValue.h" |
36 #include "core/style/NinePieceImage.h" | 35 #include "core/style/NinePieceImage.h" |
37 #include "core/style/SVGComputedStyle.h" | 36 #include "core/style/SVGComputedStyle.h" |
38 #include "core/style/StyleBackgroundData.h" | 37 #include "core/style/StyleBackgroundData.h" |
39 #include "core/style/StyleBoxData.h" | 38 #include "core/style/StyleBoxData.h" |
40 #include "core/style/StyleContentAlignmentData.h" | 39 #include "core/style/StyleContentAlignmentData.h" |
(...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 bool diffNeedsPaintInvalidationObject(const ComputedStyle& other) const; | 1924 bool diffNeedsPaintInvalidationObject(const ComputedStyle& other) const; |
1926 bool diffNeedsPaintInvalidationObjectForPaintImage(const StyleImage*, const
ComputedStyle& other) const; | 1925 bool diffNeedsPaintInvalidationObjectForPaintImage(const StyleImage*, const
ComputedStyle& other) const; |
1927 void updatePropertySpecificDifferences(const ComputedStyle& other, StyleDiff
erence&) const; | 1926 void updatePropertySpecificDifferences(const ComputedStyle& other, StyleDiff
erence&) const; |
1928 | 1927 |
1929 bool requireTransformOrigin(ApplyTransformOrigin applyOrigin, ApplyMotionPat
h) const; | 1928 bool requireTransformOrigin(ApplyTransformOrigin applyOrigin, ApplyMotionPat
h) const; |
1930 static bool shadowListHasCurrentColor(const ShadowList*); | 1929 static bool shadowListHasCurrentColor(const ShadowList*); |
1931 }; | 1930 }; |
1932 | 1931 |
1933 // FIXME: Reduce/remove the dependency on zoom adjusted int values. | 1932 // FIXME: Reduce/remove the dependency on zoom adjusted int values. |
1934 // The float or LayoutUnit versions of layout values should be used. | 1933 // The float or LayoutUnit versions of layout values should be used. |
1935 inline int adjustForAbsoluteZoom(int value, float zoomFactor) | 1934 int adjustForAbsoluteZoom(int value, float zoomFactor); |
1936 { | |
1937 if (zoomFactor == 1) | |
1938 return value; | |
1939 // Needed because computeLengthInt truncates (rather than rounds) when scali
ng up. | |
1940 float fvalue = value; | |
1941 if (zoomFactor > 1) { | |
1942 if (value < 0) | |
1943 fvalue -= 0.5f; | |
1944 else | |
1945 fvalue += 0.5f; | |
1946 } | |
1947 | |
1948 return roundForImpreciseConversion<int>(fvalue / zoomFactor); | |
1949 } | |
1950 | 1935 |
1951 inline int adjustForAbsoluteZoom(int value, const ComputedStyle* style) | 1936 inline int adjustForAbsoluteZoom(int value, const ComputedStyle* style) |
1952 { | 1937 { |
1953 return adjustForAbsoluteZoom(value, style->effectiveZoom()); | 1938 float zoomFactor = style->effectiveZoom(); |
| 1939 if (zoomFactor == 1) |
| 1940 return value; |
| 1941 return adjustForAbsoluteZoom(value, zoomFactor); |
1954 } | 1942 } |
1955 | 1943 |
1956 inline float adjustFloatForAbsoluteZoom(float value, const ComputedStyle& style) | 1944 inline float adjustFloatForAbsoluteZoom(float value, const ComputedStyle& style) |
1957 { | 1945 { |
1958 return value / style.effectiveZoom(); | 1946 return value / style.effectiveZoom(); |
1959 } | 1947 } |
1960 | 1948 |
1961 inline double adjustDoubleForAbsoluteZoom(double value, const ComputedStyle& sty
le) | 1949 inline double adjustDoubleForAbsoluteZoom(double value, const ComputedStyle& sty
le) |
1962 { | 1950 { |
1963 return value / style.effectiveZoom(); | 1951 return value / style.effectiveZoom(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2036 } | 2024 } |
2037 | 2025 |
2038 inline bool ComputedStyle::hasPseudoElementStyle() const | 2026 inline bool ComputedStyle::hasPseudoElementStyle() const |
2039 { | 2027 { |
2040 return noninherited_flags.pseudoBits & ElementPseudoIdMask; | 2028 return noninherited_flags.pseudoBits & ElementPseudoIdMask; |
2041 } | 2029 } |
2042 | 2030 |
2043 } // namespace blink | 2031 } // namespace blink |
2044 | 2032 |
2045 #endif // ComputedStyle_h | 2033 #endif // ComputedStyle_h |
OLD | NEW |