#pragma once
#include "MarkedText.h"
#include "ShadowData.h"
#include "TextDecorationPainter.h"
#include "TextPaintStyle.h"
#include <wtf/Optional.h>
namespace WebCore {
class RenderText;
class RenderedDocumentMarker;
struct MarkedTextStyle {
static bool areBackgroundMarkedTextStylesEqual(const MarkedTextStyle& a, const MarkedTextStyle& b)
{
return a.backgroundColor == b.backgroundColor;
}
static bool areForegroundMarkedTextStylesEqual(const MarkedTextStyle& a, const MarkedTextStyle& b)
{
return a.textStyles == b.textStyles && a.textShadow == b.textShadow && a.alpha == b.alpha;
}
static bool areDecorationMarkedTextStylesEqual(const MarkedTextStyle& a, const MarkedTextStyle& b)
{
return a.textDecorationStyles == b.textDecorationStyles && a.textShadow == b.textShadow && a.alpha == b.alpha;
}
Color backgroundColor;
TextPaintStyle textStyles;
TextDecorationPainter::Styles textDecorationStyles;
Optional<ShadowData> textShadow;
float alpha;
};
struct StyledMarkedText : MarkedText {
StyledMarkedText(const MarkedText& marker)
: MarkedText { marker }
{
}
MarkedTextStyle style;
};
Vector<StyledMarkedText> subdivideAndResolveStyle(const Vector<MarkedText>&, const RenderText&, bool isFirstLine, const PaintInfo&);
using MarkedTextStylesEqualityFunction = bool (*)(const MarkedTextStyle&, const MarkedTextStyle&);
Vector<StyledMarkedText> coalesceAdjacentMarkedTexts(const Vector<StyledMarkedText>&, MarkedTextStylesEqualityFunction);
}