Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLImageElement.cpp

Issue 2258033002: Replace ASSERT()s with DCHECK*() in core/html/*.{cpp,h}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Replace ASSERT()s with DCHECK*() in core/html/*.{cpp,h}. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed.
5 * Copyright (C) 2010 Google Inc. All rights reserved. 5 * Copyright (C) 2010 Google Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 return m_bestFitImageURL.isNull() ? fastGetAttribute(srcAttr) : m_bestFitIma geURL; 194 return m_bestFitImageURL.isNull() ? fastGetAttribute(srcAttr) : m_bestFitIma geURL;
195 } 195 }
196 196
197 HTMLFormElement* HTMLImageElement::formOwner() const 197 HTMLFormElement* HTMLImageElement::formOwner() const
198 { 198 {
199 return m_form.get(); 199 return m_form.get();
200 } 200 }
201 201
202 void HTMLImageElement::formRemovedFromTree(const Node& formRoot) 202 void HTMLImageElement::formRemovedFromTree(const Node& formRoot)
203 { 203 {
204 ASSERT(m_form); 204 DCHECK(m_form);
205 if (NodeTraversal::highestAncestorOrSelf(*this) != formRoot) 205 if (NodeTraversal::highestAncestorOrSelf(*this) != formRoot)
206 resetFormOwner(); 206 resetFormOwner();
207 } 207 }
208 208
209 void HTMLImageElement::resetFormOwner() 209 void HTMLImageElement::resetFormOwner()
210 { 210 {
211 m_formWasSetByParser = false; 211 m_formWasSetByParser = false;
212 HTMLFormElement* nearestForm = findFormAncestor(); 212 HTMLFormElement* nearestForm = findFormAncestor();
213 if (m_form) { 213 if (m_form) {
214 if (nearestForm == m_form.get()) 214 if (nearestForm == m_form.get())
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 String trimmedType = ContentType(type).type(); 289 String trimmedType = ContentType(type).type();
290 // An empty type attribute is implicitly supported. 290 // An empty type attribute is implicitly supported.
291 if (trimmedType.isEmpty()) 291 if (trimmedType.isEmpty())
292 return true; 292 return true;
293 return MIMETypeRegistry::isSupportedImagePrefixedMIMEType(trimmedType); 293 return MIMETypeRegistry::isSupportedImagePrefixedMIMEType(trimmedType);
294 } 294 }
295 295
296 // http://picture.responsiveimages.org/#update-source-set 296 // http://picture.responsiveimages.org/#update-source-set
297 ImageCandidate HTMLImageElement::findBestFitImageFromPictureParent() 297 ImageCandidate HTMLImageElement::findBestFitImageFromPictureParent()
298 { 298 {
299 ASSERT(isMainThread()); 299 DCHECK(isMainThread());
300 Node* parent = parentNode(); 300 Node* parent = parentNode();
301 m_source = nullptr; 301 m_source = nullptr;
302 if (!parent || !isHTMLPictureElement(*parent)) 302 if (!parent || !isHTMLPictureElement(*parent))
303 return ImageCandidate(); 303 return ImageCandidate();
304 for (Node* child = parent->firstChild(); child; child = child->nextSibling() ) { 304 for (Node* child = parent->firstChild(); child; child = child->nextSibling() ) {
305 if (child == this) 305 if (child == this)
306 return ImageCandidate(); 306 return ImageCandidate();
307 307
308 if (!isHTMLSourceElement(*child)) 308 if (!isHTMLSourceElement(*child))
309 continue; 309 continue;
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 return value; 682 return value;
683 } 683 }
684 684
685 void HTMLImageElement::forceReload() const 685 void HTMLImageElement::forceReload() const
686 { 686 {
687 imageLoader().updateFromElement(ImageLoader::UpdateForcedReload, m_referrerP olicy); 687 imageLoader().updateFromElement(ImageLoader::UpdateForcedReload, m_referrerP olicy);
688 } 688 }
689 689
690 ScriptPromise HTMLImageElement::createImageBitmap(ScriptState* scriptState, Even tTarget& eventTarget, Optional<IntRect> cropRect, const ImageBitmapOptions& opti ons, ExceptionState& exceptionState) 690 ScriptPromise HTMLImageElement::createImageBitmap(ScriptState* scriptState, Even tTarget& eventTarget, Optional<IntRect> cropRect, const ImageBitmapOptions& opti ons, ExceptionState& exceptionState)
691 { 691 {
692 ASSERT(eventTarget.toLocalDOMWindow()); 692 DCHECK(eventTarget.toLocalDOMWindow());
693 if ((cropRect && !ImageBitmap::isSourceSizeValid(cropRect->width(), cropRect ->height(), exceptionState)) 693 if ((cropRect && !ImageBitmap::isSourceSizeValid(cropRect->width(), cropRect ->height(), exceptionState))
694 || !ImageBitmap::isSourceSizeValid(bitmapSourceSize().width(), bitmapSou rceSize().height(), exceptionState)) 694 || !ImageBitmap::isSourceSizeValid(bitmapSourceSize().width(), bitmapSou rceSize().height(), exceptionState))
695 return ScriptPromise(); 695 return ScriptPromise();
696 if (!ImageBitmap::isResizeOptionValid(options, exceptionState)) 696 if (!ImageBitmap::isResizeOptionValid(options, exceptionState))
697 return ScriptPromise(); 697 return ScriptPromise();
698 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat e(this, cropRect, eventTarget.toLocalDOMWindow()->document(), options)); 698 return ImageBitmapSource::fulfillImageBitmap(scriptState, ImageBitmap::creat e(this, cropRect, eventTarget.toLocalDOMWindow()->document(), options));
699 } 699 }
700 700
701 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be havior) 701 void HTMLImageElement::selectSourceURL(ImageLoader::UpdateFromElementBehavior be havior)
702 { 702 {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 RefPtr<Image> image = getSourceImageForCanvas(&status, PreferNoAcceleration, SnapshotReasonCopyToWebGLTexture, defaultObjectSize); 822 RefPtr<Image> image = getSourceImageForCanvas(&status, PreferNoAcceleration, SnapshotReasonCopyToWebGLTexture, defaultObjectSize);
823 return image->height(); 823 return image->height();
824 } 824 }
825 825
826 IntSize HTMLImageElement::bitmapSourceSize() const 826 IntSize HTMLImageElement::bitmapSourceSize() const
827 { 827 {
828 ImageResource* image = cachedImage(); 828 ImageResource* image = cachedImage();
829 if (!image) 829 if (!image)
830 return IntSize(); 830 return IntSize();
831 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat ion(layoutObject()), 1.0f); 831 LayoutSize lSize = image->imageSize(LayoutObject::shouldRespectImageOrientat ion(layoutObject()), 1.0f);
832 ASSERT(lSize.fraction().isZero()); 832 DCHECK(lSize.fraction().isZero());
833 return IntSize(lSize.width(), lSize.height()); 833 return IntSize(lSize.width(), lSize.height());
834 } 834 }
835 835
836 } // namespace blink 836 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698