 Chromium Code Reviews
 Chromium Code Reviews Issue 1468023002:
  Rename imageSizeForLayoutObject() to imageSize()  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1468023002:
  Rename imageSizeForLayoutObject() to imageSize()  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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 LayoutObject* layoutObject = image->layoutObject(); | 
| 60 RespectImageOrientationEnum shouldRespectImageOrientation = | |
| 61 layoutObject ? layoutObject->shouldRespectImageOrientation() : DoNot RespectImageOrientation; | |
| 62 return cachedImage->imageSize(shouldRespectImageOrientation, 1.0f); // F IXME: Not sure about this. | |
| 
Yoav Weiss
2015/11/24 10:29:07
ditto
 
davve
2015/11/24 12:49:13
If I had such a function, yes. (again)
 | |
| 63 } | |
| 59 return LayoutSize(); | 64 return LayoutSize(); | 
| 60 } | 65 } | 
| 61 | 66 | 
| 62 static IntSize sizeFor(HTMLVideoElement* video) | 67 static IntSize sizeFor(HTMLVideoElement* video) | 
| 63 { | 68 { | 
| 64 if (WebMediaPlayer* webMediaPlayer = video->webMediaPlayer()) | 69 if (WebMediaPlayer* webMediaPlayer = video->webMediaPlayer()) | 
| 65 return webMediaPlayer->naturalSize(); | 70 return webMediaPlayer->naturalSize(); | 
| 66 return IntSize(); | 71 return IntSize(); | 
| 67 } | 72 } | 
| 68 | 73 | 
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 if (!sw || !sh) { | 182 if (!sw || !sh) { | 
| 178 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width")); | 183 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s provided is 0.", sw ? "height" : "width")); | 
| 179 return ScriptPromise(); | 184 return ScriptPromise(); | 
| 180 } | 185 } | 
| 181 | 186 | 
| 182 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 | 187 // FIXME: make ImageBitmap creation asynchronous crbug.com/258082 | 
| 183 return fulfillImageBitmap(scriptState, canvas->isPaintable() ? ImageBitmap:: create(canvas, IntRect(sx, sy, sw, sh)) : nullptr); | 188 return fulfillImageBitmap(scriptState, canvas->isPaintable() ? ImageBitmap:: create(canvas, IntRect(sx, sy, sw, sh)) : nullptr); | 
| 184 } | 189 } | 
| 185 | 190 | 
| 186 } // namespace blink | 191 } // namespace blink | 
| OLD | NEW |