Skip to content

Commit

Permalink
Bug 1700375. Treat replaced elements as non-inline for the purposes o…
Browse files Browse the repository at this point in the history
…f determining which element to zoom to for double tap to zoom. r=emilio

The specific case that motivated this was text areas, but in bug 1700535 we changed those to inline block to match all other input elements and other browsers.

Bug 1539469 changed all inputs to inline-block based on the spec discussion whatwg/html#4082 but textarea's were not part of that.

<img> elements remain as inline though, and we probably do want to zoom to them (and they are replaced), so this change is still desirable.

Differential Revision: https://phabricator.services.mozilla.com/D109574
  • Loading branch information
tnikkel committed Apr 7, 2021
1 parent 9dc3234 commit df3d156
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gfx/layers/apz/util/DoubleTapToZoom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ static already_AddRefed<dom::Element> ElementFromPoint(

static bool ShouldZoomToElement(const nsCOMPtr<dom::Element>& aElement) {
if (nsIFrame* frame = aElement->GetPrimaryFrame()) {
if (frame->StyleDisplay()->IsInlineFlow()) {
if (frame->StyleDisplay()->IsInlineFlow() &&
// Replaced elements are suitable zoom targets because they act like
// inline-blocks instead of inline. (textarea's are the specific reason
// we do this)
!frame->IsFrameOfType(nsIFrame::eReplaced)) {
return false;
}
}
Expand Down

0 comments on commit df3d156

Please sign in to comment.