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

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

Issue 2557783002: Improve metrics for display list canvas fallback reason (Closed)
Patch Set: Created 4 years 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 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights
5 * reserved. 5 * reserved.
6 * Copyright (C) 2010 Google Inc. All rights reserved. 6 * Copyright (C) 2010 Google Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 860
861 bool HTMLImageElement::isOpaque() const { 861 bool HTMLImageElement::isOpaque() const {
862 Image* image = const_cast<HTMLImageElement*>(this)->imageContents(); 862 Image* image = const_cast<HTMLImageElement*>(this)->imageContents();
863 return image && image->currentFrameKnownToBeOpaque(); 863 return image && image->currentFrameKnownToBeOpaque();
864 } 864 }
865 865
866 int HTMLImageElement::sourceWidth() { 866 int HTMLImageElement::sourceWidth() {
867 SourceImageStatus status; 867 SourceImageStatus status;
868 FloatSize defaultObjectSize(width(), height()); 868 FloatSize defaultObjectSize(width(), height());
869 RefPtr<Image> image = getSourceImageForCanvas( 869 RefPtr<Image> image = getSourceImageForCanvas(
870 &status, PreferNoAcceleration, SnapshotReasonCopyToWebGLTexture, 870 &status, PreferNoAcceleration, SnapshotReasonUnknown, defaultObjectSize);
871 defaultObjectSize);
872 return image->width(); 871 return image->width();
873 } 872 }
874 873
875 int HTMLImageElement::sourceHeight() { 874 int HTMLImageElement::sourceHeight() {
876 SourceImageStatus status; 875 SourceImageStatus status;
877 FloatSize defaultObjectSize(width(), height()); 876 FloatSize defaultObjectSize(width(), height());
878 RefPtr<Image> image = getSourceImageForCanvas( 877 RefPtr<Image> image = getSourceImageForCanvas(
879 &status, PreferNoAcceleration, SnapshotReasonCopyToWebGLTexture, 878 &status, PreferNoAcceleration, SnapshotReasonUnknown, defaultObjectSize);
880 defaultObjectSize);
881 return image->height(); 879 return image->height();
882 } 880 }
883 881
884 IntSize HTMLImageElement::bitmapSourceSize() const { 882 IntSize HTMLImageElement::bitmapSourceSize() const {
885 ImageResource* image = cachedImage(); 883 ImageResource* image = cachedImage();
886 if (!image) 884 if (!image)
887 return IntSize(); 885 return IntSize();
888 LayoutSize lSize = image->imageSize( 886 LayoutSize lSize = image->imageSize(
889 LayoutObject::shouldRespectImageOrientation(layoutObject()), 1.0f); 887 LayoutObject::shouldRespectImageOrientation(layoutObject()), 1.0f);
890 DCHECK(lSize.fraction().isZero()); 888 DCHECK(lSize.fraction().isZero());
891 return IntSize(lSize.width().toInt(), lSize.height().toInt()); 889 return IntSize(lSize.width().toInt(), lSize.height().toInt());
892 } 890 }
893 891
894 } // namespace blink 892 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698