Title: [202504] trunk/Source/WebKit2
- Revision
- 202504
- Author
- [email protected]
- Date
- 2016-06-27 12:06:21 -0700 (Mon, 27 Jun 2016)
Log Message
Discounted items are displayed with positive values
https://bugs.webkit.org/show_bug.cgi?id=159160
rdar://problem/26980772
Reviewed by Dean Jackson.
* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(WebKit::toDecimalNumber):
Add new helper function. Correctly compute the mantissa.
(WebKit::toPKPaymentSummaryItem):
(WebKit::toPKShippingMethod):
Use toDecimalNumber.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (202503 => 202504)
--- trunk/Source/WebKit2/ChangeLog 2016-06-27 18:52:36 UTC (rev 202503)
+++ trunk/Source/WebKit2/ChangeLog 2016-06-27 19:06:21 UTC (rev 202504)
@@ -1,3 +1,19 @@
+2016-06-27 Anders Carlsson <[email protected]>
+
+ Discounted items are displayed with positive values
+ https://bugs.webkit.org/show_bug.cgi?id=159160
+ rdar://problem/26980772
+
+ Reviewed by Dean Jackson.
+
+ * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
+ (WebKit::toDecimalNumber):
+ Add new helper function. Correctly compute the mantissa.
+
+ (WebKit::toPKPaymentSummaryItem):
+ (WebKit::toPKShippingMethod):
+ Use toDecimalNumber.
+
2016-06-27 Miguel Gomez <[email protected]>
[GTK][EFL] Build with threaded compositor enabled is broken
Modified: trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (202503 => 202504)
--- trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2016-06-27 18:52:36 UTC (rev 202503)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2016-06-27 19:06:21 UTC (rev 202504)
@@ -257,11 +257,14 @@
}
}
+static RetainPtr<NSDecimalNumber> toDecimalNumber(int64_t value)
+{
+ return adoptNS([[NSDecimalNumber alloc] initWithMantissa:llabs(value) exponent:-2 isNegative:value < 0]);
+}
+
static RetainPtr<PKPaymentSummaryItem> toPKPaymentSummaryItem(const WebCore::PaymentRequest::LineItem& lineItem)
{
- auto amount = adoptNS([[NSDecimalNumber alloc] initWithMantissa:lineItem.amount.valueOr(0) exponent:-2 isNegative:*lineItem.amount < 0]);
-
- return [getPKPaymentSummaryItemClass() summaryItemWithLabel:lineItem.label amount:amount.get() type:toPKPaymentSummaryItemType(lineItem.type)];
+ return [getPKPaymentSummaryItemClass() summaryItemWithLabel:lineItem.label amount:toDecimalNumber(lineItem.amount.valueOr(0)).get() type:toPKPaymentSummaryItemType(lineItem.type)];
}
static PKMerchantCapability toPKMerchantCapabilities(const WebCore::PaymentRequest::MerchantCapabilities& merchantCapabilities)
@@ -320,9 +323,7 @@
static RetainPtr<PKShippingMethod> toPKShippingMethod(const WebCore::PaymentRequest::ShippingMethod& shippingMethod)
{
- auto amount = adoptNS([[NSDecimalNumber alloc] initWithMantissa:shippingMethod.amount exponent:-2 isNegative:NO]);
-
- RetainPtr<PKShippingMethod> result = [getPKShippingMethodClass() summaryItemWithLabel:shippingMethod.label amount:amount.get()];
+ RetainPtr<PKShippingMethod> result = [getPKShippingMethodClass() summaryItemWithLabel:shippingMethod.label amount:toDecimalNumber(shippingMethod.amount).get()];
[result setIdentifier:shippingMethod.identifier];
[result setDetail:shippingMethod.detail];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes