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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/Image.h

Issue 1694263003: Add Image::updateConcreteSize() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-size-calculation-in
Patch Set: Add some documentation and polish title of test. 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) 2006 Samuel Weinig (sam.weinig@gmail.com) 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 bool isNull() const { return size().isEmpty(); } 91 bool isNull() const { return size().isEmpty(); }
92 92
93 virtual bool usesContainerSize() const { return false; } 93 virtual bool usesContainerSize() const { return false; }
94 virtual bool hasRelativeSize() const { return false; } 94 virtual bool hasRelativeSize() const { return false; }
95 95
96 // Computes (extracts) the intrinsic dimensions and ratio from the Image. Th e intrinsic ratio 96 // Computes (extracts) the intrinsic dimensions and ratio from the Image. Th e intrinsic ratio
97 // will be the 'viewport' of the image. (Same as the dimensions for a raster image. For SVG 97 // will be the 'viewport' of the image. (Same as the dimensions for a raster image. For SVG
98 // images it can be the dimensions defined by the 'viewBox'.) 98 // images it can be the dimensions defined by the 'viewBox'.)
99 virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intr insicHeight, FloatSize& intrinsicRatio); 99 virtual void computeIntrinsicDimensions(Length& intrinsicWidth, Length& intr insicHeight, FloatSize& intrinsicRatio);
100 100
101 // "The concrete object size is the result of combining an
102 // object’s intrinsic dimensions and specified size with the
fs 2016/02/23 11:44:23 Is that U+2019? Might want to avoid that and go wi
davve 2016/02/23 13:15:31 Yes, I c&p from spec text... Good old U+0027 comin
103 // default object size of the context it’s used in, producing a
104 // rectangle with a definite width and height."
105 //
106 // https://drafts.csswg.org/css-images-3/#concrete-object-size
107 //
108 // Updates the image size to a new default object size.
109 virtual void updateConcreteObjectSize(const LayoutSize& defaultObjectSize) { }
110
101 virtual IntSize size() const = 0; 111 virtual IntSize size() const = 0;
102 IntRect rect() const { return IntRect(IntPoint(), size()); } 112 IntRect rect() const { return IntRect(IntPoint(), size()); }
103 int width() const { return size().width(); } 113 int width() const { return size().width(); }
104 int height() const { return size().height(); } 114 int height() const { return size().height(); }
105 virtual bool getHotSpot(IntPoint&) const { return false; } 115 virtual bool getHotSpot(IntPoint&) const { return false; }
106 116
107 bool setData(PassRefPtr<SharedBuffer> data, bool allDataReceived); 117 bool setData(PassRefPtr<SharedBuffer> data, bool allDataReceived);
108 virtual bool dataChanged(bool /*allDataReceived*/) { return false; } 118 virtual bool dataChanged(bool /*allDataReceived*/) { return false; }
109 119
110 virtual String filenameExtension() const { return String(); } // null string if unknown 120 virtual String filenameExtension() const { return String(); } // null string if unknown
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // being responsible of clearing itself out. 179 // being responsible of clearing itself out.
170 RawPtrWillBeUntracedMember<ImageObserver> m_imageObserver; 180 RawPtrWillBeUntracedMember<ImageObserver> m_imageObserver;
171 }; 181 };
172 182
173 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ 183 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \
174 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t ypeName()) 184 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t ypeName())
175 185
176 } // namespace blink 186 } // namespace blink
177 187
178 #endif 188 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698