Set Ready For Review
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
bool is_valid_ = true;Why would `MediaFragmentURIParser` have a field `is_valid_`?
It is sort of giving an impression as if the parser can be valid or invalid.
`is_url_valid_` probably might be a better choice.
gfx::Rect GetRect() const { return rect; }`rect` is public already. Either make it private or remove this function and access directly.
TEST(MediaFragmentURIParserTest, FragmentConstructorParsesTime) {
MediaFragmentURIParser parser(StringView("t=5,10"));
EXPECT_DOUBLE_EQ(parser.StartTime(), 5.0);
EXPECT_DOUBLE_EQ(parser.EndTime(), 10.0);
}```suggestion
TEST(MediaFragmentURIParserTest, FragmentConstructorParsesTime) {
MediaFragmentURIParser parser(StringView("t=5,10"));
EXPECT_DOUBLE_EQ(parser.StartTime(), 5.0);
EXPECT_DOUBLE_EQ(parser.EndTime(), 10.0);
}
TEST(MediaFragmentURIParserTest, FragmentConstructorParsesSpatial) {
MediaFragmentURIParser parser(StringView("xywh=10,20,30,40"));
SpatialClip clip = parser.SpatialFragment();
EXPECT_TRUE(clip.IsValid());
EXPECT_EQ(clip.rect, gfx::Rect(10, 20, 30, 40));
EXPECT_EQ(clip.unit, SpatialClip::Unit::kPixel);
}
```We are not testing the primary functionality of this CL. This additional test should be helpful.
if (RuntimeEnabledFeatures::SvgSupportMediaFragmentsEnabled()) {``&& fragment.Contains("xywh")`` or something similar??
I guess this will make for an early return sparing initialization of MediaFragmentURIParser for all the non-`xywh` cases which I'm assuming must be in majority.
gfx::SizeF svg_size(SizeWithConfig(SizeConfig()));Consider `SizeWithConfigAsFloat`
SizeWithConfig truncates the fraction as it returns back a RoundedSize which can be a bit premature at this point and may result into pixel errors.
background-image: url("reference/green-100x100.svg#xywh=0,0,200,200");Same here.
Wouldn't this produce the same 100x100 green image anyway regardless of the fragment?
Please correct me if I'm wrong.
background-image: url("reference/green-100x100.svg#xywh=percent:0,0,100,100");Wouldn't this produce the same 100x100 green image regardless of the fragment?
Please correct me if I'm wrong.