WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
152954
Web Inspector: console.table background stripes are misaligned
https://bugs.webkit.org/show_bug.cgi?id=152954
Summary
Web Inspector: console.table background stripes are misaligned
Nikita Vasilyev
Reported
2016-01-09 20:45:53 PST
Created
attachment 268638
[details]
[Image] Bug Image attached. Steps: console.table([ {x: 1, msg: "A long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-long-string"}, {x: 2, msg: "One line"} ]) Expected: The first table raw has white background. Actual: It has striped background.
Attachments
[Image] Bug
(24.24 KB, image/png)
2016-01-09 20:45 PST
,
Nikita Vasilyev
no flags
Details
Patch
(1.73 KB, patch)
2016-01-09 21:08 PST
,
Nikita Vasilyev
nvasilyev
: review-
nvasilyev
: commit-queue-
Details
Formatted Diff
Diff
Patch
(1.57 KB, patch)
2016-02-04 20:37 PST
,
Nikita Vasilyev
no flags
Details
Formatted Diff
Diff
[Image] With the patch applied
(72.51 KB, image/png)
2016-02-04 20:38 PST
,
Nikita Vasilyev
no flags
Details
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Nikita Vasilyev
Comment 1
2016-01-09 20:51:15 PST
The striped background is made by CSS gradient: .data-grid table.data { background-image: linear-gradient(to bottom, white, white 50%, hsl(214, 41%, 96%) 50%, hsl(214, 41%, 96%)); }
https://github.com/WebKit/webkit/blob/master/Source/WebInspectorUI/UserInterface/Views/DataGrid.css#L127
It should really use tr:nth-child(even) CSS pseudo selector.
Nikita Vasilyev
Comment 2
2016-01-09 21:08:57 PST
Created
attachment 268640
[details]
Patch
Nikita Vasilyev
Comment 3
2016-01-09 23:40:52 PST
Comment on
attachment 268640
[details]
Patch This broke Timelines DataGrid.
Nikita Vasilyev
Comment 4
2016-01-12 14:28:43 PST
(In reply to
comment #0
)
> Created
attachment 268638
[details]
> [Image] Bug
Should the text be clipped on a single line? Any opinions?
Matt Baker
Comment 5
2016-01-12 14:49:15 PST
(In reply to
comment #4
)
> (In reply to
comment #0
) > > Created
attachment 268638
[details]
> > [Image] Bug > > Should the text be clipped on a single line? > Any opinions?
Have you tried adding a background-size to the style based on (twice) the row height? Something like this might fix the misaligned strips (assuming row height of 21px: .data-grid table.data { background-image: linear-gradient(to bottom, white, white 50%, hsl(214, 41%, 96%) 50%, hsl(214, 41%, 96%)); background-size: 100% 42px; } If that doesn't work, you could clip it and provide a popover or tooltip with the complete text.
Matt Baker
Comment 6
2016-01-12 14:51:44 PST
(In reply to
comment #5
)
> (In reply to
comment #4
) > > (In reply to
comment #0
) > > > Created
attachment 268638
[details]
> > > [Image] Bug > > > > Should the text be clipped on a single line? > > Any opinions? > > Have you tried adding a background-size to the style based on (twice) the > row height? Something like this might fix the misaligned strips (assuming > row height of 21px: > > > .data-grid table.data { > background-image: linear-gradient(to bottom, white, white 50%, hsl(214, > 41%, 96%) 50%, hsl(214, 41%, 96%)); > background-size: 100% 42px; > }
Never mind, that would only align the stripes with each line of text.
Timothy Hatcher
Comment 7
2016-01-13 10:03:35 PST
How did Timelines break? I assume it broke because it no longer had the stripes all the way down when there were not enough rows. You might just need to add the gradient background back to the tr.filler row.
Nikita Vasilyev
Comment 8
2016-01-13 14:33:51 PST
(In reply to
comment #7
)
> How did Timelines break? > > I assume it broke because it no longer had the stripes all the way down when > there were not enough rows.
Exactly.
> > You might just need to add the gradient background back to the tr.filler row.
I would also need to take into account if the row before the tr.filler was odd or even, otherwise these two rows would have the same background. I think it's simpler to keep the gradient background on the table for the timelines and use tr:nth-child(even) for the console.
Matt Baker
Comment 9
2016-01-13 15:50:20 PST
(In reply to
comment #8
)
> (In reply to
comment #7
) > > How did Timelines break? > > > > I assume it broke because it no longer had the stripes all the way down when > > there were not enough rows. > > Exactly. > > > > > You might just need to add the gradient background back to the tr.filler row. > > I would also need to take into account if the row > before the tr.filler was odd or even, otherwise these two rows would have > the same background. > > I think it's simpler to keep the gradient background on the table for the > timelines > and use tr:nth-child(even) for the console.
AFAIK, the only use case for the gradient background is for tables that fill the entire view, to prevent having a blank background for empty or almost empty tables. Maybe we could add a grid property to encapsulate the choice between these two styles: class DataGrid { set alwaysShowRowBackground(x) { this._dataTableElement.classList.toggle("always-show-row-background", x); } }; .data-grid table.data tr:nth-child(even) { background-color: hsl(214, 41%, 96%); } .data-grid table.data.always-show-row-background { background-image: linear-gradient(to bottom, white, white 50%, hsl(214, 41%, 96%) 50%, hsl(214, 41%, 96%)); background-size: 100% 42px; } .data-grid table.data.always-show-row-background tr { background-color: transparent; }
Matt Baker
Comment 10
2016-01-13 15:52:08 PST
Cleaner: .data-grid table.data:not(.always-show-row-background) tr:nth-child(even) { background-color: hsl(214, 41%, 96%); } .data-grid table.data.always-show-row-background { background-image: linear-gradient(to bottom, white, white 50%, hsl(214, 41%, 96%) 50%, hsl(214, 41%, 96%)); background-size: 100% 42px; }
Radar WebKit Bug Importer
Comment 11
2016-01-14 16:02:17 PST
<
rdar://problem/24197735
>
Nikita Vasilyev
Comment 12
2016-02-04 20:37:04 PST
Created
attachment 270722
[details]
Patch (In reply to
comment #10
)
> Cleaner: > > .data-grid table.data:not(.always-show-row-background) tr:nth-child(even) { > background-color: hsl(214, 41%, 96%); > } > > .data-grid table.data.always-show-row-background { > background-image: linear-gradient(to bottom, white, white 50%, hsl(214, > 41%, 96%) 50%, hsl(214, 41%, 96%)); > background-size: 100% 42px; > }
.data-grid is used in 21 CSS files. I'll just fix the console for now, keeping the rest unaffected.
Nikita Vasilyev
Comment 13
2016-02-04 20:38:03 PST
Created
attachment 270723
[details]
[Image] With the patch applied
Timothy Hatcher
Comment 14
2016-02-04 20:48:10 PST
Comment on
attachment 270722
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=270722&action=review
> Source/WebInspectorUI/ChangeLog:13 > + Replace CSS gradient that produces fixed height stripes with > + a rule that sets background only on even table rows.
Comment not correct anymore.
Nikita Vasilyev
Comment 15
2016-02-04 21:22:56 PST
Comment on
attachment 270722
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=270722&action=review
>> Source/WebInspectorUI/ChangeLog:13 >> + a rule that sets background only on even table rows. > > Comment not correct anymore.
Is it? Would the following be better? "Overwrite background-image to undo fixed height stripes and set background only on even table rows."
Timothy Hatcher
Comment 16
2016-02-04 21:25:19 PST
Comment on
attachment 270722
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=270722&action=review
>>> Source/WebInspectorUI/ChangeLog:13 >>> + a rule that sets background only on even table rows. >> >> Comment not correct anymore. > > Is it? Would the following be better? > > "Overwrite background-image to undo fixed height stripes and > set background only on even table rows."
I see, replace means override, not delete.
WebKit Commit Bot
Comment 17
2016-02-04 21:57:42 PST
Comment on
attachment 270722
[details]
Patch Clearing flags on attachment: 270722 Committed
r196166
: <
http://trac.webkit.org/changeset/196166
>
WebKit Commit Bot
Comment 18
2016-02-04 21:57:46 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug