/* -*- 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"nsSelectsAreaFrame.h"
// Check whether we need to suppress scrollbar updates. We want to do // that if we're in a possible first pass and our block size of a row // has changed. if (list->MightNeedSecondPass()) {
nscoord newBSizeOfARow = list->CalcBSizeOfARow(); // We'll need a second pass if our block size of a row changed. For // comboboxes, we'll also need it if our block size changed. If // we're going to do a second pass, suppress scrollbar updates for // this pass. if (newBSizeOfARow != mBSizeOfARow) {
mBSizeOfARow = newBSizeOfARow;
list->SetSuppressScrollbarUpdate(true);
}
}
}
namespace mozilla { /** * This wrapper class lets us redirect mouse hits from the child frame of * an option element to the element's own frame. * REVIEW: This is what nsSelectsAreaFrame::GetFrameForPoint used to do
*/ class nsDisplayOptionEventGrabber final : public nsDisplayWrapList { public:
nsDisplayOptionEventGrabber(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayItem* aItem)
: nsDisplayWrapList(aBuilder, aFrame, aItem) {}
nsDisplayOptionEventGrabber(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayList* aList)
: nsDisplayWrapList(aBuilder, aFrame, aList) {} virtualvoid HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState,
nsTArray<nsIFrame*>* aOutFrames) override; virtualbool ShouldFlattenAway(nsDisplayListBuilder* aBuilder) override { returnfalse;
} void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override {
GetChildren()->Paint(aBuilder, aCtx,
mFrame->PresContext()->AppUnitsPerDevPixel());
}
NS_DISPLAY_DECL_NAME("OptionEventGrabber", TYPE_OPTION_EVENT_GRABBER)
};
for (uint32_t i = 0; i < outFrames.Length(); i++) {
nsIFrame* selectedFrame = outFrames.ElementAt(i); while (selectedFrame &&
!(selectedFrame->GetContent() &&
selectedFrame->GetContent()->IsHTMLElement(nsGkAtoms::option))) {
selectedFrame = selectedFrame->GetParent();
} if (selectedFrame) {
aOutFrames->AppendElement(selectedFrame);
} else { // keep the original result, which could be this frame
aOutFrames->AppendElement(outFrames.ElementAt(i));
}
}
}
nsListControlFrame* listFrame = GetEnclosingListFrame(this); if (listFrame && listFrame->IsFocused()) { // we can't just associate the display item with the list frame, // because then the list's scrollframe won't clip it (the scrollframe // only clips contained descendants).
aLists.Outlines()->AppendNewToTop<nsDisplayListFocus>(aBuilder, this);
}
}
¤ Dauer der Verarbeitung: 0.20 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.