| 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/TableCellPainter.h" | 5 #include "core/paint/TableCellPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutTableCell.h" | 7 #include "core/layout/LayoutTableCell.h" |
| 8 #include "core/paint/BlockPainter.h" | 8 #include "core/paint/BlockPainter.h" |
| 9 #include "core/paint/BoxPainter.h" | 9 #include "core/paint/BoxPainter.h" |
| 10 #include "core/paint/LayoutObjectDrawingRecorder.h" | 10 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 GraphicsContext& graphics_context = paint_info.context; | 137 GraphicsContext& graphics_context = paint_info.context; |
| 138 const DisplayItemClient& client = DisplayItemClientForBorders(); | 138 const DisplayItemClient& client = DisplayItemClientForBorders(); |
| 139 if (DrawingRecorder::UseCachedDrawingIfPossible( | 139 if (DrawingRecorder::UseCachedDrawingIfPossible( |
| 140 graphics_context, client, | 140 graphics_context, client, |
| 141 static_cast<DisplayItem::Type>(display_item_type))) | 141 static_cast<DisplayItem::Type>(display_item_type))) |
| 142 return; | 142 return; |
| 143 | 143 |
| 144 DrawingRecorder recorder(graphics_context, client, | 144 DrawingRecorder recorder(graphics_context, client, |
| 145 static_cast<DisplayItem::Type>(display_item_type), | 145 static_cast<DisplayItem::Type>(display_item_type), |
| 146 border_rect); | 146 border_rect); |
| 147 Color cell_color = layout_table_cell_.ResolveColor(CSSPropertyColor); | |
| 148 | 147 |
| 149 // We never paint diagonals at the joins. We simply let the border with the | 148 // We never paint diagonals at the joins. We simply let the border with the |
| 150 // highest precedence paint on top of borders with lower precedence. | 149 // highest precedence paint on top of borders with lower precedence. |
| 151 if (display_item_type & DisplayItem::kTableCollapsedBorderTop) { | 150 if (display_item_type & DisplayItem::kTableCollapsedBorderTop) { |
| 152 ObjectPainter::DrawLineForBoxSide( | 151 ObjectPainter::DrawLineForBoxSide( |
| 153 graphics_context, border_rect.X(), border_rect.Y(), border_rect.MaxX(), | 152 graphics_context, border_rect.X(), border_rect.Y(), border_rect.MaxX(), |
| 154 border_rect.Y() + top_width, kBSTop, | 153 border_rect.Y() + top_width, kBSTop, top_border_value.GetColor(), |
| 155 top_border_value.GetColor().Resolve(cell_color), | |
| 156 CollapsedBorderStyle(top_border_value.Style()), 0, 0, true); | 154 CollapsedBorderStyle(top_border_value.Style()), 0, 0, true); |
| 157 } | 155 } |
| 158 if (display_item_type & DisplayItem::kTableCollapsedBorderBottom) { | 156 if (display_item_type & DisplayItem::kTableCollapsedBorderBottom) { |
| 159 ObjectPainter::DrawLineForBoxSide( | 157 ObjectPainter::DrawLineForBoxSide( |
| 160 graphics_context, border_rect.X(), border_rect.MaxY() - bottom_width, | 158 graphics_context, border_rect.X(), border_rect.MaxY() - bottom_width, |
| 161 border_rect.MaxX(), border_rect.MaxY(), kBSBottom, | 159 border_rect.MaxX(), border_rect.MaxY(), kBSBottom, |
| 162 bottom_border_value.GetColor().Resolve(cell_color), | 160 bottom_border_value.GetColor(), |
| 163 CollapsedBorderStyle(bottom_border_value.Style()), 0, 0, true); | 161 CollapsedBorderStyle(bottom_border_value.Style()), 0, 0, true); |
| 164 } | 162 } |
| 165 if (display_item_type & DisplayItem::kTableCollapsedBorderLeft) { | 163 if (display_item_type & DisplayItem::kTableCollapsedBorderLeft) { |
| 166 ObjectPainter::DrawLineForBoxSide( | 164 ObjectPainter::DrawLineForBoxSide( |
| 167 graphics_context, border_rect.X(), border_rect.Y(), | 165 graphics_context, border_rect.X(), border_rect.Y(), |
| 168 border_rect.X() + left_width, border_rect.MaxY(), kBSLeft, | 166 border_rect.X() + left_width, border_rect.MaxY(), kBSLeft, |
| 169 left_border_value.GetColor().Resolve(cell_color), | 167 left_border_value.GetColor(), |
| 170 CollapsedBorderStyle(left_border_value.Style()), 0, 0, true); | 168 CollapsedBorderStyle(left_border_value.Style()), 0, 0, true); |
| 171 } | 169 } |
| 172 if (display_item_type & DisplayItem::kTableCollapsedBorderRight) { | 170 if (display_item_type & DisplayItem::kTableCollapsedBorderRight) { |
| 173 ObjectPainter::DrawLineForBoxSide( | 171 ObjectPainter::DrawLineForBoxSide( |
| 174 graphics_context, border_rect.MaxX() - right_width, border_rect.Y(), | 172 graphics_context, border_rect.MaxX() - right_width, border_rect.Y(), |
| 175 border_rect.MaxX(), border_rect.MaxY(), kBSRight, | 173 border_rect.MaxX(), border_rect.MaxY(), kBSRight, |
| 176 right_border_value.GetColor().Resolve(cell_color), | 174 right_border_value.GetColor(), |
| 177 CollapsedBorderStyle(right_border_value.Style()), 0, 0, true); | 175 CollapsedBorderStyle(right_border_value.Style()), 0, 0, true); |
| 178 } | 176 } |
| 179 } | 177 } |
| 180 | 178 |
| 181 void TableCellPainter::PaintContainerBackgroundBehindCell( | 179 void TableCellPainter::PaintContainerBackgroundBehindCell( |
| 182 const PaintInfo& paint_info, | 180 const PaintInfo& paint_info, |
| 183 const LayoutPoint& paint_offset, | 181 const LayoutPoint& paint_offset, |
| 184 const LayoutObject& background_object) { | 182 const LayoutObject& background_object) { |
| 185 DCHECK(background_object != layout_table_cell_); | 183 DCHECK(background_object != layout_table_cell_); |
| 186 | 184 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 BoxPainter(layout_table_cell_).PaintMaskImages(paint_info, paint_rect); | 287 BoxPainter(layout_table_cell_).PaintMaskImages(paint_info, paint_rect); |
| 290 } | 288 } |
| 291 | 289 |
| 292 LayoutRect TableCellPainter::PaintRectNotIncludingVisualOverflow( | 290 LayoutRect TableCellPainter::PaintRectNotIncludingVisualOverflow( |
| 293 const LayoutPoint& paint_offset) { | 291 const LayoutPoint& paint_offset) { |
| 294 return LayoutRect(paint_offset, | 292 return LayoutRect(paint_offset, |
| 295 LayoutSize(layout_table_cell_.PixelSnappedSize())); | 293 LayoutSize(layout_table_cell_.PixelSnappedSize())); |
| 296 } | 294 } |
| 297 | 295 |
| 298 } // namespace blink | 296 } // namespace blink |
| OLD | NEW |