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

Unified Diff: Source/core/css/Pair.h

Issue 24077007: Add support for the object-position CSS property. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase master again Created 7 years, 3 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
« no previous file with comments | « Source/core/css/CSSPropertyNames.in ('k') | Source/core/css/resolver/StyleBuilderCustom.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/Pair.h
diff --git a/Source/core/css/Pair.h b/Source/core/css/Pair.h
index b4446b3d823832031f5b3ca7f199a62d9c8c8267..2c1940f0b5267cd1b4aeda31a481b5c1360edd85 100644
--- a/Source/core/css/Pair.h
+++ b/Source/core/css/Pair.h
@@ -34,52 +34,69 @@ namespace WebCore {
// it (eliminating some extra -webkit- internal properties).
class Pair : public RefCounted<Pair> {
public:
+ enum IdenticalValuesPolicy { DropIdenticalValues, KeepIdenticalValues };
+
static PassRefPtr<Pair> create()
{
return adoptRef(new Pair);
}
- static PassRefPtr<Pair> create(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second)
+ static PassRefPtr<Pair> create(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second, IdenticalValuesPolicy identicalValuesPolicy)
{
- return adoptRef(new Pair(first, second));
+ return adoptRef(new Pair(first, second, identicalValuesPolicy));
}
virtual ~Pair() { }
CSSPrimitiveValue* first() const { return m_first.get(); }
CSSPrimitiveValue* second() const { return m_second.get(); }
+ IdenticalValuesPolicy identicalValuesPolicy() const { return m_identicalValuesPolicy; }
void setFirst(PassRefPtr<CSSPrimitiveValue> first) { m_first = first; }
void setSecond(PassRefPtr<CSSPrimitiveValue> second) { m_second = second; }
+ void setIdenticalValuesPolicy(IdenticalValuesPolicy identicalValuesPolicy) { m_identicalValuesPolicy = identicalValuesPolicy; }
String cssText() const
{
-
- return generateCSSString(first()->cssText(), second()->cssText());
+ return generateCSSString(first()->cssText(), second()->cssText(), m_identicalValuesPolicy);
}
- bool equals(const Pair& other) const { return compareCSSValuePtr(m_first, other.m_first) && compareCSSValuePtr(m_second, other.m_second); }
+ bool equals(const Pair& other) const
+ {
+ return compareCSSValuePtr(m_first, other.m_first)
+ && compareCSSValuePtr(m_second, other.m_second)
+ && m_identicalValuesPolicy == other.m_identicalValuesPolicy;
+ }
String serializeResolvingVariables(const HashMap<AtomicString, String>& variables) const
{
- return generateCSSString(first()->customSerializeResolvingVariables(variables),
- second()->customSerializeResolvingVariables(variables));
+ return generateCSSString(
+ first()->customSerializeResolvingVariables(variables),
+ second()->customSerializeResolvingVariables(variables),
+ m_identicalValuesPolicy);
}
bool hasVariableReference() const { return first()->hasVariableReference() || second()->hasVariableReference(); }
private:
- Pair() : m_first(0), m_second(0) { }
- Pair(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second)
- : m_first(first), m_second(second) { }
+ Pair()
+ : m_first(0)
+ , m_second(0)
+ , m_identicalValuesPolicy(DropIdenticalValues) { }
+
+ Pair(PassRefPtr<CSSPrimitiveValue> first, PassRefPtr<CSSPrimitiveValue> second, IdenticalValuesPolicy identicalValuesPolicy)
+ : m_first(first)
+ , m_second(second)
+ , m_identicalValuesPolicy(identicalValuesPolicy) { }
- static String generateCSSString(const String& first, const String& second)
+ static String generateCSSString(const String& first, const String& second, IdenticalValuesPolicy identicalValuesPolicy)
{
- if (first == second)
+ if (identicalValuesPolicy == DropIdenticalValues && first == second)
return first;
return first + ' ' + second;
}
RefPtr<CSSPrimitiveValue> m_first;
RefPtr<CSSPrimitiveValue> m_second;
+ IdenticalValuesPolicy m_identicalValuesPolicy;
};
} // namespace
« no previous file with comments | « Source/core/css/CSSPropertyNames.in ('k') | Source/core/css/resolver/StyleBuilderCustom.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698