Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/layout/xul/nsScrollbarFrame.cpp
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
//
8
// Eric Vaughan
9
// Netscape Communications
10
//
11
// See documentation in associated header file
12
//
13
14
#include "nsScrollbarFrame.h"
15
#include "nsSliderFrame.h"
16
#include "nsScrollbarButtonFrame.h"
17
#include "nsContentCreatorFunctions.h"
18
#include "nsGkAtoms.h"
19
#include "nsIScrollableFrame.h"
20
#include "nsIScrollbarMediator.h"
21
#include "mozilla/LookAndFeel.h"
22
#include "nsStyleConsts.h"
23
#include "nsIContent.h"
24
#include "mozilla/dom/MutationEventBinding.h"
25
26
using namespace mozilla;
27
28
//
29
// NS_NewScrollbarFrame
30
//
31
// Creates a new scrollbar frame and returns it
32
//
33
nsIFrame*
34
NS_NewScrollbarFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle)
35
0
{
36
0
  return new (aPresShell) nsScrollbarFrame(aStyle);
37
0
}
38
39
NS_IMPL_FRAMEARENA_HELPERS(nsScrollbarFrame)
40
41
0
NS_QUERYFRAME_HEAD(nsScrollbarFrame)
42
0
  NS_QUERYFRAME_ENTRY(nsScrollbarFrame)
43
0
  NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
44
0
NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame)
45
46
void
47
nsScrollbarFrame::Init(nsIContent*       aContent,
48
                       nsContainerFrame* aParent,
49
                       nsIFrame*         aPrevInFlow)
50
0
{
51
0
  nsBoxFrame::Init(aContent, aParent, aPrevInFlow);
52
0
53
0
  // We want to be a reflow root since we use reflows to move the
54
0
  // slider.  Any reflow inside the scrollbar frame will be a reflow to
55
0
  // move the slider and will thus not change anything outside of the
56
0
  // scrollbar or change the size of the scrollbar frame.
57
0
  AddStateBits(NS_FRAME_REFLOW_ROOT);
58
0
}
59
60
void nsScrollbarFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData)
61
0
{
62
0
  aPostDestroyData.AddAnonymousContent(mUpTopButton.forget());
63
0
  aPostDestroyData.AddAnonymousContent(mDownTopButton.forget());
64
0
  aPostDestroyData.AddAnonymousContent(mSlider.forget());
65
0
  aPostDestroyData.AddAnonymousContent(mUpBottomButton.forget());
66
0
  aPostDestroyData.AddAnonymousContent(mDownBottomButton.forget());
67
0
  nsBoxFrame::DestroyFrom(aDestructRoot, aPostDestroyData);
68
0
}
69
70
void
71
nsScrollbarFrame::Reflow(nsPresContext*          aPresContext,
72
                         ReflowOutput&     aDesiredSize,
73
                         const ReflowInput& aReflowInput,
74
                         nsReflowStatus&          aStatus)
75
0
{
76
0
  MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
77
0
78
0
  nsBoxFrame::Reflow(aPresContext, aDesiredSize, aReflowInput, aStatus);
79
0
80
0
  // nsGfxScrollFrame may have told us to shrink to nothing. If so, make sure our
81
0
  // desired size agrees.
82
0
  if (aReflowInput.AvailableWidth() == 0) {
83
0
    aDesiredSize.Width() = 0;
84
0
  }
85
0
  if (aReflowInput.AvailableHeight() == 0) {
86
0
    aDesiredSize.Height() = 0;
87
0
  }
88
0
}
89
90
nsresult
91
nsScrollbarFrame::AttributeChanged(int32_t aNameSpaceID,
92
                                   nsAtom* aAttribute,
93
                                   int32_t aModType)
