Closed Bug 123605 Opened 23 years ago Closed 18 years ago

Use correct twisty size everywhere, not just only in PaintTwisty()

Categories

(Core :: XUL, defect, P3)

x86
All
defect

Tracking

()

RESOLVED FIXED
mozilla1.1alpha

People

(Reporter: janv, Assigned: enndeakin)

Details

Attachments

(1 file)

"GetFinalImageSize() to get the dimensions of the twisty will be wrong when the
skin is using a theme impl. You have to query the theme impl to get the
width/height of the twisty."

So, we can add a new method, e.g. GetTwistySize() and use that for twisty size.
w/o margins
Status: NEW → ASSIGNED
Priority: -- → P3
Target Milestone: --- → mozilla1.0
Target Milestone: mozilla1.0 → mozilla1.1alpha
Assignee: Jan.Varga → enndeakin
Attachment #224357 - Flags: superreview?(neil)
Attachment #224357 - Flags: review?(Jan.Varga)
Comment on attachment 224357 [details] [diff] [review]
Use native theme for calculating twisty width

>+  aImageRect = GetImageSize(aRowIndex, aColumn, PR_TRUE, aTwistyContext);
>+  if (aImageRect.height > aTwistyRect.height)
>+    aImageRect.height = aTwistyRect.height;
>+  if (aImageRect.width > aTwistyRect.width)
>+    aImageRect.width = aTwistyRect.width;
>+  else
>+    aTwistyRect.width = aImageRect.width;
I think the code would be clearer if this part was at the start, before the theme code, followed by the nsITheme tests. I also think that GetTwistyRect should return the nsITheme pointer as that value only has one consumer, e.g.
  PRUint8 appearance = aTwistyContext->GetStyleDisplay()->mAppearance;
  if (!appearance)
    return nsnull;

  nsITheme *theme = aPresContext->GetTheme();
  if (!theme || !theme->ThemeSupportsWidget(aPresContext, nsnull, appearance))
    return nsnull;
/* ... */
  return theme;

>+    if (aTwistyRect.width < minTwistySize.width || !canOverride)
>+      aTwistyRect.width = minTwistySize.width;
Odd. I wonder what happens to the height.
Attachment #224357 - Flags: superreview?(neil) → superreview+
Yeah, I also wonder why we need the aImageRect output argument. Otherwise, it looks correct.
Comment on attachment 224357 [details] [diff] [review]
Use native theme for calculating twisty width

r=varga with Neil's comments addressed and removed aImageRect (if possible)
Attachment #224357 - Flags: review?(Jan.Varga) → review+
checked in, but I didn't remove the image size, since it may not be the same as the twisty area.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Component: XP Toolkit/Widgets: Trees → XUL
QA Contact: jrgmorrison → xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: