diff options
| author | Ben Murdoch <benm@google.com> | 2010-08-11 14:44:44 +0100 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2010-08-12 19:15:41 +0100 |
| commit | dd8bb3de4f353a81954234999f1fea748aee2ea9 (patch) | |
| tree | 729b52bf09294f0d6c67cd5ea80aee1b727b7bd8 /WebCore/rendering/style | |
| parent | f3d41ba51d86bf719c7a65ab5297aea3c17e2d98 (diff) | |
| download | external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.zip external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.tar.gz external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.tar.bz2 | |
Merge WebKit at r65072 : Initial merge by git.
Change-Id: Ibcf418498376b2660aacb7f8d46ea7085ef91585
Diffstat (limited to 'WebCore/rendering/style')
| -rw-r--r-- | WebCore/rendering/style/ContentData.h | 2 | ||||
| -rw-r--r-- | WebCore/rendering/style/FillLayer.cpp | 35 | ||||
| -rw-r--r-- | WebCore/rendering/style/RenderStyle.cpp | 12 | ||||
| -rw-r--r-- | WebCore/rendering/style/RenderStyle.h | 15 | ||||
| -rw-r--r-- | WebCore/rendering/style/SVGRenderStyle.cpp | 20 | ||||
| -rw-r--r-- | WebCore/rendering/style/SVGRenderStyle.h | 77 | ||||
| -rw-r--r-- | WebCore/rendering/style/SVGRenderStyleDefs.cpp | 4 | ||||
| -rw-r--r-- | WebCore/rendering/style/SVGRenderStyleDefs.h | 12 | ||||
| -rw-r--r-- | WebCore/rendering/style/StyleRareInheritedData.cpp | 6 | ||||
| -rw-r--r-- | WebCore/rendering/style/StyleRareInheritedData.h | 3 |
10 files changed, 98 insertions, 88 deletions
diff --git a/WebCore/rendering/style/ContentData.h b/WebCore/rendering/style/ContentData.h index 2c261f8..5c3565e 100644 --- a/WebCore/rendering/style/ContentData.h +++ b/WebCore/rendering/style/ContentData.h @@ -26,13 +26,13 @@ #define ContentData_h #include "RenderStyleConstants.h" +#include <wtf/Forward.h> #include <wtf/Noncopyable.h> #include <wtf/PassRefPtr.h> namespace WebCore { class CounterContent; -class StringImpl; class StyleImage; struct ContentData : Noncopyable { diff --git a/WebCore/rendering/style/FillLayer.cpp b/WebCore/rendering/style/FillLayer.cpp index 3469e97..59f3bb2 100644 --- a/WebCore/rendering/style/FillLayer.cpp +++ b/WebCore/rendering/style/FillLayer.cpp @@ -129,6 +129,17 @@ bool FillLayer::operator==(const FillLayer& o) const void FillLayer::fillUnsetProperties() { FillLayer* curr; + for (curr = this; curr && curr->isImageSet(); curr = curr->next()) { } + if (curr && curr != this) { + // We need to fill in the remaining values with the pattern specified. + for (FillLayer* pattern = this; curr; curr = curr->next()) { + curr->m_image = pattern->m_image; + pattern = pattern->next(); + if (pattern == curr || !pattern) + pattern = this; + } + } + for (curr = this; curr && curr->isXPositionSet(); curr = curr->next()) { } if (curr && curr != this) { // We need to fill in the remaining values with the pattern specified. @@ -232,27 +243,15 @@ void FillLayer::fillUnsetProperties() void FillLayer::cullEmptyLayers() { - // CSS3 background layering: the number of background layers is determined - // by the number of values in the 'background-image' property. - // http://www.w3.org/TR/css3-background/#layering - FillLayer* next; for (FillLayer* p = this; p; p = next) { next = p->m_next; - if (!next) - break; - - bool anyAttributeSet = next->isXPositionSet() - || next->isYPositionSet() - || next->isAttachmentSet() - || next->isClipSet() - || next->isCompositeSet() - || next->isOriginSet() - || next->isRepeatXSet() - || next->isRepeatYSet() - || next->isSizeSet(); - - if (!next->isImageSet() || !anyAttributeSet) { + if (next && !next->isImageSet() && + !next->isXPositionSet() && !next->isYPositionSet() && + !next->isAttachmentSet() && !next->isClipSet() && + !next->isCompositeSet() && !next->isOriginSet() && + !next->isRepeatXSet() && !next->isRepeatYSet() + && !next->isSizeSet()) { delete next; p->m_next = 0; break; diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp index ce6c98e..5a66c67 100644 --- a/WebCore/rendering/style/RenderStyle.cpp +++ b/WebCore/rendering/style/RenderStyle.cpp @@ -385,7 +385,8 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon rareInheritedData->khtmlLineBreak != other->rareInheritedData->khtmlLineBreak || rareInheritedData->textSecurity != other->rareInheritedData->textSecurity || rareInheritedData->hyphens != other->rareInheritedData->hyphens || - rareInheritedData->hyphenateCharacter != other->rareInheritedData->hyphenateCharacter) + rareInheritedData->hyphenationString != other->rareInheritedData->hyphenationString || + rareInheritedData->hyphenationLocale != other->rareInheritedData->hyphenationLocale) return StyleDifferenceLayout; if (!rareInheritedData->shadowDataEquivalent(*other->rareInheritedData.get())) @@ -471,6 +472,9 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon return StyleDifferenceLayout; } + if ((visibility() == COLLAPSE) != (other->visibility() == COLLAPSE)) + return StyleDifferenceLayout; + // Make sure these left/top/right/bottom checks stay below all layout checks and above // all visible checks. if (position() != StaticPosition) { @@ -832,9 +836,9 @@ const AtomicString& RenderStyle::hyphenString() const { ASSERT(hyphens() == HyphensAuto); - const AtomicString& hyphenateCharacter = rareInheritedData.get()->hyphenateCharacter; - if (!hyphenateCharacter.isNull()) - return hyphenateCharacter; + const AtomicString& hyphenationString = rareInheritedData.get()->hyphenationString; + if (!hyphenationString.isNull()) + return hyphenationString; // FIXME: This should depend on locale. DEFINE_STATIC_LOCAL(AtomicString, hyphenMinusString, (&hyphen, 1)); diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h index 58af7cf..234122e 100644 --- a/WebCore/rendering/style/RenderStyle.h +++ b/WebCore/rendering/style/RenderStyle.h @@ -73,6 +73,7 @@ #include "ThemeTypes.h" #include "TimingFunction.h" #include "TransformOperations.h" +#include <wtf/Forward.h> #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> #include <wtf/StdLibExtras.h> @@ -108,7 +109,6 @@ class CSSStyleSelector; class CSSValueList; class CachedImage; class Pair; -class StringImpl; class StyleImage; typedef Vector<RefPtr<RenderStyle>, 4> PseudoStyleCache; @@ -648,7 +648,8 @@ public: EMatchNearestMailBlockquoteColor matchNearestMailBlockquoteColor() const { return static_cast<EMatchNearestMailBlockquoteColor>(rareNonInheritedData->matchNearestMailBlockquoteColor); } const AtomicString& highlight() const { return rareInheritedData->highlight; } Hyphens hyphens() const { return static_cast<Hyphens>(rareInheritedData->hyphens); } - const AtomicString& hyphenateCharacter() const { return rareInheritedData->hyphenateCharacter; } + const AtomicString& hyphenationString() const { return rareInheritedData->hyphenationString; } + const AtomicString& hyphenationLocale() const { return rareInheritedData->hyphenationLocale; } EBorderFit borderFit() const { return static_cast<EBorderFit>(rareNonInheritedData->m_borderFit); } EResize resize() const { return static_cast<EResize>(rareInheritedData->resize); } float columnWidth() const { return rareNonInheritedData->m_multiCol->m_width; } @@ -876,8 +877,8 @@ public: void adjustBackgroundLayers() { if (backgroundLayers()->next()) { - accessBackgroundLayers()->fillUnsetProperties(); accessBackgroundLayers()->cullEmptyLayers(); + accessBackgroundLayers()->fillUnsetProperties(); } } @@ -887,8 +888,8 @@ public: void adjustMaskLayers() { if (maskLayers()->next()) { - accessMaskLayers()->fillUnsetProperties(); accessMaskLayers()->cullEmptyLayers(); + accessMaskLayers()->fillUnsetProperties(); } } @@ -992,7 +993,8 @@ public: void setMatchNearestMailBlockquoteColor(EMatchNearestMailBlockquoteColor c) { SET_VAR(rareNonInheritedData, matchNearestMailBlockquoteColor, c); } void setHighlight(const AtomicString& h) { SET_VAR(rareInheritedData, highlight, h); } void setHyphens(Hyphens h) { SET_VAR(rareInheritedData, hyphens, h); } - void setHyphenateCharacter(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenateCharacter, h); } + void setHyphenationString(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenationString, h); } + void setHyphenationLocale(const AtomicString& h) { SET_VAR(rareInheritedData, hyphenationLocale, h); } void setBorderFit(EBorderFit b) { SET_VAR(rareNonInheritedData, m_borderFit, b); } void setResize(EResize r) { SET_VAR(rareInheritedData, resize, r); } void setColumnWidth(float f) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_autoWidth, false); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_width, f); } @@ -1205,7 +1207,8 @@ public: static EMatchNearestMailBlockquoteColor initialMatchNearestMailBlockquoteColor() { return BCNORMAL; } static const AtomicString& initialHighlight() { return nullAtom; } static Hyphens initialHyphens() { return HyphensManual; } - static const AtomicString& initialHyphenateCharacter() { return nullAtom; } + static const AtomicString& initialHyphenationString() { return nullAtom; } + static const AtomicString& initialHyphenationLocale() { return nullAtom; } static EBorderFit initialBorderFit() { return BorderFitBorder; } static EResize initialResize() { return RESIZE_NONE; } static ControlPart initialAppearance() { return NoControlPart; } diff --git a/WebCore/rendering/style/SVGRenderStyle.cpp b/WebCore/rendering/style/SVGRenderStyle.cpp index 2a9003c..0df26f4 100644 --- a/WebCore/rendering/style/SVGRenderStyle.cpp +++ b/WebCore/rendering/style/SVGRenderStyle.cpp @@ -211,26 +211,6 @@ StyleDifference SVGRenderStyle::diff(const SVGRenderStyle* other) const return StyleDifferenceEqual; } -float SVGRenderStyle::cssPrimitiveToLength(const RenderObject* item, CSSValue* value, float defaultValue) -{ - CSSPrimitiveValue* primitive = static_cast<CSSPrimitiveValue*>(value); - - unsigned short cssType = (primitive ? primitive->primitiveType() : (unsigned short) CSSPrimitiveValue::CSS_UNKNOWN); - if (!(cssType > CSSPrimitiveValue::CSS_UNKNOWN && cssType <= CSSPrimitiveValue::CSS_PC)) - return defaultValue; - - if (cssType == CSSPrimitiveValue::CSS_PERCENTAGE) { - SVGStyledElement* element = static_cast<SVGStyledElement*>(item->node()); - SVGElement* viewportElement = (element ? element->viewportElement() : 0); - if (viewportElement) { - float result = primitive->getFloatValue() / 100.0f; - return SVGLength::PercentageOfViewport(result, element, LengthModeOther); - } - } - - return primitive->computeLengthFloat(const_cast<RenderStyle*>(item->style()), item->document()->documentElement()->renderStyle()); -} - static void getSVGShadowExtent(ShadowData* shadow, float& top, float& right, float& bottom, float& left) { top = 0.0f; diff --git a/WebCore/rendering/style/SVGRenderStyle.h b/WebCore/rendering/style/SVGRenderStyle.h index c1d72e9..f071755 100644 --- a/WebCore/rendering/style/SVGRenderStyle.h +++ b/WebCore/rendering/style/SVGRenderStyle.h @@ -78,17 +78,13 @@ public: static SVGPaint* initialFillPaint() { return SVGPaint::defaultFill(); } static float initialStrokeOpacity() { return 1.0f; } static SVGPaint* initialStrokePaint() { return SVGPaint::defaultStroke(); } - static CSSValueList* initialStrokeDashArray() { return 0; } + static Vector<SVGLength> initialStrokeDashArray() { return Vector<SVGLength>(); } static float initialStrokeMiterLimit() { return 4.0f; } - static CSSValue* initialStrokeWidth() { return 0; } - static CSSValue* initialStrokeDashOffset() { return 0; }; - static CSSValue* initialKerning() { return 0; } static float initialStopOpacity() { return 1.0f; } static Color initialStopColor() { return Color(0, 0, 0); } static float initialFloodOpacity() { return 1.0f; } static Color initialFloodColor() { return Color(0, 0, 0); } static Color initialLightingColor() { return Color(255, 255, 255); } - static CSSValue* initialBaselineShiftValue() { return 0; } static ShadowData* initialShadow() { return 0; } static String initialClipperResource() { return String(); } static String initialFilterResource() { return String(); } @@ -97,6 +93,34 @@ public: static String initialMarkerMidResource() { return String(); } static String initialMarkerEndResource() { return String(); } + static SVGLength initialBaselineShiftValue() + { + SVGLength length; + length.newValueSpecifiedUnits(LengthTypeNumber, 0); + return length; + } + + static SVGLength initialKerning() + { + SVGLength length; + length.newValueSpecifiedUnits(LengthTypeNumber, 0); + return length; + } + + static SVGLength initialStrokeDashOffset() + { + SVGLength length; + length.newValueSpecifiedUnits(LengthTypeNumber, 0); + return length; + } + + static SVGLength initialStrokeWidth() + { + SVGLength length; + length.newValueSpecifiedUnits(LengthTypeNumber, 1); + return length; + } + // SVG CSS Property setters void setAlignmentBaseline(EAlignmentBaseline val) { svg_noninherited_flags.f._alignmentBaseline = val; } void setDominantBaseline(EDominantBaseline val) { svg_noninherited_flags.f._dominantBaseline = val; } @@ -140,7 +164,7 @@ public: stroke.access()->paint = obj; } - void setStrokeDashArray(PassRefPtr<CSSValueList> obj) + void setStrokeDashArray(const Vector<SVGLength>& obj) { if (!(stroke->dashArray == obj)) stroke.access()->dashArray = obj; @@ -152,19 +176,19 @@ public: stroke.access()->miterLimit = obj; } - void setStrokeWidth(PassRefPtr<CSSValue> obj) + void setStrokeWidth(const SVGLength& obj) { if (!(stroke->width == obj)) stroke.access()->width = obj; } - void setStrokeDashOffset(PassRefPtr<CSSValue> obj) + void setStrokeDashOffset(const SVGLength& obj) { if (!(stroke->dashOffset == obj)) stroke.access()->dashOffset = obj; } - void setKerning(PassRefPtr<CSSValue> obj) + void setKerning(const SVGLength& obj) { if (!(text->kerning == obj)) text.access()->kerning = obj; @@ -176,7 +200,7 @@ public: stops.access()->opacity = obj; } - void setStopColor(Color obj) + void setStopColor(const Color& obj) { if (!(stops->color == obj)) stops.access()->color = obj; @@ -188,60 +212,59 @@ public: misc.access()->floodOpacity = obj; } - void setFloodColor(Color obj) + void setFloodColor(const Color& obj) { if (!(misc->floodColor == obj)) misc.access()->floodColor = obj; } - void setLightingColor(Color obj) + void setLightingColor(const Color& obj) { if (!(misc->lightingColor == obj)) misc.access()->lightingColor = obj; } - void setBaselineShiftValue(PassRefPtr<CSSValue> obj) + void setBaselineShiftValue(const SVGLength& obj) { if (!(misc->baselineShiftValue == obj)) misc.access()->baselineShiftValue = obj; } - void setShadow(PassOwnPtr<ShadowData> obj) { shadowSVG.access()->shadow = obj; - } + void setShadow(PassOwnPtr<ShadowData> obj) { shadowSVG.access()->shadow = obj; } // Setters for non-inherited resources - void setClipperResource(String obj) + void setClipperResource(const String& obj) { if (!(resources->clipper == obj)) resources.access()->clipper = obj; } - void setFilterResource(String obj) + void setFilterResource(const String& obj) { if (!(resources->filter == obj)) resources.access()->filter = obj; } - void setMaskerResource(String obj) + void setMaskerResource(const String& obj) { if (!(resources->masker == obj)) resources.access()->masker = obj; } // Setters for inherited resources - void setMarkerStartResource(String obj) + void setMarkerStartResource(const String& obj) { if (!(inheritedResources->markerStart == obj)) inheritedResources.access()->markerStart = obj; } - void setMarkerMidResource(String obj) + void setMarkerMidResource(const String& obj) { if (!(inheritedResources->markerMid == obj)) inheritedResources.access()->markerMid = obj; } - void setMarkerEndResource(String obj) + void setMarkerEndResource(const String& obj) { if (!(inheritedResources->markerEnd == obj)) inheritedResources.access()->markerEnd = obj; @@ -269,17 +292,17 @@ public: SVGPaint* fillPaint() const { return fill->paint.get(); } float strokeOpacity() const { return stroke->opacity; } SVGPaint* strokePaint() const { return stroke->paint.get(); } - CSSValueList* strokeDashArray() const { return stroke->dashArray.get(); } + Vector<SVGLength> strokeDashArray() const { return stroke->dashArray; } float strokeMiterLimit() const { return stroke->miterLimit; } - CSSValue* strokeWidth() const { return stroke->width.get(); } - CSSValue* strokeDashOffset() const { return stroke->dashOffset.get(); } - CSSValue* kerning() const { return text->kerning.get(); } + SVGLength strokeWidth() const { return stroke->width; } + SVGLength strokeDashOffset() const { return stroke->dashOffset; } + SVGLength kerning() const { return text->kerning; } float stopOpacity() const { return stops->opacity; } Color stopColor() const { return stops->color; } float floodOpacity() const { return misc->floodOpacity; } Color floodColor() const { return misc->floodColor; } Color lightingColor() const { return misc->lightingColor; } - CSSValue* baselineShiftValue() const { return misc->baselineShiftValue.get(); } + SVGLength baselineShiftValue() const { return misc->baselineShiftValue; } ShadowData* shadow() const { return shadowSVG->shadow.get(); } String clipperResource() const { return resources->clipper; } String filterResource() const { return resources->filter; } @@ -296,8 +319,6 @@ public: bool hasStroke() const { return strokePaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE; } bool hasFill() const { return fillPaint()->paintType() != SVGPaint::SVG_PAINTTYPE_NONE; } - static float cssPrimitiveToLength(const RenderObject*, CSSValue*, float defaultValue = 0.0f); - protected: // inherit struct InheritedFlags { diff --git a/WebCore/rendering/style/SVGRenderStyleDefs.cpp b/WebCore/rendering/style/SVGRenderStyleDefs.cpp index bf7624f..c30ae6d 100644 --- a/WebCore/rendering/style/SVGRenderStyleDefs.cpp +++ b/WebCore/rendering/style/SVGRenderStyleDefs.cpp @@ -73,8 +73,8 @@ StyleStrokeData::StyleStrokeData() , miterLimit(SVGRenderStyle::initialStrokeMiterLimit()) , width(SVGRenderStyle::initialStrokeWidth()) , dashOffset(SVGRenderStyle::initialStrokeDashOffset()) - , paint(SVGRenderStyle::initialStrokePaint()) , dashArray(SVGRenderStyle::initialStrokeDashArray()) + , paint(SVGRenderStyle::initialStrokePaint()) { } @@ -84,8 +84,8 @@ StyleStrokeData::StyleStrokeData(const StyleStrokeData& other) , miterLimit(other.miterLimit) , width(other.width) , dashOffset(other.dashOffset) - , paint(other.paint) , dashArray(other.dashArray) + , paint(other.paint) { } diff --git a/WebCore/rendering/style/SVGRenderStyleDefs.h b/WebCore/rendering/style/SVGRenderStyleDefs.h index adb890c..339bb77 100644 --- a/WebCore/rendering/style/SVGRenderStyleDefs.h +++ b/WebCore/rendering/style/SVGRenderStyleDefs.h @@ -29,9 +29,9 @@ #define SVGRenderStyleDefs_h #if ENABLE(SVG) - #include "Color.h" #include "PlatformString.h" +#include "SVGLength.h" #include "ShadowData.h" #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -127,11 +127,11 @@ namespace WebCore { float opacity; float miterLimit; - RefPtr<CSSValue> width; - RefPtr<CSSValue> dashOffset; + SVGLength width; + SVGLength dashOffset; + Vector<SVGLength> dashArray; RefPtr<SVGPaint> paint; - RefPtr<CSSValueList> dashArray; private: StyleStrokeData(); @@ -168,7 +168,7 @@ namespace WebCore { return !(*this == other); } - RefPtr<CSSValue> kerning; + SVGLength kerning; private: StyleTextData(); @@ -192,7 +192,7 @@ namespace WebCore { Color lightingColor; // non-inherited text stuff lives here not in StyleTextData. - RefPtr<CSSValue> baselineShiftValue; + SVGLength baselineShiftValue; private: StyleMiscData(); diff --git a/WebCore/rendering/style/StyleRareInheritedData.cpp b/WebCore/rendering/style/StyleRareInheritedData.cpp index cb6edf3..6942809 100644 --- a/WebCore/rendering/style/StyleRareInheritedData.cpp +++ b/WebCore/rendering/style/StyleRareInheritedData.cpp @@ -77,7 +77,8 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o) , userSelect(o.userSelect) , colorSpace(o.colorSpace) , hyphens(o.hyphens) - , hyphenateCharacter(o.hyphenateCharacter) + , hyphenationString(o.hyphenationString) + , hyphenationLocale(o.hyphenationLocale) { } @@ -121,7 +122,8 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const && userSelect == o.userSelect && colorSpace == o.colorSpace && hyphens == o.hyphens - && hyphenateCharacter == o.hyphenateCharacter; + && hyphenationString == o.hyphenationString + && hyphenationLocale == o.hyphenationLocale; } bool StyleRareInheritedData::shadowDataEquivalent(const StyleRareInheritedData& o) const diff --git a/WebCore/rendering/style/StyleRareInheritedData.h b/WebCore/rendering/style/StyleRareInheritedData.h index f6e3bf4..74d5fc9 100644 --- a/WebCore/rendering/style/StyleRareInheritedData.h +++ b/WebCore/rendering/style/StyleRareInheritedData.h @@ -82,7 +82,8 @@ public: unsigned colorSpace : 1; // ColorSpace unsigned hyphens : 2; // Hyphens - AtomicString hyphenateCharacter; + AtomicString hyphenationString; + AtomicString hyphenationLocale; private: StyleRareInheritedData(); |