94
0
{
95
0
  nsresult rv = nsBoxFrame::AttributeChanged(aNameSpaceID, aAttribute,
96
0
                                             aModType);
97
0
98
0
  // Update value in our children
99
0
  UpdateChildrenAttributeValue(aAttribute, true);
100
0
101
0
  // if the current position changes, notify any nsGfxScrollFrame
102
0
  // parent we may have
103
0
  if (aAttribute != nsGkAtoms::curpos)
104
0
    return rv;
105
0
106
0
  nsIScrollableFrame* scrollable = do_QueryFrame(GetParent());
107
0
  if (!scrollable)
108
0
    return rv;
109
0
110
0
  nsCOMPtr<nsIContent> content(mContent);
111
0
  scrollable->CurPosAttributeChanged(content);
112
0
  return rv;
113
0
}
114
115
NS_IMETHODIMP
116
nsScrollbarFrame::HandlePress(nsPresContext* aPresContext,
117
                              WidgetGUIEvent* aEvent,
118
                              nsEventStatus* aEventStatus)
119
0
{
120
0
  return NS_OK;
121
0
}
122
123
NS_IMETHODIMP
124
nsScrollbarFrame::HandleMultiplePress(nsPresContext* aPresContext,
125
                                      WidgetGUIEvent* aEvent,
126
                                      nsEventStatus* aEventStatus,
127
                                      bool aControlHeld)
128
0
{
129
0
  return NS_OK;
130
0
}
131
132
NS_IMETHODIMP
133
nsScrollbarFrame::HandleDrag(nsPresContext* aPresContext,
134
                             WidgetGUIEvent* aEvent,
135
                             nsEventStatus* aEventStatus)
136
0
{
137
0
  return NS_OK;
138
0
}
139
140
NS_IMETHODIMP
141
nsScrollbarFrame::HandleRelease(nsPresContext* aPresContext,
142
                                WidgetGUIEvent* aEvent,
143
                                nsEventStatus* aEventStatus)
