Bug 32813

Summary: Type=number UI part 2: Mac implementation of spin-button
Product: WebKit Reporter: Kent Tamura <tkent>
Component: FormsAssignee: Kent Tamura <tkent>
Status: RESOLVED FIXED    
Severity: Normal CC: adele, commit-queue, eric, mjs, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: OS X 10.5   
Bug Depends on: 31821    
Bug Blocks: 27968, 35686    
Attachments:
Description Flags
Proposed patch
none
Proposed patch (rev.2)
none
Proposed patch (rev.3) none

Kent Tamura
Reported 2009-12-20 22:47:07 PST
This bug was split from Bug#27968. A review comment from Eric Seidel: (From update of attachment 39538 [details]) This change is mostly useless w/o pixel results. If we can't see what UI you're adding, we can't really review it. Also your ChangeLogs are still kinda empty. :( Why have this big function if you're only going to return 0? +const int* stepperMargins(NSControlSize controlSize) +{ + static const int margins[3][4] = { + {0, 0, 0, 0}, + {0, 0, 0, 0}, + {0, 0, 0, 0} + }; + return margins[controlSize]; +} No need: + static NSStepperCell* cell; + if (!cell) { + cell = [[NSStepperCell alloc] init]; + } Just do: static NSStepperCell* cell = [[NSStepperCell alloc] init]; and that will only run once, the first time the function is called. Needs { } due to the comment: + if (states & PressedState && states & SpinUpState) + // FIXME: There is no way to draw a NSSteperCell with the up button hilighted. + // Disables the hilight of the down button if the up button is pressed. + [cell setHighlighted:NO];
Attachments
Proposed patch (43.57 KB, patch)
2009-12-21 03:04 PST, Kent Tamura
no flags
Proposed patch (rev.2) (76.78 KB, patch)
2010-02-04 07:33 PST, Kent Tamura
no flags
Proposed patch (rev.3) (69.79 KB, patch)
2010-02-26 00:16 PST, Kent Tamura
no flags
Kent Tamura
Comment 1 2009-12-21 03:04:27 PST
Created attachment 45318 [details] Proposed patch (In reply to comment #0) > Why have this big function if you're only going to return 0? > +const int* stepperMargins(NSControlSize controlSize) > +{ > + static const int margins[3][4] = { > + {0, 0, 0, 0}, > + {0, 0, 0, 0}, > + {0, 0, 0, 0} I followed other similar functions in this file. I removed it in the updated patch. > No need: > + static NSStepperCell* cell; > + if (!cell) { > + cell = [[NSStepperCell alloc] init]; > + } > Just do: > static NSStepperCell* cell = [[NSStepperCell alloc] init]; Fixed. > Needs { } due to the comment: > + if (states & PressedState && states & SpinUpState) > + // FIXME: There is no way to draw a NSSteperCell with the up button > hilighted. > + // Disables the hilight of the down button if the up button is > pressed. > + [cell setHighlighted:NO]; Fixed.
WebKit Review Bot
Comment 2 2009-12-21 03:05:13 PST
style-queue ran check-webkit-style on attachment 45318 [details] without any errors.
Maciej Stachowiak
Comment 3 2010-01-22 02:14:00 PST
Comment on attachment 45318 [details] Proposed patch Why is it ok that the stepper buttons are not aligned with their text fields? that seems like a bug.
Kent Tamura
Comment 4 2010-01-22 02:25:08 PST
Thank you for the comment. (In reply to comment #3) > (From update of attachment 45318 [details]) > Why is it ok that the stepper buttons are not aligned with their text fields? > that seems like a bug. Because the HTML/CSS in the test has no alignment code. The steppers are just <DIV>s. Such layout should be done automatically without HTML/CSS hack. I already have the code and it will be included in a future patch.
Adele Peterson
Comment 5 2010-02-01 22:06:10 PST
Could you include the alignment code? Is it platform-specific, or general code? I think it would help to review it at the same time, to make sure the approach is sensible.
Kent Tamura
Comment 6 2010-02-04 07:33:55 PST
Created attachment 48138 [details] Proposed patch (rev.2)
Kent Tamura
Comment 7 2010-02-04 07:36:29 PST
(In reply to comment #5) > Could you include the alignment code? Is it platform-specific, or general > code? I think it would help to review it at the same time, to make sure the > approach is sensible. ok, I added the layout code to the patch.
Darin Adler
Comment 8 2010-02-05 09:22:47 PST
Comment on attachment 48138 [details] Proposed patch (rev.2) Looks good to me, but I think Adele may be the right person to review this. She's out until Monday.
Adele Peterson
Comment 9 2010-02-25 22:20:40 PST
Comment on attachment 48138 [details] Proposed patch (rev.2) The buttons don't quite look centered vertically
Adele Peterson
Comment 10 2010-02-25 22:59:25 PST
Comment on attachment 48138 [details] Proposed patch (rev.2) I agree that the rest of this looks pretty good. tkent is going to upload a new patch to fix the centering issue.
Kent Tamura
Comment 11 2010-02-26 00:16:07 PST
Created attachment 49568 [details] Proposed patch (rev.3)
Kent Tamura
Comment 12 2010-02-26 00:18:40 PST
(In reply to comment #11) > Created an attachment (id=49568) [details] > Proposed patch (rev.3) - Updated vertical centering code - Change the layout of input-appearance-spinbutton.html so that all text fields are in the viewport.
Kent Tamura
Comment 13 2010-03-02 00:42:41 PST
Thanks for r+. I don't land this patch for now because the button has no functionsy. It's confusing. I'll post another patch to add step-up/step-down functions.
WebKit Commit Bot
Comment 14 2010-03-05 14:05:00 PST
Attachment 49568 [details] was posted by a committer and has review+, assigning to Kent Tamura for commit.
Kent Tamura
Comment 15 2010-04-30 00:45:29 PDT
Note You need to log in before you can comment on or make changes to this bug.