Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Issue 1819073004: Fix table cell background painting (Closed)

Created:
4 years, 9 months ago by atotic1
Modified:
4 years, 8 months ago
Reviewers:
Xianzhu
CC:
chromium-reviews, szager+layoutwatch_chromium.org, zoltan1, blink-reviews-layout_chromium.org, pdr+renderingwatchlist_chromium.org, eae+blinkwatch, leviw+renderwatch, slimming-paint-reviews_chromium.org, dshwang, jchaffraix+rendering, blink-reviews-paint_chromium.org, blink-reviews, kinuko+watch, dgrogan
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix table cell background painting Table cell backgrounds inherited from tbody, colgroup, col, and tr were painted incorrectly, just blasted into cellRect. Biggest part of the fix was determining position of tbody, cols, tr. LayoutTableSection::getCellPhysicalPosition provides the way to determine position for all of them. <col> required a lot of tricky conversions between LayoutTableCol and effectiveColIndexes. As recommended by wangxianzhu, the fix is behind NewTableCellBackgroundPainting flag, and can be switched off. BUG=125336

Patch Set 1 #

Total comments: 60

Patch Set 2 : cr fixes, remove tiling algorithm #

Unified diffs Side-by-side diffs Delta from patch set Stats (+334 lines, -18 lines) Patch
M third_party/WebKit/Source/core/layout/LayoutTable.h View 1 2 chunks +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutTable.cpp View 1 2 chunks +25 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutTableCol.h View 1 2 chunks +11 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutTableCol.cpp View 1 3 chunks +115 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutTableRow.h View 1 1 chunk +3 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutTableRow.cpp View 1 1 chunk +8 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutTableSection.h View 1 2 chunks +13 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutTableSection.cpp View 1 1 chunk +49 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/paint/TableCellPainter.h View 1 3 chunks +7 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/paint/TableCellPainter.cpp View 1 6 chunks +92 lines, -9 lines 0 comments Download
M third_party/WebKit/Source/core/paint/TableRowPainter.cpp View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/paint/TableSectionPainter.cpp View 1 1 chunk +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 18 (4 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1819073004/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1819073004/1
4 years, 9 months ago (2016-03-22 20:39:01 UTC) #4
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/199056)
4 years, 9 months ago (2016-03-22 21:28:15 UTC) #6
atotic1
On 2016/03/22 20:39:01, commit-bot: I haz the power wrote: > Dry run: CQ is trying ...
4 years, 9 months ago (2016-03-22 21:35:00 UTC) #7
atotic1
Please review my cl. It fixes the bug, and hides the fix behind the flag.
4 years, 9 months ago (2016-03-22 21:50:25 UTC) #8
Xianzhu
Please skip to https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/core/paint/TableCellPainter.cpp#newcode247 first. https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/core/layout/LayoutTable.cpp File third_party/WebKit/Source/core/layout/LayoutTable.cpp (right): https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/core/layout/LayoutTable.cpp#newcode856 third_party/WebKit/Source/core/layout/LayoutTable.cpp:856: // an inverse of ...
4 years, 8 months ago (2016-03-28 00:44:43 UTC) #9
atotic1
Good catch. I was focusing on explicitly sized backgrounds, and did not test the unsized ...
4 years, 8 months ago (2016-03-28 20:45:33 UTC) #10
Xianzhu
https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/core/paint/TableCellPainter.cpp File third_party/WebKit/Source/core/paint/TableCellPainter.cpp (right): https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/core/paint/TableCellPainter.cpp#newcode247 third_party/WebKit/Source/core/paint/TableCellPainter.cpp:247: } On 2016/03/28 20:45:33, atotic1 wrote: > On 2016/03/28 ...
4 years, 8 months ago (2016-03-28 21:26:04 UTC) #11
atotic1
On 2016/03/28 21:26:04, Xianzhu wrote: > https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/core/paint/TableCellPainter.cpp > File third_party/WebKit/Source/core/paint/TableCellPainter.cpp (right): > > https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/core/paint/TableCellPainter.cpp#newcode247 > ...
4 years, 8 months ago (2016-03-29 00:42:55 UTC) #12
Xianzhu
On 2016/03/29 00:42:55, atotic1 wrote: > On 2016/03/28 21:26:04, Xianzhu wrote: > > > https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/core/paint/TableCellPainter.cpp ...
4 years, 8 months ago (2016-03-29 02:30:00 UTC) #13
atotic
On 2016/03/29 02:30:00, Xianzhu wrote: > This plan sounds good to me. I suggest you ...
4 years, 8 months ago (2016-03-29 03:38:09 UTC) #14
Xianzhu
On 2016/03/29 03:38:09, atotic2 wrote: > On 2016/03/29 02:30:00, Xianzhu wrote: > > This plan ...
4 years, 8 months ago (2016-03-29 04:26:17 UTC) #15
atotic1
On 2016/03/29 04:26:17, Xianzhu wrote: > I noticed that what I suggested was to step ...
4 years, 8 months ago (2016-03-29 16:52:46 UTC) #16
Xianzhu
On 2016/03/29 16:52:46, atotic1 wrote: > On 2016/03/29 04:26:17, Xianzhu wrote: > > I noticed ...
4 years, 8 months ago (2016-03-29 17:05:17 UTC) #17
atotic1
4 years, 8 months ago (2016-03-29 17:05:18 UTC) #18
Checked in the code review changes.

