Bug 1468545 - Move early-exit condition earlier to avoid more work, remove unused variable. r?botond
No functional changes intended here.
MozReview-Commit-ID: 8MwF159VEVb
--- a/layout/xul/nsSliderFrame.cpp
+++ b/layout/xul/nsSliderFrame.cpp
@@ -1108,31 +1108,29 @@ nsSliderFrame::StartAPZDrag(WidgetGUIEve
mozilla::layers::FrameMetrics::ViewID scrollTargetId;
bool hasID = nsLayoutUtils::FindIDFor(scrollableContent, &scrollTargetId);
bool hasAPZView = hasID && (scrollTargetId != layers::FrameMetrics::NULL_SCROLL_ID);
if (!hasAPZView) {
return;
}
- nsCOMPtr<nsIContent> scrollbar = GetContentOfBox(scrollbarBox);
+ if (!nsLayoutUtils::HasDisplayPort(scrollableContent)) {
+ return;
+ }
nsIPresShell* shell = PresShell();
uint64_t inputblockId = InputAPZContext::GetInputBlockId();
uint32_t presShellId = shell->GetPresShellId();
AsyncDragMetrics dragMetrics(scrollTargetId, presShellId, inputblockId,
NSAppUnitsToFloatPixels(mDragStart,
float(AppUnitsPerCSSPixel())),
isHorizontal ? ScrollDirection::eHorizontal :
ScrollDirection::eVertical);
- if (!nsLayoutUtils::HasDisplayPort(scrollableContent)) {
- return;
- }
-
// It's important to set this before calling nsIWidget::StartAsyncScrollbarDrag(),
// because in some configurations, that can call AsyncScrollbarDragRejected()
// synchronously, which clears the flag (and we want it to stay cleared in
// that case).
mScrollingWithAPZ = true;
// When we start an APZ drag, we wont get mouse events for the drag.
// APZ will consume them all and only notify us of the new scroll position.