
This fixes a plethora of rounding problems on many websites. In the future, we may want to replace this with fixed-point arithmetic (bug #18566) for performance (and consistency with other engines), but in the meantime this makes the web look a bit better. :^) There's a lot more things that could be converted to doubles, which would reduce the amount of casting necessary in this patch. We can do that incrementally, however.
23 lines
372 B
C++
23 lines
372 B
C++
/*
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Forward.h>
|
|
#include <LibWeb/Forward.h>
|
|
|
|
namespace Web::SVG {
|
|
|
|
struct ViewBox {
|
|
double min_x { 0 };
|
|
double min_y { 0 };
|
|
double width { 0 };
|
|
double height { 0 };
|
|
};
|
|
|
|
Optional<ViewBox> try_parse_view_box(StringView);
|
|
|
|
}
|