LibWeb: Use the default CSS attributes for embedded content from HTML

The main benefit of this is respecting the iframe frameborder
attribute, as frameborder="0" is a pretty common way of removing
the default <iframe> border.

For example, it's on all YouTube embeds by default and on some
ReCAPTCHA embeds.
This commit is contained in:
Luke Wilde 2022-10-10 17:25:06 +01:00 committed by Andreas Kling
parent 6a7c560849
commit 081a617d8d
Notes: sideshowbarker 2024-07-17 06:03:55 +09:00

View file

@ -623,6 +623,49 @@ video {
object-fit: contain;
}
/* 15.4.3 Attributes for embedded content and images
* https://html.spec.whatwg.org/multipage/rendering.html#attributes-for-embedded-content-and-images
*/
iframe[frameborder='0'], iframe[frameborder=no i] { border: none; }
embed[align=left i], iframe[align=left i], img[align=left i],
input[type=image i][align=left i], object[align=left i] {
float: left;
}
embed[align=right i], iframe[align=right i], img[align=right i],
input[type=image i][align=right i], object[align=right i] {
float: right;
}
embed[align=top i], iframe[align=top i], img[align=top i],
input[type=image i][align=top i], object[align=top i] {
vertical-align: top;
}
embed[align=baseline i], iframe[align=baseline i], img[align=baseline i],
input[type=image i][align=baseline i], object[align=baseline i] {
vertical-align: baseline;
}
embed[align=texttop i], iframe[align=texttop i], img[align=texttop i],
input[type=image i][align=texttop i], object[align=texttop i] {
vertical-align: text-top;
}
embed[align=absmiddle i], iframe[align=absmiddle i], img[align=absmiddle i],
input[type=image i][align=absmiddle i], object[align=absmiddle i],
embed[align=abscenter i], iframe[align=abscenter i], img[align=abscenter i],
input[type=image i][align=abscenter i], object[align=abscenter i] {
vertical-align: middle;
}
embed[align=bottom i], iframe[align=bottom i], img[align=bottom i],
input[type=image i][align=bottom i], object[align=bottom i] {
vertical-align: bottom;
}
/* 15.5.4 The details and summary elements
* https://html.spec.whatwg.org/multipage/rendering.html#the-details-and-summary-elements
*/