Bug 1709614. Allow the double tap heuristic to look at grand parent for table cells. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D114361
This commit is contained in:
Timothy Nikkel 2021-05-05 15:37:51 +00:00
Родитель 82a21c3b15
Коммит f6a0ce2933
2 изменённых файлов: 33 добавлений и 6 удалений

Просмотреть файл

@ -12,23 +12,30 @@
async function test() {
let useTouchpad = (location.search == "?touchpad");
var resolution = getResolution();
let resolution = getResolution();
ok(resolution > 0,
"The initial_resolution is " + resolution + ", which is some sane value");
// Check that double-tapping does not zoom in
info("sending first double tap");
await doubleTapOn(document.getElementById("target1"), 10, 10, useTouchpad);
var prev_resolution = resolution;
let prev_resolution = resolution;
resolution = getResolution();
ok(resolution == prev_resolution, "The first double-tap did not change the resolution: " + resolution);
// Check that double-tapping does zoom in
// Check that double-tapping does not zoom in
info("sending second double tap");
await doubleTapOn(document.getElementById("target2"), 10, 10, useTouchpad);
prev_resolution = resolution;
resolution = getResolution();
ok(resolution > prev_resolution, "The second double-tap has increased the resolution to " + resolution);
ok(resolution == prev_resolution, "The second double-tap did not change the resolution: " + resolution);
// Check that double-tapping does zoom in
info("sending third double tap");
await doubleTapOn(document.getElementById("target3"), 10, 10, useTouchpad);
prev_resolution = resolution;
resolution = getResolution();
ok(resolution > prev_resolution, "The third double-tap has increased the resolution to " + resolution);
}
waitUntilApzStable()
@ -78,7 +85,21 @@ waitUntilApzStable()
</thead>
<tbody>
<tr>
<td id="target2" class="big">The table body</td>
<td class="small"><div class="small"><div id="target2" class="small">The table body</div></div></td>
<td>with two columns</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th colspan="2">The table header</th>
</tr>
</thead>
<tbody>
<tr>
<td id="target3" class="big">The table body</td>
<td>with two columns</td>
</tr>
</tbody>

Просмотреть файл

@ -72,7 +72,7 @@ static already_AddRefed<dom::Element> ElementFromPoint(
return nullptr;
}
// Get table cell from element or parent.
// Get table cell from element, parent or grand parent.
static dom::Element* GetNearbyTableCell(
const nsCOMPtr<dom::Element>& aElement) {
nsTableCellFrame* tableCell = do_QueryFrame(aElement->GetPrimaryFrame());
@ -84,6 +84,12 @@ static dom::Element* GetNearbyTableCell(
if (tableCell) {
return parent;
}
if (dom::Element* grandParent = parent->GetFlattenedTreeParentElement()) {
tableCell = do_QueryFrame(grandParent->GetPrimaryFrame());
if (tableCell) {
return grandParent;
}
}
}
return nullptr;
}