widgets should be able to modify their width

RESOLVED FIXED

Status

Add-on SDK
General
RESOLVED FIXED
8 years ago
7 years ago

People

(Reporter: dietrich, Assigned: dietrich)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Assignee)

Description

8 years ago
widgets should be able to explicitly set a static width, as well as specify that the width should flex to the size of it's contents.
(Assignee)

Updated

7 years ago
OS: Linux → All
Hardware: x86 → All
(Assignee)

Comment 1

7 years ago
Created attachment 457988 [details] [diff] [review]
v1

* support static width in widget creation
* support for updating width post-creation

TODO:
* tests
* docs

i haven't found a nice way to get the widgets to automatically resize to the size of their content. i'll probably file a different bug for that, so we can at least get static sizing into 0.6.
Assignee: nobody → dietrich
(Assignee)

Comment 2

7 years ago
Created attachment 457997 [details] [diff] [review]
v2

* tests
* docs
Attachment #457988 - Attachment is obsolete: true
Attachment #457997 - Flags: review?(adw)

Comment 3

7 years ago
Comment on attachment 457997 [details] [diff] [review]
v2

>     // TODO move into a stylesheet
>     node.setAttribute("style", [
>-        "min-height: 24px; min-width: 24px; max-height: 24px; max-width: 24px;",
>+        "min-height: 24px; max-height: 24px;",
>         "overflow: hidden; margin: 5px; padding: 0px;",
>+        (widget.width ? "min-width: " + widget.width : "24") + "px;",

This string is getting a little long.  Would be good to get rid of it in favor of updating node.style.minWidth, etc.

>+    // test widget.width
>+    tests.push(function() testSingleWidget(widgets.Widget({
>+      label: "test widget.width",
>+      content: "test width",
>+      width: 200,
>+      onReady: function(e) {
>+        test.assertEqual(this.width, 200);
>+        widgets.remove(this);
>+        doneTest();
>+      }
>+    })));

Since width can be updated (as the example shows), could you expand this slightly to check that it works?

BTW, I didn't actually test this in my browser, but I'm sure you did. :)

r=adw
Attachment #457997 - Flags: review?(adw) → review+
(Assignee)

Comment 4

7 years ago
Created attachment 458027 [details] [diff] [review]
v3

made the changes, also updating the same style property consistently now. carrying over review.
Attachment #457997 - Attachment is obsolete: true
Attachment #458027 - Flags: review+
(Assignee)

Comment 5

7 years ago
http://hg.mozilla.org/labs/jetpack-sdk/rev/21575da79567
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
Blocks: 579813
The Add-on SDK is no longer a Mozilla Labs experiment and has become a big enough project to warrant its own Bugzilla product, so the "Add-on SDK" product has been created for it, and I am moving its bugs to that product.

To filter bugmail related to this change, filter on the word "looptid".
Component: Jetpack SDK → General
Product: Mozilla Labs → Add-on SDK
QA Contact: jetpack-sdk → general
Version: Trunk → unspecified
You need to log in before you can comment on or make changes to this bug.