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

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

Issue 1685353004: Clean up Image::computeIntrinsicDimensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits Created 4 years, 10 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 if (fixedSize.height() > 0) 63 if (fixedSize.height() > 0)
64 height = max(LayoutUnit(1), height); 64 height = max(LayoutUnit(1), height);
65 65
66 return LayoutSize(width, height); 66 return LayoutSize(width, height);
67 } 67 }
68 68
69 return LayoutSize(); 69 return LayoutSize();
70 } 70 }
71 71
72 void StyleGeneratedImage::computeIntrinsicDimensions(const LayoutObject* layoutO bject, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRati o) 72 void StyleGeneratedImage::computeIntrinsicDimensions(const LayoutObject* layoutO bject, FloatSize& intrinsicSize, FloatSize& intrinsicRatio)
73 { 73 {
74 // At a zoom level of 1 the image is guaranteed to have an integer size. 74 // At a zoom level of 1 the image is guaranteed to have an integer size.
75 IntSize size = flooredIntSize(imageSize(layoutObject, 1)); 75 LayoutSize size = imageSize(layoutObject, 1);
76 intrinsicWidth = Length(size.width(), Fixed); 76 ASSERT(size.fraction().isZero());
77 intrinsicHeight = Length(size.height(), Fixed); 77 intrinsicSize = intrinsicRatio = FloatSize(size);
78 intrinsicRatio = FloatSize(size);
79 } 78 }
80 79
81 void StyleGeneratedImage::addClient(LayoutObject* layoutObject) 80 void StyleGeneratedImage::addClient(LayoutObject* layoutObject)
82 { 81 {
83 m_imageGeneratorValue->addClient(layoutObject, IntSize()); 82 m_imageGeneratorValue->addClient(layoutObject, IntSize());
84 } 83 }
85 84
86 void StyleGeneratedImage::removeClient(LayoutObject* layoutObject) 85 void StyleGeneratedImage::removeClient(LayoutObject* layoutObject)
87 { 86 {
88 m_imageGeneratorValue->removeClient(layoutObject); 87 m_imageGeneratorValue->removeClient(layoutObject);
89 } 88 }
90 89
91 PassRefPtr<Image> StyleGeneratedImage::image(const LayoutObject* layoutObject, c onst IntSize& size, float) const 90 PassRefPtr<Image> StyleGeneratedImage::image(const LayoutObject* layoutObject, c onst IntSize& size, float) const
92 { 91 {
93 return m_imageGeneratorValue->image(layoutObject, size); 92 return m_imageGeneratorValue->image(layoutObject, size);
94 } 93 }
95 94
96 bool StyleGeneratedImage::knownToBeOpaque(const LayoutObject* layoutObject) cons t 95 bool StyleGeneratedImage::knownToBeOpaque(const LayoutObject* layoutObject) cons t
97 { 96 {
98 return m_imageGeneratorValue->knownToBeOpaque(layoutObject); 97 return m_imageGeneratorValue->knownToBeOpaque(layoutObject);
99 } 98 }
100 99
101 DEFINE_TRACE(StyleGeneratedImage) 100 DEFINE_TRACE(StyleGeneratedImage)
102 { 101 {
103 visitor->trace(m_imageGeneratorValue); 102 visitor->trace(m_imageGeneratorValue);
104 StyleImage::trace(visitor); 103 StyleImage::trace(visitor);
105 } 104 }
106 105
107 } // namespace blink 106 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleGeneratedImage.h ('k') | third_party/WebKit/Source/core/style/StyleImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698