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

Side by Side Diff: third_party/WebKit/Source/core/style/StyleGeneratedImage.cpp

Issue 1720853002: Remove Image::computeIntrinsicDimensions() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-and-use-updateconcretesize-upload
Patch Set: Avoid using the size of the error image. Null-check in ImageResource saved the day in previous patc… Created 4 years, 9 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 { 50 {
51 if (m_fixedSize) { 51 if (m_fixedSize) {
52 FloatSize unzoomedDefaultObjectSize(defaultObjectSize); 52 FloatSize unzoomedDefaultObjectSize(defaultObjectSize);
53 unzoomedDefaultObjectSize.scale(1 / multiplier); 53 unzoomedDefaultObjectSize.scale(1 / multiplier);
54 return applyZoom(LayoutSize(m_imageGeneratorValue->fixedSize(layoutObjec t, unzoomedDefaultObjectSize)), multiplier); 54 return applyZoom(LayoutSize(m_imageGeneratorValue->fixedSize(layoutObjec t, unzoomedDefaultObjectSize)), multiplier);
55 } 55 }
56 56
57 return defaultObjectSize; 57 return defaultObjectSize;
58 } 58 }
59 59
60 void StyleGeneratedImage::computeIntrinsicDimensions(const LayoutObject* layoutO bject, FloatSize& intrinsicSize, FloatSize& intrinsicRatio)
61 {
62 // At a zoom level of 1 the image is guaranteed to have an integer size.
63 LayoutSize size = imageSize(layoutObject, 1, LayoutSize());
64 ASSERT(size.fraction().isZero());
65 intrinsicSize = intrinsicRatio = FloatSize(size);
66 }
67
68 void StyleGeneratedImage::addClient(LayoutObject* layoutObject) 60 void StyleGeneratedImage::addClient(LayoutObject* layoutObject)
69 { 61 {
70 m_imageGeneratorValue->addClient(layoutObject, IntSize()); 62 m_imageGeneratorValue->addClient(layoutObject, IntSize());
71 } 63 }
72 64
73 void StyleGeneratedImage::removeClient(LayoutObject* layoutObject) 65 void StyleGeneratedImage::removeClient(LayoutObject* layoutObject)
74 { 66 {
75 m_imageGeneratorValue->removeClient(layoutObject); 67 m_imageGeneratorValue->removeClient(layoutObject);
76 } 68 }
77 69
78 PassRefPtr<Image> StyleGeneratedImage::image(const LayoutObject* layoutObject, c onst IntSize& size, float) const 70 PassRefPtr<Image> StyleGeneratedImage::image(const LayoutObject* layoutObject, c onst IntSize& size, float) const
79 { 71 {
80 return m_imageGeneratorValue->image(layoutObject, size); 72 return m_imageGeneratorValue->image(layoutObject, size);
81 } 73 }
82 74
83 bool StyleGeneratedImage::knownToBeOpaque(const LayoutObject* layoutObject) cons t 75 bool StyleGeneratedImage::knownToBeOpaque(const LayoutObject* layoutObject) cons t
84 { 76 {
85 return m_imageGeneratorValue->knownToBeOpaque(layoutObject); 77 return m_imageGeneratorValue->knownToBeOpaque(layoutObject);
86 } 78 }
87 79
88 DEFINE_TRACE(StyleGeneratedImage) 80 DEFINE_TRACE(StyleGeneratedImage)
89 { 81 {
90 visitor->trace(m_imageGeneratorValue); 82 visitor->trace(m_imageGeneratorValue);
91 StyleImage::trace(visitor); 83 StyleImage::trace(visitor);
92 } 84 }
93 85
94 } // namespace blink 86 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698