OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 11 * Copyright (C) 2013 Opera Software ASA. All rights reserved. |
11 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 12 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
12 * Redistribution and use in source and binary forms, with or without | 13 * Redistribution and use in source and binary forms, with or without |
13 * modification, are permitted provided that the following conditions are | 14 * modification, are permitted provided that the following conditions are |
14 * met: | 15 * met: |
15 * | 16 * |
16 * * Redistributions of source code must retain the above copyright | 17 * * Redistributions of source code must retain the above copyright |
17 * notice, this list of conditions and the following disclaimer. | 18 * notice, this list of conditions and the following disclaimer. |
18 * * Redistributions in binary form must reproduce the above | 19 * * Redistributions in binary form must reproduce the above |
19 * copyright notice, this list of conditions and the following disclaimer | 20 * copyright notice, this list of conditions and the following disclaimer |
20 * in the documentation and/or other materials provided with the | 21 * in the documentation and/or other materials provided with the |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 #include "core/frame/LocalFrame.h" | 71 #include "core/frame/LocalFrame.h" |
71 #include "core/frame/Settings.h" | 72 #include "core/frame/Settings.h" |
72 #include "core/rendering/style/CounterContent.h" | 73 #include "core/rendering/style/CounterContent.h" |
73 #include "core/rendering/style/CursorList.h" | 74 #include "core/rendering/style/CursorList.h" |
74 #include "core/rendering/style/QuotesData.h" | 75 #include "core/rendering/style/QuotesData.h" |
75 #include "core/rendering/style/RenderStyle.h" | 76 #include "core/rendering/style/RenderStyle.h" |
76 #include "core/rendering/style/RenderStyleConstants.h" | 77 #include "core/rendering/style/RenderStyleConstants.h" |
77 #include "core/rendering/style/SVGRenderStyle.h" | 78 #include "core/rendering/style/SVGRenderStyle.h" |
78 #include "core/rendering/style/SVGRenderStyleDefs.h" | 79 #include "core/rendering/style/SVGRenderStyleDefs.h" |
79 #include "core/rendering/style/StyleGeneratedImage.h" | 80 #include "core/rendering/style/StyleGeneratedImage.h" |
| 81 #include "core/rendering/style/StyleNavigationValue.h" |
80 #include "core/svg/SVGPaint.h" | 82 #include "core/svg/SVGPaint.h" |
81 #include "platform/fonts/FontDescription.h" | 83 #include "platform/fonts/FontDescription.h" |
82 #include "wtf/MathExtras.h" | 84 #include "wtf/MathExtras.h" |
83 #include "wtf/StdLibExtras.h" | 85 #include "wtf/StdLibExtras.h" |
84 #include "wtf/Vector.h" | 86 #include "wtf/Vector.h" |
85 | 87 |
86 namespace WebCore { | 88 namespace WebCore { |
87 | 89 |
88 static Length clipConvertToLength(StyleResolverState& state, CSSPrimitiveValue*
value) | 90 static Length clipConvertToLength(StyleResolverState& state, CSSPrimitiveValue*
value) |
89 { | 91 { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 applyInheritCSSPropertyColor(state); | 153 applyInheritCSSPropertyColor(state); |
152 return; | 154 return; |
153 } | 155 } |
154 | 156 |
155 if (state.applyPropertyToRegularStyle()) | 157 if (state.applyPropertyToRegularStyle()) |
156 state.style()->setColor(state.document().textLinkColors().colorFromPrimi
tiveValue(primitiveValue, state.style()->color())); | 158 state.style()->setColor(state.document().textLinkColors().colorFromPrimi
tiveValue(primitiveValue, state.style()->color())); |
157 if (state.applyPropertyToVisitedLinkStyle()) | 159 if (state.applyPropertyToVisitedLinkStyle()) |
158 state.style()->setVisitedLinkColor(state.document().textLinkColors().col
orFromPrimitiveValue(primitiveValue, state.style()->color(), true)); | 160 state.style()->setVisitedLinkColor(state.document().textLinkColors().col
orFromPrimitiveValue(primitiveValue, state.style()->color(), true)); |
159 } | 161 } |
160 | 162 |
| 163 namespace { |
| 164 void applyInitialCSSPropertyNavDir(StyleResolverState& state, StyleNavigationDat
a::NavigationDirection direction) |
| 165 { |
| 166 state.style()->setNavigation(direction, StyleNavigationValue(), true); |
| 167 } |
| 168 |
| 169 void applyInheritCSSPropertyNavDir(StyleResolverState& state, StyleNavigationDat
a::NavigationDirection direction) |
| 170 { |
| 171 StyleNavigationData* inheritedNavigation = state.parentStyle()->navigation()
; |
| 172 if (inheritedNavigation) |
| 173 state.style()->setNavigation(*inheritedNavigation); |
| 174 else |
| 175 applyInitialCSSPropertyNavDir(state, direction); |
| 176 } |
| 177 |
| 178 void applyValueCSSPropertyNavDir(StyleResolverState& state, CSSValue* value, Sty
leNavigationData::NavigationDirection direction) |
| 179 { |
| 180 StyleNavigationValue navigationValue; |
| 181 if (value->isPrimitiveValue()) { |
| 182 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 183 if (primitiveValue->isString()) |
| 184 navigationValue = StyleNavigationValue(primitiveValue->getStringValu
e()); |
| 185 } else if (value->isValueList()) { |
| 186 String vals[2]; |
| 187 CSSValueListIterator iterator = value; |
| 188 |
| 189 for (int i = 0; i < 2 && iterator.hasMore(); iterator.advance()) { |
| 190 CSSValue* item = iterator.value(); |
| 191 if (!item->isPrimitiveValue()) |
| 192 continue; |
| 193 vals[i++] = (static_cast<CSSPrimitiveValue*>(item))->getStringValue(
); |
| 194 } |
| 195 |
| 196 navigationValue = StyleNavigationValue(vals[0], vals[1]); |
| 197 } |
| 198 |
| 199 state.style()->setNavigation(direction, navigationValue, true); |
| 200 } |
| 201 } // namespace |
| 202 |
| 203 void StyleBuilderFunctions::applyInitialCSSPropertyNavDown(StyleResolverState& s
tate) |
| 204 { |
| 205 applyInitialCSSPropertyNavDir(state, StyleNavigationData::NavigationDown); |
| 206 } |
| 207 |
| 208 void StyleBuilderFunctions::applyInheritCSSPropertyNavDown(StyleResolverState& s
tate) |
| 209 { |
| 210 applyInheritCSSPropertyNavDir(state, StyleNavigationData::NavigationDown); |
| 211 } |
| 212 |
| 213 void StyleBuilderFunctions::applyValueCSSPropertyNavDown(StyleResolverState& sta
te, CSSValue* value) |
| 214 { |
| 215 applyValueCSSPropertyNavDir(state, value, StyleNavigationData::NavigationDow
n); |
| 216 } |
| 217 |
| 218 void StyleBuilderFunctions::applyInitialCSSPropertyNavLeft(StyleResolverState& s
tate) |
| 219 { |
| 220 applyInitialCSSPropertyNavDir(state, StyleNavigationData::NavigationLeft); |
| 221 } |
| 222 |
| 223 void StyleBuilderFunctions::applyInheritCSSPropertyNavLeft(StyleResolverState& s
tate) |
| 224 { |
| 225 applyInheritCSSPropertyNavDir(state, StyleNavigationData::NavigationLeft); |
| 226 } |
| 227 |
| 228 void StyleBuilderFunctions::applyValueCSSPropertyNavLeft(StyleResolverState& sta
te, CSSValue* value) |
| 229 { |
| 230 applyValueCSSPropertyNavDir(state, value, StyleNavigationData::NavigationLef
t); |
| 231 } |
| 232 |
| 233 void StyleBuilderFunctions::applyInitialCSSPropertyNavRight(StyleResolverState&
state) |
| 234 { |
| 235 applyInitialCSSPropertyNavDir(state, StyleNavigationData::NavigationRight); |
| 236 } |
| 237 |
| 238 void StyleBuilderFunctions::applyInheritCSSPropertyNavRight(StyleResolverState&
state) |
| 239 { |
| 240 applyInheritCSSPropertyNavDir(state, StyleNavigationData::NavigationRight); |
| 241 } |
| 242 |
| 243 void StyleBuilderFunctions::applyValueCSSPropertyNavRight(StyleResolverState& st
ate, CSSValue* value) |
| 244 { |
| 245 applyValueCSSPropertyNavDir(state, value, StyleNavigationData::NavigationRig
ht); |
| 246 } |
| 247 |
| 248 void StyleBuilderFunctions::applyInitialCSSPropertyNavUp(StyleResolverState& sta
te) |
| 249 { |
| 250 applyInitialCSSPropertyNavDir(state, StyleNavigationData::NavigationUp); |
| 251 } |
| 252 |
| 253 void StyleBuilderFunctions::applyInheritCSSPropertyNavUp(StyleResolverState& sta
te) |
| 254 { |
| 255 applyInheritCSSPropertyNavDir(state, StyleNavigationData::NavigationUp); |
| 256 } |
| 257 |
| 258 void StyleBuilderFunctions::applyValueCSSPropertyNavUp(StyleResolverState& state
, CSSValue* value) |
| 259 { |
| 260 applyValueCSSPropertyNavDir(state, value, StyleNavigationData::NavigationUp)
; |
| 261 } |
| 262 |
161 void StyleBuilderFunctions::applyInitialCSSPropertyCursor(StyleResolverState& st
ate) | 263 void StyleBuilderFunctions::applyInitialCSSPropertyCursor(StyleResolverState& st
ate) |
162 { | 264 { |
163 state.style()->clearCursorList(); | 265 state.style()->clearCursorList(); |
164 state.style()->setCursor(RenderStyle::initialCursor()); | 266 state.style()->setCursor(RenderStyle::initialCursor()); |
165 } | 267 } |
166 | 268 |
167 void StyleBuilderFunctions::applyInheritCSSPropertyCursor(StyleResolverState& st
ate) | 269 void StyleBuilderFunctions::applyInheritCSSPropertyCursor(StyleResolverState& st
ate) |
168 { | 270 { |
169 state.style()->setCursor(state.parentStyle()->cursor()); | 271 state.style()->setCursor(state.parentStyle()->cursor()); |
170 state.style()->setCursorList(state.parentStyle()->cursors()); | 272 state.style()->setCursorList(state.parentStyle()->cursors()); |
(...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1937 case CSSPropertyListStyleType: | 2039 case CSSPropertyListStyleType: |
1938 case CSSPropertyMarginBottom: | 2040 case CSSPropertyMarginBottom: |
1939 case CSSPropertyMarginLeft: | 2041 case CSSPropertyMarginLeft: |
1940 case CSSPropertyMarginRight: | 2042 case CSSPropertyMarginRight: |
1941 case CSSPropertyMarginTop: | 2043 case CSSPropertyMarginTop: |
1942 case CSSPropertyMaxHeight: | 2044 case CSSPropertyMaxHeight: |
1943 case CSSPropertyMaxWidth: | 2045 case CSSPropertyMaxWidth: |
1944 case CSSPropertyMinHeight: | 2046 case CSSPropertyMinHeight: |
1945 case CSSPropertyMixBlendMode: | 2047 case CSSPropertyMixBlendMode: |
1946 case CSSPropertyMinWidth: | 2048 case CSSPropertyMinWidth: |
| 2049 case CSSPropertyNavDown: |
| 2050 case CSSPropertyNavLeft: |
| 2051 case CSSPropertyNavRight: |
| 2052 case CSSPropertyNavUp: |
1947 case CSSPropertyObjectFit: | 2053 case CSSPropertyObjectFit: |
1948 case CSSPropertyOpacity: | 2054 case CSSPropertyOpacity: |
1949 case CSSPropertyOrphans: | 2055 case CSSPropertyOrphans: |
1950 case CSSPropertyOutlineColor: | 2056 case CSSPropertyOutlineColor: |
1951 case CSSPropertyOutlineOffset: | 2057 case CSSPropertyOutlineOffset: |
1952 case CSSPropertyOutlineStyle: | 2058 case CSSPropertyOutlineStyle: |
1953 case CSSPropertyOutlineWidth: | 2059 case CSSPropertyOutlineWidth: |
1954 case CSSPropertyOverflowWrap: | 2060 case CSSPropertyOverflowWrap: |
1955 case CSSPropertyOverflowX: | 2061 case CSSPropertyOverflowX: |
1956 case CSSPropertyOverflowY: | 2062 case CSSPropertyOverflowY: |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2295 break; | 2401 break; |
2296 } | 2402 } |
2297 case CSSPropertyEnableBackground: | 2403 case CSSPropertyEnableBackground: |
2298 // Silently ignoring this property for now | 2404 // Silently ignoring this property for now |
2299 // http://bugs.webkit.org/show_bug.cgi?id=6022 | 2405 // http://bugs.webkit.org/show_bug.cgi?id=6022 |
2300 break; | 2406 break; |
2301 } | 2407 } |
2302 } | 2408 } |
2303 | 2409 |
2304 } // namespace WebCore | 2410 } // namespace WebCore |
OLD | NEW |