Skip to content

Commit

Permalink
Revert "Cherry-pick 89399f0. rdar://problem/111116301"
Browse files Browse the repository at this point in the history
This reverts commit 8c68ef3.

Identifier: 245886.900@safari-7613.4.1.0-branch
  • Loading branch information
MyahCobbs committed Jul 3, 2023
1 parent 99edce2 commit e20fa9d
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 49 deletions.
3 changes: 1 addition & 2 deletions Source/WebCore/rendering/PaintPhase.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ enum class PaintPhase : uint8_t {
EventRegion,
};

enum class PaintBehavior : uint32_t {
enum class PaintBehavior : uint16_t {
Normal = 0,
SelectionOnly = 1 << 0,
SkipSelectionHighlight = 1 << 1,
Expand All @@ -71,7 +71,6 @@ enum class PaintBehavior : uint32_t {
AnnotateLinks = 1 << 13, // Collect all renderers with links to annotate their URLs (e.g. PDFs)
EventRegionIncludeForeground = 1 << 14, // FIXME: Event region painting should use paint phases.
EventRegionIncludeBackground = 1 << 15,
DontShowVisitedLinks = 1 << 16,
};

} // namespace WebCore
7 changes: 0 additions & 7 deletions Source/WebCore/rendering/RenderLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3347,9 +3347,6 @@ void RenderLayer::paintLayerContents(GraphicsContext& context, const LayerPainti
}
GraphicsContext& currentContext = filterContext ? *filterContext : context;

if (filterContext)
localPaintingInfo.paintBehavior.add(PaintBehavior::DontShowVisitedLinks);

// If this layer's renderer is a child of the subtreePaintRoot, we render unconditionally, which
// is done by passing a nil subtreePaintRoot down to our renderer (as if no subtreePaintRoot was ever set).
// Otherwise, our renderer tree may or may not contain the subtreePaintRoot root, so we pass that root along
Expand Down Expand Up @@ -3776,9 +3773,6 @@ void RenderLayer::paintForegroundForFragments(const LayerFragments& layerFragmen
if (localPaintingInfo.paintBehavior & PaintBehavior::CompositedOverflowScrollContent)
localPaintBehavior.add(PaintBehavior::CompositedOverflowScrollContent);

if (localPaintingInfo.paintBehavior & PaintBehavior::DontShowVisitedLinks)
localPaintBehavior.add(PaintBehavior::DontShowVisitedLinks);

GraphicsContextStateSaver stateSaver(context, false);
EventRegionContextStateSaver eventRegionStateSaver(localPaintingInfo.eventRegionContext);

Expand Down Expand Up @@ -5743,7 +5737,6 @@ TextStream& operator<<(TextStream& ts, PaintBehavior behavior)
case PaintBehavior::AnnotateLinks: ts << "AnnotateLinks"; break;
case PaintBehavior::EventRegionIncludeForeground: ts << "EventRegionIncludeForeground"; break;
case PaintBehavior::EventRegionIncludeBackground: ts << "EventRegionIncludeBackground"; break;
case PaintBehavior::DontShowVisitedLinks: ts << "DontShowVisitedLinks"; break;
}

return ts;
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/rendering/StyledMarkedText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static StyledMarkedText resolveStyleForMarkedText(const MarkedText& markedText,
style.textStyles.fillColor = renderStyle->computedStrokeColor();
style.textStyles.strokeColor = renderStyle->computedStrokeColor();

auto color = TextDecorationPainter::decorationColor(*renderStyle.get(), paintInfo.paintBehavior);
auto color = TextDecorationPainter::decorationColor(*renderStyle.get());
auto decorationStyle = renderStyle->textDecorationStyle();
auto decorations = renderStyle->textDecorationsInEffect();

Expand Down Expand Up @@ -108,7 +108,7 @@ static StyledMarkedText resolveStyleForMarkedText(const MarkedText& markedText,
static StyledMarkedText::Style computeStyleForUnmarkedMarkedText(const RenderText& renderer, const RenderStyle& lineStyle, bool isFirstLine, const PaintInfo& paintInfo)
{
StyledMarkedText::Style style;
style.textDecorationStyles = TextDecorationPainter::stylesForRenderer(renderer, lineStyle.textDecorationsInEffect(), isFirstLine, paintInfo.paintBehavior);
style.textDecorationStyles = TextDecorationPainter::stylesForRenderer(renderer, lineStyle.textDecorationsInEffect(), isFirstLine);
style.textStyles = computeTextPaintStyle(renderer.frame(), lineStyle, paintInfo);
style.textShadow = ShadowData::clone(paintInfo.forceTextColor() ? nullptr : lineStyle.textShadow());
return style;
Expand Down
24 changes: 4 additions & 20 deletions Source/WebCore/rendering/TextDecorationPainter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,10 @@ void TextDecorationPainter::paintLineThrough(const Color& color, float thickness
m_context.drawLineForText(rect, m_isPrinting, style == TextDecorationStyle::Double, strokeStyle);
}

static void collectStylesForRenderer(TextDecorationPainter::Styles& result, const RenderObject& renderer, OptionSet<TextDecorationLine> remainingDecorations, bool firstLineStyle, OptionSet<PaintBehavior> paintBehavior, PseudoId pseudoId)
static void collectStylesForRenderer(TextDecorationPainter::Styles& result, const RenderObject& renderer, OptionSet<TextDecorationLine> remainingDecorations, bool firstLineStyle, PseudoId pseudoId)
{
auto extractDecorations = [&] (const RenderStyle& style, OptionSet<TextDecorationLine> decorations) {
if (decorations.isEmpty())
return;

auto color = TextDecorationPainter::decorationColor(style, paintBehavior);
auto color = TextDecorationPainter::decorationColor(style);
auto decorationStyle = style.textDecorationStyle();

if (decorations.contains(TextDecorationLine::Underline)) {
Expand Down Expand Up @@ -391,22 +388,9 @@ static void collectStylesForRenderer(TextDecorationPainter::Styles& result, cons
extractDecorations(styleForRenderer(*current), remainingDecorations);
}

Color TextDecorationPainter::decorationColor(const RenderStyle& style, OptionSet<PaintBehavior> paintBehavior)
{
return style.visitedDependentColorWithColorFilter(CSSPropertyTextDecorationColor, paintBehavior);
}

auto TextDecorationPainter::stylesForRenderer(const RenderObject& renderer, OptionSet<TextDecorationLine> requestedDecorations, bool firstLineStyle, OptionSet<PaintBehavior> paintBehavior, PseudoId pseudoId) -> Styles
Color TextDecorationPainter::decorationColor(const RenderStyle& style)
{
if (requestedDecorations.isEmpty())
return { };

Styles result;
collectStylesForRenderer(result, renderer, requestedDecorations, false, paintBehavior, pseudoId);
if (firstLineStyle)
collectStylesForRenderer(result, renderer, requestedDecorations, true, paintBehavior, pseudoId);
result.skipInk = renderer.style().textDecorationSkipInk();
return result;
return style.visitedDependentColorWithColorFilter(CSSPropertyTextDecorationColor);
}

OptionSet<TextDecorationLine> TextDecorationPainter::textDecorationsInEffectForStyle(const TextDecorationPainter::Styles& style)
Expand Down
8 changes: 3 additions & 5 deletions Source/WebCore/rendering/TextDecorationPainter.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,9 @@ class TextDecorationPainter {
TextDecorationStyle overlineStyle;
TextDecorationStyle linethroughStyle;
};
void paintForegroundDecorations(const ForegroundDecorationGeometry&, const Styles&);

static Color decorationColor(const RenderStyle&, OptionSet<PaintBehavior> paintBehavior = { });
static Styles stylesForRenderer(const RenderObject&, OptionSet<TextDecorationLine> requestedDecorations, bool firstLineStyle = false, OptionSet<PaintBehavior> paintBehavior = { }, PseudoId = PseudoId::None);
static OptionSet<TextDecorationLine> textDecorationsInEffectForStyle(const TextDecorationPainter::Styles&);
static Color decorationColor(const RenderStyle&);
static OptionSet<TextDecorationLine> textDecorationsInEffectForStyle(const Styles&);
static Styles stylesForRenderer(const RenderObject&, OptionSet<TextDecorationLine> requestedDecorations, bool firstLineStyle = false, PseudoId = PseudoId::None);

private:
GraphicsContext& m_context;
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/TextPaintStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ TextPaintStyle computeTextPaintStyle(const Frame& frame, const RenderStyle& line
}
}

paintStyle.fillColor = lineStyle.visitedDependentColorWithColorFilter(CSSPropertyWebkitTextFillColor, paintInfo.paintBehavior);
paintStyle.fillColor = lineStyle.visitedDependentColorWithColorFilter(CSSPropertyWebkitTextFillColor);

bool forceBackgroundToWhite = false;
if (frame.document() && frame.document()->printing()) {
Expand Down
13 changes: 5 additions & 8 deletions Source/WebCore/rendering/style/RenderStyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2184,20 +2184,17 @@ Color RenderStyle::colorResolvingCurrentColor(const Color& color) const
return color;
}

Color RenderStyle::visitedDependentColor(CSSPropertyID colorProperty, OptionSet<PaintBehavior> paintBehavior) const
Color RenderStyle::visitedDependentColor(CSSPropertyID colorProperty) const
{
Color unvisitedColor = colorResolvingCurrentColor(colorProperty, false);
if (insideLink() != InsideLink::InsideVisited)
return unvisitedColor;

if (paintBehavior.contains(PaintBehavior::DontShowVisitedLinks))
return unvisitedColor;

#if ENABLE(CSS_COMPOSITING)
if (isInSubtreeWithBlendMode())
return unvisitedColor;
#endif

Color visitedColor = colorResolvingCurrentColor(colorProperty, true);

// FIXME: Technically someone could explicitly specify the color transparent, but for now we'll just
Expand All @@ -2212,12 +2209,12 @@ Color RenderStyle::visitedDependentColor(CSSPropertyID colorProperty, OptionSet<
return visitedColor.colorWithAlpha(unvisitedColor.alphaAsFloat());
}

Color RenderStyle::visitedDependentColorWithColorFilter(CSSPropertyID colorProperty, OptionSet<PaintBehavior> paintBehavior) const
Color RenderStyle::visitedDependentColorWithColorFilter(CSSPropertyID colorProperty) const
{
if (!hasAppleColorFilter())
return visitedDependentColor(colorProperty, paintBehavior);
return visitedDependentColor(colorProperty);

return colorByApplyingColorFilter(visitedDependentColor(colorProperty, paintBehavior));
return colorByApplyingColorFilter(visitedDependentColor(colorProperty));
}

Color RenderStyle::colorByApplyingColorFilter(const Color& color) const
Expand Down
6 changes: 2 additions & 4 deletions Source/WebCore/rendering/style/RenderStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ class StyleInheritedData;
class StyleScrollSnapArea;
class TransformationMatrix;

enum class PaintBehavior : uint32_t;

struct ScrollSnapAlign;
struct ScrollSnapType;

Expand Down Expand Up @@ -1546,8 +1544,8 @@ class RenderStyle {
Color unresolvedColorForProperty(CSSPropertyID colorProperty, bool visitedLink = false) const;
Color colorResolvingCurrentColor(const Color&) const;

WEBCORE_EXPORT Color visitedDependentColor(CSSPropertyID, OptionSet<PaintBehavior> paintBehavior = { }) const;
WEBCORE_EXPORT Color visitedDependentColorWithColorFilter(CSSPropertyID, OptionSet<PaintBehavior> paintBehavior = { }) const;
WEBCORE_EXPORT Color visitedDependentColor(CSSPropertyID) const;
WEBCORE_EXPORT Color visitedDependentColorWithColorFilter(CSSPropertyID) const;

WEBCORE_EXPORT Color colorByApplyingColorFilter(const Color&) const;

Expand Down

0 comments on commit e20fa9d

Please sign in to comment.