Skip to content

Commit

Permalink
visitedDependentColor() should take a CSSPropertyID
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=184949

Reviewed by Sam Weinig.

Change RenderStyle::colorIncludingFallback(), RenderStyle::visitedDependentColor()
and RenderElement::selectionColor() to take CSSPropertyID rather than int.

No behavior change.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::selectionColor const):
* rendering/RenderElement.h:
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::computeCollapsedStartBorder const):
(WebCore::RenderTableCell::computeCollapsedEndBorder const):
(WebCore::RenderTableCell::computeCollapsedBeforeBorder const):
(WebCore::RenderTableCell::computeCollapsedAfterBorder const):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::colorIncludingFallback const):
(WebCore::RenderStyle::visitedDependentColor const):
* rendering/style/RenderStyle.h:


Canonical link: https://commits.webkit.org/200452@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230979 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
smfr committed Apr 25, 2018
1 parent 773d4d0 commit 3d54b3a
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 14 deletions.
25 changes: 25 additions & 0 deletions Source/WebCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
2018-04-24 Simon Fraser <simon.fraser@apple.com>

visitedDependentColor() should take a CSSPropertyID
https://bugs.webkit.org/show_bug.cgi?id=184949

Reviewed by Sam Weinig.

Change RenderStyle::colorIncludingFallback(), RenderStyle::visitedDependentColor()
and RenderElement::selectionColor() to take CSSPropertyID rather than int.

No behavior change.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::selectionColor const):
* rendering/RenderElement.h:
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::computeCollapsedStartBorder const):
(WebCore::RenderTableCell::computeCollapsedEndBorder const):
(WebCore::RenderTableCell::computeCollapsedBeforeBorder const):
(WebCore::RenderTableCell::computeCollapsedAfterBorder const):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::colorIncludingFallback const):
(WebCore::RenderStyle::visitedDependentColor const):
* rendering/style/RenderStyle.h:

2018-04-24 Simon Fraser <simon.fraser@apple.com>

Add a new "color-filter" CSS property as an experimental feature
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/RenderElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1356,7 +1356,7 @@ std::unique_ptr<RenderStyle> RenderElement::getUncachedPseudoStyle(const PseudoS
return style;
}