144
0
{
145
0
  return NS_OK;
146
0
}
147
148
void
149
nsScrollbarFrame::SetScrollbarMediatorContent(nsIContent* aMediator)
150
0
{
151
0
  mScrollbarMediator = aMediator;
152
0
}
153
154
nsIScrollbarMediator*
155
nsScrollbarFrame::GetScrollbarMediator()
156
0
{
157
0
  if (!mScrollbarMediator) {
158
0
    return nullptr;
159
0
  }
160
0
  nsIFrame* f = mScrollbarMediator->GetPrimaryFrame();
161
0
  nsIScrollableFrame* scrollFrame = do_QueryFrame(f);
162
0
  nsIScrollbarMediator* sbm;
163
0
164
0
  if (scrollFrame) {
165
0
    nsIFrame* scrolledFrame = scrollFrame->GetScrolledFrame();
166
0
    sbm = do_QueryFrame(scrolledFrame);
167
0
    if (sbm) {
168
0
      return sbm;
169
0
    }
170
0
  }
171
0
  sbm = do_QueryFrame(f);
172
0
  if (f && !sbm) {
173
0
    f = f->PresShell()->GetRootScrollFrame();
174
0
    if (f && f->GetContent() == mScrollbarMediator) {
175
0
      return do_QueryFrame(f);
176
0
    }
177
0
  }
178
0
  return sbm;
179
0
}
180
181
nsresult
182
nsScrollbarFrame::GetXULMargin(nsMargin& aMargin)
183
0
{
184
0
  nsresult rv = NS_ERROR_FAILURE;
185
0
  aMargin.SizeTo(0,0,0,0);
186
0
187
0
  if (LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0) {
188
0
    nsPresContext* presContext = PresContext();
189
0
    nsITheme* theme = presContext->GetTheme();
190
0
    if (theme && theme->ThemeSupportsWidget(presContext, this, StyleAppearance::Scrollbar)) {
191
0
      LayoutDeviceIntSize size;
192
0
      bool isOverridable;
193
0
      theme->GetMinimumWidgetSize(presContext, this, StyleAppearance::Scrollbar, &size,
194
0
                                  &isOverridable);
195
0
      if (IsXULHorizontal()) {
196
0
        aMargin.top = -presContext->DevPixelsToAppUnits(size.height);
197
0
      } else {
198
0
        aMargin.left = -presContext->DevPixelsToAppUnits(size.width);
199
0
      }
200
0
      rv = NS_OK;
201
0
    }
202
0
  }
203
0
204
0
  if (NS_FAILED(rv)) {
205
0
    rv = nsBox::GetXULMargin(aMargin);
206
0
  }
207
0
208
0
  if (NS_SUCCEEDED(rv) && !IsXULHorizontal()) {
209
0
    nsIScrollbarMediator* scrollFrame = GetScrollbarMediator();
210
0
    if (scrollFrame && !scrollFrame->IsScrollbarOnRight()) {
211
0
      Swap(aMargin.left, aMargin.right);
212
0
    }
213
0
  }
214
0
215
0
  return rv;
216
0
}
217
218
void
219
nsScrollbarFrame::SetIncrementToLine(int32_t aDirection)
220
0
{
221
0
  // get the scrollbar's content node
222
0
  nsIContent* content = GetContent();
223
0
  mSmoothScroll = true;
224
0
  mIncrement = aDirection * nsSliderFrame::GetIncrement(content);
225
0
}
226
227
void
228
nsScrollbarFrame::SetIncrementToPage(int32_t aDirection)
229
0
{
230
0
  // get the scrollbar's content node
231
0
  nsIContent* content = GetContent();
232
0
  mSmoothScroll = true;
233
0
  mIncrement = aDirection * nsSliderFrame::GetPageIncrement(content);
234
0
}
235
236
void
237
nsScrollbarFrame::SetIncrementToWhole(int32_t aDirection)
238
0
{
239
0
  // get the scrollbar's content node
240
0
  nsIContent* content = GetContent();
241
0
  if (aDirection == -1)
242
0
    mIncrement = -nsSliderFrame::GetCurrentPosition(content);
243
0
  else
244
0
    mIncrement = nsSliderFrame::GetMaxPosition(content) -
245
0
                 nsSliderFrame::GetCurrentPosition(content);
246
0
  // Don't repeat or use smooth scrolling if scrolling to beginning or end
247
0
  // of a page.
248
0
  mSmoothScroll = false;
249
0
}
250
251
int32_t
252
nsScrollbarFrame::MoveToNewPosition()
253
0
{
254
0
  // get the scrollbar's content node
255
0
  RefPtr<Element> content = GetContent()->AsElement();
256
0
257
0
  // get the current pos
258
0
  int32_t curpos = nsSliderFrame::GetCurrentPosition(content);
259
0
260
0
  // get the max pos
261
0
  int32_t maxpos = nsSliderFrame::GetMaxPosition(content);
262
0
263
0
  // increment the given amount
264
0
  if (mIncrement) {
265
0
    curpos += mIncrement;
266
0
  }
267
0
268
0
  // make sure the current position is between the current and max positions
269
0
  if (curpos < 0) {
270
0
    curpos = 0;
271
0
  } else if (curpos > maxpos) {
272
0
    curpos = maxpos;
273
0
  }
274
0
275
0
  // set the current position of the slider.
276
0
  nsAutoString curposStr;
277
0
  curposStr.AppendInt(curpos);
278
0
279
0
  AutoWeakFrame weakFrame(this);
280
0
  if (mSmoothScroll) {
281
0
    content->SetAttr(kNameSpaceID_None, nsGkAtoms::smooth, NS_LITERAL_STRING("true"), false);
282
0
  }
283
0
  content->SetAttr(kNameSpaceID_None, nsGkAtoms::curpos, curposStr, false);
284
0
  // notify the nsScrollbarFrame of the change
285
0
  AttributeChanged(kNameSpaceID_None, nsGkAtoms::curpos,
286
0
                   dom::MutationEvent_Binding::MODIFICATION);
287
0
  if (!weakFrame.IsAlive()) {
288
0
    return curpos;
289
0
  }
290
0
  // notify all nsSliderFrames of the change
291
0
  nsIFrame::ChildListIterator childLists(this);
292
0
  for (; !childLists.IsDone(); childLists.Next()) {
293
0
    nsFrameList::Enumerator childFrames(childLists.CurrentList());
294
0
    for (; !childFrames.AtEnd(); childFrames.Next()) {
295
0
      nsIFrame* f = childFrames.get();
296
0
      nsSliderFrame* sliderFrame = do_QueryFrame(f);
297
0
      if (sliderFrame) {
298
0
        sliderFrame->AttributeChanged(kNameSpaceID_None, nsGkAtoms::curpos,
299
0
                                      dom::MutationEvent_Binding::MODIFICATION);
300
0
        if (!weakFrame.IsAlive()) {
301
0
          return curpos;
302
0
        }
303
0
      }
304
0
    }
305
0
  }
306
0
  content->UnsetAttr(kNameSpaceID_None, nsGkAtoms::smooth, false);
307
0
  return curpos;
308
0
}
309
310
nsresult
311
nsScrollbarFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
312
0
{
313
0
  // <xul:scrollbarbutton sbattr="scrollbar-up-top" type="decrement" xbl:inherits="curpos,maxpos,disabled"/>
314
0
  // <xul:scrollbarbutton sbattr="scrollbar-down-top" type="increment" xbl:inherits="curpos,maxpos,disabled"/>
315
0
  // <xul:slider flex="1" xbl:inherits="disabled,curpos,maxpos,pageincrement,increment,orient">
316
0
  //   <xul:thumb sbattr="scrollbar-thumb" xbl:inherits="orient,collapsed=disabled"
317
0
  //              align="center" pack="center"/>
318
0
  // </xul:slider>
319
0
  // <xul:scrollbarbutton sbattr="scrollbar-up-bottom" type="decrement" xbl:inherits="curpos,maxpos,disabled"/>
320
0
  // <xul:scrollbarbutton sbattr="scrollbar-down-bottom" type="increment" xbl:inherits="curpos,maxpos,disabled"/>
321
0
322
0
  nsNodeInfoManager* nodeInfoManager = mContent->NodeInfo()->NodeInfoManager();
323
0
324
0
  Element* el(GetContent()->AsElement());
325
0
326
0
  // If there are children already in the node, don't create any anonymous content
327
0
  // (this only apply to crashtests/369038-1.xhtml)
328
0
  if (el->HasChildren()) {
329
0
    return NS_OK;
330
0
  }
331
0
332
0
  nsAutoString orient;
333
0
  el->GetAttr(kNameSpaceID_None, nsGkAtoms::orient, orient);
334
0
335
0
  NS_TrustedNewXULElement(getter_AddRefs(mUpTopButton),
336
0
    nodeInfoManager->GetNodeInfo(nsGkAtoms::scrollbarbutton, nullptr,
337
0
                                 kNameSpaceID_XUL,
338
0
                                 nsINode::ELEMENT_NODE)
339
0
  );
340
0
  mUpTopButton->SetAttr(kNameSpaceID_None, nsGkAtoms::sbattr,
341
0
                        NS_LITERAL_STRING("scrollbar-up-top"), false);
342
0
  mUpTopButton->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
343
0
                        NS_LITERAL_STRING("decrement"), false);
