From 8995b83bcbfbb68245f779b64e5517627c6cc6ea Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 17 Oct 2012 16:21:14 +0200 Subject: Imported WebKit commit cf4f8fc6f19b0629f51860cb2d4b25e139d07e00 (http://svn.webkit.org/repository/webkit/trunk@131592) New snapshot that includes the build fixes for Mac OS X 10.6 and earlier as well as the previously cherry-picked changes --- Source/WebCore/css/StyleBuilder.cpp | 64 +++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 27 deletions(-) (limited to 'Source/WebCore/css/StyleBuilder.cpp') diff --git a/Source/WebCore/css/StyleBuilder.cpp b/Source/WebCore/css/StyleBuilder.cpp index 09c27b717..8075d8d0d 100644 --- a/Source/WebCore/css/StyleBuilder.cpp +++ b/Source/WebCore/css/StyleBuilder.cpp @@ -891,7 +891,7 @@ public: } }; -enum BorderImageType { Image = 0, Mask }; +enum BorderImageType { BorderImage = 0, BorderMask }; template styleMap()->mapNinePieceImage(property, value, image); (styleResolver->style()->*setterFunction)(image); @@ -918,8 +918,8 @@ enum BorderImageModifierType { Outset, Repeat, Slice, Width }; template class ApplyPropertyBorderImageModifier { private: - static inline const NinePieceImage& getValue(RenderStyle* style) { return type == Image ? style->borderImage() : style->maskBoxImage(); } - static inline void setValue(RenderStyle* style, const NinePieceImage& value) { return type == Image ? style->setBorderImage(value) : style->setMaskBoxImage(value); } + static inline const NinePieceImage& getValue(RenderStyle* style) { return type == BorderImage ? style->borderImage() : style->maskBoxImage(); } + static inline void setValue(RenderStyle* style, const NinePieceImage& value) { return type == BorderImage ? style->setBorderImage(value) : style->setMaskBoxImage(value); } public: static void applyInheritValue(CSSPropertyID, StyleResolver* styleResolver) { @@ -954,12 +954,12 @@ public: break; case Slice: // Masks have a different initial value for slices. Preserve the value of 0 for backwards compatibility. - image.setImageSlices(type == Image ? LengthBox(Length(100, Percent), Length(100, Percent), Length(100, Percent), Length(100, Percent)) : LengthBox()); + image.setImageSlices(type == BorderImage ? LengthBox(Length(100, Percent), Length(100, Percent), Length(100, Percent), Length(100, Percent)) : LengthBox()); image.setFill(false); break; case Width: // Masks have a different initial value for widths. They use an 'auto' value rather than trying to fit to the border. - image.setBorderSlices(type == Image ? LengthBox(Length(1, Relative), Length(1, Relative), Length(1, Relative), Length(1, Relative)) : LengthBox()); + image.setBorderSlices(type == BorderImage ? LengthBox(Length(1, Relative), Length(1, Relative), Length(1, Relative), Length(1, Relative)) : LengthBox()); break; } setValue(styleResolver->style(), image); @@ -1012,11 +1012,11 @@ public: typedef CounterDirectiveMap::iterator Iterator; Iterator end = parentMap.end(); for (Iterator it = parentMap.begin(); it != end; ++it) { - CounterDirectives& directives = map.add(it->first, CounterDirectives()).iterator->second; + CounterDirectives& directives = map.add(it->key, CounterDirectives()).iterator->value; if (counterBehavior == Reset) { - directives.inheritReset(it->second); + directives.inheritReset(it->value); } else { - directives.inheritIncrement(it->second); + directives.inheritIncrement(it->value); } } } @@ -1033,9 +1033,9 @@ public: Iterator end = map.end(); for (Iterator it = map.begin(); it != end; ++it) if (counterBehavior == Reset) - it->second.clearReset(); + it->value.clearReset(); else - it->second.clearIncrement(); + it->value.clearIncrement(); int length = list ? list->length() : 0; for (int i = 0; i < length; ++i) { @@ -1049,7 +1049,7 @@ public: AtomicString identifier = static_cast(pair->first())->getStringValue(); int value = static_cast(pair->second())->getIntValue(); - CounterDirectives& directives = map.add(identifier, CounterDirectives()).iterator->second; + CounterDirectives& directives = map.add(identifier, CounterDirectives()).iterator->value; if (counterBehavior == Reset) { directives.setResetValue(value); } else { @@ -1698,6 +1698,14 @@ public: else if (primitiveValue->isShape()) { setValue(styleResolver->style(), ShapeClipPathOperation::create(basicShapeForValue(styleResolver, primitiveValue->getShapeValue()))); } +#if ENABLE(SVG) + else if (primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_URI) { + String cssURLValue = primitiveValue->getStringValue(); + KURL url = styleResolver->document()->completeURL(cssURLValue); + // FIXME: It doesn't work with forward or external SVG references (see https://bugs.webkit.org/show_bug.cgi?id=90405) + setValue(styleResolver->style(), ReferenceClipPathOperation::create(cssURLValue, url.fragmentIdentifier())); + } +#endif } } static PropertyHandler createHandler() @@ -1709,7 +1717,7 @@ public: #if ENABLE(CSS_EXCLUSIONS) template ), BasicShape* (*initialFunction)()> -class ApplyPropertyWrapShape { +class ApplyPropertyExclusionShape { public: static void setValue(RenderStyle* style, PassRefPtr value) { (style->*setterFunction)(value); } static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) @@ -1719,8 +1727,8 @@ public: if (primitiveValue->getIdent() == CSSValueAuto) setValue(styleResolver->style(), 0); else if (primitiveValue->isShape()) { - RefPtr wrapShape = basicShapeForValue(styleResolver, primitiveValue->getShapeValue()); - setValue(styleResolver->style(), wrapShape.release()); + RefPtr shape = basicShapeForValue(styleResolver, primitiveValue->getShapeValue()); + setValue(styleResolver->style(), shape.release()); } } } @@ -1815,11 +1823,11 @@ StyleBuilder::StyleBuilder() setPropertyHandler(CSSPropertyBorderCollapse, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyBorderColor, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyBorderImage, ApplyPropertyExpanding::createHandler()); - setPropertyHandler(CSSPropertyBorderImageOutset, ApplyPropertyBorderImageModifier::createHandler()); - setPropertyHandler(CSSPropertyBorderImageRepeat, ApplyPropertyBorderImageModifier::createHandler()); - setPropertyHandler(CSSPropertyBorderImageSlice, ApplyPropertyBorderImageModifier::createHandler()); + setPropertyHandler(CSSPropertyBorderImageOutset, ApplyPropertyBorderImageModifier::createHandler()); + setPropertyHandler(CSSPropertyBorderImageRepeat, ApplyPropertyBorderImageModifier::createHandler()); + setPropertyHandler(CSSPropertyBorderImageSlice, ApplyPropertyBorderImageModifier::createHandler()); setPropertyHandler(CSSPropertyBorderImageSource, ApplyPropertyBorderImageSource::createHandler()); - setPropertyHandler(CSSPropertyBorderImageWidth, ApplyPropertyBorderImageModifier::createHandler()); + setPropertyHandler(CSSPropertyBorderImageWidth, ApplyPropertyBorderImageModifier::createHandler()); setPropertyHandler(CSSPropertyBorderLeft, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyBorderLeftColor, ApplyPropertyColor::createHandler()); setPropertyHandler(CSSPropertyBorderLeftStyle, ApplyPropertyDefault::createHandler()); @@ -1879,6 +1887,7 @@ StyleBuilder::StyleBuilder() setPropertyHandler(CSSPropertyMaxWidth, ApplyPropertyLength<&RenderStyle::maxWidth, &RenderStyle::setMaxWidth, &RenderStyle::initialMaxSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled, NoneEnabled, UndefinedEnabled>::createHandler()); setPropertyHandler(CSSPropertyMinHeight, ApplyPropertyLength<&RenderStyle::minHeight, &RenderStyle::setMinHeight, &RenderStyle::initialMinSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicDisabled>::createHandler()); setPropertyHandler(CSSPropertyMinWidth, ApplyPropertyLength<&RenderStyle::minWidth, &RenderStyle::setMinWidth, &RenderStyle::initialMinSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled>::createHandler()); + setPropertyHandler(CSSPropertyOpacity, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyOrphans, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyOutline, ApplyPropertyExpanding::createHandler()); setPropertyHandler(CSSPropertyOutlineColor, ApplyPropertyColor::createHandler()); @@ -1897,6 +1906,7 @@ StyleBuilder::StyleBuilder() setPropertyHandler(CSSPropertyPageBreakAfter, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyPageBreakBefore, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyPageBreakInside, ApplyPropertyDefault::createHandler()); + setPropertyHandler(CSSPropertyPointerEvents, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyPosition, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyResize, ApplyPropertyResize::createHandler()); setPropertyHandler(CSSPropertyRight, ApplyPropertyLength<&RenderStyle::right, &RenderStyle::setRight, &RenderStyle::initialOffset, AutoEnabled>::createHandler()); @@ -1938,7 +1948,7 @@ StyleBuilder::StyleBuilder() #endif setPropertyHandler(CSSPropertyWebkitBorderFit, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitBorderHorizontalSpacing, ApplyPropertyComputeLength::createHandler()); - setPropertyHandler(CSSPropertyWebkitBorderImage, ApplyPropertyBorderImage::createHandler()); + setPropertyHandler(CSSPropertyWebkitBorderImage, ApplyPropertyBorderImage::createHandler()); setPropertyHandler(CSSPropertyWebkitBorderRadius, CSSPropertyBorderRadius); setPropertyHandler(CSSPropertyWebkitBorderVerticalSpacing, ApplyPropertyComputeLength::createHandler()); setPropertyHandler(CSSPropertyWebkitBoxAlign, ApplyPropertyDefault::createHandler()); @@ -2003,12 +2013,12 @@ StyleBuilder::StyleBuilder() setPropertyHandler(CSSPropertyWebkitMarqueeDirection, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitMarqueeStyle, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskAttachment, ApplyPropertyFillLayer::createHandler()); - setPropertyHandler(CSSPropertyWebkitMaskBoxImage, ApplyPropertyBorderImage::createHandler()); - setPropertyHandler(CSSPropertyWebkitMaskBoxImageOutset, ApplyPropertyBorderImageModifier::createHandler()); - setPropertyHandler(CSSPropertyWebkitMaskBoxImageRepeat, ApplyPropertyBorderImageModifier::createHandler()); - setPropertyHandler(CSSPropertyWebkitMaskBoxImageSlice, ApplyPropertyBorderImageModifier::createHandler()); + setPropertyHandler(CSSPropertyWebkitMaskBoxImage, ApplyPropertyBorderImage::createHandler()); + setPropertyHandler(CSSPropertyWebkitMaskBoxImageOutset, ApplyPropertyBorderImageModifier::createHandler()); + setPropertyHandler(CSSPropertyWebkitMaskBoxImageRepeat, ApplyPropertyBorderImageModifier::createHandler()); + setPropertyHandler(CSSPropertyWebkitMaskBoxImageSlice, ApplyPropertyBorderImageModifier::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskBoxImageSource, ApplyPropertyBorderImageSource::createHandler()); - setPropertyHandler(CSSPropertyWebkitMaskBoxImageWidth, ApplyPropertyBorderImageModifier::createHandler()); + setPropertyHandler(CSSPropertyWebkitMaskBoxImageWidth, ApplyPropertyBorderImageModifier::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskClip, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskComposite, ApplyPropertyFillLayer::createHandler()); setPropertyHandler(CSSPropertyWebkitMaskImage, ApplyPropertyFillLayer::createHandler()); @@ -2060,8 +2070,8 @@ StyleBuilder::StyleBuilder() setPropertyHandler(CSSPropertyWebkitWrapMargin, ApplyPropertyLength<&RenderStyle::wrapMargin, &RenderStyle::setWrapMargin, &RenderStyle::initialWrapMargin>::createHandler()); setPropertyHandler(CSSPropertyWebkitWrapPadding, ApplyPropertyLength<&RenderStyle::wrapPadding, &RenderStyle::setWrapPadding, &RenderStyle::initialWrapPadding>::createHandler()); setPropertyHandler(CSSPropertyWebkitWrapThrough, ApplyPropertyDefault::createHandler()); - setPropertyHandler(CSSPropertyWebkitShapeInside, ApplyPropertyWrapShape<&RenderStyle::wrapShapeInside, &RenderStyle::setWrapShapeInside, &RenderStyle::initialWrapShapeInside>::createHandler()); - setPropertyHandler(CSSPropertyWebkitShapeOutside, ApplyPropertyWrapShape<&RenderStyle::wrapShapeOutside, &RenderStyle::setWrapShapeOutside, &RenderStyle::initialWrapShapeOutside>::createHandler()); + setPropertyHandler(CSSPropertyWebkitShapeInside, ApplyPropertyExclusionShape<&RenderStyle::shapeInside, &RenderStyle::setShapeInside, &RenderStyle::initialShapeInside>::createHandler()); + setPropertyHandler(CSSPropertyWebkitShapeOutside, ApplyPropertyExclusionShape<&RenderStyle::shapeOutside, &RenderStyle::setShapeOutside, &RenderStyle::initialShapeOutside>::createHandler()); #endif setPropertyHandler(CSSPropertyWhiteSpace, ApplyPropertyDefault::createHandler()); setPropertyHandler(CSSPropertyWidows, ApplyPropertyDefault::createHandler()); -- cgit v1.2.1