| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "core/layout/LayoutBox.h" | 51 #include "core/layout/LayoutBox.h" |
| 52 #include "core/layout/LayoutTheme.h" | 52 #include "core/layout/LayoutTheme.h" |
| 53 #include "modules/canvas2d/CanvasGradient.h" | 53 #include "modules/canvas2d/CanvasGradient.h" |
| 54 #include "modules/canvas2d/CanvasPattern.h" | 54 #include "modules/canvas2d/CanvasPattern.h" |
| 55 #include "modules/canvas2d/CanvasRenderingContext2DState.h" | 55 #include "modules/canvas2d/CanvasRenderingContext2DState.h" |
| 56 #include "modules/canvas2d/CanvasStyle.h" | 56 #include "modules/canvas2d/CanvasStyle.h" |
| 57 #include "modules/canvas2d/HitRegion.h" | 57 #include "modules/canvas2d/HitRegion.h" |
| 58 #include "modules/canvas2d/Path2D.h" | 58 #include "modules/canvas2d/Path2D.h" |
| 59 #include "platform/fonts/FontCache.h" | 59 #include "platform/fonts/FontCache.h" |
| 60 #include "platform/geometry/FloatQuad.h" | 60 #include "platform/geometry/FloatQuad.h" |
| 61 #include "platform/graphics/BitmapImage.h" |
| 61 #include "platform/graphics/DrawLooperBuilder.h" | 62 #include "platform/graphics/DrawLooperBuilder.h" |
| 62 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" | 63 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" |
| 64 #include "platform/graphics/GraphicsScreen.h" |
| 63 #include "platform/graphics/ImageBuffer.h" | 65 #include "platform/graphics/ImageBuffer.h" |
| 64 #include "platform/graphics/StrokeData.h" | 66 #include "platform/graphics/StrokeData.h" |
| 65 #include "platform/graphics/skia/SkiaUtils.h" | 67 #include "platform/graphics/skia/SkiaUtils.h" |
| 66 #include "platform/text/BidiTextRun.h" | 68 #include "platform/text/BidiTextRun.h" |
| 67 #include "public/platform/Platform.h" | 69 #include "public/platform/Platform.h" |
| 68 #include "third_party/skia/include/core/SkCanvas.h" | 70 #include "third_party/skia/include/core/SkCanvas.h" |
| 69 #include "third_party/skia/include/core/SkImageFilter.h" | 71 #include "third_party/skia/include/core/SkImageFilter.h" |
| 70 #include "wtf/ArrayBufferContents.h" | 72 #include "wtf/ArrayBufferContents.h" |
| 71 #include "wtf/CheckedArithmetic.h" | 73 #include "wtf/CheckedArithmetic.h" |
| 72 #include "wtf/MathExtras.h" | 74 #include "wtf/MathExtras.h" |
| (...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 929 SkPath skPath = path.skPath(); | 931 SkPath skPath = path.skPath(); |
| 930 FloatRect bounds = path.boundingRect(); | 932 FloatRect bounds = path.boundingRect(); |
| 931 skPath.setFillType(fillType); | 933 skPath.setFillType(fillType); |
| 932 | 934 |
| 933 if (paintType == CanvasRenderingContext2DState::StrokePaintType) | 935 if (paintType == CanvasRenderingContext2DState::StrokePaintType) |
| 934 inflateStrokeRect(bounds); | 936 inflateStrokeRect(bounds); |
| 935 | 937 |
| 936 if (!drawingCanvas()) | 938 if (!drawingCanvas()) |
| 937 return; | 939 return; |
| 938 | 940 |
| 941 WillPaintForDevice device(ScreenDevice::sRGBCanvas); // FIXME: color correct
. |
| 942 |
| 939 if (draw( | 943 if (draw( |
| 940 [&skPath, this](SkCanvas* c, const SkPaint* paint) // draw lambda | 944 [&skPath, this](SkCanvas* c, const SkPaint* paint) // draw lambda |
| 941 { | 945 { |
| 942 c->drawPath(skPath, *paint); | 946 c->drawPath(skPath, *paint); |
| 943 }, | 947 }, |
| 944 [](const SkIRect& rect) // overdraw test lambda | 948 [](const SkIRect& rect) // overdraw test lambda |
| 945 { | 949 { |
| 946 return false; | 950 return false; |
| 947 }, bounds, paintType)) { | 951 }, bounds, paintType)) { |
| 948 if (isPathExpensive(path)) { | 952 if (isPathExpensive(path)) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 } | 989 } |
| 986 | 990 |
| 987 void CanvasRenderingContext2D::fillRect(double x, double y, double width, double
height) | 991 void CanvasRenderingContext2D::fillRect(double x, double y, double width, double
height) |
| 988 { | 992 { |
| 989 if (!validateRectForCanvas(x, y, width, height)) | 993 if (!validateRectForCanvas(x, y, width, height)) |
| 990 return; | 994 return; |
| 991 | 995 |
| 992 if (!drawingCanvas()) | 996 if (!drawingCanvas()) |
| 993 return; | 997 return; |
| 994 | 998 |
| 999 WillPaintForDevice device(ScreenDevice::sRGBCanvas); // FIXME: color correct
. |
| 1000 |
| 995 SkRect rect = SkRect::MakeXYWH(x, y, width, height); | 1001 SkRect rect = SkRect::MakeXYWH(x, y, width, height); |
| 996 draw( | 1002 draw( |
| 997 [&rect, this](SkCanvas* c, const SkPaint* paint) // draw lambda | 1003 [&rect, this](SkCanvas* c, const SkPaint* paint) // draw lambda |
| 998 { | 1004 { |
| 999 c->drawRect(rect, *paint); | 1005 c->drawRect(rect, *paint); |
| 1000 }, | 1006 }, |
| 1001 [&rect, this](const SkIRect& clipBounds) // overdraw test lambda | 1007 [&rect, this](const SkIRect& clipBounds) // overdraw test lambda |
| 1002 { | 1008 { |
| 1003 return rectContainsTransformedRect(rect, clipBounds); | 1009 return rectContainsTransformedRect(rect, clipBounds); |
| 1004 }, rect, CanvasRenderingContext2DState::FillPaintType); | 1010 }, rect, CanvasRenderingContext2DState::FillPaintType); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1020 } | 1026 } |
| 1021 | 1027 |
| 1022 void CanvasRenderingContext2D::strokeRect(double x, double y, double width, doub
le height) | 1028 void CanvasRenderingContext2D::strokeRect(double x, double y, double width, doub
le height) |
| 1023 { | 1029 { |
| 1024 if (!validateRectForCanvas(x, y, width, height)) | 1030 if (!validateRectForCanvas(x, y, width, height)) |
| 1025 return; | 1031 return; |
| 1026 | 1032 |
| 1027 if (!drawingCanvas()) | 1033 if (!drawingCanvas()) |
| 1028 return; | 1034 return; |
| 1029 | 1035 |
| 1036 WillPaintForDevice device(ScreenDevice::sRGBCanvas); // FIXME: color correct
. |
| 1037 |
| 1030 SkRect rect = SkRect::MakeXYWH(x, y, width, height); | 1038 SkRect rect = SkRect::MakeXYWH(x, y, width, height); |
| 1031 FloatRect bounds = rect; | 1039 FloatRect bounds = rect; |
| 1032 inflateStrokeRect(bounds); | 1040 inflateStrokeRect(bounds); |
| 1033 draw( | 1041 draw( |
| 1034 [&rect, this](SkCanvas* c, const SkPaint* paint) // draw lambda | 1042 [&rect, this](SkCanvas* c, const SkPaint* paint) // draw lambda |
| 1035 { | 1043 { |
| 1036 strokeRectOnCanvas(rect, c, paint); | 1044 strokeRectOnCanvas(rect, c, paint); |
| 1037 }, | 1045 }, |
| 1038 [](const SkIRect& clipBounds) // overdraw test lambda | 1046 [](const SkIRect& clipBounds) // overdraw test lambda |
| 1039 { | 1047 { |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 SkCanvas* c = drawingCanvas(); | 1187 SkCanvas* c = drawingCanvas(); |
| 1180 if (!c) | 1188 if (!c) |
| 1181 return; | 1189 return; |
| 1182 if (!state().isTransformInvertible()) | 1190 if (!state().isTransformInvertible()) |
| 1183 return; | 1191 return; |
| 1184 | 1192 |
| 1185 SkIRect clipBounds; | 1193 SkIRect clipBounds; |
| 1186 if (!c->getClipDeviceBounds(&clipBounds)) | 1194 if (!c->getClipDeviceBounds(&clipBounds)) |
| 1187 return; | 1195 return; |
| 1188 | 1196 |
| 1197 WillPaintForDevice device(ScreenDevice::sRGBCanvas); |
| 1198 |
| 1189 SkPaint clearPaint; | 1199 SkPaint clearPaint; |
| 1190 clearPaint.setXfermodeMode(SkXfermode::kClear_Mode); | 1200 clearPaint.setXfermodeMode(SkXfermode::kClear_Mode); |
| 1191 clearPaint.setStyle(SkPaint::kFill_Style); | 1201 clearPaint.setStyle(SkPaint::kFill_Style); |
| 1192 FloatRect rect(x, y, width, height); | 1202 FloatRect rect(x, y, width, height); |
| 1193 | 1203 |
| 1194 if (rectContainsTransformedRect(rect, clipBounds)) { | 1204 if (rectContainsTransformedRect(rect, clipBounds)) { |
| 1195 checkOverdraw(rect, &clearPaint, CanvasRenderingContext2DState::NoImage,
ClipFill); | 1205 checkOverdraw(rect, &clearPaint, CanvasRenderingContext2DState::NoImage,
ClipFill); |
| 1196 if (drawingCanvas()) | 1206 if (drawingCanvas()) |
| 1197 drawingCanvas()->drawRect(rect, clearPaint); | 1207 drawingCanvas()->drawRect(rect, clearPaint); |
| 1198 didDraw(clipBounds); | 1208 didDraw(clipBounds); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 if (!imageSource->isVideoElement()) { | 1338 if (!imageSource->isVideoElement()) { |
| 1329 imagePaint.setAntiAlias(shouldDrawImageAntialiased(dstRect)); | 1339 imagePaint.setAntiAlias(shouldDrawImageAntialiased(dstRect)); |
| 1330 image->draw(c, imagePaint, dstRect, srcRect, DoNotRespectImageOrientatio
n, Image::DoNotClampImageToSourceRect); | 1340 image->draw(c, imagePaint, dstRect, srcRect, DoNotRespectImageOrientatio
n, Image::DoNotClampImageToSourceRect); |
| 1331 } else { | 1341 } else { |
| 1332 c->save(); | 1342 c->save(); |
| 1333 c->clipRect(dstRect); | 1343 c->clipRect(dstRect); |
| 1334 c->translate(dstRect.x(), dstRect.y()); | 1344 c->translate(dstRect.x(), dstRect.y()); |
| 1335 c->scale(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.h
eight()); | 1345 c->scale(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.h
eight()); |
| 1336 c->translate(-srcRect.x(), -srcRect.y()); | 1346 c->translate(-srcRect.x(), -srcRect.y()); |
| 1337 HTMLVideoElement* video = static_cast<HTMLVideoElement*>(imageSource); | 1347 HTMLVideoElement* video = static_cast<HTMLVideoElement*>(imageSource); |
| 1338 video->paintCurrentFrame(c, IntRect(IntPoint(), IntSize(video->videoWidt
h(), video->videoHeight())), &imagePaint); | 1348 video->paintCurrentFrame(c, IntRect(IntPoint(), IntSize(video->videoWidt
h(), video->videoHeight())), &imagePaint, nullptr); |
| 1339 } | 1349 } |
| 1340 | 1350 |
| 1341 c->restoreToCount(initialSaveCount); | 1351 c->restoreToCount(initialSaveCount); |
| 1342 } | 1352 } |
| 1343 | 1353 |
| 1344 bool shouldDisableDeferral(CanvasImageSource* imageSource) | 1354 bool shouldDisableDeferral(CanvasImageSource* imageSource) |
| 1345 { | 1355 { |
| 1346 if (imageSource->isVideoElement()) | 1356 if (imageSource->isVideoElement()) |
| 1347 return true; | 1357 return true; |
| 1348 if (imageSource->isCanvasElement()) { | 1358 if (imageSource->isCanvasElement()) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 FloatRect srcRect = normalizeRect(FloatRect(sx, sy, sw, sh)); | 1392 FloatRect srcRect = normalizeRect(FloatRect(sx, sy, sw, sh)); |
| 1383 FloatRect dstRect = normalizeRect(FloatRect(dx, dy, dw, dh)); | 1393 FloatRect dstRect = normalizeRect(FloatRect(dx, dy, dw, dh)); |
| 1384 | 1394 |
| 1385 clipRectsToImageRect(FloatRect(FloatPoint(), imageSource->elementSize()), &s
rcRect, &dstRect); | 1395 clipRectsToImageRect(FloatRect(FloatPoint(), imageSource->elementSize()), &s
rcRect, &dstRect); |
| 1386 | 1396 |
| 1387 imageSource->adjustDrawRects(&srcRect, &dstRect); | 1397 imageSource->adjustDrawRects(&srcRect, &dstRect); |
| 1388 | 1398 |
| 1389 if (srcRect.isEmpty()) | 1399 if (srcRect.isEmpty()) |
| 1390 return; | 1400 return; |
| 1391 | 1401 |
| 1402 WillPaintForDevice device(ScreenDevice::sRGBCanvas); |
| 1403 |
| 1392 if (shouldDisableDeferral(imageSource) || image->isTextureBacked()) | 1404 if (shouldDisableDeferral(imageSource) || image->isTextureBacked()) |
| 1393 canvas()->disableDeferral(); | 1405 canvas()->disableDeferral(); |
| 1394 | 1406 |
| 1395 validateStateStack(); | 1407 validateStateStack(); |
| 1396 | 1408 |
| 1397 draw( | 1409 draw( |
| 1398 [this, &imageSource, &image, &srcRect, dstRect](SkCanvas* c, const SkPai
nt* paint) // draw lambda | 1410 [this, &imageSource, &image, &srcRect, dstRect](SkCanvas* c, const SkPai
nt* paint) // draw lambda |
| 1399 { | 1411 { |
| 1400 drawImageInternal(c, imageSource, image.get(), srcRect, dstRect, pai
nt); | 1412 drawImageInternal(c, imageSource, image.get(), srcRect, dstRect, pai
nt); |
| 1401 }, | 1413 }, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 | 1454 |
| 1443 bool CanvasRenderingContext2D::rectContainsTransformedRect(const FloatRect& rect
, const SkIRect& transformedRect) const | 1455 bool CanvasRenderingContext2D::rectContainsTransformedRect(const FloatRect& rect
, const SkIRect& transformedRect) const |
| 1444 { | 1456 { |
| 1445 FloatQuad quad(rect); | 1457 FloatQuad quad(rect); |
| 1446 FloatQuad transformedQuad(FloatRect(transformedRect.x(), transformedRect.y()
, transformedRect.width(), transformedRect.height())); | 1458 FloatQuad transformedQuad(FloatRect(transformedRect.x(), transformedRect.y()
, transformedRect.width(), transformedRect.height())); |
| 1447 return state().transform().mapQuad(quad).containsQuad(transformedQuad); | 1459 return state().transform().mapQuad(quad).containsQuad(transformedQuad); |
| 1448 } | 1460 } |
| 1449 | 1461 |
| 1450 CanvasGradient* CanvasRenderingContext2D::createLinearGradient(double x0, double
y0, double x1, double y1) | 1462 CanvasGradient* CanvasRenderingContext2D::createLinearGradient(double x0, double
y0, double x1, double y1) |
| 1451 { | 1463 { |
| 1464 WillPaintForDevice device(ScreenDevice::sRGBCanvas); |
| 1465 |
| 1452 CanvasGradient* gradient = CanvasGradient::create(FloatPoint(x0, y0), FloatP
oint(x1, y1)); | 1466 CanvasGradient* gradient = CanvasGradient::create(FloatPoint(x0, y0), FloatP
oint(x1, y1)); |
| 1453 return gradient; | 1467 return gradient; |
| 1454 } | 1468 } |
| 1455 | 1469 |
| 1456 CanvasGradient* CanvasRenderingContext2D::createRadialGradient(double x0, double
y0, double r0, double x1, double y1, double r1, ExceptionState& exceptionState) | 1470 CanvasGradient* CanvasRenderingContext2D::createRadialGradient(double x0, double
y0, double r0, double x1, double y1, double r1, ExceptionState& exceptionState) |
| 1457 { | 1471 { |
| 1472 WillPaintForDevice device(ScreenDevice::sRGBCanvas); |
| 1473 |
| 1458 if (r0 < 0 || r1 < 0) { | 1474 if (r0 < 0 || r1 < 0) { |
| 1459 exceptionState.throwDOMException(IndexSizeError, String::format("The %s
provided is less than 0.", r0 < 0 ? "r0" : "r1")); | 1475 exceptionState.throwDOMException(IndexSizeError, String::format("The %s
provided is less than 0.", r0 < 0 ? "r0" : "r1")); |
| 1460 return nullptr; | 1476 return nullptr; |
| 1461 } | 1477 } |
| 1462 | 1478 |
| 1463 CanvasGradient* gradient = CanvasGradient::create(FloatPoint(x0, y0), r0, Fl
oatPoint(x1, y1), r1); | 1479 CanvasGradient* gradient = CanvasGradient::create(FloatPoint(x0, y0), r0, Fl
oatPoint(x1, y1), r1); |
| 1464 return gradient; | 1480 return gradient; |
| 1465 } | 1481 } |
| 1466 | 1482 |
| 1467 CanvasPattern* CanvasRenderingContext2D::createPattern(const CanvasImageSourceUn
ion& imageSource, const String& repetitionType, ExceptionState& exceptionState) | 1483 CanvasPattern* CanvasRenderingContext2D::createPattern(const CanvasImageSourceUn
ion& imageSource, const String& repetitionType, ExceptionState& exceptionState) |
| 1468 { | 1484 { |
| 1469 Pattern::RepeatMode repeatMode = CanvasPattern::parseRepetitionType(repetiti
onType, exceptionState); | 1485 Pattern::RepeatMode repeatMode = CanvasPattern::parseRepetitionType(repetiti
onType, exceptionState); |
| 1470 if (exceptionState.hadException()) | 1486 if (exceptionState.hadException()) |
| 1471 return nullptr; | 1487 return nullptr; |
| 1472 | 1488 |
| 1473 SourceImageStatus status; | 1489 SourceImageStatus status; |
| 1474 CanvasImageSource* imageSourceInternal = toImageSourceInternal(imageSource); | 1490 CanvasImageSource* imageSourceInternal = toImageSourceInternal(imageSource); |
| 1475 RefPtr<Image> imageForRendering = imageSourceInternal->getSourceImageForCanv
as(&status, PreferNoAcceleration); | 1491 RefPtr<Image> imageForRendering = imageSourceInternal->getSourceImageForCanv
as(&status, PreferNoAcceleration); |
| 1476 | 1492 |
| 1493 WillPaintForDevice device(ScreenDevice::sRGBCanvas); |
| 1494 |
| 1477 switch (status) { | 1495 switch (status) { |
| 1478 case NormalSourceImageStatus: | 1496 case NormalSourceImageStatus: |
| 1479 break; | 1497 break; |
| 1480 case ZeroSizeCanvasSourceImageStatus: | 1498 case ZeroSizeCanvasSourceImageStatus: |
| 1481 exceptionState.throwDOMException(InvalidStateError, String::format("The
canvas %s is 0.", imageSourceInternal->elementSize().width() ? "height" : "width
")); | 1499 exceptionState.throwDOMException(InvalidStateError, String::format("The
canvas %s is 0.", imageSourceInternal->elementSize().width() ? "height" : "width
")); |
| 1482 return nullptr; | 1500 return nullptr; |
| 1483 case UndecodableSourceImageStatus: | 1501 case UndecodableSourceImageStatus: |
| 1484 exceptionState.throwDOMException(InvalidStateError, "Source image is in
the 'broken' state."); | 1502 exceptionState.throwDOMException(InvalidStateError, "Source image is in
the 'broken' state."); |
| 1485 return nullptr; | 1503 return nullptr; |
| 1486 case InvalidSourceImageStatus: | 1504 case InvalidSourceImageStatus: |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1948 | 1966 |
| 1949 SkCanvas* c = drawingCanvas(); | 1967 SkCanvas* c = drawingCanvas(); |
| 1950 if (!c) | 1968 if (!c) |
| 1951 return; | 1969 return; |
| 1952 | 1970 |
| 1953 if (!std::isfinite(x) || !std::isfinite(y)) | 1971 if (!std::isfinite(x) || !std::isfinite(y)) |
| 1954 return; | 1972 return; |
| 1955 if (maxWidth && (!std::isfinite(*maxWidth) || *maxWidth <= 0)) | 1973 if (maxWidth && (!std::isfinite(*maxWidth) || *maxWidth <= 0)) |
| 1956 return; | 1974 return; |
| 1957 | 1975 |
| 1976 WillPaintForDevice device(ScreenDevice::sRGBCanvas); |
| 1977 |
| 1958 const Font& font = accessFont(); | 1978 const Font& font = accessFont(); |
| 1959 const FontMetrics& fontMetrics = font.fontMetrics(); | 1979 const FontMetrics& fontMetrics = font.fontMetrics(); |
| 1960 | 1980 |
| 1961 // FIXME: Need to turn off font smoothing. | 1981 // FIXME: Need to turn off font smoothing. |
| 1962 | 1982 |
| 1963 const ComputedStyle* computedStyle = 0; | 1983 const ComputedStyle* computedStyle = 0; |
| 1964 TextDirection direction = toTextDirection(state().direction(), canvas(), &co
mputedStyle); | 1984 TextDirection direction = toTextDirection(state().direction(), canvas(), &co
mputedStyle); |
| 1965 bool isRTL = direction == RTL; | 1985 bool isRTL = direction == RTL; |
| 1966 bool override = computedStyle ? isOverride(computedStyle->unicodeBidi()) : f
alse; | 1986 bool override = computedStyle ? isOverride(computedStyle->unicodeBidi()) : f
alse; |
| 1967 | 1987 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2154 return false; | 2174 return false; |
| 2155 | 2175 |
| 2156 return true; | 2176 return true; |
| 2157 } | 2177 } |
| 2158 | 2178 |
| 2159 void CanvasRenderingContext2D::drawFocusRing(const Path& path) | 2179 void CanvasRenderingContext2D::drawFocusRing(const Path& path) |
| 2160 { | 2180 { |
| 2161 if (!drawingCanvas()) | 2181 if (!drawingCanvas()) |
| 2162 return; | 2182 return; |
| 2163 | 2183 |
| 2184 WillPaintForDevice device(ScreenDevice::sRGBCanvas); |
| 2185 |
| 2164 SkColor color = LayoutTheme::theme().focusRingColor().rgb(); | 2186 SkColor color = LayoutTheme::theme().focusRingColor().rgb(); |
| 2165 const int focusRingWidth = 5; | 2187 const int focusRingWidth = 5; |
| 2166 | 2188 |
| 2167 drawPlatformFocusRing(path.skPath(), drawingCanvas(), color, focusRingWidth)
; | 2189 drawPlatformFocusRing(path.skPath(), drawingCanvas(), Color::toDeviceColor(c
olor).rgb(), focusRingWidth); |
| 2168 | 2190 |
| 2169 // We need to add focusRingWidth to dirtyRect. | 2191 // We need to add focusRingWidth to dirtyRect. |
| 2170 StrokeData strokeData; | 2192 StrokeData strokeData; |
| 2171 strokeData.setThickness(focusRingWidth); | 2193 strokeData.setThickness(focusRingWidth); |
| 2172 | 2194 |
| 2173 SkIRect dirtyRect; | 2195 SkIRect dirtyRect; |
| 2174 if (!computeDirtyRect(path.strokeBoundingRect(strokeData), &dirtyRect)) | 2196 if (!computeDirtyRect(path.strokeBoundingRect(strokeData), &dirtyRect)) |
| 2175 return; | 2197 return; |
| 2176 | 2198 |
| 2177 didDraw(dirtyRect); | 2199 didDraw(dirtyRect); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2328 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) | 2350 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) |
| 2329 return; | 2351 return; |
| 2330 if (alpha < 0xFF) | 2352 if (alpha < 0xFF) |
| 2331 return; | 2353 return; |
| 2332 } | 2354 } |
| 2333 | 2355 |
| 2334 canvas()->buffer()->willOverwriteCanvas(); | 2356 canvas()->buffer()->willOverwriteCanvas(); |
| 2335 } | 2357 } |
| 2336 | 2358 |
| 2337 } // namespace blink | 2359 } // namespace blink |
| OLD | NEW |