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

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

Issue 18859010: Move colorFromPrimitiveValue from StyleResolverState to TextLinkColors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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) 2005 Apple Computer, Inc. 2 Copyright (C) 2005 Apple Computer, Inc.
3 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 2004, 2005, 2008 Rob Buis <buis@kde.org> 4 2004, 2005, 2008 Rob Buis <buis@kde.org>
5 Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 5 Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
6 6
7 Based on khtml css code by: 7 Based on khtml css code by:
8 Copyright(C) 1999-2003 Lars Knoll(knoll@kde.org) 8 Copyright(C) 1999-2003 Lars Knoll(knoll@kde.org)
9 (C) 2003 Apple Computer, Inc. 9 (C) 2003 Apple Computer, Inc.
10 (C) 2004 Allan Sandfeld Jensen(kde@carewolf.com) 10 (C) 2004 Allan Sandfeld Jensen(kde@carewolf.com)
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 void StyleResolver::applySVGProperty(CSSPropertyID id, CSSValue* value) 100 void StyleResolver::applySVGProperty(CSSPropertyID id, CSSValue* value)
101 { 101 {
102 ASSERT(value); 102 ASSERT(value);
103 CSSPrimitiveValue* primitiveValue = 0; 103 CSSPrimitiveValue* primitiveValue = 0;
104 if (value->isPrimitiveValue()) 104 if (value->isPrimitiveValue())
105 primitiveValue = toCSSPrimitiveValue(value); 105 primitiveValue = toCSSPrimitiveValue(value);
106 106
107 // FIXME: This should be a const StyleResolverState, but 107 // FIXME: This should be a const StyleResolverState, but
108 // unfortunately resolveColorFromPrimitiveValue 108 // unfortunately colorFromPrimitiveValue
109 // has side-effects and is thus not const. 109 // has side-effects and is thus not const.
110 StyleResolverState& state = m_state; 110 StyleResolverState& state = m_state;
111 SVGRenderStyle* svgstyle = state.style()->accessSVGStyle(); 111 SVGRenderStyle* svgstyle = state.style()->accessSVGStyle();
112 112
113 bool isInherit = state.parentNode() && value->isInheritedValue(); 113 bool isInherit = state.parentNode() && value->isInheritedValue();
114 bool isInitial = value->isInitialValue() || (!state.parentNode() && value->i sInheritedValue()); 114 bool isInitial = value->isInitialValue() || (!state.parentNode() && value->i sInheritedValue());
115 115
116 // What follows is a list that maps the CSS properties into their 116 // What follows is a list that maps the CSS properties into their
117 // corresponding front-end RenderStyle values. Shorthands(e.g. border, 117 // corresponding front-end RenderStyle values. Shorthands(e.g. border,
118 // background) occur in this list as well and are only hit when mapping 118 // background) occur in this list as well and are only hit when mapping
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 561
562 CSSValue* firstValue = list->itemWithoutBoundsCheck(0); 562 CSSValue* firstValue = list->itemWithoutBoundsCheck(0);
563 if (!firstValue->isShadowValue()) 563 if (!firstValue->isShadowValue())
564 return; 564 return;
565 ShadowValue* item = static_cast<ShadowValue*>(firstValue); 565 ShadowValue* item = static_cast<ShadowValue*>(firstValue);
566 IntPoint location(item->x->computeLength<int>(state.style(), state.r ootElementStyle()), 566 IntPoint location(item->x->computeLength<int>(state.style(), state.r ootElementStyle()),
567 item->y->computeLength<int>(state.style(), state.rootElementStyl e())); 567 item->y->computeLength<int>(state.style(), state.rootElementStyl e()));
568 int blur = item->blur ? item->blur->computeLength<int>(state.style() , state.rootElementStyle()) : 0; 568 int blur = item->blur ? item->blur->computeLength<int>(state.style() , state.rootElementStyle()) : 0;
569 Color color; 569 Color color;
570 if (item->color) 570 if (item->color)
571 color = state.resolveColorFromPrimitiveValue(item->color.get()); 571 color = state.document()->textLinkColors().colorFromPrimitiveVal ue(item->color.get(), state.style()->visitedDependentColor(CSSPropertyColor));
572 572
573 // -webkit-svg-shadow does should not have a spread or style 573 // -webkit-svg-shadow does should not have a spread or style
574 ASSERT(!item->spread); 574 ASSERT(!item->spread);
575 ASSERT(!item->style); 575 ASSERT(!item->style);
576 576
577 OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(location, bl ur, 0, Normal, color.isValid() ? color : Color::transparent)); 577 OwnPtr<ShadowData> shadowData = adoptPtr(new ShadowData(location, bl ur, 0, Normal, color.isValid() ? color : Color::transparent));
578 svgstyle->setShadow(shadowData.release()); 578 svgstyle->setShadow(shadowData.release());
579 return; 579 return;
580 } 580 }
581 case CSSPropertyVectorEffect: { 581 case CSSPropertyVectorEffect: {
(...skipping 22 matching lines...) Expand all
604 } 604 }
605 default: 605 default:
606 // If you crash here, it's because you added a css property and are not handling it 606 // If you crash here, it's because you added a css property and are not handling it
607 // in either this switch statement or the one in StyleResolver::appl yProperty 607 // in either this switch statement or the one in StyleResolver::appl yProperty
608 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", id); 608 ASSERT_WITH_MESSAGE(0, "unimplemented propertyID: %d", id);
609 return; 609 return;
610 } 610 }
611 } 611 }
612 612
613 } 613 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSGradientValue.cpp ('k') | Source/core/css/resolver/FilterOperationResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698