summaryrefslogtreecommitdiffstats
path: root/WebCore/css
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-05-21 16:53:46 +0100
committerKristian Monsen <kristianm@google.com>2010-05-25 10:24:15 +0100
commit6c2af9490927c3c5959b5cb07461b646f8b32f6c (patch)
treef7111b9b22befab472616c1d50ec94eb50f1ec8c /WebCore/css
parenta149172322a9067c14e8b474a53e63649aa17cad (diff)
downloadexternal_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.zip
external_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.tar.gz
external_webkit-6c2af9490927c3c5959b5cb07461b646f8b32f6c.tar.bz2
Merge WebKit at r59636: Initial merge by git
Change-Id: I59b289c4e6b18425f06ce41cc9d34c522515de91
Diffstat (limited to 'WebCore/css')
-rw-r--r--WebCore/css/CSSHelper.cpp21
-rw-r--r--WebCore/css/CSSMutableStyleDeclaration.cpp10
-rw-r--r--WebCore/css/CSSParser.cpp1
-rw-r--r--WebCore/css/CSSParserValues.h2
-rw-r--r--WebCore/css/CSSPrimitiveValue.cpp34
-rw-r--r--WebCore/css/CSSPrimitiveValue.h4
-rw-r--r--WebCore/css/CSSPrimitiveValueMappings.h59
-rw-r--r--WebCore/css/CSSPropertyLonghand.cpp3
-rw-r--r--WebCore/css/CSSSelector.h25
-rw-r--r--WebCore/css/CSSStyleSelector.cpp138
-rw-r--r--WebCore/css/CSSStyleSelector.h23
-rw-r--r--WebCore/css/CSSValueKeywords.in1
-rw-r--r--WebCore/css/html.css14
13 files changed, 246 insertions, 89 deletions
diff --git a/WebCore/css/CSSHelper.cpp b/WebCore/css/CSSHelper.cpp
index c3418b4..a0daebd 100644
--- a/WebCore/css/CSSHelper.cpp
+++ b/WebCore/css/CSSHelper.cpp
@@ -31,10 +31,12 @@ String deprecatedParseURL(const String& url)
{
StringImpl* i = url.impl();
if (!i)
- return String();
+ return url;
+
+ int length = i->length();
int o = 0;
- int l = i->length();
+ int l = length;
while (0 < l && (*i)[o] <= ' ') {
++o;
@@ -72,11 +74,24 @@ String deprecatedParseURL(const String& url)
while (l > 0 && (*i)[o + l - 1] <= ' ')
--l;
+ const UChar* characters = i->characters();
+
+ // Optimize for the likely case there there is nothing to strip.
+ if (l == length) {
+ int k;
+ for (k = 0; k < length; k++) {
+ if (characters[k] > '\r')
+ break;
+ }
+ if (k == length)
+ return url;
+ }
+
Vector<UChar, 2048> buffer(l);
int nl = 0;
for (int k = o; k < o + l; k++) {
- UChar c = (*i)[k];
+ UChar c = characters[k];
if (c > '\r')
buffer[nl++] = c;
}
diff --git a/WebCore/css/CSSMutableStyleDeclaration.cpp b/WebCore/css/CSSMutableStyleDeclaration.cpp
index 327f398..44e0b17 100644
--- a/WebCore/css/CSSMutableStyleDeclaration.cpp
+++ b/WebCore/css/CSSMutableStyleDeclaration.cpp
@@ -240,10 +240,11 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const
return getLayeredShorthandValue(properties, 4);
}
case CSSPropertyWebkitAnimation: {
- const int properties[6] = { CSSPropertyWebkitAnimationName, CSSPropertyWebkitAnimationDuration,
+ const int properties[7] = { CSSPropertyWebkitAnimationName, CSSPropertyWebkitAnimationDuration,
CSSPropertyWebkitAnimationTimingFunction, CSSPropertyWebkitAnimationDelay,
- CSSPropertyWebkitAnimationIterationCount, CSSPropertyWebkitAnimationDirection };
- return getLayeredShorthandValue(properties, 6);
+ CSSPropertyWebkitAnimationIterationCount, CSSPropertyWebkitAnimationDirection,
+ CSSPropertyWebkitAnimationFillMode };
+ return getLayeredShorthandValue(properties, 7);
}
#if ENABLE(SVG)
case CSSPropertyMarker: {
@@ -484,7 +485,8 @@ void CSSMutableStyleDeclaration::setNeedsStyleRecalc()
while (StyleBase* parent = root->parent())
root = parent;
if (root->isCSSStyleSheet())
- static_cast<CSSStyleSheet*>(root)->doc()->updateStyleSelector();
+ if (Document* doc = static_cast<CSSStyleSheet*>(root)->doc())
+ doc->updateStyleSelector();
}
bool CSSMutableStyleDeclaration::getPropertyPriority(int propertyID) const
diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
index 5ab686f..5f64925 100644
--- a/WebCore/css/CSSParser.cpp
+++ b/WebCore/css/CSSParser.cpp
@@ -312,7 +312,6 @@ bool CSSParser::parseValue(CSSMutableStyleDeclaration* declaration, int id, cons
// possible to set up a default color.
bool CSSParser::parseColor(RGBA32& color, const String& string, bool strict)
{
- color = 0;
CSSParser parser(true);
// First try creating a color specified by name or the "#" syntax.
diff --git a/WebCore/css/CSSParserValues.h b/WebCore/css/CSSParserValues.h
index 1e9767a..a421fe0 100644
--- a/WebCore/css/CSSParserValues.h
+++ b/WebCore/css/CSSParserValues.h
@@ -83,9 +83,9 @@ public:
bool containsVariables() const { return m_variablesCount; }
private:
- Vector<CSSParserValue, 4> m_values;
unsigned m_current;
unsigned m_variablesCount;
+ Vector<CSSParserValue, 4> m_values;
};
struct CSSParserFunction : FastAllocBase {
diff --git a/WebCore/css/CSSPrimitiveValue.cpp b/WebCore/css/CSSPrimitiveValue.cpp
index 210d6f5..e602f86 100644
--- a/WebCore/css/CSSPrimitiveValue.cpp
+++ b/WebCore/css/CSSPrimitiveValue.cpp
@@ -45,6 +45,13 @@ using namespace WTF;
namespace WebCore {
+typedef HashMap<const CSSPrimitiveValue*, String> CSSTextCache;
+static CSSTextCache& cssTextCache()
+{
+ DEFINE_STATIC_LOCAL(CSSTextCache, cache, ());
+ return cache;
+}
+
// A more stylish solution than sharing would be to turn CSSPrimitiveValue (or CSSValues in general) into non-virtual,
// non-refcounted simple type with value semantics. In practice these sharing tricks get similar memory benefits
// with less need for refactoring.
@@ -145,23 +152,27 @@ static const AtomicString& valueOrPropertyName(int valueOrPropertyID)
CSSPrimitiveValue::CSSPrimitiveValue()
: m_type(0)
+ , m_hasCachedCSSText(false)
{
}
CSSPrimitiveValue::CSSPrimitiveValue(int ident)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
m_value.ident = ident;
}
CSSPrimitiveValue::CSSPrimitiveValue(double num, UnitTypes type)
: m_type(type)
+ , m_hasCachedCSSText(false)
{
m_value.num = num;
}
CSSPrimitiveValue::CSSPrimitiveValue(const String& str, UnitTypes type)
: m_type(type)
+ , m_hasCachedCSSText(false)
{
if ((m_value.string = str.impl()))
m_value.string->ref();
@@ -169,11 +180,13 @@ CSSPrimitiveValue::CSSPrimitiveValue(const String& str, UnitTypes type)
CSSPrimitiveValue::CSSPrimitiveValue(RGBA32 color)
: m_type(CSS_RGBCOLOR)
+ , m_hasCachedCSSText(false)
{
m_value.rgbcolor = color;
}
CSSPrimitiveValue::CSSPrimitiveValue(const Length& length)
+ : m_hasCachedCSSText(false)
{
switch (length.type()) {
case Auto:
@@ -206,12 +219,14 @@ CSSPrimitiveValue::CSSPrimitiveValue(const Length& length)
void CSSPrimitiveValue::init(PassRefPtr<Counter> c)
{
m_type = CSS_COUNTER;
+ m_hasCachedCSSText = false;
m_value.counter = c.releaseRef();
}
void CSSPrimitiveValue::init(PassRefPtr<Rect> r)
{
m_type = CSS_RECT;
+ m_hasCachedCSSText = false;
m_value.rect = r.releaseRef();
}
@@ -219,6 +234,7 @@ void CSSPrimitiveValue::init(PassRefPtr<Rect> r)
void CSSPrimitiveValue::init(PassRefPtr<DashboardRegion> r)
{
m_type = CSS_DASHBOARD_REGION;
+ m_hasCachedCSSText = false;
m_value.region = r.releaseRef();
}
#endif
@@ -226,6 +242,7 @@ void CSSPrimitiveValue::init(PassRefPtr<DashboardRegion> r)
void CSSPrimitiveValue::init(PassRefPtr<Pair> p)
{
m_type = CSS_PAIR;
+ m_hasCachedCSSText = false;
m_value.pair = p.releaseRef();
}
@@ -265,7 +282,10 @@ void CSSPrimitiveValue::cleanup()
}
m_type = 0;
- m_cachedCSSText = String();
+ if (m_hasCachedCSSText) {
+ cssTextCache().remove(this);
+ m_hasCachedCSSText = false;
+ }
}
int CSSPrimitiveValue::computeLengthInt(RenderStyle* style, RenderStyle* rootStyle)
@@ -633,8 +653,11 @@ String CSSPrimitiveValue::cssText() const
{
// FIXME: return the original value instead of a generated one (e.g. color
// name if it was specified) - check what spec says about this
- if (!m_cachedCSSText.isNull())
- return m_cachedCSSText;
+
+ if (m_hasCachedCSSText) {
+ ASSERT(cssTextCache().contains(this));
+ return cssTextCache().get(this);
+ }
String text;
switch (m_type) {
@@ -837,7 +860,10 @@ String CSSPrimitiveValue::cssText() const
text = quoteCSSStringIfNeeded(m_value.string);
break;
}
- m_cachedCSSText = text;
+
+ ASSERT(!cssTextCache().contains(this));
+ cssTextCache().set(this, text);
+ m_hasCachedCSSText = true;
return text;
}
diff --git a/WebCore/css/CSSPrimitiveValue.h b/WebCore/css/CSSPrimitiveValue.h
index 943ad04..c2a4dc3 100644
--- a/WebCore/css/CSSPrimitiveValue.h
+++ b/WebCore/css/CSSPrimitiveValue.h
@@ -200,7 +200,8 @@ private:
virtual unsigned short cssValueType() const;
- int m_type;
+ int m_type : 31;
+ mutable unsigned m_hasCachedCSSText : 1;
union {
int ident;
double num;
@@ -211,7 +212,6 @@ private:
Pair* pair;
DashboardRegion* region;
} m_value;
- mutable String m_cachedCSSText;
};
} // namespace WebCore
diff --git a/WebCore/css/CSSPrimitiveValueMappings.h b/WebCore/css/CSSPrimitiveValueMappings.h
index d5876e7..0f302a0 100644
--- a/WebCore/css/CSSPrimitiveValueMappings.h
+++ b/WebCore/css/CSSPrimitiveValueMappings.h
@@ -44,6 +44,7 @@ namespace WebCore {
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBorderStyle e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case BNONE:
@@ -86,6 +87,7 @@ template<> inline CSSPrimitiveValue::operator EBorderStyle() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(CompositeOperator e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case CompositeClear:
@@ -172,6 +174,7 @@ template<> inline CSSPrimitiveValue::operator CompositeOperator() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case NoControlPart:
@@ -272,6 +275,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e)
case MenulistTextFieldPart:
m_value.ident = CSSValueMenulistTextfield;
break;
+ case MeterPart:
+ m_value.ident = CSSValueMeter;
+ break;
case OuterSpinButtonPart:
m_value.ident = CSSValueOuterSpinButton;
break;
@@ -337,6 +343,7 @@ template<> inline CSSPrimitiveValue::operator ControlPart() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillAttachment e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case ScrollBackgroundAttachment:
@@ -368,6 +375,7 @@ template<> inline CSSPrimitiveValue::operator EFillAttachment() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillBox e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case BorderFillBox:
@@ -408,6 +416,7 @@ template<> inline CSSPrimitiveValue::operator EFillBox() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFillRepeat e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case RepeatFill:
@@ -444,6 +453,7 @@ template<> inline CSSPrimitiveValue::operator EFillRepeat() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxAlignment e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case BSTRETCH:
@@ -490,6 +500,7 @@ template<> inline CSSPrimitiveValue::operator EBoxAlignment() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxDirection e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case BNORMAL:
@@ -516,6 +527,7 @@ template<> inline CSSPrimitiveValue::operator EBoxDirection() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxLines e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case SINGLE:
@@ -542,6 +554,7 @@ template<> inline CSSPrimitiveValue::operator EBoxLines() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EBoxOrient e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case HORIZONTAL:
@@ -570,6 +583,7 @@ template<> inline CSSPrimitiveValue::operator EBoxOrient() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECaptionSide e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case CAPLEFT:
@@ -606,6 +620,7 @@ template<> inline CSSPrimitiveValue::operator ECaptionSide() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EClear e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case CNONE:
@@ -642,6 +657,7 @@ template<> inline CSSPrimitiveValue::operator EClear() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ECursor e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case CURSOR_AUTO:
@@ -766,6 +782,7 @@ template<> inline CSSPrimitiveValue::operator ECursor() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDisplay e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case INLINE:
@@ -842,6 +859,7 @@ template<> inline CSSPrimitiveValue::operator EDisplay() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EEmptyCell e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case SHOW:
@@ -868,6 +886,7 @@ template<> inline CSSPrimitiveValue::operator EEmptyCell() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EFloat e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case FNONE:
@@ -900,6 +919,7 @@ template<> inline CSSPrimitiveValue::operator EFloat() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EKHTMLLineBreak e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case LBNORMAL:
@@ -926,6 +946,7 @@ template<> inline CSSPrimitiveValue::operator EKHTMLLineBreak() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStylePosition e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case OUTSIDE:
@@ -944,6 +965,7 @@ template<> inline CSSPrimitiveValue::operator EListStylePosition() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case Afar:
@@ -1192,6 +1214,7 @@ template<> inline CSSPrimitiveValue::operator EListStyleType() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarginCollapse e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case MCOLLAPSE:
@@ -1223,6 +1246,7 @@ template<> inline CSSPrimitiveValue::operator EMarginCollapse() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeBehavior e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case MNONE:
@@ -1259,6 +1283,7 @@ template<> inline CSSPrimitiveValue::operator EMarqueeBehavior() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMarqueeDirection e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case MFORWARD:
@@ -1312,6 +1337,7 @@ template<> inline CSSPrimitiveValue::operator EMarqueeDirection() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EMatchNearestMailBlockquoteColor e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case BCNORMAL:
@@ -1338,6 +1364,7 @@ template<> inline CSSPrimitiveValue::operator EMatchNearestMailBlockquoteColor()
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ENBSPMode e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case NBNORMAL:
@@ -1364,6 +1391,7 @@ template<> inline CSSPrimitiveValue::operator ENBSPMode() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EOverflow e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case OVISIBLE:
@@ -1410,6 +1438,7 @@ template<> inline CSSPrimitiveValue::operator EOverflow() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPageBreak e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case PBAUTO:
@@ -1443,6 +1472,7 @@ template<> inline CSSPrimitiveValue::operator EPageBreak() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPosition e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case StaticPosition:
@@ -1479,6 +1509,7 @@ template<> inline CSSPrimitiveValue::operator EPosition() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EResize e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case RESIZE_BOTH:
@@ -1518,6 +1549,7 @@ template<> inline CSSPrimitiveValue::operator EResize() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETableLayout e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case TAUTO:
@@ -1544,6 +1576,7 @@ template<> inline CSSPrimitiveValue::operator ETableLayout() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAlign e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case TAAUTO:
@@ -1587,6 +1620,7 @@ template<> inline CSSPrimitiveValue::operator ETextAlign() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextSecurity e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case TSNONE:
@@ -1623,6 +1657,7 @@ template<> inline CSSPrimitiveValue::operator ETextSecurity() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextTransform e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case CAPITALIZE:
@@ -1659,6 +1694,7 @@ template<> inline CSSPrimitiveValue::operator ETextTransform() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUnicodeBidi e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case UBNormal:
@@ -1690,6 +1726,7 @@ template<> inline CSSPrimitiveValue::operator EUnicodeBidi() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserDrag e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case DRAG_AUTO:
@@ -1721,6 +1758,7 @@ template<> inline CSSPrimitiveValue::operator EUserDrag() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserModify e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case READ_ONLY:
@@ -1742,6 +1780,7 @@ template<> inline CSSPrimitiveValue::operator EUserModify() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EUserSelect e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case SELECT_NONE:
@@ -1770,6 +1809,7 @@ template<> inline CSSPrimitiveValue::operator EUserSelect() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EVisibility e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case VISIBLE:
@@ -1801,6 +1841,7 @@ template<> inline CSSPrimitiveValue::operator EVisibility() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWhiteSpace e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case NORMAL:
@@ -1847,6 +1888,7 @@ template<> inline CSSPrimitiveValue::operator EWhiteSpace() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordBreak e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case NormalWordBreak:
@@ -1878,6 +1920,7 @@ template<> inline CSSPrimitiveValue::operator EWordBreak() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWordWrap e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case NormalWordWrap:
@@ -1904,6 +1947,7 @@ template<> inline CSSPrimitiveValue::operator EWordWrap() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextDirection e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case LTR:
@@ -1930,6 +1974,7 @@ template<> inline CSSPrimitiveValue::operator TextDirection() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPointerEvents e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case PE_NONE:
@@ -1996,6 +2041,7 @@ template<> inline CSSPrimitiveValue::operator EPointerEvents() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(FontSmoothingMode smoothing)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (smoothing) {
case AutoSmoothing:
@@ -2035,6 +2081,7 @@ template<> inline CSSPrimitiveValue::operator FontSmoothingMode() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextRenderingMode e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case AutoTextRendering:
@@ -2071,6 +2118,7 @@ template<> inline CSSPrimitiveValue::operator TextRenderingMode() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ColorSpace space)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (space) {
case DeviceColorSpace:
@@ -2099,6 +2147,7 @@ template<> inline CSSPrimitiveValue::operator ColorSpace() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineCap e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case ButtCap:
@@ -2130,6 +2179,7 @@ template<> inline CSSPrimitiveValue::operator LineCap() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(LineJoin e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case MiterJoin:
@@ -2161,6 +2211,7 @@ template<> inline CSSPrimitiveValue::operator LineJoin() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(WindRule e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case RULE_NONZERO:
@@ -2188,6 +2239,7 @@ template<> inline CSSPrimitiveValue::operator WindRule() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EAlignmentBaseline e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case AB_AUTO:
@@ -2264,6 +2316,7 @@ template<> inline CSSPrimitiveValue::operator EAlignmentBaseline() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorInterpolation e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case CI_AUTO:
@@ -2295,6 +2348,7 @@ template<> inline CSSPrimitiveValue::operator EColorInterpolation() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EColorRendering e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case CR_AUTO:
@@ -2326,6 +2380,7 @@ template<> inline CSSPrimitiveValue::operator EColorRendering() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EDominantBaseline e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case DB_AUTO:
@@ -2402,6 +2457,7 @@ template<> inline CSSPrimitiveValue::operator EDominantBaseline() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EImageRendering e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case IR_AUTO:
@@ -2433,6 +2489,7 @@ template<> inline CSSPrimitiveValue::operator EImageRendering() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EShapeRendering e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case IR_AUTO:
@@ -2469,6 +2526,7 @@ template<> inline CSSPrimitiveValue::operator EShapeRendering() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAnchor e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case TA_START:
@@ -2500,6 +2558,7 @@ template<> inline CSSPrimitiveValue::operator ETextAnchor() const
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EWritingMode e)
: m_type(CSS_IDENT)
+ , m_hasCachedCSSText(false)
{
switch (e) {
case WM_LRTB:
diff --git a/WebCore/css/CSSPropertyLonghand.cpp b/WebCore/css/CSSPropertyLonghand.cpp
index b45fa0d..a4b3325 100644
--- a/WebCore/css/CSSPropertyLonghand.cpp
+++ b/WebCore/css/CSSPropertyLonghand.cpp
@@ -188,7 +188,8 @@ static void initShorthandMap(ShorthandMap& shorthandMap)
CSSPropertyWebkitAnimationTimingFunction,
CSSPropertyWebkitAnimationDelay,
CSSPropertyWebkitAnimationIterationCount,
- CSSPropertyWebkitAnimationDirection
+ CSSPropertyWebkitAnimationDirection,
+ CSSPropertyWebkitAnimationFillMode
};
SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSSPropertyWebkitAnimation, animationProperties);
diff --git a/WebCore/css/CSSSelector.h b/WebCore/css/CSSSelector.h
index 8f84b05..f97f36d 100644
--- a/WebCore/css/CSSSelector.h
+++ b/WebCore/css/CSSSelector.h
@@ -33,24 +33,24 @@ namespace WebCore {
class CSSSelector : public Noncopyable {
public:
CSSSelector()
- : m_tag(anyQName())
- , m_relation(Descendant)
+ : m_relation(Descendant)
, m_match(None)
, m_pseudoType(PseudoNotParsed)
, m_parsedNth(false)
, m_isLastInSelectorList(false)
, m_hasRareData(false)
+ , m_tag(anyQName())
{
}
CSSSelector(const QualifiedName& qName)
- : m_tag(qName)
- , m_relation(Descendant)
+ : m_relation(Descendant)
, m_match(None)
, m_pseudoType(PseudoNotParsed)
, m_parsedNth(false)
, m_isLastInSelectorList(false)
, m_hasRareData(false)
+ , m_tag(qName)
{
}
@@ -252,9 +252,6 @@ namespace WebCore {
void setLastInSelectorList() { m_isLastInSelectorList = true; }
bool isSimple() const;
- mutable AtomicString m_value;
- QualifiedName m_tag;
-
unsigned m_relation : 3; // enum Relation
mutable unsigned m_match : 4; // enum Match
mutable unsigned m_pseudoType : 8; // PseudoType
@@ -268,24 +265,24 @@ namespace WebCore {
struct RareData : Noncopyable {
RareData(CSSSelector* tagHistory)
- : m_tagHistory(tagHistory)
+ : m_a(0)
+ , m_b(0)
+ , m_tagHistory(tagHistory)
, m_simpleSelector(0)
, m_attribute(anyQName())
, m_argument(nullAtom)
- , m_a(0)
- , m_b(0)
{
}
bool parseNth();
bool matchNth(int count);
+ int m_a; // Used for :nth-*
+ int m_b; // Used for :nth-*
OwnPtr<CSSSelector> m_tagHistory;
OwnPtr<CSSSelector> m_simpleSelector; // Used for :not.
QualifiedName m_attribute; // used for attribute selector
AtomicString m_argument; // Used for :contains, :lang and :nth-*
- int m_a; // Used for :nth-*
- int m_b; // Used for :nth-*
};
void createRareData()
@@ -301,6 +298,10 @@ namespace WebCore {
CSSSelector* m_tagHistory;
RareData* m_rareData;
} m_data;
+
+ public:
+ mutable AtomicString m_value;
+ QualifiedName m_tag;
};
} // namespace WebCore
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index eae36ac..ff650bc 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -414,6 +414,9 @@ CSSStyleSelector::CSSStyleSelector(Document* doc, StyleSheetList* styleSheets, C
bool strictParsing, bool matchAuthorAndUserStyles)
: m_backgroundData(BackgroundFillLayer)
, m_checker(doc, strictParsing)
+ , m_element(0)
+ , m_styledElement(0)
+ , m_elementLinkState(NotInsideLink)
, m_fontSelector(CSSFontSelector::create(doc))
{
init();
@@ -490,8 +493,7 @@ void CSSStyleSelector::addKeyframeStyle(PassRefPtr<WebKitCSSKeyframesRule> rule)
void CSSStyleSelector::init()
{
- m_element = 0;
- m_haveCachedLinkState = false;
+ initElement(0);
m_matchedDecls.clear();
m_ruleList = 0;
m_rootDefaultStyle = 0;
@@ -804,13 +806,20 @@ void CSSStyleSelector::sortMatchedRules(unsigned start, unsigned end)
m_matchedRules[i] = rulesMergeBuffer[i - start];
}
-inline void CSSStyleSelector::initElement(Element* e, bool helperCallForVisitedStyle = false)
+inline EInsideLink CSSStyleSelector::SelectorChecker::determineLinkState(Element* element) const
{
- if (!helperCallForVisitedStyle)
- m_haveCachedLinkState = false;
-
- m_element = e;
- m_styledElement = m_element && m_element->isStyledElement() ? static_cast<StyledElement*>(m_element) : 0;
+ if (!element || !element->isLink())
+ return NotInsideLink;
+ return determineLinkStateSlowCase(element);
+}
+
+inline void CSSStyleSelector::initElement(Element* e)
+{
+ if (m_element != e) {
+ m_element = e;
+ m_styledElement = m_element && m_element->isStyledElement() ? static_cast<StyledElement*>(m_element) : 0;
+ m_elementLinkState = m_checker.determineLinkState(m_element);
+ }
}
inline void CSSStyleSelector::initForStyleResolve(Element* e, RenderStyle* parentStyle, PseudoId pseudoID)
@@ -850,7 +859,7 @@ static inline const AtomicString* linkAttribute(Node* node)
ASSERT(node->isElementNode());
Element* element = static_cast<Element*>(node);
if (element->isHTMLElement())
- return &element->getAttribute(hrefAttr);
+ return &element->fastGetAttribute(hrefAttr);
#if ENABLE(WML)
if (element->isWMLElement()) {
@@ -859,13 +868,13 @@ static inline const AtomicString* linkAttribute(Node* node)
if (element->hasTagName(WMLNames::anchorTag))
return &emptyAtom;
- return &element->getAttribute(hrefAttr);
+ return &element->fastGetAttribute(hrefAttr);
}
#endif
#if ENABLE(SVG)
if (element->isSVGElement())
- return &element->getAttribute(XLinkNames::hrefAttr);
+ return &element->fastGetAttribute(XLinkNames::hrefAttr);
#endif
return 0;
@@ -881,14 +890,6 @@ CSSStyleSelector::SelectorChecker::SelectorChecker(Document* document, bool stri
{
}
-inline EInsideLink CSSStyleSelector::SelectorChecker::determineLinkState(Element* element) const
-{
- if (!element->isLink())
- return NotInsideLink;
- return determineLinkStateSlowCase(element);
-}
-
-
EInsideLink CSSStyleSelector::SelectorChecker::determineLinkStateSlowCase(Element* element) const
{
ASSERT(element->isLink());
@@ -987,11 +988,11 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n)
(s->active() == m_element->active()) &&
(s->focused() == m_element->focused()) &&
(s != s->document()->cssTarget() && m_element != m_element->document()->cssTarget()) &&
- (s->getAttribute(typeAttr) == m_element->getAttribute(typeAttr)) &&
- (s->getAttribute(XMLNames::langAttr) == m_element->getAttribute(XMLNames::langAttr)) &&
- (s->getAttribute(langAttr) == m_element->getAttribute(langAttr)) &&
- (s->getAttribute(readonlyAttr) == m_element->getAttribute(readonlyAttr)) &&
- (s->getAttribute(cellpaddingAttr) == m_element->getAttribute(cellpaddingAttr))) {
+ (s->fastGetAttribute(typeAttr) == m_element->fastGetAttribute(typeAttr)) &&
+ (s->fastGetAttribute(XMLNames::langAttr) == m_element->fastGetAttribute(XMLNames::langAttr)) &&
+ (s->fastGetAttribute(langAttr) == m_element->fastGetAttribute(langAttr)) &&
+ (s->fastGetAttribute(readonlyAttr) == m_element->fastGetAttribute(readonlyAttr)) &&
+ (s->fastGetAttribute(cellpaddingAttr) == m_element->fastGetAttribute(cellpaddingAttr))) {
bool isControl = s->isFormControlElement();
if (isControl != m_element->isFormControlElement())
return false;
@@ -1028,8 +1029,8 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n)
bool classesMatch = true;
if (s->hasClass()) {
- const AtomicString& class1 = m_element->getAttribute(classAttr);
- const AtomicString& class2 = s->getAttribute(classAttr);
+ const AtomicString& class1 = m_element->fastGetAttribute(classAttr);
+ const AtomicString& class2 = s->fastGetAttribute(classAttr);
classesMatch = (class1 == class2);
}
@@ -1039,7 +1040,7 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n)
mappedAttrsMatch = s->mappedAttributes()->mapsEquivalent(m_styledElement->mappedAttributes());
if (mappedAttrsMatch) {
if (s->isLink()) {
- if (currentElementLinkState() != style->insideLink())
+ if (m_elementLinkState != style->insideLink())
return false;
}
return true;
@@ -1132,7 +1133,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForDocument(Document* document)
// If resolveForRootDefault is true, style based on user agent style sheet only. This is used in media queries, where
// relative units are interpreted according to document root element style, styled only with UA stylesheet
-PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyle* defaultParent, bool allowSharing, bool resolveForRootDefault, bool helperCallForVisitedStyle)
+PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyle* defaultParent, bool allowSharing, bool resolveForRootDefault, bool matchVisitedPseudoClass)
{
// Once an element has a renderer, we don't try to destroy it, since otherwise the renderer
// will vanish if a style recalc happens during loading.
@@ -1148,7 +1149,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
return s_styleNotYetAvailable;
}
- initElement(e, helperCallForVisitedStyle);
+ initElement(e);
if (allowSharing) {
RenderStyle* sharedStyle = locateSharedStyle();
if (sharedStyle)
@@ -1158,7 +1159,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
// Compute our style allowing :visited to match first.
RefPtr<RenderStyle> visitedStyle;
- if (!helperCallForVisitedStyle && m_parentStyle && (m_parentStyle->insideLink() || e->isLink()) && e->document()->usesLinkRules()) {
+ if (!matchVisitedPseudoClass && m_parentStyle && (m_parentStyle->insideLink() || e->isLink()) && e->document()->usesLinkRules()) {
// Fetch our parent style.
RenderStyle* parentStyle = m_parentStyle;
if (!e->isLink()) {
@@ -1168,11 +1169,16 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
parentStyle = parentVisitedStyle;
}
visitedStyle = styleForElement(e, parentStyle, false, false, true);
- visitedStyle->setStyleType(VISITED_LINK);
+ if (visitedStyle) {
+ if (m_elementLinkState == InsideUnvisitedLink)
+ visitedStyle = 0; // We made the style to avoid timing attacks. Just throw it away now that we did that, since we don't need it.
+ else
+ visitedStyle->setStyleType(VISITED_LINK);
+ }
initForStyleResolve(e, defaultParent);
}
- m_checker.m_matchVisitedPseudoClass = helperCallForVisitedStyle;
+ m_checker.m_matchVisitedPseudoClass = matchVisitedPseudoClass;
m_style = RenderStyle::create();
@@ -1183,7 +1189,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
if (e->isLink()) {
m_style->setIsLink(true);
- m_style->setInsideLink(currentElementLinkState());
+ m_style->setInsideLink(m_elementLinkState);
}
if (simpleDefaultStyleSheet && !elementCanUseSimpleDefaultStyle(e))
@@ -1298,7 +1304,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
}
// Reset the value back before applying properties, so that -webkit-link knows what color to use.
- m_checker.m_matchVisitedPseudoClass = helperCallForVisitedStyle;
+ m_checker.m_matchVisitedPseudoClass = matchVisitedPseudoClass;
// Now we have all of the matched rules in the appropriate order. Walk the rules and apply
// high-priority properties first, i.e., those properties that other properties depend on.
@@ -1359,6 +1365,9 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
m_style->addCachedPseudoStyle(visitedStyle.release());
}
+ if (!matchVisitedPseudoClass)
+ initElement(0); // Clear out for the next resolve.
+
// Now return the style.
return m_style.release();
}
@@ -1445,27 +1454,32 @@ void CSSStyleSelector::keyframeStylesForAnimation(Element* e, const RenderStyle*
list.clear();
}
-PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle, bool helperCallForVisitedStyle)
+PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle, bool matchVisitedPseudoClass)
{
if (!e)
return 0;
+ initElement(e);
+
// Compute our :visited style first, so that we know whether or not we'll need to create a normal style just to hang it
// off of.
RefPtr<RenderStyle> visitedStyle;
- if (!helperCallForVisitedStyle && parentStyle && parentStyle->insideLink()) {
+ if (!matchVisitedPseudoClass && parentStyle && parentStyle->insideLink()) {
// Fetch our parent style with :visited in effect.
RenderStyle* parentVisitedStyle = parentStyle->getCachedPseudoStyle(VISITED_LINK);
visitedStyle = pseudoStyleForElement(pseudo, e, parentVisitedStyle ? parentVisitedStyle : parentStyle, true);
- if (visitedStyle)
- visitedStyle->setStyleType(VISITED_LINK);
+ if (visitedStyle) {
+ if (m_elementLinkState == InsideUnvisitedLink)
+ visitedStyle = 0; // We made the style to avoid timing attacks. Just throw it away now that we did that.
+ else
+ visitedStyle->setStyleType(VISITED_LINK);
+ }
}
- initElement(e, helperCallForVisitedStyle);
initForStyleResolve(e, parentStyle, pseudo);
m_style = parentStyle;
- m_checker.m_matchVisitedPseudoClass = helperCallForVisitedStyle;
+ m_checker.m_matchVisitedPseudoClass = matchVisitedPseudoClass;
// Since we don't use pseudo-elements in any of our quirk/print user agent rules, don't waste time walking
// those rules.
@@ -1491,7 +1505,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo,
m_lineHeightValue = 0;
// Reset the value back before applying properties, so that -webkit-link knows what color to use.
- m_checker.m_matchVisitedPseudoClass = helperCallForVisitedStyle;
+ m_checker.m_matchVisitedPseudoClass = matchVisitedPseudoClass;
// High-priority properties.
applyDeclarations<true>(false, 0, m_matchedDecls.size() - 1);
@@ -2538,9 +2552,9 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme
while (n && value.isEmpty()) {
if (n->isElementNode()) {
// Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml1/#C_7
- value = static_cast<Element*>(n)->getAttribute(XMLNames::langAttr);
+ value = static_cast<Element*>(n)->fastGetAttribute(XMLNames::langAttr);
if (value.isEmpty())
- value = static_cast<Element*>(n)->getAttribute(langAttr);
+ value = static_cast<Element*>(n)->fastGetAttribute(langAttr);
} else if (n->isDocumentNode())
// checking the MIME content-language
value = static_cast<Document*>(n)->contentLanguage();
@@ -2918,6 +2932,39 @@ void CSSStyleSelector::applyPropertyToStyle(int id, CSSValue *value, RenderStyle
applyProperty(id, value);
}
+inline bool isValidVisitedLinkProperty(int id)
+{
+ switch(static_cast<CSSPropertyID>(id)) {
+ case CSSPropertyBackgroundColor:
+ case CSSPropertyBorderLeftColor:
+ case CSSPropertyBorderRightColor:
+ case CSSPropertyBorderTopColor:
+ case CSSPropertyBorderBottomColor:
+ case CSSPropertyColor:
+ case CSSPropertyOutlineColor:
+ case CSSPropertyWebkitColumnRuleColor:
+ case CSSPropertyWebkitTextFillColor:
+ case CSSPropertyWebkitTextStrokeColor:
+ // Also allow shorthands so that inherit/initial still work.
+ case CSSPropertyBackground:
+ case CSSPropertyBorderLeft:
+ case CSSPropertyBorderRight:
+ case CSSPropertyBorderTop:
+ case CSSPropertyBorderBottom:
+ case CSSPropertyOutline:
+ case CSSPropertyWebkitColumnRule:
+#if ENABLE(SVG)
+ case CSSPropertyFill:
+ case CSSPropertyStroke:
+#endif
+ return true;
+ default:
+ break;
+ }
+
+ return false;
+}
+
void CSSStyleSelector::applyProperty(int id, CSSValue *value)
{
CSSPrimitiveValue* primitiveValue = 0;
@@ -2950,6 +2997,11 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
else if (id == CSSPropertyWebkitPaddingStart)
id = m_style->direction() == LTR ? CSSPropertyPaddingLeft : CSSPropertyPaddingRight;
+ if (m_checker.m_matchVisitedPseudoClass && !isValidVisitedLinkProperty(id)) {
+ // Limit the properties that can be applied to only the ones honored by :visited.
+ return;
+ }
+
// What follows is a list that maps the CSS properties into their corresponding front-end
// RenderStyle values. Shorthands (e.g. border, background) occur in this list as well and
// are only hit when mapping "inherit" or "initial" into front-end values.
diff --git a/WebCore/css/CSSStyleSelector.h b/WebCore/css/CSSStyleSelector.h
index 5089686..fd37c85 100644
--- a/WebCore/css/CSSStyleSelector.h
+++ b/WebCore/css/CSSStyleSelector.h
@@ -87,10 +87,11 @@ public:
~CSSStyleSelector();
void initForStyleResolve(Element*, RenderStyle* parentStyle = 0, PseudoId = NOPSEUDO);
- PassRefPtr<RenderStyle> styleForElement(Element* e, RenderStyle* parentStyle = 0, bool allowSharing = true, bool resolveForRootDefault = false) { return styleForElement(e, parentStyle, allowSharing, resolveForRootDefault, false); }
+ PassRefPtr<RenderStyle> styleForElement(Element* e, RenderStyle* parentStyle = 0, bool allowSharing = true, bool resolveForRootDefault = false, bool matchVisitedPseudoClass = false);
+
void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList& list);
- PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle = 0) { return pseudoStyleForElement(pseudo, e, parentStyle, false); }
+ PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle = 0, bool matchVisitedPseudoClass = false);
static PassRefPtr<RenderStyle> styleForDocument(Document*);
@@ -101,9 +102,7 @@ public:
#endif
private:
- PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle, bool allowSharing, bool resolveForRootDefault, bool helperCallForVisitedStyle);
- PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId, Element*, RenderStyle*, bool helperCallForVisitedStyle);
- void initElement(Element*, bool);
+ void initElement(Element*);
RenderStyle* locateSharedStyle();
Node* locateCousinList(Element* parent, unsigned depth = 1);
bool canShareStyleWithElement(Node*);
@@ -258,19 +257,6 @@ public:
StyleImage* styleImage(CSSValue* value);
-
- EInsideLink currentElementLinkState() const
- {
- if (!m_haveCachedLinkState) {
- m_cachedLinkState = m_checker.determineLinkState(m_element);
- m_haveCachedLinkState = true;
- }
- return m_cachedLinkState;
- }
-
- mutable EInsideLink m_cachedLinkState;
- mutable bool m_haveCachedLinkState;
-
// We collect the set of decls that match in |m_matchedDecls|. We then walk the
// set of matched decls four times, once for those properties that others depend on (like font-size),
// and then a second time for all the remaining properties. We then do the same two passes
@@ -295,6 +281,7 @@ public:
RenderStyle* m_rootElementStyle;
Element* m_element;
StyledElement* m_styledElement;
+ EInsideLink m_elementLinkState;
Node* m_parentNode;
CSSValue* m_lineHeightValue;
bool m_fontDirty;
diff --git a/WebCore/css/CSSValueKeywords.in b/WebCore/css/CSSValueKeywords.in
index 06d966c..a20e64f 100644
--- a/WebCore/css/CSSValueKeywords.in
+++ b/WebCore/css/CSSValueKeywords.in
@@ -589,6 +589,7 @@ menulist
menulist-button
menulist-text
menulist-textfield
+meter
outer-spin-button
progress-bar
progress-bar-value
diff --git a/WebCore/css/html.css b/WebCore/css/html.css
index 01103f4..b4bb05a 100644
--- a/WebCore/css/html.css
+++ b/WebCore/css/html.css
@@ -517,6 +517,20 @@ option {
font-weight: normal;
}
+/* meter */
+
+meter {
+ -webkit-appearance: meter;
+ display: inline-block;
+ height: 1em;
+ width: 5em;
+ vertical-align: -0.2em;
+}
+
+meter::-webkit-meter {
+ -webkit-appearance: meter;
+}
+
/* progress */
progress {