OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "bindings/core/v8/ScriptPromiseResolver.h" | 35 #include "bindings/core/v8/ScriptPromiseResolver.h" |
36 #include "core/dom/ExceptionCode.h" | 36 #include "core/dom/ExceptionCode.h" |
37 #include "core/dom/ExecutionContext.h" | 37 #include "core/dom/ExecutionContext.h" |
38 #include "core/fileapi/Blob.h" | 38 #include "core/fileapi/Blob.h" |
39 #include "core/frame/ImageBitmap.h" | 39 #include "core/frame/ImageBitmap.h" |
40 #include "core/frame/LocalDOMWindow.h" | 40 #include "core/frame/LocalDOMWindow.h" |
41 #include "core/html/HTMLCanvasElement.h" | 41 #include "core/html/HTMLCanvasElement.h" |
42 #include "core/html/HTMLImageElement.h" | 42 #include "core/html/HTMLImageElement.h" |
43 #include "core/html/HTMLVideoElement.h" | 43 #include "core/html/HTMLVideoElement.h" |
44 #include "core/html/ImageData.h" | 44 #include "core/html/ImageData.h" |
| 45 #include "core/layout/LayoutObject.h" |
45 #include "core/workers/WorkerGlobalScope.h" | 46 #include "core/workers/WorkerGlobalScope.h" |
46 #include "modules/canvas2d/CanvasRenderingContext2D.h" | 47 #include "modules/canvas2d/CanvasRenderingContext2D.h" |
47 #include "platform/SharedBuffer.h" | 48 #include "platform/SharedBuffer.h" |
48 #include "platform/graphics/BitmapImage.h" | 49 #include "platform/graphics/BitmapImage.h" |
49 #include "platform/graphics/ImageSource.h" | 50 #include "platform/graphics/ImageSource.h" |
50 #include "public/platform/WebSize.h" | 51 #include "public/platform/WebSize.h" |
51 #include <v8.h> | 52 #include <v8.h> |
52 | 53 |
53 namespace blink { | 54 namespace blink { |
54 | 55 |
55 static LayoutSize sizeFor(HTMLImageElement* image) | 56 static LayoutSize sizeFor(HTMLImageElement* image) |
56 { | 57 { |
57 if (ImageResource* cachedImage = image->cachedImage()) | 58 if (ImageResource* cachedImage = image->cachedImage()) |
58 return cachedImage->imageSizeForLayoutObject(image->layoutObject(), 1.0f
); // FIXME: Not sure about this. | 59 return cachedImage->imageSize(LayoutObject::shouldRespectImageOrientatio
n(image->layoutObject()), 1.0f); // FIXME: Not sure about this. |
59 return LayoutSize(); | 60 return LayoutSize(); |
60 } | 61 } |
61 | 62 |
62 static IntSize sizeFor(HTMLVideoElement* video) | 63 static IntSize sizeFor(HTMLVideoElement* video) |
63 { | 64 { |
64 if (WebMediaPlayer* webMediaPlayer = video->webMediaPlayer()) | 65 if (WebMediaPlayer* webMediaPlayer = video->webMediaPlayer()) |
65 return webMediaPlayer->naturalSize(); | 66 return webMediaPlayer->naturalSize(); |
66 return IntSize(); | 67 return IntSize(); |
67 } | 68 } |
68 | 69 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 if (!sw || !sh) { | 178 if (!sw || !sh) { |
178 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); | 179 exceptionState.throwDOMException(IndexSizeError, String::format("The sou
rce %s provided is 0.", sw ? "height" : "width")); |
179 return ScriptPromise(); | 180 return ScriptPromise(); |
180 } | 181 } |
181 | 182 |
182 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 | 183 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 |
183 return fulfillImageBitmap(scriptState, canvas->isPaintable() ? ImageBitmap::
create(canvas, IntRect(sx, sy, sw, sh)) : nullptr); | 184 return fulfillImageBitmap(scriptState, canvas->isPaintable() ? ImageBitmap::
create(canvas, IntRect(sx, sy, sw, sh)) : nullptr); |
184 } | 185 } |
185 | 186 |
186 } // namespace blink | 187 } // namespace blink |
OLD | NEW |