NS_IMETHODIMP nsPlaceholderFrame::List(FILE* out, int32_t aIndent, uint32_t aFlags) const { IndentBy(out, aIndent); ListTag(out); if (HasView()) { fprintf(out, " [view=%p]", (void*)GetView()); } fprintf(out, " {%d,%d,%d,%d}", mRect.x, mRect.y, mRect.width, mRect.height); if (0 != mState) { fprintf(out, " [state=%016llx]", (unsigned long long)mState); } nsIFrame* prevInFlow = GetPrevInFlow(); nsIFrame* nextInFlow = GetNextInFlow(); if (prevInFlow) { fprintf(out, " prev-in-flow=%p", static_cast<void*>(prevInFlow)); } if (nextInFlow) { fprintf(out, " next-in-flow=%p", static_cast<void*>(nextInFlow)); } if (mContent) { fprintf(out, " [content=%p]", static_cast<void*>(mContent)); } if (mStyleContext) { fprintf(out, " [sc=%p]", static_cast<void*>(mStyleContext)); } if (mOutOfFlowFrame) { fprintf(out, " outOfFlowFrame="); nsFrame::ListTag(out, mOutOfFlowFrame); } fputs("\n", out); return NS_OK; }
void CLibraryFrame::OnSetFocus(CWnd* pOldWnd) { CWnd::OnSetFocus( pOldWnd ); if ( HasView() && m_pView->IsWindowVisible() ) m_pView->SetFocus(); }
NS_IMETHODIMP nsPlaceholderFrame::List(FILE* out, PRInt32 aIndent) const { IndentBy(out, aIndent); ListTag(out); #ifdef DEBUG_waterson fprintf(out, " [parent=%p]", static_cast<void*>(mParent)); #endif if (HasView()) { fprintf(out, " [view=%p]", (void*)GetView()); } fprintf(out, " {%d,%d,%d,%d}", mRect.x, mRect.y, mRect.width, mRect.height); if (0 != mState) { fprintf(out, " [state=%08x]", mState); } nsIFrame* prevInFlow = GetPrevInFlow(); nsIFrame* nextInFlow = GetNextInFlow(); if (nsnull != prevInFlow) { fprintf(out, " prev-in-flow=%p", static_cast<void*>(prevInFlow)); } if (nsnull != nextInFlow) { fprintf(out, " next-in-flow=%p", static_cast<void*>(nextInFlow)); } if (mOutOfFlowFrame) { fprintf(out, " outOfFlowFrame="); nsFrame::ListTag(out, mOutOfFlowFrame); } fputs("\n", out); return NS_OK; }
void CLibraryFrame::OnToolbarEscape() { if ( GetFocus() == &m_wndSearch ) { m_wndSearch.SetWindowText( L"" ); if ( HasView() ) m_pView->SetFocus(); } }
void CLibraryFrame::OnToolbarReturn() { if ( GetFocus() == &m_wndSearch ) { if ( m_wndSearch.GetWindowTextLength() > 0 ) OnLibrarySearchQuick(); else if ( HasView() ) m_pView->SetFocus(); } }
BOOL CLibraryFrame::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) { if ( m_wndTreeTop.m_hWnd && m_wndTreeTop.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE; if ( m_wndTreeBottom.m_hWnd && m_wndTreeBottom.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE; if ( m_wndViewTop.m_hWnd && m_wndViewTop.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE; if ( m_wndViewBottom.m_hWnd && m_wndViewBottom.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE; if ( m_wndTree.m_hWnd && m_wndTree.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE; if ( HasView() && m_pView->OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE; if ( HasPanel() && m_pPanel->OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE; if ( m_wndBottomDynamic.m_hWnd && m_wndBottomDynamic.OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ) ) return TRUE; return CWnd::OnCmdMsg( nID, nCode, pExtra, pHandlerInfo ); }
void CLibraryFrame::OnLibraryPanel() { if ( HasPanel() ) { m_bPanelShow = FALSE; SetDynamicBar( NULL ); if ( HasView() ) m_pView->SendMessage( WM_METADATA ); SetPanel( NULL ); } else { m_bPanelShow = TRUE; Update( TRUE ); } }
NS_IMETHODIMP nsSubDocumentFrame::Init(nsIContent* aContent, nsIFrame* aParent, nsIFrame* aPrevInFlow) { // determine if we are a <frame> or <iframe> if (aContent) { nsCOMPtr<nsIDOMHTMLFrameElement> frameElem = do_QueryInterface(aContent); mIsInline = frameElem ? PR_FALSE : PR_TRUE; } nsresult rv = nsLeafFrame::Init(aContent, aParent, aPrevInFlow); if (NS_FAILED(rv)) return rv; // We are going to create an inner view. If we need a view for the // OuterFrame but we wait for the normal view creation path in // nsCSSFrameConstructor, then we will lose because the inner view's // parent will already have been set to some outer view (e.g., the // canvas) when it really needs to have this frame's view as its // parent. So, create this frame's view right away, whether we // really need it or not, and the inner view will get it as the // parent. if (!HasView()) { rv = nsHTMLContainerFrame::CreateViewForFrame(this, PR_TRUE); NS_ENSURE_SUCCESS(rv, rv); } nsIView* view = GetView(); if (aParent->GetStyleDisplay()->mDisplay == NS_STYLE_DISPLAY_DECK && !view->HasWidget()) { view->CreateWidget(kCChildCID); } // Set the primary frame now so that // DocumentViewerImpl::FindContainerView called by ShowViewer below // can find it if necessary. PresContext()->FrameManager()->SetPrimaryFrameFor(aContent, this); ShowViewer(); return NS_OK; }
NS_IMETHODIMP nsPlaceholderFrame::List(nsPresContext* aPresContext, FILE* out, PRInt32 aIndent) const { IndentBy(out, aIndent); ListTag(out); #ifdef DEBUG_waterson fprintf(out, " [parent=%p]", NS_STATIC_CAST(void*, mParent)); #endif if (HasView()) { fprintf(out, " [view=%p]", (void*)GetView()); } fprintf(out, " {%d,%d,%d,%d}", mRect.x, mRect.y, mRect.width, mRect.height); if (0 != mState) { fprintf(out, " [state=%08x]", mState); } nsIFrame* prevInFlow = GetPrevInFlow(); nsIFrame* nextInFlow = GetNextInFlow(); if (nsnull != prevInFlow) { fprintf(out, " prev-in-flow=%p", NS_STATIC_CAST(void*, prevInFlow)); }
void CLibraryFrame::OnSkinChange() { OnSize( 0, 0, 0 ); m_wndTree.SetVirtual( Settings.Library.ShowVirtual ); Skin.CreateToolBar( L"CLibraryTree.Top", &m_wndTreeTop ); if ( Settings.Library.ShowVirtual ) { Skin.CreateToolBar( L"CLibraryHeaderBar.Virtual", &m_wndViewTop ); Skin.CreateToolBar( L"CLibraryTree.Virtual", &m_wndTreeBottom ); } else { Skin.CreateToolBar( L"CLibraryHeaderBar.Physical", &m_wndViewTop ); Skin.CreateToolBar( L"CLibraryTree.Physical", &m_wndTreeBottom ); m_wndTreeTypes.SetEmptyString( IDS_LIBRARY_TYPE_FILTER_ALL ); m_wndTreeTypes.Load( Settings.Library.FilterURI ); } m_wndTreeBottom.ShowWindow( Settings.Library.ShowVirtual ? SW_SHOW : SW_HIDE ); m_wndTreeTypes.ShowWindow( Settings.Library.ShowVirtual ? SW_HIDE : SW_SHOW ); m_wndHeader.OnSkinChange(); m_wndSearch.SetFont( &CoolInterface.m_fntNormal ); CLibraryView* pView = m_pView; CPanelCtrl* pPanel = m_pPanel; SetView( NULL, TRUE, FALSE ); SetView( pView, TRUE, FALSE ); SetPanel( pPanel ); if ( HasView() ) m_pView->OnSkinChange(); }
void CLibraryFrame::UpdatePanel(BOOL bForce) { CQuickLock oLock( Library.m_pSection ); if ( ! bForce && ! m_bViewSelection ) return; m_bViewSelection = FALSE; m_pViewSelection = HasView() ? m_pView->GetSelection() : m_pViewEmpty; if ( m_bPanelShow ) { CLibraryTreeItem* pFolders = m_wndTree.GetFirstSelected(); CLibraryListPtr pFiles( GetViewSelection() ); BOOL bMetaPanelAvailable = ( pFolders != NULL ); BOOL bHistoryPanelAvailable = ( LibraryHistory.GetCount() > 0 ); // Do not display any panel for the collection folder if ( pFolders && pFolders->m_pVirtual && pFolders->m_pVirtual->m_oCollSHA1 ) bMetaPanelAvailable = bHistoryPanelAvailable = FALSE; // Prefer history panel if no files selected for meta panel if ( bMetaPanelAvailable && bHistoryPanelAvailable && pFiles && pFiles->GetCount() <= 0 ) bMetaPanelAvailable = FALSE; CPanelCtrl* pBestPanel = bMetaPanelAvailable ? static_cast< CPanelCtrl* >( &m_pMetaPanel ) : ( bHistoryPanelAvailable ? static_cast< CPanelCtrl* >( &m_pHistoryPanel ) : NULL ); if ( ! HasPanel() || m_pPanel != pBestPanel ) SetPanel( pBestPanel ); else SetPanel( m_pPanel ); } }
// this is identical to nsHTMLContainerFrame::Paint except for the background and border. NS_IMETHODIMP nsFieldSetFrame::Paint(nsPresContext* aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect, nsFramePaintLayer aWhichLayer, PRUint32 aFlags) { if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) { // Paint our background and border PRBool isVisible; if (NS_SUCCEEDED(IsVisibleForPainting(aPresContext, aRenderingContext, PR_TRUE, &isVisible)) && isVisible && mRect.width && mRect.height) { PRIntn skipSides = GetSkipSides(); const nsStyleBorder* borderStyle = GetStyleBorder(); const nsStylePadding* paddingStyle = GetStylePadding(); nscoord topBorder = borderStyle->GetBorderWidth(NS_SIDE_TOP); nscoord yoff = 0; // if the border is smaller than the legend. Move the border down // to be centered on the legend. if (topBorder < mLegendRect.height) yoff = (mLegendRect.height - topBorder)/2; nsRect rect(0, yoff, mRect.width, mRect.height - yoff); nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this, aDirtyRect, rect, *borderStyle, *paddingStyle, PR_TRUE); if (mLegendFrame) { // Use the rect of the legend frame, not mLegendRect, so we draw our // border under the legend's left and right margins. const nsRect & legendRect = mLegendFrame->GetRect(); // we should probably use PaintBorderEdges to do this but for now just use clipping // to achieve the same effect. // draw left side nsRect clipRect(rect); clipRect.width = legendRect.x - rect.x; clipRect.height = topBorder; aRenderingContext.PushState(); aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect); nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, aDirtyRect, rect, *borderStyle, mStyleContext, skipSides); aRenderingContext.PopState(); // draw right side clipRect = rect; clipRect.x = legendRect.x + legendRect.width; clipRect.width -= (legendRect.x + legendRect.width); clipRect.height = topBorder; aRenderingContext.PushState(); aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect); nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, aDirtyRect, rect, *borderStyle, mStyleContext, skipSides); aRenderingContext.PopState(); // draw bottom clipRect = rect; clipRect.y += topBorder; clipRect.height = mRect.height - (yoff + topBorder); aRenderingContext.PushState(); aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect); nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, aDirtyRect, rect, *borderStyle, mStyleContext, skipSides); aRenderingContext.PopState(); } else { nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this, aDirtyRect, nsRect(0,0,mRect.width, mRect.height), *borderStyle, mStyleContext, skipSides); } } } PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer); #ifdef DEBUG if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) { if (HasView()) { aRenderingContext.SetColor(NS_RGB(0,0,255)); } else { aRenderingContext.SetColor(NS_RGB(255,0,0)); } aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); } #endif DO_GLOBAL_REFLOW_COUNT_DSP("nsFieldSetFrame", &aRenderingContext); return NS_OK; }
BOOL CLibraryFrame::Select(DWORD nObject) { return HasView() ? m_pView->Select( nObject ) : FALSE; }
BOOL CLibraryFrame::Update(BOOL bForce, BOOL bBestView) { CSingleLock pLock( &Library.m_pSection ); if ( ! pLock.Lock( bForce ? 500 : 50 ) ) return FALSE; if ( ! bForce && m_nLibraryCookie == Library.GetCookie() ) return FALSE; m_nLibraryCookie = Library.GetCookie(); m_bUpdating = TRUE; m_nFolderCookie = GetTickCount(); m_wndTree.Update( m_nFolderCookie ); CLibraryTreeItem* pFolderSelection = m_wndTree.GetFirstSelected(); CLibraryView* pFirstView = NULL; CLibraryView* pBestView = NULL; CString strBest; if ( pFolderSelection != NULL && pFolderSelection->m_pVirtual != NULL ) { ASSERT_VALID( pFolderSelection ); strBest = pFolderSelection->m_pVirtual->GetBestView(); } for ( POSITION pos = m_pViews.GetHeadPosition(); pos; ) { CLibraryView* pView = m_pViews.GetNext( pos ); if ( pView->CheckAvailable( m_wndTree.GetFirstSelected() ) ) { CString strViewName( pView->GetRuntimeClass()->m_lpszClassName ); if ( ! pFirstView || ( pFolderSelection && pFolderSelection->m_pPhysical && strViewName.CompareNoCase( Settings.Library.LastUsedView ) == 0 ) ) pFirstView = pView; if ( strViewName.CompareNoCase( strBest ) == 0 ) pBestView = pView; } } int nHeaderSize = m_wndHeader.Update(); if ( bBestView && pBestView ) { if ( pBestView->IsKindOf( RUNTIME_CLASS(CLibraryCollectionView) ) ) nHeaderSize = 0; } if ( nHeaderSize != m_nHeaderSize ) { m_nHeaderSize = nHeaderSize; if ( m_nHeaderSize == 0 ) m_wndHeader.ShowWindow( SW_HIDE ); OnSize( 1982, 0, 0 ); } if ( pFirstView == NULL ) pFirstView = m_pViews.GetTail(); if ( pBestView != NULL && bBestView ) SetView( pBestView, FALSE, FALSE ); else if ( ! HasView() || ! m_pView->m_bAvailable ) SetView( pFirstView, FALSE, FALSE ); else SetView( m_pView, FALSE, FALSE ); UpdatePanel( TRUE ); m_bUpdating = FALSE; return TRUE; }
void CLibraryFrame::SetView(CLibraryView* pView, BOOL bUpdate, BOOL bUser) { CSingleLock pLock( &Library.m_pSection, TRUE ); CLibraryTreeItem* pFolderSelection = m_wndTree.GetFirstSelected(); if ( pView && pFolderSelection && pFolderSelection->m_pPhysical ) { Settings.Library.LastUsedView = pView->GetRuntimeClass()->m_lpszClassName; Settings.Save(); } if ( bUser && pView != NULL ) { for ( CLibraryTreeItem* pItem = pFolderSelection; pItem; pItem = pItem->m_pSelNext ) { if ( pItem->m_pVirtual != NULL ) pItem->m_pVirtual->m_sBestView = pView->GetRuntimeClass()->m_lpszClassName; } } if ( pView ) { if ( Settings.Library.ShowVirtual && pFolderSelection && pFolderSelection->m_pVirtual && pFolderSelection->m_pVirtual->m_pSchema && pFolderSelection->m_pVirtual->m_pSchema->CheckURI( CSchema::uriGhostFolder ) ) pView->m_bGhostFolder = TRUE; else pView->m_bGhostFolder = FALSE; } if ( m_pView == pView ) { if ( HasView() ) { m_pView->Update(); m_pView->ShowWindow( SW_SHOW ); m_wndViewTop.Update( m_pView ); } return; } if ( pView && pView->m_hWnd ) return; // Switching too fast m_wndViewTip.Hide(); m_wndViewTip.SetOwner( this ); CWnd* pFocus = GetFocus(); BOOL bViewSel = ( pFocus == m_pView || ( pFocus && pFocus->GetParent() == m_pView ) ); CLibraryView* pOld = m_pView; m_pView = pView; if ( m_pView ) m_pView->Create( this ); OnSize( 1982, 0, 0 ); if ( HasView() && ! bUpdate ) m_pView->Update(); if ( pOld && pOld != m_pView ) pOld->ShowWindow( SW_HIDE ); if ( HasView() ) m_pView->ShowWindow( SW_SHOW ); if ( pOld && pOld != m_pView ) pOld->DestroyWindow(); if ( HasView() && bUpdate ) Update( TRUE ); m_wndViewTop.Update( m_pView ); if ( HasView() ) { CString strBar( m_pView->m_pszToolBar ); strBar += Settings.Library.ShowVirtual ? L".Virtual" : L".Physical"; Skin.CreateToolBar( strBar, &m_wndViewBottom ); m_wndViewTip.SetOwner( m_pView ); if ( bViewSel ) m_pView->SetFocus(); } Invalidate(); }
void CLibraryFrame::OnSize(UINT nType, int cx, int cy) { if ( nType != 1982 ) CWnd::OnSize( nType, cx, cy ); HideDynamicBar(); CRect rc; GetClientRect( &rc ); if ( rc.Width() < 32 || rc.Height() < 32 ) return; if ( rc.Width() < m_nTreeSize + Settings.Skin.Splitter ) m_nTreeSize = max( 0, rc.Width() - (int)Settings.Skin.Splitter ); if ( rc.Height() - Settings.Skin.ToolbarHeight * 2 - m_nHeaderSize < m_nPanelSize + Settings.Skin.Splitter ) m_nPanelSize = max( 0, rc.Height() - (int)Settings.Skin.ToolbarHeight * 2 - m_nHeaderSize - (int)Settings.Skin.Splitter ); HDWP hDWP = BeginDeferWindowPos( 7 + ( HasView() ? 1 : 0 ) + ( HasPanel() ? 1 : 0 ) + ( m_nHeaderSize > 0 ) ); DeferWindowPos( hDWP, m_wndTreeTop.GetSafeHwnd(), NULL, rc.left, rc.top, m_nTreeSize, Settings.Skin.ToolbarHeight, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndTreeBottom.GetSafeHwnd(), NULL, rc.left, rc.bottom - Settings.Skin.ToolbarHeight, m_nTreeSize, Settings.Skin.ToolbarHeight, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndTreeTypes.GetSafeHwnd(), NULL, rc.left, rc.bottom - m_nTreeTypesHeight, m_nTreeSize, 256, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndViewTop.GetSafeHwnd(), NULL, rc.left + m_nTreeSize + Settings.Skin.Splitter, rc.top, rc.Width() - m_nTreeSize - Settings.Skin.Splitter, Settings.Skin.ToolbarHeight, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndViewBottom.GetSafeHwnd(), NULL, rc.left + m_nTreeSize + Settings.Skin.Splitter, rc.bottom - Settings.Skin.ToolbarHeight, rc.Width() - m_nTreeSize - Settings.Skin.Splitter, Settings.Skin.ToolbarHeight, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndBottomDynamic.GetSafeHwnd(), NULL, rc.left + m_nTreeSize + Settings.Skin.Splitter, rc.bottom - Settings.Skin.ToolbarHeight * 2, rc.Width() - m_nTreeSize - Settings.Skin.Splitter, Settings.Skin.ToolbarHeight, SWP_NOZORDER ); DeferWindowPos( hDWP, m_wndTree.GetSafeHwnd(), NULL, rc.left, rc.top + Settings.Skin.ToolbarHeight, m_nTreeSize, rc.Height() - Settings.Skin.ToolbarHeight * 2, SWP_NOZORDER ); if ( HasView() ) { int nTop = rc.top + Settings.Skin.ToolbarHeight; if ( m_nHeaderSize > 0 ) { DeferWindowPos( hDWP, m_wndHeader.GetSafeHwnd(), NULL, rc.left + m_nTreeSize + Settings.Skin.Splitter, nTop, rc.Width() - m_nTreeSize - Settings.Skin.Splitter, m_nHeaderSize, SWP_NOZORDER|SWP_SHOWWINDOW ); nTop += m_nHeaderSize; } int nHeight = rc.bottom - Settings.Skin.ToolbarHeight - nTop; if ( HasPanel() ) nHeight -= m_nPanelSize + Settings.Skin.Splitter; DeferWindowPos( hDWP, m_pView->GetSafeHwnd(), NULL, rc.left + m_nTreeSize + Settings.Skin.Splitter, nTop, rc.Width() - m_nTreeSize - Settings.Skin.Splitter, nHeight, SWP_NOZORDER|SWP_SHOWWINDOW ); } if ( HasPanel() ) { DeferWindowPos( hDWP, m_pPanel->GetSafeHwnd(), NULL, rc.left + m_nTreeSize + Settings.Skin.Splitter, rc.bottom - Settings.Skin.ToolbarHeight - m_nPanelSize, rc.Width() - m_nTreeSize - Settings.Skin.Splitter, m_nPanelSize, SWP_NOZORDER|SWP_SHOWWINDOW ); } EndDeferWindowPos( hDWP ); }
NS_IMETHODIMP nsPopupSetFrame::List(FILE* out, int32_t aIndent, uint32_t aFlags) const { IndentBy(out, aIndent); ListTag(out); #ifdef DEBUG_waterson fprintf(out, " [parent=%p]", static_cast<void*>(mParent)); #endif if (HasView()) { fprintf(out, " [view=%p]", static_cast<void*>(GetView())); } if (GetNextSibling()) { fprintf(out, " next=%p", static_cast<void*>(GetNextSibling())); } if (nullptr != GetPrevContinuation()) { fprintf(out, " prev-continuation=%p", static_cast<void*>(GetPrevContinuation())); } if (nullptr != GetNextContinuation()) { fprintf(out, " next-continuation=%p", static_cast<void*>(GetNextContinuation())); } fprintf(out, " {%d,%d,%d,%d}", mRect.x, mRect.y, mRect.width, mRect.height); if (0 != mState) { fprintf(out, " [state=%016llx]", (unsigned long long)mState); } fprintf(out, " [content=%p]", static_cast<void*>(mContent)); nsPopupSetFrame* f = const_cast<nsPopupSetFrame*>(this); if (f->HasOverflowAreas()) { nsRect overflowArea = f->GetVisualOverflowRect(); fprintf(out, " [vis-overflow=%d,%d,%d,%d]", overflowArea.x, overflowArea.y, overflowArea.width, overflowArea.height); overflowArea = f->GetScrollableOverflowRect(); fprintf(out, " [scr-overflow=%d,%d,%d,%d]", overflowArea.x, overflowArea.y, overflowArea.width, overflowArea.height); } fprintf(out, " [sc=%p]", static_cast<void*>(mStyleContext)); nsIAtom* pseudoTag = mStyleContext->GetPseudo(); if (pseudoTag) { nsAutoString atomString; pseudoTag->ToString(atomString); fprintf(out, " pst=%s", NS_LossyConvertUTF16toASCII(atomString).get()); } // Output the children bool outputOneList = false; ChildListIterator lists(this); for (; !lists.IsDone(); lists.Next()) { if (outputOneList) { IndentBy(out, aIndent); } outputOneList = true; fprintf(out, "%s<\n", mozilla::layout::ChildListName(lists.CurrentID())); nsFrameList::Enumerator childFrames(lists.CurrentList()); for (; !childFrames.AtEnd(); childFrames.Next()) { nsIFrame* kid = childFrames.get(); // Verify the child frame's parent frame pointer is correct NS_ASSERTION(kid->GetParent() == this, "bad parent frame pointer"); // Have the child frame list kid->List(out, aIndent + 1, aFlags); } IndentBy(out, aIndent); fputs(">\n", out); } // XXXmats the above is copy-pasted from nsContainerFrame::List which is lame, // clean this up after bug 399111 is implemented. if (!mPopupList.IsEmpty()) { fputs("<\n", out); ++aIndent; IndentBy(out, aIndent); fputs(mozilla::layout::ChildListName(kPopupList), out); fputs(" for ", out); ListTag(out); fputs(" <\n", out); ++aIndent; for (nsFrameList::Enumerator e(mPopupList); !e.AtEnd(); e.Next()) { e.get()->List(out, aIndent, aFlags); } --aIndent; IndentBy(out, aIndent); fputs(">\n", out); --aIndent; IndentBy(out, aIndent); fputs(">\n", out); outputOneList = true; } if (!outputOneList) { fputs("<>\n", out); } return NS_OK; }
NS_IMETHODIMP nsPopupSetFrame::List(FILE* out, PRInt32 aIndent) const { IndentBy(out, aIndent); ListTag(out); #ifdef DEBUG_waterson fprintf(out, " [parent=%p]", static_cast<void*>(mParent)); #endif if (HasView()) { fprintf(out, " [view=%p]", static_cast<void*>(GetView())); } if (nsnull != mNextSibling) { fprintf(out, " next=%p", static_cast<void*>(mNextSibling)); } if (nsnull != GetPrevContinuation()) { fprintf(out, " prev-continuation=%p", static_cast<void*>(GetPrevContinuation())); } if (nsnull != GetNextContinuation()) { fprintf(out, " next-continuation=%p", static_cast<void*>(GetNextContinuation())); } fprintf(out, " {%d,%d,%d,%d}", mRect.x, mRect.y, mRect.width, mRect.height); if (0 != mState) { fprintf(out, " [state=%08x]", mState); } fprintf(out, " [content=%p]", static_cast<void*>(mContent)); nsPopupSetFrame* f = const_cast<nsPopupSetFrame*>(this); if (f->HasOverflowRect()) { nsRect overflowArea = f->GetOverflowRect(); fprintf(out, " [overflow=%d,%d,%d,%d]", overflowArea.x, overflowArea.y, overflowArea.width, overflowArea.height); } fprintf(out, " [sc=%p]", static_cast<void*>(mStyleContext)); nsIAtom* pseudoTag = mStyleContext->GetPseudoType(); if (pseudoTag) { nsAutoString atomString; pseudoTag->ToString(atomString); fprintf(out, " pst=%s", NS_LossyConvertUTF16toASCII(atomString).get()); } // Output the children nsIAtom* listName = nsnull; PRInt32 listIndex = 0; PRBool outputOneList = PR_FALSE; do { nsIFrame* kid = GetFirstChild(listName); if (nsnull != kid) { if (outputOneList) { IndentBy(out, aIndent); } outputOneList = PR_TRUE; nsAutoString tmp; if (nsnull != listName) { listName->ToString(tmp); fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out); } fputs("<\n", out); while (nsnull != kid) { // Verify the child frame's parent frame pointer is correct NS_ASSERTION(kid->GetParent() == (nsIFrame*)this, "bad parent frame pointer"); // Have the child frame list nsIFrameDebug* frameDebug = do_QueryFrame(kid); if (frameDebug) { frameDebug->List(out, aIndent + 1); } kid = kid->GetNextSibling(); } IndentBy(out, aIndent); fputs(">\n", out); } listName = GetAdditionalChildListName(listIndex++); } while(nsnull != listName); // XXXmats the above is copy-pasted from nsContainerFrame::List which is lame, // clean this up after bug 399111 is implemented. if (mPopupList) { fputs("<\n", out); ++aIndent; IndentBy(out, aIndent); nsAutoString tmp; nsGkAtoms::popupList->ToString(tmp); fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out); fputs(" for ", out); ListTag(out); fputs(" <\n", out); ++aIndent; for (nsPopupFrameList* l = mPopupList; l; l = l->mNextPopup) { nsIFrameDebug* frameDebug = do_QueryFrame(l->mPopupFrame); if (frameDebug) { frameDebug->List(out, aIndent); } } --aIndent; IndentBy(out, aIndent); fputs(">\n", out); --aIndent; IndentBy(out, aIndent); fputs(">\n", out); outputOneList = PR_TRUE; } if (!outputOneList) { fputs("<>\n", out); } return NS_OK; }
void nsTableCellFrame::VerticallyAlignChild(const nsHTMLReflowState& aReflowState, nscoord aMaxAscent) { const nsStyleTextReset* textStyle = GetStyleTextReset(); /* XXX: remove tableFrame when border-collapse inherits */ nsPresContext* presContext = GetPresContext(); GET_PIXELS_TO_TWIPS(presContext, p2t); nsMargin borderPadding = nsTableFrame::GetBorderPadding(aReflowState, p2t, this); nscoord topInset = borderPadding.top; nscoord bottomInset = borderPadding.bottom; // As per bug 10207, we map 'sub', 'super', 'text-top', 'text-bottom', // length and percentage values to 'baseline' // XXX It seems that we don't get to see length and percentage values here // because the Style System has already fixed the error and mapped them // to whatever is inherited from the parent, i.e, 'middle' in most cases. PRUint8 verticalAlignFlags = NS_STYLE_VERTICAL_ALIGN_BASELINE; if (textStyle->mVerticalAlign.GetUnit() == eStyleUnit_Enumerated) { verticalAlignFlags = textStyle->mVerticalAlign.GetIntValue(); if (verticalAlignFlags != NS_STYLE_VERTICAL_ALIGN_TOP && verticalAlignFlags != NS_STYLE_VERTICAL_ALIGN_MIDDLE && verticalAlignFlags != NS_STYLE_VERTICAL_ALIGN_BOTTOM) { verticalAlignFlags = NS_STYLE_VERTICAL_ALIGN_BASELINE; } } nscoord height = mRect.height; nsIFrame* firstKid = mFrames.FirstChild(); NS_ASSERTION(firstKid, "Frame construction error, a table cell always has an inner cell frame"); nsRect kidRect = firstKid->GetRect(); nscoord childHeight = kidRect.height; // Vertically align the child nscoord kidYTop = 0; switch (verticalAlignFlags) { case NS_STYLE_VERTICAL_ALIGN_BASELINE: // Align the baselines of the child frame with the baselines of // other children in the same row which have 'vertical-align: baseline' kidYTop = topInset + aMaxAscent - GetDesiredAscent(); break; case NS_STYLE_VERTICAL_ALIGN_TOP: // Align the top of the child frame with the top of the content area, kidYTop = topInset; break; case NS_STYLE_VERTICAL_ALIGN_BOTTOM: // Align the bottom of the child frame with the bottom of the content area, kidYTop = height - childHeight - bottomInset; break; default: case NS_STYLE_VERTICAL_ALIGN_MIDDLE: // Align the middle of the child frame with the middle of the content area, kidYTop = (height - childHeight - bottomInset + topInset) / 2; kidYTop = nsTableFrame::RoundToPixel(kidYTop, presContext->ScaledPixelsToTwips(), eAlwaysRoundDown); } // if the content is larger than the cell height align from top kidYTop = PR_MAX(0, kidYTop); firstKid->SetPosition(nsPoint(kidRect.x, kidYTop)); nsHTMLReflowMetrics desiredSize(PR_FALSE); desiredSize.width = mRect.width; desiredSize.height = mRect.height; GetSelfOverflow(desiredSize.mOverflowArea); ConsiderChildOverflow(desiredSize.mOverflowArea, firstKid); FinishAndStoreOverflow(&desiredSize); if (kidYTop != kidRect.y) { // Make sure any child views are correctly positioned. We know the inner table // cell won't have a view nsContainerFrame::PositionChildViews(firstKid); } if (HasView()) { nsContainerFrame::SyncFrameViewAfterReflow(presContext, this, GetView(), &desiredSize.mOverflowArea, 0); } }
bool Observable::hasView(const std::string& name) const { return utils::findIf(m_list.begin(), m_list.end(), HasView(name)) != m_list.end(); }