!1506 无障碍修改RangeInfo精度丢失问题, 合入5.0.1

Merge pull request !1506 from qianchuang/OpenHarmony-5.0.1-Release
This commit is contained in:
openharmony_ci 2024-10-31 04:20:55 +00:00 committed by Gitee
commit 42356122ca
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 26 additions and 26 deletions

View File

@ -357,18 +357,18 @@ RangeInfoParcel::RangeInfoParcel(const RangeInfo &rangeInfo)
bool RangeInfoParcel::ReadFromParcel(Parcel &parcel)
{
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, min_);
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, max_);
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, current_);
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Double, parcel, min_);
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Double, parcel, max_);
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Double, parcel, current_);
return true;
}
bool RangeInfoParcel::Marshalling(Parcel &parcel) const
{
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, min_);
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, max_);
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Int32, parcel, current_);
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Double, parcel, min_);
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Double, parcel, max_);
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Double, parcel, current_);
return true;
}

View File

@ -608,39 +608,39 @@ const std::string &AccessibleAction::GetDescriptionInfo() const
return description_;
}
RangeInfo::RangeInfo(int32_t min, int32_t max, int32_t current)
RangeInfo::RangeInfo(double min, double max, double current)
{
min_ = min;
max_ = max;
current_ = current;
}
int32_t RangeInfo::GetMin() const
double RangeInfo::GetMin() const
{
return min_;
}
int32_t RangeInfo::GetMax() const
double RangeInfo::GetMax() const
{
return max_;
}
int32_t RangeInfo::GetCurrent() const
double RangeInfo::GetCurrent() const
{
return current_;
}
void RangeInfo::SetMin(int32_t min)
void RangeInfo::SetMin(double min)
{
min_ = min;
}
void RangeInfo::SetMax(int32_t max)
void RangeInfo::SetMax(double max)
{
max_ = max;
}
void RangeInfo::SetCurrent(int32_t current)
void RangeInfo::SetCurrent(double current)
{
current_ = current;
}

View File

@ -75,48 +75,48 @@ public:
* @param max The max value
* @param current current value
*/
RangeInfo(int32_t min, int32_t max, int32_t current);
RangeInfo(double min, double max, double current);
/**
* @brief Gets the min value.
* @return min value
*/
int32_t GetMin() const;
double GetMin() const;
/**
* @brief Gets the max value.
* @return max value.
*/
int32_t GetMax() const;
double GetMax() const;
/**
* @brief Gets the current value.
* @return current value.
*/
int32_t GetCurrent() const;
double GetCurrent() const;
/**
* @brief Sets the min value.
* @param min min value
*/
void SetMin(int32_t min);
void SetMin(double min);
/**
* @brief Sets the max value.
* @param max max value.
*/
void SetMax(int32_t max);
void SetMax(double max);
/**
* @brief Sets the current value.
* @param current current value
*/
void SetCurrent(int32_t current);
void SetCurrent(double current);
protected:
int32_t min_ = 0;
int32_t max_ = 0;
int32_t current_ = 0;
double min_ = 0;
double max_ = 0;
double current_ = 0;
};
/**

View File

@ -835,7 +835,7 @@ void NAccessibilityElement::GetElementInfoValueMax(NAccessibilityElementData *ca
if (!CheckElementInfoParameter(callbackInfo, value)) {
return;
}
NAPI_CALL_RETURN_VOID(callbackInfo->env_, napi_create_int32(callbackInfo->env_,
NAPI_CALL_RETURN_VOID(callbackInfo->env_, napi_create_double(callbackInfo->env_,
callbackInfo->accessibilityElement_.elementInfo_->GetRange().GetMax(), &value));
}
@ -844,7 +844,7 @@ void NAccessibilityElement::GetElementInfoValueMin(NAccessibilityElementData *ca
if (!CheckElementInfoParameter(callbackInfo, value)) {
return;
}
NAPI_CALL_RETURN_VOID(callbackInfo->env_, napi_create_int32(callbackInfo->env_,
NAPI_CALL_RETURN_VOID(callbackInfo->env_, napi_create_double(callbackInfo->env_,
callbackInfo->accessibilityElement_.elementInfo_->GetRange().GetMin(), &value));
}
@ -853,7 +853,7 @@ void NAccessibilityElement::GetElementInfoValueNow(NAccessibilityElementData *ca
if (!CheckElementInfoParameter(callbackInfo, value)) {
return;
}
NAPI_CALL_RETURN_VOID(callbackInfo->env_, napi_create_int32(callbackInfo->env_,
NAPI_CALL_RETURN_VOID(callbackInfo->env_, napi_create_double(callbackInfo->env_,
callbackInfo->accessibilityElement_.elementInfo_->GetRange().GetCurrent(), &value));
}