Next step is to start "Intent To Implement" process.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
File third_party/WebKit/Source/core/layout/LayoutTable.cpp (right):

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/layout/LayoutTable.cpp:856: // an inverse of
slowColElementAtAbsoluteColumn.
On 2016/03/28 00:44:42, Xianzhu wrote:
> Move the comment to header file.

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/layout/LayoutTable.cpp:857: unsigned
LayoutTable::colElementToAbsoluteColumn(const LayoutTableCol * colElement) const
On 2016/03/28 00:44:42, Xianzhu wrote:
> Nit: remove the extra space before '*'.

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/layout/LayoutTable.cpp:863: break;
On 2016/03/28 00:44:42, Xianzhu wrote:
> Change this to 'return col';

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/layout/LayoutTable.cpp:865: // Do nothing, span
will increase with children
On 2016/03/28 00:44:42, Xianzhu wrote:
> The comment is not clear to me. How about:
>     // Count spans of leaf col elements only.
>     if (!columnLayoutObject->isTableColumnGroupWithColumnChildren())
>         col += columnLayoutObject->span();

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/layout/LayoutTable.cpp:870: return col;
On 2016/03/28 00:44:41, Xianzhu wrote:
> Change this to:
>    ASSERT_NOT_REACHED();
>    return 0;
> to catch errors.

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
File third_party/WebKit/Source/core/layout/LayoutTable.h (right):

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/layout/LayoutTable.h:340: unsigned
colElementToAbsoluteColumn(const LayoutTableCol *) const;
On 2016/03/28 00:44:42, Xianzhu wrote:
> Nit: Remove the extra space before '*'.

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
File third_party/WebKit/Source/core/layout/LayoutTableCol.cpp (right):

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/layout/LayoutTableCol.cpp:191: next =
p->nextSibling();
On 2016/03/28 00:44:42, Xianzhu wrote:
> Is this change necessary?

I've seen parent() be null while debugging. That's why I put the guard in. Happy
to take it out if you'd like.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
File third_party/WebKit/Source/core/layout/LayoutTableCol.h (right):

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/layout/LayoutTableCol.h:97: // <col> elements
need to provide absoluteColumnIndex.
On 2016/03/28 00:44:42, Xianzhu wrote:
> Can you rephrase the above sentence?

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/layout/LayoutTableCol.h:101: // particular
absolute column.
On 2016/03/28 00:44:42, Xianzhu wrote:
> I think you can omit the above comments.

Moved it into .cpp. The comment describes a non-intuitive aspect of table spec.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
File third_party/WebKit/Source/core/layout/LayoutTableRow.h (right):

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/layout/LayoutTableRow.h:136: LayoutRect
positionByCellSpan() const;
On 2016/03/28 00:44:42, Xianzhu wrote:
> Please add documentation for this method. I can't guess what this function
does
> from its name. Perhaps you should also give it a better name.

I've renamed positionByCellSpan to "positionForBackgroundDrawing"

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
File third_party/WebKit/Source/core/layout/LayoutTableSection.cpp (right):

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/layout/LayoutTableSection.cpp:1668: LayoutRect
LayoutTableSection::transformLogicalToPhysicalPosition(const LayoutRect&
position) const
On 2016/03/28 00:44:42, Xianzhu wrote:
> Can you use LayoutBox::flipForWritingMode() in this function?

