| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |
| 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
| 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |
| 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| (...skipping 2221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2232 | 2232 |
| 2233 GridLength minTrackBreadth; | 2233 GridLength minTrackBreadth; |
| 2234 GridLength maxTrackBreadth; | 2234 GridLength maxTrackBreadth; |
| 2235 if (!createGridTrackBreadth(minMaxTrackBreadth->first(), state, minTrackBrea
dth) || !createGridTrackBreadth(minMaxTrackBreadth->second(), state, maxTrackBre
adth)) | 2235 if (!createGridTrackBreadth(minMaxTrackBreadth->first(), state, minTrackBrea
dth) || !createGridTrackBreadth(minMaxTrackBreadth->second(), state, maxTrackBre
adth)) |
| 2236 return false; | 2236 return false; |
| 2237 | 2237 |
| 2238 trackSize.setMinMax(minTrackBreadth, maxTrackBreadth); | 2238 trackSize.setMinMax(minTrackBreadth, maxTrackBreadth); |
| 2239 return true; | 2239 return true; |
| 2240 } | 2240 } |
| 2241 | 2241 |
| 2242 static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSiz
es, const StyleResolverState& state) | 2242 static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSiz
es, NamedGridLinesMap& namedGridLines, const StyleResolverState& state) |
| 2243 { | 2243 { |
| 2244 // Handle 'none'. | 2244 // Handle 'none'. |
| 2245 if (value->isPrimitiveValue()) { | 2245 if (value->isPrimitiveValue()) { |
| 2246 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valu
e); | 2246 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valu
e); |
| 2247 return primitiveValue->getIdent() == CSSValueNone; | 2247 return primitiveValue->getIdent() == CSSValueNone; |
| 2248 } | 2248 } |
| 2249 | 2249 |
| 2250 if (!value->isValueList()) | 2250 if (!value->isValueList()) |
| 2251 return false; | 2251 return false; |
| 2252 | 2252 |
| 2253 size_t currentNamedGridLine = 0; |
| 2253 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { | 2254 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { |
| 2254 CSSValue* currValue = i.value(); | 2255 CSSValue* currValue = i.value(); |
| 2256 if (currValue->isPrimitiveValue()) { |
| 2257 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(
currValue); |
| 2258 if (primitiveValue->isString()) { |
| 2259 NamedGridLinesMap::AddResult result = namedGridLines.add(primiti
veValue->getStringValue(), Vector<size_t>()); |
| 2260 result.iterator->value.append(currentNamedGridLine); |
| 2261 continue; |
| 2262 } |
| 2263 } |
| 2264 |
| 2265 ++currentNamedGridLine; |
| 2255 GridTrackSize trackSize; | 2266 GridTrackSize trackSize; |
| 2256 if (!createGridTrackSize(currValue, trackSize, state)) | 2267 if (!createGridTrackSize(currValue, trackSize, state)) |
| 2257 return false; | 2268 return false; |
| 2258 | 2269 |
| 2259 trackSizes.append(trackSize); | 2270 trackSizes.append(trackSize); |
| 2260 } | 2271 } |
| 2272 |
| 2273 if (trackSizes.isEmpty()) |
| 2274 return false; |
| 2275 |
| 2261 return true; | 2276 return true; |
| 2262 } | 2277 } |
| 2263 | 2278 |
| 2264 | 2279 |
| 2265 static bool createGridPosition(CSSValue* value, GridPosition& position) | 2280 static bool createGridPosition(CSSValue* value, GridPosition& position) |
| 2266 { | 2281 { |
| 2267 // For now, we only accept: 'auto' | <integer> | span && <integer>? | 2282 // For now, we only accept: 'auto' | <integer> | span && <integer>? |
| 2268 if (value->isPrimitiveValue()) { | 2283 if (value->isPrimitiveValue()) { |
| 2269 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valu
e); | 2284 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valu
e); |
| 2270 if (primitiveValue->getIdent() == CSSValueAuto) | 2285 if (primitiveValue->getIdent() == CSSValueAuto) |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2914 } | 2929 } |
| 2915 case CSSPropertyWebkitGridAutoRows: { | 2930 case CSSPropertyWebkitGridAutoRows: { |
| 2916 GridTrackSize trackSize; | 2931 GridTrackSize trackSize; |
| 2917 if (!createGridTrackSize(value, trackSize, state)) | 2932 if (!createGridTrackSize(value, trackSize, state)) |
| 2918 return; | 2933 return; |
| 2919 state.style()->setGridAutoRows(trackSize); | 2934 state.style()->setGridAutoRows(trackSize); |
| 2920 return; | 2935 return; |
| 2921 } | 2936 } |
| 2922 case CSSPropertyWebkitGridColumns: { | 2937 case CSSPropertyWebkitGridColumns: { |
| 2923 Vector<GridTrackSize> trackSizes; | 2938 Vector<GridTrackSize> trackSizes; |
| 2924 if (!createGridTrackList(value, trackSizes, state)) | 2939 NamedGridLinesMap namedGridLines; |
| 2940 if (!createGridTrackList(value, trackSizes, namedGridLines, state)) |
| 2925 return; | 2941 return; |
| 2926 state.style()->setGridColumns(trackSizes); | 2942 state.style()->setGridColumns(trackSizes); |
| 2943 state.style()->setNamedGridColumnLines(namedGridLines); |
| 2927 return; | 2944 return; |
| 2928 } | 2945 } |
| 2929 case CSSPropertyWebkitGridRows: { | 2946 case CSSPropertyWebkitGridRows: { |
| 2930 Vector<GridTrackSize> trackSizes; | 2947 Vector<GridTrackSize> trackSizes; |
| 2931 if (!createGridTrackList(value, trackSizes, state)) | 2948 NamedGridLinesMap namedGridLines; |
| 2949 if (!createGridTrackList(value, trackSizes, namedGridLines, state)) |
| 2932 return; | 2950 return; |
| 2933 state.style()->setGridRows(trackSizes); | 2951 state.style()->setGridRows(trackSizes); |
| 2952 state.style()->setNamedGridRowLines(namedGridLines); |
| 2934 return; | 2953 return; |
| 2935 } | 2954 } |
| 2936 | 2955 |
| 2937 case CSSPropertyWebkitGridStart: { | 2956 case CSSPropertyWebkitGridStart: { |
| 2938 HANDLE_INHERIT_AND_INITIAL(gridStart, GridStart); | 2957 HANDLE_INHERIT_AND_INITIAL(gridStart, GridStart); |
| 2939 GridPosition startPosition; | 2958 GridPosition startPosition; |
| 2940 if (!createGridPosition(value, startPosition)) | 2959 if (!createGridPosition(value, startPosition)) |
| 2941 return; | 2960 return; |
| 2942 state.style()->setGridStart(startPosition); | 2961 state.style()->setGridStart(startPosition); |
| 2943 return; | 2962 return; |
| (...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4293 info.addMember(m_state, "state"); | 4312 info.addMember(m_state, "state"); |
| 4294 | 4313 |
| 4295 // FIXME: move this to a place where it would be called only once? | 4314 // FIXME: move this to a place where it would be called only once? |
| 4296 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); | 4315 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); |
| 4297 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl
e"); | 4316 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl
e"); |
| 4298 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle,"defaultPrintStyle")
; | 4317 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle,"defaultPrintStyle")
; |
| 4299 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo
urceStyle"); | 4318 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo
urceStyle"); |
| 4300 } | 4319 } |
| 4301 | 4320 |
| 4302 } // namespace WebCore | 4321 } // namespace WebCore |
| OLD | NEW |