https://bugs.webkit.org/show_bug.cgi?id=83740
Reviewed by Andreas Kling.
The style sheet is set when the rule is added to one. The parser does not need to know about it.
* css/CSSImportRule.cpp:
(WebCore::StyleRuleImport::StyleRuleImport):
* css/CSSImportRule.h:
(StyleRuleImport):
(WebCore::StyleRuleImport::setParentStyleSheet):
* css/CSSParser.cpp:
(WebCore::CSSParser::createImportRule):
* css/CSSStyleSheet.cpp:
(WebCore::StyleSheetInternal::parserAppendRule):
(WebCore::StyleSheetInternal::wrapperInsertRule):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114006
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-04-12 Antti Koivisto <antti@apple.com>
+
+ Remove style sheet argument from StyleRuleImport constructor
+ https://bugs.webkit.org/show_bug.cgi?id=83740
+
+ Reviewed by Andreas Kling.
+
+ The style sheet is set when the rule is added to one. The parser does not need to know about it.
+
+ * css/CSSImportRule.cpp:
+ (WebCore::StyleRuleImport::StyleRuleImport):
+ * css/CSSImportRule.h:
+ (StyleRuleImport):
+ (WebCore::StyleRuleImport::setParentStyleSheet):
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::createImportRule):
+ * css/CSSStyleSheet.cpp:
+ (WebCore::StyleSheetInternal::parserAppendRule):
+ (WebCore::StyleSheetInternal::wrapperInsertRule):
+
2012-04-12 Alexey Proskuryakov <ap@apple.com>
REGRESSION (r113900): In nightly builds, Safari Webpage Preview Fetcher crashes in Settings::initializeDefaultFontFamilies() due to uncaught exception (sandbox preventing access to fonts plist)
namespace WebCore {
-PassRefPtr<StyleRuleImport> StyleRuleImport::create(StyleSheetInternal* parent, const String& href, PassRefPtr<MediaQuerySet> media)
+PassRefPtr<StyleRuleImport> StyleRuleImport::create(const String& href, PassRefPtr<MediaQuerySet> media)
{
- return adoptRef(new StyleRuleImport(parent, href, media));
+ return adoptRef(new StyleRuleImport(href, media));
}
-StyleRuleImport::StyleRuleImport(StyleSheetInternal* parent, const String& href, PassRefPtr<MediaQuerySet> media)
+StyleRuleImport::StyleRuleImport(const String& href, PassRefPtr<MediaQuerySet> media)
: StyleRuleBase(Import, 0)
- , m_parentStyleSheet(parent)
+ , m_parentStyleSheet(0)
, m_styleSheetClient(this)
, m_strHref(href)
, m_mediaQueries(media)
, m_cachedSheet(0)
, m_loading(false)
{
- ASSERT(parent);
if (!m_mediaQueries)
m_mediaQueries = MediaQuerySet::create(String());
}
class StyleRuleImport : public StyleRuleBase {
public:
- static PassRefPtr<StyleRuleImport> create(StyleSheetInternal* parent, const String& href, PassRefPtr<MediaQuerySet>);
+ static PassRefPtr<StyleRuleImport> create(const String& href, PassRefPtr<MediaQuerySet>);
~StyleRuleImport();
StyleSheetInternal* parentStyleSheet() const { return m_parentStyleSheet; }
+ void setParentStyleSheet(StyleSheetInternal* sheet) { ASSERT(sheet); m_parentStyleSheet = sheet; }
void clearParentStyleSheet() { m_parentStyleSheet = 0; }
String href() const { return m_strHref; }
void setCSSStyleSheet(const String& href, const KURL& baseURL, const String& charset, const CachedCSSStyleSheet*);
friend class ImportedStyleSheetClient;
- StyleRuleImport(StyleSheetInternal* parent, const String& href, PassRefPtr<MediaQuerySet>);
+ StyleRuleImport(const String& href, PassRefPtr<MediaQuerySet>);
StyleSheetInternal* m_parentStyleSheet;
StyleRuleBase* CSSParser::createImportRule(const CSSParserString& url, MediaQuerySet* media)
{
- if (!media || !m_styleSheet || !m_allowImportRules)
+ if (!media || !m_allowImportRules)
return 0;
- RefPtr<StyleRuleImport> rule = StyleRuleImport::create(m_styleSheet, url, media);
+ RefPtr<StyleRuleImport> rule = StyleRuleImport::create(url, media);
StyleRuleImport* result = rule.get();
m_parsedRules.append(rule.release());
return result;
// Parser enforces that @import rules come before anything else except @charset.
ASSERT(m_childRules.isEmpty());
m_importRules.append(static_cast<StyleRuleImport*>(rule.get()));
+ m_importRules.last()->setParentStyleSheet(this);
m_importRules.last()->requestStyleSheet();
return;
}
if (!rule->isImportRule())
return false;
m_importRules.insert(childVectorIndex, static_cast<StyleRuleImport*>(rule.get()));
+ m_importRules[childVectorIndex]->setParentStyleSheet(this);
m_importRules[childVectorIndex]->requestStyleSheet();
// FIXME: Stylesheet doesn't actually change meaningfully before the imported sheets are loaded.
styleSheetChanged();