Caret rendered at incorrect location inside empty table cell
authorrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Apr 2018 07:10:48 +0000 (07:10 +0000)
committerrego@igalia.com <rego@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Apr 2018 07:10:48 +0000 (07:10 +0000)
commit535bddc360c93dbd8c00c3325bc3048f87db93ad
tree191672b69f0505f048d1dbf7a5e21992e614295a
parent8cb5f9231d7311efe101bffc9df0c8ef8bfc2cb0
Caret rendered at incorrect location inside empty table cell
https://bugs.webkit.org/show_bug.cgi?id=85385

Reviewed by Zalan Bujtas.

Source/WebCore:

This is based on a previous patch by Shezan Baig <shezbaig.wk@gmail.com>.

This fixes the position of the caret in empty cells,
that was painted lower than expected
(and then modified when you start to edit the cell).

Ensures that editable table cells have at least one line when
they are laid out. This ensures that the cell's intrinsic before/after
padding is calculated correctly, which results in the caret location
being calculated correctly.

Test: editing/caret/caret-in-empty-cell.html

* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::hasLineIfEmpty): Override method to consider
that it has an an empty line if the table cell is editable.
* rendering/RenderTableCell.h:

LayoutTests:

* editing/caret/caret-in-empty-cell-expected.html: Added.
* editing/caret/caret-in-empty-cell.html: Added.
* editing/deleting/5206311-2-expected.txt:
* editing/deleting/5433862-1-expected.txt:
* platform/gtk/editing/deleting/5126166-expected.png:
* platform/gtk/editing/deleting/5126166-expected.txt:
* platform/gtk/editing/deleting/5206311-1-expected.png:
* platform/gtk/editing/deleting/5206311-1-expected.txt:
* platform/gtk/editing/deleting/5433862-2-expected.png:
* platform/gtk/editing/deleting/5433862-2-expected.txt:
* platform/gtk/editing/deleting/5483370-expected.png:
* platform/gtk/editing/deleting/5483370-expected.txt:
* platform/gtk/editing/selection/move-by-line-001-expected.png:
* platform/gtk/editing/selection/move-by-line-001-expected.txt:
* platform/gtk/editing/selection/select-all-004-expected.txt:
* platform/ios-simulator/editing/deleting/5126166-expected.txt:
* platform/ios-simulator/editing/deleting/5206311-1-expected.txt:
* platform/ios-simulator/editing/deleting/5433862-2-expected.txt:
* platform/ios-simulator/editing/deleting/5483370-expected.txt:
* platform/mac/editing/deleting/5126166-expected.png:
* platform/mac/editing/deleting/5126166-expected.txt:
* platform/mac/editing/deleting/5206311-1-expected.png:
* platform/mac/editing/deleting/5206311-1-expected.txt:
* platform/mac/editing/deleting/5433862-2-expected.png:
* platform/mac/editing/deleting/5433862-2-expected.txt:
* platform/mac/editing/deleting/5483370-expected.png:
* platform/mac/editing/deleting/5483370-expected.txt:
* platform/mac/editing/selection/move-by-line-001-expected.txt:
* platform/mac/editing/selection/select-all-004-expected.txt:
* platform/win/editing/deleting/5126166-expected.png: Added.
* platform/win/editing/deleting/5126166-expected.txt:
* platform/win/editing/deleting/5206311-1-expected.png: Added.
* platform/win/editing/deleting/5206311-1-expected.txt:
* platform/win/editing/deleting/5433862-2-expected.png: Added.
* platform/win/editing/deleting/5433862-2-expected.txt:
* platform/win/editing/deleting/5483370-expected.png: Added.
* platform/win/editing/deleting/5483370-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230797 268f45cc-cd09-0410-ab3c-d52691b4dbfc
41 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/caret/caret-in-empty-cell-expected.html [new file with mode: 0644]
LayoutTests/editing/caret/caret-in-empty-cell.html [new file with mode: 0644]
LayoutTests/editing/deleting/5206311-2-expected.txt
LayoutTests/editing/deleting/5433862-1-expected.txt
LayoutTests/editing/selection/select-all-004-expected.txt
LayoutTests/platform/gtk/editing/deleting/5126166-expected.png
LayoutTests/platform/gtk/editing/deleting/5126166-expected.txt
LayoutTests/platform/gtk/editing/deleting/5206311-1-expected.png
LayoutTests/platform/gtk/editing/deleting/5206311-1-expected.txt
LayoutTests/platform/gtk/editing/deleting/5433862-2-expected.png
LayoutTests/platform/gtk/editing/deleting/5433862-2-expected.txt
LayoutTests/platform/gtk/editing/deleting/5483370-expected.png
LayoutTests/platform/gtk/editing/deleting/5483370-expected.txt
LayoutTests/platform/gtk/editing/selection/move-by-line-001-expected.png
LayoutTests/platform/gtk/editing/selection/move-by-line-001-expected.txt
LayoutTests/platform/ios/editing/deleting/5126166-expected.txt
LayoutTests/platform/ios/editing/deleting/5206311-1-expected.txt
LayoutTests/platform/ios/editing/deleting/5433862-2-expected.txt
LayoutTests/platform/ios/editing/deleting/5483370-expected.txt
LayoutTests/platform/mac/editing/deleting/5126166-expected.png
LayoutTests/platform/mac/editing/deleting/5126166-expected.txt
LayoutTests/platform/mac/editing/deleting/5206311-1-expected.png
LayoutTests/platform/mac/editing/deleting/5206311-1-expected.txt
LayoutTests/platform/mac/editing/deleting/5433862-2-expected.png
LayoutTests/platform/mac/editing/deleting/5433862-2-expected.txt
LayoutTests/platform/mac/editing/deleting/5483370-expected.png
LayoutTests/platform/mac/editing/deleting/5483370-expected.txt
LayoutTests/platform/mac/editing/selection/move-by-line-001-expected.txt
LayoutTests/platform/mac/editing/selection/select-all-004-expected.txt
LayoutTests/platform/win/editing/deleting/5126166-expected.png [new file with mode: 0644]
LayoutTests/platform/win/editing/deleting/5126166-expected.txt
LayoutTests/platform/win/editing/deleting/5206311-1-expected.png [new file with mode: 0644]
LayoutTests/platform/win/editing/deleting/5206311-1-expected.txt
LayoutTests/platform/win/editing/deleting/5433862-2-expected.png [new file with mode: 0644]
LayoutTests/platform/win/editing/deleting/5433862-2-expected.txt
LayoutTests/platform/win/editing/deleting/5483370-expected.png [new file with mode: 0644]
LayoutTests/platform/win/editing/deleting/5483370-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderTableCell.cpp
Source/WebCore/rendering/RenderTableCell.h