OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. | 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. |
9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
10 * | 10 * |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 } | 1231 } |
1232 | 1232 |
1233 void CanvasRenderingContext2D::scrollPathIntoView(Path2D* path2d) | 1233 void CanvasRenderingContext2D::scrollPathIntoView(Path2D* path2d) |
1234 { | 1234 { |
1235 scrollPathIntoViewInternal(path2d->path()); | 1235 scrollPathIntoViewInternal(path2d->path()); |
1236 } | 1236 } |
1237 | 1237 |
1238 void CanvasRenderingContext2D::scrollPathIntoViewInternal(const Path& path) | 1238 void CanvasRenderingContext2D::scrollPathIntoViewInternal(const Path& path) |
1239 { | 1239 { |
1240 LayoutObject* renderer = canvas()->renderer(); | 1240 LayoutObject* renderer = canvas()->renderer(); |
1241 RenderBox* renderBox = canvas()->renderBox(); | 1241 LayoutBox* layoutBox = canvas()->layoutBox(); |
1242 if (!renderer || !renderBox || !state().m_invertibleCTM || path.isEmpty()) | 1242 if (!renderer || !layoutBox || !state().m_invertibleCTM || path.isEmpty()) |
1243 return; | 1243 return; |
1244 | 1244 |
1245 canvas()->document().updateLayoutIgnorePendingStylesheets(); | 1245 canvas()->document().updateLayoutIgnorePendingStylesheets(); |
1246 | 1246 |
1247 // Apply transformation and get the bounding rect | 1247 // Apply transformation and get the bounding rect |
1248 Path transformedPath = path; | 1248 Path transformedPath = path; |
1249 transformedPath.transform(state().m_transform); | 1249 transformedPath.transform(state().m_transform); |
1250 FloatRect boundingRect = transformedPath.boundingRect(); | 1250 FloatRect boundingRect = transformedPath.boundingRect(); |
1251 | 1251 |
1252 // Offset by the canvas rect | 1252 // Offset by the canvas rect |
1253 LayoutRect pathRect(boundingRect); | 1253 LayoutRect pathRect(boundingRect); |
1254 IntRect canvasRect = renderBox->absoluteContentBox(); | 1254 IntRect canvasRect = layoutBox->absoluteContentBox(); |
1255 pathRect.move(canvasRect.x(), canvasRect.y()); | 1255 pathRect.move(canvasRect.x(), canvasRect.y()); |
1256 | 1256 |
1257 renderer->scrollRectToVisible( | 1257 renderer->scrollRectToVisible( |
1258 pathRect, ScrollAlignment::alignCenterAlways, ScrollAlignment::alignTopA
lways); | 1258 pathRect, ScrollAlignment::alignCenterAlways, ScrollAlignment::alignTopA
lways); |
1259 | 1259 |
1260 // TODO: should implement "inform the user" that the caret and/or | 1260 // TODO: should implement "inform the user" that the caret and/or |
1261 // selection the specified rectangle of the canvas. See http://crbug.com/357
987 | 1261 // selection the specified rectangle of the canvas. See http://crbug.com/357
987 |
1262 } | 1262 } |
1263 | 1263 |
1264 void CanvasRenderingContext2D::clearRect(float x, float y, float width, float he
ight) | 1264 void CanvasRenderingContext2D::clearRect(float x, float y, float width, float he
ight) |
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2478 if (imageType == NonOpaqueImage) | 2478 if (imageType == NonOpaqueImage) |
2479 return; | 2479 return; |
2480 if (alpha < 0xFF) | 2480 if (alpha < 0xFF) |
2481 return; | 2481 return; |
2482 } | 2482 } |
2483 | 2483 |
2484 canvas()->buffer()->willOverwriteCanvas(); | 2484 canvas()->buffer()->willOverwriteCanvas(); |
2485 } | 2485 } |
2486 | 2486 |
2487 } // namespace blink | 2487 } // namespace blink |
OLD | NEW |