344
0
345
0
  if (!aElements.AppendElement(mUpTopButton)) {
346
0
    return NS_ERROR_OUT_OF_MEMORY;
347
0
  }
348
0
349
0
  NS_TrustedNewXULElement(getter_AddRefs(mDownTopButton),
350
0
    nodeInfoManager->GetNodeInfo(nsGkAtoms::scrollbarbutton, nullptr,
351
0
                                 kNameSpaceID_XUL,
352
0
                                 nsINode::ELEMENT_NODE)
353
0
  );
354
0
  mDownTopButton->SetAttr(kNameSpaceID_None, nsGkAtoms::sbattr,
355
0
                          NS_LITERAL_STRING("scrollbar-down-top"), false);
356
0
  mDownTopButton->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
357
0
                          NS_LITERAL_STRING("increment"), false);
358
0
359
0
  if (!aElements.AppendElement(mDownTopButton)) {
360
0
    return NS_ERROR_OUT_OF_MEMORY;
361
0
  }
362
0
363
0
  NS_TrustedNewXULElement(getter_AddRefs(mSlider),
364
0
    nodeInfoManager->GetNodeInfo(nsGkAtoms::slider, nullptr,
365
0
                                 kNameSpaceID_XUL,
366
0
                                 nsINode::ELEMENT_NODE)
367
0
  );
368
0
  mSlider->SetAttr(kNameSpaceID_None, nsGkAtoms::orient, orient, false);