Color RenderElement::selectionColor(int colorProperty) const
Color RenderElement::selectionColor(CSSPropertyID colorProperty) const
{
// If the element is unselectable, or we are only painting the selection,
// don't override the foreground color with the selection foreground color.
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/RenderElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class RenderElement : public RenderObject {
bool canContainFixedPositionObjects() const;
bool canContainAbsolutelyPositionedObjects() const;

Color selectionColor(int colorProperty) const;
Color selectionColor(CSSPropertyID) const;
std::unique_ptr<RenderStyle> selectionPseudoStyle() const;

// Obtains the selection colors that should be used when painting a selection.
Expand Down
16 changes: 8 additions & 8 deletions Source/WebCore/rendering/RenderTableCell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,8 @@ CollapsedBorderValue RenderTableCell::computeCollapsedStartBorder(IncludeBorderC
{
// For the start border, we need to check, in order of precedence:
// (1) Our start border.
int startColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderStartColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : 0;
int endColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderEndColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : 0;
CSSPropertyID startColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderStartColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : CSSPropertyInvalid;
CSSPropertyID endColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderEndColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : CSSPropertyInvalid;
CollapsedBorderValue result(style().borderStart(), includeColor ? style().visitedDependentColor(startColorProperty) : Color(), BCELL);

RenderTable* table = this->table();
Expand Down Expand Up @@ -669,8 +669,8 @@ CollapsedBorderValue RenderTableCell::computeCollapsedEndBorder(IncludeBorderCol
{
// For end border, we need to check, in order of precedence:
// (1) Our end border.
int startColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderStartColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : 0;
int endColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderEndColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : 0;
CSSPropertyID startColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderStartColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : CSSPropertyInvalid;
CSSPropertyID endColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderEndColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : CSSPropertyInvalid;
CollapsedBorderValue result = CollapsedBorderValue(style().borderEnd(), includeColor ? style().visitedDependentColor(endColorProperty) : Color(), BCELL);

RenderTable* table = this->table();
Expand Down Expand Up @@ -782,8 +782,8 @@ CollapsedBorderValue RenderTableCell::computeCollapsedBeforeBorder(IncludeBorder
{
// For before border, we need to check, in order of precedence:
// (1) Our before border.
int beforeColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderBeforeColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : 0;
int afterColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderAfterColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : 0;
CSSPropertyID beforeColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderBeforeColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : CSSPropertyInvalid;
CSSPropertyID afterColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderAfterColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : CSSPropertyInvalid;
CollapsedBorderValue result = CollapsedBorderValue(style().borderBefore(), includeColor ? style().visitedDependentColor(beforeColorProperty) : Color(), BCELL);

RenderTable* table = this->table();
Expand Down Expand Up @@ -879,8 +879,8 @@ CollapsedBorderValue RenderTableCell::computeCollapsedAfterBorder(IncludeBorderC
{
// For after border, we need to check, in order of precedence:
// (1) Our after border.
int beforeColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderBeforeColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : 0;
int afterColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderAfterColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : 0;
CSSPropertyID beforeColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderBeforeColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : CSSPropertyInvalid;
CSSPropertyID afterColorProperty = includeColor ? CSSProperty::resolveDirectionAwareProperty(CSSPropertyWebkitBorderAfterColor, styleForCellFlow().direction(), styleForCellFlow().writingMode()) : CSSPropertyInvalid;
CollapsedBorderValue result = CollapsedBorderValue(style().borderAfter(), includeColor ? style().visitedDependentColor(afterColorProperty) : Color(), BCELL);

RenderTable* table = this->table();
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/rendering/style/RenderStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,7 @@ void RenderStyle::getShadowVerticalExtent(const ShadowData* shadow, LayoutUnit &
}
}

Color RenderStyle::colorIncludingFallback(int colorProperty, bool visitedLink) const
Color RenderStyle::colorIncludingFallback(CSSPropertyID colorProperty, bool visitedLink) const
{
Color result;
EBorderStyle borderStyle = BNONE;
Expand Down Expand Up @@ -1822,7 +1822,7 @@ Color RenderStyle::colorIncludingFallback(int colorProperty, bool visitedLink) c
return result;
}

Color RenderStyle::visitedDependentColor(int colorProperty) const
Color RenderStyle::visitedDependentColor(CSSPropertyID colorProperty) const
{
Color unvisitedColor = colorIncludingFallback(colorProperty, false);
if (insideLink() != InsideVisitedLink)
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/rendering/style/RenderStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ class RenderStyle {
bool lastChildState() const { return m_nonInheritedFlags.lastChildState; }
void setLastChildState() { setUnique(); m_nonInheritedFlags.lastChildState = true; }

WEBCORE_EXPORT Color visitedDependentColor(int colorProperty) const;
WEBCORE_EXPORT Color visitedDependentColor(CSSPropertyID) const;
bool backgroundColorEqualsToColorIgnoringVisited(const Color& color) const { return color == backgroundColor(); }

void setHasExplicitlyInheritedProperties() { m_nonInheritedFlags.hasExplicitlyInheritedProperties = true; }
Expand Down Expand Up @@ -1827,7 +1827,7 @@ class RenderStyle {
static bool isDisplayGridBox(EDisplay);
static bool isDisplayFlexibleOrGridBox(EDisplay);

Color colorIncludingFallback(int colorProperty, bool visitedLink) const;
Color colorIncludingFallback(CSSPropertyID colorProperty, bool visitedLink) const;

bool changeAffectsVisualOverflow(const RenderStyle&) const;
bool changeRequiresLayout(const RenderStyle&, unsigned& changedContextSensitiveProperties) const;
Expand Down

0 comments on commit 3d54b3a

Please sign in to comment.