mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-22 02:09:28 +00:00
Bug 1299741 part 11 - Change text-{emphasis,fill,stroke}-color to using StyleComplexColor. r=dbaron
MozReview-Commit-ID: 1MlgGAkdPn8 --HG-- extra : rebase_source : 293aa61adaa091bb3d4350a4b86ec9cfbb40eb02
This commit is contained in:
parent
addef001bc
commit
6b6e2ad7b2
@ -214,8 +214,8 @@ void
|
||||
nsDisplayTextOverflowMarker::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsRenderingContext* aCtx)
|
||||
{
|
||||
nsCSSPropertyID colorProp = mFrame->StyleContext()->GetTextFillColorProp();
|
||||
nscolor foregroundColor = nsLayoutUtils::GetColor(mFrame, colorProp);
|
||||
nscolor foregroundColor = nsLayoutUtils::
|
||||
GetColor(mFrame, eCSSProperty__webkit_text_fill_color);
|
||||
|
||||
// Paint the text-shadows for the overflow marker
|
||||
nsLayoutUtils::PaintTextShadow(mFrame, aCtx, mRect, mVisibleRect,
|
||||
|
@ -332,7 +332,8 @@ public:
|
||||
if (mFrame->IsSVGText()) {
|
||||
return 0;
|
||||
}
|
||||
return mFrame->StyleContext()->GetTextStrokeColor();
|
||||
return mFrame->StyleColor()->
|
||||
CalcComplexColor(mFrame->StyleText()->mWebkitTextStrokeColor);
|
||||
}
|
||||
float GetWebkitTextStrokeWidth() {
|
||||
if (mFrame->IsSVGText()) {
|
||||
@ -3707,8 +3708,7 @@ nsTextPaintStyle::GetTextColor()
|
||||
}
|
||||
}
|
||||
|
||||
return nsLayoutUtils::GetColor(mFrame,
|
||||
mFrame->StyleContext()->GetTextFillColorProp());
|
||||
return nsLayoutUtils::GetColor(mFrame, eCSSProperty__webkit_text_fill_color);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -3901,7 +3901,8 @@ nsTextPaintStyle::InitSelectionColorsAndShadow()
|
||||
if (sc) {
|
||||
mSelectionBGColor =
|
||||
sc->GetVisitedDependentColor(eCSSProperty_background_color);
|
||||
mSelectionTextColor = sc->GetVisitedDependentColor(sc->GetTextFillColorProp());
|
||||
mSelectionTextColor =
|
||||
sc->GetVisitedDependentColor(eCSSProperty__webkit_text_fill_color);
|
||||
mHasSelectionShadow =
|
||||
nsRuleNode::HasAuthorSpecifiedRules(sc,
|
||||
NS_AUTHOR_SPECIFIED_TEXT_SHADOW,
|
||||
@ -3939,13 +3940,13 @@ nsTextPaintStyle::InitSelectionColorsAndShadow()
|
||||
if (mSelectionTextColor == NS_DONT_CHANGE_COLOR) {
|
||||
nsCSSPropertyID property = mFrame->IsSVGText()
|
||||
? eCSSProperty_fill
|
||||
: mFrame->StyleContext()->GetTextFillColorProp();
|
||||
: eCSSProperty__webkit_text_fill_color;
|
||||
nscoord frameColor = mFrame->GetVisitedDependentColor(property);
|
||||
mSelectionTextColor = EnsureDifferentColors(frameColor, mSelectionBGColor);
|
||||
} else if (mSelectionTextColor == NS_CHANGE_COLOR_IF_SAME_AS_BG) {
|
||||
nsCSSPropertyID property = mFrame->IsSVGText()
|
||||
? eCSSProperty_fill
|
||||
: mFrame->StyleContext()->GetTextFillColorProp();
|
||||
: eCSSProperty__webkit_text_fill_color;
|
||||
nscolor frameColor = mFrame->GetVisitedDependentColor(property);
|
||||
if (frameColor == mSelectionBGColor) {
|
||||
mSelectionTextColor =
|
||||
@ -4952,9 +4953,11 @@ nsTextFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
|
||||
DO_GLOBAL_REFLOW_COUNT_DSP("nsTextFrame");
|
||||
|
||||
nsStyleContext* sc = StyleContext();
|
||||
bool isTextTransparent = (NS_GET_A(sc->GetTextFillColor()) == 0) &&
|
||||
(NS_GET_A(sc->GetTextStrokeColor()) == 0);
|
||||
const nsStyleColor* sc = StyleColor();
|
||||
const nsStyleText* st = StyleText();
|
||||
bool isTextTransparent =
|
||||
NS_GET_A(sc->CalcComplexColor(st->mWebkitTextFillColor)) == 0 &&
|
||||
NS_GET_A(sc->CalcComplexColor(st->mWebkitTextStrokeColor)) == 0;
|
||||
Maybe<bool> isSelected;
|
||||
if (((GetStateBits() & TEXT_NO_RENDERED_GLYPHS) ||
|
||||
(isTextTransparent && !StyleText()->HasTextShadow())) &&
|
||||
|
@ -2124,8 +2124,8 @@ nsMathMLChar::PaintForeground(nsPresContext* aPresContext,
|
||||
RefPtr<gfxContext> thebesContext = aRenderingContext.ThebesContext();
|
||||
|
||||
// Set color ...
|
||||
nsCSSPropertyID colorProp = styleContext->GetTextFillColorProp();
|
||||
nscolor fgColor = styleContext->GetVisitedDependentColor(colorProp);
|
||||
nscolor fgColor = styleContext->
|
||||
GetVisitedDependentColor(eCSSProperty__webkit_text_fill_color);
|
||||
if (aIsSelected) {
|
||||
// get color to use for selection from the look&feel object
|
||||
fgColor = LookAndFeel::GetColor(LookAndFeel::eColorID_TextSelectForeground,
|
||||
|
@ -365,9 +365,8 @@ void nsDisplayMathMLBar::Paint(nsDisplayListBuilder* aBuilder,
|
||||
NSRectToNonEmptySnappedRect(mRect + ToReferenceFrame(),
|
||||
mFrame->PresContext()->AppUnitsPerDevPixel(),
|
||||
*drawTarget);
|
||||
nsCSSPropertyID colorProp = mFrame->StyleContext()->GetTextFillColorProp();
|
||||
ColorPattern color(ToDeviceColor(
|
||||
mFrame->GetVisitedDependentColor(colorProp)));
|
||||
mFrame->GetVisitedDependentColor(eCSSProperty__webkit_text_fill_color)));
|
||||
drawTarget->FillRect(rect, color);
|
||||
}
|
||||
|
||||
|
@ -779,9 +779,8 @@ void nsDisplayNotation::Paint(nsDisplayListBuilder* aBuilder,
|
||||
presContext->AppUnitsPerDevPixel());
|
||||
rect.Deflate(strokeWidth / 2.f);
|
||||
|
||||
nsCSSPropertyID colorProp = mFrame->StyleContext()->GetTextFillColorProp();
|
||||
ColorPattern color(ToDeviceColor(
|
||||
mFrame->GetVisitedDependentColor(colorProp)));
|
||||
mFrame->GetVisitedDependentColor(eCSSProperty__webkit_text_fill_color)));
|
||||
|
||||
StrokeOptions strokeOptions(strokeWidth);
|
||||
|
||||
|
@ -628,12 +628,11 @@ void nsDisplayMathMLSlash::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsPresContext* presContext = mFrame->PresContext();
|
||||
Rect rect = NSRectToRect(mRect + ToReferenceFrame(),
|
||||
presContext->AppUnitsPerDevPixel());
|
||||
|
||||
nsCSSPropertyID colorProp = mFrame->StyleContext()->GetTextFillColorProp();
|
||||
|
||||
ColorPattern color(ToDeviceColor(
|
||||
mFrame->GetVisitedDependentColor(colorProp)));
|
||||
|
||||
// draw the slash as a parallelogram
|
||||
mFrame->GetVisitedDependentColor(eCSSProperty__webkit_text_fill_color)));
|
||||
|
||||
// draw the slash as a parallelogram
|
||||
Point delta = Point(presContext->AppUnitsToGfxUnits(mThickness), 0);
|
||||
RefPtr<PathBuilder> builder = aDrawTarget.CreatePathBuilder();
|
||||
if (mRTL) {
|
||||
|
@ -3419,17 +3419,6 @@ StyleDataAtOffset(const void* aStyleStruct, ptrdiff_t aOffset)
|
||||
reinterpret_cast<const uint8_t*>(aStyleStruct) + aOffset);
|
||||
}
|
||||
|
||||
static void
|
||||
SetCurrentOrActualColor(bool aIsForeground, nscolor aActualColor,
|
||||
StyleAnimationValue& aComputedValue)
|
||||
{
|
||||
if (aIsForeground) {
|
||||
aComputedValue.SetCurrentColorValue();
|
||||
} else {
|
||||
aComputedValue.SetColorValue(aActualColor);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ExtractBorderColor(nsStyleContext* aStyleContext, const void* aStyleBorder,
|
||||
mozilla::css::Side aSide,
|
||||
@ -3927,30 +3916,6 @@ StyleAnimationValue::ExtractComputedValue(nsCSSPropertyID aProperty,
|
||||
break;
|
||||
}
|
||||
|
||||
case eCSSProperty_text_emphasis_color: {
|
||||
auto styleText = static_cast<const nsStyleText*>(styleStruct);
|
||||
SetCurrentOrActualColor(styleText->mTextEmphasisColorForeground,
|
||||
styleText->mTextEmphasisColor,
|
||||
aComputedValue);
|
||||
break;
|
||||
}
|
||||
|
||||
case eCSSProperty__webkit_text_fill_color: {
|
||||
auto styleText = static_cast<const nsStyleText*>(styleStruct);
|
||||
SetCurrentOrActualColor(styleText->mWebkitTextFillColorForeground,
|
||||
styleText->mWebkitTextFillColor,
|
||||
aComputedValue);
|
||||
break;
|
||||
}
|
||||
|
||||
case eCSSProperty__webkit_text_stroke_color: {
|
||||
auto styleText = static_cast<const nsStyleText*>(styleStruct);
|
||||
SetCurrentOrActualColor(styleText->mWebkitTextStrokeColorForeground,
|
||||
styleText->mWebkitTextStrokeColor,
|
||||
aComputedValue);
|
||||
break;
|
||||
}
|
||||
|
||||
case eCSSProperty_border_spacing: {
|
||||
const nsStyleTableBorder *styleTableBorder =
|
||||
static_cast<const nsStyleTableBorder*>(styleStruct);
|
||||
|
@ -3981,8 +3981,8 @@ CSS_PROP_TEXT(
|
||||
"",
|
||||
VARIANT_HC,
|
||||
nullptr,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_Custom)
|
||||
offsetof(nsStyleText, mTextEmphasisColor),
|
||||
eStyleAnimType_ComplexColor)
|
||||
CSS_PROP_TEXT(
|
||||
text-emphasis-position,
|
||||
text_emphasis_position,
|
||||
@ -4017,7 +4017,7 @@ CSS_PROP_TEXT(
|
||||
VARIANT_HC,
|
||||
nullptr,
|
||||
offsetof(nsStyleText, mWebkitTextFillColor),
|
||||
eStyleAnimType_Custom)
|
||||
eStyleAnimType_ComplexColor)
|
||||
CSS_PROP_TEXT(
|
||||
text-indent,
|
||||
text_indent,
|
||||
@ -4106,7 +4106,7 @@ CSS_PROP_TEXT(
|
||||
VARIANT_HC,
|
||||
nullptr,
|
||||
offsetof(nsStyleText, mWebkitTextStrokeColor),
|
||||
eStyleAnimType_Custom)
|
||||
eStyleAnimType_ComplexColor)
|
||||
CSS_PROP_TEXT(
|
||||
-webkit-text-stroke-width,
|
||||
_webkit_text_stroke_width,
|
||||
|
@ -957,6 +957,13 @@ nsComputedDOMStyle::SetToRGBAColor(nsROCSSPrimitiveValue* aValue,
|
||||
aValue->SetColor(rgbColor);
|
||||
}
|
||||
|
||||
void
|
||||
nsComputedDOMStyle::SetValueFromComplexColor(nsROCSSPrimitiveValue* aValue,
|
||||
const StyleComplexColor& aColor)
|
||||
{
|
||||
SetToRGBAColor(aValue, StyleColor()->CalcComplexColor(aColor));
|
||||
}
|
||||
|
||||
already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetColor()
|
||||
{
|
||||
@ -3828,10 +3835,7 @@ already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetTextEmphasisColor()
|
||||
{
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
const nsStyleText* text = StyleText();
|
||||
nscolor color = text->mTextEmphasisColorForeground ?
|
||||
StyleColor()->mColor : text->mTextEmphasisColor;
|
||||
SetToRGBAColor(val, color);
|
||||
SetValueFromComplexColor(val, StyleText()->mTextEmphasisColor);
|
||||
return val.forget();
|
||||
}
|
||||
|
||||
@ -4076,7 +4080,7 @@ already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetWebkitTextFillColor()
|
||||
{
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
SetToRGBAColor(val, mStyleContext->GetTextFillColor());
|
||||
SetValueFromComplexColor(val, StyleText()->mWebkitTextFillColor);
|
||||
return val.forget();
|
||||
}
|
||||
|
||||
@ -4084,7 +4088,7 @@ already_AddRefed<CSSValue>
|
||||
nsComputedDOMStyle::DoGetWebkitTextStrokeColor()
|
||||
{
|
||||
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
||||
SetToRGBAColor(val, mStyleContext->GetTextStrokeColor());
|
||||
SetValueFromComplexColor(val, StyleText()->mWebkitTextStrokeColor);
|
||||
return val.forget();
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "mozilla/ArenaRefPtr.h"
|
||||
#include "mozilla/ArenaRefPtrInlines.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/StyleComplexColor.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nscore.h"
|
||||
#include "nsCSSProps.h"
|
||||
@ -583,6 +584,8 @@ private:
|
||||
|
||||
/* Helper functions */
|
||||
void SetToRGBAColor(nsROCSSPrimitiveValue* aValue, nscolor aColor);
|
||||
void SetValueFromComplexColor(nsROCSSPrimitiveValue* aValue,
|
||||
const mozilla::StyleComplexColor& aColor);
|
||||
void SetValueToStyleImage(const nsStyleImage& aStyleImage,
|
||||
nsROCSSPrimitiveValue* aValue);
|
||||
void SetValueToPositionCoord(const mozilla::Position::Coord& aCoord,
|
||||
|
@ -75,6 +75,16 @@ using std::min;
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
enum UnsetAction
|
||||
{
|
||||
eUnsetInitial,
|
||||
eUnsetInherit
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
void*
|
||||
nsConditionalResetStyleData::GetConditionalStyleData(nsStyleStructID aSID,
|
||||
nsStyleContext* aStyleContext) const
|
||||
@ -1091,6 +1101,41 @@ static bool SetColor(const nsCSSValue& aValue, const nscolor aParentColor,
|
||||
return result;
|
||||
}
|
||||
|
||||
template<UnsetAction UnsetTo>
|
||||
static void
|
||||
SetComplexColor(const nsCSSValue& aValue,
|
||||
const StyleComplexColor& aParentColor,
|
||||
const StyleComplexColor& aInitialColor,
|
||||
nsPresContext* aPresContext,
|
||||
StyleComplexColor& aResult,
|
||||
RuleNodeCacheConditions& aConditions)
|
||||
{
|
||||
nsCSSUnit unit = aValue.GetUnit();
|
||||
if (unit == eCSSUnit_Null) {
|
||||
return;
|
||||
}
|
||||
if (unit == eCSSUnit_Initial ||
|
||||
(UnsetTo == eUnsetInitial && unit == eCSSUnit_Unset)) {
|
||||
aResult = aInitialColor;
|
||||
} else if (unit == eCSSUnit_Inherit ||
|
||||
(UnsetTo == eUnsetInherit && unit == eCSSUnit_Unset)) {
|
||||
aConditions.SetUncacheable();
|
||||
aResult = aParentColor;
|
||||
} else if (unit == eCSSUnit_EnumColor &&
|
||||
aValue.GetIntValue() == NS_COLOR_CURRENTCOLOR) {
|
||||
aResult = StyleComplexColor::CurrentColor();
|
||||
} else if (unit == eCSSUnit_ComplexColor) {
|
||||
aResult = aValue.GetStyleComplexColorValue();
|
||||
} else {
|
||||
if (!SetColor(aValue, aParentColor.mColor, aPresContext,
|
||||
nullptr, aResult.mColor, aConditions)) {
|
||||
MOZ_ASSERT_UNREACHABLE("Unknown color value");
|
||||
return;
|
||||
}
|
||||
aResult.mForegroundRatio = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void SetGradientCoord(const nsCSSValue& aValue, nsPresContext* aPresContext,
|
||||
nsStyleContext* aContext, nsStyleCoord& aResult,
|
||||
RuleNodeCacheConditions& aConditions)
|
||||
@ -4473,6 +4518,13 @@ nsRuleNode::ComputeTextData(void* aStartStruct,
|
||||
{
|
||||
COMPUTE_START_INHERITED(Text, text, parentText)
|
||||
|
||||
auto setComplexColor = [&](const nsCSSValue* aValue,
|
||||
StyleComplexColor nsStyleText::* aField) {
|
||||
SetComplexColor<eUnsetInherit>(*aValue, parentText->*aField,
|
||||
StyleComplexColor::CurrentColor(),
|
||||
mPresContext, text->*aField, conditions);
|
||||
};
|
||||
|
||||
// tab-size: integer, inherit
|
||||
SetValue(*aRuleData->ValueForTabSize(),
|
||||
text->mTabSize, conditions,
|
||||
@ -4716,26 +4768,8 @@ nsRuleNode::ComputeTextData(void* aStartStruct,
|
||||
NS_STYLE_TEXT_COMBINE_UPRIGHT_NONE);
|
||||
|
||||
// text-emphasis-color: color, string, inherit, initial
|
||||
const nsCSSValue*
|
||||
textEmphasisColorValue = aRuleData->ValueForTextEmphasisColor();
|
||||
if (textEmphasisColorValue->GetUnit() == eCSSUnit_Null) {
|
||||
// We don't want to change anything in this case.
|
||||
} else if (textEmphasisColorValue->GetUnit() == eCSSUnit_Inherit ||
|
||||
textEmphasisColorValue->GetUnit() == eCSSUnit_Unset) {
|
||||
conditions.SetUncacheable();
|
||||
text->mTextEmphasisColorForeground =
|
||||
parentText->mTextEmphasisColorForeground;
|
||||
text->mTextEmphasisColor = parentText->mTextEmphasisColor;
|
||||
} else if ((textEmphasisColorValue->GetUnit() == eCSSUnit_EnumColor &&
|
||||
textEmphasisColorValue->GetIntValue() == NS_COLOR_CURRENTCOLOR) ||
|
||||
textEmphasisColorValue->GetUnit() == eCSSUnit_Initial) {
|
||||
text->mTextEmphasisColorForeground = true;
|
||||
text->mTextEmphasisColor = mPresContext->DefaultColor();
|
||||
} else {
|
||||
text->mTextEmphasisColorForeground = false;
|
||||
SetColor(*textEmphasisColorValue, 0, mPresContext, aContext,
|
||||
text->mTextEmphasisColor, conditions);
|
||||
}
|
||||
setComplexColor(aRuleData->ValueForTextEmphasisColor(),
|
||||
&nsStyleText::mTextEmphasisColor);
|
||||
|
||||
// text-emphasis-position: enum, inherit, initial
|
||||
SetValue(*aRuleData->ValueForTextEmphasisPosition(),
|
||||
@ -4809,47 +4843,12 @@ nsRuleNode::ComputeTextData(void* aStartStruct,
|
||||
NS_STYLE_TEXT_RENDERING_AUTO);
|
||||
|
||||
// -webkit-text-fill-color: color, string, inherit, initial
|
||||
const nsCSSValue*
|
||||
webkitTextFillColorValue = aRuleData->ValueForWebkitTextFillColor();
|
||||
if (webkitTextFillColorValue->GetUnit() == eCSSUnit_Null) {
|
||||
// We don't want to change anything in this case.
|
||||
} else if (webkitTextFillColorValue->GetUnit() == eCSSUnit_Inherit ||
|
||||
webkitTextFillColorValue->GetUnit() == eCSSUnit_Unset) {
|
||||
conditions.SetUncacheable();
|
||||
text->mWebkitTextFillColorForeground = parentText->mWebkitTextFillColorForeground;
|
||||
text->mWebkitTextFillColor = parentText->mWebkitTextFillColor;
|
||||
} else if ((webkitTextFillColorValue->GetUnit() == eCSSUnit_EnumColor &&
|
||||
webkitTextFillColorValue->GetIntValue() == NS_COLOR_CURRENTCOLOR) ||
|
||||
webkitTextFillColorValue->GetUnit() == eCSSUnit_Initial) {
|
||||
text->mWebkitTextFillColorForeground = true;
|
||||
text->mWebkitTextFillColor = mPresContext->DefaultColor();
|
||||
} else {
|
||||
text->mWebkitTextFillColorForeground = false;
|
||||
SetColor(*webkitTextFillColorValue, 0, mPresContext, aContext,
|
||||
text->mWebkitTextFillColor, conditions);
|
||||
}
|
||||
setComplexColor(aRuleData->ValueForWebkitTextFillColor(),
|
||||
&nsStyleText::mWebkitTextFillColor);
|
||||
|
||||
// -webkit-text-stroke-color: color, string, inherit, initial
|
||||
const nsCSSValue* webkitTextStrokeColorValue =
|
||||
aRuleData->ValueForWebkitTextStrokeColor();
|
||||
if (webkitTextStrokeColorValue->GetUnit() == eCSSUnit_Null) {
|
||||
// We don't want to change anything in this case.
|
||||
} else if (webkitTextStrokeColorValue->GetUnit() == eCSSUnit_Inherit ||
|
||||
webkitTextStrokeColorValue->GetUnit() == eCSSUnit_Unset) {
|
||||
conditions.SetUncacheable();
|
||||
text->mWebkitTextStrokeColorForeground =
|
||||
parentText->mWebkitTextStrokeColorForeground;
|
||||
text->mWebkitTextStrokeColor = parentText->mWebkitTextStrokeColor;
|
||||
} else if ((webkitTextStrokeColorValue->GetUnit() == eCSSUnit_EnumColor &&
|
||||
webkitTextStrokeColorValue->GetIntValue() == NS_COLOR_CURRENTCOLOR) ||
|
||||
webkitTextStrokeColorValue->GetUnit() == eCSSUnit_Initial) {
|
||||
text->mWebkitTextStrokeColorForeground = true;
|
||||
text->mWebkitTextStrokeColor = mPresContext->DefaultColor();
|
||||
} else {
|
||||
text->mWebkitTextStrokeColorForeground = false;
|
||||
SetColor(*webkitTextStrokeColorValue, 0, mPresContext, aContext,
|
||||
text->mWebkitTextStrokeColor, conditions);
|
||||
}
|
||||
setComplexColor(aRuleData->ValueForWebkitTextStrokeColor(),
|
||||
&nsStyleText::mWebkitTextStrokeColor);
|
||||
|
||||
// -webkit-text-stroke-width: length, inherit, initial, enum
|
||||
const nsCSSValue*
|
||||
|
@ -1218,14 +1218,8 @@ nsStyleContext::CalcStyleDifferenceInternal(StyleContextLike* aNewContext,
|
||||
if (!change && PeekStyleText()) {
|
||||
const nsStyleText* thisVisText = thisVis->StyleText();
|
||||
const nsStyleText* otherVisText = otherVis->StyleText();
|
||||
if (thisVisText->mTextEmphasisColorForeground !=
|
||||
otherVisText->mTextEmphasisColorForeground ||
|
||||
thisVisText->mTextEmphasisColor != otherVisText->mTextEmphasisColor ||
|
||||
thisVisText->mWebkitTextFillColorForeground !=
|
||||
otherVisText->mWebkitTextFillColorForeground ||
|
||||
if (thisVisText->mTextEmphasisColor != otherVisText->mTextEmphasisColor ||
|
||||
thisVisText->mWebkitTextFillColor != otherVisText->mWebkitTextFillColor ||
|
||||
thisVisText->mWebkitTextStrokeColorForeground !=
|
||||
otherVisText->mWebkitTextStrokeColorForeground ||
|
||||
thisVisText->mWebkitTextStrokeColor != otherVisText->mWebkitTextStrokeColor) {
|
||||
change = true;
|
||||
}
|
||||
@ -1489,6 +1483,9 @@ ExtractColor(nsCSSPropertyID aProperty,
|
||||
return Some(val.GetCSSValueValue()->GetColorValue());
|
||||
case StyleAnimationValue::eUnit_CurrentColor:
|
||||
return Some(aStyleContext->StyleColor()->mColor);
|
||||
case StyleAnimationValue::eUnit_ComplexColor:
|
||||
return Some(aStyleContext->StyleColor()->
|
||||
CalcComplexColor(val.GetStyleComplexColorValue()));
|
||||
default:
|
||||
return Nothing();
|
||||
}
|
||||
|
@ -178,32 +178,6 @@ public:
|
||||
mozilla::NonOwningStyleContextSource aSource,
|
||||
mozilla::NonOwningStyleContextSource aSourceIfVisited,
|
||||
bool aRelevantLinkVisited);
|
||||
/**
|
||||
* Get the color property that should be used to fill text.
|
||||
*/
|
||||
nsCSSPropertyID GetTextFillColorProp() {
|
||||
return StyleText()->mWebkitTextFillColorForeground
|
||||
? eCSSProperty_color : eCSSProperty__webkit_text_fill_color;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the color that should be used to fill text: either
|
||||
* the current foreground color, or a separately-specified text fill color.
|
||||
*/
|
||||
nscolor GetTextFillColor() {
|
||||
return (GetTextFillColorProp() == eCSSProperty_color)
|
||||
? StyleColor()->mColor : StyleText()->mWebkitTextFillColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the color that should be used to stroke text: either
|
||||
* the current foreground color, or a separately-specified text stroke color.
|
||||
*/
|
||||
nscolor GetTextStrokeColor() {
|
||||
const nsStyleText* textStyle = StyleText();
|
||||
return textStyle->mWebkitTextStrokeColorForeground
|
||||
? StyleColor()->mColor : textStyle->mWebkitTextStrokeColor;
|
||||
}
|
||||
|
||||
// Does this style context or any of its ancestors have text
|
||||
// decoration lines?
|
||||
|
@ -3679,9 +3679,6 @@ nsStyleText::nsStyleText(StyleStructContext aContext)
|
||||
, mTextAlignLast(NS_STYLE_TEXT_ALIGN_AUTO)
|
||||
, mTextAlignTrue(false)
|
||||
, mTextAlignLastTrue(false)
|
||||
, mTextEmphasisColorForeground(true)
|
||||
, mWebkitTextFillColorForeground(true)
|
||||
, mWebkitTextStrokeColorForeground(true)
|
||||
, mTextTransform(NS_STYLE_TEXT_TRANSFORM_NONE)
|
||||
, mWhiteSpace(NS_STYLE_WHITESPACE_NORMAL)
|
||||
, mWordBreak(NS_STYLE_WORDBREAK_NORMAL)
|
||||
@ -3695,9 +3692,9 @@ nsStyleText::nsStyleText(StyleStructContext aContext)
|
||||
, mTextEmphasisStyle(NS_STYLE_TEXT_EMPHASIS_STYLE_NONE)
|
||||
, mTextRendering(NS_STYLE_TEXT_RENDERING_AUTO)
|
||||
, mTabSize(NS_STYLE_TABSIZE_INITIAL)
|
||||
, mTextEmphasisColor(aContext.DefaultColor())
|
||||
, mWebkitTextFillColor(aContext.DefaultColor())
|
||||
, mWebkitTextStrokeColor(aContext.DefaultColor())
|
||||
, mTextEmphasisColor(StyleComplexColor::CurrentColor())
|
||||
, mWebkitTextFillColor(StyleComplexColor::CurrentColor())
|
||||
, mWebkitTextStrokeColor(StyleComplexColor::CurrentColor())
|
||||
, mWordSpacing(0, nsStyleCoord::CoordConstructor)
|
||||
, mLetterSpacing(eStyleUnit_Normal)
|
||||
, mLineHeight(eStyleUnit_Normal)
|
||||
@ -3718,9 +3715,6 @@ nsStyleText::nsStyleText(const nsStyleText& aSource)
|
||||
, mTextAlignLast(aSource.mTextAlignLast)
|
||||
, mTextAlignTrue(false)
|
||||
, mTextAlignLastTrue(false)
|
||||
, mTextEmphasisColorForeground(aSource.mTextEmphasisColorForeground)
|
||||
, mWebkitTextFillColorForeground(aSource.mWebkitTextFillColorForeground)
|
||||
, mWebkitTextStrokeColorForeground(aSource.mWebkitTextStrokeColorForeground)
|
||||
, mTextTransform(aSource.mTextTransform)
|
||||
, mWhiteSpace(aSource.mWhiteSpace)
|
||||
, mWordBreak(aSource.mWordBreak)
|
||||
@ -3818,16 +3812,8 @@ nsStyleText::CalcDifference(const nsStyleText& aNewData) const
|
||||
return hint;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!mTextEmphasisColorForeground ||
|
||||
!aNewData.mTextEmphasisColorForeground ||
|
||||
mTextEmphasisColor == aNewData.mTextEmphasisColor,
|
||||
"If the text-emphasis-color are both foreground color, "
|
||||
"mTextEmphasisColor should also be identical");
|
||||
if (mTextEmphasisColorForeground != aNewData.mTextEmphasisColorForeground ||
|
||||
mTextEmphasisColor != aNewData.mTextEmphasisColor ||
|
||||
mWebkitTextFillColorForeground != aNewData.mWebkitTextFillColorForeground ||
|
||||
if (mTextEmphasisColor != aNewData.mTextEmphasisColor ||
|
||||
mWebkitTextFillColor != aNewData.mWebkitTextFillColor ||
|
||||
mWebkitTextStrokeColorForeground != aNewData.mWebkitTextStrokeColorForeground ||
|
||||
mWebkitTextStrokeColor != aNewData.mWebkitTextStrokeColor) {
|
||||
hint |= nsChangeHint_SchedulePaint |
|
||||
nsChangeHint_RepaintFrame;
|
||||
|
@ -2090,9 +2090,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText
|
||||
uint8_t mTextAlignLast; // [inherited] see nsStyleConsts.h
|
||||
bool mTextAlignTrue : 1; // [inherited] see nsStyleConsts.h
|
||||
bool mTextAlignLastTrue : 1; // [inherited] see nsStyleConsts.h
|
||||
bool mTextEmphasisColorForeground : 1;// [inherited] whether text-emphasis-color is currentColor
|
||||
bool mWebkitTextFillColorForeground : 1; // [inherited] whether -webkit-text-fill-color is currentColor
|
||||
bool mWebkitTextStrokeColorForeground : 1; // [inherited] whether -webkit-text-stroke-color is currentColor
|
||||
uint8_t mTextTransform; // [inherited] see nsStyleConsts.h
|
||||
uint8_t mWhiteSpace; // [inherited] see nsStyleConsts.h
|
||||
uint8_t mWordBreak; // [inherited] see nsStyleConsts.h
|
||||
@ -2107,9 +2104,9 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleText
|
||||
uint8_t mTextEmphasisStyle; // [inherited] see nsStyleConsts.h
|
||||
uint8_t mTextRendering; // [inherited] see nsStyleConsts.h
|
||||
int32_t mTabSize; // [inherited] see nsStyleConsts.h
|
||||
nscolor mTextEmphasisColor; // [inherited]
|
||||
nscolor mWebkitTextFillColor; // [inherited]
|
||||
nscolor mWebkitTextStrokeColor; // [inherited]
|
||||
mozilla::StyleComplexColor mTextEmphasisColor; // [inherited]
|
||||
mozilla::StyleComplexColor mWebkitTextFillColor; // [inherited]
|
||||
mozilla::StyleComplexColor mWebkitTextStrokeColor; // [inherited]
|
||||
|
||||
nsStyleCoord mWordSpacing; // [inherited] coord, percent, calc
|
||||
nsStyleCoord mLetterSpacing; // [inherited] coord, normal
|
||||
|
Loading…
x
Reference in New Issue
Block a user