#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/core/css/style_property_serializer.h"
#include <bitset>
#include "base/logging.h"
#include "base/memory/values_equivalent.h"
#include "third_party/blink/renderer/core/animation/css/css_animation_data.h"
#include "third_party/blink/renderer/core/css/css_grid_template_areas_value.h"
#include "third_party/blink/renderer/core/css/css_identifier_value.h"
#include "third_party/blink/renderer/core/css/css_markup.h"
#include "third_party/blink/renderer/core/css/css_pending_substitution_value.h"
#include "third_party/blink/renderer/core/css/css_pending_system_font_value.h"
#include "third_party/blink/renderer/core/css/css_repeat_style_value.h"
#include "third_party/blink/renderer/core/css/css_unparsed_declaration_value.h"
#include "third_party/blink/renderer/core/css/css_value_pair.h"
#include "third_party/blink/renderer/core/css/css_value_pool.h"
#include "third_party/blink/renderer/core/css/cssom_utils.h"
#include "third_party/blink/renderer/core/css/properties/css_property.h"
#include "third_party/blink/renderer/core/css/properties/css_property_instances.h"
#include "third_party/blink/renderer/core/css/properties/longhand.h"
#include "third_party/blink/renderer/core/css/properties/longhands.h"
#include "third_party/blink/renderer/core/css/resolver/css_to_style_map.h"
#include "third_party/blink/renderer/core/css_value_keywords.h"
#include "third_party/blink/renderer/core/style_property_shorthand.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h"
#include "third_party/blink/renderer/platform/wtf/text/string_builder.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink {
namespace {
template <typename T>
T ConvertIdentifierTo(const CSSValue* value, T initial_value) { … }
inline WhiteSpaceCollapse ToWhiteSpaceCollapse(const CSSValue* value) { … }
inline TextWrapMode ToTextWrapMode(const CSSValue* value) { … }
inline TextWrapStyle ToTextWrapStyle(const CSSValue* value) { … }
bool IsZeroPercent(const CSSValue* value) { … }
}
StylePropertySerializer::CSSPropertyValueSetForSerializer::
CSSPropertyValueSetForSerializer(const CSSPropertyValueSet& properties)
: … { … }
void StylePropertySerializer::CSSPropertyValueSetForSerializer::Trace(
blink::Visitor* visitor) const { … }
unsigned
StylePropertySerializer::CSSPropertyValueSetForSerializer::PropertyCount()
const { … }
StylePropertySerializer::PropertyValueForSerializer
StylePropertySerializer::CSSPropertyValueSetForSerializer::PropertyAt(
unsigned index) const { … }
bool StylePropertySerializer::CSSPropertyValueSetForSerializer::
ShouldProcessPropertyAt(unsigned index) const { … }
int StylePropertySerializer::CSSPropertyValueSetForSerializer::
FindPropertyIndex(const CSSProperty& property) const { … }
const CSSValue*
StylePropertySerializer::CSSPropertyValueSetForSerializer::GetPropertyCSSValue(
const CSSProperty& property) const { … }
bool StylePropertySerializer::CSSPropertyValueSetForSerializer::
IsDescriptorContext() const { … }
StylePropertySerializer::StylePropertySerializer(
const CSSPropertyValueSet& properties)
: … { … }
String StylePropertySerializer::GetCustomPropertyText(
const PropertyValueForSerializer& property,
bool is_not_first_decl) const { … }
String StylePropertySerializer::GetPropertyText(const CSSPropertyName& name,
const String& value,
bool is_important,
bool is_not_first_decl) const { … }
String StylePropertySerializer::AsText() const { … }
static bool AllowInitialInShorthand(CSSPropertyID property_id) { … }
String StylePropertySerializer::CommonShorthandChecks(
const StylePropertyShorthand& shorthand) const { … }
String StylePropertySerializer::SerializeShorthand(
CSSPropertyID property_id) const { … }
const CSSValue* GetFontStretchKeyword(const CSSValue* font_stretch_value) { … }
bool StylePropertySerializer::AppendFontLonghandValueIfNotNormal(
const CSSProperty& property,
StringBuilder& result) const { … }
String StylePropertySerializer::ContainerValue() const { … }
namespace {
bool IsIdentifier(const CSSValue& value, CSSValueID ident) { … }
bool IsIdentifierPair(const CSSValue& value, CSSValueID ident) { … }
CSSValue* TimelineValueItem(wtf_size_t index,
const CSSValueList& name_list,
const CSSValueList& axis_list,
const CSSValueList* inset_list) { … }
}
String StylePropertySerializer::TimelineValue(
const StylePropertyShorthand& shorthand) const { … }
String StylePropertySerializer::ScrollTimelineValue() const { … }
String StylePropertySerializer::ViewTimelineValue() const { … }
namespace {
std::pair<CSSValueID, double> GetTimelineRangePercent(
const CSSValue& value,
double default_offset_percent) { … }
CSSValue* AnimationRangeShorthandValueItem(wtf_size_t index,
const CSSValueList& start_list,
const CSSValueList& end_list) { … }
}
String StylePropertySerializer::AnimationRangeShorthandValue() const { … }
String StylePropertySerializer::FontValue() const { … }
String StylePropertySerializer::FontVariantValue() const { … }
String StylePropertySerializer::FontSynthesisValue() const { … }
String StylePropertySerializer::OffsetValue() const { … }
String StylePropertySerializer::TextDecorationValue() const { … }
String StylePropertySerializer::Get2Values(
const StylePropertyShorthand& shorthand) const { … }
String StylePropertySerializer::Get4Values(
const StylePropertyShorthand& shorthand) const { … }
namespace {
void SerializeMaskOriginAndClip(StringBuilder& result,
const CSSValueID& origin_id,
const CSSValueID& clip_id) { … }
}
String StylePropertySerializer::GetLayeredShorthandValue(
const StylePropertyShorthand& shorthand) const { … }
String StylePropertySerializer::GetShorthandValue(
const StylePropertyShorthand& shorthand,
String separator) const { … }
String StylePropertySerializer::GetShorthandValueForColumnRule(
const StylePropertyShorthand& shorthand) const { … }
String StylePropertySerializer::GetShorthandValueForColumns(
const StylePropertyShorthand& shorthand) const { … }
String StylePropertySerializer::GetShorthandValueForDoubleBarCombinator(
const StylePropertyShorthand& shorthand) const { … }
String StylePropertySerializer::GetShorthandValueForGrid(
const StylePropertyShorthand& shorthand) const { … }
String StylePropertySerializer::GetShorthandValueForGridArea(
const StylePropertyShorthand& shorthand) const { … }
String StylePropertySerializer::GetShorthandValueForGridLine(
const StylePropertyShorthand& shorthand) const { … }
String StylePropertySerializer::GetShorthandValueForMasonryTrack() const { … }
String StylePropertySerializer::GetShorthandValueForGridTemplate(
const StylePropertyShorthand& shorthand) const { … }
String StylePropertySerializer::GetCommonValue(
const StylePropertyShorthand& shorthand) const { … }
String StylePropertySerializer::BorderPropertyValue(
const StylePropertyShorthand& width,
const StylePropertyShorthand& style,
const StylePropertyShorthand& color) const { … }
String StylePropertySerializer::BorderImagePropertyValue() const { … }
String StylePropertySerializer::BorderRadiusValue() const { … }
String StylePropertySerializer::PageBreakPropertyValue(
const StylePropertyShorthand& shorthand) const { … }
String StylePropertySerializer::ContainIntrinsicSizeValue() const { … }
String StylePropertySerializer::TextBoxValue() const { … }
String StylePropertySerializer::TextSpacingValue() const { … }
String StylePropertySerializer::TextWrapValue() const { … }
String StylePropertySerializer::WhiteSpaceValue() const { … }
String StylePropertySerializer::ScrollStartValue() const { … }
String StylePropertySerializer::ScrollStartTargetValue() const { … }
String StylePropertySerializer::PositionTryValue(
const StylePropertyShorthand& shorthand) const { … }
}