369
0
  mSlider->SetAttr(kNameSpaceID_None, nsGkAtoms::flex,
370
0
                   NS_LITERAL_STRING("1"), false);
371
0
372
0
  if (!aElements.AppendElement(mSlider)) {
373
0
    return NS_ERROR_OUT_OF_MEMORY;
374
0
  }
375
0
376
0
  NS_TrustedNewXULElement(getter_AddRefs(mThumb),
377
0
    nodeInfoManager->GetNodeInfo(nsGkAtoms::thumb, nullptr,
378
0
                                 kNameSpaceID_XUL,
379
0
                                 nsINode::ELEMENT_NODE)
380
0
  );
381
0
  mThumb->SetAttr(kNameSpaceID_None, nsGkAtoms::sbattr,
382
0
                  NS_LITERAL_STRING("scrollbar-thumb"), false);
383
0
  mThumb->SetAttr(kNameSpaceID_None, nsGkAtoms::orient, orient, false);
384
0
  mThumb->SetAttr(kNameSpaceID_None, nsGkAtoms::align,
385
0
                  NS_LITERAL_STRING("center"), false);
386
0
  mThumb->SetAttr(kNameSpaceID_None, nsGkAtoms::pack,
387
0
                  NS_LITERAL_STRING("center"), false);
388
0
  mSlider->AppendChildTo(mThumb, false);
389
0
390
0
  NS_TrustedNewXULElement(getter_AddRefs(mUpBottomButton),
391
0
    nodeInfoManager->GetNodeInfo(nsGkAtoms::scrollbarbutton, nullptr,
392
0
                                 kNameSpaceID_XUL,
393
0
                                 nsINode::ELEMENT_NODE)
394
0
  );
395
0
  mUpBottomButton->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
396
0
                           NS_LITERAL_STRING("decrement"), false);
397
0
  mUpBottomButton->SetAttr(kNameSpaceID_None, nsGkAtoms::sbattr,
398
0
                           NS_LITERAL_STRING("scrollbar-up-bottom"), false);
399
0
400
0
  if (!aElements.AppendElement(mUpBottomButton)) {
401
0
    return NS_ERROR_OUT_OF_MEMORY;
402
0
  }
403
0
404
0
  NS_TrustedNewXULElement(getter_AddRefs(mDownBottomButton),
405
0
    nodeInfoManager->GetNodeInfo(nsGkAtoms::scrollbarbutton, nullptr,
406
0
                                 kNameSpaceID_XUL,
407
0
                                 nsINode::ELEMENT_NODE)
408
0
  );
409
0
  mDownBottomButton->SetAttr(kNameSpaceID_None, nsGkAtoms::sbattr,
410
0
                             NS_LITERAL_STRING("scrollbar-down-bottom"), false);
411
0
  mDownBottomButton->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
412
0
                             NS_LITERAL_STRING("increment"), false);
413
0
414
0
  if (!aElements.AppendElement(mDownBottomButton)) {
415
0
    return NS_ERROR_OUT_OF_MEMORY;
416
0
  }
417
0
418
0
  UpdateChildrenAttributeValue(nsGkAtoms::curpos, false);
419
0
  UpdateChildrenAttributeValue(nsGkAtoms::maxpos, false);
420
0
  UpdateChildrenAttributeValue(nsGkAtoms::disabled, false);
421
0
  UpdateChildrenAttributeValue(nsGkAtoms::pageincrement, false);
422
0
  UpdateChildrenAttributeValue(nsGkAtoms::increment, false);
423
0
424
0
  return NS_OK;
