bool CXbtFile::HasImageAlpha() const { CXBTFFrame frame; if (!GetFirstFrame(frame)) return false; return frame.HasAlpha(); }
uint32_t CXbtFile::GetImageFormat() const { CXBTFFrame frame; if (!GetFirstFrame(frame)) return false; return frame.GetFormat(); }
bool nsListBoxBodyFrame::ContinueReflow(nscoord height) { #ifdef ACCESSIBILITY if (nsIPresShell::IsAccessibilityActive()) { // Create all the frames at once so screen readers and // onscreen keyboards can see the full list right away return true; } #endif if (height <= 0) { nsIFrame* lastChild = GetLastFrame(); nsIFrame* startingPoint = mBottomFrame; if (startingPoint == nsnull) { // We just want to delete everything but the first item. startingPoint = GetFirstFrame(); } if (lastChild != startingPoint) { // We have some hangers on (probably caused by shrinking the size of the window). // Nuke them. nsIFrame* currFrame = startingPoint->GetNextSibling(); nsBoxLayoutState state(PresContext()); nsCSSFrameConstructor* fc = PresContext()->PresShell()->FrameConstructor(); fc->BeginUpdate(); while (currFrame) { nsIFrame* nextFrame = currFrame->GetNextSibling(); RemoveChildFrame(state, currFrame); currFrame = nextFrame; } fc->EndUpdate(); PresContext()->PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_HAS_DIRTY_CHILDREN); } return false; } else return true; }
void nsListBoxBodyFrame::DestroyRows(PRInt32& aRowsToLose) { // We need to destroy frames until our row count has been properly // reduced. A reflow will then pick up and create the new frames. nsIFrame* childFrame = GetFirstFrame(); nsBoxLayoutState state(PresContext()); nsCSSFrameConstructor* fc = PresContext()->PresShell()->FrameConstructor(); fc->BeginUpdate(); while (childFrame && aRowsToLose > 0) { --aRowsToLose; nsIFrame* nextFrame = childFrame->GetNextSibling(); RemoveChildFrame(state, childFrame); mTopFrame = childFrame = nextFrame; } fc->EndUpdate(); PresContext()->PresShell()-> FrameNeedsReflow(this, nsIPresShell::eTreeChange, NS_FRAME_HAS_DIRTY_CHILDREN); }
// // Get the nsIBox for the first visible listitem, and if none exists, // create one. // nsIBox* nsListBoxBodyFrame::GetFirstItemBox(PRInt32 aOffset, bool* aCreated) { if (aCreated) *aCreated = false; // Clear ourselves out. mBottomFrame = mTopFrame; if (mTopFrame) { return mTopFrame->IsBoxFrame() ? static_cast<nsIBox*>(mTopFrame) : nsnull; } // top frame was cleared out mTopFrame = GetFirstFrame(); mBottomFrame = mTopFrame; if (mTopFrame && mRowsToPrepend <= 0) { return mTopFrame->IsBoxFrame() ? static_cast<nsIBox*>(mTopFrame) : nsnull; } // At this point, we either have no frames at all, // or the user has scrolled upwards, leaving frames // to be created at the top. Let's determine which // content needs a new frame first. nsCOMPtr<nsIContent> startContent; if (mTopFrame && mRowsToPrepend > 0) { // We need to insert rows before the top frame nsIContent* topContent = mTopFrame->GetContent(); nsIContent* topParent = topContent->GetParent(); PRInt32 contentIndex = topParent->IndexOf(topContent); contentIndex -= aOffset; if (contentIndex < 0) return nsnull; startContent = topParent->GetChildAt(contentIndex - mRowsToPrepend); } else { // This will be the first item frame we create. Use the content // at the current index, which is the first index scrolled into view GetListItemContentAt(mCurrentIndex+aOffset, getter_AddRefs(startContent)); } if (startContent) { nsIFrame* existingFrame; if (!IsListItemChild(this, startContent, &existingFrame)) { return GetFirstItemBox(++aOffset, aCreated); } if (existingFrame) { return existingFrame->IsBoxFrame() ? existingFrame : nsnull; } // Either append the new frame, or prepend it (at index 0) // XXX check here if frame was even created, it may not have been if // display: none was on listitem content bool isAppend = mRowsToPrepend <= 0; nsPresContext* presContext = PresContext(); nsCSSFrameConstructor* fc = presContext->PresShell()->FrameConstructor(); nsIFrame* topFrame = nsnull; fc->CreateListBoxContent(presContext, this, nsnull, startContent, &topFrame, isAppend, false, nsnull); mTopFrame = topFrame; if (mTopFrame) { if (aCreated) *aCreated = true; mBottomFrame = mTopFrame; return mTopFrame->IsBoxFrame() ? static_cast<nsIBox*>(mTopFrame) : nsnull; } else return GetFirstItemBox(++aOffset, 0); } return nsnull; }