diff options
Diffstat (limited to 'WebCore/rendering/style')
-rw-r--r-- | WebCore/rendering/style/FillLayer.cpp | 11 | ||||
-rw-r--r-- | WebCore/rendering/style/FillLayer.h | 1 | ||||
-rw-r--r-- | WebCore/rendering/style/RenderStyle.cpp | 2 | ||||
-rw-r--r-- | WebCore/rendering/style/RenderStyle.h | 57 | ||||
-rw-r--r-- | WebCore/rendering/style/RenderStyleConstants.h | 63 | ||||
-rw-r--r-- | WebCore/rendering/style/SVGRenderStyle.cpp | 53 | ||||
-rw-r--r-- | WebCore/rendering/style/SVGRenderStyle.h | 340 | ||||
-rw-r--r-- | WebCore/rendering/style/StyleInheritedData.cpp | 5 | ||||
-rw-r--r-- | WebCore/rendering/style/StyleInheritedData.h | 1 |
9 files changed, 329 insertions, 204 deletions
diff --git a/WebCore/rendering/style/FillLayer.cpp b/WebCore/rendering/style/FillLayer.cpp index ec910c9..597e919 100644 --- a/WebCore/rendering/style/FillLayer.cpp +++ b/WebCore/rendering/style/FillLayer.cpp @@ -270,4 +270,15 @@ bool FillLayer::containsImage(StyleImage* s) const return false; } +bool FillLayer::imagesAreLoaded() const +{ + const FillLayer* curr; + for (curr = this; curr; curr = curr->next()) { + if (curr->m_image && !curr->m_image->isLoaded()) + return false; + } + + return true; +} + } // namespace WebCore diff --git a/WebCore/rendering/style/FillLayer.h b/WebCore/rendering/style/FillLayer.h index 9c615b4..cef6b19 100644 --- a/WebCore/rendering/style/FillLayer.h +++ b/WebCore/rendering/style/FillLayer.h @@ -126,6 +126,7 @@ public: } bool containsImage(StyleImage*) const; + bool imagesAreLoaded() const; bool hasImage() const { diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp index 59d40b4..0952557 100644 --- a/WebCore/rendering/style/RenderStyle.cpp +++ b/WebCore/rendering/style/RenderStyle.cpp @@ -702,7 +702,7 @@ void RenderStyle::addBindingURI(StringImpl* uri) void RenderStyle::setTextShadow(ShadowData* val, bool add) { - ASSERT(!val || !val->spread && val->style == Normal); + ASSERT(!val || (!val->spread && val->style == Normal)); StyleRareInheritedData* rareData = rareInheritedData.access(); if (!add) { diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h index a72b66d..c59d953 100644 --- a/WebCore/rendering/style/RenderStyle.h +++ b/WebCore/rendering/style/RenderStyle.h @@ -89,7 +89,11 @@ #include "BindingURI.h" #endif +#if COMPILER(WINSCW) +#define compareEqual(t, u) ((t) == (u)) +#else template<typename T, typename U> inline bool compareEqual(const T& t, const U& u) { return t == static_cast<T>(u); } +#endif #define SET_VAR(group, variable, value) \ if (!compareEqual(group->variable, value)) \ @@ -179,7 +183,7 @@ protected: unsigned _empty_cells : 1; // EEmptyCell unsigned _caption_side : 2; // ECaptionSide - unsigned _list_style_type : 5 ; // EListStyleType + unsigned _list_style_type : 6; // EListStyleType unsigned _list_style_position : 1; // EListStylePosition unsigned _visibility : 2; // EVisibility unsigned _text_align : 3; // ETextAlign @@ -190,37 +194,38 @@ protected: bool _border_collapse : 1 ; unsigned _white_space : 3; // EWhiteSpace unsigned _box_direction : 1; // EBoxDirection (CSS3 box_direction property, flexible box layout module) - // 32 bits + // 33 bits // non CSS2 inherited bool _visuallyOrdered : 1; bool _htmlHacks : 1; bool _force_backgrounds_to_white : 1; unsigned _pointerEvents : 4; // EPointerEvents - // 39 bits + // 40 bits } inherited_flags; // don't inherit struct NonInheritedFlags { bool operator==(const NonInheritedFlags& other) const { - return (_effectiveDisplay == other._effectiveDisplay) && - (_originalDisplay == other._originalDisplay) && - (_overflowX == other._overflowX) && - (_overflowY == other._overflowY) && - (_vertical_align == other._vertical_align) && - (_clear == other._clear) && - (_position == other._position) && - (_floating == other._floating) && - (_table_layout == other._table_layout) && - (_page_break_before == other._page_break_before) && - (_page_break_after == other._page_break_after) && - (_styleType == other._styleType) && - (_affectedByHover == other._affectedByHover) && - (_affectedByActive == other._affectedByActive) && - (_affectedByDrag == other._affectedByDrag) && - (_pseudoBits == other._pseudoBits) && - (_unicodeBidi == other._unicodeBidi); + return _effectiveDisplay == other._effectiveDisplay + && _originalDisplay == other._originalDisplay + && _overflowX == other._overflowX + && _overflowY == other._overflowY + && _vertical_align == other._vertical_align + && _clear == other._clear + && _position == other._position + && _floating == other._floating + && _table_layout == other._table_layout + && _page_break_before == other._page_break_before + && _page_break_after == other._page_break_after + && _page_break_inside == other._page_break_inside + && _styleType == other._styleType + && _affectedByHover == other._affectedByHover + && _affectedByActive == other._affectedByActive + && _affectedByDrag == other._affectedByDrag + && _pseudoBits == other._pseudoBits + && _unicodeBidi == other._unicodeBidi; } bool operator!=(const NonInheritedFlags& other) const { return !(*this == other); } @@ -237,6 +242,7 @@ protected: unsigned _page_break_before : 2; // EPageBreak unsigned _page_break_after : 2; // EPageBreak + unsigned _page_break_inside : 2; // EPageBreak unsigned _styleType : 5; // PseudoId bool _affectedByHover : 1; @@ -244,7 +250,7 @@ protected: bool _affectedByDrag : 1; unsigned _pseudoBits : 7; unsigned _unicodeBidi : 2; // EUnicodeBidi - // 48 bits + // 50 bits } noninherited_flags; // !END SYNC! @@ -280,6 +286,7 @@ protected: noninherited_flags._table_layout = initialTableLayout(); noninherited_flags._page_break_before = initialPageBreak(); noninherited_flags._page_break_after = initialPageBreak(); + noninherited_flags._page_break_inside = initialPageBreak(); noninherited_flags._styleType = NOPSEUDO; noninherited_flags._affectedByHover = false; noninherited_flags._affectedByActive = false; @@ -460,7 +467,7 @@ public: return font().lineSpacing(); if (lh.isPercent()) - return lh.calcMinValue(fontSize(), true); + return lh.calcMinValue(fontSize()); return lh.value(); } @@ -581,7 +588,7 @@ public: short widows() const { return inherited->widows; } short orphans() const { return inherited->orphans; } - EPageBreak pageBreakInside() const { return static_cast<EPageBreak>(inherited->page_break_inside); } + EPageBreak pageBreakInside() const { return static_cast<EPageBreak>(noninherited_flags._page_break_inside); } EPageBreak pageBreakBefore() const { return static_cast<EPageBreak>(noninherited_flags._page_break_before); } EPageBreak pageBreakAfter() const { return static_cast<EPageBreak>(noninherited_flags._page_break_after); } @@ -921,7 +928,7 @@ public: void setWidows(short w) { SET_VAR(inherited, widows, w); } void setOrphans(short o) { SET_VAR(inherited, orphans, o); } - void setPageBreakInside(EPageBreak b) { SET_VAR(inherited, page_break_inside, b); } + void setPageBreakInside(EPageBreak b) { noninherited_flags._page_break_inside = b; } void setPageBreakBefore(EPageBreak b) { noninherited_flags._page_break_before = b; } void setPageBreakAfter(EPageBreak b) { noninherited_flags._page_break_after = b; } @@ -1114,7 +1121,7 @@ public: static EEmptyCell initialEmptyCells() { return SHOW; } static EFloat initialFloating() { return FNONE; } static EListStylePosition initialListStylePosition() { return OUTSIDE; } - static EListStyleType initialListStyleType() { return DISC; } + static EListStyleType initialListStyleType() { return Disc; } static EOverflow initialOverflowX() { return OVISIBLE; } static EOverflow initialOverflowY() { return OVISIBLE; } static EPageBreak initialPageBreak() { return PBAUTO; } diff --git a/WebCore/rendering/style/RenderStyleConstants.h b/WebCore/rendering/style/RenderStyleConstants.h index 92cd3d5..d2c80ca 100644 --- a/WebCore/rendering/style/RenderStyleConstants.h +++ b/WebCore/rendering/style/RenderStyleConstants.h @@ -73,7 +73,7 @@ enum PseudoId { MEDIA_CONTROLS_SEEK_BACK_BUTTON, MEDIA_CONTROLS_SEEK_FORWARD_BUTTON, MEDIA_CONTROLS_FULLSCREEN_BUTTON, MEDIA_CONTROLS_REWIND_BUTTON, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON, MEDIA_CONTROLS_STATUS_DISPLAY, SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER, - INPUT_LIST_BUTTON, + INPUT_LIST_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON, FIRST_INTERNAL_PSEUDOID = FILE_UPLOAD_BUTTON }; @@ -203,12 +203,63 @@ enum EResize { RESIZE_NONE, RESIZE_BOTH, RESIZE_HORIZONTAL, RESIZE_VERTICAL }; +// The order of this enum must match the order of the list style types in CSSValueKeywords.in. enum EListStyleType { - DISC, CIRCLE, SQUARE, LDECIMAL, DECIMAL_LEADING_ZERO, - LOWER_ROMAN, UPPER_ROMAN, LOWER_GREEK, - LOWER_ALPHA, LOWER_LATIN, UPPER_ALPHA, UPPER_LATIN, - HEBREW, ARMENIAN, GEORGIAN, CJK_IDEOGRAPHIC, - HIRAGANA, KATAKANA, HIRAGANA_IROHA, KATAKANA_IROHA, LNONE + Disc, + Circle, + Square, + DecimalListStyle, + DecimalLeadingZero, + LowerRoman, + UpperRoman, + LowerGreek, + LowerAlpha, + LowerLatin, + UpperAlpha, + UpperLatin, + Afar, + EthiopicHalehameAaEt, + EthiopicHalehameAaEr, + Amharic, + EthiopicHalehameAmEt, + AmharicAbegede, + EthiopicAbegedeAmEt, + CjkEarthlyBranch, + CjkHeavenlyStem, + Ethiopic, + EthiopicHalehameGez, + EthiopicAbegede, + EthiopicAbegedeGez, + HangulConsonant, + Hangul, + LowerNorwegian, + Oromo, + EthiopicHalehameOmEt, + Sidama, + EthiopicHalehameSidEt, + Somali, + EthiopicHalehameSoEt, + Tigre, + EthiopicHalehameTig, + TigrinyaEr, + EthiopicHalehameTiEr, + TigrinyaErAbegede, + EthiopicAbegedeTiEr, + TigrinyaEt, + EthiopicHalehameTiEt, + TigrinyaEtAbegede, + EthiopicAbegedeTiEt, + UpperGreek, + UpperNorwegian, + Hebrew, + Armenian, + Georgian, + CJKIdeographic, + Hiragana, + Katakana, + HiraganaIroha, + KatakanaIroha, + NoneListStyle }; enum StyleContentType { diff --git a/WebCore/rendering/style/SVGRenderStyle.cpp b/WebCore/rendering/style/SVGRenderStyle.cpp index 728738b..7958088 100644 --- a/WebCore/rendering/style/SVGRenderStyle.cpp +++ b/WebCore/rendering/style/SVGRenderStyle.cpp @@ -30,11 +30,14 @@ #include "CSSPrimitiveValue.h" #include "CSSValueList.h" +#include "IntRect.h" #include "NodeRenderStyle.h" #include "RenderObject.h" #include "RenderStyle.h" #include "SVGStyledElement.h" +using namespace std; + namespace WebCore { SVGRenderStyle::SVGRenderStyle() @@ -141,6 +144,56 @@ float SVGRenderStyle::cssPrimitiveToLength(const RenderObject* item, CSSValue* v return primitive->computeLengthFloat(const_cast<RenderStyle*>(item->style()), item->document()->documentElement()->renderStyle()); } + +static void getSVGShadowExtent(ShadowData* shadow, int& top, int& right, int& bottom, int& left) +{ + top = 0; + right = 0; + bottom = 0; + left = 0; + + int blurAndSpread = shadow->blur + shadow->spread; + + top = min(top, shadow->y - blurAndSpread); + right = max(right, shadow->x + blurAndSpread); + bottom = max(bottom, shadow->y + blurAndSpread); + left = min(left, shadow->x - blurAndSpread); +} + +void SVGRenderStyle::inflateForShadow(IntRect& repaintRect) const +{ + ShadowData* svgShadow = shadow(); + if (!svgShadow) + return; + + FloatRect repaintFloatRect = FloatRect(repaintRect); + inflateForShadow(repaintFloatRect); + repaintRect = enclosingIntRect(repaintFloatRect); +} + +void SVGRenderStyle::inflateForShadow(FloatRect& repaintRect) const +{ + ShadowData* svgShadow = shadow(); + if (!svgShadow) + return; + + int shadowTop; + int shadowRight; + int shadowBottom; + int shadowLeft; + getSVGShadowExtent(svgShadow, shadowTop, shadowRight, shadowBottom, shadowLeft); + + int overflowLeft = repaintRect.x() + shadowLeft; + int overflowRight = repaintRect.right() + shadowRight; + int overflowTop = repaintRect.y() + shadowTop; + int overflowBottom = repaintRect.bottom() + shadowBottom; + + repaintRect.setX(overflowLeft); + repaintRect.setY(overflowTop); + repaintRect.setWidth(overflowRight - overflowLeft); + repaintRect.setHeight(overflowBottom - overflowTop); +} + } #endif // ENABLE(SVG) diff --git a/WebCore/rendering/style/SVGRenderStyle.h b/WebCore/rendering/style/SVGRenderStyle.h index c65be97..c7f85db 100644 --- a/WebCore/rendering/style/SVGRenderStyle.h +++ b/WebCore/rendering/style/SVGRenderStyle.h @@ -34,176 +34,182 @@ namespace WebCore { - class RenderObject; - class RenderStyle; - - class SVGRenderStyle : public RefCounted<SVGRenderStyle> { - public: - static PassRefPtr<SVGRenderStyle> create() { return adoptRef(new SVGRenderStyle); } - PassRefPtr<SVGRenderStyle> copy() const { return adoptRef(new SVGRenderStyle(*this));} - ~SVGRenderStyle(); +class FloatRect; +class IntRect; +class RenderObject; +class RenderStyle; + +class SVGRenderStyle : public RefCounted<SVGRenderStyle> { +public: + static PassRefPtr<SVGRenderStyle> create() { return adoptRef(new SVGRenderStyle); } + PassRefPtr<SVGRenderStyle> copy() const { return adoptRef(new SVGRenderStyle(*this));} + ~SVGRenderStyle(); + + bool inheritedNotEqual(const SVGRenderStyle*) const; + void inheritFrom(const SVGRenderStyle*); + + // FIXME: These functions should move to ShadowData. + void inflateForShadow(IntRect&) const; + void inflateForShadow(FloatRect&) const; + + bool operator==(const SVGRenderStyle&) const; + bool operator!=(const SVGRenderStyle& o) const { return !(*this == o); } + + // SVG CSS Properties + SVG_RS_DEFINE_ATTRIBUTE(EAlignmentBaseline, AlignmentBaseline, alignmentBaseline, AB_AUTO) + SVG_RS_DEFINE_ATTRIBUTE(EDominantBaseline, DominantBaseline, dominantBaseline, DB_AUTO) + SVG_RS_DEFINE_ATTRIBUTE(EBaselineShift, BaselineShift, baselineShift, BS_BASELINE) + + SVG_RS_DEFINE_ATTRIBUTE_INHERITED(LineCap, CapStyle, capStyle, ButtCap) + SVG_RS_DEFINE_ATTRIBUTE_INHERITED(WindRule, ClipRule, clipRule, RULE_NONZERO) + SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EColorInterpolation, ColorInterpolation, colorInterpolation, CI_SRGB) + SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EColorInterpolation, ColorInterpolationFilters, colorInterpolationFilters, CI_LINEARRGB) + SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EColorRendering, ColorRendering, colorRendering, CR_AUTO) + SVG_RS_DEFINE_ATTRIBUTE_INHERITED(WindRule, FillRule, fillRule, RULE_NONZERO) + SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EImageRendering, ImageRendering, imageRendering, IR_AUTO) + SVG_RS_DEFINE_ATTRIBUTE_INHERITED(LineJoin, JoinStyle, joinStyle, MiterJoin) + SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EShapeRendering, ShapeRendering, shapeRendering, SR_AUTO) + SVG_RS_DEFINE_ATTRIBUTE_INHERITED(ETextAnchor, TextAnchor, textAnchor, TA_START) + SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EWritingMode, WritingMode, writingMode, WM_LRTB) + SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EGlyphOrientation, GlyphOrientationHorizontal, glyphOrientationHorizontal, GO_0DEG) + SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EGlyphOrientation, GlyphOrientationVertical, glyphOrientationVertical, GO_AUTO) + + // SVG CSS Properties (using DataRef's) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, fill, opacity, FillOpacity, fillOpacity, 1.0f) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(SVGPaint, fill, paint, FillPaint, fillPaint, SVGPaint::defaultFill()) + + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, stroke, opacity, StrokeOpacity, strokeOpacity, 1.0f) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(SVGPaint, stroke, paint, StrokePaint, strokePaint, SVGPaint::defaultStroke()) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValueList, stroke, dashArray, StrokeDashArray, strokeDashArray, 0) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, stroke, miterLimit, StrokeMiterLimit, strokeMiterLimit, 4.0f) + + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, stroke, width, StrokeWidth, strokeWidth, 0) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, stroke, dashOffset, StrokeDashOffset, strokeDashOffset, 0); + + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, text, kerning, Kerning, kerning, 0) + + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, stops, opacity, StopOpacity, stopOpacity, 1.0f) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, stops, color, StopColor, stopColor, Color(0, 0, 0)) + + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, clip, clipPath, ClipPath, clipPath, String()) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, mask, maskElement, MaskElement, maskElement, String()) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, markers, startMarker, StartMarker, startMarker, String()) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, markers, midMarker, MidMarker, midMarker, String()) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, markers, endMarker, EndMarker, endMarker, String()) + + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, misc, filter, Filter, filter, String()) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, misc, floodOpacity, FloodOpacity, floodOpacity, 1.0f) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, misc, floodColor, FloodColor, floodColor, Color(0, 0, 0)) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, misc, lightingColor, LightingColor, lightingColor, Color(255, 255, 255)) + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, misc, baselineShiftValue, BaselineShiftValue, baselineShiftValue, 0) + + SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_OWNPTR(ShadowData, shadowSVG, shadow, Shadow, shadow, 0) + + // convenience + 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 { + bool operator==(const InheritedFlags& other) const + { + return (_colorRendering == other._colorRendering) + && (_imageRendering == other._imageRendering) + && (_shapeRendering == other._shapeRendering) + && (_clipRule == other._clipRule) + && (_fillRule == other._fillRule) + && (_capStyle == other._capStyle) + && (_joinStyle == other._joinStyle) + && (_textAnchor == other._textAnchor) + && (_colorInterpolation == other._colorInterpolation) + && (_colorInterpolationFilters == other._colorInterpolationFilters) + && (_writingMode == other._writingMode) + && (_glyphOrientationHorizontal == other._glyphOrientationHorizontal) + && (_glyphOrientationVertical == other._glyphOrientationVertical); + } - bool inheritedNotEqual(const SVGRenderStyle*) const; - void inheritFrom(const SVGRenderStyle*); - - bool operator==(const SVGRenderStyle&) const; - bool operator!=(const SVGRenderStyle& o) const { return !(*this == o); } - - // SVG CSS Properties - SVG_RS_DEFINE_ATTRIBUTE(EAlignmentBaseline, AlignmentBaseline, alignmentBaseline, AB_AUTO) - SVG_RS_DEFINE_ATTRIBUTE(EDominantBaseline, DominantBaseline, dominantBaseline, DB_AUTO) - SVG_RS_DEFINE_ATTRIBUTE(EBaselineShift, BaselineShift, baselineShift, BS_BASELINE) - - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(LineCap, CapStyle, capStyle, ButtCap) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(WindRule, ClipRule, clipRule, RULE_NONZERO) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EColorInterpolation, ColorInterpolation, colorInterpolation, CI_SRGB) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EColorInterpolation, ColorInterpolationFilters, colorInterpolationFilters, CI_LINEARRGB) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EColorRendering, ColorRendering, colorRendering, CR_AUTO) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(WindRule, FillRule, fillRule, RULE_NONZERO) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EImageRendering, ImageRendering, imageRendering, IR_AUTO) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(LineJoin, JoinStyle, joinStyle, MiterJoin) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EShapeRendering, ShapeRendering, shapeRendering, SR_AUTO) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(ETextAnchor, TextAnchor, textAnchor, TA_START) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EWritingMode, WritingMode, writingMode, WM_LRTB) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EGlyphOrientation, GlyphOrientationHorizontal, glyphOrientationHorizontal, GO_0DEG) - SVG_RS_DEFINE_ATTRIBUTE_INHERITED(EGlyphOrientation, GlyphOrientationVertical, glyphOrientationVertical, GO_AUTO) - - // SVG CSS Properties (using DataRef's) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, fill, opacity, FillOpacity, fillOpacity, 1.0f) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(SVGPaint, fill, paint, FillPaint, fillPaint, SVGPaint::defaultFill()) - - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, stroke, opacity, StrokeOpacity, strokeOpacity, 1.0f) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(SVGPaint, stroke, paint, StrokePaint, strokePaint, SVGPaint::defaultStroke()) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValueList, stroke, dashArray, StrokeDashArray, strokeDashArray, 0) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, stroke, miterLimit, StrokeMiterLimit, strokeMiterLimit, 4.0f) - - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, stroke, width, StrokeWidth, strokeWidth, 0) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, stroke, dashOffset, StrokeDashOffset, strokeDashOffset, 0); - - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, text, kerning, Kerning, kerning, 0) - - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, stops, opacity, StopOpacity, stopOpacity, 1.0f) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, stops, color, StopColor, stopColor, Color(0, 0, 0)) - - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, clip, clipPath, ClipPath, clipPath, String()) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, mask, maskElement, MaskElement, maskElement, String()) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, markers, startMarker, StartMarker, startMarker, String()) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, markers, midMarker, MidMarker, midMarker, String()) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, markers, endMarker, EndMarker, endMarker, String()) - - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(String, misc, filter, Filter, filter, String()) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(float, misc, floodOpacity, FloodOpacity, floodOpacity, 1.0f) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, misc, floodColor, FloodColor, floodColor, Color(0, 0, 0)) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL(Color, misc, lightingColor, LightingColor, lightingColor, Color(255, 255, 255)) - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_REFCOUNTED(CSSValue, misc, baselineShiftValue, BaselineShiftValue, baselineShiftValue, 0) - - SVG_RS_DEFINE_ATTRIBUTE_DATAREF_WITH_INITIAL_OWNPTR(ShadowData, shadowSVG, shadow, Shadow, shadow, 0) - - // convenience - 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 { - bool operator==(const InheritedFlags& other) const - { - return (_colorRendering == other._colorRendering) && - (_imageRendering == other._imageRendering) && - (_shapeRendering == other._shapeRendering) && - (_clipRule == other._clipRule) && - (_fillRule == other._fillRule) && - (_capStyle == other._capStyle) && - (_joinStyle == other._joinStyle) && - (_textAnchor == other._textAnchor) && - (_colorInterpolation == other._colorInterpolation) && - (_colorInterpolationFilters == other._colorInterpolationFilters) && - (_writingMode == other._writingMode) && - (_glyphOrientationHorizontal == other._glyphOrientationHorizontal) && - (_glyphOrientationVertical == other._glyphOrientationVertical); - } - - bool operator!=(const InheritedFlags& other) const - { - return !(*this == other); - } - - unsigned _colorRendering : 2; // EColorRendering - unsigned _imageRendering : 2; // EImageRendering - unsigned _shapeRendering : 2; // EShapeRendering - unsigned _clipRule : 1; // WindRule - unsigned _fillRule : 1; // WindRule - unsigned _capStyle : 2; // LineCap - unsigned _joinStyle : 2; // LineJoin - unsigned _textAnchor : 2; // ETextAnchor - unsigned _colorInterpolation : 2; // EColorInterpolation - unsigned _colorInterpolationFilters : 2; // EColorInterpolation - unsigned _writingMode : 3; // EWritingMode - unsigned _glyphOrientationHorizontal : 3; // EGlyphOrientation - unsigned _glyphOrientationVertical : 3; // EGlyphOrientation - } svg_inherited_flags; - - // don't inherit - struct NonInheritedFlags { - // 32 bit non-inherited, don't add to the struct, or the operator will break. - bool operator==(const NonInheritedFlags &other) const { return _niflags == other._niflags; } - bool operator!=(const NonInheritedFlags &other) const { return _niflags != other._niflags; } - - union { - struct { - unsigned _alignmentBaseline : 4; // EAlignmentBaseline - unsigned _dominantBaseline : 4; // EDominantBaseline - unsigned _baselineShift : 2; // EBaselineShift - // 22 bits unused - } f; - uint32_t _niflags; - }; - } svg_noninherited_flags; - - // inherited attributes - DataRef<StyleFillData> fill; - DataRef<StyleStrokeData> stroke; - DataRef<StyleMarkerData> markers; - DataRef<StyleTextData> text; - - // non-inherited attributes - DataRef<StyleStopData> stops; - DataRef<StyleClipData> clip; - DataRef<StyleMaskData> mask; - DataRef<StyleMiscData> misc; - DataRef<StyleShadowSVGData> shadowSVG; - - private: - enum CreateDefaultType { CreateDefault }; - - SVGRenderStyle(); - SVGRenderStyle(const SVGRenderStyle&); - SVGRenderStyle(CreateDefaultType); // Used to create the default style. - - void setBitDefaults() + bool operator!=(const InheritedFlags& other) const { - svg_inherited_flags._clipRule = initialClipRule(); - svg_inherited_flags._colorRendering = initialColorRendering(); - svg_inherited_flags._fillRule = initialFillRule(); - svg_inherited_flags._imageRendering = initialImageRendering(); - svg_inherited_flags._shapeRendering = initialShapeRendering(); - svg_inherited_flags._textAnchor = initialTextAnchor(); - svg_inherited_flags._capStyle = initialCapStyle(); - svg_inherited_flags._joinStyle = initialJoinStyle(); - svg_inherited_flags._colorInterpolation = initialColorInterpolation(); - svg_inherited_flags._colorInterpolationFilters = initialColorInterpolationFilters(); - svg_inherited_flags._writingMode = initialWritingMode(); - svg_inherited_flags._glyphOrientationHorizontal = initialGlyphOrientationHorizontal(); - svg_inherited_flags._glyphOrientationVertical = initialGlyphOrientationVertical(); - - svg_noninherited_flags._niflags = 0; - svg_noninherited_flags.f._alignmentBaseline = initialAlignmentBaseline(); - svg_noninherited_flags.f._dominantBaseline = initialDominantBaseline(); - svg_noninherited_flags.f._baselineShift = initialBaselineShift(); + return !(*this == other); } - }; + + unsigned _colorRendering : 2; // EColorRendering + unsigned _imageRendering : 2; // EImageRendering + unsigned _shapeRendering : 2; // EShapeRendering + unsigned _clipRule : 1; // WindRule + unsigned _fillRule : 1; // WindRule + unsigned _capStyle : 2; // LineCap + unsigned _joinStyle : 2; // LineJoin + unsigned _textAnchor : 2; // ETextAnchor + unsigned _colorInterpolation : 2; // EColorInterpolation + unsigned _colorInterpolationFilters : 2; // EColorInterpolation + unsigned _writingMode : 3; // EWritingMode + unsigned _glyphOrientationHorizontal : 3; // EGlyphOrientation + unsigned _glyphOrientationVertical : 3; // EGlyphOrientation + } svg_inherited_flags; + + // don't inherit + struct NonInheritedFlags { + // 32 bit non-inherited, don't add to the struct, or the operator will break. + bool operator==(const NonInheritedFlags &other) const { return _niflags == other._niflags; } + bool operator!=(const NonInheritedFlags &other) const { return _niflags != other._niflags; } + + union { + struct { + unsigned _alignmentBaseline : 4; // EAlignmentBaseline + unsigned _dominantBaseline : 4; // EDominantBaseline + unsigned _baselineShift : 2; // EBaselineShift + // 22 bits unused + } f; + uint32_t _niflags; + }; + } svg_noninherited_flags; + + // inherited attributes + DataRef<StyleFillData> fill; + DataRef<StyleStrokeData> stroke; + DataRef<StyleMarkerData> markers; + DataRef<StyleTextData> text; + + // non-inherited attributes + DataRef<StyleStopData> stops; + DataRef<StyleClipData> clip; + DataRef<StyleMaskData> mask; + DataRef<StyleMiscData> misc; + DataRef<StyleShadowSVGData> shadowSVG; + +private: + enum CreateDefaultType { CreateDefault }; + + SVGRenderStyle(); + SVGRenderStyle(const SVGRenderStyle&); + SVGRenderStyle(CreateDefaultType); // Used to create the default style. + + void setBitDefaults() + { + svg_inherited_flags._clipRule = initialClipRule(); + svg_inherited_flags._colorRendering = initialColorRendering(); + svg_inherited_flags._fillRule = initialFillRule(); + svg_inherited_flags._imageRendering = initialImageRendering(); + svg_inherited_flags._shapeRendering = initialShapeRendering(); + svg_inherited_flags._textAnchor = initialTextAnchor(); + svg_inherited_flags._capStyle = initialCapStyle(); + svg_inherited_flags._joinStyle = initialJoinStyle(); + svg_inherited_flags._colorInterpolation = initialColorInterpolation(); + svg_inherited_flags._colorInterpolationFilters = initialColorInterpolationFilters(); + svg_inherited_flags._writingMode = initialWritingMode(); + svg_inherited_flags._glyphOrientationHorizontal = initialGlyphOrientationHorizontal(); + svg_inherited_flags._glyphOrientationVertical = initialGlyphOrientationVertical(); + + svg_noninherited_flags._niflags = 0; + svg_noninherited_flags.f._alignmentBaseline = initialAlignmentBaseline(); + svg_noninherited_flags.f._dominantBaseline = initialDominantBaseline(); + svg_noninherited_flags.f._baselineShift = initialBaselineShift(); + } +}; } // namespace WebCore diff --git a/WebCore/rendering/style/StyleInheritedData.cpp b/WebCore/rendering/style/StyleInheritedData.cpp index f59c0c2..c73497f 100644 --- a/WebCore/rendering/style/StyleInheritedData.cpp +++ b/WebCore/rendering/style/StyleInheritedData.cpp @@ -37,7 +37,6 @@ StyleInheritedData::StyleInheritedData() , vertical_border_spacing(RenderStyle::initialVerticalBorderSpacing()) , widows(RenderStyle::initialWidows()) , orphans(RenderStyle::initialOrphans()) - , page_break_inside(RenderStyle::initialPageBreak()) { } @@ -58,7 +57,6 @@ StyleInheritedData::StyleInheritedData(const StyleInheritedData& o) , vertical_border_spacing(o.vertical_border_spacing) , widows(o.widows) , orphans(o.orphans) - , page_break_inside(o.page_break_inside) { } @@ -84,8 +82,7 @@ bool StyleInheritedData::operator==(const StyleInheritedData& o) const horizontal_border_spacing == o.horizontal_border_spacing && vertical_border_spacing == o.vertical_border_spacing && widows == o.widows && - orphans == o.orphans && - page_break_inside == o.page_break_inside; + orphans == o.orphans; } } // namespace WebCore diff --git a/WebCore/rendering/style/StyleInheritedData.h b/WebCore/rendering/style/StyleInheritedData.h index 548ca72..3b30b8f 100644 --- a/WebCore/rendering/style/StyleInheritedData.h +++ b/WebCore/rendering/style/StyleInheritedData.h @@ -68,7 +68,6 @@ public: // Paged media properties. short widows; short orphans; - unsigned page_break_inside : 2; // EPageBreak private: StyleInheritedData(); |