зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1567094 - Make GetVisitedDependentColor const-friendly. r=jrmuizel
Differential Revision: https://phabricator.services.mozilla.com/D41934 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
cbf082a263
Коммит
c3325072d0
|
@ -264,14 +264,14 @@ void ComputedStyle::List(FILE* out, int32_t aIndent) {
|
|||
#endif
|
||||
|
||||
template <typename Func>
|
||||
static nscolor GetVisitedDependentColorInternal(ComputedStyle* aSc,
|
||||
static nscolor GetVisitedDependentColorInternal(const ComputedStyle& aStyle,
|
||||
Func aColorFunc) {
|
||||
nscolor colors[2];
|
||||
colors[0] = aColorFunc(aSc);
|
||||
if (ComputedStyle* visitedStyle = aSc->GetStyleIfVisited()) {
|
||||
colors[1] = aColorFunc(visitedStyle);
|
||||
colors[0] = aColorFunc(aStyle);
|
||||
if (const ComputedStyle* visitedStyle = aStyle.GetStyleIfVisited()) {
|
||||
colors[1] = aColorFunc(*visitedStyle);
|
||||
return ComputedStyle::CombineVisitedColors(colors,
|
||||
aSc->RelevantLinkVisited());
|
||||
aStyle.RelevantLinkVisited());
|
||||
}
|
||||
return colors[0];
|
||||
}
|
||||
|
@ -306,14 +306,14 @@ static nscolor ExtractColor(const ComputedStyle& aStyle,
|
|||
#define STYLE_FIELD(struct_, field_) aField == &struct_::field_ ||
|
||||
#define STYLE_STRUCT(name_, fields_) \
|
||||
template <> \
|
||||
nscolor ComputedStyle::GetVisitedDependentColor( \
|
||||
decltype(nsStyle##name_::MOZ_ARG_1 fields_) nsStyle##name_::*aField) { \
|
||||
nscolor ComputedStyle::GetVisitedDependentColor(decltype( \
|
||||
nsStyle##name_::MOZ_ARG_1 fields_) nsStyle##name_::*aField) const { \
|
||||
MOZ_ASSERT(MOZ_FOR_EACH(STYLE_FIELD, (nsStyle##name_, ), fields_) false, \
|
||||
"Getting visited-dependent color for a field in nsStyle" #name_ \
|
||||
" which is not listed in nsCSSVisitedDependentPropList.h"); \
|
||||
return GetVisitedDependentColorInternal( \
|
||||
this, [aField](ComputedStyle* sc) { \
|
||||
return ExtractColor(*sc, sc->Style##name_()->*aField); \
|
||||
*this, [aField](const ComputedStyle& aStyle) { \
|
||||
return ExtractColor(aStyle, aStyle.Style##name_()->*aField); \
|
||||
}); \
|
||||
}
|
||||
#include "nsCSSVisitedDependentPropList.h"
|
||||
|
|
|
@ -254,7 +254,7 @@ class ComputedStyle {
|
|||
* been listed in nsCSSVisitedDependentPropList.h.
|
||||
*/
|
||||
template <typename T, typename S>
|
||||
nscolor GetVisitedDependentColor(T S::*aField);
|
||||
nscolor GetVisitedDependentColor(T S::*aField) const;
|
||||
|
||||
/**
|
||||
* aColors should be a two element array of nscolor in which the first
|
||||
|
|
Загрузка…
Ссылка в новой задаче