Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: Source/core/css/resolver/StyleResolver.cpp

Issue 18532004: Implement 'grid-template' parsing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Same change, forgot to update css-properties-as-js-properties.html result Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 22 matching lines...) Expand all
33 #include "HTMLNames.h" 33 #include "HTMLNames.h"
34 #include "RuntimeEnabledFeatures.h" 34 #include "RuntimeEnabledFeatures.h"
35 #include "SVGNames.h" 35 #include "SVGNames.h"
36 #include "XMLNames.h" 36 #include "XMLNames.h"
37 #include "core/animation/AnimatableValue.h" 37 #include "core/animation/AnimatableValue.h"
38 #include "core/animation/Animation.h" 38 #include "core/animation/Animation.h"
39 #include "core/css/CSSCalculationValue.h" 39 #include "core/css/CSSCalculationValue.h"
40 #include "core/css/CSSCursorImageValue.h" 40 #include "core/css/CSSCursorImageValue.h"
41 #include "core/css/CSSDefaultStyleSheets.h" 41 #include "core/css/CSSDefaultStyleSheets.h"
42 #include "core/css/CSSFontSelector.h" 42 #include "core/css/CSSFontSelector.h"
43 #include "core/css/CSSGridTemplateValue.h"
43 #include "core/css/CSSImageSetValue.h" 44 #include "core/css/CSSImageSetValue.h"
44 #include "core/css/CSSKeyframeRule.h" 45 #include "core/css/CSSKeyframeRule.h"
45 #include "core/css/CSSKeyframesRule.h" 46 #include "core/css/CSSKeyframesRule.h"
46 #include "core/css/CSSLineBoxContainValue.h" 47 #include "core/css/CSSLineBoxContainValue.h"
47 #include "core/css/CSSParser.h" 48 #include "core/css/CSSParser.h"
48 #include "core/css/CSSPrimitiveValueMappings.h" 49 #include "core/css/CSSPrimitiveValueMappings.h"
49 #include "core/css/CSSReflectValue.h" 50 #include "core/css/CSSReflectValue.h"
50 #include "core/css/CSSSVGDocumentValue.h" 51 #include "core/css/CSSSVGDocumentValue.h"
51 #include "core/css/CSSSelector.h" 52 #include "core/css/CSSSelector.h"
52 #include "core/css/CSSSelectorList.h" 53 #include "core/css/CSSSelectorList.h"
(...skipping 2273 matching lines...) Expand 10 before | Expand all | Expand 10 after
2326 2327
2327 ASSERT(!it.hasMore()); 2328 ASSERT(!it.hasMore());
2328 if (isSpanPosition) 2329 if (isSpanPosition)
2329 position.setSpanPosition(gridLineNumber, gridLineName); 2330 position.setSpanPosition(gridLineNumber, gridLineName);
2330 else 2331 else
2331 position.setExplicitPosition(gridLineNumber, gridLineName); 2332 position.setExplicitPosition(gridLineNumber, gridLineName);
2332 2333
2333 return true; 2334 return true;
2334 } 2335 }
2335 2336
2337 static void createGridTemplate(CSSValue* value, NamedGridAreaMap& namedGridArea, size_t& rowCount, size_t& columnCount)
ojan 2013/07/29 23:03:28 I don't think this function adds value.
Julien - ping for review 2013/07/30 18:43:33 ACK!
2338 {
2339 if (value->isPrimitiveValue()) {
2340 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone);
2341 return;
2342 }
2343
2344 CSSGridTemplateValue* gridTemplateValue = toCSSGridTemplateValue(value);
2345 namedGridArea = gridTemplateValue->gridAreaMap();
2346 rowCount = gridTemplateValue->rowCount();
2347 columnCount = gridTemplateValue->columnCount();
esprehn 2013/07/29 23:27:36 This makes the code really confusing, can you just
2348 }
2349
2336 static bool hasVariableReference(CSSValue* value) 2350 static bool hasVariableReference(CSSValue* value)
2337 { 2351 {
2338 if (value->isPrimitiveValue()) { 2352 if (value->isPrimitiveValue()) {
2339 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 2353 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
2340 return primitiveValue->hasVariableReference(); 2354 return primitiveValue->hasVariableReference();
2341 } 2355 }
2342 2356
2343 if (value->isCalculationValue()) 2357 if (value->isCalculationValue())
2344 return static_cast<CSSCalcValue*>(value)->hasVariableReference(); 2358 return static_cast<CSSCalcValue*>(value)->hasVariableReference();
2345 2359
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
3020 } 3034 }
3021 case CSSPropertyGridRowEnd: { 3035 case CSSPropertyGridRowEnd: {
3022 HANDLE_INHERIT_AND_INITIAL(gridRowEnd, GridRowEnd); 3036 HANDLE_INHERIT_AND_INITIAL(gridRowEnd, GridRowEnd);
3023 GridPosition afterPosition; 3037 GridPosition afterPosition;
3024 if (!createGridPosition(value, afterPosition)) 3038 if (!createGridPosition(value, afterPosition))
3025 return; 3039 return;
3026 state.style()->setGridRowEnd(afterPosition); 3040 state.style()->setGridRowEnd(afterPosition);
3027 return; 3041 return;
3028 } 3042 }
3029 3043
3044 case CSSPropertyGridTemplate: {
3045 if (isInherit) {
3046 m_state.style()->setNamedGridArea(m_state.parentStyle()->namedGridAr ea());
3047 m_state.style()->setNamedGridAreaRowCount(m_state.parentStyle()->nam edGridAreaRowCount());
3048 m_state.style()->setNamedGridAreaColumnCount(m_state.parentStyle()-> namedGridAreaColumnCount());
3049 return;
3050 }
3051 if (isInitial) {
3052 m_state.style()->setNamedGridArea(RenderStyle::initialNamedGridArea( ));
3053 m_state.style()->setNamedGridAreaRowCount(RenderStyle::initialNamedG ridAreaCount());
3054 m_state.style()->setNamedGridAreaColumnCount(RenderStyle::initialNam edGridAreaCount());
3055 return;
3056 }
3057
3058 size_t rowCount;
3059 size_t columnCount;
3060 NamedGridAreaMap namedGridArea;
3061 createGridTemplate(value, namedGridArea, rowCount, columnCount);
3062 m_state.style()->setNamedGridArea(namedGridArea);
3063 m_state.style()->setNamedGridAreaRowCount(rowCount);
3064 m_state.style()->setNamedGridAreaColumnCount(columnCount);
3065 return;
3066 }
3067
3030 // These properties are aliased and DeprecatedStyleBuilder already applied t he property on the prefixed version. 3068 // These properties are aliased and DeprecatedStyleBuilder already applied t he property on the prefixed version.
3031 case CSSPropertyTransitionDelay: 3069 case CSSPropertyTransitionDelay:
3032 case CSSPropertyTransitionDuration: 3070 case CSSPropertyTransitionDuration:
3033 case CSSPropertyTransitionProperty: 3071 case CSSPropertyTransitionProperty:
3034 case CSSPropertyTransitionTimingFunction: 3072 case CSSPropertyTransitionTimingFunction:
3035 return; 3073 return;
3036 // These properties are implemented in the DeprecatedStyleBuilder lookup tab le or in the new StyleBuilder. 3074 // These properties are implemented in the DeprecatedStyleBuilder lookup tab le or in the new StyleBuilder.
3037 case CSSPropertyBackgroundAttachment: 3075 case CSSPropertyBackgroundAttachment:
3038 case CSSPropertyBackgroundBlendMode: 3076 case CSSPropertyBackgroundBlendMode:
3039 case CSSPropertyBackgroundClip: 3077 case CSSPropertyBackgroundClip:
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
3476 info.addMember(m_state, "state"); 3514 info.addMember(m_state, "state");
3477 3515
3478 // FIXME: move this to a place where it would be called only once? 3516 // FIXME: move this to a place where it would be called only once?
3479 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle"); 3517 info.addMember(CSSDefaultStyleSheets::defaultStyle, "defaultStyle");
3480 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e"); 3518 info.addMember(CSSDefaultStyleSheets::defaultQuirksStyle, "defaultQuirksStyl e");
3481 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" ); 3519 info.addMember(CSSDefaultStyleSheets::defaultPrintStyle, "defaultPrintStyle" );
3482 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle"); 3520 info.addMember(CSSDefaultStyleSheets::defaultViewSourceStyle, "defaultViewSo urceStyle");
3483 } 3521 }
3484 3522
3485 } // namespace WebCore 3523 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698