mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 17:52:26 -05:00
LibWeb: Honor border
attribute on HTMLImageElement
This commit is contained in:
parent
e781aab274
commit
1288452bc3
Notes:
github-actions[bot]
2024-11-23 13:43:45 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/1288452bc3f Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2519
2 changed files with 84 additions and 67 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2023, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2018-2024, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
|
@ -11,7 +11,9 @@
|
|||
#include <LibWeb/Bindings/HTMLImageElementPrototype.h>
|
||||
#include <LibWeb/CSS/Parser/Parser.h>
|
||||
#include <LibWeb/CSS/StyleComputer.h>
|
||||
#include <LibWeb/CSS/StyleValues/CSSKeywordValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
|
||||
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/Fetch/Fetching/Fetching.h>
|
||||
|
@ -26,6 +28,7 @@
|
|||
#include <LibWeb/HTML/HTMLSourceElement.h>
|
||||
#include <LibWeb/HTML/ImageRequest.h>
|
||||
#include <LibWeb/HTML/ListOfAvailableImages.h>
|
||||
#include <LibWeb/HTML/Numbers.h>
|
||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||
#include <LibWeb/HTML/PotentialCORSRequest.h>
|
||||
#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
|
||||
|
@ -92,6 +95,20 @@ void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) c
|
|||
style.set_property(CSS::PropertyID::MarginTop, *parsed_value);
|
||||
style.set_property(CSS::PropertyID::MarginBottom, *parsed_value);
|
||||
}
|
||||
} else if (name == HTML::AttributeNames::border) {
|
||||
if (auto parsed_value = parse_non_negative_integer(value); parsed_value.has_value()) {
|
||||
auto width_value = CSS::LengthStyleValue::create(CSS::Length::make_px(*parsed_value));
|
||||
style.set_property(CSS::PropertyID::BorderTopWidth, width_value);
|
||||
style.set_property(CSS::PropertyID::BorderRightWidth, width_value);
|
||||
style.set_property(CSS::PropertyID::BorderBottomWidth, width_value);
|
||||
style.set_property(CSS::PropertyID::BorderLeftWidth, width_value);
|
||||
|
||||
auto solid_value = CSS::CSSKeywordValue::create(CSS::Keyword::Solid);
|
||||
style.set_property(CSS::PropertyID::BorderTopStyle, solid_value);
|
||||
style.set_property(CSS::PropertyID::BorderRightStyle, solid_value);
|
||||
style.set_property(CSS::PropertyID::BorderBottomStyle, solid_value);
|
||||
style.set_property(CSS::PropertyID::BorderLeftStyle, solid_value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ Rerun
|
|||
|
||||
Found 588 tests
|
||||
|
||||
500 Pass
|
||||
88 Fail
|
||||
564 Pass
|
||||
24 Fail
|
||||
Details
|
||||
Result Test Name MessagePass <iframe marginwidth="200"> mapping to marginLeft
|
||||
Pass <iframe marginwidth="1007"> mapping to marginLeft
|
||||
|
@ -345,85 +345,85 @@ Pass <body bottommargin="-200px"> mapping to marginBottom
|
|||
Pass <body bottommargin=" -200"> mapping to marginBottom
|
||||
Pass <body bottommargin="+-200"> mapping to marginBottom
|
||||
Pass <body bottommargin="-+200"> mapping to marginBottom
|
||||
Fail <img border="200"> mapping to borderTopWidth
|
||||
Fail <img border="1007"> mapping to borderTopWidth
|
||||
Fail <img border=" 00523 "> mapping to borderTopWidth
|
||||
Fail <img border="200."> mapping to borderTopWidth
|
||||
Fail <img border="200.25"> mapping to borderTopWidth
|
||||
Fail <img border="200.7"> mapping to borderTopWidth
|
||||
Fail <img border="0"> mapping to borderTopWidth
|
||||
Fail <img border="-0"> mapping to borderTopWidth
|
||||
Fail <img border="+0"> mapping to borderTopWidth
|
||||
Fail <img border="+200"> mapping to borderTopWidth
|
||||
Fail <img border="200in"> mapping to borderTopWidth
|
||||
Fail <img border="200.25in"> mapping to borderTopWidth
|
||||
Fail <img border=" +200in "> mapping to borderTopWidth
|
||||
Fail <img border="200%"> mapping to borderTopWidth
|
||||
Fail <img border="200.%"> mapping to borderTopWidth
|
||||
Fail <img border="200.25%"> mapping to borderTopWidth
|
||||
Pass <img border="200"> mapping to borderTopWidth
|
||||
Pass <img border="1007"> mapping to borderTopWidth
|
||||
Pass <img border=" 00523 "> mapping to borderTopWidth
|
||||
Pass <img border="200."> mapping to borderTopWidth
|
||||
Pass <img border="200.25"> mapping to borderTopWidth
|
||||
Pass <img border="200.7"> mapping to borderTopWidth
|
||||
Pass <img border="0"> mapping to borderTopWidth
|
||||
Pass <img border="-0"> mapping to borderTopWidth
|
||||
Pass <img border="+0"> mapping to borderTopWidth
|
||||
Pass <img border="+200"> mapping to borderTopWidth
|
||||
Pass <img border="200in"> mapping to borderTopWidth
|
||||
Pass <img border="200.25in"> mapping to borderTopWidth
|
||||
Pass <img border=" +200in "> mapping to borderTopWidth
|
||||
Pass <img border="200%"> mapping to borderTopWidth
|
||||
Pass <img border="200.%"> mapping to borderTopWidth
|
||||
Pass <img border="200.25%"> mapping to borderTopWidth
|
||||
Pass <img border="-200"> mapping to borderTopWidth
|
||||
Pass <img border="-200px"> mapping to borderTopWidth
|
||||
Pass <img border=" -200"> mapping to borderTopWidth
|
||||
Pass <img border="+-200"> mapping to borderTopWidth
|
||||
Pass <img border="-+200"> mapping to borderTopWidth
|
||||
Fail <img border="200"> mapping to borderRightWidth
|
||||
Fail <img border="1007"> mapping to borderRightWidth
|
||||
Fail <img border=" 00523 "> mapping to borderRightWidth
|
||||
Fail <img border="200."> mapping to borderRightWidth
|
||||
Fail <img border="200.25"> mapping to borderRightWidth
|
||||
Fail <img border="200.7"> mapping to borderRightWidth
|
||||
Fail <img border="0"> mapping to borderRightWidth
|
||||
Fail <img border="-0"> mapping to borderRightWidth
|
||||
Fail <img border="+0"> mapping to borderRightWidth
|
||||
Fail <img border="+200"> mapping to borderRightWidth
|
||||
Fail <img border="200in"> mapping to borderRightWidth
|
||||
Fail <img border="200.25in"> mapping to borderRightWidth
|
||||
Fail <img border=" +200in "> mapping to borderRightWidth
|
||||
Fail <img border="200%"> mapping to borderRightWidth
|
||||
Fail <img border="200.%"> mapping to borderRightWidth
|
||||
Fail <img border="200.25%"> mapping to borderRightWidth
|
||||
Pass <img border="200"> mapping to borderRightWidth
|
||||
Pass <img border="1007"> mapping to borderRightWidth
|
||||
Pass <img border=" 00523 "> mapping to borderRightWidth
|
||||
Pass <img border="200."> mapping to borderRightWidth
|
||||
Pass <img border="200.25"> mapping to borderRightWidth
|
||||
Pass <img border="200.7"> mapping to borderRightWidth
|
||||
Pass <img border="0"> mapping to borderRightWidth
|
||||
Pass <img border="-0"> mapping to borderRightWidth
|
||||
Pass <img border="+0"> mapping to borderRightWidth
|
||||
Pass <img border="+200"> mapping to borderRightWidth
|
||||
Pass <img border="200in"> mapping to borderRightWidth
|
||||
Pass <img border="200.25in"> mapping to borderRightWidth
|
||||
Pass <img border=" +200in "> mapping to borderRightWidth
|
||||
Pass <img border="200%"> mapping to borderRightWidth
|
||||
Pass <img border="200.%"> mapping to borderRightWidth
|
||||
Pass <img border="200.25%"> mapping to borderRightWidth
|
||||
Pass <img border="-200"> mapping to borderRightWidth
|
||||
Pass <img border="-200px"> mapping to borderRightWidth
|
||||
Pass <img border=" -200"> mapping to borderRightWidth
|
||||
Pass <img border="+-200"> mapping to borderRightWidth
|
||||
Pass <img border="-+200"> mapping to borderRightWidth
|
||||
Fail <img border="200"> mapping to borderBottomWidth
|
||||
Fail <img border="1007"> mapping to borderBottomWidth
|
||||
Fail <img border=" 00523 "> mapping to borderBottomWidth
|
||||
Fail <img border="200."> mapping to borderBottomWidth
|
||||
Fail <img border="200.25"> mapping to borderBottomWidth
|
||||
Fail <img border="200.7"> mapping to borderBottomWidth
|
||||
Fail <img border="0"> mapping to borderBottomWidth
|
||||
Fail <img border="-0"> mapping to borderBottomWidth
|
||||
Fail <img border="+0"> mapping to borderBottomWidth
|
||||
Fail <img border="+200"> mapping to borderBottomWidth
|
||||
Fail <img border="200in"> mapping to borderBottomWidth
|
||||
Fail <img border="200.25in"> mapping to borderBottomWidth
|
||||
Fail <img border=" +200in "> mapping to borderBottomWidth
|
||||
Fail <img border="200%"> mapping to borderBottomWidth
|
||||
Fail <img border="200.%"> mapping to borderBottomWidth
|
||||
Fail <img border="200.25%"> mapping to borderBottomWidth
|
||||
Pass <img border="200"> mapping to borderBottomWidth
|
||||
Pass <img border="1007"> mapping to borderBottomWidth
|
||||
Pass <img border=" 00523 "> mapping to borderBottomWidth
|
||||
Pass <img border="200."> mapping to borderBottomWidth
|
||||
Pass <img border="200.25"> mapping to borderBottomWidth
|
||||
Pass <img border="200.7"> mapping to borderBottomWidth
|
||||
Pass <img border="0"> mapping to borderBottomWidth
|
||||
Pass <img border="-0"> mapping to borderBottomWidth
|
||||
Pass <img border="+0"> mapping to borderBottomWidth
|
||||
Pass <img border="+200"> mapping to borderBottomWidth
|
||||
Pass <img border="200in"> mapping to borderBottomWidth
|
||||
Pass <img border="200.25in"> mapping to borderBottomWidth
|
||||
Pass <img border=" +200in "> mapping to borderBottomWidth
|
||||
Pass <img border="200%"> mapping to borderBottomWidth
|
||||
Pass <img border="200.%"> mapping to borderBottomWidth
|
||||
Pass <img border="200.25%"> mapping to borderBottomWidth
|
||||
Pass <img border="-200"> mapping to borderBottomWidth
|
||||
Pass <img border="-200px"> mapping to borderBottomWidth
|
||||
Pass <img border=" -200"> mapping to borderBottomWidth
|
||||
Pass <img border="+-200"> mapping to borderBottomWidth
|
||||
Pass <img border="-+200"> mapping to borderBottomWidth
|
||||
Fail <img border="200"> mapping to borderLeftWidth
|
||||
Fail <img border="1007"> mapping to borderLeftWidth
|
||||
Fail <img border=" 00523 "> mapping to borderLeftWidth
|
||||
Fail <img border="200."> mapping to borderLeftWidth
|
||||
Fail <img border="200.25"> mapping to borderLeftWidth
|
||||
Fail <img border="200.7"> mapping to borderLeftWidth
|
||||
Fail <img border="0"> mapping to borderLeftWidth
|
||||
Fail <img border="-0"> mapping to borderLeftWidth
|
||||
Fail <img border="+0"> mapping to borderLeftWidth
|
||||
Fail <img border="+200"> mapping to borderLeftWidth
|
||||
Fail <img border="200in"> mapping to borderLeftWidth
|
||||
Fail <img border="200.25in"> mapping to borderLeftWidth
|
||||
Fail <img border=" +200in "> mapping to borderLeftWidth
|
||||
Fail <img border="200%"> mapping to borderLeftWidth
|
||||
Fail <img border="200.%"> mapping to borderLeftWidth
|
||||
Fail <img border="200.25%"> mapping to borderLeftWidth
|
||||
Pass <img border="200"> mapping to borderLeftWidth
|
||||
Pass <img border="1007"> mapping to borderLeftWidth
|
||||
Pass <img border=" 00523 "> mapping to borderLeftWidth
|
||||
Pass <img border="200."> mapping to borderLeftWidth
|
||||
Pass <img border="200.25"> mapping to borderLeftWidth
|
||||
Pass <img border="200.7"> mapping to borderLeftWidth
|
||||
Pass <img border="0"> mapping to borderLeftWidth
|
||||
Pass <img border="-0"> mapping to borderLeftWidth
|
||||
Pass <img border="+0"> mapping to borderLeftWidth
|
||||
Pass <img border="+200"> mapping to borderLeftWidth
|
||||
Pass <img border="200in"> mapping to borderLeftWidth
|
||||
Pass <img border="200.25in"> mapping to borderLeftWidth
|
||||
Pass <img border=" +200in "> mapping to borderLeftWidth
|
||||
Pass <img border="200%"> mapping to borderLeftWidth
|
||||
Pass <img border="200.%"> mapping to borderLeftWidth
|
||||
Pass <img border="200.25%"> mapping to borderLeftWidth
|
||||
Pass <img border="-200"> mapping to borderLeftWidth
|
||||
Pass <img border="-200px"> mapping to borderLeftWidth
|
||||
Pass <img border=" -200"> mapping to borderLeftWidth
|
||||
|
|
Loading…
Add table
Reference in a new issue