OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) | 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) |
3 * (C) 1997 Torben Weis (weis@kde.org) | 3 * (C) 1997 Torben Weis (weis@kde.org) |
4 * (C) 1998 Waldo Bastian (bastian@kde.org) | 4 * (C) 1998 Waldo Bastian (bastian@kde.org) |
5 * (C) 1999 Lars Knoll (knoll@kde.org) | 5 * (C) 1999 Lars Knoll (knoll@kde.org) |
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc. |
8 * All rights reserved. | 8 * All rights reserved. |
9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
10 * | 10 * |
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 } | 1061 } |
1062 } | 1062 } |
1063 | 1063 |
1064 void LayoutTableSection::DistributeRemainingExtraLogicalHeight( | 1064 void LayoutTableSection::DistributeRemainingExtraLogicalHeight( |
1065 int& extra_logical_height) { | 1065 int& extra_logical_height) { |
1066 unsigned total_rows = grid_.size(); | 1066 unsigned total_rows = grid_.size(); |
1067 | 1067 |
1068 if (extra_logical_height <= 0 || !row_pos_[total_rows]) | 1068 if (extra_logical_height <= 0 || !row_pos_[total_rows]) |
1069 return; | 1069 return; |
1070 | 1070 |
1071 // FIXME: m_rowPos[totalRows] - m_rowPos[0] is the total rows' size. | 1071 // FIXME: row_pos_[totalRows] - row_pos_[0] is the total rows' size. |
1072 int total_row_size = row_pos_[total_rows]; | 1072 int total_row_size = row_pos_[total_rows]; |
1073 int total_logical_height_added = 0; | 1073 int total_logical_height_added = 0; |
1074 int previous_row_position = row_pos_[0]; | 1074 int previous_row_position = row_pos_[0]; |
1075 for (unsigned r = 0; r < total_rows; r++) { | 1075 for (unsigned r = 0; r < total_rows; r++) { |
1076 // weight with the original height | 1076 // weight with the original height |
1077 total_logical_height_added += extra_logical_height * | 1077 total_logical_height_added += extra_logical_height * |
1078 (row_pos_[r + 1] - previous_row_position) / | 1078 (row_pos_[r + 1] - previous_row_position) / |
1079 total_row_size; | 1079 total_row_size; |
1080 previous_row_position = row_pos_[r + 1]; | 1080 previous_row_position = row_pos_[r + 1]; |
1081 row_pos_[r + 1] += total_logical_height_added; | 1081 row_pos_[r + 1] += total_logical_height_added; |
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2157 if (Table()->Header() == this && IsRepeatingHeaderGroup()) { | 2157 if (Table()->Header() == this && IsRepeatingHeaderGroup()) { |
2158 transform_state.Flatten(); | 2158 transform_state.Flatten(); |
2159 FloatRect rect = transform_state.LastPlanarQuad().BoundingBox(); | 2159 FloatRect rect = transform_state.LastPlanarQuad().BoundingBox(); |
2160 rect.SetHeight(Table()->LogicalHeight()); | 2160 rect.SetHeight(Table()->LogicalHeight()); |
2161 transform_state.SetQuad(FloatQuad(rect)); | 2161 transform_state.SetQuad(FloatQuad(rect)); |
2162 } | 2162 } |
2163 return LayoutTableBoxComponent::MapToVisualRectInAncestorSpaceInternal( | 2163 return LayoutTableBoxComponent::MapToVisualRectInAncestorSpaceInternal( |
2164 ancestor, transform_state, flags); | 2164 ancestor, transform_state, flags); |
2165 } | 2165 } |
2166 | 2166 |
2167 bool LayoutTableSection::PaintedOutputOfObjectHasNoEffectRegardlessOfSize() | 2167 LayoutRect LayoutTableSection::GetCellPosition( |
2168 const { | 2168 unsigned row, |
2169 // LayoutTableSection paints background from columns. | 2169 unsigned effective_column) const { |
2170 if (Table()->HasColElements()) | 2170 LayoutTable* table = this->Table(); |
2171 return false; | 2171 LayoutUnit left = |
2172 return LayoutTableBoxComponent:: | 2172 LayoutUnit(table->EffectiveColumnPositions()[effective_column]); |
2173 PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); | 2173 LayoutUnit top = LayoutUnit(row_pos_[row]); |
| 2174 unsigned rightCol = std::min<unsigned>( |
| 2175 table->EffectiveColumnPositions().size() - 1, effective_column + 1); |
| 2176 unsigned bottom_row = std::min<unsigned>(row_pos_.size() - 1, row + 1); |
| 2177 LayoutUnit right = LayoutUnit(table->EffectiveColumnPositions()[rightCol]); |
| 2178 LayoutUnit bottom = LayoutUnit(row_pos_[bottom_row]); |
| 2179 left += LayoutUnit(table->HBorderSpacing()); |
| 2180 return LayoutRect(left, top, right - left, bottom - top); |
| 2181 } |
| 2182 |
| 2183 LayoutRect LayoutTableSection::GetCellPhysicalPosition( |
| 2184 unsigned row, |
| 2185 unsigned effective_column) const { |
| 2186 return TransformLogicalToPhysicalPosition( |
| 2187 GetCellPosition(row, effective_column)); |
| 2188 } |
| 2189 |
| 2190 LayoutRect LayoutTableSection::TransformLogicalToPhysicalPosition( |
| 2191 const LayoutRect& position) const { |
| 2192 WritingMode writingMode = Style()->GetWritingMode(); |
| 2193 bool is_ltr = Style()->IsLeftToRightDirection(); |
| 2194 LayoutRect transformed_position = position; |
| 2195 if (blink::IsHorizontalWritingMode(writingMode)) { |
| 2196 if (!is_ltr) |
| 2197 transformed_position.SetX(Size().Width() - transformed_position.MaxX()); |
| 2198 } else { |
| 2199 transformed_position = transformed_position.TransposedRect(); |
| 2200 if (!is_ltr) |
| 2201 transformed_position.SetY(Size().Height() - transformed_position.MaxY()); |
| 2202 if (blink::IsFlippedBlocksWritingMode(writingMode)) |
| 2203 transformed_position.SetX(Size().Width() - transformed_position.MaxX()); |
| 2204 } |
| 2205 return transformed_position; |
2174 } | 2206 } |
2175 | 2207 |
2176 } // namespace blink | 2208 } // namespace blink |
OLD | NEW |