Changeset 202504 in webkit
- Timestamp:
- Jun 27, 2016 12:06:21 PM (8 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r202484 r202504 1 2016-06-27 Anders Carlsson <andersca@apple.com> 2 3 Discounted items are displayed with positive values 4 https://bugs.webkit.org/show_bug.cgi?id=159160 5 rdar://problem/26980772 6 7 Reviewed by Dean Jackson. 8 9 * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: 10 (WebKit::toDecimalNumber): 11 Add new helper function. Correctly compute the mantissa. 12 13 (WebKit::toPKPaymentSummaryItem): 14 (WebKit::toPKShippingMethod): 15 Use toDecimalNumber. 16 1 17 2016-06-27 Miguel Gomez <magomez@igalia.com> 2 18 -
trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm
r202432 r202504 258 258 } 259 259 260 static RetainPtr<NSDecimalNumber> toDecimalNumber(int64_t value) 261 { 262 return adoptNS([[NSDecimalNumber alloc] initWithMantissa:llabs(value) exponent:-2 isNegative:value < 0]); 263 } 264 260 265 static RetainPtr<PKPaymentSummaryItem> toPKPaymentSummaryItem(const WebCore::PaymentRequest::LineItem& lineItem) 261 266 { 262 auto amount = adoptNS([[NSDecimalNumber alloc] initWithMantissa:lineItem.amount.valueOr(0) exponent:-2 isNegative:*lineItem.amount < 0]); 263 264 return [getPKPaymentSummaryItemClass() summaryItemWithLabel:lineItem.label amount:amount.get() type:toPKPaymentSummaryItemType(lineItem.type)]; 267 return [getPKPaymentSummaryItemClass() summaryItemWithLabel:lineItem.label amount:toDecimalNumber(lineItem.amount.valueOr(0)).get() type:toPKPaymentSummaryItemType(lineItem.type)]; 265 268 } 266 269 … … 321 324 static RetainPtr<PKShippingMethod> toPKShippingMethod(const WebCore::PaymentRequest::ShippingMethod& shippingMethod) 322 325 { 323 auto amount = adoptNS([[NSDecimalNumber alloc] initWithMantissa:shippingMethod.amount exponent:-2 isNegative:NO]); 324 325 RetainPtr<PKShippingMethod> result = [getPKShippingMethodClass() summaryItemWithLabel:shippingMethod.label amount:amount.get()]; 326 RetainPtr<PKShippingMethod> result = [getPKShippingMethodClass() summaryItemWithLabel:shippingMethod.label amount:toDecimalNumber(shippingMethod.amount).get()]; 326 327 [result setIdentifier:shippingMethod.identifier]; 327 328 [result setDetail:shippingMethod.detail];
Note: See TracChangeset
for help on using the changeset viewer.