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

Side by Side Diff: sky/engine/core/css/CSSPropertySourceData.cpp

Issue 860423004: Remove css !important (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « sky/engine/core/css/CSSPropertySourceData.h ('k') | sky/engine/core/css/CSSStyleDeclaration.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 Google Inc. All rights reserved. 2 * Copyright (c) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 : start(start) 48 : start(start)
49 , end(end) 49 , end(end)
50 { 50 {
51 } 51 }
52 52
53 unsigned SourceRange::length() const 53 unsigned SourceRange::length() const
54 { 54 {
55 return end - start; 55 return end - start;
56 } 56 }
57 57
58 CSSPropertySourceData::CSSPropertySourceData(const String& name, const String& v alue, bool important, bool disabled, bool parsedOk, const SourceRange& range) 58 CSSPropertySourceData::CSSPropertySourceData(const String& name, const String& v alue, bool disabled, bool parsedOk, const SourceRange& range)
59 : name(name) 59 : name(name)
60 , value(value) 60 , value(value)
61 , important(important)
62 , disabled(disabled) 61 , disabled(disabled)
63 , parsedOk(parsedOk) 62 , parsedOk(parsedOk)
64 , range(range) 63 , range(range)
65 { 64 {
66 } 65 }
67 66
68 CSSPropertySourceData::CSSPropertySourceData(const CSSPropertySourceData& other) 67 CSSPropertySourceData::CSSPropertySourceData(const CSSPropertySourceData& other)
69 : name(other.name) 68 : name(other.name)
70 , value(other.value) 69 , value(other.value)
71 , important(other.important)
72 , disabled(other.disabled) 70 , disabled(other.disabled)
73 , parsedOk(other.parsedOk) 71 , parsedOk(other.parsedOk)
74 , range(other.range) 72 , range(other.range)
75 { 73 {
76 } 74 }
77 75
78 CSSPropertySourceData::CSSPropertySourceData() 76 CSSPropertySourceData::CSSPropertySourceData()
79 : name("") 77 : name("")
80 , value("") 78 , value("")
81 , important(false)
82 , disabled(false) 79 , disabled(false)
83 , parsedOk(false) 80 , parsedOk(false)
84 , range(SourceRange(0, 0)) 81 , range(SourceRange(0, 0))
85 { 82 {
86 } 83 }
87 84
88 String CSSPropertySourceData::toString() const 85 String CSSPropertySourceData::toString() const
89 { 86 {
90 DEFINE_STATIC_LOCAL(String, emptyValue, ("e")); 87 DEFINE_STATIC_LOCAL(String, emptyValue, ("e"));
91 if (!name && value == emptyValue) 88 if (!name && value == emptyValue)
92 return String(); 89 return String();
93 90
94 StringBuilder result; 91 StringBuilder result;
95 if (disabled) 92 if (disabled)
96 result.appendLiteral("/* "); 93 result.appendLiteral("/* ");
97 result.append(name); 94 result.append(name);
98 result.appendLiteral(": "); 95 result.appendLiteral(": ");
99 result.append(value); 96 result.append(value);
100 if (important)
101 result.appendLiteral(" !important");
102 result.append(';'); 97 result.append(';');
103 if (disabled) 98 if (disabled)
104 result.appendLiteral(" */"); 99 result.appendLiteral(" */");
105 return result.toString(); 100 return result.toString();
106 } 101 }
107 102
108 unsigned CSSPropertySourceData::hash() const 103 unsigned CSSPropertySourceData::hash() const
109 { 104 {
110 return StringHash::hash(name) + 3 * StringHash::hash(value) + 7 * important + 13 * parsedOk + 31; 105 return StringHash::hash(name) + 3 * StringHash::hash(value) + 13 * parsedOk + 31;
111 } 106 }
112 107
113 } // namespace blink 108 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/css/CSSPropertySourceData.h ('k') | sky/engine/core/css/CSSStyleDeclaration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698