Changeset 92742 in webkit
- Timestamp:
- Aug 9, 2011 6:44:07 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r92712 r92742 1 2011-08-09 Luke Macpherson <macpherson@chromium.org> 2 3 Implement string based properties in CSSStyleApplyProperty. 4 https://bugs.webkit.org/show_bug.cgi?id=65662 5 6 Reviewed by Darin Adler. 7 8 No new tests / refactoring only. 9 10 * css/CSSStyleApplyProperty.cpp: 11 (WebCore::ApplyPropertyString::ApplyPropertyString): 12 Added class to handle string based properties. 13 (WebCore::ApplyPropertyString::applyValue): 14 (WebCore::CSSStyleApplyProperty::CSSStyleApplyProperty): 15 Add initializers for CSSPropertyWebkitHighlight and CSSPropertyWebkitHyphenateCharacter. 16 * css/CSSStyleSelector.cpp: 17 (WebCore::CSSStyleSelector::applyProperty): 18 Remove existing implementations for CSSPropertyWebkitHighlight and CSSPropertyWebkitHyphenateCharacter. 19 1 20 2011-08-09 Emil A Eklund <eae@chromium.org> 2 21 -
trunk/Source/WebCore/css/CSSStyleApplyProperty.cpp
r92243 r92742 266 266 }; 267 267 268 enum LengthAuto { AutoDisabled = 0, AutoEnabled = 1};269 enum LengthIntrinsic { IntrinsicDisabled = 0, IntrinsicEnabled = 1};270 enum LengthMinIntrinsic { MinIntrinsicDisabled = 0, MinIntrinsicEnabled = 1};271 enum LengthNone { NoneDisabled = 0, NoneEnabled = 1};272 enum LengthUndefined { UndefinedDisabled = 0, UndefinedEnabled = 1};273 enum LengthFlexDirection { FlexDirectionDisabled = 0, FlexWidth = 1, FlexHeight};268 enum LengthAuto { AutoDisabled = 0, AutoEnabled }; 269 enum LengthIntrinsic { IntrinsicDisabled = 0, IntrinsicEnabled }; 270 enum LengthMinIntrinsic { MinIntrinsicDisabled = 0, MinIntrinsicEnabled }; 271 enum LengthNone { NoneDisabled = 0, NoneEnabled }; 272 enum LengthUndefined { UndefinedDisabled = 0, UndefinedEnabled }; 273 enum LengthFlexDirection { FlexDirectionDisabled = 0, FlexWidth, FlexHeight }; 274 274 template <LengthAuto autoEnabled = AutoDisabled, 275 275 LengthIntrinsic intrinsicEnabled = IntrinsicDisabled, … … 330 330 setValue(selector->style(), Length(primitiveValue->getDoubleValue(), Percent)); 331 331 } 332 } 333 }; 334 335 enum StringIdentBehavior { NothingMapsToNull = 0, MapNoneToNull, MapAutoToNull }; 336 template <StringIdentBehavior identBehavior = NothingMapsToNull> 337 class ApplyPropertyString : public ApplyPropertyDefaultBase<const AtomicString&> { 338 public: 339 ApplyPropertyString(GetterFunction getter, SetterFunction setter, InitialFunction initial) 340 : ApplyPropertyDefaultBase<const AtomicString&>(getter, setter, initial) 341 { 342 } 343 344 private: 345 virtual void applyValue(CSSStyleSelector* selector, CSSValue* value) const 346 { 347 if (!value->isPrimitiveValue()) 348 return; 349 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); 350 if ((identBehavior == MapNoneToNull && primitiveValue->getIdent() == CSSValueNone) 351 || (identBehavior == MapAutoToNull && primitiveValue->getIdent() == CSSValueAuto)) 352 setValue(selector->style(), nullAtom); 353 else 354 setValue(selector->style(), primitiveValue->getStringValue()); 332 355 } 333 356 }; … … 932 955 setPropertyHandler(CSSPropertyWebkitColumnWidth, new ApplyPropertyAuto<float, ComputeLength>(&RenderStyle::columnWidth, &RenderStyle::setColumnWidth, &RenderStyle::hasAutoColumnWidth, &RenderStyle::setHasAutoColumnWidth)); 933 956 957 setPropertyHandler(CSSPropertyWebkitHighlight, new ApplyPropertyString<MapNoneToNull>(&RenderStyle::highlight, &RenderStyle::setHighlight, &RenderStyle::initialHighlight)); 958 setPropertyHandler(CSSPropertyWebkitHyphenateCharacter, new ApplyPropertyString<MapAutoToNull>(&RenderStyle::hyphenationString, &RenderStyle::setHyphenationString, &RenderStyle::initialHyphenationString)); 959 934 960 setPropertyHandler(CSSPropertyWebkitTextCombine, new ApplyPropertyDefault<TextCombine>(&RenderStyle::textCombine, &RenderStyle::setTextCombine, &RenderStyle::initialTextCombine)); 935 961 setPropertyHandler(CSSPropertyWebkitTextEmphasisPosition, new ApplyPropertyDefault<TextEmphasisPosition>(&RenderStyle::textEmphasisPosition, &RenderStyle::setTextEmphasisPosition, &RenderStyle::initialTextEmphasisPosition)); -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r92620 r92742 4742 4742 return; 4743 4743 } 4744 case CSSPropertyWebkitHighlight: {4745 HANDLE_INHERIT_AND_INITIAL(highlight, Highlight);4746 if (primitiveValue->getIdent() == CSSValueNone)4747 m_style->setHighlight(nullAtom);4748 else4749 m_style->setHighlight(primitiveValue->getStringValue());4750 return;4751 }4752 4744 case CSSPropertyWebkitHyphens: 4753 4745 HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(hyphens, Hyphens); 4754 4746 return; 4755 case CSSPropertyWebkitHyphenateCharacter: {4756 HANDLE_INHERIT_AND_INITIAL(hyphenationString, HyphenationString);4757 if (primitiveValue->getIdent() == CSSValueAuto)4758 m_style->setHyphenationString(nullAtom);4759 else4760 m_style->setHyphenationString(primitiveValue->getStringValue());4761 return;4762 }4763 4747 case CSSPropertyWebkitHyphenateLimitAfter: { 4764 4748 HANDLE_INHERIT_AND_INITIAL(hyphenationLimitAfter, HyphenationLimitAfter); … … 5223 5207 case CSSPropertyWebkitColumnGap: 5224 5208 case CSSPropertyWebkitColumnWidth: 5209 case CSSPropertyWebkitHighlight: 5210 case CSSPropertyWebkitHyphenateCharacter: 5225 5211 case CSSPropertyWebkitTextCombine: 5226 5212 case CSSPropertyWebkitTextEmphasisPosition:
Note: See TracChangeset
for help on using the changeset viewer.