mirror of
https://forge.fsky.io/oneflux/omegafox.git
synced 2026-02-10 03:22:05 -08:00
Fix swapped rect properties
Fixed a logical bug in MaskConfig swapped some screen and document.body properties. - document.body.clientTop <--> document.body.clientWidth - screen.availTop <--> screen.availLeft - screen.availWidth <--> screen.availHeight
This commit is contained in:
parent
8a9b062d05
commit
7598704d79
2 changed files with 10 additions and 10 deletions
|
|
@ -159,12 +159,12 @@ inline std::optional<bool> GetBool(const std::string& key) {
|
|||
}
|
||||
|
||||
inline std::optional<std::array<uint32_t, 4>> GetRect(
|
||||
const std::string& top, const std::string& left, const std::string& height,
|
||||
const std::string& width) {
|
||||
const std::string& left, const std::string& top, const std::string& width,
|
||||
const std::string& height) {
|
||||
// Make top and left default to 0
|
||||
std::array<std::optional<uint32_t>, 4> values = {
|
||||
GetUint32(top).value_or(0), GetUint32(left).value_or(0),
|
||||
GetUint32(height), GetUint32(width)};
|
||||
GetUint32(left).value_or(0), GetUint32(top).value_or(0),
|
||||
GetUint32(width), GetUint32(height)};
|
||||
|
||||
// If height or width is std::nullopt, return std::nullopt
|
||||
if (!values[2].has_value() || !values[3].has_value()) {
|
||||
|
|
@ -185,10 +185,10 @@ inline std::optional<std::array<uint32_t, 4>> GetRect(
|
|||
}
|
||||
|
||||
inline std::optional<std::array<int32_t, 4>> GetInt32Rect(
|
||||
const std::string& top, const std::string& left, const std::string& height,
|
||||
const std::string& width) {
|
||||
const std::string& left, const std::string& top, const std::string& width,
|
||||
const std::string& height) {
|
||||
// Calls GetRect but casts to int32_t
|
||||
if (auto optValue = GetRect(top, left, height, width)) {
|
||||
if (auto optValue = GetRect(left, top, width, height)) {
|
||||
std::array<int32_t, 4> result;
|
||||
std::transform(optValue->begin(), optValue->end(), result.begin(),
|
||||
[](const auto& val) { return static_cast<int32_t>(val); });
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ index 807cb4ec25..3df0e0f70f 100644
|
|||
|
||||
+ if (doc->GetBodyElement() == this) {
|
||||
+ if (auto conf = MaskConfig::GetInt32Rect(
|
||||
+ "document.body.clientTop", "document.body.clientLeft",
|
||||
+ "document.body.clientLeft", "document.body.clientTop",
|
||||
+ "document.body.clientWidth", "document.body.clientHeight")) {
|
||||
+ if (conf.has_value()) {
|
||||
+ auto values = conf.value();
|
||||
|
|
@ -394,8 +394,8 @@ index 4bd1e0c964..a5a95d3fdf 100644
|
|||
}
|
||||
|
||||
CSSIntRect nsScreen::GetAvailRect() {
|
||||
+ auto rect = MaskConfig::GetRect("screen.availTop", "screen.availLeft",
|
||||
+ "screen.availHeight", "screen.availWidth");
|
||||
+ auto rect = MaskConfig::GetRect("screen.availLeft", "screen.availTop",
|
||||
+ "screen.availWidth", "screen.availHeight");
|
||||
+ if (rect.has_value()) {
|
||||
+ auto values = rect.value();
|
||||
+ return {values[0], values[1], values[2], values[3]};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue