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 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 | 1106 |
1107 StrokeData strokeData; | 1107 StrokeData strokeData; |
1108 strokeData.setThickness(lineWidth()); | 1108 strokeData.setThickness(lineWidth()); |
1109 strokeData.setLineCap(getLineCap()); | 1109 strokeData.setLineCap(getLineCap()); |
1110 strokeData.setLineJoin(getLineJoin()); | 1110 strokeData.setLineJoin(getLineJoin()); |
1111 strokeData.setMiterLimit(miterLimit()); | 1111 strokeData.setMiterLimit(miterLimit()); |
1112 strokeData.setLineDash(getLineDash(), lineDashOffset()); | 1112 strokeData.setLineDash(getLineDash(), lineDashOffset()); |
1113 return path.strokeContains(transformedPoint, strokeData); | 1113 return path.strokeContains(transformedPoint, strokeData); |
1114 } | 1114 } |
1115 | 1115 |
| 1116 void CanvasRenderingContext2D::scrollPathIntoView() |
| 1117 { |
| 1118 scrollPathIntoViewInternal(m_path); |
| 1119 } |
| 1120 |
| 1121 void CanvasRenderingContext2D::scrollPathIntoView(Path2D* path2d, ExceptionState
& exceptionState) |
| 1122 { |
| 1123 if (!path2d) { |
| 1124 exceptionState.throwDOMException(TypeMismatchError, ExceptionMessages::a
rgumentNullOrIncorrectType(1, "Path2D")); |
| 1125 return; |
| 1126 } |
| 1127 |
| 1128 scrollPathIntoViewInternal(path2d->path()); |
| 1129 } |
| 1130 |
| 1131 void CanvasRenderingContext2D::scrollPathIntoViewInternal(const Path& path) |
| 1132 { |
| 1133 if (!state().m_invertibleCTM || path.isEmpty()) |
| 1134 return; |
| 1135 |
| 1136 canvas()->document().updateLayoutIgnorePendingStylesheets(); |
| 1137 |
| 1138 // Apply transformation and get the bounding rect |
| 1139 Path transformedPath = path; |
| 1140 transformedPath.transform(state().m_transform); |
| 1141 FloatRect boundingRect = transformedPath.boundingRect(); |
| 1142 |
| 1143 // Offset by the canvas rect (We should take border and padding into account
). |
| 1144 RenderBoxModelObject* rbmo = canvas()->renderBoxModelObject(); |
| 1145 IntRect canvasRect = canvas()->renderer()->absoluteBoundingBoxRect(); |
| 1146 canvasRect.move(rbmo->borderLeft() + rbmo->paddingLeft(), |
| 1147 rbmo->borderTop() + rbmo->paddingTop()); |
| 1148 LayoutRect pathRect = enclosingLayoutRect(boundingRect); |
| 1149 pathRect.moveBy(canvasRect.location()); |
| 1150 |
| 1151 if (canvas()->renderer()) { |
| 1152 canvas()->renderer()->scrollRectToVisible( |
| 1153 pathRect, ScrollAlignment::alignCenterAlways, ScrollAlignment::align
TopAlways); |
| 1154 } |
| 1155 |
| 1156 // TODO: should implement "inform the user" that the caret and/or |
| 1157 // selection the specified rectangle of the canvas. See http://crbug.com/357
987 |
| 1158 } |
| 1159 |
1116 void CanvasRenderingContext2D::clearRect(float x, float y, float width, float he
ight) | 1160 void CanvasRenderingContext2D::clearRect(float x, float y, float width, float he
ight) |
1117 { | 1161 { |
1118 if (!validateRectForCanvas(x, y, width, height)) | 1162 if (!validateRectForCanvas(x, y, width, height)) |
1119 return; | 1163 return; |
1120 GraphicsContext* context = drawingContext(); | 1164 GraphicsContext* context = drawingContext(); |
1121 if (!context) | 1165 if (!context) |
1122 return; | 1166 return; |
1123 if (!state().m_invertibleCTM) | 1167 if (!state().m_invertibleCTM) |
1124 return; | 1168 return; |
1125 FloatRect rect(x, y, width, height); | 1169 FloatRect rect(x, y, width, height); |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2296 c->setAlphaAsFloat(1.0); | 2340 c->setAlphaAsFloat(1.0); |
2297 c->clearShadow(); | 2341 c->clearShadow(); |
2298 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); | 2342 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); |
2299 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); | 2343 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); |
2300 c->restore(); | 2344 c->restore(); |
2301 | 2345 |
2302 didDraw(dirtyRect); | 2346 didDraw(dirtyRect); |
2303 } | 2347 } |
2304 | 2348 |
2305 } // namespace WebCore | 2349 } // namespace WebCore |
OLD | NEW |