Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(408)

Unified Diff: Source/core/css/resolver/StyleBuilderCustom.cpp

Issue 1306823004: Split out String, URI and CustomIdent from CSSPrimitiveValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@split_out_attr_values
Patch Set: Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/css/resolver/StyleBuilderCustom.cpp
diff --git a/Source/core/css/resolver/StyleBuilderCustom.cpp b/Source/core/css/resolver/StyleBuilderCustom.cpp
index 45353a8a27a38e71ab73a565a234866eb749f8a3..a364eebda0049b3b35fabc94a951d06ae6ffc335 100644
--- a/Source/core/css/resolver/StyleBuilderCustom.cpp
+++ b/Source/core/css/resolver/StyleBuilderCustom.cpp
@@ -572,12 +572,12 @@ void StyleBuilderFunctions::applyValueCSSPropertyWebkitClipPath(StyleResolverSta
state.style()->setClipPath(nullptr);
} else if (primitiveValue->isShape()) {
state.style()->setClipPath(ShapeClipPathOperation::create(basicShapeForValue(state, primitiveValue->getShapeValue())));
- } else if (primitiveValue->isURI()) {
- String cssURLValue = primitiveValue->getStringValue();
- KURL url = state.document().completeURL(cssURLValue);
- // FIXME: It doesn't work with forward or external SVG references (see https://bugs.webkit.org/show_bug.cgi?id=90405)
- state.style()->setClipPath(ReferenceClipPathOperation::create(cssURLValue, AtomicString(url.fragmentIdentifier())));
}
+ } else if (value->isStringValue() && toCSSStringValue(value)->serializationType() == CSSStringValue::SerializeAsURI) {
+ String cssURLValue = toCSSStringValue(value)->getStringValue();
+ KURL url = state.document().completeURL(cssURLValue);
+ // FIXME: It doesn't work with forward or external SVG references (see https://bugs.webkit.org/show_bug.cgi?id=90405)
+ state.style()->setClipPath(ReferenceClipPathOperation::create(cssURLValue, AtomicString(url.fragmentIdentifier())));
}
}
@@ -619,15 +619,14 @@ void StyleBuilderFunctions::applyValueCSSPropertyWebkitTextEmphasisStyle(StyleRe
return;
}
- CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
-
- if (primitiveValue->isString()) {
+ if (value->isStringValue() && toCSSStringValue(value)->serializationType() == CSSStringValue::SerializeAsString) {
state.style()->setTextEmphasisFill(TextEmphasisFillFilled);
state.style()->setTextEmphasisMark(TextEmphasisMarkCustom);
- state.style()->setTextEmphasisCustomMark(AtomicString(primitiveValue->getStringValue()));
+ state.style()->setTextEmphasisCustomMark(AtomicString(toCSSStringValue(value)->getStringValue()));
return;
}
+ CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
state.style()->setTextEmphasisCustomMark(nullAtom);
if (primitiveValue->getValueID() == CSSValueFilled || primitiveValue->getValueID() == CSSValueOpen) {
@@ -729,21 +728,21 @@ void StyleBuilderFunctions::applyValueCSSPropertyContent(StyleResolverState& sta
state.style()->setUnique();
else
state.parentStyle()->setUnique();
- QualifiedName attr(nullAtom, AtomicString(toCSSPrimitiveValue(functionValue->item(0))->getStringValue()), nullAtom);
+ QualifiedName attr(nullAtom, AtomicString(toCSSStringValue(functionValue->item(0))->getStringValue()), nullAtom);
const AtomicString& value = state.element()->getAttribute(attr);
state.style()->setContent(value.isNull() ? emptyString() : value.string(), didSet);
didSet = true;
}
- if (!item->isPrimitiveValue())
+ if (!item->isPrimitiveValue() && !item->isStringValue())
continue;
- CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item.get());
-
- if (contentValue->isString()) {
+ if (item->isStringValue() && toCSSStringValue(item.get())->serializationType() == CSSStringValue::SerializeAsString) {
+ CSSStringValue* contentValue = toCSSStringValue(item.get());
state.style()->setContent(contentValue->getStringValue().impl(), didSet);
didSet = true;
} else {
+ CSSPrimitiveValue* contentValue = toCSSPrimitiveValue(item.get());
switch (contentValue->getValueID()) {
case CSSValueOpenQuote:
state.style()->setContent(OPEN_QUOTE, didSet);
@@ -773,12 +772,11 @@ void StyleBuilderFunctions::applyValueCSSPropertyContent(StyleResolverState& sta
void StyleBuilderFunctions::applyValueCSSPropertyWebkitLocale(StyleResolverState& state, CSSValue* value)
{
- const CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
- if (primitiveValue->getValueID() == CSSValueAuto) {
+ if (value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID() == CSSValueAuto) {
state.style()->setLocale(nullAtom);
} else {
- ASSERT(primitiveValue->isString());
- state.style()->setLocale(AtomicString(primitiveValue->getStringValue()));
+ ASSERT(value->isStringValue());
+ state.style()->setLocale(AtomicString(toCSSStringValue(value)->getStringValue()));
}
state.fontBuilder().setScript(state.style()->locale());
}
« Source/core/css/CSSStringValue.h ('K') | « Source/core/css/resolver/StyleBuilderConverter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698