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

Side by Side Diff: Source/core/css/CSSComputedStyleDeclaration.cpp

Issue 636993002: [CSS Grid Layout] Upgrade justify-content parsing to CSS3 Box Alignment spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebaseline some tests expectations. Created 6 years, 1 month 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
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/CSSContentDistributionValue.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 { 1538 {
1539 if (position != ItemPositionAuto) 1539 if (position != ItemPositionAuto)
1540 return position; 1540 return position;
1541 1541
1542 bool isFlexOrGrid = element && element->computedStyle() 1542 bool isFlexOrGrid = element && element->computedStyle()
1543 && element->computedStyle()->isDisplayFlexibleOrGridBox(); 1543 && element->computedStyle()->isDisplayFlexibleOrGridBox();
1544 1544
1545 return isFlexOrGrid ? ItemPositionStretch : ItemPositionStart; 1545 return isFlexOrGrid ? ItemPositionStretch : ItemPositionStart;
1546 } 1546 }
1547 1547
1548 static ContentPosition resolveContentAlignmentAuto(ContentPosition position, Con tentDistributionType distribution, Node* element)
1549 {
1550 if (position != ContentPositionAuto || distribution != ContentDistributionDe fault)
1551 return position;
1552
1553 bool isFlex = element && element->computedStyle()
1554 && element->computedStyle()->isDisplayFlexibleBox();
1555
1556 return isFlex ? ContentPositionFlexStart : ContentPositionStart;
1557 }
1558
1548 static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlig nment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositi onType positionType) 1559 static PassRefPtrWillBeRawPtr<CSSValueList> valueForItemPositionWithOverflowAlig nment(ItemPosition itemPosition, OverflowAlignment overflowAlignment, ItemPositi onType positionType)
1549 { 1560 {
1550 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated (); 1561 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated ();
1551 if (positionType == LegacyPosition) 1562 if (positionType == LegacyPosition)
1552 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); 1563 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy));
1553 result->append(CSSPrimitiveValue::create(itemPosition)); 1564 result->append(CSSPrimitiveValue::create(itemPosition));
1554 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign mentDefault) 1565 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign mentDefault)
1555 result->append(CSSPrimitiveValue::create(overflowAlignment)); 1566 result->append(CSSPrimitiveValue::create(overflowAlignment));
1556 ASSERT(result->length() <= 2); 1567 ASSERT(result->length() <= 2);
1557 return result.release(); 1568 return result.release();
1558 } 1569 }
1559 1570
1571 static PassRefPtrWillBeRawPtr<CSSValueList> valueForContentPositionAndDistributi onWithOverflowAlignment(ContentPosition position, OverflowAlignment overflowAlig nment, ContentDistributionType distribution)
1572 {
1573 RefPtrWillBeRawPtr<CSSValueList> result = CSSValueList::createSpaceSeparated ();
1574 if (distribution != ContentDistributionDefault)
1575 result->append(CSSPrimitiveValue::create(distribution));
1576 if (distribution == ContentDistributionDefault || position != ContentPositio nAuto)
1577 result->append(CSSPrimitiveValue::create(position));
1578 if ((position >= ContentPositionCenter || distribution != ContentDistributio nDefault) && overflowAlignment != OverflowAlignmentDefault)
1579 result->append(CSSPrimitiveValue::create(overflowAlignment));
1580 ASSERT(result->length() > 0);
1581 ASSERT(result->length() <= 3);
1582 return result.release();
1583 }
1584
1560 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu e(CSSPropertyID propertyID, EUpdateLayout updateLayout) const 1585 PassRefPtrWillBeRawPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValu e(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
1561 { 1586 {
1562 Node* styledNode = this->styledNode(); 1587 Node* styledNode = this->styledNode();
1563 if (!styledNode) 1588 if (!styledNode)
1564 return nullptr; 1589 return nullptr;
1565 RenderObject* renderer = styledNode->renderer(); 1590 RenderObject* renderer = styledNode->renderer();
1566 RefPtr<RenderStyle> style; 1591 RefPtr<RenderStyle> style;
1567 1592
1568 if (updateLayout) { 1593 if (updateLayout) {
1569 Document& document = styledNode->document(); 1594 Document& document = styledNode->document();
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 return cssValuePool().createValue(style->flexDirection()); 1862 return cssValuePool().createValue(style->flexDirection());
1838 case CSSPropertyFlexFlow: 1863 case CSSPropertyFlexFlow:
1839 return valuesForShorthandProperty(flexFlowShorthand()); 1864 return valuesForShorthandProperty(flexFlowShorthand());
1840 case CSSPropertyFlexGrow: 1865 case CSSPropertyFlexGrow:
1841 return cssValuePool().createValue(style->flexGrow()); 1866 return cssValuePool().createValue(style->flexGrow());
1842 case CSSPropertyFlexShrink: 1867 case CSSPropertyFlexShrink:
1843 return cssValuePool().createValue(style->flexShrink()); 1868 return cssValuePool().createValue(style->flexShrink());
1844 case CSSPropertyFlexWrap: 1869 case CSSPropertyFlexWrap:
1845 return cssValuePool().createValue(style->flexWrap()); 1870 return cssValuePool().createValue(style->flexWrap());
1846 case CSSPropertyJustifyContent: 1871 case CSSPropertyJustifyContent:
1847 return cssValuePool().createValue(style->justifyContent()); 1872 return valueForContentPositionAndDistributionWithOverflowAlignment(r esolveContentAlignmentAuto(style->justifyContent(), style->justifyContentDistrib ution(), styledNode), style->justifyContentOverflowAlignment(), style->justifyCo ntentDistribution());
1848 case CSSPropertyOrder: 1873 case CSSPropertyOrder:
1849 return cssValuePool().createValue(style->order(), CSSPrimitiveValue: :CSS_NUMBER); 1874 return cssValuePool().createValue(style->order(), CSSPrimitiveValue: :CSS_NUMBER);
1850 case CSSPropertyFloat: 1875 case CSSPropertyFloat:
1851 if (style->display() != NONE && style->hasOutOfFlowPosition()) 1876 if (style->display() != NONE && style->hasOutOfFlowPosition())
1852 return cssValuePool().createIdentifierValue(CSSValueNone); 1877 return cssValuePool().createIdentifierValue(CSSValueNone);
1853 return cssValuePool().createValue(style->floating()); 1878 return cssValuePool().createValue(style->floating());
1854 case CSSPropertyFont: { 1879 case CSSPropertyFont: {
1855 RefPtrWillBeRawPtr<CSSFontValue> computedFont = CSSFontValue::create (); 1880 RefPtrWillBeRawPtr<CSSFontValue> computedFont = CSSFontValue::create ();
1856 computedFont->style = valueForFontStyle(*style); 1881 computedFont->style = valueForFontStyle(*style);
1857 computedFont->variant = valueForFontVariant(*style); 1882 computedFont->variant = valueForFontVariant(*style);
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
2992 return list.release(); 3017 return list.release();
2993 } 3018 }
2994 3019
2995 void CSSComputedStyleDeclaration::trace(Visitor* visitor) 3020 void CSSComputedStyleDeclaration::trace(Visitor* visitor)
2996 { 3021 {
2997 visitor->trace(m_node); 3022 visitor->trace(m_node);
2998 CSSStyleDeclaration::trace(visitor); 3023 CSSStyleDeclaration::trace(visitor);
2999 } 3024 }
3000 3025
3001 } // namespace blink 3026 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/CSSContentDistributionValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698