| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 LayoutPoint adjustedPaintOffset = paintOffset + location(); | 112 LayoutPoint adjustedPaintOffset = paintOffset + location(); |
| 113 | 113 |
| 114 if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paint
Info.phase == PaintPhaseSelection)) | 114 if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paint
Info.phase == PaintPhaseSelection)) |
| 115 paintBoxDecorations(paintInfo, adjustedPaintOffset); | 115 paintBoxDecorations(paintInfo, adjustedPaintOffset); |
| 116 | 116 |
| 117 if (paintInfo.phase == PaintPhaseMask) { | 117 if (paintInfo.phase == PaintPhaseMask) { |
| 118 paintMask(paintInfo, adjustedPaintOffset); | 118 paintMask(paintInfo, adjustedPaintOffset); |
| 119 return; | 119 return; |
| 120 } | 120 } |
| 121 | 121 |
| 122 if (paintInfo.phase == PaintPhaseClippingMask && (!hasLayer() || !layer()->h
asCompositedClippingMask())) |
| 123 return; |
| 124 |
| 122 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size()); | 125 LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size()); |
| 123 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSe
lfOutline) && style()->outlineWidth()) | 126 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSe
lfOutline) && style()->outlineWidth()) |
| 124 paintOutline(paintInfo, paintRect); | 127 paintOutline(paintInfo, paintRect); |
| 125 | 128 |
| 126 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection && !canHaveChildren()) | 129 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection && !canHaveChildren() && paintInfo.phase != PaintPhaseClippingMask) |
| 127 return; | 130 return; |
| 128 | 131 |
| 129 if (!paintInfo.shouldPaintWithinRoot(this)) | 132 if (!paintInfo.shouldPaintWithinRoot(this)) |
| 130 return; | 133 return; |
| 131 | 134 |
| 132 bool drawSelectionTint = selectionState() != SelectionNone && !document().pr
inting(); | 135 bool drawSelectionTint = selectionState() != SelectionNone && !document().pr
inting(); |
| 133 if (paintInfo.phase == PaintPhaseSelection) { | 136 if (paintInfo.phase == PaintPhaseSelection) { |
| 134 if (selectionState() == SelectionNone) | 137 if (selectionState() == SelectionNone) |
| 135 return; | 138 return; |
| 136 drawSelectionTint = false; | 139 drawSelectionTint = false; |
| 137 } | 140 } |
| 138 | 141 |
| 139 bool completelyClippedOut = false; | 142 bool completelyClippedOut = false; |
| 140 if (style()->hasBorderRadius()) { | 143 if (style()->hasBorderRadius()) { |
| 141 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size()); | 144 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, size()); |
| 142 | 145 |
| 143 if (borderRect.isEmpty()) | 146 if (borderRect.isEmpty()) |
| 144 completelyClippedOut = true; | 147 completelyClippedOut = true; |
| 145 else { | 148 else { |
| 146 // Push a clip if we have a border radius, since we want to round th
e foreground content that gets painted. | 149 // Push a clip if we have a border radius, since we want to round th
e foreground content that gets painted. |
| 147 paintInfo.context->save(); | 150 paintInfo.context->save(); |
| 148 RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(pai
ntRect, | 151 RoundedRect roundedInnerRect = style()->getRoundedInnerBorderFor(pai
ntRect, |
| 149 paddingTop() + borderTop(), paddingBottom() + borderBottom(), pa
ddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true); | 152 paddingTop() + borderTop(), paddingBottom() + borderBottom(), pa
ddingLeft() + borderLeft(), paddingRight() + borderRight(), true, true); |
| 150 clipRoundedInnerRect(paintInfo.context, paintRect, roundedInnerRect)
; | 153 clipRoundedInnerRect(paintInfo.context, paintRect, roundedInnerRect)
; |
| 151 } | 154 } |
| 152 } | 155 } |
| 153 | 156 |
| 154 if (!completelyClippedOut) { | 157 if (!completelyClippedOut) { |
| 155 paintReplaced(paintInfo, adjustedPaintOffset); | 158 if (paintInfo.phase == PaintPhaseClippingMask) { |
| 159 paintClippingMask(paintInfo, adjustedPaintOffset); |
| 160 } else { |
| 161 paintReplaced(paintInfo, adjustedPaintOffset); |
| 162 } |
| 156 | 163 |
| 157 if (style()->hasBorderRadius()) | 164 if (style()->hasBorderRadius()) |
| 158 paintInfo.context->restore(); | 165 paintInfo.context->restore(); |
| 159 } | 166 } |
| 160 | 167 |
| 161 // The selection tint never gets clipped by border-radius rounding, since we
want it to run right up to the edges of | 168 // The selection tint never gets clipped by border-radius rounding, since we
want it to run right up to the edges of |
| 162 // surrounding content. | 169 // surrounding content. |
| 163 if (drawSelectionTint) { | 170 if (drawSelectionTint) { |
| 164 LayoutRect selectionPaintingRect = localSelectionRect(); | 171 LayoutRect selectionPaintingRect = localSelectionRect(); |
| 165 selectionPaintingRect.moveBy(adjustedPaintOffset); | 172 selectionPaintingRect.moveBy(adjustedPaintOffset); |
| 166 paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect),
selectionBackgroundColor()); | 173 paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect),
selectionBackgroundColor()); |
| 167 } | 174 } |
| 168 } | 175 } |
| 169 | 176 |
| 170 bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) | 177 bool RenderReplaced::shouldPaint(PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) |
| 171 { | 178 { |
| 172 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Outline && paintInfo.phase != PaintPhaseSelfOutline | 179 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Outline && paintInfo.phase != PaintPhaseSelfOutline |
| 173 && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != Pain
tPhaseMask) | 180 && paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPha
seMask && paintInfo.phase != PaintPhaseClippingMask) |
| 174 return false; | 181 return false; |
| 175 | 182 |
| 176 if (!paintInfo.shouldPaintWithinRoot(this)) | 183 if (!paintInfo.shouldPaintWithinRoot(this)) |
| 177 return false; | 184 return false; |
| 178 | 185 |
| 179 // if we're invisible or haven't received a layout yet, then just bail. | 186 // if we're invisible or haven't received a layout yet, then just bail. |
| 180 if (style()->visibility() != VISIBLE) | 187 if (style()->visibility() != VISIBLE) |
| 181 return false; | 188 return false; |
| 182 | 189 |
| 183 LayoutPoint adjustedPaintOffset = paintOffset + location(); | 190 LayoutPoint adjustedPaintOffset = paintOffset + location(); |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 614 | 621 |
| 615 if (style()) { | 622 if (style()) { |
| 616 if (v) | 623 if (v) |
| 617 r.inflate(style()->outlineSize()); | 624 r.inflate(style()->outlineSize()); |
| 618 } | 625 } |
| 619 computeRectForRepaint(repaintContainer, r); | 626 computeRectForRepaint(repaintContainer, r); |
| 620 return r; | 627 return r; |
| 621 } | 628 } |
| 622 | 629 |
| 623 } | 630 } |
| OLD | NEW |