mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
LibWeb: Add a separate UA style sheet for documents in quirks mode
We need to make some additional tweaks to the default UA style when displaying documents in quirks mode.
This commit is contained in:
parent
1cb8be9906
commit
96fc476107
4 changed files with 25 additions and 5 deletions
|
@ -57,10 +57,23 @@ static StyleSheet& default_stylesheet()
|
|||
return *sheet;
|
||||
}
|
||||
|
||||
static StyleSheet& quirks_mode_stylesheet()
|
||||
{
|
||||
static StyleSheet* sheet;
|
||||
if (!sheet) {
|
||||
extern const char quirks_mode_stylesheet_source[];
|
||||
String css = quirks_mode_stylesheet_source;
|
||||
sheet = parse_css(CSS::ParsingContext(), css).leak_ref();
|
||||
}
|
||||
return *sheet;
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
void StyleResolver::for_each_stylesheet(Callback callback) const
|
||||
{
|
||||
callback(default_stylesheet());
|
||||
if (document().in_quirks_mode())
|
||||
callback(quirks_mode_stylesheet());
|
||||
for (auto& sheet : document().style_sheets().sheets()) {
|
||||
callback(sheet);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue