Skip to content

Commit 5fb926d

Browse files
sleepy-monaxLouciole
authored andcommitted
vaev-loader: Added comment about default object size.
1 parent d297447 commit 5fb926d

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ static Async::Task<> renderAsync(
172172
auto scene = window->render();
173173

174174
// NOTE: Override the background of HTML document, since no
175-
// one really expect a html document to transparent
175+
// one really expect a html document to be transparent
176176
if (window->document()->documentElement()->namespaceUri() == Vaev::Html::NAMESPACE) {
177177
scene = makeRc<Scene::Clear>(scene, Gfx::WHITE);
178178
}

src/vaev-engine/loader/loader-impl.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,13 @@ Async::Task<Rc<Scene::Node>> _fetchImageContentAsync(Http::Client& client, Ref::
3737
window->computeStyle();
3838
auto root = window->document()->documentElement();
3939
Layout::Resolver resolver;
40+
41+
// NOSPEC: The spec references a “default object size” but does not define explicit values.
42+
// Historically, browsers (including Chrome) default to 300x150, as mentioned in older drafts:
43+
// https://www.w3.org/TR/2011/WD-css3-images-20110908/#default-object-size
4044
auto width = resolver.resolve(root->specifiedValues()->sizing->width.unwrapOr<CalcValue<PercentOr<Length>>>(Length{300_au}), 300_au);
4145
auto height = resolver.resolve(root->specifiedValues()->sizing->height.unwrapOr<CalcValue<PercentOr<Length>>>(Length{300_au}), 300_au);
46+
4247
window->changeMedia(Style::Media::forRender({width, height}, Resolution::fromDppx(1)));
4348
co_return Ok(window->render());
4449
} else {

tests/html/tag-img.xhtml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
src="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxyZWN0IHdpZHRoPSIyMDAiIGhlaWdodD0iMjAwIiBmaWxsPSJncmVlbiIgLz4KPC9zdmc+Cg==" />
3232
</rendering>
3333

34+
<!-- TODO: Add test for loading images from actual file when this is supported by reftest -->
35+
3436
<error>
3537
</error>
3638
</test>

0 commit comments

Comments
 (0)