diff options
Diffstat (limited to 'WebCore/rendering/style')
-rw-r--r-- | WebCore/rendering/style/RenderStyle.cpp | 38 | ||||
-rw-r--r-- | WebCore/rendering/style/RenderStyle.h | 49 | ||||
-rw-r--r-- | WebCore/rendering/style/StyleMultiColData.cpp | 10 | ||||
-rw-r--r-- | WebCore/rendering/style/StyleMultiColData.h | 3 |
4 files changed, 57 insertions, 43 deletions
diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp index 7ef580f..220e657 100644 --- a/WebCore/rendering/style/RenderStyle.cpp +++ b/WebCore/rendering/style/RenderStyle.cpp @@ -995,42 +995,42 @@ static EBorderStyle borderStyleForColorProperty(const RenderStyle* style, int co return borderStyle; } -static Color colorIncludingFallback(const RenderStyle* style, int colorProperty, EBorderStyle borderStyle) +const Color RenderStyle::colorIncludingFallback(int colorProperty, EBorderStyle borderStyle) const { Color result; switch (colorProperty) { case CSSPropertyBackgroundColor: - return style->backgroundColor(); // Background color doesn't fall back. + return backgroundColor(); // Background color doesn't fall back. case CSSPropertyBorderLeftColor: - result = style->borderLeftColor(); - borderStyle = style->borderLeftStyle(); + result = borderLeftColor(); + borderStyle = borderLeftStyle(); break; case CSSPropertyBorderRightColor: - result = style->borderRightColor(); - borderStyle = style->borderRightStyle(); + result = borderRightColor(); + borderStyle = borderRightStyle(); break; case CSSPropertyBorderTopColor: - result = style->borderTopColor(); - borderStyle = style->borderTopStyle(); + result = borderTopColor(); + borderStyle = borderTopStyle(); break; case CSSPropertyBorderBottomColor: - result = style->borderBottomColor(); - borderStyle = style->borderBottomStyle(); + result = borderBottomColor(); + borderStyle = borderBottomStyle(); break; case CSSPropertyColor: - result = style->color(); + result = color(); break; case CSSPropertyOutlineColor: - result = style->outlineColor(); + result = outlineColor(); break; case CSSPropertyWebkitColumnRuleColor: - result = style->columnRuleColor(); + result = columnRuleColor(); break; case CSSPropertyWebkitTextFillColor: - result = style->textFillColor(); + result = textFillColor(); break; case CSSPropertyWebkitTextStrokeColor: - result = style->textStrokeColor(); + result = textStrokeColor(); break; default: ASSERT_NOT_REACHED(); @@ -1043,23 +1043,23 @@ static Color colorIncludingFallback(const RenderStyle* style, int colorProperty, && (borderStyle == INSET || borderStyle == OUTSET || borderStyle == RIDGE || borderStyle == GROOVE)) result.setRGB(238, 238, 238); else - result = style->color(); + result = color(); } return result; } -Color RenderStyle::visitedDependentColor(int colorProperty) const +const Color RenderStyle::visitedDependentColor(int colorProperty) const { EBorderStyle borderStyle = borderStyleForColorProperty(this, colorProperty); - Color unvisitedColor = colorIncludingFallback(this, colorProperty, borderStyle); + Color unvisitedColor = colorIncludingFallback(colorProperty, borderStyle); if (insideLink() != InsideVisitedLink) return unvisitedColor; RenderStyle* visitedStyle = getCachedPseudoStyle(VISITED_LINK); if (!visitedStyle) return unvisitedColor; - Color visitedColor = colorIncludingFallback(visitedStyle, colorProperty, borderStyle); + Color visitedColor = visitedStyle->colorIncludingFallback(colorProperty, borderStyle); // Take the alpha from the unvisited color, but get the RGB values from the visited color. return Color(visitedColor.red(), visitedColor.green(), visitedColor.blue(), unvisitedColor.alpha()); diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h index 970b26a..e8f4d2f 100644 --- a/WebCore/rendering/style/RenderStyle.h +++ b/WebCore/rendering/style/RenderStyle.h @@ -32,6 +32,7 @@ #include "CSSHelper.h" #include "CSSImageGeneratorValue.h" #include "CSSPrimitiveValue.h" +#include "CSSPropertyNames.h" #include "CSSReflectionDirection.h" #include "CSSValueList.h" #include "CachedImage.h" @@ -113,7 +114,13 @@ class StyleImage; typedef Vector<RefPtr<RenderStyle>, 4> PseudoStyleCache; class RenderStyle: public RefCounted<RenderStyle> { - friend class CSSStyleSelector; + friend class AnimationBase; // Used by CSS animations. We can't allow them to animate based off visited colors. + friend class ApplyStyleCommand; // Editing has to only reveal unvisited info. + friend class CSSStyleSelector; // Sets members directly. + friend class CSSComputedStyleDeclaration; // Ignores visited styles, so needs to be able to see unvisited info. + friend class PropertyWrapperMaybeInvalidColor; // Used by CSS animations. We can't allow them to animate based off visited colors. + friend class RenderSVGResource; // FIXME: Needs to alter the visited state by hand. Should clean the SVG code up and move it into RenderStyle perhaps. + friend class RenderTreeAsText; // FIXME: Only needed so the render tree can keep lying and dump the wrong colors. Rebaselining would allow this to be yanked. protected: // The following bitfield is 32-bits long, which optimizes padding with the @@ -341,12 +348,6 @@ public: bool hasPadding() const { return surround->padding.nonZero(); } bool hasOffset() const { return surround->offset.nonZero(); } - bool hasBackground() const - { - if (backgroundColor().isValid() && backgroundColor().alpha() > 0) - return true; - return m_background->background().hasImage(); - } bool hasBackgroundImage() const { return m_background->background().hasImage(); } bool hasFixedBackgroundImage() const { return m_background->background().hasFixedImage(); } bool hasAppearance() const { return appearance() != NoControlPart; } @@ -401,19 +402,15 @@ public: unsigned short borderLeftWidth() const { return surround->border.borderLeftWidth(); } EBorderStyle borderLeftStyle() const { return surround->border.left().style(); } - const Color& borderLeftColor() const { return surround->border.left().color(); } bool borderLeftIsTransparent() const { return surround->border.left().isTransparent(); } unsigned short borderRightWidth() const { return surround->border.borderRightWidth(); } EBorderStyle borderRightStyle() const { return surround->border.right().style(); } - const Color& borderRightColor() const { return surround->border.right().color(); } bool borderRightIsTransparent() const { return surround->border.right().isTransparent(); } unsigned short borderTopWidth() const { return surround->border.borderTopWidth(); } EBorderStyle borderTopStyle() const { return surround->border.top().style(); } - const Color& borderTopColor() const { return surround->border.top().color(); } bool borderTopIsTransparent() const { return surround->border.top().isTransparent(); } unsigned short borderBottomWidth() const { return surround->border.borderBottomWidth(); } EBorderStyle borderBottomStyle() const { return surround->border.bottom().style(); } - const Color& borderBottomColor() const { return surround->border.bottom().color(); } bool borderBottomIsTransparent() const { return surround->border.bottom().isTransparent(); } unsigned short outlineSize() const { return max(0, outlineWidth() + outlineOffset()); } @@ -426,8 +423,7 @@ public: bool hasOutline() const { return outlineWidth() > 0 && outlineStyle() > BHIDDEN; } EBorderStyle outlineStyle() const { return m_background->outline().style(); } bool outlineStyleIsAuto() const { return m_background->outline().isAuto(); } - const Color& outlineColor() const { return m_background->outline().color(); } - + EOverflow overflowX() const { return static_cast<EOverflow>(noninherited_flags._overflowX); } EOverflow overflowY() const { return static_cast<EOverflow>(noninherited_flags._overflowY); } @@ -451,7 +447,6 @@ public: const FontDescription& fontDescription() const { return inherited->font.fontDescription(); } int fontSize() const { return inherited->font.pixelSize(); } - const Color& color() const { return inherited->color; } Length textIndent() const { return rareInheritedData->indent; } ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flags._text_align); } ETextTransform textTransform() const { return static_cast<ETextTransform>(inherited_flags._text_transform); } @@ -535,7 +530,6 @@ public: return wordBreak() == BreakWordBreak || wordWrap() == BreakWordWrap; } - const Color& backgroundColor() const { return m_background->color(); } StyleImage* backgroundImage() const { return m_background->background().image(); } EFillRepeat backgroundRepeatX() const { return static_cast<EFillRepeat>(m_background->background().repeatX()); } EFillRepeat backgroundRepeatY() const { return static_cast<EFillRepeat>(m_background->background().repeatY()); } @@ -616,9 +610,7 @@ public: } const ShadowData* textShadow() const { return rareInheritedData->textShadow; } - const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; } float textStrokeWidth() const { return rareInheritedData->textStrokeWidth; } - const Color& textFillColor() const { return rareInheritedData->textFillColor; } ColorSpace colorSpace() const { return static_cast<ColorSpace>(rareInheritedData->colorSpace); } float opacity() const { return rareNonInheritedData->opacity; } ControlPart appearance() const { return static_cast<ControlPart>(rareNonInheritedData->m_appearance); } @@ -664,10 +656,10 @@ public: bool specifiesColumns() const { return !hasAutoColumnCount() || !hasAutoColumnWidth(); } float columnGap() const { return rareNonInheritedData->m_multiCol->m_gap; } bool hasNormalColumnGap() const { return rareNonInheritedData->m_multiCol->m_normalGap; } - const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); } EBorderStyle columnRuleStyle() const { return rareNonInheritedData->m_multiCol->m_rule.style(); } unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); } bool columnRuleIsTransparent() const { return rareNonInheritedData->m_multiCol->m_rule.isTransparent(); } + bool columnSpan() const { return rareNonInheritedData->m_multiCol->m_columnSpan; } EPageBreak columnBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakBefore); } EPageBreak columnBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakInside); } EPageBreak columnBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakAfter); } @@ -1002,6 +994,7 @@ public: void setColumnRuleStyle(EBorderStyle b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_style, b); } void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_width, w); } void resetColumnRule() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule, BorderValue()) } + void setColumnSpan(bool b) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_columnSpan, b); } void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakBefore, p); } void setColumnBreakInside(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); } void setColumnBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakAfter, p); } @@ -1120,7 +1113,7 @@ public: unsigned childIndex() const { return m_childIndex; } void setChildIndex(unsigned index) { m_childIndex = index; } - Color visitedDependentColor(int colorProperty) const; + const Color visitedDependentColor(int colorProperty) const; // Initial values for all the properties static bool initialBorderCollapse() { return false; } @@ -1200,6 +1193,7 @@ public: static bool initialVisuallyOrdered() { return false; } static float initialTextStrokeWidth() { return 0; } static unsigned short initialColumnCount() { return 1; } + static bool initialColumnSpan() { return false; } static const TransformOperations& initialTransform() { DEFINE_STATIC_LOCAL(TransformOperations, ops, ()); return ops; } static Length initialTransformOriginX() { return Length(50.0, Percent); } static Length initialTransformOriginY() { return Length(50.0, Percent); } @@ -1221,9 +1215,26 @@ public: static const Vector<StyleDashboardRegion>& noneDashboardRegions(); #endif +<<<<<<< HEAD #ifdef ANDROID_CSS_TAP_HIGHLIGHT_COLOR static Color initialTapHighlightColor() { return Color::tap; } #endif +======= +private: + // Color accessors are all private to make sure callers use visitedDependentColor instead to access them. + const Color& borderLeftColor() const { return surround->border.left().color(); } + const Color& borderRightColor() const { return surround->border.right().color(); } + const Color& borderTopColor() const { return surround->border.top().color(); } + const Color& borderBottomColor() const { return surround->border.bottom().color(); } + const Color& backgroundColor() const { return m_background->color(); } + const Color& color() const { return inherited->color; } + const Color& columnRuleColor() const { return rareNonInheritedData->m_multiCol->m_rule.color(); } + const Color& outlineColor() const { return m_background->outline().color(); } + const Color& textFillColor() const { return rareInheritedData->textFillColor; } + const Color& textStrokeColor() const { return rareInheritedData->textStrokeColor; } + + const Color colorIncludingFallback(int colorProperty, EBorderStyle borderStyle) const; +>>>>>>> webkit.org at r60074 }; } // namespace WebCore diff --git a/WebCore/rendering/style/StyleMultiColData.cpp b/WebCore/rendering/style/StyleMultiColData.cpp index bff4fb3..3366e9f 100644 --- a/WebCore/rendering/style/StyleMultiColData.cpp +++ b/WebCore/rendering/style/StyleMultiColData.cpp @@ -33,6 +33,7 @@ StyleMultiColData::StyleMultiColData() , m_autoWidth(true) , m_autoCount(true) , m_normalGap(true) + , m_columnSpan(false) , m_breakBefore(RenderStyle::initialPageBreak()) , m_breakAfter(RenderStyle::initialPageBreak()) , m_breakInside(RenderStyle::initialPageBreak()) @@ -48,6 +49,7 @@ StyleMultiColData::StyleMultiColData(const StyleMultiColData& o) , m_autoWidth(o.m_autoWidth) , m_autoCount(o.m_autoCount) , m_normalGap(o.m_normalGap) + , m_columnSpan(o.m_columnSpan) , m_breakBefore(o.m_breakBefore) , m_breakAfter(o.m_breakAfter) , m_breakInside(o.m_breakInside) @@ -56,10 +58,10 @@ StyleMultiColData::StyleMultiColData(const StyleMultiColData& o) bool StyleMultiColData::operator==(const StyleMultiColData& o) const { - return m_width == o.m_width && m_count == o.m_count && m_gap == o.m_gap && - m_rule == o.m_rule && m_breakBefore == o.m_breakBefore && - m_autoWidth == o.m_autoWidth && m_autoCount == o.m_autoCount && m_normalGap == o.m_normalGap && - m_breakAfter == o.m_breakAfter && m_breakInside == o.m_breakInside; + return m_width == o.m_width && m_count == o.m_count && m_gap == o.m_gap + && m_rule == o.m_rule && m_breakBefore == o.m_breakBefore + && m_autoWidth == o.m_autoWidth && m_autoCount == o.m_autoCount && m_normalGap == o.m_normalGap + && m_columnSpan == o.m_columnSpan && m_breakAfter == o.m_breakAfter && m_breakInside == o.m_breakInside; } } // namespace WebCore diff --git a/WebCore/rendering/style/StyleMultiColData.h b/WebCore/rendering/style/StyleMultiColData.h index d3fe720..9948846 100644 --- a/WebCore/rendering/style/StyleMultiColData.h +++ b/WebCore/rendering/style/StyleMultiColData.h @@ -57,10 +57,11 @@ public: unsigned short m_count; float m_gap; BorderValue m_rule; - + bool m_autoWidth : 1; bool m_autoCount : 1; bool m_normalGap : 1; + bool m_columnSpan : 1; unsigned m_breakBefore : 2; // EPageBreak unsigned m_breakAfter : 2; // EPageBreak unsigned m_breakInside : 2; // EPageBreak |