No. The transformation computed here is more complex. This is the simplest
I could make it.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
File third_party/WebKit/Source/core/layout/LayoutTableSection.h (right):

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/layout/LayoutTableSection.h:317: LayoutRect
getCellPosition(unsigned row, unsigned effectiveColumn) const;
On 2016/03/28 00:44:42, Xianzhu wrote:
> Document which coordinate space the returned value is in.
> 
> Also don't use 'transformation' whose defined meaning is different from what
you
> means. 

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/layout/LayoutTableSection.h:320: LayoutRect
getCellPhysicalPosition(unsigned row, unsigned effectiveColumn) const;
On 2016/03/28 00:44:42, Xianzhu wrote:
> Don't use 'transform'.

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/layout/LayoutTableSection.h:320: LayoutRect
getCellPhysicalPosition(unsigned row, unsigned effectiveColumn) const;
On 2016/03/28 00:44:42, Xianzhu wrote:
> Don't use 'transform'.

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/layout/LayoutTableSection.h:376: LayoutRect
transformLogicalToPhysicalPosition(const LayoutRect& position) const;
On 2016/03/28 00:44:42, Xianzhu wrote:
> Don't use 'transform'.

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
File third_party/WebKit/Source/core/paint/TableCellPainter.cpp (right):

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/paint/TableCellPainter.cpp:197: LayoutTable*
tableElt = m_layoutTableCell.table();
On 2016/03/28 00:44:43, Xianzhu wrote:
> s/tableElt/table/

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/paint/TableCellPainter.cpp:212: // painting
directions correctly.
On 2016/03/28 00:44:42, Xianzhu wrote:
> Convert the above to a TODO, and reference a bug. You can use
> TODO(crbug.com/...): style if you are not going to fix it.

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/paint/TableCellPainter.cpp:217:
backgroundRect.setY(cellRect.y());
On 2016/03/28 00:44:43, Xianzhu wrote:
> Why does this happen?

This happens when table is vertical. I've reworked the code to be much simpler.
It will be incorrect, see referenced bug for more details.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/paint/TableCellPainter.cpp:219:
Optional<LayoutObjectDrawingRecorder> recorder;
On 2016/03/28 00:44:42, Xianzhu wrote:
> This recorder doesn't need to be optional. You can declare and initialize it
at
> the same time at line 223. 

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/paint/TableCellPainter.cpp:225: Color c =
backgroundObject->resolveColor(CSSPropertyBackgroundColor);
On 2016/03/28 00:44:42, Xianzhu wrote:
> s/c/color/

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/paint/TableCellPainter.cpp:226: const FillLayer&
bgLayer = backgroundObject->style()->backgroundLayers();
On 2016/03/28 00:44:43, Xianzhu wrote:
> s/bgLayer/backgroundLayer/

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/paint/TableCellPainter.cpp:227: FillLayer
bgAdjustedLayer(bgLayer);
On 2016/03/28 00:44:42, Xianzhu wrote:
> Not used?

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/paint/TableCellPainter.cpp:315: {
On 2016/03/28 00:44:43, Xianzhu wrote:
> Put '{' at the end of the previous line.

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/paint/TableCellPainter.cpp:322: }
On 2016/03/28 00:44:43, Xianzhu wrote:
> Put break inside of '}' and align '}' with 'case'.

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/paint/TableCellPainter.cpp:324: case
DisplayItem::TableCellBackgroundFromSection:
On 2016/03/28 00:44:42, Xianzhu wrote:
> We know TableCellSection's paint bounds in TableCellPainter. You can just pass
> it from the callsite into TableCellPaint::paintBackgroundsBehindCell(). In
this
> way, you don't need LayoutTableSection::positionByCellSpan().

How do we know TableSection bounds inside TableCellPainter?

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/paint/TableCellPainter.cpp:339: ASSERT(false);
On 2016/03/28 00:44:42, Xianzhu wrote:
> ASSERT_NOT_REACHED();

Done.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
File third_party/WebKit/Source/core/paint/TableCellPainter.h (right):

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/paint/TableCellPainter.h:40: void
paintParentBackgroundsBehindCell(const PaintInfo&, const LayoutPoint&, const
LayoutBox* backgroundObject, DisplayItem::Type);
On 2016/03/28 00:44:43, Xianzhu wrote:
> 1. Make it private.
> 2. backgroundObject should be 'const LayoutBox&' because it is never null. You
> can update paintBackgroundsBehindCell also accept 'const LayoutBox&' or leave
it
> until you remove the RuntimeEnabledFeature.

Done. Modified the old routine to accept const LayoutBox& too.

https://codereview.chromium.org/1819073004/diff/1/third_party/WebKit/Source/c...
third_party/WebKit/Source/core/paint/TableCellPainter.h:43: LayoutRect
paintBoundsParent(const LayoutPoint& paintOffset, const LayoutBox*,
DisplayItem::Type);
On 2016/03/28 00:44:43, Xianzhu wrote:
> Make it private.

Done.

Powered by Google App Engine
This is Rietveld 408576698