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

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

Issue 879993003: Fix serialization of background property with multiple layers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add test Created 5 years, 10 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 | « LayoutTests/fast/backgrounds/background-shorthand-multiple-layers-expected.txt ('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 * 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 * Copyright (C) 2015 Google Inc. All rights reserved. 7 * Copyright (C) 2015 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 for (size_t i = 0; i < shorthand.length(); ++i) { 407 for (size_t i = 0; i < shorthand.length(); ++i) {
408 RefPtrWillBeRawPtr<CSSValue> value = RenderStyleCSSValueMapping::get(sho rthand.properties()[i], style, renderer, styledNode, allowVisitedStyle); 408 RefPtrWillBeRawPtr<CSSValue> value = RenderStyleCSSValueMapping::get(sho rthand.properties()[i], style, renderer, styledNode, allowVisitedStyle);
409 ASSERT(value); 409 ASSERT(value);
410 list->append(value); 410 list->append(value);
411 } 411 }
412 return list.release(); 412 return list.release();
413 } 413 }
414 414
415 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBackgroundShorthand(const R enderStyle& style, const RenderObject* renderer, Node* styledNode, bool allowVis itedStyle) 415 static PassRefPtrWillBeRawPtr<CSSValueList> valuesForBackgroundShorthand(const R enderStyle& style, const RenderObject* renderer, Node* styledNode, bool allowVis itedStyle)
416 { 416 {
417 static const CSSPropertyID propertiesBeforeSlashSeperator[] = { 417 RefPtrWillBeRawPtr<CSSValueList> ret = CSSValueList::createCommaSeparated();
418 CSSPropertyBackgroundColor, 418 const FillLayer* currLayer = &style.backgroundLayers();
419 CSSPropertyBackgroundImage, 419 for (; currLayer; currLayer = currLayer->next()) {
420 CSSPropertyBackgroundRepeat, 420 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparat ed();
421 CSSPropertyBackgroundAttachment, 421 RefPtrWillBeRawPtr<CSSValueList> beforeSlash = CSSValueList::createSpace Separated();
422 CSSPropertyBackgroundPosition 422 if (!currLayer->next()) { // color only for final layer
423 }; 423 RefPtrWillBeRawPtr<CSSValue> value = RenderStyleCSSValueMapping::get (CSSPropertyBackgroundColor, style, renderer, styledNode, allowVisitedStyle);
424 static const CSSPropertyID propertiesAfterSlashSeperator[] = { 424 ASSERT(value);
425 CSSPropertyBackgroundSize, 425 beforeSlash->append(value);
426 CSSPropertyBackgroundOrigin, 426 }
427 CSSPropertyBackgroundClip 427 beforeSlash->append(currLayer->image() ? currLayer->image()->cssValue() : cssValuePool().createIdentifierValue(CSSValueNone));
428 }; 428 beforeSlash->append(valueForFillRepeat(currLayer->repeatX(), currLayer-> repeatY()));
429 429 beforeSlash->append(cssValuePool().createValue(currLayer->attachment())) ;
430 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSlashSeparated() ; 430 beforeSlash->append(createPositionListForLayer(CSSPropertyBackgroundPosi tion, *currLayer, style));
431 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesBeforeSlashSeperator, WTF_ARRAY_LENGTH(propertiesBeforeSlash Seperator)), style, renderer, styledNode, allowVisitedStyle)); 431 list->append(beforeSlash);
432 list->append(valuesForShorthandProperty(StylePropertyShorthand(CSSPropertyBa ckground, propertiesAfterSlashSeperator, WTF_ARRAY_LENGTH(propertiesAfterSlashSe perator)), style, renderer, styledNode, allowVisitedStyle)); 432 RefPtrWillBeRawPtr<CSSValueList> afterSlash = CSSValueList::createSpaceS eparated();
433 return list.release(); 433 afterSlash->append(valueForFillSize(currLayer->size(), style));
434 afterSlash->append(cssValuePool().createValue(currLayer->origin()));
435 afterSlash->append(cssValuePool().createValue(currLayer->clip()));
436 list->append(afterSlash);
437 ret->append(list);
438 }
439 return ret.release();
434 } 440 }
435 441
436 static ContentPosition resolveContentAlignmentAuto(ContentPosition position, Con tentDistributionType distribution, Node* element) 442 static ContentPosition resolveContentAlignmentAuto(ContentPosition position, Con tentDistributionType distribution, Node* element)
437 { 443 {
438 if (position != ContentPositionAuto || distribution != ContentDistributionDe fault) 444 if (position != ContentPositionAuto || distribution != ContentDistributionDe fault)
439 return position; 445 return position;
440 446
441 bool isFlex = element && element->computedStyle() 447 bool isFlex = element && element->computedStyle()
442 && element->computedStyle()->isDisplayFlexibleBox(); 448 && element->computedStyle()->isDisplayFlexibleBox();
443 449
(...skipping 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2547 return nullptr; 2553 return nullptr;
2548 2554
2549 case CSSPropertyAll: 2555 case CSSPropertyAll:
2550 return nullptr; 2556 return nullptr;
2551 } 2557 }
2552 ASSERT_NOT_REACHED(); 2558 ASSERT_NOT_REACHED();
2553 return nullptr; 2559 return nullptr;
2554 } 2560 }
2555 2561
2556 } 2562 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/backgrounds/background-shorthand-multiple-layers-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698