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, 2007, 2009, 2013 Apple Inc. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2013 Apple Inc. |
8 * All rights reserved. | 8 * All rights reserved. |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 178 |
179 int borderLeft() const override; | 179 int borderLeft() const override; |
180 int borderRight() const override; | 180 int borderRight() const override; |
181 int borderTop() const override; | 181 int borderTop() const override; |
182 int borderBottom() const override; | 182 int borderBottom() const override; |
183 int borderStart() const override; | 183 int borderStart() const override; |
184 int borderEnd() const override; | 184 int borderEnd() const override; |
185 int borderBefore() const override; | 185 int borderBefore() const override; |
186 int borderAfter() const override; | 186 int borderAfter() const override; |
187 | 187 |
188 void collectBorderValues(LayoutTable::CollapsedBorderValues&); | 188 // Returns true if any collapsed borders related to this cell changed. |
189 static void sortBorderValues(LayoutTable::CollapsedBorderValues&); | 189 bool collectBorderValues(Vector<CollapsedBorderValue>&); |
| 190 static void sortBorderValues(Vector<CollapsedBorderValue>&); |
190 | 191 |
191 void layout() override; | 192 void layout() override; |
192 | 193 |
193 void paint(const PaintInfo&, const LayoutPoint&) const override; | 194 void paint(const PaintInfo&, const LayoutPoint&) const override; |
194 | 195 |
195 int cellBaselinePosition() const; | 196 int cellBaselinePosition() const; |
196 bool isBaselineAligned() const { | 197 bool isBaselineAligned() const { |
197 EVerticalAlign va = style()->verticalAlign(); | 198 EVerticalAlign va = style()->verticalAlign(); |
198 return va == VerticalAlignBaseline || va == VerticalAlignTextBottom || | 199 return va == VerticalAlignBaseline || va == VerticalAlignTextBottom || |
199 va == VerticalAlignTextTop || va == VerticalAlignSuper || | 200 va == VerticalAlignTextTop || va == VerticalAlignSuper || |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 280 |
280 #if ENABLE(ASSERT) | 281 #if ENABLE(ASSERT) |
281 bool isFirstOrLastCellInRow() const { | 282 bool isFirstOrLastCellInRow() const { |
282 return !table()->cellAfter(this) || !table()->cellBefore(this); | 283 return !table()->cellAfter(this) || !table()->cellBefore(this); |
283 } | 284 } |
284 #endif | 285 #endif |
285 | 286 |
286 const char* name() const override { return "LayoutTableCell"; } | 287 const char* name() const override { return "LayoutTableCell"; } |
287 | 288 |
288 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override; | 289 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override; |
289 void invalidateDisplayItemClients(PaintInvalidationReason) const override; | |
290 | 290 |
291 // TODO(wkorman): Consider renaming to more clearly differentiate from | 291 struct CollapsedBorderValues { |
292 // CollapsedBorderValue. | 292 CollapsedBorderValue startBorder; |
293 class CollapsedBorderValues : public DisplayItemClient { | 293 CollapsedBorderValue endBorder; |
294 public: | 294 CollapsedBorderValue beforeBorder; |
295 CollapsedBorderValues(const LayoutTable&, | 295 CollapsedBorderValue afterBorder; |
296 const CollapsedBorderValue& startBorder, | |
297 const CollapsedBorderValue& endBorder, | |
298 const CollapsedBorderValue& beforeBorder, | |
299 const CollapsedBorderValue& afterBorder); | |
300 | |
301 const CollapsedBorderValue& startBorder() const { return m_startBorder; } | |
302 const CollapsedBorderValue& endBorder() const { return m_endBorder; } | |
303 const CollapsedBorderValue& beforeBorder() const { return m_beforeBorder; } | |
304 const CollapsedBorderValue& afterBorder() const { return m_afterBorder; } | |
305 | |
306 void setCollapsedBorderValues(const CollapsedBorderValues& other); | |
307 | |
308 // DisplayItemClient methods. | |
309 String debugName() const; | |
310 LayoutRect visualRect() const; | |
311 | |
312 private: | |
313 const LayoutTable& m_layoutTable; | |
314 CollapsedBorderValue m_startBorder; | |
315 CollapsedBorderValue m_endBorder; | |
316 CollapsedBorderValue m_beforeBorder; | |
317 CollapsedBorderValue m_afterBorder; | |
318 }; | 296 }; |
319 | 297 |
320 bool usesTableAsAdditionalDisplayItemClient() const; | |
321 const CollapsedBorderValues* collapsedBorderValues() const { | 298 const CollapsedBorderValues* collapsedBorderValues() const { |
322 return m_collapsedBorderValues.get(); | 299 return m_collapsedBorderValues.get(); |
323 } | 300 } |
324 | 301 |
325 LayoutRect debugRect() const override; | 302 LayoutRect debugRect() const override; |
326 | 303 |
327 void adjustChildDebugRect(LayoutRect&) const override; | 304 void adjustChildDebugRect(LayoutRect&) const override; |
328 | 305 |
329 // A table cell's location is relative to its containing section. | 306 // A table cell's location is relative to its containing section. |
330 LayoutBox* locationContainer() const override { return section(); } | 307 LayoutBox* locationContainer() const override { return section(); } |
331 | 308 |
| 309 LayoutRect localVisualRect() const override; |
| 310 |
332 protected: | 311 protected: |
333 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; | 312 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; |
334 void computePreferredLogicalWidths() override; | 313 void computePreferredLogicalWidths() override; |
335 | 314 |
336 void addLayerHitTestRects(LayerHitTestRects&, | 315 void addLayerHitTestRects(LayerHitTestRects&, |
337 const PaintLayer* currentCompositedLayer, | 316 const PaintLayer* currentCompositedLayer, |
338 const LayoutPoint& layerOffset, | 317 const LayoutPoint& layerOffset, |
339 const LayoutRect& containerRect) const override; | 318 const LayoutRect& containerRect) const override; |
340 | 319 |
341 private: | 320 private: |
342 bool isOfType(LayoutObjectType type) const override { | 321 bool isOfType(LayoutObjectType type) const override { |
343 return type == LayoutObjectTableCell || LayoutBlockFlow::isOfType(type); | 322 return type == LayoutObjectTableCell || LayoutBlockFlow::isOfType(type); |
344 } | 323 } |
345 | 324 |
346 void willBeRemovedFromTree() override; | 325 void willBeRemovedFromTree() override; |
347 | 326 |
348 void updateLogicalWidth() override; | 327 void updateLogicalWidth() override; |
349 | 328 |
350 void paintBoxDecorationBackground(const PaintInfo&, | 329 void paintBoxDecorationBackground(const PaintInfo&, |
351 const LayoutPoint&) const override; | 330 const LayoutPoint&) const override; |
352 void paintMask(const PaintInfo&, const LayoutPoint&) const override; | 331 void paintMask(const PaintInfo&, const LayoutPoint&) const override; |
353 | 332 |
354 LayoutSize offsetFromContainer(const LayoutObject*) const override; | 333 LayoutSize offsetFromContainer(const LayoutObject*) const override; |
355 LayoutRect localVisualRect() const override; | |
356 | 334 |
357 int borderHalfLeft(bool outer) const; | 335 int borderHalfLeft(bool outer) const; |
358 int borderHalfRight(bool outer) const; | 336 int borderHalfRight(bool outer) const; |
359 int borderHalfTop(bool outer) const; | 337 int borderHalfTop(bool outer) const; |
360 int borderHalfBottom(bool outer) const; | 338 int borderHalfBottom(bool outer) const; |
361 | 339 |
362 int borderHalfStart(bool outer) const; | 340 int borderHalfStart(bool outer) const; |
363 int borderHalfEnd(bool outer) const; | 341 int borderHalfEnd(bool outer) const; |
364 int borderHalfBefore(bool outer) const; | 342 int borderHalfBefore(bool outer) const; |
365 int borderHalfAfter(bool outer) const; | 343 int borderHalfAfter(bool outer) const; |
(...skipping 17 matching lines...) Expand all Loading... |
383 // column, column group). | 361 // column, column group). |
384 // TODO(jchaffraix): It should be easier to compute all the borders in | 362 // TODO(jchaffraix): It should be easier to compute all the borders in |
385 // physical coordinates. However this is not the design of the current code. | 363 // physical coordinates. However this is not the design of the current code. |
386 // | 364 // |
387 // Blink's support for mixed directionality is currently partial. We only | 365 // Blink's support for mixed directionality is currently partial. We only |
388 // support the directionality up to |styleForCellFlow|. See comment on the | 366 // support the directionality up to |styleForCellFlow|. See comment on the |
389 // function above for more details. | 367 // function above for more details. |
390 // See also https://code.google.com/p/chromium/issues/detail?id=128227 for | 368 // See also https://code.google.com/p/chromium/issues/detail?id=128227 for |
391 // some history. | 369 // some history. |
392 // | 370 // |
393 // Those functions are called when the cache (m_collapsedBorders) is | 371 // Those functions are called before paint invalidation if the collapsed |
394 // invalidated on LayoutTable. | 372 // borders cache is invalidated on LayoutTable. |
395 CollapsedBorderValue computeCollapsedStartBorder( | 373 CollapsedBorderValue computeCollapsedStartBorder( |
396 IncludeBorderColorOrNot = IncludeBorderColor) const; | 374 IncludeBorderColorOrNot = IncludeBorderColor) const; |
397 CollapsedBorderValue computeCollapsedEndBorder( | 375 CollapsedBorderValue computeCollapsedEndBorder( |
398 IncludeBorderColorOrNot = IncludeBorderColor) const; | 376 IncludeBorderColorOrNot = IncludeBorderColor) const; |
399 CollapsedBorderValue computeCollapsedBeforeBorder( | 377 CollapsedBorderValue computeCollapsedBeforeBorder( |
400 IncludeBorderColorOrNot = IncludeBorderColor) const; | 378 IncludeBorderColorOrNot = IncludeBorderColor) const; |
401 CollapsedBorderValue computeCollapsedAfterBorder( | 379 CollapsedBorderValue computeCollapsedAfterBorder( |
402 IncludeBorderColorOrNot = IncludeBorderColor) const; | 380 IncludeBorderColorOrNot = IncludeBorderColor) const; |
403 | 381 |
404 Length logicalWidthFromColumns(LayoutTableCol* firstColForThisCell, | 382 Length logicalWidthFromColumns(LayoutTableCol* firstColForThisCell, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 return toLayoutTableCell(firstChild()); | 422 return toLayoutTableCell(firstChild()); |
445 } | 423 } |
446 | 424 |
447 inline LayoutTableCell* LayoutTableRow::lastCell() const { | 425 inline LayoutTableCell* LayoutTableRow::lastCell() const { |
448 return toLayoutTableCell(lastChild()); | 426 return toLayoutTableCell(lastChild()); |
449 } | 427 } |
450 | 428 |
451 } // namespace blink | 429 } // namespace blink |
452 | 430 |
453 #endif // LayoutTableCell_h | 431 #endif // LayoutTableCell_h |
OLD | NEW |