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 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2299 | 2299 |
2300 GridLength minTrackBreadth; | 2300 GridLength minTrackBreadth; |
2301 GridLength maxTrackBreadth; | 2301 GridLength maxTrackBreadth; |
2302 if (!createGridTrackBreadth(minMaxTrackBreadth->first(), state, minTrackBrea
dth) || !createGridTrackBreadth(minMaxTrackBreadth->second(), state, maxTrackBre
adth)) | 2302 if (!createGridTrackBreadth(minMaxTrackBreadth->first(), state, minTrackBrea
dth) || !createGridTrackBreadth(minMaxTrackBreadth->second(), state, maxTrackBre
adth)) |
2303 return false; | 2303 return false; |
2304 | 2304 |
2305 trackSize.setMinMax(minTrackBreadth, maxTrackBreadth); | 2305 trackSize.setMinMax(minTrackBreadth, maxTrackBreadth); |
2306 return true; | 2306 return true; |
2307 } | 2307 } |
2308 | 2308 |
2309 static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSiz
es, const StyleResolver::State& state) | 2309 static bool createGridTrackList(CSSValue* value, Vector<GridTrackSize>& trackSiz
es, NamedGridLinesMapping& namedGridLines, const StyleResolver::State& state) |
2310 { | 2310 { |
2311 // Handle 'none'. | 2311 // Handle 'none'. |
2312 if (value->isPrimitiveValue()) { | 2312 if (value->isPrimitiveValue()) { |
2313 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valu
e); | 2313 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(valu
e); |
2314 return primitiveValue->getIdent() == CSSValueNone; | 2314 return primitiveValue->getIdent() == CSSValueNone; |
2315 } | 2315 } |
2316 | 2316 |
2317 if (!value->isValueList()) | 2317 if (!value->isValueList()) |
2318 return false; | 2318 return false; |
2319 | 2319 |
| 2320 size_t currentNamedGridLine = 0; |
2320 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { | 2321 for (CSSValueListIterator i = value; i.hasMore(); i.advance()) { |
2321 CSSValue* currValue = i.value(); | 2322 CSSValue* currValue = i.value(); |
| 2323 if (currValue->isPrimitiveValue()) { |
| 2324 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(
currValue); |
| 2325 if (primitiveValue->isString()) { |
| 2326 NamedGridLinesMapping::AddResult result = namedGridLines.add(pri
mitiveValue->getStringValue(), Vector<size_t>()); |
| 2327 result.iterator->value.append(currentNamedGridLine); |
| 2328 continue; |
| 2329 } |
| 2330 } |
| 2331 |
| 2332 ++currentNamedGridLine; |
2322 GridTrackSize trackSize; | 2333 GridTrackSize trackSize; |
2323 if (!createGridTrackSize(currValue, trackSize, state)) | 2334 if (!createGridTrackSize(currValue, trackSize, state)) |
2324 return false; | 2335 return false; |
2325 | 2336 |
2326 trackSizes.append(trackSize); | 2337 trackSizes.append(trackSize); |
2327 } | 2338 } |
2328 return true; | 2339 return true; |
2329 } | 2340 } |
2330 | 2341 |
2331 | 2342 |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2985 } | 2996 } |
2986 case CSSPropertyWebkitGridAutoRows: { | 2997 case CSSPropertyWebkitGridAutoRows: { |
2987 GridTrackSize trackSize; | 2998 GridTrackSize trackSize; |
2988 if (!createGridTrackSize(value, trackSize, state)) | 2999 if (!createGridTrackSize(value, trackSize, state)) |
2989 return; | 3000 return; |
2990 state.style()->setGridAutoRows(trackSize); | 3001 state.style()->setGridAutoRows(trackSize); |
2991 return; | 3002 return; |
2992 } | 3003 } |
2993 case CSSPropertyWebkitGridColumns: { | 3004 case CSSPropertyWebkitGridColumns: { |
2994 Vector<GridTrackSize> trackSizes; | 3005 Vector<GridTrackSize> trackSizes; |
2995 if (!createGridTrackList(value, trackSizes, state)) | 3006 NamedGridLinesMapping namedGridLines; |
| 3007 if (!createGridTrackList(value, trackSizes, namedGridLines, state)) |
2996 return; | 3008 return; |
2997 state.style()->setGridColumns(trackSizes); | 3009 state.style()->setGridColumns(trackSizes); |
| 3010 state.style()->setNamedGridColumnLines(namedGridLines); |
2998 return; | 3011 return; |
2999 } | 3012 } |
3000 case CSSPropertyWebkitGridRows: { | 3013 case CSSPropertyWebkitGridRows: { |
3001 Vector<GridTrackSize> trackSizes; | 3014 Vector<GridTrackSize> trackSizes; |
3002 if (!createGridTrackList(value, trackSizes, state)) | 3015 NamedGridLinesMapping namedGridLines; |
| 3016 if (!createGridTrackList(value, trackSizes, namedGridLines, state)) |
3003 return; | 3017 return; |
3004 state.style()->setGridRows(trackSizes); | 3018 state.style()->setGridRows(trackSizes); |
| 3019 state.style()->setNamedGridRowLines(namedGridLines); |
3005 return; | 3020 return; |
3006 } | 3021 } |
3007 | 3022 |
3008 case CSSPropertyWebkitGridStart: { | 3023 case CSSPropertyWebkitGridStart: { |
3009 HANDLE_INHERIT_AND_INITIAL(gridStart, GridStart); | 3024 HANDLE_INHERIT_AND_INITIAL(gridStart, GridStart); |
3010 GridPosition startPosition; | 3025 GridPosition startPosition; |
3011 if (!createGridPosition(value, startPosition)) | 3026 if (!createGridPosition(value, startPosition)) |
3012 return; | 3027 return; |
3013 state.style()->setGridStart(startPosition); | 3028 state.style()->setGridStart(startPosition); |
3014 return; | 3029 return; |
(...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4650 info.addMember(m_state, "state"); | 4665 info.addMember(m_state, "state"); |
4651 | 4666 |
4652 // FIXME: move this to a place where it would be called only once? | 4667 // FIXME: move this to a place where it would be called only once? |
4653 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); | 4668 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); |
4654 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl
e"); | 4669 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl
e"); |
4655 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle,"defaultPrintStyle")
; | 4670 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle,"defaultPrintStyle")
; |
4656 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo
urceStyle"); | 4671 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo
urceStyle"); |
4657 } | 4672 } |
4658 | 4673 |
4659 } // namespace WebCore | 4674 } // namespace WebCore |
OLD | NEW |