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

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

Issue 1132753002: [CSS Grid Layout] Fix grid shorthands CSSOM serialization (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update test expectations for webexposed/nonstable-css-properties.html Created 5 years, 7 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
« no previous file with comments | « Source/core/css/StylePropertySerializer.h ('k') | no next file » | 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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r ights reserved.
4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
5 * Copyright (C) 2013 Intel Corporation. All rights reserved. 5 * Copyright (C) 2013 Intel Corporation. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 return get4Values(borderStyleShorthand()); 410 return get4Values(borderStyleShorthand());
411 case CSSPropertyWebkitColumnRule: 411 case CSSPropertyWebkitColumnRule:
412 return getShorthandValue(webkitColumnRuleShorthand()); 412 return getShorthandValue(webkitColumnRuleShorthand());
413 case CSSPropertyWebkitColumns: 413 case CSSPropertyWebkitColumns:
414 return getShorthandValue(webkitColumnsShorthand()); 414 return getShorthandValue(webkitColumnsShorthand());
415 case CSSPropertyFlex: 415 case CSSPropertyFlex:
416 return getShorthandValue(flexShorthand()); 416 return getShorthandValue(flexShorthand());
417 case CSSPropertyFlexFlow: 417 case CSSPropertyFlexFlow:
418 return getShorthandValue(flexFlowShorthand()); 418 return getShorthandValue(flexFlowShorthand());
419 case CSSPropertyGridColumn: 419 case CSSPropertyGridColumn:
420 return getShorthandValue(gridColumnShorthand()); 420 return getShorthandValue(gridColumnShorthand(), " / ");
421 case CSSPropertyGridRow: 421 case CSSPropertyGridRow:
422 return getShorthandValue(gridRowShorthand()); 422 return getShorthandValue(gridRowShorthand(), " / ");
423 case CSSPropertyGridArea: 423 case CSSPropertyGridArea:
424 return getShorthandValue(gridAreaShorthand()); 424 return getShorthandValue(gridAreaShorthand(), " / ");
425 case CSSPropertyFont: 425 case CSSPropertyFont:
426 return fontValue(); 426 return fontValue();
427 case CSSPropertyMargin: 427 case CSSPropertyMargin:
428 return get4Values(marginShorthand()); 428 return get4Values(marginShorthand());
429 case CSSPropertyMotion: 429 case CSSPropertyMotion:
430 return getShorthandValue(motionShorthand()); 430 return getShorthandValue(motionShorthand());
431 case CSSPropertyWebkitMarginCollapse: 431 case CSSPropertyWebkitMarginCollapse:
432 return getShorthandValue(webkitMarginCollapseShorthand()); 432 return getShorthandValue(webkitMarginCollapseShorthand());
433 case CSSPropertyOverflow: 433 case CSSPropertyOverflow:
434 return getCommonValue(overflowShorthand()); 434 return getCommonValue(overflowShorthand());
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 } 744 }
745 745
746 if (isInitialOrInherit(commonValue)) 746 if (isInitialOrInherit(commonValue))
747 return commonValue; 747 return commonValue;
748 748
749 if (result.isEmpty()) 749 if (result.isEmpty())
750 return String(); 750 return String();
751 return result.toString(); 751 return result.toString();
752 } 752 }
753 753
754 String StylePropertySerializer::getShorthandValue(const StylePropertyShorthand& shorthand) const 754 String StylePropertySerializer::getShorthandValue(const StylePropertyShorthand& shorthand, String separator) const
755 { 755 {
756 String commonValue; 756 String commonValue;
757 StringBuilder result; 757 StringBuilder result;
758 for (unsigned i = 0; i < shorthand.length(); ++i) { 758 for (unsigned i = 0; i < shorthand.length(); ++i) {
759 if (!m_propertySet.isPropertyImplicit(shorthand.properties()[i])) { 759 if (!m_propertySet.isPropertyImplicit(shorthand.properties()[i])) {
760 const CSSValue* value = m_propertySet.getPropertyCSSValue(shorthand. properties()[i]); 760 const CSSValue* value = m_propertySet.getPropertyCSSValue(shorthand. properties()[i]);
761 if (!value) 761 if (!value)
762 return String(); 762 return String();
763 String valueText = value->cssText(); 763 String valueText = value->cssText();
764 if (!i) 764 if (!i)
765 commonValue = valueText; 765 commonValue = valueText;
766 else if (!commonValue.isNull() && commonValue != valueText) 766 else if (!commonValue.isNull() && commonValue != valueText)
767 commonValue = String(); 767 commonValue = String();
768 if (value->isInitialValue()) 768 if (value->isInitialValue())
769 continue; 769 continue;
770 if (!result.isEmpty()) 770 if (!result.isEmpty())
771 result.append(' '); 771 result.append(separator);
772 result.append(valueText); 772 result.append(valueText);
773 } else 773 } else
774 commonValue = String(); 774 commonValue = String();
775 } 775 }
776 if (isInitialOrInherit(commonValue)) 776 if (isInitialOrInherit(commonValue))
777 return commonValue; 777 return commonValue;
778 if (result.isEmpty()) 778 if (result.isEmpty())
779 return String(); 779 return String();
780 return result.toString(); 780 return result.toString();
781 } 781 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 isInitialValue = false; 993 isInitialValue = false;
994 if (!value->isInheritedValue()) 994 if (!value->isInheritedValue())
995 isInheritedValue = false; 995 isInheritedValue = false;
996 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie s()[i])) 996 if (isImportant != m_propertySet.propertyIsImportant(shorthand.propertie s()[i]))
997 return false; 997 return false;
998 } 998 }
999 return isInitialValue || isInheritedValue; 999 return isInitialValue || isInheritedValue;
1000 } 1000 }
1001 1001
1002 } 1002 }
OLDNEW
« no previous file with comments | « Source/core/css/StylePropertySerializer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698