OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/canvas2d/CanvasRenderingContext2D.h" | 5 #include "modules/canvas2d/CanvasRenderingContext2D.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
10 #include "core/html/HTMLCanvasElement.h" | 10 #include "core/html/HTMLCanvasElement.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 ImageData* imageData = context2d()->createImageData(100, 50, exceptionState); | 237 ImageData* imageData = context2d()->createImageData(100, 50, exceptionState); |
238 EXPECT_FALSE(exceptionState.hadException()); | 238 EXPECT_FALSE(exceptionState.hadException()); |
239 EXPECT_EQ(100, imageData->width()); | 239 EXPECT_EQ(100, imageData->width()); |
240 EXPECT_EQ(50, imageData->height()); | 240 EXPECT_EQ(50, imageData->height()); |
241 | 241 |
242 for (unsigned i = 0; i < imageData->data()->length(); ++i) | 242 for (unsigned i = 0; i < imageData->data()->length(); ++i) |
243 imageData->data()->data()[i] = 255; | 243 imageData->data()->data()[i] = 255; |
244 | 244 |
245 EXPECT_EQ(255, imageData->data()->data()[32]); | 245 EXPECT_EQ(255, imageData->data()->data()[32]); |
246 | 246 |
247 // createImageData(imageData) should create a new ImageData of the same size a
s 'imageData' | 247 // createImageData(imageData) should create a new ImageData of the same size |
248 // but filled with transparent black | 248 // as 'imageData' but filled with transparent black |
249 | 249 |
250 ImageData* sameSizeImageData = | 250 ImageData* sameSizeImageData = |
251 context2d()->createImageData(imageData, exceptionState); | 251 context2d()->createImageData(imageData, exceptionState); |
252 EXPECT_FALSE(exceptionState.hadException()); | 252 EXPECT_FALSE(exceptionState.hadException()); |
253 EXPECT_EQ(100, sameSizeImageData->width()); | 253 EXPECT_EQ(100, sameSizeImageData->width()); |
254 EXPECT_EQ(50, sameSizeImageData->height()); | 254 EXPECT_EQ(50, sameSizeImageData->height()); |
255 EXPECT_EQ(0, sameSizeImageData->data()->data()[32]); | 255 EXPECT_EQ(0, sameSizeImageData->data()->data()[32]); |
256 | 256 |
257 // createImageData(width, height) takes the absolute magnitude of the size arg
uments | 257 // createImageData(width, height) takes the absolute magnitude of the size |
| 258 // arguments |
258 | 259 |
259 ImageData* imgdata1 = context2d()->createImageData(10, 20, exceptionState); | 260 ImageData* imgdata1 = context2d()->createImageData(10, 20, exceptionState); |
260 EXPECT_FALSE(exceptionState.hadException()); | 261 EXPECT_FALSE(exceptionState.hadException()); |
261 ImageData* imgdata2 = context2d()->createImageData(-10, 20, exceptionState); | 262 ImageData* imgdata2 = context2d()->createImageData(-10, 20, exceptionState); |
262 EXPECT_FALSE(exceptionState.hadException()); | 263 EXPECT_FALSE(exceptionState.hadException()); |
263 ImageData* imgdata3 = context2d()->createImageData(10, -20, exceptionState); | 264 ImageData* imgdata3 = context2d()->createImageData(10, -20, exceptionState); |
264 EXPECT_FALSE(exceptionState.hadException()); | 265 EXPECT_FALSE(exceptionState.hadException()); |
265 ImageData* imgdata4 = context2d()->createImageData(-10, -20, exceptionState); | 266 ImageData* imgdata4 = context2d()->createImageData(-10, -20, exceptionState); |
266 EXPECT_FALSE(exceptionState.hadException()); | 267 EXPECT_FALSE(exceptionState.hadException()); |
267 | 268 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 AXObject* axObject = axObjectCache->getOrCreate(buttonElement); | 360 AXObject* axObject = axObjectCache->getOrCreate(buttonElement); |
360 | 361 |
361 LayoutRect axBounds = axObject->getBoundsInFrameCoordinates(); | 362 LayoutRect axBounds = axObject->getBoundsInFrameCoordinates(); |
362 EXPECT_EQ(25, axBounds.x().toInt()); | 363 EXPECT_EQ(25, axBounds.x().toInt()); |
363 EXPECT_EQ(25, axBounds.y().toInt()); | 364 EXPECT_EQ(25, axBounds.y().toInt()); |
364 EXPECT_EQ(40, axBounds.width().toInt()); | 365 EXPECT_EQ(40, axBounds.width().toInt()); |
365 EXPECT_EQ(40, axBounds.height().toInt()); | 366 EXPECT_EQ(40, axBounds.height().toInt()); |
366 } | 367 } |
367 | 368 |
368 } // namespace blink | 369 } // namespace blink |
OLD | NEW |