summaryrefslogtreecommitdiffstats
path: root/WebCore/css
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/css')
-rw-r--r--WebCore/css/CSSComputedStyleDeclaration.cpp23
-rw-r--r--WebCore/css/CSSFontSelector.cpp6
-rw-r--r--WebCore/css/CSSFunctionValue.cpp11
-rw-r--r--WebCore/css/CSSGrammar.y18
-rw-r--r--WebCore/css/CSSImageGeneratorValue.cpp2
-rw-r--r--WebCore/css/CSSImageValue.cpp26
-rw-r--r--WebCore/css/CSSImageValue.h5
-rw-r--r--WebCore/css/CSSImportRule.cpp10
-rw-r--r--WebCore/css/CSSMutableStyleDeclaration.cpp10
-rw-r--r--WebCore/css/CSSNamespace.h30
-rw-r--r--WebCore/css/CSSParser.cpp106
-rw-r--r--WebCore/css/CSSParser.h20
-rw-r--r--WebCore/css/CSSParserValues.h6
-rw-r--r--WebCore/css/CSSPrimitiveValue.cpp3
-rw-r--r--WebCore/css/CSSPrimitiveValueMappings.h11
-rw-r--r--WebCore/css/CSSPropertyNames.in2
-rw-r--r--WebCore/css/CSSSelector.cpp19
-rw-r--r--WebCore/css/CSSSelector.h4
-rw-r--r--WebCore/css/CSSStyleSelector.cpp383
-rw-r--r--WebCore/css/CSSStyleSelector.h43
-rw-r--r--WebCore/css/CSSStyleSheet.cpp25
-rw-r--r--WebCore/css/CSSStyleSheet.h8
-rw-r--r--WebCore/css/CSSValueKeywords.in3
-rw-r--r--WebCore/css/CSSValueList.cpp26
-rw-r--r--WebCore/css/CSSValueList.h4
-rw-r--r--WebCore/css/CSSVariablesDeclaration.cpp2
-rw-r--r--WebCore/css/MediaList.cpp14
-rw-r--r--WebCore/css/MediaList.h4
-rw-r--r--WebCore/css/fullscreen.css27
29 files changed, 522 insertions, 329 deletions
diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp
index cbb9ca8..edb6987 100644
--- a/WebCore/css/CSSComputedStyleDeclaration.cpp
+++ b/WebCore/css/CSSComputedStyleDeclaration.cpp
@@ -404,14 +404,22 @@ PassRefPtr<CSSPrimitiveValue> CSSComputedStyleDeclaration::currentColorOrValidCo
return CSSPrimitiveValue::createColor(color.rgb());
}
-static PassRefPtr<CSSValue> getBorderRadiusCornerValue(IntSize radius)
+static PassRefPtr<CSSValue> getBorderRadiusCornerValue(LengthSize radius)
{
- if (radius.width() == radius.height())
- return CSSPrimitiveValue::create(radius.width(), CSSPrimitiveValue::CSS_PX);
-
RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
- list->append(CSSPrimitiveValue::create(radius.width(), CSSPrimitiveValue::CSS_PX));
- list->append(CSSPrimitiveValue::create(radius.height(), CSSPrimitiveValue::CSS_PX));
+ if (radius.width() == radius.height()) {
+ if (radius.width().type() == Percent)
+ return CSSPrimitiveValue::create(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE);
+ return CSSPrimitiveValue::create(radius.width().value(), CSSPrimitiveValue::CSS_PX);
+ }
+ if (radius.width().type() == Percent)
+ list->append(CSSPrimitiveValue::create(radius.width().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
+ else
+ list->append(CSSPrimitiveValue::create(radius.width().value(), CSSPrimitiveValue::CSS_PX));
+ if (radius.height().type() == Percent)
+ list->append(CSSPrimitiveValue::create(radius.height().percent(), CSSPrimitiveValue::CSS_PERCENTAGE));
+ else
+ list->append(CSSPrimitiveValue::create(radius.height().value(), CSSPrimitiveValue::CSS_PX));
return list.release();
}
@@ -715,6 +723,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
case CSSPropertyBackgroundColor:
return CSSPrimitiveValue::createColor(m_allowVisitedStyle? style->visitedDependentColor(CSSPropertyBackgroundColor).rgb() : style->backgroundColor().rgb());
case CSSPropertyBackgroundImage:
+ // FIXME: Broken for multiple backgrounds. https://bugs.webkit.org/show_bug.cgi?id=44853
if (style->backgroundImage())
return style->backgroundImage()->cssValue();
return CSSPrimitiveValue::createIdentifier(CSSValueNone);
@@ -861,7 +870,7 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
if (cursors && cursors->size() > 0) {
list = CSSValueList::createCommaSeparated();
for (unsigned i = 0; i < cursors->size(); ++i)
- list->append(CSSPrimitiveValue::create((*cursors)[i].image()->url(), CSSPrimitiveValue::CSS_URI));
+ list->append((*cursors)[i].image()->cssValue());
}
RefPtr<CSSValue> value = CSSPrimitiveValue::create(style->cursor());
if (list) {
diff --git a/WebCore/css/CSSFontSelector.cpp b/WebCore/css/CSSFontSelector.cpp
index b98dcae..50627d7 100644
--- a/WebCore/css/CSSFontSelector.cpp
+++ b/WebCore/css/CSSFontSelector.cpp
@@ -356,16 +356,14 @@ void CSSFontSelector::fontLoaded()
{
if (!m_document || m_document->inPageCache() || !m_document->renderer())
return;
- m_document->recalcStyle(Document::Force);
- m_document->renderer()->setNeedsLayoutAndPrefWidthsRecalc();
+ m_document->scheduleForcedStyleRecalc();
}
void CSSFontSelector::fontCacheInvalidated()
{
if (!m_document || m_document->inPageCache() || !m_document->renderer())
return;
- m_document->recalcStyle(Document::Force);
- m_document->renderer()->setNeedsLayoutAndPrefWidthsRecalc();
+ m_document->scheduleForcedStyleRecalc();
}
static FontData* fontDataForGenericFamily(Document* document, const FontDescription& fontDescription, const AtomicString& familyName)
diff --git a/WebCore/css/CSSFunctionValue.cpp b/WebCore/css/CSSFunctionValue.cpp
index 0fc260d..70e8174 100644
--- a/WebCore/css/CSSFunctionValue.cpp
+++ b/WebCore/css/CSSFunctionValue.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2008, 2010 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,15 +25,17 @@
#include "config.h"
#include "CSSFunctionValue.h"
+
#include "CSSValueList.h"
+#include <wtf/PassOwnPtr.h>
namespace WebCore {
CSSFunctionValue::CSSFunctionValue(CSSParserFunction* function)
+ : m_name(function->name)
{
- m_name = function->name;
if (function->args)
- m_args = CSSValueList::createFromParserValueList(function->args);
+ m_args = CSSValueList::createFromParserValueList(function->args.get());
}
CSSFunctionValue::~CSSFunctionValue()
@@ -58,7 +60,8 @@ CSSParserValue CSSFunctionValue::parserValue() const
val.function = new CSSParserFunction;
val.function->name.characters = const_cast<UChar*>(m_name.characters());
val.function->name.length = m_name.length();
- val.function->args = m_args ? m_args->createParserValueList() : 0;
+ if (m_args)
+ val.function->args = m_args->createParserValueList();
return val;
}
diff --git a/WebCore/css/CSSGrammar.y b/WebCore/css/CSSGrammar.y
index 26b2ba8..ec507be 100644
--- a/WebCore/css/CSSGrammar.y
+++ b/WebCore/css/CSSGrammar.y
@@ -2,7 +2,7 @@
/*
* Copyright (C) 2002-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
* Copyright (C) 2008 Eric Seidel <eric@webkit.org>
*
@@ -34,6 +34,7 @@
#include "Document.h"
#include "HTMLNames.h"
#include "MediaList.h"
+#include "MediaQueryExp.h"
#include "WebKitCSSKeyframeRule.h"
#include "WebKitCSSKeyframesRule.h"
#include <wtf/FastMalloc.h>
@@ -98,7 +99,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser)
%}
-%expect 55
+%expect 56
%nonassoc LOWEST_PREC
@@ -201,6 +202,7 @@ static int cssyylex(YYSTYPE* yylval, void* parser)
%type <relation> combinator
%type <rule> charset
+%type <rule> ignored_charset
%type <rule> ruleset
%type <rule> media
%type <rule> import
@@ -389,6 +391,13 @@ charset:
}
;
+ignored_charset:
+ CHARSET_SYM maybe_space STRING maybe_space ';' {
+ // Ignore any @charset rule not at the beginning of the style sheet.
+ $$ = 0;
+ }
+;
+
rule_list:
/* empty */
| rule_list rule maybe_sgml {
@@ -413,6 +422,7 @@ rule:
valid_rule {
static_cast<CSSParser*>(parser)->m_hadSyntacticallyValidCSSRule = true;
}
+ | ignored_charset
| invalid_rule
| invalid_at
;
@@ -617,11 +627,11 @@ media_query_exp_list:
media_query_exp {
CSSParser* p = static_cast<CSSParser*>(parser);
$$ = p->createFloatingMediaQueryExpList();
- $$->append(p->sinkFloatingMediaQueryExp($1));
+ $$->append(p->sinkFloatingMediaQueryExp($1).leakPtr());
}
| media_query_exp_list maybe_space MEDIA_AND maybe_space media_query_exp {
$$ = $1;
- $$->append(static_cast<CSSParser*>(parser)->sinkFloatingMediaQueryExp($5));
+ $$->append(static_cast<CSSParser*>(parser)->sinkFloatingMediaQueryExp($5).leakPtr());
}
;
diff --git a/WebCore/css/CSSImageGeneratorValue.cpp b/WebCore/css/CSSImageGeneratorValue.cpp
index 4cf0873..784f438 100644
--- a/WebCore/css/CSSImageGeneratorValue.cpp
+++ b/WebCore/css/CSSImageGeneratorValue.cpp
@@ -86,6 +86,8 @@ Image* CSSImageGeneratorValue::getImage(RenderObject* renderer, const IntSize& s
SizeCountPair& sizeCount = it->second;
IntSize oldSize = sizeCount.first;
if (oldSize != size) {
+ // If renderer is the only client, make sure we don't delete this.
+ RefPtr<CSSImageGeneratorValue> protect(this);
removeClient(renderer);
addClient(renderer, size);
}
diff --git a/WebCore/css/CSSImageValue.cpp b/WebCore/css/CSSImageValue.cpp
index 96a8dec..dc2d700 100644
--- a/WebCore/css/CSSImageValue.cpp
+++ b/WebCore/css/CSSImageValue.cpp
@@ -26,6 +26,7 @@
#include "CachedImage.h"
#include "DocLoader.h"
#include "StyleCachedImage.h"
+#include "StylePendingImage.h"
namespace WebCore {
@@ -43,8 +44,19 @@ CSSImageValue::CSSImageValue()
CSSImageValue::~CSSImageValue()
{
- if (m_image)
- m_image->cachedImage()->removeClient(this);
+ if (m_image && m_image->isCachedImage())
+ static_cast<StyleCachedImage*>(m_image.get())->cachedImage()->removeClient(this);
+}
+
+StyleImage* CSSImageValue::cachedOrPendingImage()
+{
+ if (getIdent() == CSSValueNone)
+ return 0;
+
+ if (!m_image)
+ m_image = StylePendingImage::create(this);
+
+ return m_image.get();
}
StyleCachedImage* CSSImageValue::cachedImage(DocLoader* loader)
@@ -71,20 +83,20 @@ StyleCachedImage* CSSImageValue::cachedImage(DocLoader* loader, const String& ur
}
}
- return m_image.get();
+ return m_image->isCachedImage() ? static_cast<StyleCachedImage*>(m_image.get()) : 0;
}
String CSSImageValue::cachedImageURL()
{
- if (!m_image)
+ if (!m_image || !m_image->isCachedImage())
return String();
- return m_image->cachedImage()->url();
+ return static_cast<StyleCachedImage*>(m_image.get())->cachedImage()->url();
}
void CSSImageValue::clearCachedImage()
{
- if (m_image)
- m_image->cachedImage()->removeClient(this);
+ if (m_image && m_image->isCachedImage())
+ static_cast<StyleCachedImage*>(m_image.get())->cachedImage()->removeClient(this);
m_image = 0;
m_accessedImage = false;
}
diff --git a/WebCore/css/CSSImageValue.h b/WebCore/css/CSSImageValue.h
index a1715cd..4205c4f 100644
--- a/WebCore/css/CSSImageValue.h
+++ b/WebCore/css/CSSImageValue.h
@@ -29,6 +29,7 @@ namespace WebCore {
class DocLoader;
class StyleCachedImage;
+class StyleImage;
class CSSImageValue : public CSSPrimitiveValue, private CachedResourceClient {
public:
@@ -37,6 +38,8 @@ public:
virtual ~CSSImageValue();
virtual StyleCachedImage* cachedImage(DocLoader*);
+ // Returns a StyleCachedImage if the image is cached already, otherwise a StylePendingImage.
+ StyleImage* cachedOrPendingImage();
virtual bool isImageValue() const { return true; }
@@ -50,7 +53,7 @@ protected:
private:
CSSImageValue();
- RefPtr<StyleCachedImage> m_image;
+ RefPtr<StyleImage> m_image;
bool m_accessedImage;
};
diff --git a/WebCore/css/CSSImportRule.cpp b/WebCore/css/CSSImportRule.cpp
index b4d7e69..cc6083e 100644
--- a/WebCore/css/CSSImportRule.cpp
+++ b/WebCore/css/CSSImportRule.cpp
@@ -1,7 +1,7 @@
/*
* (C) 1999-2003 Lars Knoll (knoll@kde.org)
* (C) 2002-2003 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2002, 2005, 2006, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -65,7 +65,7 @@ void CSSImportRule::setCSSStyleSheet(const String& href, const KURL& baseURL, co
CSSStyleSheet* parent = parentStyleSheet();
bool strict = !parent || parent->useStrictParsing();
bool enforceMIMEType = strict;
- bool needsSiteSpecificQuirks = parent && parent->doc() && parent->doc()->settings() && parent->doc()->settings()->needsSiteSpecificQuirks();
+ bool needsSiteSpecificQuirks = parent && parent->document() && parent->document()->settings() && parent->document()->settings()->needsSiteSpecificQuirks();
#if defined(BUILDING_ON_TIGER) || defined(BUILDING_ON_LEOPARD)
if (enforceMIMEType && needsSiteSpecificQuirks) {
@@ -78,7 +78,7 @@ void CSSImportRule::setCSSStyleSheet(const String& href, const KURL& baseURL, co
String sheetText = sheet->sheetText(enforceMIMEType, &validMIMEType);
m_styleSheet->parseString(sheetText, strict);
- if (!parent || !parent->doc() || !parent->doc()->securityOrigin()->canRequest(baseURL))
+ if (!parent || !parent->document() || !parent->document()->securityOrigin()->canRequest(baseURL))
crossOriginCSS = true;
if (crossOriginCSS && !validMIMEType && !m_styleSheet->hasSyntacticallyValidCSSHeader())
@@ -115,7 +115,7 @@ void CSSImportRule::insertedIntoParent()
if (!parentSheet)
return;
- DocLoader* docLoader = parentSheet->doc()->docLoader();
+ DocLoader* docLoader = parentSheet->document()->docLoader();
if (!docLoader)
return;
@@ -143,7 +143,7 @@ void CSSImportRule::insertedIntoParent()
// removed from the pending sheet count, so let the doc know
// the sheet being imported is pending.
if (parentSheet && parentSheet->loadCompleted() && root == parentSheet)
- parentSheet->doc()->addPendingSheet();
+ parentSheet->document()->addPendingSheet();
m_loading = true;
m_cachedSheet->addClient(this);
}
diff --git a/WebCore/css/CSSMutableStyleDeclaration.cpp b/WebCore/css/CSSMutableStyleDeclaration.cpp
index e3fed35..f620be1 100644
--- a/WebCore/css/CSSMutableStyleDeclaration.cpp
+++ b/WebCore/css/CSSMutableStyleDeclaration.cpp
@@ -1,6 +1,6 @@
/*
* (C) 1999-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -499,13 +499,13 @@ void CSSMutableStyleDeclaration::setNeedsStyleRecalc()
return;
}
- // FIXME: quick&dirty hack for KDE 3.0... make this MUCH better! (Dirk)
StyleBase* root = this;
while (StyleBase* parent = root->parent())
root = parent;
- if (root->isCSSStyleSheet())
- if (Document* doc = static_cast<CSSStyleSheet*>(root)->doc())
- doc->updateStyleSelector();
+ if (root->isCSSStyleSheet()) {
+ if (Document* document = static_cast<CSSStyleSheet*>(root)->document())
+ document->styleSelectorChanged(DeferRecalcStyle);
+ }
}
bool CSSMutableStyleDeclaration::getPropertyPriority(int propertyID) const
diff --git a/WebCore/css/CSSNamespace.h b/WebCore/css/CSSNamespace.h
index d7fab4c..6225c36 100644
--- a/WebCore/css/CSSNamespace.h
+++ b/WebCore/css/CSSNamespace.h
@@ -1,7 +1,7 @@
/*
* Copyright (C) 1999-2003 Lars Knoll (knoll@kde.org)
* 1999 Waldo Bastian (bastian@kde.org)
- * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ * Copyright (C) 2004, 2006, 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -27,27 +27,23 @@
namespace WebCore {
struct CSSNamespace : Noncopyable {
- AtomicString m_prefix;
- AtomicString m_uri;
- CSSNamespace* m_parent;
-
- CSSNamespace(const AtomicString& prefix, const AtomicString& uri, CSSNamespace* parent)
- : m_prefix(prefix)
- , m_uri(uri)
- , m_parent(parent)
+ AtomicString prefix;
+ AtomicString uri;
+ OwnPtr<CSSNamespace> parent;
+
+ CSSNamespace(const AtomicString& prefix, const AtomicString& uri, PassOwnPtr<CSSNamespace> parent)
+ : prefix(prefix)
+ , uri(uri)
+ , parent(parent)
{
}
- ~CSSNamespace() { delete m_parent; }
-
- const AtomicString& uri() { return m_uri; }
- const AtomicString& prefix() { return m_prefix; }
CSSNamespace* namespaceForPrefix(const AtomicString& prefix)
{
- if (prefix == m_prefix)
- return this;
- if (m_parent)
- return m_parent->namespaceForPrefix(prefix);
+ for (CSSNamespace* candidate = this; candidate; candidate = candidate->parent.get()) {
+ if (candidate->prefix == prefix)
+ return candidate;
+ }
return 0;
}
};
diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
index f511507..07cd300 100644
--- a/WebCore/css/CSSParser.cpp
+++ b/WebCore/css/CSSParser.cpp
@@ -138,7 +138,6 @@ CSSParser::CSSParser(bool strictParsing)
, m_important(false)
, m_id(0)
, m_styleSheet(0)
- , m_mediaQuery(0)
, m_valueList(0)
, m_parsedProperties(static_cast<CSSProperty**>(fastMalloc(32 * sizeof(CSSProperty*))))
, m_numParsedProperties(0)
@@ -160,9 +159,6 @@ CSSParser::CSSParser(bool strictParsing)
, m_allowImportRules(true)
, m_allowVariablesRules(true)
, m_allowNamespaceDeclarations(true)
- , m_floatingMediaQuery(0)
- , m_floatingMediaQueryExp(0)
- , m_floatingMediaQueryExpList(0)
{
#if YYDEBUG > 0
cssyydebug = 1;
@@ -180,12 +176,8 @@ CSSParser::~CSSParser()
fastFree(m_data);
- if (m_floatingMediaQueryExpList) {
+ if (m_floatingMediaQueryExpList)
deleteAllValues(*m_floatingMediaQueryExpList);
- delete m_floatingMediaQueryExpList;
- }
- delete m_floatingMediaQueryExp;
- delete m_floatingMediaQuery;
fastDeleteAllValues(m_floatingSelectors);
deleteAllValues(m_floatingValueLists);
deleteAllValues(m_floatingFunctions);
@@ -409,10 +401,15 @@ bool CSSParser::parseMediaQuery(MediaList* queries, const String& string)
if (string.isEmpty())
return true;
+<<<<<<< HEAD
#ifdef ANDROID_INSTRUMENT
android::TimeCounter::start(android::TimeCounter::CSSParseTimeCounter);
#endif
m_mediaQuery = 0;
+=======
+ ASSERT(!m_mediaQuery);
+
+>>>>>>> webkit.org at r66666
// can't use { because tokenizer state switches from mediaquery to initial state when it sees { token.
// instead insert one " " (which is WHITESPACE in CSSGrammar.y)
setupParser("@-webkit-mediaquery ", string, "} ");
@@ -421,8 +418,7 @@ bool CSSParser::parseMediaQuery(MediaList* queries, const String& string)
bool ok = false;
if (m_mediaQuery) {
ok = true;
- queries->appendMediaQuery(m_mediaQuery);
- m_mediaQuery = 0;
+ queries->appendMediaQuery(m_mediaQuery.release());
}
#ifdef ANDROID_INSTRUMENT
@@ -466,12 +462,13 @@ void CSSParser::clearProperties()
Document* CSSParser::document() const
{
StyleBase* root = m_styleSheet;
- Document* doc = 0;
while (root && root->parent())
root = root->parent();
- if (root && root->isCSSStyleSheet())
- doc = static_cast<CSSStyleSheet*>(root)->doc();
- return doc;
+ if (!root)
+ return 0;
+ if (!root->isCSSStyleSheet())
+ return 0;
+ return static_cast<CSSStyleSheet*>(root)->document();
}
bool CSSParser::validUnit(CSSParserValue* value, Units unitflags, bool strict)
@@ -1219,14 +1216,14 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyBorderBottomRightRadius: {
if (num != 1 && num != 2)
return false;
- validPrimitive = validUnit(value, FLength, m_strict);
+ validPrimitive = validUnit(value, FLength | FPercent, m_strict);
if (!validPrimitive)
return false;
RefPtr<CSSPrimitiveValue> parsedValue1 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
RefPtr<CSSPrimitiveValue> parsedValue2;
if (num == 2) {
value = m_valueList->next();
- validPrimitive = validUnit(value, FLength, m_strict);
+ validPrimitive = validUnit(value, FLength | FPercent, m_strict);
if (!validPrimitive)
return false;
parsedValue2 = CSSPrimitiveValue::create(value->fValue, (CSSPrimitiveValue::UnitTypes)value->unit);
@@ -1242,7 +1239,7 @@ bool CSSParser::parseValue(int propId, bool important)
case CSSPropertyWebkitBorderRadius:
return parseBorderRadius(propId, important);
case CSSPropertyOutlineOffset:
- validPrimitive = validUnit(value, FLength, m_strict);
+ validPrimitive = validUnit(value, FLength | FPercent, m_strict);
break;
case CSSPropertyTextShadow: // CSS2 property, dropped in CSS2.1, back in CSS3, so treat as CSS3
case CSSPropertyWebkitBoxShadow:
@@ -2363,7 +2360,7 @@ bool CSSParser::parseContent(int propId, bool important)
parsedValue = CSSImageValue::create(m_styleSheet->completeURL(val->string));
} else if (val->unit == CSSParserValue::Function) {
// attr(X) | counter(X [,Y]) | counters(X, Y, [,Z]) | -webkit-gradient(...)
- CSSParserValueList* args = val->function->args;
+ CSSParserValueList* args = val->function->args.get();
if (!args)
return false;
if (equalIgnoringCase(val->function->name, "attr(")) {
@@ -2913,7 +2910,7 @@ PassRefPtr<CSSValue> CSSParser::parseAnimationTimingFunction()
return 0;
// The only timing function we accept for now is a cubic bezier function. 4 points must be specified.
- CSSParserValueList* args = value->function->args;
+ CSSParserValueList* args = value->function->args.get();
if (!equalIgnoringCase(value->function->name, "cubic-bezier(") || !args || args->size() != 7)
return 0;
@@ -3088,7 +3085,7 @@ bool CSSParser::parseDashboardRegions(int propId, bool important)
// also allow
// dashboard-region(label, type) or dashboard-region(label type)
// dashboard-region(label, type) or dashboard-region(label type)
- CSSParserValueList* args = value->function->args;
+ CSSParserValueList* args = value->function->args.get();
if (!equalIgnoringCase(value->function->name, "dashboard-region(") || !args) {
valid = false;
break;
@@ -3234,7 +3231,7 @@ PassRefPtr<CSSValue> CSSParser::parseCounterContent(CSSParserValueList* args, bo
bool CSSParser::parseShape(int propId, bool important)
{
CSSParserValue* value = m_valueList->current();
- CSSParserValueList* args = value->function->args;
+ CSSParserValueList* args = value->function->args.get();
if (!equalIgnoringCase(value->function->name, "rect(") || !args)
return false;
@@ -3598,7 +3595,7 @@ bool CSSParser::parseFontWeight(bool important)
static bool isValidFormatFunction(CSSParserValue* val)
{
- CSSParserValueList* args = val->function->args;
+ CSSParserValueList* args = val->function->args.get();
return equalIgnoringCase(val->function->name, "format(") && (args->current()->unit == CSSPrimitiveValue::CSS_STRING || args->current()->unit == CSSPrimitiveValue::CSS_IDENT);
}
@@ -3621,7 +3618,7 @@ bool CSSParser::parseFontFaceSrc()
expectComma = true;
} else if (val->unit == CSSParserValue::Function) {
// There are two allowed functions: local() and format().
- CSSParserValueList* args = val->function->args;
+ CSSParserValueList* args = val->function->args.get();
if (args && args->size() == 1) {
if (equalIgnoringCase(val->function->name, "local(") && !expectComma) {
expectComma = true;
@@ -3959,7 +3956,7 @@ static inline int colorIntFromValue(CSSParserValue* v)
bool CSSParser::parseColorParameters(CSSParserValue* value, int* colorArray, bool parseAlpha)
{
- CSSParserValueList* args = value->function->args;
+ CSSParserValueList* args = value->function->args.get();
CSSParserValue* v = args->current();
Units unitType = FUnknown;
// Get the first value and its type
@@ -4000,7 +3997,7 @@ bool CSSParser::parseColorParameters(CSSParserValue* value, int* colorArray, boo
// The first value, HUE, is in an angle with a value between 0 and 360
bool CSSParser::parseHSLParameters(CSSParserValue* value, double* colorArray, bool parseAlpha)
{
- CSSParserValueList* args = value->function->args;
+ CSSParserValueList* args = value->function->args.get();
CSSParserValue* v = args->current();
// Get the first value
if (!validUnit(v, FNumber, true))
@@ -4549,7 +4546,7 @@ bool CSSParser::parseBorderRadius(int propId, bool important)
if (i - indexAfterSlash >= 4)
return false;
- if (!validUnit(value, FLength, m_strict))
+ if (!validUnit(value, FLength | FPercent, m_strict))
return false;
RefPtr<CSSPrimitiveValue> radius = CSSPrimitiveValue::create(value->fValue, static_cast<CSSPrimitiveValue::UnitTypes>(value->unit));
@@ -4649,7 +4646,7 @@ static bool parseGradientColorStop(CSSParser* p, CSSParserValue* a, CSSGradientC
!equalIgnoringCase(a->function->name, "color-stop("))
return false;
- CSSParserValueList* args = a->function->args;
+ CSSParserValueList* args = a->function->args.get();
if (!args)
return false;
@@ -4708,7 +4705,7 @@ bool CSSParser::parseGradient(RefPtr<CSSValue>& gradient)
RefPtr<CSSGradientValue> result = CSSGradientValue::create();
// Walk the arguments.
- CSSParserValueList* args = m_valueList->current()->function->args;
+ CSSParserValueList* args = m_valueList->current()->function->args.get();
if (!args || args->size() == 0)
return false;
@@ -4829,7 +4826,7 @@ bool CSSParser::parseCanvas(RefPtr<CSSValue>& canvas)
RefPtr<CSSCanvasValue> result = CSSCanvasValue::create();
// Walk the arguments.
- CSSParserValueList* args = m_valueList->current()->function->args;
+ CSSParserValueList* args = m_valueList->current()->function->args.get();
if (!args || args->size() != 1)
return false;
@@ -4949,7 +4946,7 @@ PassRefPtr<CSSValueList> CSSParser::parseTransform()
return 0;
// Every primitive requires at least one argument.
- CSSParserValueList* args = value->function->args;
+ CSSParserValueList* args = value->function->args.get();
if (!args)
return 0;
@@ -5371,52 +5368,45 @@ CSSParserValue& CSSParser::sinkFloatingValue(CSSParserValue& value)
MediaQueryExp* CSSParser::createFloatingMediaQueryExp(const AtomicString& mediaFeature, CSSParserValueList* values)
{
- delete m_floatingMediaQueryExp;
- m_floatingMediaQueryExp = new MediaQueryExp(mediaFeature, values);
- return m_floatingMediaQueryExp;
+ m_floatingMediaQueryExp = adoptPtr(new MediaQueryExp(mediaFeature, values));
+ return m_floatingMediaQueryExp.get();
}
-MediaQueryExp* CSSParser::sinkFloatingMediaQueryExp(MediaQueryExp* e)
+PassOwnPtr<MediaQueryExp> CSSParser::sinkFloatingMediaQueryExp(MediaQueryExp* expression)
{
- ASSERT(e == m_floatingMediaQueryExp);
- m_floatingMediaQueryExp = 0;
- return e;
+ ASSERT_UNUSED(expression, expression == m_floatingMediaQueryExp);
+ return m_floatingMediaQueryExp.release();
}
Vector<MediaQueryExp*>* CSSParser::createFloatingMediaQueryExpList()
{
- if (m_floatingMediaQueryExpList) {
+ if (m_floatingMediaQueryExpList)
deleteAllValues(*m_floatingMediaQueryExpList);
- delete m_floatingMediaQueryExpList;
- }
- m_floatingMediaQueryExpList = new Vector<MediaQueryExp*>;
- return m_floatingMediaQueryExpList;
+ m_floatingMediaQueryExpList = adoptPtr(new Vector<MediaQueryExp*>);
+ return m_floatingMediaQueryExpList.get();
}
-Vector<MediaQueryExp*>* CSSParser::sinkFloatingMediaQueryExpList(Vector<MediaQueryExp*>* l)
+PassOwnPtr<Vector<MediaQueryExp*> > CSSParser::sinkFloatingMediaQueryExpList(Vector<MediaQueryExp*>* list)
{
- ASSERT(l == m_floatingMediaQueryExpList);
- m_floatingMediaQueryExpList = 0;
- return l;
+ ASSERT_UNUSED(list, list == m_floatingMediaQueryExpList);
+ return m_floatingMediaQueryExpList.release();
}
-MediaQuery* CSSParser::createFloatingMediaQuery(MediaQuery::Restrictor r, const String& mediaType, Vector<MediaQueryExp*>* exprs)
+MediaQuery* CSSParser::createFloatingMediaQuery(MediaQuery::Restrictor restrictor, const String& mediaType, PassOwnPtr<Vector<MediaQueryExp*> > expressions)
{
- delete m_floatingMediaQuery;
- m_floatingMediaQuery = new MediaQuery(r, mediaType, exprs);
- return m_floatingMediaQuery;
+ m_floatingMediaQuery = adoptPtr(new MediaQuery(restrictor, mediaType, expressions));
+ return m_floatingMediaQuery.get();
}
-MediaQuery* CSSParser::createFloatingMediaQuery(Vector<MediaQueryExp*>* exprs)
+MediaQuery* CSSParser::createFloatingMediaQuery(PassOwnPtr<Vector<MediaQueryExp*> > expressions)
{
- return createFloatingMediaQuery(MediaQuery::None, "all", exprs);
+ return createFloatingMediaQuery(MediaQuery::None, "all", expressions);
}
-MediaQuery* CSSParser::sinkFloatingMediaQuery(MediaQuery* mq)
+PassOwnPtr<MediaQuery> CSSParser::sinkFloatingMediaQuery(MediaQuery* query)
{
- ASSERT(mq == m_floatingMediaQuery);
- m_floatingMediaQuery = 0;
- return mq;
+ ASSERT_UNUSED(query, query == m_floatingMediaQuery);
+ return m_floatingMediaQuery.release();
}
MediaList* CSSParser::createMediaList()
@@ -5678,7 +5668,7 @@ bool CSSParser::checkForVariables(CSSParserValueList* valueList)
break;
}
- if (valueList->valueAt(i)->unit == CSSParserValue::Function && checkForVariables(valueList->valueAt(i)->function->args)) {
+ if (valueList->valueAt(i)->unit == CSSParserValue::Function && checkForVariables(valueList->valueAt(i)->function->args.get())) {
hasVariables = true;
break;
}
diff --git a/WebCore/css/CSSParser.h b/WebCore/css/CSSParser.h
index 1e233c8..6211e62 100644
--- a/WebCore/css/CSSParser.h
+++ b/WebCore/css/CSSParser.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
* Copyright (C) 2008 Eric Seidel <eric@webkit.org>
* Copyright (C) 2009 - 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
*
@@ -194,12 +194,12 @@ namespace WebCore {
void endDeclarationsForMarginBox();
MediaQueryExp* createFloatingMediaQueryExp(const AtomicString&, CSSParserValueList*);
- MediaQueryExp* sinkFloatingMediaQueryExp(MediaQueryExp*);
+ PassOwnPtr<MediaQueryExp> sinkFloatingMediaQueryExp(MediaQueryExp*);
Vector<MediaQueryExp*>* createFloatingMediaQueryExpList();
- Vector<MediaQueryExp*>* sinkFloatingMediaQueryExpList(Vector<MediaQueryExp*>*);
- MediaQuery* createFloatingMediaQuery(MediaQuery::Restrictor, const String&, Vector<MediaQueryExp*>*);
- MediaQuery* createFloatingMediaQuery(Vector<MediaQueryExp*>*);
- MediaQuery* sinkFloatingMediaQuery(MediaQuery*);
+ PassOwnPtr<Vector<MediaQueryExp*> > sinkFloatingMediaQueryExpList(Vector<MediaQueryExp*>*);
+ MediaQuery* createFloatingMediaQuery(MediaQuery::Restrictor, const String&, PassOwnPtr<Vector<MediaQueryExp*> >);
+ MediaQuery* createFloatingMediaQuery(PassOwnPtr<Vector<MediaQueryExp*> >);
+ PassOwnPtr<MediaQuery> sinkFloatingMediaQuery(MediaQuery*);
void addNamespace(const AtomicString& prefix, const AtomicString& uri);
@@ -221,7 +221,7 @@ namespace WebCore {
CSSStyleSheet* m_styleSheet;
RefPtr<CSSRule> m_rule;
RefPtr<CSSRule> m_keyframe;
- MediaQuery* m_mediaQuery;
+ OwnPtr<MediaQuery> m_mediaQuery;
CSSParserValueList* m_valueList;
CSSProperty** m_parsedProperties;
CSSSelectorList* m_selectorListForParseSelector;
@@ -301,9 +301,9 @@ namespace WebCore {
HashSet<CSSParserValueList*> m_floatingValueLists;
HashSet<CSSParserFunction*> m_floatingFunctions;
- MediaQuery* m_floatingMediaQuery;
- MediaQueryExp* m_floatingMediaQueryExp;
- Vector<MediaQueryExp*>* m_floatingMediaQueryExpList;
+ OwnPtr<MediaQuery> m_floatingMediaQuery;
+ OwnPtr<MediaQueryExp> m_floatingMediaQueryExp;
+ OwnPtr<Vector<MediaQueryExp*> > m_floatingMediaQueryExpList;
Vector<CSSSelector*> m_reusableSelectorVector;
diff --git a/WebCore/css/CSSParserValues.h b/WebCore/css/CSSParserValues.h
index 5c6f55e..8644d9b 100644
--- a/WebCore/css/CSSParserValues.h
+++ b/WebCore/css/CSSParserValues.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -90,9 +90,7 @@ private:
struct CSSParserFunction : FastAllocBase {
CSSParserString name;
- CSSParserValueList* args;
-
- ~CSSParserFunction() { delete args; }
+ OwnPtr<CSSParserValueList> args;
};
}
diff --git a/WebCore/css/CSSPrimitiveValue.cpp b/WebCore/css/CSSPrimitiveValue.cpp
index 0508cd5..b4478b4 100644
--- a/WebCore/css/CSSPrimitiveValue.cpp
+++ b/WebCore/css/CSSPrimitiveValue.cpp
@@ -329,9 +329,6 @@ int CSSPrimitiveValue::computeLengthInt(RenderStyle* style, RenderStyle* rootSty
return static_cast<int>(result);
}
-const int intMaxForLength = 0x7ffffff; // max value for a 28-bit int
-const int intMinForLength = (-0x7ffffff - 1); // min value for a 28-bit int
-
// Lengths expect an int that is only 28-bits, so we have to check for a different overflow.
int CSSPrimitiveValue::computeLengthIntForLength(RenderStyle* style, RenderStyle* rootStyle)
{
diff --git a/WebCore/css/CSSPrimitiveValueMappings.h b/WebCore/css/CSSPrimitiveValueMappings.h
index b1d2d3d..3da5cf6 100644
--- a/WebCore/css/CSSPrimitiveValueMappings.h
+++ b/WebCore/css/CSSPrimitiveValueMappings.h
@@ -262,6 +262,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ControlPart e)
case MediaControlsBackgroundPart:
m_value.ident = CSSValueMediaControlsBackground;
break;
+ case MediaControlsFullscreenBackgroundPart:
+ m_value.ident = CSSValueMediaControlsFullscreenBackground;
+ break;
case MediaCurrentTimePart:
m_value.ident = CSSValueMediaCurrentTimeDisplay;
break;
@@ -1005,6 +1008,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
case Armenian:
m_value.ident = CSSValueArmenian;
break;
+ case Asterisks:
+ m_value.ident = CSSValueAsterisks;
+ break;
case BinaryListStyle:
m_value.ident = CSSValueBinary;
break;
@@ -1086,6 +1092,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EListStyleType e)
case EthiopicHalehameTig:
m_value.ident = CSSValueEthiopicHalehameTig;
break;
+ case Footnotes:
+ m_value.ident = CSSValueFootnotes;
+ break;
case Georgian:
m_value.ident = CSSValueGeorgian;
break;
@@ -1602,7 +1611,7 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAlign e)
{
switch (e) {
case TAAUTO:
- m_value.ident = CSSValueAuto;
+ m_value.ident = CSSValueWebkitAuto;
break;
case LEFT:
m_value.ident = CSSValueLeft;
diff --git a/WebCore/css/CSSPropertyNames.in b/WebCore/css/CSSPropertyNames.in
index 0216ae1..a3063db 100644
--- a/WebCore/css/CSSPropertyNames.in
+++ b/WebCore/css/CSSPropertyNames.in
@@ -20,6 +20,7 @@ font-style
font-variant
font-weight
text-rendering
+-webkit-font-smoothing
-webkit-text-size-adjust
zoom
@@ -213,7 +214,6 @@ z-index
-webkit-column-width
-webkit-columns
-webkit-font-size-delta
--webkit-font-smoothing
-webkit-highlight
-webkit-hyphenate-character
-webkit-hyphenate-locale
diff --git a/WebCore/css/CSSSelector.cpp b/WebCore/css/CSSSelector.cpp
index 1f336a2..fb8f695 100644
--- a/WebCore/css/CSSSelector.cpp
+++ b/WebCore/css/CSSSelector.cpp
@@ -248,6 +248,13 @@ PseudoId CSSSelector::pseudoId(PseudoType type)
return NOPSEUDO;
#endif
+#if ENABLE(FULLSCREEN_API)
+ case PseudoFullScreen:
+ return FULL_SCREEN;
+ case PseudoFullScreenDocument:
+ return FULL_SCREEN_DOCUMENT;
+#endif
+
case PseudoInputListButton:
#if ENABLE(DATALIST)
return INPUT_LIST_BUTTON;
@@ -426,6 +433,10 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap(
DEFINE_STATIC_LOCAL(AtomicString, firstPage, ("first"));
DEFINE_STATIC_LOCAL(AtomicString, leftPage, ("left"));
DEFINE_STATIC_LOCAL(AtomicString, rightPage, ("right"));
+#if ENABLE(FULLSCREEN_API)
+ DEFINE_STATIC_LOCAL(AtomicString, fullScreen, ("-webkit-full-screen"));
+ DEFINE_STATIC_LOCAL(AtomicString, fullScreenDocument, ("-webkit-full-screen-document"));
+#endif
static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoType = 0;
if (!nameToPseudoType) {
@@ -537,6 +548,10 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap(
nameToPseudoType->set(firstPage.impl(), CSSSelector::PseudoFirstPage);
nameToPseudoType->set(leftPage.impl(), CSSSelector::PseudoLeftPage);
nameToPseudoType->set(rightPage.impl(), CSSSelector::PseudoRightPage);
+#if ENABLE(FULLSCREEN_API)
+ nameToPseudoType->set(fullScreen.impl(), CSSSelector::PseudoFullScreen);
+ nameToPseudoType->set(fullScreenDocument.impl(), CSSSelector::PseudoFullScreenDocument);
+#endif
}
return nameToPseudoType;
}
@@ -666,6 +681,10 @@ void CSSSelector::extractPseudoType() const
case PseudoSingleButton:
case PseudoNoButton:
case PseudoNotParsed:
+#if ENABLE(FULLSCREEN_API)
+ case PseudoFullScreen:
+ case PseudoFullScreenDocument:
+#endif
break;
case PseudoFirstPage:
case PseudoLeftPage:
diff --git a/WebCore/css/CSSSelector.h b/WebCore/css/CSSSelector.h
index e253949..00e23b9 100644
--- a/WebCore/css/CSSSelector.h
+++ b/WebCore/css/CSSSelector.h
@@ -217,6 +217,10 @@ namespace WebCore {
PseudoLeftPage,
PseudoRightPage,
PseudoFirstPage,
+#if ENABLE(FULLSCREEN_API)
+ PseudoFullScreen,
+ PseudoFullScreenDocument,
+#endif
};
enum MarginBoxType {
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index aa724a3..a75dede 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -49,7 +49,6 @@
#include "CSSVariablesRule.h"
#include "CachedImage.h"
#include "Counter.h"
-#include "CounterContent.h"
#include "FocusController.h"
#include "FontFamilyValue.h"
#include "FontValue.h"
@@ -83,6 +82,7 @@
#include "ShadowValue.h"
#include "SkewTransformOperation.h"
#include "StyleCachedImage.h"
+#include "StylePendingImage.h"
#include "StyleGeneratedImage.h"
#include "StyleSheetList.h"
#include "Text.h"
@@ -199,12 +199,12 @@ if (value->isValueList()) { \
currChild = new FillLayer(LayerType##FillLayer); \
prevChild->setNext(currChild); \
} \
- mapFill##Prop(currChild, valueList->itemWithoutBoundsCheck(i)); \
+ mapFill##Prop(property, currChild, valueList->itemWithoutBoundsCheck(i)); \
prevChild = currChild; \
currChild = currChild->next(); \
} \
} else { \
- mapFill##Prop(currChild, value); \
+ mapFill##Prop(property, currChild, value); \
currChild = currChild->next(); \
} \
while (currChild) { \
@@ -370,15 +370,15 @@ public:
CSSRuleDataList* getIDRules(AtomicStringImpl* key) { return m_idRules.get(key); }
CSSRuleDataList* getClassRules(AtomicStringImpl* key) { return m_classRules.get(key); }
CSSRuleDataList* getTagRules(AtomicStringImpl* key) { return m_tagRules.get(key); }
- CSSRuleDataList* getUniversalRules() { return m_universalRules; }
- CSSRuleDataList* getPageRules() { return m_pageRules; }
+ CSSRuleDataList* getUniversalRules() { return m_universalRules.get(); }
+ CSSRuleDataList* getPageRules() { return m_pageRules.get(); }
public:
AtomRuleMap m_idRules;
AtomRuleMap m_classRules;
AtomRuleMap m_tagRules;
- CSSRuleDataList* m_universalRules;
- CSSRuleDataList* m_pageRules;
+ OwnPtr<CSSRuleDataList> m_universalRules;
+ OwnPtr<CSSRuleDataList> m_pageRules;
unsigned m_ruleCount;
unsigned m_pageRuleCount;
};
@@ -413,21 +413,19 @@ static const MediaQueryEvaluator& printEval()
return staticPrintEval;
}
-CSSStyleSelector::CSSStyleSelector(Document* doc, StyleSheetList* styleSheets, CSSStyleSheet* mappedElementSheet,
+CSSStyleSelector::CSSStyleSelector(Document* document, StyleSheetList* styleSheets, CSSStyleSheet* mappedElementSheet,
CSSStyleSheet* pageUserSheet, const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets,
bool strictParsing, bool matchAuthorAndUserStyles)
: m_backgroundData(BackgroundFillLayer)
- , m_checker(doc, strictParsing)
+ , m_checker(document, strictParsing)
, m_element(0)
, m_styledElement(0)
, m_elementLinkState(NotInsideLink)
- , m_fontSelector(CSSFontSelector::create(doc))
+ , m_fontSelector(CSSFontSelector::create(document))
{
- init();
-
m_matchAuthorAndUserStyles = matchAuthorAndUserStyles;
- Element* root = doc->documentElement();
+ Element* root = document->documentElement();
if (!defaultStyle) {
if (!root || elementCanUseSimpleDefaultStyle(root))
@@ -436,32 +434,28 @@ CSSStyleSelector::CSSStyleSelector(Document* doc, StyleSheetList* styleSheets, C
loadFullDefaultStyle();
}
- m_userStyle = 0;
-
// construct document root element default style. this is needed
// to evaluate media queries that contain relative constraints, like "screen and (max-width: 10em)"
// This is here instead of constructor, because when constructor is run,
// document doesn't have documentElement
// NOTE: this assumes that element that gets passed to styleForElement -call
// is always from the document that owns the style selector
- FrameView* view = doc->view();
+ FrameView* view = document->view();
if (view)
- m_medium = new MediaQueryEvaluator(view->mediaType());
+ m_medium = adoptPtr(new MediaQueryEvaluator(view->mediaType()));
else
- m_medium = new MediaQueryEvaluator("all");
+ m_medium = adoptPtr(new MediaQueryEvaluator("all"));
if (root)
m_rootDefaultStyle = styleForElement(root, 0, false, true); // don't ref, because the RenderStyle is allocated from global heap
- if (m_rootDefaultStyle && view) {
- delete m_medium;
- m_medium = new MediaQueryEvaluator(view->mediaType(), view->frame(), m_rootDefaultStyle.get());
- }
+ if (m_rootDefaultStyle && view)
+ m_medium = adoptPtr(new MediaQueryEvaluator(view->mediaType(), view->frame(), m_rootDefaultStyle.get()));
- m_authorStyle = new CSSRuleSet();
+ m_authorStyle = adoptPtr(new CSSRuleSet);
// FIXME: This sucks! The user sheet is reparsed every time!
- OwnPtr<CSSRuleSet> tempUserStyle(new CSSRuleSet);
+ OwnPtr<CSSRuleSet> tempUserStyle = adoptPtr(new CSSRuleSet);
if (pageUserSheet)
tempUserStyle->addRulesFromSheet(pageUserSheet, *m_medium, this);
if (pageGroupUserSheets) {
@@ -475,7 +469,7 @@ CSSStyleSelector::CSSStyleSelector(Document* doc, StyleSheetList* styleSheets, C
}
if (tempUserStyle->m_ruleCount > 0 || tempUserStyle->m_pageRuleCount > 0)
- m_userStyle = tempUserStyle.leakPtr();
+ m_userStyle = tempUserStyle.release();
// Add rules from elements like SVG's <font-face>
if (mappedElementSheet)
@@ -489,8 +483,8 @@ CSSStyleSelector::CSSStyleSelector(Document* doc, StyleSheetList* styleSheets, C
m_authorStyle->addRulesFromSheet(static_cast<CSSStyleSheet*>(sheet), *m_medium, this);
}
- if (doc->renderer() && doc->renderer()->style())
- doc->renderer()->style()->font().update(fontSelector());
+ if (document->renderer() && document->renderer()->style())
+ document->renderer()->style()->font().update(fontSelector());
}
// This is a simplified style setting function for keyframe styles
@@ -500,23 +494,10 @@ void CSSStyleSelector::addKeyframeStyle(PassRefPtr<WebKitCSSKeyframesRule> rule)
m_keyframesRuleMap.add(s.impl(), rule);
}
-void CSSStyleSelector::init()
-{
- initElement(0);
- m_matchedDecls.clear();
- m_ruleList = 0;
- m_rootDefaultStyle = 0;
- m_medium = 0;
-}
-
CSSStyleSelector::~CSSStyleSelector()
{
m_fontSelector->clearDocument();
- delete m_medium;
- delete m_authorStyle;
- delete m_userStyle;
deleteAllValues(m_viewportDependentMediaQueryResults);
- m_keyframesRuleMap.clear();
}
static CSSStyleSheet* parseUASheet(const String& str)
@@ -556,6 +537,14 @@ static void loadFullDefaultStyle()
String quirksRules = String(quirksUserAgentStyleSheet, sizeof(quirksUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraQuirksStyleSheet();
CSSStyleSheet* quirksSheet = parseUASheet(quirksRules);
defaultQuirksStyle->addRulesFromSheet(quirksSheet, screenEval());
+
+#if ENABLE(FULLSCREEN_API)
+ // Full-screen rules.
+ String fullscreenRules = String(fullscreenUserAgentStyleSheet, sizeof(fullscreenUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraDefaultStyleSheet();
+ CSSStyleSheet* fullscreenSheet = parseUASheet(fullscreenRules);
+ defaultStyle->addRulesFromSheet(fullscreenSheet, screenEval());
+ defaultQuirksStyle->addRulesFromSheet(fullscreenSheet, screenEval());
+#endif
}
static void loadSimpleDefaultStyle()
@@ -855,6 +844,8 @@ inline void CSSStyleSelector::initForStyleResolve(Element* e, RenderStyle* paren
m_matchedDecls.clear();
+ m_pendingImageProperties.clear();
+
m_ruleList = 0;
m_fontDirty = false;
@@ -1135,8 +1126,6 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForDocument(Document* document)
documentStyle->setFontDescription(fontDescription);
documentStyle->font().update(0);
- if (document->inCompatMode())
- documentStyle->setHtmlHacks(true); // enable html specific rendering tricks
return documentStyle.release();
}
@@ -1258,7 +1247,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
if (!resolveForRootDefault) {
// 4. Now we check user sheet rules.
if (m_matchAuthorAndUserStyles)
- matchRules(m_userStyle, firstUserRule, lastUserRule);
+ matchRules(m_userStyle.get(), firstUserRule, lastUserRule);
// 5. Now check author rules, beginning first with presentational attributes
// mapped from HTML.
@@ -1297,7 +1286,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
// 6. Check the rules in author sheets next.
if (m_matchAuthorAndUserStyles)
- matchRules(m_authorStyle, firstAuthorRule, lastAuthorRule);
+ matchRules(m_authorStyle.get(), firstAuthorRule, lastAuthorRule);
// 7. Now check our inline style attribute.
if (m_matchAuthorAndUserStyles && m_styledElement) {
@@ -1347,7 +1336,8 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
applyDeclarations<false>(true, firstUserRule, lastUserRule);
}
applyDeclarations<false>(true, firstUARule, lastUARule);
-
+
+ ASSERT(!m_fontDirty);
// If our font got dirtied by one of the non-essential font props,
// go ahead and update it a second time.
if (m_fontDirty)
@@ -1356,6 +1346,9 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
// Clean up our style object's display and text decorations (among other fixups).
adjustRenderStyle(style(), e);
+ // Start loading images referenced by this style.
+ loadPendingImages();
+
// If we have first-letter pseudo style, do not share this style
if (m_style->hasPseudoStyle(FIRST_LETTER))
m_style->setUnique();
@@ -1380,7 +1373,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
return m_style.release();
}
-PassRefPtr<RenderStyle> CSSStyleSelector::styleForKeyframe(const RenderStyle* elementStyle, const WebKitCSSKeyframeRule* keyframeRule, KeyframeList& list)
+PassRefPtr<RenderStyle> CSSStyleSelector::styleForKeyframe(const RenderStyle* elementStyle, const WebKitCSSKeyframeRule* keyframeRule, KeyframeValue& keyframe)
{
if (keyframeRule->style())
addMatchedDeclaration(keyframeRule->style());
@@ -1414,7 +1407,10 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForKeyframe(const RenderStyle* el
if (m_fontDirty)
updateFont();
- // Add all the animating properties to the list
+ // Start loading images referenced by this style.
+ loadPendingImages();
+
+ // Add all the animating properties to the keyframe.
if (keyframeRule->style()) {
CSSMutableStyleDeclaration::const_iterator end = keyframeRule->style()->end();
for (CSSMutableStyleDeclaration::const_iterator it = keyframeRule->style()->begin(); it != end; ++it) {
@@ -1422,7 +1418,7 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForKeyframe(const RenderStyle* el
// Timing-function within keyframes is special, because it is not animated; it just
// describes the timing function between this keyframe and the next.
if (property != CSSPropertyWebkitAnimationTimingFunction)
- list.addProperty(property);
+ keyframe.addProperty(property);
}
}
@@ -1443,7 +1439,6 @@ void CSSStyleSelector::keyframeStylesForAnimation(Element* e, const RenderStyle*
return;
const WebKitCSSKeyframesRule* rule = m_keyframesRuleMap.find(list.animationName().impl()).get()->second.get();
- RefPtr<RenderStyle> keyframeStyle;
// Construct and populate the style for each keyframe
for (unsigned i = 0; i < rule->length(); ++i) {
@@ -1452,34 +1447,36 @@ void CSSStyleSelector::keyframeStylesForAnimation(Element* e, const RenderStyle*
initForStyleResolve(e);
const WebKitCSSKeyframeRule* keyframeRule = rule->item(i);
-
- keyframeStyle = styleForKeyframe(elementStyle, keyframeRule, list);
+
+ KeyframeValue keyframe(0, 0);
+ keyframe.setStyle(styleForKeyframe(elementStyle, keyframeRule, keyframe));
// Add this keyframe style to all the indicated key times
Vector<float> keys;
keyframeRule->getKeys(keys);
for (size_t keyIndex = 0; keyIndex < keys.size(); ++keyIndex) {
- float key = keys[keyIndex];
- list.insert(key, keyframeStyle.get());
+ keyframe.setKey(keys[keyIndex]);
+ list.insert(keyframe);
}
- keyframeStyle.release();
}
// If the 0% keyframe is missing, create it (but only if there is at least one other keyframe)
int initialListSize = list.size();
- if (initialListSize > 0 && list.beginKeyframes()->key() != 0) {
- RefPtr<WebKitCSSKeyframeRule> keyframe = WebKitCSSKeyframeRule::create();
- keyframe->setKeyText("0%");
- keyframeStyle = styleForKeyframe(elementStyle, keyframe.get(), list);
- list.insert(0, keyframeStyle.release());
+ if (initialListSize > 0 && list[0].key() != 0) {
+ RefPtr<WebKitCSSKeyframeRule> keyframeRule = WebKitCSSKeyframeRule::create();
+ keyframeRule->setKeyText("0%");
+ KeyframeValue keyframe(0, 0);
+ keyframe.setStyle(styleForKeyframe(elementStyle, keyframeRule.get(), keyframe));
+ list.insert(keyframe);
}
// If the 100% keyframe is missing, create it (but only if there is at least one other keyframe)
- if (initialListSize > 0 && (list.endKeyframes() - 1)->key() != 1) {
- RefPtr<WebKitCSSKeyframeRule> keyframe = WebKitCSSKeyframeRule::create();
- keyframe->setKeyText("100%");
- keyframeStyle = styleForKeyframe(elementStyle, keyframe.get(), list);
- list.insert(1, keyframeStyle.release());
+ if (initialListSize > 0 && (list[list.size() - 1].key() != 1)) {
+ RefPtr<WebKitCSSKeyframeRule> keyframeRule = WebKitCSSKeyframeRule::create();
+ keyframeRule->setKeyText("100%");
+ KeyframeValue keyframe(1, 0);
+ keyframe.setStyle(styleForKeyframe(elementStyle, keyframeRule.get(), keyframe));
+ list.insert(keyframe);
}
}
@@ -1518,8 +1515,8 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo,
matchUARules(firstUARule, lastUARule);
if (m_matchAuthorAndUserStyles) {
- matchRules(m_userStyle, firstUserRule, lastUserRule);
- matchRules(m_authorStyle, firstAuthorRule, lastAuthorRule);
+ matchRules(m_userStyle.get(), firstUserRule, lastUserRule);
+ matchRules(m_authorStyle.get(), firstAuthorRule, lastAuthorRule);
}
if (m_matchedDecls.isEmpty() && !visitedStyle)
@@ -1569,6 +1566,9 @@ PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo,
// Clean up our style object's display and text decorations (among other fixups).
adjustRenderStyle(style(), 0);
+ // Start loading images referenced by this style.
+ loadPendingImages();
+
// Hang our visited style off m_style.
if (visitedStyle)
m_style->addCachedPseudoStyle(visitedStyle.release());
@@ -1588,8 +1588,8 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForPage(int pageIndex)
const bool isFirst = isFirstPage(pageIndex);
const String page = pageName(pageIndex);
matchPageRules(defaultPrintStyle, isLeft, isFirst, page);
- matchPageRules(m_userStyle, isLeft, isFirst, page);
- matchPageRules(m_authorStyle, isLeft, isFirst, page);
+ matchPageRules(m_userStyle.get(), isLeft, isFirst, page);
+ matchPageRules(m_authorStyle.get(), isLeft, isFirst, page);
m_lineHeightValue = 0;
applyDeclarations<true>(false, 0, m_matchedDecls.size() - 1);
@@ -1603,6 +1603,9 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForPage(int pageIndex)
applyDeclarations<false>(false, 0, m_matchedDecls.size() - 1);
+ // Start loading images referenced by this style.
+ loadPendingImages();
+
// Now return the style.
return m_style.release();
}
@@ -1865,14 +1868,14 @@ PassRefPtr<CSSRuleList> CSSStyleSelector::pseudoStyleRulesForElement(Element* e,
// Now we check user sheet rules.
if (m_matchAuthorAndUserStyles) {
int firstUserRule = -1, lastUserRule = -1;
- matchRules(m_userStyle, firstUserRule, lastUserRule);
+ matchRules(m_userStyle.get(), firstUserRule, lastUserRule);
}
}
if (m_matchAuthorAndUserStyles) {
// Check the rules in author sheets.
int firstAuthorRule = -1, lastAuthorRule = -1;
- matchRules(m_authorStyle, firstAuthorRule, lastAuthorRule);
+ matchRules(m_authorStyle.get(), firstAuthorRule, lastAuthorRule);
}
m_checker.m_collectRulesOnly = false;
@@ -2598,22 +2601,7 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme
return true;
break;
case CSSSelector::PseudoLang: {
- Node* n = e;
- AtomicString value;
- // The language property is inherited, so we iterate over the parents
- // to find the first language.
- while (n && value.isNull()) {
- if (n->isElementNode()) {
- // Spec: xml:lang takes precedence -- http://www.w3.org/TR/xhtml1/#C_7
- value = static_cast<Element*>(n)->fastGetAttribute(XMLNames::langAttr);
- if (value.isNull())
- value = static_cast<Element*>(n)->fastGetAttribute(langAttr);
- } else if (n->isDocumentNode())
- // checking the MIME content-language
- value = static_cast<Document*>(n)->contentLanguage();
-
- n = n->parent();
- }
+ AtomicString value = e->computeInheritedLanguage();
const AtomicString& argument = sel->argument();
if (value.isEmpty() || !value.startsWith(argument, false))
break;
@@ -2621,6 +2609,26 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme
break;
return true;
}
+#if ENABLE(FULLSCREEN_API)
+ case CSSSelector::PseudoFullScreen:
+ // While a Document is in the fullscreen state, and the document's current fullscreen
+ // element is an element in the document, the 'full-screen' pseudoclass applies to
+ // that element. Also, an <iframe>, <object> or <embed> element whose child browsing
+ // context's Document is in the fullscreen state has the 'full-screen' pseudoclass applied.
+ if (!e->document()->webkitFullScreen())
+ return false;
+ if (e != e->document()->webkitCurrentFullScreenElement())
+ return false;
+ return true;
+ case CSSSelector::PseudoFullScreenDocument:
+ // While a Document is in the fullscreen state, the 'full-screen-document' pseudoclass applies
+ // to the root element of that Document.
+ if (!e->document()->webkitFullScreen())
+ return false;
+ if (e != e->document()->documentElement())
+ return false;
+ return true;
+#endif
case CSSSelector::PseudoUnknown:
case CSSSelector::PseudoNotParsed:
default:
@@ -2745,11 +2753,9 @@ CSSValue* CSSStyleSelector::resolveVariableDependentValue(CSSVariableDependentVa
// -----------------------------------------------------------------
CSSRuleSet::CSSRuleSet()
+ : m_ruleCount(0)
+ , m_pageRuleCount(0)
{
- m_universalRules = 0;
- m_pageRules = 0;
- m_ruleCount = 0;
- m_pageRuleCount = 0;
}
CSSRuleSet::~CSSRuleSet()
@@ -2757,9 +2763,6 @@ CSSRuleSet::~CSSRuleSet()
deleteAllValues(m_idRules);
deleteAllValues(m_classRules);
deleteAllValues(m_tagRules);
-
- delete m_universalRules;
- delete m_pageRules;
}
@@ -2794,7 +2797,7 @@ void CSSRuleSet::addRule(CSSStyleRule* rule, CSSSelector* sel)
// Just put it in the universal rule set.
if (!m_universalRules)
- m_universalRules = new CSSRuleDataList(m_ruleCount++, rule, sel);
+ m_universalRules = adoptPtr(new CSSRuleDataList(m_ruleCount++, rule, sel));
else
m_universalRules->append(m_ruleCount++, rule, sel);
}
@@ -2802,7 +2805,7 @@ void CSSRuleSet::addRule(CSSStyleRule* rule, CSSSelector* sel)
void CSSRuleSet::addPageRule(CSSStyleRule* rule, CSSSelector* sel)
{
if (!m_pageRules)
- m_pageRules = new CSSRuleDataList(m_pageRuleCount++, rule, sel);
+ m_pageRules = adoptPtr(new CSSRuleDataList(m_pageRuleCount++, rule, sel));
else
m_pageRules->append(m_pageRuleCount++, rule, sel);
}
@@ -2922,7 +2925,7 @@ void CSSStyleSelector::applyDeclarations(bool isImportant, int startIndex, int e
if (applyFirst) {
COMPILE_ASSERT(firstCSSProperty == CSSPropertyColor, CSS_color_is_first_property);
- COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 11, CSS_zoom_is_end_of_first_prop_range);
+ COMPILE_ASSERT(CSSPropertyZoom == CSSPropertyColor + 12, CSS_zoom_is_end_of_first_prop_range);
COMPILE_ASSERT(CSSPropertyLineHeight == CSSPropertyZoom + 1, CSS_line_height_is_after_zoom);
// give special priority to font-xxx, color properties, etc
@@ -3120,7 +3123,8 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
// 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.
- switch (static_cast<CSSPropertyID>(id)) {
+ CSSPropertyID property = static_cast<CSSPropertyID>(id);
+ switch (property) {
// ident only properties
case CSSPropertyBackgroundAttachment:
HANDLE_BACKGROUND_VALUE(attachment, Attachment, value)
@@ -3510,11 +3514,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
CSSCursorImageValue* image = static_cast<CSSCursorImageValue*>(primitiveValue);
if (image->updateIfSVGCursorIsUsed(m_element)) // Elements with SVG cursors are not allowed to share style.
m_style->setUnique();
- // FIXME: Temporary clumsiness to pass off a CachedImage to an API that will eventually convert to using
- // StyleImage.
- RefPtr<StyleCachedImage> styleCachedImage(image->cachedImage(m_element->document()->docLoader()));
- if (styleCachedImage)
- m_style->addCursor(styleCachedImage->cachedImage(), image->hotSpot());
+ m_style->addCursor(cachedOrPendingFromValue(CSSPropertyCursor, image), image->hotSpot());
} else if (type == CSSPrimitiveValue::CSS_IDENT)
m_style->setCursor(*primitiveValue);
}
@@ -3611,7 +3611,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
case CSSPropertyListStyleImage:
{
HANDLE_INHERIT_AND_INITIAL(listStyleImage, ListStyleImage)
- m_style->setListStyleImage(styleImage(value));
+ m_style->setListStyleImage(styleImage(CSSPropertyListStyleImage, value));
return;
}
@@ -4066,10 +4066,10 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
fontDescription.setKeywordSize(primitiveValue->getIdent() - CSSValueXxSmall + 1);
break;
case CSSValueLarger:
- size = largerFontSize(oldSize, m_style->htmlHacks());
+ size = largerFontSize(oldSize, m_checker.m_document->inQuirksMode());
break;
case CSSValueSmaller:
- size = smallerFontSize(oldSize, m_style->htmlHacks());
+ size = smallerFontSize(oldSize, m_checker.m_document->inQuirksMode());
break;
default:
return;
@@ -4273,16 +4273,15 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
break;
}
case CSSPrimitiveValue::CSS_URI: {
- CSSImageValue* image = static_cast<CSSImageValue*>(val);
- m_style->setContent(image->cachedImage(m_element->document()->docLoader()), didSet);
+ m_style->setContent(cachedOrPendingFromValue(CSSPropertyContent, static_cast<CSSImageValue*>(val)), didSet);
didSet = true;
break;
}
case CSSPrimitiveValue::CSS_COUNTER: {
Counter* counterValue = val->getCounterValue();
- CounterContent* counter = new CounterContent(counterValue->identifier(),
- (EListStyleType)counterValue->listStyleNumber(), counterValue->separator());
- m_style->setContent(counter, didSet);
+ OwnPtr<CounterContent> counter = adoptPtr(new CounterContent(counterValue->identifier(),
+ (EListStyleType)counterValue->listStyleNumber(), counterValue->separator()));
+ m_style->setContent(counter.release(), didSet);
didSet = true;
}
}
@@ -4701,7 +4700,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
}
NinePieceImage image;
- mapNinePieceImage(value, image);
+ mapNinePieceImage(property, value, image);
if (id == CSSPropertyWebkitBorderImage)
m_style->setBorderImage(image);
@@ -4751,17 +4750,26 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
if (!pair)
return;
- int width = pair->first()->computeLengthInt(style(), m_rootElementStyle, zoomFactor);
- int height = pair->second()->computeLengthInt(style(), m_rootElementStyle, zoomFactor);
+ Length radiusWidth;
+ Length radiusHeight;
+ if (pair->first()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
+ radiusWidth = Length(pair->first()->getDoubleValue(), Percent);
+ else
+ radiusWidth = Length(max(intMinForLength, min(intMaxForLength, pair->first()->computeLengthInt(style(), m_rootElementStyle, zoomFactor))), Fixed);
+ if (pair->second()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
+ radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
+ else
+ radiusHeight = Length(max(intMinForLength, min(intMaxForLength, pair->second()->computeLengthInt(style(), m_rootElementStyle, zoomFactor))), Fixed);
+ int width = radiusWidth.rawValue();
+ int height = radiusHeight.rawValue();
if (width < 0 || height < 0)
return;
-
if (width == 0)
- height = 0; // Null out the other value.
+ radiusHeight = radiusWidth; // Null out the other value.
else if (height == 0)
- width = 0; // Null out the other value.
+ radiusWidth = radiusHeight; // Null out the other value.
- IntSize size(width, height);
+ LengthSize size(radiusWidth, radiusHeight);
switch (id) {
case CSSPropertyBorderTopLeftRadius:
m_style->setBorderTopLeftRadius(size);
@@ -4851,7 +4859,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
reflection->setOffset(Length(reflectValue->offset()->computeLengthIntForLength(style(), m_rootElementStyle, zoomFactor), Fixed));
}
NinePieceImage mask;
- mapNinePieceImage(reflectValue->mask(), mask);
+ mapNinePieceImage(property, reflectValue->mask(), mask);
reflection->setMask(mask);
m_style->setBoxReflect(reflection.release());
@@ -5820,7 +5828,7 @@ Length CSSStyleSelector::inchLength(double inch)
return Length(CSSPrimitiveValue::create(inch, CSSPrimitiveValue::CSS_IN)->computeLengthIntForLength(style(), m_rootElementStyle), Fixed);
}
-void CSSStyleSelector::mapFillAttachment(FillLayer* layer, CSSValue* value)
+void CSSStyleSelector::mapFillAttachment(CSSPropertyID, FillLayer* layer, CSSValue* value)
{
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
layer->setAttachment(FillLayer::initialFillAttachment(layer->type()));
@@ -5846,7 +5854,7 @@ void CSSStyleSelector::mapFillAttachment(FillLayer* layer, CSSValue* value)
}
}
-void CSSStyleSelector::mapFillClip(FillLayer* layer, CSSValue* value)
+void CSSStyleSelector::mapFillClip(CSSPropertyID, FillLayer* layer, CSSValue* value)
{
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
layer->setClip(FillLayer::initialFillClip(layer->type()));
@@ -5860,7 +5868,7 @@ void CSSStyleSelector::mapFillClip(FillLayer* layer, CSSValue* value)
layer->setClip(*primitiveValue);
}
-void CSSStyleSelector::mapFillComposite(FillLayer* layer, CSSValue* value)
+void CSSStyleSelector::mapFillComposite(CSSPropertyID, FillLayer* layer, CSSValue* value)
{
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
layer->setComposite(FillLayer::initialFillComposite(layer->type()));
@@ -5874,7 +5882,7 @@ void CSSStyleSelector::mapFillComposite(FillLayer* layer, CSSValue* value)
layer->setComposite(*primitiveValue);
}
-void CSSStyleSelector::mapFillOrigin(FillLayer* layer, CSSValue* value)
+void CSSStyleSelector::mapFillOrigin(CSSPropertyID, FillLayer* layer, CSSValue* value)
{
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
layer->setOrigin(FillLayer::initialFillOrigin(layer->type()));
@@ -5888,26 +5896,36 @@ void CSSStyleSelector::mapFillOrigin(FillLayer* layer, CSSValue* value)
layer->setOrigin(*primitiveValue);
}
-StyleImage* CSSStyleSelector::styleImage(CSSValue* value)
+StyleImage* CSSStyleSelector::styleImage(CSSPropertyID property, CSSValue* value)
{
if (value->isImageValue())
- return static_cast<CSSImageValue*>(value)->cachedImage(m_element->document()->docLoader());
+ return cachedOrPendingFromValue(property, static_cast<CSSImageValue*>(value));
+
if (value->isImageGeneratorValue())
return static_cast<CSSImageGeneratorValue*>(value)->generatedImage();
+
return 0;
}
-void CSSStyleSelector::mapFillImage(FillLayer* layer, CSSValue* value)
+StyleImage* CSSStyleSelector::cachedOrPendingFromValue(CSSPropertyID property, CSSImageValue* value)
+{
+ StyleImage* image = value->cachedOrPendingImage();
+ if (image && image->isPendingImage())
+ m_pendingImageProperties.add(property);
+ return image;
+}
+
+void CSSStyleSelector::mapFillImage(CSSPropertyID property, FillLayer* layer, CSSValue* value)
{
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
layer->setImage(FillLayer::initialFillImage(layer->type()));
return;
}
- layer->setImage(styleImage(value));
+ layer->setImage(styleImage(property, value));
}
-void CSSStyleSelector::mapFillRepeatX(FillLayer* layer, CSSValue* value)
+void CSSStyleSelector::mapFillRepeatX(CSSPropertyID, FillLayer* layer, CSSValue* value)
{
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
layer->setRepeatX(FillLayer::initialFillRepeatX(layer->type()));
@@ -5921,7 +5939,7 @@ void CSSStyleSelector::mapFillRepeatX(FillLayer* layer, CSSValue* value)
layer->setRepeatX(*primitiveValue);
}
-void CSSStyleSelector::mapFillRepeatY(FillLayer* layer, CSSValue* value)
+void CSSStyleSelector::mapFillRepeatY(CSSPropertyID, FillLayer* layer, CSSValue* value)
{
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
layer->setRepeatY(FillLayer::initialFillRepeatY(layer->type()));
@@ -5935,7 +5953,7 @@ void CSSStyleSelector::mapFillRepeatY(FillLayer* layer, CSSValue* value)
layer->setRepeatY(*primitiveValue);
}
-void CSSStyleSelector::mapFillSize(FillLayer* layer, CSSValue* value)
+void CSSStyleSelector::mapFillSize(CSSPropertyID, FillLayer* layer, CSSValue* value)
{
if (!value->isPrimitiveValue()) {
layer->setSizeType(SizeNone);
@@ -5997,7 +6015,7 @@ void CSSStyleSelector::mapFillSize(FillLayer* layer, CSSValue* value)
layer->setSizeLength(b);
}
-void CSSStyleSelector::mapFillXPosition(FillLayer* layer, CSSValue* value)
+void CSSStyleSelector::mapFillXPosition(CSSPropertyID, FillLayer* layer, CSSValue* value)
{
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
layer->setXPosition(FillLayer::initialFillXPosition(layer->type()));
@@ -6021,7 +6039,7 @@ void CSSStyleSelector::mapFillXPosition(FillLayer* layer, CSSValue* value)
layer->setXPosition(l);
}
-void CSSStyleSelector::mapFillYPosition(FillLayer* layer, CSSValue* value)
+void CSSStyleSelector::mapFillYPosition(CSSPropertyID, FillLayer* layer, CSSValue* value)
{
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
layer->setYPosition(FillLayer::initialFillYPosition(layer->type()));
@@ -6209,7 +6227,7 @@ void CSSStyleSelector::mapAnimationTimingFunction(Animation* animation, CSSValue
}
}
-void CSSStyleSelector::mapNinePieceImage(CSSValue* value, NinePieceImage& image)
+void CSSStyleSelector::mapNinePieceImage(CSSPropertyID property, CSSValue* value, NinePieceImage& image)
{
// If we're a primitive value, then we are "none" and don't need to alter the empty image at all.
if (!value || value->isPrimitiveValue())
@@ -6219,7 +6237,7 @@ void CSSStyleSelector::mapNinePieceImage(CSSValue* value, NinePieceImage& image)
CSSBorderImageValue* borderImage = static_cast<CSSBorderImageValue*>(value);
// Set the image (this kicks off the load).
- image.setImage(styleImage(borderImage->imageValue()));
+ image.setImage(styleImage(property, borderImage->imageValue()));
// Set up a length box to represent our image slices.
LengthBox l;
@@ -6430,7 +6448,7 @@ float CSSStyleSelector::fontSizeForKeyword(Document* document, int keyword, bool
if (!settings)
return 1.0f;
- bool quirksMode = document->inCompatMode();
+ bool quirksMode = document->inQuirksMode();
int mediumSize = fixed ? settings->defaultFixedFontSize() : settings->defaultFontSize();
if (mediumSize >= fontSizeTableMin && mediumSize <= fontSizeTableMax) {
// Look up the entry in the table.
@@ -6828,4 +6846,101 @@ bool CSSStyleSelector::createTransformOperations(CSSValue* inValue, RenderStyle*
return true;
}
+void CSSStyleSelector::loadPendingImages()
+{
+ if (m_pendingImageProperties.isEmpty())
+ return;
+
+ HashSet<int>::const_iterator end = m_pendingImageProperties.end();
+ for (HashSet<int>::const_iterator it = m_pendingImageProperties.begin(); it != end; ++it) {
+ CSSPropertyID currentProperty = static_cast<CSSPropertyID>(*it);
+
+ DocLoader* docLoader = m_element->document()->docLoader();
+
+ switch (currentProperty) {
+ case CSSPropertyBackgroundImage: {
+ for (FillLayer* backgroundLayer = m_style->accessBackgroundLayers(); backgroundLayer; backgroundLayer = backgroundLayer->next()) {
+ if (backgroundLayer->image() && backgroundLayer->image()->isPendingImage()) {
+ CSSImageValue* imageValue = static_cast<StylePendingImage*>(backgroundLayer->image())->cssImageValue();
+ backgroundLayer->setImage(imageValue->cachedImage(docLoader));
+ }
+ }
+ break;
+ }
+
+ case CSSPropertyContent: {
+ for (ContentData* contentData = const_cast<ContentData*>(m_style->contentData()); contentData; contentData = contentData->next()) {
+ if (contentData->isImage() && contentData->image()->isPendingImage()) {
+ CSSImageValue* imageValue = static_cast<StylePendingImage*>(contentData->image())->cssImageValue();
+ contentData->setImage(imageValue->cachedImage(docLoader));
+ }
+ }
+ break;
+ }
+
+ case CSSPropertyCursor: {
+ if (CursorList* cursorList = m_style->cursors()) {
+ for (size_t i = 0; i < cursorList->size(); ++i) {
+ CursorData& currentCursor = (*cursorList)[i];
+ if (currentCursor.image()->isPendingImage()) {
+ CSSImageValue* imageValue = static_cast<StylePendingImage*>(currentCursor.image())->cssImageValue();
+ currentCursor.setImage(imageValue->cachedImage(docLoader));
+ }
+ }
+ }
+ break;
+ }
+
+ case CSSPropertyListStyleImage: {
+ if (m_style->listStyleImage() && m_style->listStyleImage()->isPendingImage()) {
+ CSSImageValue* imageValue = static_cast<StylePendingImage*>(m_style->listStyleImage())->cssImageValue();
+ m_style->setListStyleImage(imageValue->cachedImage(docLoader));
+ }
+ break;
+ }
+
+ case CSSPropertyWebkitBorderImage: {
+ const NinePieceImage& borderImage = m_style->borderImage();
+ if (borderImage.image() && borderImage.image()->isPendingImage()) {
+ CSSImageValue* imageValue = static_cast<StylePendingImage*>(borderImage.image())->cssImageValue();
+ m_style->setBorderImage(NinePieceImage(imageValue->cachedImage(docLoader), borderImage.slices(), borderImage.horizontalRule(), borderImage.verticalRule()));
+ }
+ break;
+ }
+
+ case CSSPropertyWebkitBoxReflect: {
+ const NinePieceImage& maskImage = m_style->boxReflect()->mask();
+ if (maskImage.image() && maskImage.image()->isPendingImage()) {
+ CSSImageValue* imageValue = static_cast<StylePendingImage*>(maskImage.image())->cssImageValue();
+ m_style->boxReflect()->setMask(NinePieceImage(imageValue->cachedImage(docLoader), maskImage.slices(), maskImage.horizontalRule(), maskImage.verticalRule()));
+ }
+ break;
+ }
+
+ case CSSPropertyWebkitMaskBoxImage: {
+ const NinePieceImage& maskBoxImage = m_style->maskBoxImage();
+ if (maskBoxImage.image() && maskBoxImage.image()->isPendingImage()) {
+ CSSImageValue* imageValue = static_cast<StylePendingImage*>(maskBoxImage.image())->cssImageValue();
+ m_style->setMaskBoxImage(NinePieceImage(imageValue->cachedImage(docLoader), maskBoxImage.slices(), maskBoxImage.horizontalRule(), maskBoxImage.verticalRule()));
+ }
+ break;
+ }
+
+ case CSSPropertyWebkitMaskImage: {
+ for (FillLayer* maskLayer = m_style->accessMaskLayers(); maskLayer; maskLayer = maskLayer->next()) {
+ if (maskLayer->image() && maskLayer->image()->isPendingImage()) {
+ CSSImageValue* imageValue = static_cast<StylePendingImage*>(maskLayer->image())->cssImageValue();
+ maskLayer->setImage(imageValue->cachedImage(docLoader));
+ }
+ }
+ break;
+ }
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ }
+
+ m_pendingImageProperties.clear();
+}
+
} // namespace WebCore
diff --git a/WebCore/css/CSSStyleSelector.h b/WebCore/css/CSSStyleSelector.h
index b0d977e..28d4488 100644
--- a/WebCore/css/CSSStyleSelector.h
+++ b/WebCore/css/CSSStyleSelector.h
@@ -1,6 +1,6 @@
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -40,6 +40,7 @@ class CSSPrimitiveValue;
class CSSProperty;
class CSSFontFace;
class CSSFontFaceRule;
+class CSSImageValue;
class CSSRuleData;
class CSSRuleDataList;
class CSSRuleList;
@@ -58,6 +59,7 @@ class Frame;
class FrameView;
class KURL;
class KeyframeList;
+class KeyframeValue;
class MediaQueryEvaluator;
class Node;
class Settings;
@@ -113,7 +115,7 @@ public:
RenderStyle* style() const { return m_style.get(); }
- PassRefPtr<RenderStyle> styleForKeyframe(const RenderStyle*, const WebKitCSSKeyframeRule*, KeyframeList&);
+ PassRefPtr<RenderStyle> styleForKeyframe(const RenderStyle*, const WebKitCSSKeyframeRule*, KeyframeValue&);
public:
// These methods will give back the set of rules that matched for a given element (or a pseudo-element).
@@ -194,8 +196,8 @@ public:
bool isFirstPage(int pageIndex) const;
String pageName(int pageIndex) const;
- CSSRuleSet* m_authorStyle;
- CSSRuleSet* m_userStyle;
+ OwnPtr<CSSRuleSet> m_authorStyle;
+ OwnPtr<CSSRuleSet> m_userStyle;
bool m_hasUAAppearance;
BorderData m_borderData;
@@ -234,22 +236,20 @@ public:
private:
static RenderStyle* s_styleNotYetAvailable;
- void init();
-
void matchUARules(int& firstUARule, int& lastUARule);
void updateFont();
void cacheBorderAndBackground();
- void mapFillAttachment(FillLayer*, CSSValue*);
- void mapFillClip(FillLayer*, CSSValue*);
- void mapFillComposite(FillLayer*, CSSValue*);
- void mapFillOrigin(FillLayer*, CSSValue*);
- void mapFillImage(FillLayer*, CSSValue*);
- void mapFillRepeatX(FillLayer*, CSSValue*);
- void mapFillRepeatY(FillLayer*, CSSValue*);
- void mapFillSize(FillLayer*, CSSValue*);
- void mapFillXPosition(FillLayer*, CSSValue*);
- void mapFillYPosition(FillLayer*, CSSValue*);
+ void mapFillAttachment(CSSPropertyID, FillLayer*, CSSValue*);
+ void mapFillClip(CSSPropertyID, FillLayer*, CSSValue*);
+ void mapFillComposite(CSSPropertyID, FillLayer*, CSSValue*);
+ void mapFillOrigin(CSSPropertyID, FillLayer*, CSSValue*);
+ void mapFillImage(CSSPropertyID, FillLayer*, CSSValue*);
+ void mapFillRepeatX(CSSPropertyID, FillLayer*, CSSValue*);
+ void mapFillRepeatY(CSSPropertyID, FillLayer*, CSSValue*);
+ void mapFillSize(CSSPropertyID, FillLayer*, CSSValue*);
+ void mapFillXPosition(CSSPropertyID, FillLayer*, CSSValue*);
+ void mapFillYPosition(CSSPropertyID, FillLayer*, CSSValue*);
void mapAnimationDelay(Animation*, CSSValue*);
void mapAnimationDirection(Animation*, CSSValue*);
@@ -261,7 +261,7 @@ public:
void mapAnimationProperty(Animation*, CSSValue*);
void mapAnimationTimingFunction(Animation*, CSSValue*);
- void mapNinePieceImage(CSSValue*, NinePieceImage&);
+ void mapNinePieceImage(CSSPropertyID, CSSValue*, NinePieceImage&);
void applyProperty(int id, CSSValue*);
void applyPageSizeProperty(CSSValue*);
@@ -272,7 +272,10 @@ public:
void applySVGProperty(int id, CSSValue*);
#endif
- StyleImage* styleImage(CSSValue* value);
+ void loadPendingImages();
+
+ StyleImage* styleImage(CSSPropertyID, CSSValue* value);
+ StyleImage* cachedOrPendingFromValue(CSSPropertyID property, CSSImageValue* value);
// 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),
@@ -285,8 +288,10 @@ public:
Vector<CSSRuleData*, 32> m_matchedRules;
RefPtr<CSSRuleList> m_ruleList;
+
+ HashSet<int> m_pendingImageProperties; // Hash of CSSPropertyIDs
- MediaQueryEvaluator* m_medium;
+ OwnPtr<MediaQueryEvaluator> m_medium;
RefPtr<RenderStyle> m_rootDefaultStyle;
PseudoId m_dynamicPseudo;
diff --git a/WebCore/css/CSSStyleSheet.cpp b/WebCore/css/CSSStyleSheet.cpp
index 1ef1c2b..9bbcb8b 100644
--- a/WebCore/css/CSSStyleSheet.cpp
+++ b/WebCore/css/CSSStyleSheet.cpp
@@ -36,8 +36,7 @@ namespace WebCore {
CSSStyleSheet::CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, const KURL& baseURL, const String& charset)
: StyleSheet(parentSheet, href, baseURL)
- , m_doc(parentSheet ? parentSheet->doc() : 0)
- , m_namespaces(0)
+ , m_document(parentSheet ? parentSheet->document() : 0)
, m_charset(charset)
, m_loadCompleted(false)
, m_strictParsing(!parentSheet || parentSheet->useStrictParsing())
@@ -48,8 +47,7 @@ CSSStyleSheet::CSSStyleSheet(CSSStyleSheet* parentSheet, const String& href, con
CSSStyleSheet::CSSStyleSheet(Node* parentNode, const String& href, const KURL& baseURL, const String& charset)
: StyleSheet(parentNode, href, baseURL)
- , m_doc(parentNode->document())
- , m_namespaces(0)
+ , m_document(parentNode->document())
, m_charset(charset)
, m_loadCompleted(false)
, m_strictParsing(false)
@@ -60,20 +58,18 @@ CSSStyleSheet::CSSStyleSheet(Node* parentNode, const String& href, const KURL& b
CSSStyleSheet::CSSStyleSheet(CSSRule* ownerRule, const String& href, const KURL& baseURL, const String& charset)
: StyleSheet(ownerRule, href, baseURL)
- , m_namespaces(0)
, m_charset(charset)
, m_loadCompleted(false)
, m_strictParsing(!ownerRule || ownerRule->useStrictParsing())
, m_hasSyntacticallyValidCSSHeader(true)
{
CSSStyleSheet* parentSheet = ownerRule ? ownerRule->parentStyleSheet() : 0;
- m_doc = parentSheet ? parentSheet->doc() : 0;
+ m_document = parentSheet ? parentSheet->document() : 0;
m_isUserStyleSheet = parentSheet ? parentSheet->isUserStyleSheet() : false;
}
CSSStyleSheet::~CSSStyleSheet()
{
- delete m_namespaces;
}
CSSRule *CSSStyleSheet::ownerRule() const
@@ -137,7 +133,7 @@ int CSSStyleSheet::addRule(const String& selector, const String& style, Exceptio
PassRefPtr<CSSRuleList> CSSStyleSheet::cssRules(bool omitCharsetRules)
{
KURL url = finalURL();
- if (!url.isEmpty() && doc() && !doc()->securityOrigin()->canRequest(url))
+ if (!url.isEmpty() && document() && !document()->securityOrigin()->canRequest(url))
return 0;
return CSSRuleList::create(this, omitCharsetRules);
}
@@ -159,7 +155,7 @@ void CSSStyleSheet::addNamespace(CSSParser* p, const AtomicString& prefix, const
if (uri.isNull())
return;
- m_namespaces = new CSSNamespace(prefix, uri, m_namespaces);
+ m_namespaces = adoptPtr(new CSSNamespace(prefix, uri, m_namespaces.release()));
if (prefix.isEmpty())
// Set the default namespace on the parser so that selectors that omit namespace info will
@@ -174,11 +170,10 @@ const AtomicString& CSSStyleSheet::determineNamespace(const AtomicString& prefix
if (prefix == starAtom)
return starAtom; // We'll match any namespace.
if (m_namespaces) {
- CSSNamespace* ns = m_namespaces->namespaceForPrefix(prefix);
- if (ns)
- return ns->uri();
+ if (CSSNamespace* namespaceForPrefix = m_namespaces->namespaceForPrefix(prefix))
+ return namespaceForPrefix->uri;
}
- return nullAtom; // Assume we wont match any namespaces.
+ return nullAtom; // Assume we won't match any namespaces.
}
bool CSSStyleSheet::parseString(const String &string, bool strict)
@@ -224,14 +219,14 @@ void CSSStyleSheet::styleSheetChanged()
StyleBase* root = this;
while (StyleBase* parent = root->parent())
root = parent;
- Document* documentToUpdate = root->isCSSStyleSheet() ? static_cast<CSSStyleSheet*>(root)->doc() : 0;
+ Document* documentToUpdate = root->isCSSStyleSheet() ? static_cast<CSSStyleSheet*>(root)->document() : 0;
/* FIXME: We don't need to do everything updateStyleSelector does,
* basically we just need to recreate the document's selector with the
* already existing style sheets.
*/
if (documentToUpdate)
- documentToUpdate->updateStyleSelector();
+ documentToUpdate->styleSelectorChanged(DeferRecalcStyle);
}
KURL CSSStyleSheet::completeURL(const String& url) const
diff --git a/WebCore/css/CSSStyleSheet.h b/WebCore/css/CSSStyleSheet.h
index fe82794..3b18522 100644
--- a/WebCore/css/CSSStyleSheet.h
+++ b/WebCore/css/CSSStyleSheet.h
@@ -1,6 +1,6 @@
/*
* (C) 1999-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -87,7 +87,7 @@ public:
virtual void checkLoaded();
- Document* doc() { return m_doc; }
+ Document* document() { return m_document; }
const String& charset() const { return m_charset; }
@@ -112,8 +112,8 @@ private:
virtual bool isCSSStyleSheet() const { return true; }
virtual String type() const { return "text/css"; }
- Document* m_doc;
- CSSNamespace* m_namespaces;
+ Document* m_document;
+ OwnPtr<CSSNamespace> m_namespaces;
String m_charset;
bool m_loadCompleted : 1;
bool m_strictParsing : 1;
diff --git a/WebCore/css/CSSValueKeywords.in b/WebCore/css/CSSValueKeywords.in
index d302990..7a9b9c7 100644
--- a/WebCore/css/CSSValueKeywords.in
+++ b/WebCore/css/CSSValueKeywords.in
@@ -288,6 +288,8 @@ tigrinya-et-abegede
ethiopic-abegede-ti-et
upper-greek
upper-norwegian
+asterisks
+footnotes
hebrew
armenian
georgian
@@ -585,6 +587,7 @@ media-volume-slider
media-volume-sliderthumb
media-volume-slider-mute-button
media-controls-background
+media-controls-fullscreen-background
media-current-time-display
media-time-remaining-display
menulist
diff --git a/WebCore/css/CSSValueList.cpp b/WebCore/css/CSSValueList.cpp
index 8f1f88d..f8d8457 100644
--- a/WebCore/css/CSSValueList.cpp
+++ b/WebCore/css/CSSValueList.cpp
@@ -1,6 +1,6 @@
-/**
+/*
* (C) 1999-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -17,11 +17,13 @@
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
+
#include "config.h"
#include "CSSValueList.h"
#include "CSSParserValues.h"
#include "PlatformString.h"
+#include <wtf/PassOwnPtr.h>
namespace WebCore {
@@ -34,11 +36,9 @@ CSSValueList::CSSValueList(CSSParserValueList* list)
: m_isSpaceSeparated(true)
{
if (list) {
- unsigned s = list->size();
- for (unsigned i = 0; i < s; ++i) {
- CSSParserValue* v = list->valueAt(i);
- append(v->createCSSValue());
- }
+ size_t size = list->size();
+ for (unsigned i = 0; i < size; ++i)
+ append(list->valueAt(i)->createCSSValue());
}
}
@@ -120,15 +120,15 @@ String CSSValueList::cssText() const
return result;
}
-CSSParserValueList* CSSValueList::createParserValueList() const
+PassOwnPtr<CSSParserValueList> CSSValueList::createParserValueList() const
{
- unsigned s = m_values.size();
- if (!s)
+ size_t size = m_values.size();
+ if (!size)
return 0;
- CSSParserValueList* result = new CSSParserValueList;
- for (unsigned i = 0; i < s; ++i)
+ OwnPtr<CSSParserValueList> result = adoptPtr(new CSSParserValueList);
+ for (size_t i = 0; i < size; ++i)
result->addValue(m_values[i]->parserValue());
- return result;
+ return result.release();
}
void CSSValueList::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const CSSStyleSheet* styleSheet)
diff --git a/WebCore/css/CSSValueList.h b/WebCore/css/CSSValueList.h
index b835345..0d5c882 100644
--- a/WebCore/css/CSSValueList.h
+++ b/WebCore/css/CSSValueList.h
@@ -1,6 +1,6 @@
/*
* (C) 1999-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -58,7 +58,7 @@ public:
virtual String cssText() const;
- CSSParserValueList* createParserValueList() const;
+ PassOwnPtr<CSSParserValueList> createParserValueList() const;
virtual void addSubresourceStyleURLs(ListHashSet<KURL>&, const CSSStyleSheet*);
diff --git a/WebCore/css/CSSVariablesDeclaration.cpp b/WebCore/css/CSSVariablesDeclaration.cpp
index cb852cb..e40750a 100644
--- a/WebCore/css/CSSVariablesDeclaration.cpp
+++ b/WebCore/css/CSSVariablesDeclaration.cpp
@@ -169,7 +169,7 @@ void CSSVariablesDeclaration::setNeedsStyleRecalc()
while (StyleBase* parent = root->parent())
root = parent;
if (root->isCSSStyleSheet())
- static_cast<CSSStyleSheet*>(root)->doc()->updateStyleSelector();
+ static_cast<CSSStyleSheet*>(root)->document()->styleSelectorChanged(DeferRecalcStyle);
}
}
diff --git a/WebCore/css/MediaList.cpp b/WebCore/css/MediaList.cpp
index 85cf590..e67c9c7 100644
--- a/WebCore/css/MediaList.cpp
+++ b/WebCore/css/MediaList.cpp
@@ -1,6 +1,6 @@
/*
* (C) 1999-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2006 Apple Computer, Inc.
+ * Copyright (C) 2004, 2006, 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -122,7 +122,7 @@ void MediaList::deleteMedium(const String& oldMedium, ExceptionCode& ec)
CSSParser p(true);
MediaQuery* oldQuery = 0;
- bool deleteOldQuery = false;
+ OwnPtr<MediaQuery> createdQuery;
if (p.parseMediaQuery(tempMediaList.get(), oldMedium)) {
if (tempMediaList->m_queries.size() > 0)
@@ -130,8 +130,8 @@ void MediaList::deleteMedium(const String& oldMedium, ExceptionCode& ec)
} else if (m_fallback) {
String medium = parseMediaDescriptor(oldMedium);
if (!medium.isNull()) {
- oldQuery = new MediaQuery(MediaQuery::None, medium, 0);
- deleteOldQuery = true;
+ createdQuery = adoptPtr(new MediaQuery(MediaQuery::None, medium, 0));
+ oldQuery = createdQuery.get();
}
}
@@ -148,8 +148,6 @@ void MediaList::deleteMedium(const String& oldMedium, ExceptionCode& ec)
break;
}
}
- if (deleteOldQuery)
- delete oldQuery;
}
if (!ec)
@@ -242,9 +240,9 @@ void MediaList::appendMedium(const String& newMedium, ExceptionCode& ec)
notifyChanged();
}
-void MediaList::appendMediaQuery(MediaQuery* mediaQuery)
+void MediaList::appendMediaQuery(PassOwnPtr<MediaQuery> mediaQuery)
{
- m_queries.append(mediaQuery);
+ m_queries.append(mediaQuery.leakPtr());
}
void MediaList::notifyChanged()
diff --git a/WebCore/css/MediaList.h b/WebCore/css/MediaList.h
index e91ca9d..f4b1fa7 100644
--- a/WebCore/css/MediaList.h
+++ b/WebCore/css/MediaList.h
@@ -1,6 +1,6 @@
/*
* (C) 1999-2003 Lars Knoll (knoll@kde.org)
- * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -73,7 +73,7 @@ public:
String mediaText() const;
void setMediaText(const String&, ExceptionCode&xo);
- void appendMediaQuery(MediaQuery*);
+ void appendMediaQuery(PassOwnPtr<MediaQuery>);
const Vector<MediaQuery*>& mediaQueries() const { return m_queries; }
private:
diff --git a/WebCore/css/fullscreen.css b/WebCore/css/fullscreen.css
new file mode 100644
index 0000000..ebf3a02
--- /dev/null
+++ b/WebCore/css/fullscreen.css
@@ -0,0 +1,27 @@
+:-webkit-full-screen {
+ position:fixed;
+ top:0;
+ left:0;
+ right:0;
+ bottom:0;
+}
+
+:root:full-screen-document:not(:full-screen) {
+ overflow:hidden;
+}
+
+video:-webkit-full-screen {
+ width: 100%;
+ height: 100%
+ image-fit: fill;
+}
+
+img:-webkit-full-screen {
+ width: 100%;
+ height: 100%;
+ image-fit: fill;
+}
+
+video:-webkit-full-page-media:-webkit-full-screen::-webkit-media-controls-panel {
+ bottom: 0px;
+}