Bug 1303241 part 1 - Move visited-dependent style fields into a list file. r=dbaron

MozReview-Commit-ID: K4kc8ByNGoT

--HG--
extra : rebase_source : 0225be937ea2706ec43f56211550b966859afc8c
This commit is contained in:
Xidorn Quan 2017-01-05 11:22:36 +11:00
Родитель a8a552beb9
Коммит 801cd27579
2 изменённых файлов: 46 добавлений и 75 удалений

Просмотреть файл

@ -0,0 +1,35 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* a list of style struct's member variables which can be visited-dependent */
/* This file contains the list of all style structs and fields that can
* be visited-dependent. Each entry is defined as a STYLE_STRUCT macro
* with the following parameters:
* - 'name_' the name of the style struct
* - 'fields_' the list of member variables in the style struct that can
* be visited-dependent
*
* Users of this list should define a macro STYLE_STRUCT(name_, fields_)
* before including this file.
*
* Note that, currently, there is a restriction that all fields in a
* style struct must have the same type.
*/
STYLE_STRUCT(Color, (mColor))
STYLE_STRUCT(Background, (mBackgroundColor))
STYLE_STRUCT(Border, (mBorderTopColor,
mBorderRightColor,
mBorderBottomColor,
mBorderLeftColor))
STYLE_STRUCT(Outline, (mOutlineColor))
STYLE_STRUCT(Column, (mColumnRuleColor))
STYLE_STRUCT(Text, (mTextEmphasisColor,
mWebkitTextFillColor,
mWebkitTextStrokeColor))
STYLE_STRUCT(TextReset, (mTextDecorationColor))
STYLE_STRUCT(SVG, (mFill, mStroke))

Просмотреть файл

@ -1169,82 +1169,18 @@ nsStyleContext::CalcStyleDifferenceInternal(StyleContextLike* aNewContext,
// |thisVis| (including this function if we skip one of these checks
// due to change being true already or due to the old style context
// not having a style-if-visited), but not the other way around.
if (PeekStyleColor()) {
if (thisVis->StyleColor()->mColor !=
otherVis->StyleColor()->mColor) {
change = true;
}
}
// NB: Calling Peek on |this|, not |thisVis| (see above).
if (!change && PeekStyleBackground()) {
if (thisVis->StyleBackground()->mBackgroundColor !=
otherVis->StyleBackground()->mBackgroundColor) {
change = true;
}
}
// NB: Calling Peek on |this|, not |thisVis| (see above).
if (!change && PeekStyleBorder()) {
const nsStyleBorder *thisVisBorder = thisVis->StyleBorder();
const nsStyleBorder *otherVisBorder = otherVis->StyleBorder();
NS_FOR_CSS_SIDES(side) {
if (thisVisBorder->mBorderColor[side] !=
otherVisBorder->mBorderColor[side]) {
change = true;
break;
}
}
}
// NB: Calling Peek on |this|, not |thisVis| (see above).
if (!change && PeekStyleOutline()) {
const nsStyleOutline *thisVisOutline = thisVis->StyleOutline();
const nsStyleOutline *otherVisOutline = otherVis->StyleOutline();
if (thisVisOutline->mOutlineColor != otherVisOutline->mOutlineColor) {
change = true;
}
}
// NB: Calling Peek on |this|, not |thisVis| (see above).
if (!change && PeekStyleColumn()) {
const nsStyleColumn *thisVisColumn = thisVis->StyleColumn();
const nsStyleColumn *otherVisColumn = otherVis->StyleColumn();
if (thisVisColumn->mColumnRuleColor != otherVisColumn->mColumnRuleColor) {
change = true;
}
}
// NB: Calling Peek on |this|, not |thisVis| (see above).
if (!change && PeekStyleText()) {
const nsStyleText* thisVisText = thisVis->StyleText();
const nsStyleText* otherVisText = otherVis->StyleText();
if (thisVisText->mTextEmphasisColor != otherVisText->mTextEmphasisColor ||
thisVisText->mWebkitTextFillColor != otherVisText->mWebkitTextFillColor ||
thisVisText->mWebkitTextStrokeColor != otherVisText->mWebkitTextStrokeColor) {
change = true;
}
}
// NB: Calling Peek on |this|, not |thisVis| (see above).
if (!change && PeekStyleTextReset()) {
const nsStyleTextReset *thisVisTextReset = thisVis->StyleTextReset();
const nsStyleTextReset *otherVisTextReset = otherVis->StyleTextReset();
if (thisVisTextReset->mTextDecorationColor !=
otherVisTextReset->mTextDecorationColor) {
change = true;
}
}
// NB: Calling Peek on |this|, not |thisVis| (see above).
if (!change && PeekStyleSVG()) {
const nsStyleSVG *thisVisSVG = thisVis->StyleSVG();
const nsStyleSVG *otherVisSVG = otherVis->StyleSVG();
if (thisVisSVG->mFill != otherVisSVG->mFill ||
thisVisSVG->mStroke != otherVisSVG->mStroke) {
change = true;
}
#define STYLE_FIELD(name_) thisVisStruct->name_ != otherVisStruct->name_ ||
#define STYLE_STRUCT(name_, fields_) \
if (!change && PeekStyle##name_()) { \
const nsStyle##name_* thisVisStruct = thisVis->Style##name_(); \
const nsStyle##name_* otherVisStruct = otherVis->Style##name_(); \
if (MOZ_FOR_EACH(STYLE_FIELD, (), fields_) false) { \
change = true; \
} \
}
#include "nsCSSVisitedDependentPropList.h"
#undef STYLE_STRUCT
#undef STYLE_FIELD
if (change) {
hint |= nsChangeHint_RepaintFrame;