| 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 "core/paint/ImagePainter.h" | 5 #include "core/paint/ImagePainter.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
| 9 #include "core/editing/FrameSelection.h" | 9 #include "core/editing/FrameSelection.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 Path path = areaElement.computePath(&m_layoutImage); | 54 Path path = areaElement.computePath(&m_layoutImage); |
| 55 if (path.isEmpty()) | 55 if (path.isEmpty()) |
| 56 return; | 56 return; |
| 57 | 57 |
| 58 const ComputedStyle& areaElementStyle = *areaElement.ensureComputedStyle(); | 58 const ComputedStyle& areaElementStyle = *areaElement.ensureComputedStyle(); |
| 59 int outlineWidth = areaElementStyle.outlineWidth(); | 59 int outlineWidth = areaElementStyle.outlineWidth(); |
| 60 if (!outlineWidth) | 60 if (!outlineWidth) |
| 61 return; | 61 return; |
| 62 | 62 |
| 63 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutImage, paintInfo.phase)) | 63 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(paintInfo.contex
t, m_layoutImage, DisplayItem::ImageAreaFocusRing)) |
| 64 return; | 64 return; |
| 65 | 65 |
| 66 IntRect focusRect = m_layoutImage.absoluteContentBox(); | 66 IntRect focusRect = m_layoutImage.absoluteContentBox(); |
| 67 LayoutObjectDrawingRecorder drawingRecorder(paintInfo.context, m_layoutImage
, paintInfo.phase, focusRect); | 67 LayoutObjectDrawingRecorder drawingRecorder(paintInfo.context, m_layoutImage
, DisplayItem::ImageAreaFocusRing, focusRect); |
| 68 | 68 |
| 69 // FIXME: Clip path instead of context when Skia pathops is ready. | 69 // FIXME: Clip path instead of context when Skia pathops is ready. |
| 70 // https://crbug.com/251206 | 70 // https://crbug.com/251206 |
| 71 | 71 |
| 72 paintInfo.context.save(); | 72 paintInfo.context.save(); |
| 73 paintInfo.context.clip(focusRect); | 73 paintInfo.context.clip(focusRect); |
| 74 paintInfo.context.drawFocusRing(path, outlineWidth, | 74 paintInfo.context.drawFocusRing(path, outlineWidth, |
| 75 areaElementStyle.outlineOffset(), | 75 areaElementStyle.outlineOffset(), |
| 76 m_layoutImage.resolveColor(areaElementStyle, CSSPropertyOutlineColor)); | 76 m_layoutImage.resolveColor(areaElementStyle, CSSPropertyOutlineColor)); |
| 77 paintInfo.context.restore(); | 77 paintInfo.context.restore(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", "
data", InspectorPaintImageEvent::data(m_layoutImage)); | 137 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", "
data", InspectorPaintImageEvent::data(m_layoutImage)); |
| 138 | 138 |
| 139 InterpolationQuality previousInterpolationQuality = context.imageInterpolati
onQuality(); | 139 InterpolationQuality previousInterpolationQuality = context.imageInterpolati
onQuality(); |
| 140 context.setImageInterpolationQuality(interpolationQuality); | 140 context.setImageInterpolationQuality(interpolationQuality); |
| 141 context.drawImage(image.get(), alignedRect, SkXfermode::kSrcOver_Mode, Layou
tObject::shouldRespectImageOrientation(&m_layoutImage)); | 141 context.drawImage(image.get(), alignedRect, SkXfermode::kSrcOver_Mode, Layou
tObject::shouldRespectImageOrientation(&m_layoutImage)); |
| 142 context.setImageInterpolationQuality(previousInterpolationQuality); | 142 context.setImageInterpolationQuality(previousInterpolationQuality); |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace blink | 145 } // namespace blink |
| OLD | NEW |