Reviewed by Darin Adler.
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Mar 2009 22:14:57 +0000 (22:14 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Mar 2009 22:14:57 +0000 (22:14 +0000)
        Move ASSERT(foo) to before where foo-> is used
        https://bugs.webkit.org/show_bug.cgi?id=24684

        * platform/chromium/PasteboardChromium.cpp:
        (WebCore::Pasteboard::writeImage):
          Move ASSERTs to the top of the function, code was using "node" before ASSERT(node), once I moved
          ASSERT(node) to the top of the function it made sense to move the rest of them there too.
        * rendering/SVGRenderSupport.cpp:
        (WebCore::prepareToRenderSVGContent):
          move ASSERT(object) to *before* we use "object" :)

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@41990 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/chromium/PasteboardChromium.cpp
WebCore/rendering/SVGRenderSupport.cpp

index 9fa3601..31ec679 100644 (file)
 
 2009-03-24  Eric Seidel  <eric@webkit.org>
 
+        Reviewed by Darin Adler.
+
+        Move ASSERT(foo) to before where foo-> is used
+        https://bugs.webkit.org/show_bug.cgi?id=24684
+
+        * platform/chromium/PasteboardChromium.cpp:
+        (WebCore::Pasteboard::writeImage):
+          Move ASSERTs to the top of the function, code was using "node" before ASSERT(node), once I moved
+          ASSERT(node) to the top of the function it made sense to move the rest of them there too.
+        * rendering/SVGRenderSupport.cpp:
+        (WebCore::prepareToRenderSVGContent):
+          move ASSERT(object) to *before* we use "object" :)
+
+2009-03-24  Eric Seidel  <eric@webkit.org>
+
         Reviewed by Simon Fraser.
 
         Make TextTokenizer ASSERT that the buffer was freed
index e7b2203..9b32bae 100644 (file)
@@ -98,6 +98,15 @@ void Pasteboard::writeURL(const KURL& url, const String& titleStr, Frame* frame)
 
 void Pasteboard::writeImage(Node* node, const KURL&, const String& title)
 {
+    ASSERT(node);
+    ASSERT(node->renderer());
+    ASSERT(node->renderer()->isImage());
+    RenderImage* renderer = static_cast<RenderImage*>(node->renderer());
+    CachedImage* cachedImage = static_cast<CachedImage*>(renderer->cachedImage());
+    ASSERT(cachedImage);
+    Image* image = cachedImage->image();
+    ASSERT(image);
+
     // If the image is wrapped in a link, |url| points to the target of the
     // link.  This isn't useful to us, so get the actual image URL.
     AtomicString urlString;
@@ -113,16 +122,6 @@ void Pasteboard::writeImage(Node* node, const KURL&, const String& title)
     }
     KURL url = urlString.isEmpty() ? KURL() : node->document()->completeURL(parseURL(urlString));
 
-    ASSERT(node);
-    ASSERT(node->renderer());
-    ASSERT(node->renderer()->isImage());
-
-    RenderImage* renderer = static_cast<RenderImage*>(node->renderer());
-    CachedImage* cachedImage = static_cast<CachedImage*>(renderer->cachedImage());
-    ASSERT(cachedImage);
-    Image* image = cachedImage->image();
-    ASSERT(image);
-
     NativeImageSkia* bitmap = 0;
 #if !PLATFORM(CG)
     bitmap = image->nativeImageForCurrentFrame();
index 6d43e85..dd154c7 100644 (file)
@@ -46,9 +46,9 @@ void prepareToRenderSVGContent(RenderObject* object, RenderObject::PaintInfo& pa
     UNUSED_PARAM(rootFilter);
 #endif
 
+    ASSERT(object);
     SVGElement* svgElement = static_cast<SVGElement*>(object->node());
     ASSERT(svgElement && svgElement->document() && svgElement->isStyled());
-    ASSERT(object);
 
     SVGStyledElement* styledElement = static_cast<SVGStyledElement*>(svgElement);
     const RenderStyle* style = object->style();