425
0
}
426
427
void
428
nsScrollbarFrame::UpdateChildrenAttributeValue(nsAtom* aAttribute, bool aNotify)
429
0
{
430
0
  Element* el(GetContent()->AsElement());
431
0
432
0
  nsAutoString value;
433
0
  el->GetAttr(kNameSpaceID_None, aAttribute, value);
434
0
435
0
  if (!el->HasAttr(kNameSpaceID_None, aAttribute)) {
436
0
    if (mUpTopButton) {
437
0
      mUpTopButton->UnsetAttr(kNameSpaceID_None, aAttribute, aNotify);
438
0
    }
439
0
    if (mDownTopButton) {
440
0
      mDownTopButton->UnsetAttr(kNameSpaceID_None, aAttribute, aNotify);
441
0
    }
442
0
    if (mSlider) {
443
0
      mSlider->UnsetAttr(kNameSpaceID_None, aAttribute, aNotify);
444
0
    }
445
0
    if (mThumb && aAttribute == nsGkAtoms::disabled) {
446
0
      mThumb->UnsetAttr(kNameSpaceID_None, nsGkAtoms::collapsed, aNotify);
447
0
    }
448
0
    if (mUpBottomButton) {
449
0
      mUpBottomButton->UnsetAttr(kNameSpaceID_None, aAttribute, aNotify);
450
0
    }
451
0
    if (mDownBottomButton) {
452
0
      mDownBottomButton->UnsetAttr(kNameSpaceID_None, aAttribute, aNotify);
453
0
    }
454
0
    return;
455
0
  }
456
0
457
0
  if (aAttribute == nsGkAtoms::curpos ||
458
0
      aAttribute == nsGkAtoms::maxpos) {
459
0
    if (mUpTopButton) {
460
0
      mUpTopButton->SetAttr(kNameSpaceID_None, aAttribute, value, aNotify);
461
0
    }
462
0
    if (mDownTopButton) {
463
0
      mDownTopButton->SetAttr(kNameSpaceID_None, aAttribute, value, aNotify);
464
0
    }
465
0
    if (mSlider) {
466
0
      mSlider->SetAttr(kNameSpaceID_None, aAttribute, value, aNotify);
467
0
    }
468
0
    if (mUpBottomButton) {
469
0
      mUpBottomButton->SetAttr(kNameSpaceID_None, aAttribute, value, aNotify);
470
0
    }
471
0
    if (mDownBottomButton) {
472
0
      mDownBottomButton->SetAttr(kNameSpaceID_None, aAttribute, value, aNotify);
473
0
    }
474
0
  }
475
0
  else if (aAttribute == nsGkAtoms::disabled) {
476
0
    if (mUpTopButton) {
477
0
      mUpTopButton->SetAttr(kNameSpaceID_None, aAttribute, value, aNotify);
478
0
    }
479
0
    if (mDownTopButton) {
480
0
      mDownTopButton->SetAttr(kNameSpaceID_None, aAttribute, value, aNotify);
481
0
    }
482
0
    if (mSlider) {
483
0
      mSlider->SetAttr(kNameSpaceID_None, aAttribute, value, aNotify);
484
0
    }
485
0
    // Set the value on "collapsed" attribute.
486
0
    if (mThumb) {
487
0
      mThumb->SetAttr(kNameSpaceID_None, nsGkAtoms::collapsed, value, aNotify);
488
0
    }
489
0
    if (mUpBottomButton) {
490
0
      mUpBottomButton->SetAttr(kNameSpaceID_None, aAttribute, value, aNotify);
491
0
    }
492
0
    if (mDownBottomButton) {
493
0
      mDownBottomButton->SetAttr(kNameSpaceID_None, aAttribute, value, aNotify);
494
0
    }
495
0
  }
496
0
  else if (aAttribute == nsGkAtoms::pageincrement ||
497
0
           aAttribute == nsGkAtoms::increment) {
498
0
    if (mSlider) {
499
0
      mSlider->SetAttr(kNameSpaceID_None, aAttribute, value, aNotify);
500
0
    }
501
0
  }
502
0
}
503
504
void
505
nsScrollbarFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
506
                                           uint32_t aFilter)
507
0
{
508
0
  if (mUpTopButton) {
509
0
    aElements.AppendElement(mUpTopButton);
510
0
  }
511
0
512
0
  if (mDownTopButton) {
513
0
    aElements.AppendElement(mDownTopButton);
514
0
  }
515
0
516
0
  if (mSlider) {
517
0
    aElements.AppendElement(mSlider);
518
0
  }
519
0
520
0
  if (mUpBottomButton) {
521
0
    aElements.AppendElement(mUpBottomButton);
522
0
  }
523
0
524
0
  if (mDownBottomButton) {
525
0
    aElements.AppendElement(mDownBottomButton);
526
0
  }
527
0
}