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 "config.h" | 5 #include "config.h" |
6 #include "core/paint/ImagePainter.h" | 6 #include "core/paint/ImagePainter.h" |
7 | 7 |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
10 #include "core/editing/FrameSelection.h" | 10 #include "core/editing/FrameSelection.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 void ImagePainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff
set) | 26 void ImagePainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOff
set) |
27 { | 27 { |
28 m_layoutImage.LayoutReplaced::paint(paintInfo, paintOffset); | 28 m_layoutImage.LayoutReplaced::paint(paintInfo, paintOffset); |
29 | 29 |
30 if (paintInfo.phase == PaintPhaseOutline) | 30 if (paintInfo.phase == PaintPhaseOutline) |
31 paintAreaElementFocusRing(paintInfo); | 31 paintAreaElementFocusRing(paintInfo); |
32 } | 32 } |
33 | 33 |
34 void ImagePainter::paintAreaElementFocusRing(const PaintInfo& paintInfo) | 34 void ImagePainter::paintAreaElementFocusRing(const PaintInfo& paintInfo) |
35 { | 35 { |
| 36 // TODO(wangxianzhu): In other places, we just paint focus ring if outline s
tyle is auto. |
| 37 // We should also do that here to keep consistency. |
36 Document& document = m_layoutImage.document(); | 38 Document& document = m_layoutImage.document(); |
37 | 39 |
38 if (paintInfo.isPrinting() || !document.frame()->selection().isFocusedAndAct
ive()) | 40 if (paintInfo.isPrinting() || !document.frame()->selection().isFocusedAndAct
ive()) |
39 return; | 41 return; |
40 | 42 |
41 Element* focusedElement = document.focusedElement(); | 43 Element* focusedElement = document.focusedElement(); |
42 if (!isHTMLAreaElement(focusedElement)) | 44 if (!isHTMLAreaElement(focusedElement)) |
43 return; | 45 return; |
44 | 46 |
45 HTMLAreaElement& areaElement = toHTMLAreaElement(*focusedElement); | 47 HTMLAreaElement& areaElement = toHTMLAreaElement(*focusedElement); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 139 |
138 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", "
data", InspectorPaintImageEvent::data(m_layoutImage)); | 140 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", "
data", InspectorPaintImageEvent::data(m_layoutImage)); |
139 | 141 |
140 InterpolationQuality previousInterpolationQuality = context->imageInterpolat
ionQuality(); | 142 InterpolationQuality previousInterpolationQuality = context->imageInterpolat
ionQuality(); |
141 context->setImageInterpolationQuality(interpolationQuality); | 143 context->setImageInterpolationQuality(interpolationQuality); |
142 context->drawImage(image.get(), alignedRect, SkXfermode::kSrcOver_Mode, m_la
youtImage.shouldRespectImageOrientation()); | 144 context->drawImage(image.get(), alignedRect, SkXfermode::kSrcOver_Mode, m_la
youtImage.shouldRespectImageOrientation()); |
143 context->setImageInterpolationQuality(previousInterpolationQuality); | 145 context->setImageInterpolationQuality(previousInterpolationQuality); |
144 } | 146 } |
145 | 147 |
146 } // namespace blink | 148 } // namespace blink |
OLD | NEW |