From 514f9fcc2988d253e7662a76684b677625fdcc84 Mon Sep 17 00:00:00 2001 From: Matthew Noorenberghe Date: Thu, 20 Sep 2018 21:07:20 +0000 Subject: [PATCH] Bug 1463545 - Replace grid layout of with a new two line design. r=sfoster Differential Revision: https://phabricator.services.mozilla.com/D5186 --HG-- extra : moz-landing-system : lando --- .../res/components/address-option.css | 65 ++----- .../payments/res/components/address-option.js | 97 ++++++++-- .../payments/res/containers/address-picker.js | 26 ++- .../payments/res/containers/payment-dialog.js | 55 ++++-- .../payments/res/containers/rich-picker.js | 13 +- browser/components/payments/res/debugging.js | 17 ++ .../res/mixins/ObservedPropertiesMixin.js | 6 +- .../payments/res/paymentRequest.xhtml | 3 + .../payments/res/unprivileged-fallbacks.js | 2 +- .../payments/test/mochitest/mochitest.ini | 1 + .../test/mochitest/test_address_option.html | 179 ++++++++++++++++++ .../test/mochitest/test_address_picker.html | 14 +- .../mochitest/test_payer_address_picker.html | 29 +-- .../test/mochitest/test_payment_dialog.html | 1 + ...yment_dialog_required_top_level_items.html | 1 + .../test/mochitest/test_rich_select.html | 3 + .../formautofill/content/autofillEditForms.js | 7 +- 17 files changed, 408 insertions(+), 111 deletions(-) create mode 100644 browser/components/payments/test/mochitest/test_address_option.html diff --git a/browser/components/payments/res/components/address-option.css b/browser/components/payments/res/components/address-option.css index 4992c71e7d79..9619048ae6ad 100644 --- a/browser/components/payments/res/components/address-option.css +++ b/browser/components/payments/res/components/address-option.css @@ -2,67 +2,28 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -address-option { +address-option.rich-option { grid-row-gap: 5px; - grid-column-gap: 10px; - grid-template-areas: - "name " - "street-address"; } -rich-select[open] > .rich-select-popup-box > address-option { - grid-template-areas: - "name name " - "street-address street-address" - "email tel "; -} - -address-picker.payer-related > rich-select address-option { - grid-template-areas: - "name name" - "tel email"; -} - -address-option > .name { - grid-area: name; -} - -address-option > .street-address { - grid-area: street-address; -} - -address-option > .email { - grid-area: email; -} - -address-option > .tel { - grid-area: tel; -} - -address-option > .name, -address-option > .street-address, -address-option > .email, -address-option > .tel { +address-option > .line { + overflow: hidden; + text-overflow: ellipsis; white-space: nowrap; } -address-picker.shipping-related address-option > .email, -address-picker.shipping-related address-option.rich-select-selected-option > .tel { +address-option > .line:empty { + /* Hide the 2nd line in cases where it's empty + (e.g. payer field with one or two fields requested) */ display: none; } -/* for payer contact details: - * display fields selectively based on the contents of the address-fields attribute - */ -address-picker.payer-related address-option > .name, -address-picker.payer-related address-option > .street-address, -address-picker.payer-related address-option > .email, -address-picker.payer-related address-option > .tel { - display: none; +address-option > .line > span { + white-space: nowrap; } -address-picker[address-fields~='name'].payer-related address-option > .name, -address-picker[address-fields~='email'].payer-related address-option > .email, -address-picker[address-fields~='tel'].payer-related address-option > .tel { - display: inline-block; +address-option > .line > span:empty::before { + /* Show the string for missing fields in grey when the field is empty */ + color: GrayText; + content: attr(data-missing-string); } diff --git a/browser/components/payments/res/components/address-option.js b/browser/components/payments/res/components/address-option.js index 434956bc0e6a..eba1585d1ef1 100644 --- a/browser/components/payments/res/components/address-option.js +++ b/browser/components/payments/res/components/address-option.js @@ -2,11 +2,15 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +/* import-globals-from ../../../../../browser/extensions/formautofill/content/autofillEditForms.js*/ import ObservedPropertiesMixin from "../mixins/ObservedPropertiesMixin.js"; import RichOption from "./rich-option.js"; /* import-globals-from ../unprivileged-fallbacks.js */ /** + * Up to two-line address display. After bug 1475684 this will also be used for + * the single-line