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