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/BoxPainter.h" | 5 #include "core/paint/BoxPainter.h" |
6 | 6 |
7 #include "core/HTMLNames.h" | 7 #include "core/HTMLNames.h" |
8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
9 #include "core/html/HTMLFrameOwnerElement.h" | 9 #include "core/html/HTMLFrameOwnerElement.h" |
10 #include "core/layout/ImageQualityController.h" | 10 #include "core/layout/ImageQualityController.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 } | 205 } |
206 | 206 |
207 // If we have a native theme appearance, paint that before painting our | 207 // If we have a native theme appearance, paint that before painting our |
208 // background. The theme will tell us whether or not we should also paint the | 208 // background. The theme will tell us whether or not we should also paint the |
209 // CSS background. | 209 // CSS background. |
210 IntRect snappedPaintRect(pixelSnappedIntRect(paintRect)); | 210 IntRect snappedPaintRect(pixelSnappedIntRect(paintRect)); |
211 ThemePainter& themePainter = LayoutTheme::theme().painter(); | 211 ThemePainter& themePainter = LayoutTheme::theme().painter(); |
212 bool themePainted = | 212 bool themePainted = |
213 boxDecorationData.hasAppearance && | 213 boxDecorationData.hasAppearance && |
214 !themePainter.paint(m_layoutBox, paintInfo, snappedPaintRect); | 214 !themePainter.paint(m_layoutBox, paintInfo, snappedPaintRect); |
215 bool shouldPaintBackground = | 215 bool shouldPaintBackground = !themePainted && |
216 !themePainted && (!paintInfo.skipRootBackground() || | 216 (!paintInfo.skipRootBackground() || |
217 paintInfo.paintContainer() != &m_layoutBox); | 217 paintInfo.paintContainer() != &m_layoutBox); |
218 if (shouldPaintBackground) { | 218 if (shouldPaintBackground) { |
219 paintBackground(paintInfo, paintRect, boxDecorationData.backgroundColor, | 219 paintBackground(paintInfo, paintRect, boxDecorationData.backgroundColor, |
220 boxDecorationData.bleedAvoidance); | 220 boxDecorationData.bleedAvoidance); |
221 | 221 |
222 if (boxDecorationData.hasAppearance) | 222 if (boxDecorationData.hasAppearance) |
223 themePainter.paintDecorations(m_layoutBox, paintInfo, snappedPaintRect); | 223 themePainter.paintDecorations(m_layoutBox, paintInfo, snappedPaintRect); |
224 } | 224 } |
225 | 225 |
226 if (!paintingOverflowContents) { | 226 if (!paintingOverflowContents) { |
227 paintInsetBoxShadow(paintInfo, paintRect, style); | 227 paintInsetBoxShadow(paintInfo, paintRect, style); |
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 // Create the text mask layer. | 770 // Create the text mask layer. |
771 context.beginLayer(1, SkBlendMode::kDstIn); | 771 context.beginLayer(1, SkBlendMode::kDstIn); |
772 | 772 |
773 // Now draw the text into the mask. We do this by painting using a special | 773 // Now draw the text into the mask. We do this by painting using a special |
774 // paint phase that signals to | 774 // paint phase that signals to |
775 // InlineTextBoxes that they should just add their contents to the clip. | 775 // InlineTextBoxes that they should just add their contents to the clip. |
776 PaintInfo info(context, maskRect, PaintPhaseTextClip, | 776 PaintInfo info(context, maskRect, PaintPhaseTextClip, |
777 GlobalPaintNormalPhase, 0); | 777 GlobalPaintNormalPhase, 0); |
778 if (box) { | 778 if (box) { |
779 const RootInlineBox& root = box->root(); | 779 const RootInlineBox& root = box->root(); |
780 box->paint(info, LayoutPoint(scrolledPaintRect.x() - box->x(), | 780 box->paint(info, |
781 scrolledPaintRect.y() - box->y()), | 781 LayoutPoint(scrolledPaintRect.x() - box->x(), |
| 782 scrolledPaintRect.y() - box->y()), |
782 root.lineTop(), root.lineBottom()); | 783 root.lineTop(), root.lineBottom()); |
783 } else { | 784 } else { |
784 // FIXME: this should only have an effect for the line box list within | 785 // FIXME: this should only have an effect for the line box list within |
785 // |obj|. Change this to create a LineBoxListPainter directly. | 786 // |obj|. Change this to create a LineBoxListPainter directly. |
786 LayoutSize localOffset = | 787 LayoutSize localOffset = |
787 obj.isBox() ? toLayoutBox(&obj)->locationOffset() : LayoutSize(); | 788 obj.isBox() ? toLayoutBox(&obj)->locationOffset() : LayoutSize(); |
788 obj.paint(info, scrolledPaintRect.location() - localOffset); | 789 obj.paint(info, scrolledPaintRect.location() - localOffset); |
789 } | 790 } |
790 | 791 |
791 context.endLayer(); | 792 context.endLayer(); |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1090 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy( | 1091 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy( |
1091 const ComputedStyle& style, | 1092 const ComputedStyle& style, |
1092 const Document& document) { | 1093 const Document& document) { |
1093 return document.printing() && | 1094 return document.printing() && |
1094 style.printColorAdjust() == EPrintColorAdjust::kEconomy && | 1095 style.printColorAdjust() == EPrintColorAdjust::kEconomy && |
1095 (!document.settings() || | 1096 (!document.settings() || |
1096 !document.settings()->getShouldPrintBackgrounds()); | 1097 !document.settings()->getShouldPrintBackgrounds()); |
1097 } | 1098 } |
1098 | 1099 |
1099 } // namespace blink | 1100 } // namespace blink |
OLD | NEW |