/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nscore.h" #include "nsCOMPtr.h" #include "nsUnicharUtils.h" #include "nsListControlFrame.h" #include "HTMLSelectEventListener.h" #include "nsGkAtoms.h" #include "nsComboboxControlFrame.h" #include "nsFontMetrics.h" #include "nsIScrollableFrame.h" #include "nsCSSRendering.h" #include "nsLayoutUtils.h" #include "nsDisplayList.h" #include "nsContentUtils.h" #include "mozilla/Attributes.h" #include "mozilla/dom/Event.h" #include "mozilla/dom/HTMLOptGroupElement.h" #include "mozilla/dom/HTMLOptionsCollection.h" #include "mozilla/dom/HTMLSelectElement.h" #include "mozilla/dom/MouseEvent.h" #include "mozilla/dom/MouseEventBinding.h" #include "mozilla/EventStateManager.h" #include "mozilla/LookAndFeel.h" #include "mozilla/MouseEvents.h" #include "mozilla/Preferences.h" #include "mozilla/PresShell.h" #include "mozilla/StaticPrefs_browser.h" #include "mozilla/StaticPrefs_ui.h" #include "mozilla/TextEvents.h" #include using namespace mozilla; using namespace mozilla::dom; // Static members nsListControlFrame* nsListControlFrame::mFocused = nullptr; //--------------------------------------------------------- nsListControlFrame* NS_NewListControlFrame(PresShell* aPresShell, ComputedStyle* aStyle) { nsListControlFrame* it = new (aPresShell) nsListControlFrame(aStyle, aPresShell->GetPresContext()); it->AddStateBits(NS_FRAME_INDEPENDENT_SELECTION); return it; } NS_IMPL_FRAMEARENA_HELPERS(nsListControlFrame) nsListControlFrame::nsListControlFrame(ComputedStyle* aStyle, nsPresContext* aPresContext) : nsHTMLScrollFrame(aStyle, aPresContext, kClassID, false), mMightNeedSecondPass(false), mHasPendingInterruptAtStartOfReflow(false), mForceSelection(false) { mChangesSinceDragStart = false; mIsAllContentHere = false; mIsAllFramesHere = false; mHasBeenInitialized = false; mNeedToReset = true; mPostChildrenLoadedReset = false; } nsListControlFrame::~nsListControlFrame() = default; // for Bug 47302 (remove this comment later) void nsListControlFrame::DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) { // get the receiver interface from the browser button's content node NS_ENSURE_TRUE_VOID(mContent); // Clear the frame pointer on our event listener, just in case the // event listener can outlive the frame. mEventListener->Detach(); nsHTMLScrollFrame::DestroyFrom(aDestructRoot, aPostDestroyData); } void nsListControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists) { // We allow visibility:hidden