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 2277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2288 | 2288 |
2289 GridLength minTrackBreadth; | 2289 GridLength minTrackBreadth; |
2290 GridLength maxTrackBreadth; | 2290 GridLength maxTrackBreadth; |
2291 if (!createGridTrackBreadth(minMaxTrackBreadth->first(), state, minTrackBrea
dth) || !createGridTrackBreadth(minMaxTrackBreadth->second(), state, maxTrackBre
adth)) | 2291 if (!createGridTrackBreadth(minMaxTrackBreadth->first(), state, minTrackBrea
dth) || !createGridTrackBreadth(minMaxTrackBreadth->second(), state, maxTrackBre
adth)) |
2292 return false; | 2292 return false; |
2293 | 2293 |
2294 trackSize.setMinMax(minTrackBreadth, maxTrackBreadth); | 2294 trackSize.setMinMax(minTrackBreadth, maxTrackBreadth); |
2295 return true; | 2295 return true; |
2296 } | 2296 } |
2297 | 2297 |
2298 static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSiz
es, const StyleResolver::State& state) | 2298 static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSiz
es, NamedGridLinesMap& namedGridLines, const StyleResolver::State& state) |
2299 { | 2299 { |
2300 // Handle 'none'. | 2300 // Handle 'none'. |
2301 if (value->isPrimitiveValue()) { | 2301 if (value->isPrimitiveValue()) { |
2302 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valu
e); | 2302 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valu
e); |
2303 return primitiveValue->getIdent() == CSSValueNone; | 2303 return primitiveValue->getIdent() == CSSValueNone; |
2304 } | 2304 } |
2305 | 2305 |
2306 if (!value->isValueList()) | 2306 if (!value->isValueList()) |
2307 return false; | 2307 return false; |
2308 | 2308 |
| 2309 size_t currentNamedGridLine = 0; |
2309 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { | 2310 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { |
2310 CSSValue* currValue = i.value(); | 2311 CSSValue* currValue = i.value(); |
| 2312 if (currValue->isPrimitiveValue()) { |
| 2313 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(
currValue); |
| 2314 if (primitiveValue->isString()) { |
| 2315 NamedGridLinesMap::AddResult result = namedGridLines.add(primiti
veValue->getStringValue(), Vector<size_t>()); |
| 2316 result.iterator->value.append(currentNamedGridLine); |
| 2317 continue; |
| 2318 } |
| 2319 } |
| 2320 |
| 2321 ++currentNamedGridLine; |
2311 GridTrackSize trackSize; | 2322 GridTrackSize trackSize; |
2312 if (!createGridTrackSize(currValue, trackSize, state)) | 2323 if (!createGridTrackSize(currValue, trackSize, state)) |
2313 return false; | 2324 return false; |
2314 | 2325 |
2315 trackSizes.append(trackSize); | 2326 trackSizes.append(trackSize); |
2316 } | 2327 } |
| 2328 |
| 2329 if (trackSizes.isEmpty()) |
| 2330 return false; |
| 2331 |
2317 return true; | 2332 return true; |
2318 } | 2333 } |
2319 | 2334 |
2320 | 2335 |
2321 static bool createGridPosition(CSSValue* value, GridPosition& position) | 2336 static bool createGridPosition(CSSValue* value, GridPosition& position) |
2322 { | 2337 { |
2323 // For now, we only accept: 'auto' | <integer> | span && <integer>? | 2338 // For now, we only accept: 'auto' | <integer> | span && <integer>? |
2324 if (value->isPrimitiveValue()) { | 2339 if (value->isPrimitiveValue()) { |
2325 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valu
e); | 2340 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valu
e); |
2326 if (primitiveValue->getIdent() == CSSValueAuto) | 2341 if (primitiveValue->getIdent() == CSSValueAuto) |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2970 } | 2985 } |
2971 case CSSPropertyWebkitGridAutoRows: { | 2986 case CSSPropertyWebkitGridAutoRows: { |
2972 GridTrackSize trackSize; | 2987 GridTrackSize trackSize; |
2973 if (!createGridTrackSize(value, trackSize, state)) | 2988 if (!createGridTrackSize(value, trackSize, state)) |
2974 return; | 2989 return; |
2975 state.style()->setGridAutoRows(trackSize); | 2990 state.style()->setGridAutoRows(trackSize); |
2976 return; | 2991 return; |
2977 } | 2992 } |
2978 case CSSPropertyWebkitGridColumns: { | 2993 case CSSPropertyWebkitGridColumns: { |
2979 Vector<GridTrackSize> trackSizes; | 2994 Vector<GridTrackSize> trackSizes; |
2980 if (!createGridTrackList(value, trackSizes, state)) | 2995 NamedGridLinesMap namedGridLines; |
| 2996 if (!createGridTrackList(value, trackSizes, namedGridLines, state)) |
2981 return; | 2997 return; |
2982 state.style()->setGridColumns(trackSizes); | 2998 state.style()->setGridColumns(trackSizes); |
| 2999 state.style()->setNamedGridColumnLines(namedGridLines); |
2983 return; | 3000 return; |
2984 } | 3001 } |
2985 case CSSPropertyWebkitGridRows: { | 3002 case CSSPropertyWebkitGridRows: { |
2986 Vector<GridTrackSize> trackSizes; | 3003 Vector<GridTrackSize> trackSizes; |
2987 if (!createGridTrackList(value, trackSizes, state)) | 3004 NamedGridLinesMap namedGridLines; |
| 3005 if (!createGridTrackList(value, trackSizes, namedGridLines, state)) |
2988 return; | 3006 return; |
2989 state.style()->setGridRows(trackSizes); | 3007 state.style()->setGridRows(trackSizes); |
| 3008 state.style()->setNamedGridRowLines(namedGridLines); |
2990 return; | 3009 return; |
2991 } | 3010 } |
2992 | 3011 |
2993 case CSSPropertyWebkitGridStart: { | 3012 case CSSPropertyWebkitGridStart: { |
2994 HANDLE_INHERIT_AND_INITIAL(gridStart, GridStart); | 3013 HANDLE_INHERIT_AND_INITIAL(gridStart, GridStart); |
2995 GridPosition startPosition; | 3014 GridPosition startPosition; |
2996 if (!createGridPosition(value, startPosition)) | 3015 if (!createGridPosition(value, startPosition)) |
2997 return; | 3016 return; |
2998 state.style()->setGridStart(startPosition); | 3017 state.style()->setGridStart(startPosition); |
2999 return; | 3018 return; |
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4349 info.addMember(m_state, "state"); | 4368 info.addMember(m_state, "state"); |
4350 | 4369 |
4351 // FIXME: move this to a place where it would be called only once? | 4370 // FIXME: move this to a place where it would be called only once? |
4352 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); | 4371 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); |
4353 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl
e"); | 4372 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl
e"); |
4354 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle,"defaultPrintStyle")
; | 4373 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle,"defaultPrintStyle")
; |
4355 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo
urceStyle"); | 4374 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo
urceStyle"); |
4356 } | 4375 } |
4357 | 4376 |
4358 } // namespace WebCore | 4377 } // namespace WebCore |
OLD | NEW |