Title: [157792] trunk/Source/WebCore
Revision
157792
Author
akl...@apple.com
Date
2013-10-22 07:43:48 -0700 (Tue, 22 Oct 2013)

Log Message

CSSStyleSheet constructor functions should return PassRef.
<https://webkit.org/b/123156>

Make CSSStyleSheet::create*() return PassRef and tighten some call
sites that were using them. Most callers didn't need any tweaks to
take advantage of PassRef.

Reviewed by Antti Koivisto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (157791 => 157792)


--- trunk/Source/WebCore/ChangeLog	2013-10-22 14:43:01 UTC (rev 157791)
+++ trunk/Source/WebCore/ChangeLog	2013-10-22 14:43:48 UTC (rev 157792)
@@ -1,5 +1,16 @@
 2013-10-22  Andreas Kling  <akl...@apple.com>
 
+        CSSStyleSheet constructor functions should return PassRef.
+        <https://webkit.org/b/123156>
+
+        Make CSSStyleSheet::create*() return PassRef and tighten some call
+        sites that were using them. Most callers didn't need any tweaks to
+        take advantage of PassRef.
+
+        Reviewed by Antti Koivisto.
+
+2013-10-22  Andreas Kling  <akl...@apple.com>
+
         CTTE: RenderMathMLFraction always has a MathMLInlineContainerElement.
         <https://webkit.org/b/123154>
 

Modified: trunk/Source/WebCore/css/CSSStyleSheet.cpp (157791 => 157792)


--- trunk/Source/WebCore/css/CSSStyleSheet.cpp	2013-10-22 14:43:01 UTC (rev 157791)
+++ trunk/Source/WebCore/css/CSSStyleSheet.cpp	2013-10-22 14:43:48 UTC (rev 157792)
@@ -76,20 +76,20 @@
 }
 #endif
 
-PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRef<StyleSheetContents> sheet, CSSImportRule* ownerRule)
+PassRef<CSSStyleSheet> CSSStyleSheet::create(PassRef<StyleSheetContents> sheet, CSSImportRule* ownerRule)
 { 
-    return adoptRef(new CSSStyleSheet(std::move(sheet), ownerRule));
+    return adoptRef(*new CSSStyleSheet(std::move(sheet), ownerRule));
 }
 
-PassRefPtr<CSSStyleSheet> CSSStyleSheet::create(PassRef<StyleSheetContents> sheet, Node* ownerNode)
+PassRef<CSSStyleSheet> CSSStyleSheet::create(PassRef<StyleSheetContents> sheet, Node* ownerNode)
 { 
-    return adoptRef(new CSSStyleSheet(std::move(sheet), ownerNode, false));
+    return adoptRef(*new CSSStyleSheet(std::move(sheet), ownerNode, false));
 }
 
-PassRefPtr<CSSStyleSheet> CSSStyleSheet::createInline(Node& ownerNode, const URL& baseURL, const String& encoding)
+PassRef<CSSStyleSheet> CSSStyleSheet::createInline(Node& ownerNode, const URL& baseURL, const String& encoding)
 {
     CSSParserContext parserContext(ownerNode.document(), baseURL, encoding);
-    return adoptRef(new CSSStyleSheet(StyleSheetContents::create(baseURL.string(), parserContext), &ownerNode, true));
+    return adoptRef(*new CSSStyleSheet(StyleSheetContents::create(baseURL.string(), parserContext), &ownerNode, true));
 }
 
 CSSStyleSheet::CSSStyleSheet(PassRef<StyleSheetContents> contents, CSSImportRule* ownerRule)

Modified: trunk/Source/WebCore/css/CSSStyleSheet.h (157791 => 157792)


--- trunk/Source/WebCore/css/CSSStyleSheet.h	2013-10-22 14:43:01 UTC (rev 157791)
+++ trunk/Source/WebCore/css/CSSStyleSheet.h	2013-10-22 14:43:48 UTC (rev 157792)
@@ -47,9 +47,9 @@
 
 class CSSStyleSheet FINAL : public StyleSheet {
 public:
-    static PassRefPtr<CSSStyleSheet> create(PassRef<StyleSheetContents>, CSSImportRule* ownerRule = 0);
-    static PassRefPtr<CSSStyleSheet> create(PassRef<StyleSheetContents>, Node* ownerNode);
-    static PassRefPtr<CSSStyleSheet> createInline(Node&, const URL&, const String& encoding = String());
+    static PassRef<CSSStyleSheet> create(PassRef<StyleSheetContents>, CSSImportRule* ownerRule = 0);
+    static PassRef<CSSStyleSheet> create(PassRef<StyleSheetContents>, Node* ownerNode);
+    static PassRef<CSSStyleSheet> createInline(Node&, const URL&, const String& encoding = String());
 
     virtual ~CSSStyleSheet();
 

Modified: trunk/Source/WebCore/dom/DOMImplementation.cpp (157791 => 157792)


--- trunk/Source/WebCore/dom/DOMImplementation.cpp	2013-10-22 14:43:01 UTC (rev 157791)
+++ trunk/Source/WebCore/dom/DOMImplementation.cpp	2013-10-22 14:43:48 UTC (rev 157792)
@@ -262,9 +262,9 @@
 {
     // FIXME: Title should be set.
     // FIXME: Media could have wrong syntax, in which case we should generate an exception.
-    RefPtr<CSSStyleSheet> sheet = CSSStyleSheet::create(StyleSheetContents::create());
-    sheet->setMediaQueries(MediaQuerySet::createAllowingDescriptionSyntax(media));
-    return sheet;
+    auto sheet = CSSStyleSheet::create(StyleSheetContents::create());
+    sheet.get().setMediaQueries(MediaQuerySet::createAllowingDescriptionSyntax(media));
+    return std::move(sheet);
 }
 
 static inline bool isValidXMLMIMETypeChar(UChar c)

Modified: trunk/Source/WebCore/dom/ProcessingInstruction.cpp (157791 => 157792)


--- trunk/Source/WebCore/dom/ProcessingInstruction.cpp	2013-10-22 14:43:01 UTC (rev 157791)
+++ trunk/Source/WebCore/dom/ProcessingInstruction.cpp	2013-10-22 14:43:48 UTC (rev 157792)
@@ -198,12 +198,12 @@
     ASSERT(m_isCSS);
     CSSParserContext parserContext(document(), baseURL, charset);
 
-    RefPtr<CSSStyleSheet> cssSheet = CSSStyleSheet::create(StyleSheetContents::create(href, parserContext), this);
-    cssSheet->setDisabled(m_alternate);
-    cssSheet->setTitle(m_title);
-    cssSheet->setMediaQueries(MediaQuerySet::create(m_media));
+    auto cssSheet = CSSStyleSheet::create(StyleSheetContents::create(href, parserContext), this);
+    cssSheet.get().setDisabled(m_alternate);
+    cssSheet.get().setTitle(m_title);
+    cssSheet.get().setMediaQueries(MediaQuerySet::create(m_media));
 
-    m_sheet = cssSheet.release();
+    m_sheet = std::move(cssSheet);
 
     // We don't need the cross-origin security check here because we are
     // getting the sheet text in "strict" mode. This enforces a valid CSS MIME
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to