Backed out changeset 4c4df6ed1b41 - Bug 396185 - Make nsIFrame not inherit from nsISupports due to mochitest failures... these appear to be crashes in nsGenericHTMLElement::GetEditorInternal.

This commit is contained in:
Benjamin Smedberg 2009-01-09 11:35:24 -05:00
Родитель fb44041259
Коммит 3a130c31ef
201 изменённых файлов: 2096 добавлений и 1153 удалений

Просмотреть файл

@ -52,29 +52,29 @@ interface nsIAccessibilityService : nsIAccessibleRetrieval
nsIAccessible createOuterDocAccessible(in nsIDOMNode aNode);
nsIAccessible createRootAccessible(in nsIPresShell aShell, in nsIDocument aDocument);
nsIAccessible createHTML4ButtonAccessible(in nsIFrame aFrame);
nsIAccessible createHyperTextAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLBRAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLButtonAccessible(in nsIFrame aFrame);
nsIAccessible createHTML4ButtonAccessible(in nsISupports aFrame);
nsIAccessible createHyperTextAccessible(in nsISupports aFrame);
nsIAccessible createHTMLBRAccessible(in nsISupports aFrame);
nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame);
nsIAccessible createHTMLAccessibleByMarkup(in nsIFrame aFrame, in nsIWeakReference aWeakShell, in nsIDOMNode aDOMNode);
nsIAccessible createHTMLLIAccessible(in nsIFrame aFrame, in nsIFrame aBulletFrame, in AString aBulletText);
nsIAccessible createHTMLCheckboxAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLLIAccessible(in nsISupports aFrame, in nsISupports aBulletFrame, in AString aBulletText);
nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame);
nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsIWeakReference aPresShell);
nsIAccessible createHTMLGenericAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLGroupboxAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLHRAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLImageAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLLabelAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLGenericAccessible(in nsISupports aFrame);
nsIAccessible createHTMLGroupboxAccessible(in nsISupports aFrame);
nsIAccessible createHTMLHRAccessible(in nsISupports aFrame);
nsIAccessible createHTMLImageAccessible(in nsISupports aFrame);
nsIAccessible createHTMLLabelAccessible(in nsISupports aFrame);
nsIAccessible createHTMLListboxAccessible(in nsIDOMNode aNode, in nsIWeakReference aPresShell);
nsIAccessible createHTMLObjectFrameAccessible(in nsObjectFrame aFrame);
nsIAccessible createHTMLRadioButtonAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLRadioButtonAccessible(in nsISupports aFrame);
nsIAccessible createHTMLSelectOptionAccessible(in nsIDOMNode aNode, in nsIAccessible aAccParent, in nsIWeakReference aPresShell);
nsIAccessible createHTMLTableAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLTableCellAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLTableAccessible(in nsISupports aFrame);
nsIAccessible createHTMLTableCellAccessible(in nsISupports aFrame);
nsIAccessible createHTMLTableHeadAccessible(in nsIDOMNode aDOMNode);
nsIAccessible createHTMLTextAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLTextFieldAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLCaptionAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLTextAccessible(in nsISupports aFrame);
nsIAccessible createHTMLTextFieldAccessible(in nsISupports aFrame);
nsIAccessible createHTMLCaptionAccessible(in nsISupports aFrame);
nsIAccessible getAccessible(in nsIDOMNode aNode, in nsIPresShell aPresShell,
in nsIWeakReference aWeakShell,

Просмотреть файл

@ -332,10 +332,11 @@ NS_IMETHODIMP nsAccessibilityService::OnSecurityChange(nsIWebProgress *aWebProgr
nsresult
nsAccessibilityService::GetInfo(nsIFrame* aFrame, nsIWeakReference** aShell, nsIDOMNode** aNode)
nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aNode)
{
NS_ASSERTION(aFrame,"Error -- 1st argument (aFrame) is null!!");
nsCOMPtr<nsIContent> content = aFrame->GetContent();
*aRealFrame = static_cast<nsIFrame*>(aFrame);
nsCOMPtr<nsIContent> content = (*aRealFrame)->GetContent();
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
if (!content || !node)
return NS_ERROR_FAILURE;
@ -473,11 +474,12 @@ nsAccessibilityService::CreateRootAccessible(nsIPresShell *aShell,
* HTML widget creation
*/
NS_IMETHODIMP
nsAccessibilityService::CreateHTML4ButtonAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
nsAccessibilityService::CreateHTML4ButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@ -490,11 +492,12 @@ nsAccessibilityService::CreateHTML4ButtonAccessible(nsIFrame *aFrame, nsIAccessi
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLButtonAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@ -562,14 +565,15 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame *aFrame,
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLLIAccessible(nsIFrame *aFrame,
nsIFrame *aBulletFrame,
nsAccessibilityService::CreateHTMLLIAccessible(nsISupports *aFrame,
nsISupports *aBulletFrame,
const nsAString& aBulletText,
nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@ -582,11 +586,12 @@ nsAccessibilityService::CreateHTMLLIAccessible(nsIFrame *aFrame,
}
NS_IMETHODIMP
nsAccessibilityService::CreateHyperTextAccessible(nsIFrame *aFrame, nsIAccessible **aAccessible)
nsAccessibilityService::CreateHyperTextAccessible(nsISupports *aFrame, nsIAccessible **aAccessible)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@ -601,11 +606,12 @@ nsAccessibilityService::CreateHyperTextAccessible(nsIFrame *aFrame, nsIAccessibl
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLCheckboxAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLCheckboxAccessible(nsISupports *aFrame, nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@ -629,11 +635,12 @@ nsAccessibilityService::CreateHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWe
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLImageAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLImageAccessible(nsISupports *aFrame, nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@ -651,17 +658,18 @@ nsAccessibilityService::CreateHTMLImageAccessible(nsIFrame *aFrame, nsIAccessibl
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLGenericAccessible(nsIFrame *aFrame, nsIAccessible **aAccessible)
nsAccessibilityService::CreateHTMLGenericAccessible(nsISupports *aFrame, nsIAccessible **aAccessible)
{
return CreateHyperTextAccessible(aFrame, aAccessible);
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLGroupboxAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLGroupboxAccessible(nsISupports *aFrame, nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@ -699,10 +707,11 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame *aFrame,
{
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsIFrame *frame;
GetInfo(static_cast<nsIFrame*>(aFrame), &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
*aAccessible = nsnull;
if (aFrame->GetRect().IsEmpty()) {
if (!frame || frame->GetRect().IsEmpty()) {
return NS_ERROR_FAILURE;
}
// 1) for object elements containing either HTML or TXT documents
@ -734,7 +743,7 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame *aFrame,
// 3) for images and imagemaps, or anything else with a child frame
// we have the object frame, get the image frame
nsIFrame *frame = aFrame->GetFirstChild(nsnull);
frame = aFrame->GetFirstChild(nsnull);
if (frame)
return frame->GetAccessible(aAccessible);
@ -742,11 +751,12 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame *aFrame,
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@ -773,11 +783,12 @@ nsAccessibilityService::CreateHTMLSelectOptionAccessible(nsIDOMNode* aDOMNode,
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLTableAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLTableAccessible(nsISupports *aFrame, nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@ -817,11 +828,12 @@ nsAccessibilityService::CreateHTMLTableHeadAccessible(nsIDOMNode *aDOMNode, nsIA
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLTableCellAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLTableCellAccessible(nsISupports *aFrame, nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@ -834,13 +846,14 @@ nsAccessibilityService::CreateHTMLTableCellAccessible(nsIFrame *aFrame, nsIAcces
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLTextAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLTextAccessible(nsISupports *aFrame, nsIAccessible **_retval)
{
*_retval = nsnull;
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@ -854,11 +867,12 @@ nsAccessibilityService::CreateHTMLTextAccessible(nsIFrame *aFrame, nsIAccessible
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLTextFieldAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLTextFieldAccessible(nsISupports *aFrame, nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@ -871,11 +885,12 @@ nsAccessibilityService::CreateHTMLTextFieldAccessible(nsIFrame *aFrame, nsIAcces
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLLabelAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLLabelAccessible(nsISupports *aFrame, nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@ -888,11 +903,12 @@ nsAccessibilityService::CreateHTMLLabelAccessible(nsIFrame *aFrame, nsIAccessibl
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLHRAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLHRAccessible(nsISupports *aFrame, nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@ -905,11 +921,12 @@ nsAccessibilityService::CreateHTMLHRAccessible(nsIFrame *aFrame, nsIAccessible *
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLBRAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLBRAccessible(nsISupports *aFrame, nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@ -922,11 +939,12 @@ nsAccessibilityService::CreateHTMLBRAccessible(nsIFrame *aFrame, nsIAccessible *
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLCaptionAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLCaptionAccessible(nsISupports *aFrame, nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, getter_AddRefs(weakShell), getter_AddRefs(node));
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
@ -1392,7 +1410,8 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
// image frame is the image content.
// Check if frame is an image frame, and content is <area>
nsIImageFrame *imageFrame = do_QueryFrame(frame);
nsIImageFrame *imageFrame;
CallQueryInterface(frame, &imageFrame);
nsCOMPtr<nsIDOMHTMLAreaElement> areaElmt = do_QueryInterface(content);
if (imageFrame && areaElmt) {
nsCOMPtr<nsIAccessible> imageAcc;

Просмотреть файл

@ -89,11 +89,12 @@ private:
* Return presentation shell, DOM node for the given frame.
*
* @param aFrame - the given frame
* @param aRealFrame [out] - the given frame casted to nsIFrame
* @param aShell [out] - presentation shell for DOM node associated with the
* given frame
* @param aContent [out] - DOM node associated with the given frame
*/
nsresult GetInfo(nsIFrame *aFrame,
nsresult GetInfo(nsISupports *aFrame, nsIFrame **aRealFrame,
nsIWeakReference **aShell,
nsIDOMNode **aContent);

Просмотреть файл

@ -2774,7 +2774,8 @@ NS_IMETHODIMP nsAccessible::GetAccessibleRelated(PRUint32 aRelationType, nsIAcce
if (frame) {
nsIView *view = frame->GetViewExternal();
if (view) {
nsIScrollableFrame *scrollFrame = do_QueryFrame(frame);
nsIScrollableFrame *scrollFrame = nsnull;
CallQueryInterface(frame, &scrollFrame);
if (scrollFrame || view->GetWidget()) {
return GetParent(aRelated);
}

Просмотреть файл

@ -331,7 +331,8 @@ nsCoreUtils::ScrollFrameToPoint(nsIFrame *aScrollableFrame,
nsIFrame *aFrame,
const nsIntPoint& aPoint)
{
nsIScrollableFrame *scrollableFrame = do_QueryFrame(aScrollableFrame);
nsIScrollableFrame *scrollableFrame = nsnull;
CallQueryInterface(aScrollableFrame, &scrollableFrame);
if (!scrollableFrame)
return;

Просмотреть файл

@ -841,7 +841,8 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
nsIFrame* menuFrame = menuAccessNode->GetFrame();
NS_ENSURE_TRUE(menuFrame, NS_ERROR_FAILURE);
nsIMenuFrame* imenuFrame = do_QueryFrame(menuFrame);
nsIMenuFrame* imenuFrame;
CallQueryInterface(menuFrame, &imenuFrame);
if (imenuFrame)
fireFocus = PR_TRUE;
// QI failed for nsIMenuFrame means it's not on menu bar

Просмотреть файл

@ -120,8 +120,6 @@ NS_IMETHODIMP
nsHTMLAreaAccessible::GetBounds(PRInt32 *x, PRInt32 *y,
PRInt32 *width, PRInt32 *height)
{
nsresult rv;
// Essentially this uses GetRect on mAreas of nsImageMap from nsImageFrame
*x = *y = *width = *height = 0;
@ -134,7 +132,9 @@ nsHTMLAreaAccessible::GetBounds(PRInt32 *x, PRInt32 *y,
nsIFrame *frame = GetFrame();
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
nsIImageFrame *imageFrame = do_QueryFrame(frame);
nsIImageFrame *imageFrame;
nsresult rv = frame->QueryInterface(NS_GET_IID(nsIImageFrame), (void**)&imageFrame);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIImageMap> map;
imageFrame->GetImageMap(presContext, getter_AddRefs(map));

Просмотреть файл

@ -292,7 +292,8 @@ nsHTMLButtonAccessible::GetNameInternal(nsAString& aName)
// Use the button's (default) label if nothing else works
nsIFrame* frame = GetFrame();
if (frame) {
nsIFormControlFrame* fcFrame = do_QueryFrame(frame);
nsIFormControlFrame* fcFrame = nsnull;
CallQueryInterface(frame, &fcFrame);
if (fcFrame)
fcFrame->GetFormProperty(nsAccessibilityAtoms::defaultLabel, name);
}

Просмотреть файл

@ -743,12 +743,14 @@ NS_IMETHODIMP nsHTMLSelectOptionAccessible::DoAction(PRUint8 index)
return NS_ERROR_FAILURE;
nsIFrame *selectFrame = presShell->GetPrimaryFrameFor(selectContent);
nsIComboboxControlFrame *comboBoxFrame = do_QueryFrame(selectFrame);
nsIComboboxControlFrame *comboBoxFrame = nsnull;
CallQueryInterface(selectFrame, &comboBoxFrame);
if (comboBoxFrame) {
nsIFrame *listFrame = comboBoxFrame->GetDropDown();
if (comboBoxFrame->IsDroppedDown() && listFrame) {
// use this list control frame to roll up the list
nsIListControlFrame *listControlFrame = do_QueryFrame(listFrame);
nsIListControlFrame *listControlFrame = nsnull;
listFrame->QueryInterface(NS_GET_IID(nsIListControlFrame), (void**)&listControlFrame);
if (listControlFrame) {
PRInt32 newIndex = 0;
option->GetIndex(&newIndex);
@ -795,7 +797,8 @@ nsresult nsHTMLSelectOptionAccessible::GetFocusedOptionNode(nsIDOMNode *aListNod
nsresult rv = selectElement->GetOptions(getter_AddRefs(options));
if (NS_SUCCEEDED(rv)) {
nsIListControlFrame *listFrame = do_QueryFrame(frame);
nsIListControlFrame *listFrame = nsnull;
frame->QueryInterface(NS_GET_IID(nsIListControlFrame), (void**)&listFrame);
if (listFrame) {
// Get what's focused in listbox by asking frame for "selected item".
// Can't use dom interface for this, because it will always return the first selected item
@ -1013,7 +1016,8 @@ void nsHTMLComboboxAccessible::CacheChildren()
if (!frame) {
return;
}
nsIComboboxControlFrame *comboFrame = do_QueryFrame(frame);
nsIComboboxControlFrame *comboFrame = nsnull;
frame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
if (!comboFrame) {
return;
}
@ -1072,7 +1076,11 @@ nsHTMLComboboxAccessible::GetStateInternal(PRUint32 *aState,
NS_ENSURE_A11Y_SUCCESS(rv, rv);
nsIFrame *frame = GetBoundsFrame();
nsIComboboxControlFrame *comboFrame = do_QueryFrame(frame);
nsIComboboxControlFrame *comboFrame = nsnull;
if (frame) {
frame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
}
if (comboFrame && comboFrame->IsDroppedDown()) {
*aState |= nsIAccessibleStates::STATE_EXPANDED;
}
@ -1152,7 +1160,8 @@ NS_IMETHODIMP nsHTMLComboboxAccessible::DoAction(PRUint8 aIndex)
if (!frame) {
return NS_ERROR_FAILURE;
}
nsIComboboxControlFrame *comboFrame = do_QueryFrame(frame);
nsIComboboxControlFrame *comboFrame = nsnull;
frame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
if (!comboFrame) {
return NS_ERROR_FAILURE;
}
@ -1177,7 +1186,8 @@ NS_IMETHODIMP nsHTMLComboboxAccessible::GetActionName(PRUint8 aIndex, nsAString&
if (!frame) {
return NS_ERROR_FAILURE;
}
nsIComboboxControlFrame *comboFrame = do_QueryFrame(frame);
nsIComboboxControlFrame *comboFrame = nsnull;
frame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
if (!comboFrame) {
return NS_ERROR_FAILURE;
}
@ -1418,7 +1428,8 @@ nsHTMLComboboxListAccessible::GetFrame()
nsIFrame* frame = nsHTMLSelectListAccessible::GetFrame();
if (frame) {
nsIComboboxControlFrame* comboBox = do_QueryFrame(frame);
nsIComboboxControlFrame* comboBox;
CallQueryInterface(frame, &comboBox);
if (comboBox) {
return comboBox->GetDropDown();
}
@ -1443,7 +1454,10 @@ nsHTMLComboboxListAccessible::GetStateInternal(PRUint32 *aState,
NS_ENSURE_A11Y_SUCCESS(rv, rv);
nsIFrame *boundsFrame = GetBoundsFrame();
nsIComboboxControlFrame* comboFrame = do_QueryFrame(boundsFrame);
nsIComboboxControlFrame* comboFrame = nsnull;
if (boundsFrame)
boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
if (comboFrame && comboFrame->IsDroppedDown())
*aState |= nsIAccessibleStates::STATE_FLOATING;
else

Просмотреть файл

@ -95,7 +95,8 @@ nsHTMLTableCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttri
NS_ASSERTION(frame, "The frame cannot be obtaied for HTML table cell.");
NS_ENSURE_STATE(frame);
nsITableCellLayout *cellLayout = do_QueryFrame(frame);
nsITableCellLayout *cellLayout = nsnull;
CallQueryInterface(frame, &cellLayout);
NS_ENSURE_STATE(cellLayout);
PRInt32 rowIdx = -1, cellIdx = -1;
@ -927,11 +928,7 @@ nsHTMLTableAccessible::GetTableLayout(nsITableLayout **aTableLayout)
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE);
nsIFrame *frame = shell->GetPrimaryFrameFor(tableContent);
if (!frame)
return NS_ERROR_FAILURE;
*aTableLayout = do_QueryFrame(frame);
return (*aTableLayout) ? NS_OK : NS_NOINTERFACE;
return frame ? CallQueryInterface(frame, aTableLayout) : NS_ERROR_FAILURE;
}
nsresult

Просмотреть файл

@ -2044,7 +2044,8 @@ nsHyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex,
PRBool initialScrolled = PR_FALSE;
nsIFrame *parentFrame = frame;
while ((parentFrame = parentFrame->GetParent())) {
nsIScrollableFrame *scrollableFrame = do_QueryFrame(parentFrame);
nsIScrollableFrame *scrollableFrame = nsnull;
CallQueryInterface(parentFrame, &scrollableFrame);
if (scrollableFrame) {
if (!initialScrolled) {
// Scroll substring to the given point. Turn the point into percents

Просмотреть файл

@ -216,7 +216,8 @@ __try {
else {
// If a frame is a scrollable frame, then it has one window for the client area,
// not an extra parent window for just the scrollbars
nsIScrollableFrame *scrollFrame = do_QueryFrame(frame);
nsIScrollableFrame *scrollFrame = nsnull;
CallQueryInterface(frame, &scrollFrame);
if (scrollFrame) {
hwnd = (HWND)scrollFrame->GetScrolledFrame()->GetWindow()->GetNativeData(NS_NATIVE_WINDOW);
NS_ASSERTION(hwnd, "No window handle for window");

Просмотреть файл

@ -638,7 +638,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
return NS_ERROR_NOT_IMPLEMENTED;
}
nsIFrameFrame* ourFrameFrame = do_QueryFrame(ourFrame);
nsIFrameFrame* ourFrameFrame = nsnull;
CallQueryInterface(ourFrame, &ourFrameFrame);
if (!ourFrameFrame) {
mInSwap = aOther->mInSwap = PR_FALSE;
FirePageShowEvent(ourTreeItem, ourChromeEventHandler, PR_TRUE);

Просмотреть файл

@ -1117,9 +1117,12 @@ nsNSElementTearoff::GetScrollInfo(nsIScrollableView **aScrollableView,
}
// Get the scrollable frame
nsIScrollableFrame *scrollFrame = do_QueryFrame(frame);
nsIScrollableFrame *scrollFrame = nsnull;
CallQueryInterface(frame, &scrollFrame);
if (!scrollFrame) {
nsIScrollableViewProvider *scrollProvider = do_QueryFrame(frame);
nsIScrollableViewProvider *scrollProvider = nsnull;
CallQueryInterface(frame, &scrollProvider);
// menu frames implement nsIScrollableViewProvider but we don't want
// to use it here.
if (scrollProvider && frame->GetType() != nsGkAtoms::menuFrame) {
@ -1148,7 +1151,7 @@ nsNSElementTearoff::GetScrollInfo(nsIScrollableView **aScrollableView,
break;
}
scrollFrame = do_QueryFrame(frame);
CallQueryInterface(frame, &scrollFrame);
} while (!scrollFrame);
}

Просмотреть файл

@ -561,7 +561,8 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
}
{
nsIFrame *nsiframe = do_QueryFrame(frame);
nsIFrame *nsiframe;
CallQueryInterface(frame, &nsiframe);
nsWeakFrame weakFrame(nsiframe);
@ -750,7 +751,8 @@ nsObjectLoadingContent::EnsureInstantiation(nsIPluginInstance** aInstance)
}
}
nsIFrame *nsiframe = do_QueryFrame(frame);
nsIFrame *nsiframe;
CallQueryInterface(frame, &nsiframe);
nsWeakFrame weakFrame(nsiframe);
// We may have a plugin instance already; if so, do nothing
@ -803,7 +805,8 @@ nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame)
}
}
nsIFrame* frame = do_QueryFrame(aFrame);
nsIFrame* frame = nsnull;
CallQueryInterface(aFrame, &frame);
nsCOMPtr<nsIRunnable> event =
new nsAsyncInstantiateEvent(this, frame, mContentType, mURI);
if (!event) {
@ -1649,7 +1652,8 @@ nsObjectLoadingContent::GetExistingFrame(FlushType aFlushType)
aFlushType = eDontFlush;
} while (1);
nsIObjectFrame* objFrame = do_QueryFrame(frame);
nsIObjectFrame* objFrame;
CallQueryInterface(frame, &objFrame);
return objFrame;
}
@ -1691,7 +1695,8 @@ nsObjectLoadingContent::TryInstantiate(const nsACString& aMIMEType,
// frame does have a plugin instance already, be sure to
// re-instantiate the plugin as its source or whatnot might have
// chanced since it was instantiated.
nsIFrame* iframe = do_QueryFrame(frame);
nsIFrame* iframe;
CallQueryInterface(frame, &iframe);
if (iframe->GetStateBits() & NS_FRAME_FIRST_REFLOW) {
LOG(("OBJLC [%p]: Frame hasn't been reflown yet\n", this));
return NS_OK; // Not a failure to have no frame

Просмотреть файл

@ -2379,7 +2379,8 @@ nsEventStateManager::DoDefaultDragStart(nsPresContext* aPresContext,
if (presShell) {
nsIFrame* frame = presShell->GetPrimaryFrameFor(content);
if (frame) {
nsTreeBodyFrame* treeBody = do_QueryFrame(frame);
nsTreeBodyFrame* treeBody;
CallQueryInterface(frame, &treeBody);
treeBody->GetSelectionRegion(getter_AddRefs(region));
}
}
@ -2534,7 +2535,8 @@ static nsIScrollableView*
GetScrollableViewForFrame(nsPresContext* aPresContext, nsIFrame* aFrame)
{
for (; aFrame; aFrame = GetParentFrameToScroll(aPresContext, aFrame)) {
nsIScrollableViewProvider* svp = do_QueryFrame(aFrame);
nsIScrollableViewProvider* svp;
CallQueryInterface(aFrame, &svp);
if (svp) {
nsIScrollableView* scrollView = svp->GetScrollableView();
if (scrollView)
@ -2610,7 +2612,8 @@ nsEventStateManager::DoScrollText(nsPresContext* aPresContext,
// operation, even if the mouse hasn't moved.
nsIFrame* lastScrollFrame = nsMouseWheelTransaction::GetTargetFrame();
if (lastScrollFrame) {
nsIScrollableViewProvider* svp = do_QueryFrame(lastScrollFrame);
nsIScrollableViewProvider* svp;
CallQueryInterface(lastScrollFrame, &svp);
if (svp) {
scrollView = svp->GetScrollableView();
nsMouseWheelTransaction::UpdateTransaction();
@ -2625,7 +2628,8 @@ nsEventStateManager::DoScrollText(nsPresContext* aPresContext,
scrollFrame = GetParentFrameToScroll(aPresContext, scrollFrame)) {
// Check whether the frame wants to provide us with a scrollable view.
scrollView = nsnull;
nsIScrollableViewProvider* svp = do_QueryFrame(scrollFrame);
nsIScrollableViewProvider* svp;
CallQueryInterface(scrollFrame, &svp);
if (svp) {
scrollView = svp->GetScrollableView();
}
@ -2654,7 +2658,8 @@ nsEventStateManager::DoScrollText(nsPresContext* aPresContext,
}
// Comboboxes need special care.
nsIComboboxControlFrame* comboBox = do_QueryFrame(scrollFrame);
nsIComboboxControlFrame* comboBox = nsnull;
CallQueryInterface(scrollFrame, &comboBox);
if (comboBox) {
if (comboBox->IsDroppedDown()) {
// Don't propagate to parent when drop down menu is active.
@ -3588,7 +3593,8 @@ nsEventStateManager::NotifyMouseOut(nsGUIEvent* aEvent, nsIContent* aMovingInto)
if (mLastMouseOverFrame) {
// if the frame is associated with a subdocument,
// tell the subdocument that we're moving out of it
nsIFrameFrame* subdocFrame = do_QueryFrame(mLastMouseOverFrame.GetFrame());
nsIFrameFrame* subdocFrame;
CallQueryInterface(mLastMouseOverFrame.GetFrame(), &subdocFrame);
if (subdocFrame) {
nsCOMPtr<nsIDocShell> docshell;
subdocFrame->GetDocShell(getter_AddRefs(docshell));
@ -5209,7 +5215,9 @@ nsEventStateManager::SendFocusBlur(nsPresContext* aPresContext,
currentFocusFrame = presShell->GetPrimaryFrameFor(mCurrentFocus);
if (!currentFocusFrame)
currentFocusFrame = mCurrentTarget;
nsIObjectFrame* objFrame = do_QueryFrame(currentFocusFrame);
nsIObjectFrame* objFrame = nsnull;
if (currentFocusFrame)
CallQueryInterface(currentFocusFrame, &objFrame);
if (objFrame) {
nsIView* view = currentFocusFrame->GetViewExternal();
NS_ASSERTION(view, "Object frames must have views");

Просмотреть файл

@ -1326,7 +1326,8 @@ nsGenericHTMLElement::GetFormControlFrameFor(nsIContent* aContent,
}
nsIFrame* frame = GetPrimaryFrameFor(aContent, aDocument);
if (frame) {
nsIFormControlFrame* form_frame = do_QueryFrame(frame);
nsIFormControlFrame* form_frame = nsnull;
CallQueryInterface(frame, &form_frame);
if (form_frame) {
return form_frame;
}
@ -1336,7 +1337,7 @@ nsGenericHTMLElement::GetFormControlFrameFor(nsIContent* aContent,
for (frame = frame->GetFirstChild(nsnull);
frame;
frame = frame->GetNextSibling()) {
form_frame = do_QueryFrame(frame);
CallQueryInterface(frame, &form_frame);
if (form_frame) {
return form_frame;
}
@ -3551,7 +3552,8 @@ nsGenericHTMLElement::GetEditorInternal(nsIEditor** aEditor)
nsIFormControlFrame *fcFrame = GetFormControlFrame(PR_FALSE);
if (fcFrame) {
nsITextControlFrame *textFrame = do_QueryFrame(fcFrame);
nsITextControlFrame *textFrame = nsnull;
CallQueryInterface(fcFrame, &textFrame);
if (textFrame) {
return textFrame->GetEditor(aEditor);
}

Просмотреть файл

@ -306,7 +306,9 @@ nsHTMLButtonElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_FALSE);
if (formControlFrame) {
nsIFrame* formFrame = do_QueryFrame(formControlFrame);
nsIFrame* formFrame = nsnull;
CallQueryInterface(formControlFrame, &formFrame);
if (formFrame) {
const nsStyleUserInterface* uiStyle = formFrame->GetStyleUserInterface();

Просмотреть файл

@ -787,7 +787,9 @@ nsHTMLInputElement::GetValue(nsAString& aValue)
PRBool frameOwnsValue = PR_FALSE;
if (formControlFrame) {
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
nsITextControlFrame* textControlFrame = nsnull;
CallQueryInterface(formControlFrame, &textControlFrame);
if (textControlFrame) {
textControlFrame->OwnsValue(&frameOwnsValue);
} else {
@ -991,7 +993,7 @@ nsHTMLInputElement::SetValueInternal(const nsAString& aValue,
formControlFrame = GetFormControlFrame(PR_FALSE);
if (formControlFrame) {
textControlFrame = do_QueryFrame(formControlFrame);
CallQueryInterface(formControlFrame, &textControlFrame);
}
}
@ -1264,12 +1266,14 @@ nsHTMLInputElement::SetCheckedInternal(PRBool aChecked, PRBool aNotify)
nsPresContext *presContext = GetPresContext();
if (mType == NS_FORM_INPUT_CHECKBOX) {
nsICheckboxControlFrame* checkboxFrame = do_QueryFrame(frame);
nsICheckboxControlFrame* checkboxFrame = nsnull;
CallQueryInterface(frame, &checkboxFrame);
if (checkboxFrame) {
checkboxFrame->OnChecked(presContext, aChecked);
}
} else if (mType == NS_FORM_INPUT_RADIO) {
nsIRadioControlFrame* radioFrame = do_QueryFrame(frame);
nsIRadioControlFrame* radioFrame = nsnull;
CallQueryInterface(frame, &radioFrame);
if (radioFrame) {
radioFrame->OnChecked(presContext, aChecked);
}
@ -1596,7 +1600,8 @@ nsHTMLInputElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
if (aVisitor.mEvent->message == NS_BLUR_CONTENT) {
nsIFrame* primaryFrame = GetPrimaryFrame();
if (primaryFrame) {
nsITextControlFrame* textFrame = do_QueryFrame(primaryFrame);
nsITextControlFrame* textFrame = nsnull;
CallQueryInterface(primaryFrame, &textFrame);
if (textFrame) {
textFrame->CheckFireOnChange();
}
@ -1834,7 +1839,8 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
if (!isButton) {
nsIFrame* primaryFrame = GetPrimaryFrame();
if (primaryFrame) {
nsITextControlFrame* textFrame = do_QueryFrame(primaryFrame);
nsITextControlFrame* textFrame = nsnull;
CallQueryInterface(primaryFrame, &textFrame);
// Fire onChange (if necessary)
if (textFrame) {
@ -2206,7 +2212,9 @@ nsHTMLInputElement::SetSelectionRange(PRInt32 aSelectionStart,
nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE);
if (formControlFrame) {
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
nsITextControlFrame* textControlFrame = nsnull;
CallQueryInterface(formControlFrame, &textControlFrame);
if (textControlFrame)
rv = textControlFrame->SetSelectionRange(aSelectionStart, aSelectionEnd);
}
@ -2230,7 +2238,9 @@ nsHTMLInputElement::SetSelectionStart(PRInt32 aSelectionStart)
nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE);
if (formControlFrame) {
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
nsITextControlFrame* textControlFrame = nsnull;
CallQueryInterface(formControlFrame, &textControlFrame);
if (textControlFrame)
rv = textControlFrame->SetSelectionStart(aSelectionStart);
}
@ -2255,7 +2265,9 @@ nsHTMLInputElement::SetSelectionEnd(PRInt32 aSelectionEnd)
nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE);
if (formControlFrame) {
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
nsITextControlFrame* textControlFrame = nsnull;
CallQueryInterface(formControlFrame, &textControlFrame);
if (textControlFrame)
rv = textControlFrame->SetSelectionEnd(aSelectionEnd);
}
@ -2292,7 +2304,9 @@ nsHTMLInputElement::GetSelectionRange(PRInt32* aSelectionStart,
nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE);
if (formControlFrame) {
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
nsITextControlFrame* textControlFrame = nsnull;
CallQueryInterface(formControlFrame, &textControlFrame);
if (textControlFrame)
rv = textControlFrame->GetSelectionRange(aSelectionStart, aSelectionEnd);
}
@ -2307,7 +2321,9 @@ nsHTMLInputElement::GetPhonetic(nsAString& aPhonetic)
nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE);
if (formControlFrame) {
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
nsITextControlFrame* textControlFrame = nsnull;
CallQueryInterface(formControlFrame, &textControlFrame);
if (textControlFrame)
textControlFrame->GetPhonetic(aPhonetic);
}

Просмотреть файл

@ -323,7 +323,11 @@ nsHTMLObjectElement::SubmitNamesValues(nsIFormSubmission *aFormSubmission,
nsIFrame* frame = GetPrimaryFrame();
nsIObjectFrame *objFrame = do_QueryFrame(frame);
nsIObjectFrame *objFrame = nsnull;
if (frame) {
CallQueryInterface(frame, &objFrame);
}
if (!objFrame) {
// No frame, nothing to submit.

Просмотреть файл

@ -601,7 +601,7 @@ nsHTMLSelectElement::GetSelectFrame()
nsISelectControlFrame *select_frame = nsnull;
if (form_control_frame) {
select_frame = do_QueryFrame(form_control_frame);
CallQueryInterface(form_control_frame, &select_frame);
}
return select_frame;
@ -1440,7 +1440,9 @@ nsHTMLSelectElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
nsIFrame* formFrame = nsnull;
if (formControlFrame &&
(formFrame = do_QueryFrame(formControlFrame))) {
NS_SUCCEEDED(CallQueryInterface(formControlFrame, &formFrame)) &&
formFrame)
{
const nsStyleUserInterface* uiStyle = formFrame->GetStyleUserInterface();
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE ||
@ -1700,12 +1702,14 @@ void nsHTMLSelectElement::DispatchContentReset() {
// Only dispatch content reset notification if this is a list control
// frame or combo box control frame.
if (IsCombobox()) {
nsIComboboxControlFrame* comboFrame = do_QueryFrame(formControlFrame);
nsIComboboxControlFrame* comboFrame = nsnull;
CallQueryInterface(formControlFrame, &comboFrame);
if (comboFrame) {
comboFrame->OnContentReset();
}
} else {
nsIListControlFrame* listFrame = do_QueryFrame(formControlFrame);
nsIListControlFrame* listFrame = nsnull;
CallQueryInterface(formControlFrame, &listFrame);
if (listFrame) {
listFrame->OnContentReset();
}

Просмотреть файл

@ -410,7 +410,7 @@ nsHTMLTextAreaElement::GetValueInternal(nsAString& aValue, PRBool aIgnoreWrap)
nsIFrame* primaryFrame = GetPrimaryFrame();
nsITextControlFrame* textControlFrame = nsnull;
if (primaryFrame) {
textControlFrame = do_QueryFrame(primaryFrame);
CallQueryInterface(primaryFrame, &textControlFrame);
}
// If the frame exists and owns the value, get it from the frame. Otherwise
@ -453,7 +453,7 @@ nsHTMLTextAreaElement::SetValueInternal(const nsAString& aValue,
formControlFrame = GetFormControlFrame(PR_FALSE);
if (formControlFrame) {
textControlFrame = do_QueryFrame(formControlFrame);
CallQueryInterface(formControlFrame, &textControlFrame);
}
}
@ -593,7 +593,8 @@ nsHTMLTextAreaElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
nsIFrame* formFrame = nsnull;
if (formControlFrame &&
(formFrame = do_QueryFrame(formControlFrame))) {
NS_SUCCEEDED(CallQueryInterface(formControlFrame, &formFrame)) &&
formFrame) {
const nsStyleUserInterface* uiStyle = formFrame->GetStyleUserInterface();
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE ||
@ -627,7 +628,8 @@ nsHTMLTextAreaElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
if (aVisitor.mEvent->message == NS_BLUR_CONTENT) {
nsIFrame* primaryFrame = GetPrimaryFrame();
if (primaryFrame) {
nsITextControlFrame* textFrame = do_QueryFrame(primaryFrame);
nsITextControlFrame* textFrame = nsnull;
CallQueryInterface(primaryFrame, &textFrame);
if (textFrame) {
textFrame->CheckFireOnChange();
}
@ -728,7 +730,9 @@ nsHTMLTextAreaElement::SetSelectionStart(PRInt32 aSelectionStart)
nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE);
if (formControlFrame){
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
nsITextControlFrame* textControlFrame = nsnull;
CallQueryInterface(formControlFrame, &textControlFrame);
if (textControlFrame)
rv = textControlFrame->SetSelectionStart(aSelectionStart);
}
@ -752,7 +756,9 @@ nsHTMLTextAreaElement::SetSelectionEnd(PRInt32 aSelectionEnd)
nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE);
if (formControlFrame) {
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
nsITextControlFrame* textControlFrame = nsnull;
CallQueryInterface(formControlFrame, &textControlFrame);
if (textControlFrame)
rv = textControlFrame->SetSelectionEnd(aSelectionEnd);
}
@ -768,7 +774,9 @@ nsHTMLTextAreaElement::GetSelectionRange(PRInt32* aSelectionStart,
nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE);
if (formControlFrame) {
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
nsITextControlFrame* textControlFrame = nsnull;
CallQueryInterface(formControlFrame, &textControlFrame);
if (textControlFrame)
rv = textControlFrame->GetSelectionRange(aSelectionStart, aSelectionEnd);
}
@ -783,7 +791,9 @@ nsHTMLTextAreaElement::SetSelectionRange(PRInt32 aSelectionStart, PRInt32 aSelec
nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_TRUE);
if (formControlFrame) {
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
nsITextControlFrame* textControlFrame = nsnull;
CallQueryInterface(formControlFrame, &textControlFrame);
if (textControlFrame)
rv = textControlFrame->SetSelectionRange(aSelectionStart, aSelectionEnd);
}

Просмотреть файл

@ -129,7 +129,8 @@ nsPluginStreamListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
return rv;
}
nsIObjectFrame* objFrame = do_QueryFrame(frame);
nsIObjectFrame* objFrame;
CallQueryInterface(frame, &objFrame);
if (!objFrame) {
mPluginDoc->AllowNormalInstantiation();
return NS_ERROR_UNEXPECTED;
@ -327,7 +328,9 @@ nsPluginDocument::Print()
nsIFrame* frame = shell->GetPrimaryFrameFor(mPluginContent);
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
nsIObjectFrame* objectFrame = do_QueryFrame(frame);
nsIObjectFrame* objectFrame = nsnull;
CallQueryInterface(frame, &objectFrame);
if (objectFrame) {
nsCOMPtr<nsIPluginInstance> pi;
objectFrame->GetPluginInstance(*getter_AddRefs(pi));

Просмотреть файл

@ -39,18 +39,21 @@
#ifndef __NS_ISVGTEXTCONTENTMETRICS_H__
#define __NS_ISVGTEXTCONTENTMETRICS_H__
#include "nsQueryFrame.h"
#include "nsISupports.h"
class nsIDOMSVGRect;
class nsIDOMSVGPoint;
////////////////////////////////////////////////////////////////////////
// nsISVGTextContentMetrics
class nsISVGTextContentMetrics
// {CBF0A774-4171-4112-BD9A-F49BEFC0CE18}
#define NS_ISVGTEXTCONTENTMETRICS_IID \
{ 0xcbf0a774, 0x4171, 0x4112, { 0xbd, 0x9a, 0xf4, 0x9b, 0xef, 0xc0, 0xce, 0x18 } }
class nsISVGTextContentMetrics : public nsISupports
{
public:
NS_DECLARE_FRAME_ACCESSOR(nsISVGTextContentMetrics)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISVGTEXTCONTENTMETRICS_IID)
NS_IMETHOD GetNumberOfChars(PRInt32 *_retval)=0;
NS_IMETHOD GetComputedTextLength(float *_retval)=0;
@ -62,4 +65,7 @@ public:
NS_IMETHOD GetCharNumAtPosition(nsIDOMSVGPoint *point, PRInt32 *_retval)=0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsISVGTextContentMetrics,
NS_ISVGTEXTCONTENTMETRICS_IID)
#endif // __NS_ISVGTEXTCONTENTMETRICS_H__

Просмотреть файл

@ -41,7 +41,6 @@
#define __NS_ISVGVALUE_H__
#include "nsISupports.h"
#include "nsQueryFrame.h"
#include "nsString.h"
class nsISVGValueObserver;
@ -73,7 +72,6 @@ public:
};
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISVGVALUE_IID)
NS_DECLARE_FRAME_ACCESSOR(nsISVGValue)
NS_IMETHOD SetValueString(const nsAString& aValue)=0;
NS_IMETHOD GetValueString(nsAString& aValue)=0;

Просмотреть файл

@ -94,7 +94,8 @@ NS_IMETHODIMP nsSVGGraphicElement::GetBBox(nsIDOMSVGRect **_retval)
if (!frame || (frame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD))
return NS_ERROR_FAILURE;
nsISVGChildFrame* svgframe = do_QueryFrame(frame);
nsISVGChildFrame* svgframe;
CallQueryInterface(frame, &svgframe);
NS_ASSERTION(svgframe, "wrong frame type");
if (svgframe) {
svgframe->SetMatrixPropagation(PR_FALSE);

Просмотреть файл

@ -276,7 +276,8 @@ nsSVGPatternElement::PushUpdate()
nsIFrame *frame = GetPrimaryFrame();
if (frame) {
nsISVGValue *value = do_QueryFrame(frame);
nsISVGValue *value = nsnull;
CallQueryInterface(frame, &value);
if (value) {
value->BeginBatchUpdate();
value->EndBatchUpdate();

Просмотреть файл

@ -365,7 +365,8 @@ nsSVGSVGElement::SuspendRedraw(PRUint32 max_wait_milliseconds, PRUint32 *_retval
NS_ASSERTION(frame, "suspending redraw w/o frame");
#endif
if (frame) {
nsISVGSVGFrame* svgframe = do_QueryFrame(frame);
nsISVGSVGFrame* svgframe;
CallQueryInterface(frame, &svgframe);
NS_ASSERTION(svgframe, "wrong frame type");
if (svgframe) {
svgframe->SuspendRedraw();
@ -403,7 +404,8 @@ nsSVGSVGElement::UnsuspendRedrawAll()
NS_ASSERTION(frame, "unsuspending redraw w/o frame");
#endif
if (frame) {
nsISVGSVGFrame* svgframe = do_QueryFrame(frame);
nsISVGSVGFrame* svgframe;
CallQueryInterface(frame, &svgframe);
NS_ASSERTION(svgframe, "wrong frame type");
if (svgframe) {
svgframe->UnsuspendRedraw();
@ -656,7 +658,8 @@ nsSVGSVGElement::GetBBox(nsIDOMSVGRect **_retval)
if (!frame || (frame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD))
return NS_ERROR_FAILURE;
nsISVGChildFrame* svgframe = do_QueryFrame(frame);
nsISVGChildFrame* svgframe;
CallQueryInterface(frame, &svgframe);
if (svgframe) {
svgframe->SetMatrixPropagation(PR_FALSE);
svgframe->NotifySVGChanged(nsISVGChildFrame::SUPPRESS_INVALIDATION |
@ -1294,7 +1297,8 @@ nsSVGSVGElement::InvalidateTransformNotifyFrame()
nsIFrame* frame = presShell->GetPrimaryFrameFor(this);
if (frame) {
nsISVGSVGFrame* svgframe = do_QueryFrame(frame);
nsISVGSVGFrame* svgframe;
CallQueryInterface(frame, &svgframe);
if (svgframe) {
svgframe->NotifyViewportChange();
}

Просмотреть файл

@ -97,7 +97,9 @@ nsSVGSwitchElement::MaybeInvalidate()
nsIFrame *frame = GetPrimaryFrame();
if (frame) {
nsISVGChildFrame* svgFrame = do_QueryFrame(frame);
nsISVGChildFrame* svgFrame = nsnull;
CallQueryInterface(frame, &svgFrame);
if (svgFrame) {
nsSVGUtils::UpdateGraphic(svgFrame);
}

Просмотреть файл

@ -82,7 +82,7 @@ protected:
// nsSVGElement overrides
virtual PRBool IsEventName(nsIAtom* aName);
nsISVGTextContentMetrics* GetTextContentMetrics();
already_AddRefed<nsISVGTextContentMetrics> GetTextContentMetrics();
// nsIDOMSVGTextPositioning properties:
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mX;
@ -253,7 +253,7 @@ NS_IMETHODIMP nsSVGTSpanElement::GetLengthAdjust(nsIDOMSVGAnimatedEnumeration *
/* long getNumberOfChars (); */
NS_IMETHODIMP nsSVGTSpanElement::GetNumberOfChars(PRInt32 *_retval)
{
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (metrics)
return metrics->GetNumberOfChars(_retval);
@ -265,7 +265,7 @@ NS_IMETHODIMP nsSVGTSpanElement::GetNumberOfChars(PRInt32 *_retval)
/* float getComputedTextLength (); */
NS_IMETHODIMP nsSVGTSpanElement::GetComputedTextLength(float *_retval)
{
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (metrics)
return metrics->GetComputedTextLength(_retval);
@ -277,7 +277,7 @@ NS_IMETHODIMP nsSVGTSpanElement::GetComputedTextLength(float *_retval)
/* float getSubStringLength (in unsigned long charnum, in unsigned long nchars); */
NS_IMETHODIMP nsSVGTSpanElement::GetSubStringLength(PRUint32 charnum, PRUint32 nchars, float *_retval)
{
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (metrics)
return metrics->GetSubStringLength(charnum, nchars, _retval);
@ -290,7 +290,7 @@ NS_IMETHODIMP nsSVGTSpanElement::GetSubStringLength(PRUint32 charnum, PRUint32 n
NS_IMETHODIMP nsSVGTSpanElement::GetStartPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval)
{
*_retval = nsnull;
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (!metrics) return NS_ERROR_FAILURE;
@ -301,7 +301,7 @@ NS_IMETHODIMP nsSVGTSpanElement::GetStartPositionOfChar(PRUint32 charnum, nsIDOM
NS_IMETHODIMP nsSVGTSpanElement::GetEndPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval)
{
*_retval = nsnull;
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (!metrics) return NS_ERROR_FAILURE;
@ -312,7 +312,7 @@ NS_IMETHODIMP nsSVGTSpanElement::GetEndPositionOfChar(PRUint32 charnum, nsIDOMSV
NS_IMETHODIMP nsSVGTSpanElement::GetExtentOfChar(PRUint32 charnum, nsIDOMSVGRect **_retval)
{
*_retval = nsnull;
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (!metrics) return NS_ERROR_FAILURE;
@ -324,7 +324,7 @@ NS_IMETHODIMP nsSVGTSpanElement::GetRotationOfChar(PRUint32 charnum, float *_ret
{
*_retval = 0.0;
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (!metrics) return NS_ERROR_FAILURE;
@ -339,7 +339,7 @@ NS_IMETHODIMP nsSVGTSpanElement::GetCharNumAtPosition(nsIDOMSVGPoint *point,
if (!point)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (metrics)
return metrics->GetCharNumAtPosition(point, _retval);
@ -385,7 +385,7 @@ nsSVGTSpanElement::IsEventName(nsIAtom* aName)
//----------------------------------------------------------------------
// implementation helpers:
nsISVGTextContentMetrics*
already_AddRefed<nsISVGTextContentMetrics>
nsSVGTSpanElement::GetTextContentMetrics()
{
nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
@ -394,6 +394,7 @@ nsSVGTSpanElement::GetTextContentMetrics()
return nsnull;
}
nsISVGTextContentMetrics* metrics = do_QueryFrame(frame);
nsISVGTextContentMetrics* metrics;
CallQueryInterface(frame, &metrics);
return metrics;
}

Просмотреть файл

@ -80,7 +80,7 @@ public:
protected:
nsISVGTextContentMetrics* GetTextContentMetrics();
already_AddRefed<nsISVGTextContentMetrics> GetTextContentMetrics();
// nsIDOMSVGTextPositioning properties:
nsCOMPtr<nsIDOMSVGAnimatedLengthList> mX;
@ -250,7 +250,7 @@ NS_IMETHODIMP nsSVGTextElement::GetLengthAdjust(nsIDOMSVGAnimatedEnumeration * *
/* long getNumberOfChars (); */
NS_IMETHODIMP nsSVGTextElement::GetNumberOfChars(PRInt32 *_retval)
{
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (metrics)
return metrics->GetNumberOfChars(_retval);
@ -262,7 +262,7 @@ NS_IMETHODIMP nsSVGTextElement::GetNumberOfChars(PRInt32 *_retval)
/* float getComputedTextLength (); */
NS_IMETHODIMP nsSVGTextElement::GetComputedTextLength(float *_retval)
{
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (metrics)
return metrics->GetComputedTextLength(_retval);
@ -274,7 +274,7 @@ NS_IMETHODIMP nsSVGTextElement::GetComputedTextLength(float *_retval)
/* float getSubStringLength (in unsigned long charnum, in unsigned long nchars); */
NS_IMETHODIMP nsSVGTextElement::GetSubStringLength(PRUint32 charnum, PRUint32 nchars, float *_retval)
{
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (metrics)
return metrics->GetSubStringLength(charnum, nchars, _retval);
@ -287,7 +287,7 @@ NS_IMETHODIMP nsSVGTextElement::GetSubStringLength(PRUint32 charnum, PRUint32 nc
NS_IMETHODIMP nsSVGTextElement::GetStartPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval)
{
*_retval = nsnull;
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (!metrics) return NS_ERROR_FAILURE;
@ -298,7 +298,7 @@ NS_IMETHODIMP nsSVGTextElement::GetStartPositionOfChar(PRUint32 charnum, nsIDOMS
NS_IMETHODIMP nsSVGTextElement::GetEndPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval)
{
*_retval = nsnull;
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (!metrics) return NS_ERROR_FAILURE;
@ -309,7 +309,7 @@ NS_IMETHODIMP nsSVGTextElement::GetEndPositionOfChar(PRUint32 charnum, nsIDOMSVG
NS_IMETHODIMP nsSVGTextElement::GetExtentOfChar(PRUint32 charnum, nsIDOMSVGRect **_retval)
{
*_retval = nsnull;
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (!metrics) return NS_ERROR_FAILURE;
@ -321,7 +321,7 @@ NS_IMETHODIMP nsSVGTextElement::GetRotationOfChar(PRUint32 charnum, float *_retv
{
*_retval = 0.0;
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (!metrics) return NS_ERROR_FAILURE;
@ -335,7 +335,7 @@ NS_IMETHODIMP nsSVGTextElement::GetCharNumAtPosition(nsIDOMSVGPoint *point, PRIn
if (!point)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (metrics)
return metrics->GetCharNumAtPosition(point, _retval);
@ -369,7 +369,7 @@ nsSVGTextElement::IsAttributeMapped(const nsIAtom* name) const
//----------------------------------------------------------------------
// implementation helpers:
nsISVGTextContentMetrics*
already_AddRefed<nsISVGTextContentMetrics>
nsSVGTextElement::GetTextContentMetrics()
{
nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
@ -378,6 +378,7 @@ nsSVGTextElement::GetTextContentMetrics()
return nsnull;
}
nsISVGTextContentMetrics* metrics = do_QueryFrame(frame);
nsISVGTextContentMetrics* metrics;
CallQueryInterface(frame, &metrics);
return metrics;
}

Просмотреть файл

@ -155,7 +155,7 @@ NS_IMETHODIMP nsSVGTextPathElement::GetLengthAdjust(nsIDOMSVGAnimatedEnumeration
/* long getNumberOfChars (); */
NS_IMETHODIMP nsSVGTextPathElement::GetNumberOfChars(PRInt32 *_retval)
{
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (metrics)
return metrics->GetNumberOfChars(_retval);
@ -167,7 +167,7 @@ NS_IMETHODIMP nsSVGTextPathElement::GetNumberOfChars(PRInt32 *_retval)
/* float getComputedTextLength (); */
NS_IMETHODIMP nsSVGTextPathElement::GetComputedTextLength(float *_retval)
{
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (metrics)
return metrics->GetComputedTextLength(_retval);
@ -179,7 +179,7 @@ NS_IMETHODIMP nsSVGTextPathElement::GetComputedTextLength(float *_retval)
/* float getSubStringLength (in unsigned long charnum, in unsigned long nchars); */
NS_IMETHODIMP nsSVGTextPathElement::GetSubStringLength(PRUint32 charnum, PRUint32 nchars, float *_retval)
{
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (metrics)
return metrics->GetSubStringLength(charnum, nchars, _retval);
@ -192,7 +192,7 @@ NS_IMETHODIMP nsSVGTextPathElement::GetSubStringLength(PRUint32 charnum, PRUint3
NS_IMETHODIMP nsSVGTextPathElement::GetStartPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval)
{
*_retval = nsnull;
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (!metrics) return NS_ERROR_FAILURE;
@ -203,7 +203,7 @@ NS_IMETHODIMP nsSVGTextPathElement::GetStartPositionOfChar(PRUint32 charnum, nsI
NS_IMETHODIMP nsSVGTextPathElement::GetEndPositionOfChar(PRUint32 charnum, nsIDOMSVGPoint **_retval)
{
*_retval = nsnull;
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (!metrics) return NS_ERROR_FAILURE;
@ -214,7 +214,7 @@ NS_IMETHODIMP nsSVGTextPathElement::GetEndPositionOfChar(PRUint32 charnum, nsIDO
NS_IMETHODIMP nsSVGTextPathElement::GetExtentOfChar(PRUint32 charnum, nsIDOMSVGRect **_retval)
{
*_retval = nsnull;
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (!metrics) return NS_ERROR_FAILURE;
@ -226,7 +226,7 @@ NS_IMETHODIMP nsSVGTextPathElement::GetRotationOfChar(PRUint32 charnum, float *_
{
*_retval = 0.0;
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (!metrics) return NS_ERROR_FAILURE;
@ -241,7 +241,7 @@ NS_IMETHODIMP nsSVGTextPathElement::GetCharNumAtPosition(nsIDOMSVGPoint *point,
if (!point)
return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
nsISVGTextContentMetrics *metrics = GetTextContentMetrics();
nsCOMPtr<nsISVGTextContentMetrics> metrics = GetTextContentMetrics();
if (metrics)
return metrics->GetCharNumAtPosition(point, _retval);
@ -307,7 +307,7 @@ nsSVGTextPathElement::GetStringInfo()
//----------------------------------------------------------------------
// implementation helpers:
nsISVGTextContentMetrics*
already_AddRefed<nsISVGTextContentMetrics>
nsSVGTextPathElement::GetTextContentMetrics()
{
nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
@ -316,6 +316,7 @@ nsSVGTextPathElement::GetTextContentMetrics()
return nsnull;
}
nsISVGTextContentMetrics* metrics = do_QueryFrame(frame);
nsISVGTextContentMetrics* metrics;
CallQueryInterface(frame, &metrics);
return metrics;
}

Просмотреть файл

@ -82,7 +82,7 @@ protected:
virtual PRBool IsEventName(nsIAtom* aName);
nsISVGTextContentMetrics* GetTextContentMetrics();
already_AddRefed<nsISVGTextContentMetrics> GetTextContentMetrics();
enum { STARTOFFSET };
nsSVGLength2 mLengthAttributes[1];

Просмотреть файл

@ -4345,7 +4345,8 @@ nsDocShell::GetScrollbarVisibility(PRBool * verticalVisible,
static_cast<nsIFrame*>(scrollView->View()->GetParent()->GetClientData());
if (!scrollFrame)
return NS_ERROR_FAILURE;
nsIScrollableFrame* scrollable = do_QueryFrame(scrollFrame);
nsIScrollableFrame* scrollable = nsnull;
CallQueryInterface(scrollFrame, &scrollable);
if (!scrollable)
return NS_ERROR_FAILURE;
@ -9263,8 +9264,8 @@ nsDocShell::SetHasFocus(PRBool aHasFocus)
// child lists. aFrame must be non-null.
static nsICanvasFrame* FindCanvasFrame(nsIFrame* aFrame)
{
nsICanvasFrame* canvasFrame = do_QueryFrame(aFrame);
if (canvasFrame) {
nsICanvasFrame* canvasFrame;
if (NS_SUCCEEDED(CallQueryInterface(aFrame, &canvasFrame))) {
return canvasFrame;
}
@ -9301,8 +9302,8 @@ nsDocShell::SetCanvasHasFocus(PRBool aCanvasHasFocus)
if (frame) {
frame = frame->GetParent();
if (frame) {
nsICanvasFrame* canvasFrame = do_QueryFrame(frame);
if (canvasFrame) {
nsICanvasFrame* canvasFrame;
if (NS_SUCCEEDED(CallQueryInterface(frame, &canvasFrame))) {
return canvasFrame->SetHasFocus(aCanvasHasFocus);
}
}

Просмотреть файл

@ -2730,7 +2730,9 @@ nsHTMLEditor::GetCellIndexes(nsIDOMElement *aCell,
nsIFrame *layoutObject = ps->GetPrimaryFrameFor(nodeAsContent);
if (!layoutObject) return NS_ERROR_FAILURE;
nsITableCellLayout *cellLayoutObject = do_QueryFrame(layoutObject);
nsITableCellLayout *cellLayoutObject=nsnull; // again, frames are not ref-counted
res = layoutObject->QueryInterface(NS_GET_IID(nsITableCellLayout), (void**)(&cellLayoutObject));
if (NS_FAILED(res)) return res;
if (!cellLayoutObject) return NS_ERROR_FAILURE;
return cellLayoutObject->GetCellIndexes(*aRowIndex, *aColIndex);
}
@ -2750,8 +2752,8 @@ nsHTMLEditor::GetTableLayoutObject(nsIDOMElement* aTable, nsITableLayout **table
nsIFrame *layoutObject = ps->GetPrimaryFrameFor(nodeAsContent);
if (!layoutObject) return NS_ERROR_FAILURE;
*tableLayoutObject = do_QueryFrame(layoutObject);
return *tableLayoutObject ? NS_OK : NS_NOINTERFACE;
return layoutObject->QueryInterface(NS_GET_IID(nsITableLayout),
(void**)(tableLayoutObject));
}
//Return actual number of cells (a cell with colspan > 1 counts as just 1)

Просмотреть файл

@ -378,7 +378,8 @@ nsFindContentIterator::SetupInnerIterator(nsIContent* aContent)
if (!frame)
return;
nsITextControlFrame* tcFrame = do_QueryFrame(frame);
nsITextControlFrame* tcFrame = nsnull;
CallQueryInterface(frame, &tcFrame);
if (!tcFrame)
return;

Просмотреть файл

@ -440,7 +440,7 @@ void nsWebBrowserFind::SetSelectionAndScroll(nsIDOMWindow* aWindow,
nsIFrame* f = presShell->GetPrimaryFrameFor(content);
if (!f)
return;
tcFrame = do_QueryFrame(f);
CallQueryInterface(f, &tcFrame);
break;
}
}

Просмотреть файл

@ -53,6 +53,8 @@
#include "nsInlineFrame.h"
#include "nsPlaceholderFrame.h"
static NS_DEFINE_IID(kInlineFrameCID, NS_INLINE_FRAME_CID);
static const PRUnichar kSpace = 0x0020;
static const PRUnichar kLineSeparator = 0x2028;
static const PRUnichar kObjectSubstitute = 0xFFFC;
@ -850,7 +852,9 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
isLeftMost /* out */,
isRightMost /* out */);
nsInlineFrame* testFrame = do_QueryFrame(aFrame);
nsIFrame* testFrame;
aFrame->QueryInterface(kInlineFrameCID, (void**)&testFrame);
if (testFrame) {
aFrame->AddStateBits(NS_INLINE_FRAME_BIDI_VISUAL_STATE_IS_SET);

Просмотреть файл

@ -4517,7 +4517,8 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIContent* aDocElement,
PR_TRUE,
newFrame);
nsIScrollableFrame* scrollable = do_QueryFrame(newFrame);
nsIScrollableFrame* scrollable;
CallQueryInterface(newFrame, &scrollable);
NS_ENSURE_TRUE(scrollable, NS_ERROR_FAILURE);
nsIScrollableView* scrollableView = scrollable->GetScrollableView();
@ -4672,8 +4673,8 @@ nsCSSFrameConstructor::ConstructRadioControlFrame(nsIFrame** aNewFrame,
radioStyle = mPresShell->StyleSet()->ResolvePseudoStyleFor(aContent,
nsCSSAnonBoxes::radio,
aStyleContext);
nsIRadioControlFrame* radio = do_QueryFrame(*aNewFrame);
if (radio) {
nsIRadioControlFrame* radio = nsnull;
if (*aNewFrame && NS_SUCCEEDED(CallQueryInterface(*aNewFrame, &radio))) {
radio->SetRadioButtonFaceStyleContext(radioStyle);
}
return NS_OK;
@ -4693,8 +4694,8 @@ nsCSSFrameConstructor::ConstructCheckboxControlFrame(nsIFrame** aNewFrame,
checkboxStyle = mPresShell->StyleSet()->ResolvePseudoStyleFor(aContent,
nsCSSAnonBoxes::check,
aStyleContext);
nsICheckboxControlFrame* checkbox = do_QueryFrame(*aNewFrame);
if (checkbox) {
nsICheckboxControlFrame* checkbox = nsnull;
if (*aNewFrame && NS_SUCCEEDED(CallQueryInterface(*aNewFrame, &checkbox))) {
checkbox->SetCheckboxFaceStyleContext(checkboxStyle);
}
return NS_OK;
@ -4771,7 +4772,8 @@ nsCSSFrameConstructor::ConstructButtonFrame(nsFrameConstructorState& aState,
#ifdef DEBUG
// Make sure that we're an anonymous content creator exactly when we're a
// leaf
nsIAnonymousContentCreator* creator = do_QueryFrame(buttonFrame);
nsIAnonymousContentCreator* creator = nsnull;
CallQueryInterface(buttonFrame, &creator);
NS_ASSERTION(!creator == !isLeaf,
"Should be creator exactly when we're a leaf");
#endif
@ -4789,7 +4791,8 @@ nsCSSFrameConstructor::ConstructButtonFrame(nsFrameConstructorState& aState,
#ifdef DEBUG
// Make sure that anonymous child creation will have no effect in this case
nsIAnonymousContentCreator* creator = do_QueryFrame(blockFrame);
nsIAnonymousContentCreator* creator = nsnull;
CallQueryInterface(blockFrame, &creator);
NS_ASSERTION(!creator, "Shouldn't be an anonymous content creator!");
#endif
@ -4875,7 +4878,8 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState,
///////////////////////////////////////////////////////////////////
// Combobox - Old Native Implementation
///////////////////////////////////////////////////////////////////
nsIComboboxControlFrame* comboBox = do_QueryFrame(comboboxFrame);
nsIComboboxControlFrame* comboBox = nsnull;
CallQueryInterface(comboboxFrame, &comboBox);
NS_ASSERTION(comboBox, "NS_NewComboboxControlFrame returned frame that "
"doesn't implement nsIComboboxControlFrame");
@ -4889,8 +4893,9 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState,
nsIFrame* listFrame = NS_NewListControlFrame(mPresShell, listStyle);
// Notify the listbox that it is being used as a dropdown list.
nsIListControlFrame * listControlFrame = do_QueryFrame(listFrame);
if (listControlFrame) {
nsIListControlFrame * listControlFrame;
rv = CallQueryInterface(listFrame, &listControlFrame);
if (NS_SUCCEEDED(rv)) {
listControlFrame->SetComboboxFrame(comboboxFrame);
}
// Notify combobox that it should use the listbox as it's popup
@ -5110,12 +5115,13 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState,
ProcessChildren(aState, aContent, aStyleContext, blockFrame, PR_TRUE,
childItems, PR_TRUE);
static NS_DEFINE_IID(kLegendFrameCID, NS_LEGEND_FRAME_CID);
nsIFrame * child = childItems.childList;
nsIFrame * previous = nsnull;
nsLegendFrame* legendFrame = nsnull;
nsIFrame* legendFrame = nsnull;
while (nsnull != child) {
legendFrame = do_QueryFrame(child);
if (legendFrame) {
nsresult result = child->QueryInterface(kLegendFrameCID, (void**)&legendFrame);
if (NS_SUCCEEDED(result) && legendFrame) {
// We want the legend to be the first frame in the fieldset child list.
// That way the EventStateManager will do the right thing when tabbing
// from a selection point within the legend (bug 236071), which is
@ -5182,7 +5188,8 @@ nsCSSFrameConstructor::ConstructTextFrame(nsFrameConstructorState& aState,
if (aParentFrame->IsFrameOfType(nsIFrame::eSVG)) {
nsIFrame *ancestorFrame = SVG_GetFirstNonAAncestorFrame(aParentFrame);
if (ancestorFrame) {
nsISVGTextContentMetrics* metrics = do_QueryFrame(ancestorFrame);
nsISVGTextContentMetrics* metrics;
CallQueryInterface(ancestorFrame, &metrics);
if (!metrics) {
return NS_OK;
}
@ -5572,7 +5579,8 @@ nsCSSFrameConstructor::CreateAnonymousFrames(nsFrameConstructorState& aState,
nsIFrame* aParentFrame,
nsFrameItems& aChildItems)
{
nsIAnonymousContentCreator* creator = do_QueryFrame(aParentFrame);
nsIAnonymousContentCreator* creator = nsnull;
CallQueryInterface(aParentFrame, &creator);
if (!creator)
return NS_OK;
@ -6985,7 +6993,8 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState,
else if (aTag == nsGkAtoms::text) {
nsIFrame *ancestorFrame = SVG_GetFirstNonAAncestorFrame(aParentFrame);
if (ancestorFrame) {
nsISVGTextContentMetrics* metrics = do_QueryFrame(ancestorFrame);
nsISVGTextContentMetrics* metrics;
CallQueryInterface(ancestorFrame, &metrics);
// Text cannot be nested
if (!metrics)
newFrame = NS_NewSVGTextFrame(mPresShell, aContent, aStyleContext);
@ -6994,7 +7003,8 @@ nsCSSFrameConstructor::ConstructSVGFrame(nsFrameConstructorState& aState,
else if (aTag == nsGkAtoms::tspan) {
nsIFrame *ancestorFrame = SVG_GetFirstNonAAncestorFrame(aParentFrame);
if (ancestorFrame) {
nsISVGTextContentMetrics* metrics = do_QueryFrame(ancestorFrame);
nsISVGTextContentMetrics* metrics;
CallQueryInterface(ancestorFrame, &metrics);
if (metrics)
newFrame = NS_NewSVGTSpanFrame(mPresShell, aContent,
ancestorFrame, aStyleContext);
@ -8489,7 +8499,8 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
#ifdef DEBUG
if (gReallyNoisyContentUpdates) {
nsIFrameDebug* fdbg = do_QueryFrame(parentFrame);
nsIFrameDebug* fdbg = nsnull;
CallQueryInterface(parentFrame, &fdbg);
if (fdbg) {
printf("nsCSSFrameConstructor::ContentAppended: resulting frame model:\n");
fdbg->List(stdout, 0);
@ -8636,7 +8647,8 @@ nsCSSFrameConstructor::ContentInserted(nsIContent* aContainer,
InvalidateCanvasIfNeeded(docElementFrame);
#ifdef DEBUG
if (gReallyNoisyContentUpdates) {
nsIFrameDebug* fdbg = do_QueryFrame(docElementFrame);
nsIFrameDebug* fdbg = nsnull;
CallQueryInterface(docElementFrame, &fdbg);
if (fdbg) {
printf("nsCSSFrameConstructor::ContentInserted: resulting frame model:\n");
fdbg->List(stdout, 0);
@ -8928,7 +8940,8 @@ nsCSSFrameConstructor::ContentInserted(nsIContent* aContainer,
#ifdef DEBUG
if (gReallyNoisyContentUpdates && parentFrame) {
nsIFrameDebug* fdbg = do_QueryFrame(parentFrame);
nsIFrameDebug* fdbg = nsnull;
CallQueryInterface(parentFrame, &fdbg);
if (fdbg) {
printf("nsCSSFrameConstructor::ContentInserted: resulting frame model:\n");
fdbg->List(stdout, 0);
@ -9306,7 +9319,8 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
nsFrame::ListTag(stdout, childFrame);
printf("\n");
nsIFrameDebug* fdbg = do_QueryFrame(parentFrame);
nsIFrameDebug* fdbg = nsnull;
CallQueryInterface(parentFrame, &fdbg);
if (fdbg)
fdbg->List(stdout, 0);
}
@ -9370,7 +9384,8 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
#ifdef DEBUG
if (gReallyNoisyContentUpdates && parentFrame) {
nsIFrameDebug* fdbg = do_QueryFrame(parentFrame);
nsIFrameDebug* fdbg = nsnull;
CallQueryInterface(parentFrame, &fdbg);
if (fdbg) {
printf("nsCSSFrameConstructor::ContentRemoved: resulting frame model:\n");
fdbg->List(stdout, 0);
@ -12521,15 +12536,16 @@ nsCSSFrameConstructor::ConstructInline(nsFrameConstructorState& aState,
nsIFrameDebug* frameDebug;
printf("nsCSSFrameConstructor::ConstructInline:\n");
if ( (frameDebug = do_QueryFrame(aNewFrame)) ) {
if (NS_SUCCEEDED(CallQueryInterface(aNewFrame, &frameDebug))) {
printf(" ==> leading inline frame:\n");
frameDebug->List(stdout, 2);
}
if ( (frameDebug = do_QueryFrame(blockFrame)) ) {
if (NS_SUCCEEDED(CallQueryInterface(blockFrame, &frameDebug))) {
printf(" ==> block frame:\n");
frameDebug->List(stdout, 2);
}
if ( (frameDebug = do_QueryFrame(inlineFrame)) ) {
if (inlineFrame &&
NS_SUCCEEDED(CallQueryInterface(inlineFrame, &frameDebug))) {
printf(" ==> trailing inline frame:\n");
frameDebug->List(stdout, 2);
}

Просмотреть файл

@ -240,13 +240,14 @@ protected:
if (mBidiEnabled) {
// Find the containing block frame
nsIFrame* frame = aFrame;
do {
nsresult rv = NS_ERROR_FAILURE;
while (frame &&
frame->IsFrameOfType(nsIFrame::eLineParticipant) &&
NS_FAILED(rv)) {
frame = frame->GetParent();
mBlockFrame = do_QueryFrame(frame);
rv = frame->QueryInterface(kBlockFrameCID, (void**)&mBlockFrame);
}
while (frame && frame->IsFrameOfType(nsIFrame::eLineParticipant));
NS_ASSERTION(mBlockFrame, "Cannot find containing block.");
NS_ASSERTION(NS_SUCCEEDED(rv) && mBlockFrame, "Cannot find containing block.");
mLineContinuationPoint = mContinuationPoint;
}

Просмотреть файл

@ -1184,7 +1184,8 @@ nsresult nsCaret::UpdateCaretRects(nsIFrame* aFrame, PRInt32 aFrameOffset)
if (scrollFrame)
{
// First, use the scrollFrame to get at the scrollable view that we're in.
nsIScrollableFrame *scrollable = do_QueryFrame(scrollFrame);
nsIScrollableFrame *scrollable;
CallQueryInterface(scrollFrame, &scrollable);
nsIScrollableView *scrollView = scrollable->GetScrollableView();
nsIView *view;
scrollView->GetScrolledView(view);

Просмотреть файл

@ -3737,8 +3737,8 @@ DocumentViewerImpl::PrintPreviewNavigate(PRInt16 aType, PRInt32 aPageNum)
if (fndPageFrame && scrollableView) {
nscoord deadSpaceGapTwips = 0;
nsIPageSequenceFrame * sqf = do_QueryFrame(seqFrame);
if (sqf) {
nsIPageSequenceFrame * sqf;
if (NS_SUCCEEDED(CallQueryInterface(seqFrame, &sqf))) {
sqf->GetDeadSpaceValue(&deadSpaceGapTwips);
}

Просмотреть файл

@ -737,8 +737,9 @@ DumpContext(nsIFrame* aFrame, nsStyleContext* aContext)
if (aFrame) {
fputs("frame: ", stdout);
nsAutoString name;
nsIFrameDebug *frameDebug = do_QueryFrame(aFrame);
if (frameDebug) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(aFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) {
frameDebug->GetFrameName(name);
fputs(NS_LossyConvertUTF16toASCII(name).get(), stdout);
}
@ -1587,7 +1588,9 @@ nsFrameManager::CaptureFrameStateFor(nsIFrame* aFrame,
}
// Only capture state for stateful frames
nsIStatefulFrame* statefulFrame = do_QueryFrame(aFrame);
nsIStatefulFrame* statefulFrame;
CallQueryInterface(aFrame, &statefulFrame);
if (!statefulFrame) {
return;
}
@ -1652,7 +1655,8 @@ nsFrameManager::RestoreFrameStateFor(nsIFrame* aFrame,
}
// Only restore state for stateful frames
nsIStatefulFrame* statefulFrame = do_QueryFrame(aFrame);
nsIStatefulFrame* statefulFrame;
CallQueryInterface(aFrame, &statefulFrame);
if (!statefulFrame) {
return;
}

Просмотреть файл

@ -38,20 +38,22 @@
#ifndef nsIPercentHeightObserver_h___
#define nsIPercentHeightObserver_h___
#include "nsQueryFrame.h"
struct nsHTMLReflowState;
class nsPresContext;
// IID for the nsIPercentHeightObserver interface
#define NS_IPERCENTHEIGHTOBSERVER_IID \
{ 0x9cdc174b, 0x4f39, 0x41ad, {0xbc, 0x16, 0x5a, 0xc5, 0xa8, 0x64, 0x14, 0xa1}}
/**
* This interface is supported by frames that need to provide computed height
* values to children during reflow which would otherwise not happen. Currently only
* table cells support this.
*/
class nsIPercentHeightObserver
class nsIPercentHeightObserver : public nsISupports
{
public:
NS_DECLARE_FRAME_ACCESSOR(nsIPercentHeightObserver)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPERCENTHEIGHTOBSERVER_IID)
// Notify the observer that aReflowState has no computed height, but it has a percent height
virtual void NotifyPercentHeight(const nsHTMLReflowState& aReflowState) = 0;
@ -60,4 +62,7 @@ public:
virtual PRBool NeedsToObserve(const nsHTMLReflowState& aReflowState) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIPercentHeightObserver,
NS_IPERCENTHEIGHTOBSERVER_IID)
#endif // nsIPercentHeightObserver_h___

Просмотреть файл

@ -159,7 +159,10 @@ PrintDisplayListTo(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList,
fputc(' ', aOutput);
}
nsIFrame* f = i->GetUnderlyingFrame();
nsIFrameDebug* fDebug = do_QueryFrame(f);
nsIFrameDebug* fDebug = nsnull;
if (f) {
CallQueryInterface(f, &fDebug);
}
nsAutoString fName;
if (fDebug) {
fDebug->GetFrameName(fName);

Просмотреть файл

@ -546,7 +546,8 @@ nsLayoutUtils::GetScrollableFrameFor(nsIFrame *aScrolledFrame)
if (!frame) {
return nsnull;
}
nsIScrollableFrame *sf = do_QueryFrame(frame);
nsIScrollableFrame *sf;
CallQueryInterface(frame, &sf);
return sf;
}
@ -555,8 +556,12 @@ nsIScrollableFrame*
nsLayoutUtils::GetScrollableFrameFor(nsIScrollableView *aScrollableView)
{
nsIFrame *frame = GetFrameFor(aScrollableView->View()->GetParent());
nsIScrollableFrame *sf = do_QueryFrame(frame);
return sf;
if (frame) {
nsIScrollableFrame *sf;
CallQueryInterface(frame, &sf);
return sf;
}
return nsnull;
}
//static
@ -1529,8 +1534,10 @@ nsLayoutUtils::FindChildContainingDescendant(nsIFrame* aParent, nsIFrame* aDesce
nsBlockFrame*
nsLayoutUtils::GetAsBlock(nsIFrame* aFrame)
{
nsBlockFrame* block = do_QueryFrame(aFrame);
return block;
nsBlockFrame* block;
if (NS_SUCCEEDED(aFrame->QueryInterface(kBlockFrameCID, (void**)&block)))
return block;
return nsnull;
}
nsBlockFrame*
@ -1675,7 +1682,8 @@ nsLayoutUtils::IsViewportScrollbarFrame(nsIFrame* aFrame)
if (!rootScrollFrame)
return PR_FALSE;
nsIScrollableFrame* rootScrollableFrame = do_QueryFrame(rootScrollFrame);
nsIScrollableFrame* rootScrollableFrame = nsnull;
CallQueryInterface(rootScrollFrame, &rootScrollableFrame);
NS_ASSERTION(rootScrollableFrame, "The root scorollable frame is null");
if (!IsProperAncestorFrame(rootScrollFrame, aFrame))
@ -2518,8 +2526,9 @@ nsLayoutUtils::GetFirstLineBaseline(const nsIFrame* aFrame, nscoord* aResult)
// For first-line baselines, we have to consider scroll frames.
if (fType == nsGkAtoms::scrollFrame) {
nsIScrollableFrame *sFrame = do_QueryFrame(const_cast<nsIFrame*>(aFrame));
if (!sFrame) {
nsIScrollableFrame *sFrame;
if (NS_FAILED(CallQueryInterface(const_cast<nsIFrame*>
(aFrame), &sFrame)) || !sFrame) {
NS_NOTREACHED("not scroll frame");
}
nscoord kidBaseline;

Просмотреть файл

@ -2930,7 +2930,8 @@ nsIPresShell::GetRootScrollFrameAsScrollable() const
nsIFrame* frame = GetRootScrollFrame();
if (!frame)
return nsnull;
nsIScrollableFrame* scrollableFrame = do_QueryFrame(frame);
nsIScrollableFrame* scrollableFrame = nsnull;
CallQueryInterface(frame, &scrollableFrame);
NS_ASSERTION(scrollableFrame,
"All scroll frames must implement nsIScrollableFrame");
return scrollableFrame;
@ -2946,7 +2947,9 @@ PresShell::GetPageSequenceFrame(nsIPageSequenceFrame** aResult) const
*aResult = nsnull;
nsIFrame* frame = mFrameConstructor->GetPageSequenceFrame();
*aResult = do_QueryFrame(frame);
if (frame) {
CallQueryInterface(frame, aResult);
}
return *aResult ? NS_OK : NS_ERROR_FAILURE;
}
@ -3000,7 +3003,8 @@ PresShell::RestoreRootScrollPosition()
if (historyState) {
nsIFrame* scrollFrame = GetRootScrollFrame();
if (scrollFrame) {
nsIScrollableFrame* scrollableFrame = do_QueryFrame(scrollFrame);
nsIScrollableFrame* scrollableFrame;
CallQueryInterface(scrollFrame, &scrollableFrame);
if (scrollableFrame) {
FrameManager()->RestoreFrameStateFor(scrollFrame, historyState,
nsIStatefulFrame::eDocumentScrollState);
@ -3218,7 +3222,8 @@ PresShell::GetViewToScroll(nsLayoutUtils::Direction aDirection)
if (focusedContent) {
nsIFrame* startFrame = GetPrimaryFrameFor(focusedContent);
if (startFrame) {
nsIScrollableViewProvider* svp = do_QueryFrame(startFrame);
nsIScrollableViewProvider* svp;
CallQueryInterface(startFrame, &svp);
// If this very frame provides a scroll view, start there instead of frame's
// closest view, because the scroll view may be inside a child frame.
// For example, this happens in the case of overflow:scroll.
@ -5990,7 +5995,9 @@ StopPluginInstance(PresShell *aShell, nsIContent *aContent)
{
nsIFrame *frame = aShell->FrameManager()->GetPrimaryFrameFor(aContent, -1);
nsIObjectFrame *objectFrame = do_QueryFrame(frame);
nsIObjectFrame *objectFrame = nsnull;
if (frame)
CallQueryInterface(frame, &objectFrame);
if (!objectFrame)
return;
@ -6274,9 +6281,10 @@ void
PresShell::DoVerifyReflow()
{
if (nsIFrameDebug::GetVerifyTreeEnable()) {
nsIFrameDebug* frameDebug;
nsIFrame* rootFrame = FrameManager()->GetRootFrame();
nsIFrameDebug *frameDebug = do_QueryFrame(rootFrame);
if (frameDebug) {
if (NS_SUCCEEDED(rootFrame->QueryInterface(NS_GET_IID(nsIFrameDebug),
(void**)&frameDebug))) {
frameDebug->VerifyTree();
}
}
@ -6418,7 +6426,8 @@ ReResolveMenusAndTrees(nsIFrame *aFrame, void *aClosure)
{
// Trees have a special style cache that needs to be flushed when
// the theme changes.
nsTreeBodyFrame *treeBody = do_QueryFrame(aFrame);
nsTreeBodyFrame *treeBody = nsnull;
CallQueryInterface(aFrame, &treeBody);
if (treeBody)
treeBody->ClearStyleAndImageCaches();
@ -6592,8 +6601,10 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg)
printf("verifyreflow: ");
nsAutoString name;
if (nsnull != k1) {
nsIFrameDebug *frameDebug = do_QueryFrame(k1);
if (frameDebug) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(k1->QueryInterface(NS_GET_IID(nsIFrameDebug),
(void**)&frameDebug))) {
frameDebug->GetFrameName(name);
}
}
@ -6607,8 +6618,10 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg)
printf(" != ");
if (nsnull != k2) {
nsIFrameDebug *frameDebug = do_QueryFrame(k2);
if (frameDebug) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(k2->QueryInterface(NS_GET_IID(nsIFrameDebug),
(void**)&frameDebug))) {
frameDebug->GetFrameName(name);
}
}
@ -6628,8 +6641,10 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg,
{
printf("VerifyReflow Error:\n");
nsAutoString name;
nsIFrameDebug *frameDebug = do_QueryFrame(k1);
if (frameDebug) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(k1->QueryInterface(NS_GET_IID(nsIFrameDebug),
(void**)&frameDebug))) {
fprintf(stdout, " ");
frameDebug->GetFrameName(name);
fputs(NS_LossyConvertUTF16toASCII(name).get(), stdout);
@ -6639,8 +6654,8 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg,
printf(" != \n");
frameDebug = do_QueryFrame(k2);
if (frameDebug) {
if (NS_SUCCEEDED(k2->QueryInterface(NS_GET_IID(nsIFrameDebug),
(void**)&frameDebug))) {
fprintf(stdout, " ");
frameDebug->GetFrameName(name);
fputs(NS_LossyConvertUTF16toASCII(name).get(), stdout);
@ -6998,13 +7013,13 @@ PresShell::VerifyIncrementalReflow()
PRBool ok = CompareTrees(mPresContext, root1, cx, root2);
if (!ok && (VERIFY_REFLOW_NOISY & gVerifyReflowFlags)) {
printf("Verify reflow failed, primary tree:\n");
nsIFrameDebug* frameDebug = do_QueryFrame(root1);
if (frameDebug) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(CallQueryInterface(root1, &frameDebug))) {
frameDebug->List(stdout, 0);
}
printf("Verification tree:\n");
frameDebug = do_QueryFrame(root2);
if (frameDebug) {
if (NS_SUCCEEDED(CallQueryInterface(root2, &frameDebug))) {
frameDebug->List(stdout, 0);
}
}

Просмотреть файл

@ -287,28 +287,36 @@ nsComboboxControlFrame::~nsComboboxControlFrame()
}
//--------------------------------------------------------------
NS_QUERYFRAME_HEAD(nsComboboxControlFrame)
NS_QUERYFRAME_ENTRY(nsIComboboxControlFrame)
NS_QUERYFRAME_ENTRY(nsIFormControlFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
NS_QUERYFRAME_ENTRY(nsISelectControlFrame)
NS_QUERYFRAME_ENTRY(nsIStatefulFrame)
NS_QUERYFRAME_ENTRY(nsIScrollableViewProvider)
NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame)
NS_IMPL_QUERY_INTERFACE1(nsComboboxControlFrame, nsIRollupListener)
NS_IMETHODIMP_(nsrefcnt)
nsComboboxControlFrame::AddRef()
// Frames are not refcounted, no need to AddRef
NS_IMETHODIMP
nsComboboxControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
return 2;
}
NS_PRECONDITION(aInstancePtr, "null out param");
NS_IMETHODIMP_(nsrefcnt)
nsComboboxControlFrame::Release()
{
return 1;
if (aIID.Equals(NS_GET_IID(nsIComboboxControlFrame))) {
*aInstancePtr = static_cast<nsIComboboxControlFrame*>(this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) {
*aInstancePtr = static_cast<nsIFormControlFrame*>(this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) {
*aInstancePtr = static_cast<nsIAnonymousContentCreator*>(this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsISelectControlFrame))) {
*aInstancePtr = static_cast<nsISelectControlFrame*>(this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIStatefulFrame))) {
*aInstancePtr = static_cast<nsIStatefulFrame*>(this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIRollupListener))) {
*aInstancePtr = static_cast<nsIRollupListener*>(this);
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIScrollableViewProvider))) {
*aInstancePtr = static_cast<nsIScrollableViewProvider*>(this);
return NS_OK;
}
return nsBlockFrame::QueryInterface(aIID, aInstancePtr);
}
#ifdef ACCESSIBILITY
@ -417,7 +425,8 @@ nsComboboxControlFrame::ShowList(nsPresContext* aPresContext, PRBool aShowList)
return PR_FALSE;
}
nsIFrame* listFrame = do_QueryFrame(mListControlFrame);
nsIFrame* listFrame;
CallQueryInterface(mListControlFrame, &listFrame);
if (listFrame) {
nsIView* view = listFrame->GetView();
NS_ASSERTION(view, "nsComboboxControlFrame view is null");
@ -561,7 +570,8 @@ nsComboboxControlFrame::GetIntrinsicWidth(nsIRenderingContext* aRenderingContext
nscoord scrollbarWidth = 0;
nsPresContext* presContext = PresContext();
if (mListControlFrame) {
nsIScrollableFrame* scrollable = do_QueryFrame(mListControlFrame);
nsIScrollableFrame* scrollable;
CallQueryInterface(mListControlFrame, &scrollable);
NS_ASSERTION(scrollable, "List must be a scrollable frame");
scrollbarWidth =
scrollable->GetDesiredScrollbarSizes(presContext, aRenderingContext).LeftRight();
@ -666,7 +676,8 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
buttonWidth = 0;
}
else {
nsIScrollableFrame* scrollable = do_QueryFrame(mListControlFrame);
nsIScrollableFrame* scrollable;
CallQueryInterface(mListControlFrame, &scrollable);
NS_ASSERTION(scrollable, "List must be a scrollable frame");
buttonWidth =
scrollable->GetDesiredScrollbarSizes(PresContext(),
@ -763,7 +774,8 @@ void
nsComboboxControlFrame::SetDropDown(nsIFrame* aDropDownFrame)
{
mDropdownFrame = aDropDownFrame;
mListControlFrame = do_QueryFrame(mDropdownFrame);
CallQueryInterface(mDropdownFrame, &mListControlFrame);
}
nsIFrame*
@ -866,11 +878,15 @@ nsComboboxControlFrame::GetIndexOfDisplayArea()
NS_IMETHODIMP
nsComboboxControlFrame::DoneAddingChildren(PRBool aIsDone)
{
nsISelectControlFrame* listFrame = do_QueryFrame(mDropdownFrame);
if (!listFrame)
return NS_ERROR_FAILURE;
return listFrame->DoneAddingChildren(aIsDone);
nsISelectControlFrame* listFrame = nsnull;
nsresult rv = NS_ERROR_FAILURE;
if (mDropdownFrame != nsnull) {
rv = CallQueryInterface(mDropdownFrame, &listFrame);
if (listFrame) {
rv = listFrame->DoneAddingChildren(aIsDone);
}
}
return rv;
}
NS_IMETHODIMP
@ -908,9 +924,10 @@ nsComboboxControlFrame::RemoveOption(nsPresContext* aPresContext, PRInt32 aIndex
NS_IMETHODIMP
nsComboboxControlFrame::GetOptionSelected(PRInt32 aIndex, PRBool* aValue)
{
nsISelectControlFrame* listFrame = nsnull;
NS_ASSERTION(mDropdownFrame, "No dropdown frame!");
nsISelectControlFrame* listFrame = do_QueryFrame(mDropdownFrame);
CallQueryInterface(mDropdownFrame, &listFrame);
NS_ASSERTION(listFrame, "No list frame!");
return listFrame->GetOptionSelected(aIndex, aValue);
@ -920,9 +937,11 @@ NS_IMETHODIMP
nsComboboxControlFrame::OnSetSelectedIndex(PRInt32 aOldIndex, PRInt32 aNewIndex)
{
RedisplayText(aNewIndex);
NS_ASSERTION(mDropdownFrame, "No dropdown frame!");
nsISelectControlFrame* listFrame = do_QueryFrame(mDropdownFrame);
nsISelectControlFrame* listFrame = nsnull;
NS_ASSERTION(mDropdownFrame, "No dropdown frame!");
CallQueryInterface(mDropdownFrame, &listFrame);
NS_ASSERTION(listFrame, "No list frame!");
return listFrame->OnSetSelectedIndex(aOldIndex, aNewIndex);
@ -958,23 +977,29 @@ nsComboboxControlFrame::HandleEvent(nsPresContext* aPresContext,
nsresult
nsComboboxControlFrame::SetFormProperty(nsIAtom* aName, const nsAString& aValue)
{
nsIFormControlFrame* fcFrame = do_QueryFrame(mDropdownFrame);
if (!fcFrame) {
return NS_NOINTERFACE;
nsIFormControlFrame* fcFrame = nsnull;
nsresult result = CallQueryInterface(mDropdownFrame, &fcFrame);
if (NS_FAILED(result)) {
return result;
}
return fcFrame->SetFormProperty(aName, aValue);
if (fcFrame) {
return fcFrame->SetFormProperty(aName, aValue);
}
return NS_OK;
}
nsresult
nsComboboxControlFrame::GetFormProperty(nsIAtom* aName, nsAString& aValue) const
{
nsIFormControlFrame* fcFrame = do_QueryFrame(mDropdownFrame);
if (!fcFrame) {
return NS_ERROR_FAILURE;
nsIFormControlFrame* fcFrame = nsnull;
nsresult result = CallQueryInterface(mDropdownFrame, &fcFrame);
if(NS_FAILED(result)) {
return result;
}
return fcFrame->GetFormProperty(aName, aValue);
if (fcFrame) {
return fcFrame->GetFormProperty(aName, aValue);
}
return NS_OK;
}
nsIFrame*
@ -1204,8 +1229,8 @@ nsComboboxControlFrame::Destroy()
if (mDroppedDown) {
// Get parent view
nsIFrame * listFrame = do_QueryFrame(mListControlFrame);
if (listFrame) {
nsIFrame * listFrame;
if (NS_OK == mListControlFrame->QueryInterface(NS_GET_IID(nsIFrame), (void **)&listFrame)) {
nsIView* view = listFrame->GetView();
NS_ASSERTION(view, "nsComboboxControlFrame view is null");
if (view) {
@ -1421,8 +1446,9 @@ nsIScrollableView* nsComboboxControlFrame::GetScrollableView()
if (!mDropdownFrame)
return nsnull;
nsIScrollableFrame* scrollable = do_QueryFrame(mDropdownFrame);
if (!scrollable)
nsIScrollableFrame* scrollable = nsnull;
nsresult rv = CallQueryInterface(mDropdownFrame, &scrollable);
if (NS_FAILED(rv))
return nsnull;
return scrollable->GetScrollableView();
@ -1438,7 +1464,8 @@ nsComboboxControlFrame::OnOptionSelected(nsPresContext* aPresContext,
PRBool aSelected)
{
if (mDroppedDown) {
nsISelectControlFrame *selectFrame = do_QueryFrame(mListControlFrame);
nsCOMPtr<nsISelectControlFrame> selectFrame
= do_QueryInterface(mListControlFrame);
if (selectFrame) {
selectFrame->OnOptionSelected(aPresContext, aIndex, aSelected);
}
@ -1490,7 +1517,8 @@ nsComboboxControlFrame::SaveState(SpecialStateID aStateID,
if (!mListControlFrame)
return NS_ERROR_FAILURE;
nsIStatefulFrame* stateful = do_QueryFrame(mListControlFrame);
nsIStatefulFrame* stateful;
CallQueryInterface(mListControlFrame, &stateful);
return stateful->SaveState(aStateID, aState);
}
@ -1500,9 +1528,11 @@ nsComboboxControlFrame::RestoreState(nsPresState* aState)
if (!mListControlFrame)
return NS_ERROR_FAILURE;
nsIStatefulFrame* stateful = do_QueryFrame(mListControlFrame);
NS_ASSERTION(stateful, "Must implement nsIStatefulFrame");
return stateful->RestoreState(aState);
nsIStatefulFrame* stateful;
nsresult rv = CallQueryInterface(mListControlFrame, &stateful);
NS_ASSERTION(NS_SUCCEEDED(rv), "Must implement nsIStatefulFrame");
rv = stateful->RestoreState(aState);
return rv;
}

Просмотреть файл

@ -96,8 +96,8 @@ public:
nsComboboxControlFrame(nsStyleContext* aContext);
~nsComboboxControlFrame();
NS_DECL_QUERYFRAME
NS_DECL_ISUPPORTS_INHERITED
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<nsIContent*>& aElements);
@ -292,6 +292,10 @@ protected:
#ifdef DO_REFLOW_COUNTER
PRInt32 mReflowId;
#endif
private:
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
};
#endif

Просмотреть файл

@ -228,10 +228,23 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
return NS_OK;
}
NS_QUERYFRAME_HEAD(nsFileControlFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
NS_QUERYFRAME_ENTRY(nsIFormControlFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame)
// Frames are not refcounted, no need to AddRef
NS_IMETHODIMP
nsFileControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) {
*aInstancePtr = static_cast<nsIAnonymousContentCreator*>(this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) {
*aInstancePtr = static_cast<nsIFormControlFrame*>(this);
return NS_OK;
}
return nsBlockFrame::QueryInterface(aIID, aInstancePtr);
}
void
nsFileControlFrame::SetFocus(PRBool aOn, PRBool aRepaint)

Просмотреть файл

@ -63,7 +63,7 @@ public:
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists);
NS_DECL_QUERYFRAME
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIFormControlFrame
virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue);
@ -183,6 +183,9 @@ private:
*/
void SyncAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
PRInt32 aWhichControls);
NS_IMETHOD_(nsrefcnt) AddRef() { return 1; }
NS_IMETHOD_(nsrefcnt) Release() { return 1; }
};
#endif

Просмотреть файл

@ -62,9 +62,19 @@ nsFormControlFrame::Destroy()
nsLeafFrame::Destroy();
}
NS_QUERYFRAME_HEAD(nsFormControlFrame)
NS_QUERYFRAME_ENTRY(nsIFormControlFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsLeafFrame)
// Frames are not refcounted, no need to AddRef
NS_IMETHODIMP
nsFormControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) {
*aInstancePtr = static_cast<nsIFormControlFrame*>(this);
return NS_OK;
}
return nsLeafFrame::QueryInterface(aIID, aInstancePtr);
}
nscoord
nsFormControlFrame::GetIntrinsicWidth()

Просмотреть файл

@ -64,7 +64,7 @@ public:
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
}
NS_DECL_QUERYFRAME
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
/**
* Respond to a gui event
@ -124,6 +124,11 @@ protected:
*/
void GetCurrentCheckState(PRBool* aState);
private:
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
};
#endif

Просмотреть файл

@ -186,9 +186,19 @@ NS_IMETHODIMP nsGfxButtonControlFrame::GetAccessible(nsIAccessible** aAccessible
}
#endif
NS_QUERYFRAME_HEAD(nsGfxButtonControlFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
NS_QUERYFRAME_TAIL_INHERITING(nsHTMLButtonControlFrame)
// Frames are not refcounted, no need to AddRef
NS_IMETHODIMP
nsGfxButtonControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) {
*aInstancePtr = static_cast<nsIAnonymousContentCreator*>(this);
return NS_OK;
}
return nsHTMLButtonControlFrame::QueryInterface(aIID, aInstancePtr);
}
// Initially we hardcoded the default strings here.
// Next, we used html.css to store the default label for various types

Просмотреть файл

@ -74,8 +74,8 @@ public:
#ifdef DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const;
#endif
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_DECL_QUERYFRAME
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<nsIContent*>& aElements);
@ -101,6 +101,9 @@ protected:
PRBool IsFileBrowseButton(PRInt32 type); // Browse button of file input
private:
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
nsSize mSuggestedSize;
nsCOMPtr<nsIContent> mTextContent;
};

Просмотреть файл

@ -93,9 +93,22 @@ nsGfxCheckboxControlFrame::~nsGfxCheckboxControlFrame()
}
NS_QUERYFRAME_HEAD(nsGfxCheckboxControlFrame)
NS_QUERYFRAME_ENTRY(nsICheckboxControlFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsFormControlFrame)
//----------------------------------------------------------------------
// nsISupports
//----------------------------------------------------------------------
// Frames are not refcounted, no need to AddRef
NS_IMETHODIMP
nsGfxCheckboxControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsICheckboxControlFrame))) {
*aInstancePtr = static_cast<nsICheckboxControlFrame*>(this);
return NS_OK;
}
return nsFormControlFrame::QueryInterface(aIID, aInstancePtr);
}
#ifdef ACCESSIBILITY
NS_IMETHODIMP nsGfxCheckboxControlFrame::GetAccessible(nsIAccessible** aAccessible)

Просмотреть файл

@ -78,7 +78,7 @@ public:
virtual void SetAdditionalStyleContext(PRInt32 aIndex,
nsStyleContext* aStyleContext);
NS_DECL_QUERYFRAME
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
void PaintCheckBox(nsIRenderingContext& aRenderingContext,
nsPoint aPt, const nsRect& aDirtyRect);
@ -91,6 +91,11 @@ protected:
PRBool GetCheckboxState();
nsRefPtr<nsStyleContext> mCheckButtonFaceStyle;
private:
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
};
#endif

Просмотреть файл

@ -61,9 +61,19 @@ nsGfxRadioControlFrame::~nsGfxRadioControlFrame()
{
}
NS_QUERYFRAME_HEAD(nsGfxRadioControlFrame)
NS_QUERYFRAME_ENTRY(nsIRadioControlFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsFormControlFrame)
// Frames are not refcounted, no need to AddRef
NS_IMETHODIMP
nsGfxRadioControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIRadioControlFrame))) {
*aInstancePtr = static_cast<nsIRadioControlFrame*>(this);
return NS_OK;
}
return nsFormControlFrame::QueryInterface(aIID, aInstancePtr);
}
#ifdef ACCESSIBILITY
NS_IMETHODIMP nsGfxRadioControlFrame::GetAccessible(nsIAccessible** aAccessible)

Просмотреть файл

@ -60,9 +60,8 @@ public:
nsGfxRadioControlFrame(nsStyleContext* aContext);
~nsGfxRadioControlFrame();
NS_DECL_QUERYFRAME
//nsIRadioControlFrame methods
//nsIRadioControlFrame methods
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD SetRadioButtonFaceStyleContext(nsStyleContext *aRadioButtonFaceStyleContext);
#ifdef ACCESSIBILITY
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
@ -82,6 +81,10 @@ public:
protected:
nsRefPtr<nsStyleContext> mRadioButtonFaceStyle;
private:
NS_IMETHOD_(nsrefcnt) AddRef() { return NS_OK; }
NS_IMETHOD_(nsrefcnt) Release() { return NS_OK; }
};
#endif

Просмотреть файл

@ -105,9 +105,31 @@ nsHTMLButtonControlFrame::Init(
return rv;
}
NS_QUERYFRAME_HEAD(nsHTMLButtonControlFrame)
NS_QUERYFRAME_ENTRY(nsIFormControlFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame)
nsrefcnt nsHTMLButtonControlFrame::AddRef(void)
{
NS_WARNING("not supported");
return 1;
}
nsrefcnt nsHTMLButtonControlFrame::Release(void)
{
NS_WARNING("not supported");
return 1;
}
// Frames are not refcounted, no need to AddRef
NS_IMETHODIMP
nsHTMLButtonControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) {
*aInstancePtr = static_cast<nsIFormControlFrame*>(this);
return NS_OK;
}
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}
#ifdef ACCESSIBILITY
NS_IMETHODIMP nsHTMLButtonControlFrame::GetAccessible(nsIAccessible** aAccessible)

Просмотреть файл

@ -65,7 +65,7 @@ public:
virtual void Destroy();
NS_DECL_QUERYFRAME
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
@ -142,6 +142,9 @@ protected:
nsMargin aFocusPadding,
nsReflowStatus& aStatus);
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
PRIntn GetSkipSides() const;
nsButtonFrameRenderer mRenderer;
};

Просмотреть файл

@ -38,18 +38,24 @@
#ifndef nsICheckControlFrame_h___
#define nsICheckControlFrame_h___
#include "nsQueryFrame.h"
#include "nsISupports.h"
class nsStyleContext;
class nsPresContext;
// IID for the nsICheckControlFrame class
// {401347ED-0101-11d4-9706-0060B0FB9956}
#define NS_ICHECKBOXCONTROLFRAME_IID \
{ 0x401347ed, 0x101, 0x11d4, \
{ 0x97, 0x6, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56 } }
/**
* nsICheckControlFrame is the common interface radio buttons.
* @see nsFromControlFrame and its base classes for more info
*/
class nsICheckboxControlFrame
{
class nsICheckboxControlFrame : public nsISupports {
public:
NS_DECLARE_FRAME_ACCESSOR(nsICheckboxControlFrame)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICHECKBOXCONTROLFRAME_IID)
/**
* Sets the Pseudo Style Contexts for the Check button
@ -63,5 +69,8 @@ public:
NS_IMETHOD OnChecked(nsPresContext* aPresContext, PRBool aChecked) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsICheckboxControlFrame,
NS_ICHECKBOXCONTROLFRAME_IID)
#endif

Просмотреть файл

@ -38,7 +38,7 @@
#ifndef nsIComboboxControlFrame_h___
#define nsIComboboxControlFrame_h___
#include "nsQueryFrame.h"
#include "nsISupports.h"
#include "nsFont.h"
class nsPresContext;
@ -47,15 +47,21 @@ class nsIContent;
class nsVoidArray;
class nsCSSFrameConstructor;
// IID for the nsIComboboxControlFrame class
#define NS_ICOMBOBOXCONTROLFRAME_IID \
{ 0x23f75e9c, 0x6850, 0x11da, \
{ 0x95, 0x2c, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f } }
/**
* nsIComboboxControlFrame is the common interface for frames of form controls. It
* provides a uniform way of creating widgets, resizing, and painting.
* @see nsLeafFrame and its base classes for more info
*/
class nsIComboboxControlFrame : public nsQueryFrame
{
class nsIComboboxControlFrame : public nsISupports {
public:
NS_DECLARE_FRAME_ACCESSOR(nsIComboboxControlFrame)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICOMBOBOXCONTROLFRAME_IID)
/**
* Indicates whether the list is dropped down
@ -121,5 +127,8 @@ public:
virtual PRInt32 GetIndexOfDisplayArea() = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIComboboxControlFrame,
NS_ICOMBOBOXCONTROLFRAME_IID)
#endif

Просмотреть файл

@ -38,21 +38,26 @@
#ifndef nsIFormControlFrame_h___
#define nsIFormControlFrame_h___
#include "nsQueryFrame.h"
#include "nsISupports.h"
class nsAString;
class nsIContent;
class nsIAtom;
struct nsSize;
// IID for the nsIFormControlFrame class
#define NS_IFORMCONTROLFRAME_IID \
{ 0x189e1565, 0x44f, 0x11da, \
{ 0x94, 0xfc, 0x0, 0xe0, 0x81, 0x61, 0x16, 0x5f } }
/**
* nsIFormControlFrame is the common interface for frames of form controls. It
* provides a uniform way of creating widgets, resizing, and painting.
* @see nsLeafFrame and its base classes for more info
*/
class nsIFormControlFrame : public nsQueryFrame
{
class nsIFormControlFrame : public nsISupports {
public:
NS_DECLARE_FRAME_ACCESSOR(nsIFormControlFrame)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFORMCONTROLFRAME_IID)
/**
*
@ -81,5 +86,7 @@ public:
virtual nsresult GetFormProperty(nsIAtom* aName, nsAString& aValue) const = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIFormControlFrame, NS_IFORMCONTROLFRAME_IID)
#endif

Просмотреть файл

@ -38,19 +38,24 @@
#ifndef nsIListControlFrame_h___
#define nsIListControlFrame_h___
#include "nsQueryFrame.h"
#include "nsISupports.h"
#include "nsFont.h"
class nsPresContext;
class nsAString;
class nsIContent;
// IID for the nsIListControlFrame class
#define NS_ILISTCONTROLFRAME_IID \
{ 0x4de9ab73, 0x31b5, 0x4d92, \
{ 0xb7, 0xe4, 0x73, 0xb4, 0x4d, 0xcb, 0xfc, 0xda } }
/**
* nsIListControlFrame is the interface for frame-based listboxes.
*/
class nsIListControlFrame : public nsQueryFrame
{
class nsIListControlFrame : public nsISupports {
public:
NS_DECLARE_FRAME_ACCESSOR(nsIListControlFrame)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILISTCONTROLFRAME_IID)
/**
* Sets the ComboBoxFrame
@ -121,5 +126,7 @@ public:
virtual void OnContentReset() = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIListControlFrame, NS_ILISTCONTROLFRAME_IID)
#endif

Просмотреть файл

@ -38,17 +38,24 @@
#ifndef nsIRadioControlFrame_h___
#define nsIRadioControlFrame_h___
#include "nsQueryFrame.h"
#include "nsISupports.h"
class nsStyleContext;
// IID for the nsIRadioControlFrame class
// {06450E00-24D9-11d3-966B-00105A1B1B76}
#define NS_IRADIOCONTROLFRAME_IID \
{ 0x6450e00, 0x24d9, 0x11d3, \
{ 0x96, 0x6b, 0x0, 0x10, 0x5a, 0x1b, 0x1b, 0x76 } }
/**
* nsIRadioControlFrame is the common interface radio buttons.
* @see nsFormControlFrame and its base classes for more info
*/
class nsIRadioControlFrame
{
class nsIRadioControlFrame : public nsISupports {
public:
NS_DECLARE_FRAME_ACCESSOR(nsIRadioControlFrame)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IRADIOCONTROLFRAME_IID)
/**
* Sets the Pseudo Style Contexts for the Radio button
@ -62,5 +69,7 @@ public:
NS_IMETHOD OnChecked(nsPresContext* aPresContext, PRBool aChecked) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIRadioControlFrame, NS_IRADIOCONTROLFRAME_IID)
#endif

Просмотреть файл

@ -39,17 +39,23 @@
#ifndef nsISelectControlFrame_h___
#define nsISelectControlFrame_h___
#include "nsQueryFrame.h"
#include "nsISupports.h"
// IID for the nsISelectControlFrame class
// f8a1b329-d0d8-4bd5-a9ab-08c3c0f2f166
#define NS_ISELECTCONTROLFRAME_IID \
{ 0xf8a1b329, 0xd0d8, 0x4bd5, \
{ 0xa9, 0xab, 0x08, 0xc3, 0xc0, 0xf2, 0xf1, 0x66 } }
class nsIDOMHTMLOptionElement;
/**
* nsISelectControlFrame is the interface for combo boxes and listboxes
*/
class nsISelectControlFrame
{
class nsISelectControlFrame : public nsISupports {
public:
NS_DECLARE_FRAME_ACCESSOR(nsISelectControlFrame)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISELECTCONTROLFRAME_IID)
/**
* Adds an option to the list at index
@ -88,4 +94,7 @@ public:
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsISelectControlFrame,
NS_ISELECTCONTROLFRAME_IID)
#endif

Просмотреть файл

@ -81,8 +81,7 @@ public:
NS_IMETHOD Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow);
NS_DECL_QUERYFRAME
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
@ -111,6 +110,10 @@ public:
virtual void SetFocus(PRBool aOn, PRBool aRepaint);
virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue);
virtual nsresult GetFormProperty(nsIAtom* aName, nsAString& aValue) const;
protected:
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
};
@ -157,9 +160,19 @@ nsImageControlFrame::Init(nsIContent* aContent,
IntPointDtorFunc);
}
NS_QUERYFRAME_HEAD(nsImageControlFrame)
NS_QUERYFRAME_ENTRY(nsIFormControlFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsImageControlFrameSuper)
// Frames are not refcounted, no need to AddRef
NS_IMETHODIMP
nsImageControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) {
*aInstancePtr = static_cast<nsIFormControlFrame*>(this);
return NS_OK;
}
return nsImageControlFrameSuper::QueryInterface(aIID, aInstancePtr);
}
#ifdef ACCESSIBILITY
NS_IMETHODIMP nsImageControlFrame::GetAccessible(nsIAccessible** aAccessible)
@ -179,6 +192,18 @@ NS_IMETHODIMP nsImageControlFrame::GetAccessible(nsIAccessible** aAccessible)
}
#endif
nsrefcnt nsImageControlFrame::AddRef(void)
{
NS_WARNING("not supported");
return 1;
}
nsrefcnt nsImageControlFrame::Release(void)
{
NS_WARNING("not supported");
return 1;
}
nsIAtom*
nsImageControlFrame::GetType() const
{

Просмотреть файл

@ -147,8 +147,7 @@ nsIsIndexFrame::GetInputFrame(nsIFormControlFrame** oFrame)
if (presShell && mInputContent) {
nsIFrame *frame = presShell->GetPrimaryFrameFor(mInputContent);
if (frame) {
*oFrame = do_QueryFrame(frame);
return *oFrame ? NS_OK : NS_NOINTERFACE;
return CallQueryInterface(frame, oFrame);
}
}
return NS_OK;
@ -234,17 +233,20 @@ nsIsIndexFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
return NS_OK;
}
NS_QUERYFRAME_HEAD(nsIsIndexFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
NS_QUERYFRAME_ENTRY(nsIStatefulFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame)
// Frames are not refcounted, no need to AddRef
NS_IMETHODIMP
nsIsIndexFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) {
*aInstancePtr = static_cast<nsIAnonymousContentCreator*>(this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIStatefulFrame))) {
*aInstancePtr = static_cast<nsIStatefulFrame*>(this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIDOMKeyListener))) {
*aInstancePtr = static_cast<nsIDOMKeyListener*>(this);
return NS_OK;
@ -254,7 +256,7 @@ nsIsIndexFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
return NS_OK;
}
return NS_NOINTERFACE;
return nsBlockFrame::QueryInterface(aIID, aInstancePtr);
}
nscoord

Просмотреть файл

@ -81,12 +81,9 @@ public:
*/
NS_IMETHOD KeyPress(nsIDOMEvent* aKeyEvent); // we only care when a key is pressed
NS_DECL_QUERYFRAME
// nsISupports
// nsIFormControlFrame
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIFormControlFrame
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
virtual PRBool IsLeaf() const;

Просмотреть файл

@ -52,6 +52,8 @@
#include "nsFont.h"
#include "nsFormControlFrame.h"
static NS_DEFINE_IID(kLegendFrameCID, NS_LEGEND_FRAME_CID);
nsIFrame*
NS_NewLegendFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
@ -75,9 +77,19 @@ nsLegendFrame::Destroy()
nsBlockFrame::Destroy();
}
NS_QUERYFRAME_HEAD(nsLegendFrame)
NS_QUERYFRAME_ENTRY(nsLegendFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame)
// Frames are not refcounted, no need to AddRef
NS_IMETHODIMP
nsLegendFrame::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(kLegendFrameCID)) {
*aInstancePtr = this;
return NS_OK;
}
return nsBlockFrame::QueryInterface(aIID, aInstancePtr);
}
NS_IMETHODIMP
nsLegendFrame::Reflow(nsPresContext* aPresContext,

Просмотреть файл

@ -49,13 +49,14 @@ struct nsHTMLReflowMetrics;
class nsIRenderingContext;
struct nsRect;
#define NS_LEGEND_FRAME_CID \
{ 0x73805d40, 0x5a24, 0x11d2, { 0x80, 0x46, 0x0, 0x60, 0x8, 0x15, 0xa7, 0x91 } }
class nsLegendFrame : public nsBlockFrame {
public:
NS_DECLARE_FRAME_ACCESSOR(nsLegendFrame)
nsLegendFrame(nsStyleContext* aContext) : nsBlockFrame(aContext) {}
NS_DECL_QUERYFRAME
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,

Просмотреть файл

@ -386,11 +386,28 @@ nsListControlFrame::InvalidateFocus()
}
}
NS_QUERYFRAME_HEAD(nsListControlFrame)
NS_QUERYFRAME_ENTRY(nsIFormControlFrame)
NS_QUERYFRAME_ENTRY(nsIListControlFrame)
NS_QUERYFRAME_ENTRY(nsISelectControlFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsHTMLScrollFrame)
//---------------------------------------------------------
// Frames are not refcounted, no need to AddRef
NS_IMETHODIMP
nsListControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) {
*aInstancePtr = static_cast<nsIFormControlFrame*>(this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIListControlFrame))) {
*aInstancePtr = static_cast<nsIListControlFrame*>(this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsISelectControlFrame))) {
*aInstancePtr = static_cast<nsISelectControlFrame*>(this);
return NS_OK;
}
return nsHTMLScrollFrame::QueryInterface(aIID, aInstancePtr);
}
#ifdef ACCESSIBILITY
NS_IMETHODIMP nsListControlFrame::GetAccessible(nsIAccessible** aAccessible)
@ -1349,7 +1366,7 @@ void
nsListControlFrame::SetComboboxFrame(nsIFrame* aComboboxFrame)
{
if (nsnull != aComboboxFrame) {
mComboboxFrame = do_QueryFrame(aComboboxFrame);
aComboboxFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame),(void**) &mComboboxFrame);
}
}
@ -2184,7 +2201,8 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent)
if (!nsComboboxControlFrame::ToolkitHasNativePopup())
{
PRBool isDroppedDown = mComboboxFrame->IsDroppedDown();
nsIFrame* comboFrame = do_QueryFrame(mComboboxFrame);
nsIFrame* comboFrame;
CallQueryInterface(mComboboxFrame, &comboFrame);
nsWeakFrame weakFrame(comboFrame);
mComboboxFrame->ShowDropDown(!isDroppedDown);
if (!weakFrame.IsAlive())

Просмотреть файл

@ -80,7 +80,8 @@ class nsListControlFrame : public nsHTMLScrollFrame,
public:
friend nsIFrame* NS_NewListControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
NS_DECL_QUERYFRAME
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIFrame
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,

Просмотреть файл

@ -1004,13 +1004,34 @@ NS_NewTextControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
return new (aPresShell) nsTextControlFrame(aPresShell, aContext);
}
NS_QUERYFRAME_HEAD(nsTextControlFrame)
NS_QUERYFRAME_ENTRY(nsIFormControlFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
NS_QUERYFRAME_ENTRY(nsITextControlFrame)
if (nsIScrollableViewProvider::kFrameIID == id && IsScrollable())
return static_cast<nsIScrollableViewProvider*>(this);
NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame)
NS_IMPL_ADDREF_INHERITED(nsTextControlFrame, nsBoxFrame)
NS_IMPL_RELEASE_INHERITED(nsTextControlFrame, nsBoxFrame)
NS_IMETHODIMP
nsTextControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIFormControlFrame))) {
*aInstancePtr = static_cast<nsIFormControlFrame*>(this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIAnonymousContentCreator))) {
*aInstancePtr = static_cast<nsIAnonymousContentCreator*>(this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsITextControlFrame))) {
*aInstancePtr = static_cast<nsITextControlFrame*>(this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIScrollableViewProvider)) && IsScrollable()) {
*aInstancePtr = static_cast<nsIScrollableViewProvider*>(this);
return NS_OK;
}
return nsBoxFrame::QueryInterface(aIID, aInstancePtr);
}
#ifdef ACCESSIBILITY
NS_IMETHODIMP nsTextControlFrame::GetAccessible(nsIAccessible** aAccessible)
@ -1373,7 +1394,8 @@ nsTextControlFrame::CalcIntrinsicSize(nsIRenderingContext* aRenderingContext,
if (IsTextArea()) {
nsIFrame* first = GetFirstChild(nsnull);
nsIScrollableFrame *scrollableFrame = do_QueryFrame(first);
nsIScrollableFrame *scrollableFrame;
CallQueryInterface(first, &scrollableFrame);
NS_ASSERTION(scrollableFrame, "Child must be scrollable");
nsMargin scrollbarSizes =
@ -2796,7 +2818,8 @@ nsTextControlFrame::SetInitialChildList(nsIAtom* aListName,
// than descending from the root frame of the frame hierarchy.
first->AddStateBits(NS_FRAME_REFLOW_ROOT);
nsIScrollableFrame *scrollableFrame = do_QueryFrame(first);
nsIScrollableFrame *scrollableFrame = nsnull;
CallQueryInterface(first, &scrollableFrame);
NS_ASSERTION(scrollableFrame, "Child must be scrollable");
// we must turn off scrollbars for singleline text controls
@ -2841,7 +2864,10 @@ nsTextControlFrame::SetInitialChildList(nsIAtom* aListName,
nsIScrollableView* nsTextControlFrame::GetScrollableView()
{
nsIFrame* first = GetFirstChild(nsnull);
nsIScrollableFrame* scrollableFrame = do_QueryFrame(first);
nsIScrollableFrame* scrollableFrame = nsnull;
if (first) {
CallQueryInterface(first, &scrollableFrame);
}
return scrollableFrame ? scrollableFrame->GetScrollableView() : nsnull;
}

Просмотреть файл

@ -168,7 +168,7 @@ public:
NS_IMETHOD GetText(nsString* aText);
NS_DECL_QUERYFRAME
NS_DECL_ISUPPORTS_INHERITED
public: //for methods who access nsTextControlFrame directly
/**

Просмотреть файл

@ -83,7 +83,6 @@ REQUIRES += accessibility
endif
EXPORTS = \
nsQueryFrame.h \
nsFrameList.h \
nsHTMLParts.h \
nsHTMLReflowMetrics.h \

Просмотреть файл

@ -369,8 +369,8 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
nsFrame::IndentBy(stdout,nsBlockFrame::gNoiseIndent);
printf("abs pos ");
if (nsnull != aKidFrame) {
nsIFrameDebug *frameDebug = do_QueryFrame(aKidFrame);
if (frameDebug) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(CallQueryInterface(aKidFrame, &frameDebug))) {
nsAutoString name;
frameDebug->GetFrameName(name);
printf("%s ", NS_LossyConvertUTF16toASCII(name).get());
@ -513,8 +513,8 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
nsFrame::IndentBy(stdout,nsBlockFrame::gNoiseIndent - 1);
printf("abs pos ");
if (nsnull != aKidFrame) {
nsIFrameDebug *frameDebug = do_QueryFrame(aKidFrame);
if (frameDebug) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(CallQueryInterface(aKidFrame, &frameDebug))) {
nsAutoString name;
frameDebug->GetFrameName(name);
printf("%s ", NS_LossyConvertUTF16toASCII(name).get());

Просмотреть файл

@ -281,7 +281,7 @@ NS_IMETHODIMP BRFrame::GetAccessible(nsIAccessible** aAccessible)
// "bogus node" used when there is no text in the control
return NS_ERROR_FAILURE;
}
return accService->CreateHTMLBRAccessible(this, aAccessible);
return accService->CreateHTMLBRAccessible(static_cast<nsIFrame*>(this), aAccessible);
}
#endif

Просмотреть файл

@ -266,6 +266,8 @@ RecordReflowStatus(PRBool aChildIsBlock, nsReflowStatus aFrameReflowStatus)
//----------------------------------------------------------------------
const nsIID kBlockFrameCID = NS_BLOCK_FRAME_CID;
nsIFrame*
NS_NewBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags)
{
@ -328,9 +330,17 @@ nsBlockFrame::GetLineIterator()
return it;
}
NS_QUERYFRAME_HEAD(nsBlockFrame)
NS_QUERYFRAME_ENTRY(nsBlockFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrameSuper)
NS_IMETHODIMP
nsBlockFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(kBlockFrameCID)) {
*aInstancePtr = static_cast<void*>(static_cast<nsBlockFrame*>(this));
return NS_OK;
}
return nsBlockFrameSuper::QueryInterface(aIID, aInstancePtr);
}
nsSplittableType
nsBlockFrame::GetSplittableType() const
@ -439,8 +449,9 @@ nsBlockFrame::List(FILE* out, PRInt32 aIndent) const
}
fputs("<\n", out);
while (kid) {
nsIFrameDebug *frameDebug = do_QueryFrame(kid);
if (frameDebug) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(CallQueryInterface(kid, &frameDebug))) {
frameDebug->List(out, aIndent + 1);
}
kid = kid->GetNextSibling();
@ -821,7 +832,8 @@ CalculateContainingBlockSizeForAbsolutes(const nsHTMLReflowState& aReflowState,
if (aLastRS != &aReflowState) {
// Scrollbars need to be specifically excluded, if present, because they are outside the
// padding-edge. We need better APIs for getting the various boxes from a frame.
nsIScrollableFrame* scrollFrame = do_QueryFrame(aLastRS->frame);
nsIScrollableFrame* scrollFrame;
CallQueryInterface(aLastRS->frame, &scrollFrame);
nsMargin scrollbars(0,0,0,0);
if (scrollFrame) {
scrollbars =

Просмотреть файл

@ -127,6 +127,11 @@ class nsIntervalSet;
#define nsBlockFrameSuper nsHTMLContainerFrame
#define NS_BLOCK_FRAME_CID \
{ 0xa6cf90df, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
extern const nsIID kBlockFrameCID;
/*
* Base class for block and inline frames.
* The block frame has an additional named child list:
@ -137,8 +142,6 @@ class nsIntervalSet;
class nsBlockFrame : public nsBlockFrameSuper
{
public:
NS_DECLARE_FRAME_ACCESSOR(nsBlockFrame)
typedef nsLineList::iterator line_iterator;
typedef nsLineList::const_iterator const_line_iterator;
typedef nsLineList::reverse_iterator reverse_line_iterator;
@ -155,8 +158,8 @@ public:
friend nsIFrame* NS_NewBlockFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRUint32 aFlags);
// nsQueryFrame
NS_DECL_QUERYFRAME
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIFrame
NS_IMETHOD Init(nsIContent* aContent,

Просмотреть файл

@ -1643,8 +1643,8 @@ nsContainerFrame::List(FILE* out, PRInt32 aIndent) const
NS_ASSERTION(kid->GetParent() == (nsIFrame*)this, "bad parent frame pointer");
// Have the child frame list
nsIFrameDebug *frameDebug = do_QueryFrame(kid);
if (frameDebug) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(kid->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) {
frameDebug->List(out, aIndent + 1);
}
kid = kid->GetNextSibling();

Просмотреть файл

@ -372,6 +372,7 @@ nsFloatManager::List(FILE* out) const
fi.mRect.x, fi.mRect.y, fi.mRect.width, fi.mRect.height,
fi.mLeftYMost, fi.mRightYMost);
}
return NS_OK;
}
#endif

Просмотреть файл

@ -273,8 +273,10 @@ nsIFrameDebug::RootFrameList(nsPresContext* aPresContext, FILE* out, PRInt32 aIn
if (nsnull != shell) {
nsIFrame* frame = shell->FrameManager()->GetRootFrame();
if(nsnull != frame) {
nsIFrameDebug* debugFrame = do_QueryFrame(frame);
if (debugFrame)
nsIFrameDebug* debugFrame;
nsresult rv;
rv = frame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&debugFrame);
if(NS_SUCCEEDED(rv))
debugFrame->List(out, aIndent);
}
}
@ -364,12 +366,42 @@ nsFrame::~nsFrame()
mStyleContext->Release();
}
NS_QUERYFRAME_HEAD(nsFrame)
NS_QUERYFRAME_ENTRY(nsIFrame)
/////////////////////////////////////////////////////////////////////////////
// nsISupports
NS_IMETHODIMP
nsFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
#ifdef DEBUG
NS_QUERYFRAME_ENTRY(nsIFrameDebug)
if (aIID.Equals(NS_GET_IID(nsIFrameDebug))) {
*aInstancePtr = static_cast<nsIFrameDebug*>(this);
return NS_OK;
}
#endif
NS_QUERYFRAME_TAIL
if (aIID.Equals(NS_GET_IID(nsIFrame)) ||
aIID.Equals(NS_GET_IID(nsISupports))) {
*aInstancePtr = static_cast<nsIFrame*>(this);
return NS_OK;
}
*aInstancePtr = nsnull;
return NS_ERROR_NO_INTERFACE;
}
nsrefcnt nsFrame::AddRef(void)
{
NS_WARNING("not supported for frames");
return 1;
}
nsrefcnt nsFrame::Release(void)
{
NS_WARNING("not supported for frames");
return 1;
}
/////////////////////////////////////////////////////////////////////////////
// nsIFrame
@ -1693,8 +1725,9 @@ nsFrame::GetDataForTableSelection(const nsFrameSelection *aFrameSelection,
while (frame && NS_SUCCEEDED(result))
{
// Check for a table cell by querying to a known CellFrame interface
nsITableCellLayout *cellElement = do_QueryFrame(frame);
if (cellElement)
nsITableCellLayout *cellElement;
result = (frame)->QueryInterface(NS_GET_IID(nsITableCellLayout), (void **)&cellElement);
if (NS_SUCCEEDED(result) && cellElement)
{
foundCell = PR_TRUE;
//TODO: If we want to use proximity to top or left border
@ -1706,8 +1739,9 @@ nsFrame::GetDataForTableSelection(const nsFrameSelection *aFrameSelection,
// If not a cell, check for table
// This will happen when starting frame is the table or child of a table,
// such as a row (we were inbetween cells or in table border)
nsITableLayout *tableElement = do_QueryFrame(frame);
if (tableElement)
nsITableLayout *tableElement;
result = (frame)->QueryInterface(NS_GET_IID(nsITableLayout), (void **)&tableElement);
if (NS_SUCCEEDED(result) && tableElement)
{
foundTable = PR_TRUE;
//TODO: How can we select row when along left table edge
@ -4259,8 +4293,8 @@ nsFrame::GetSelectionController(nsPresContext *aPresContext, nsISelectionControl
nsIFrame *frame = this;
while (frame && (frame->GetStateBits() & NS_FRAME_INDEPENDENT_SELECTION)) {
nsITextControlFrame *tcf = do_QueryFrame(frame);
if (tcf) {
nsITextControlFrame *tcf;
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsITextControlFrame),(void**)&tcf))) {
NS_IF_ADDREF(*aSelCon = tcf->GetOwnedSelectionController());
return NS_OK;
}
@ -4284,8 +4318,8 @@ nsIFrame::GetConstFrameSelection()
{
nsIFrame *frame = this;
while (frame && (frame->GetStateBits() & NS_FRAME_INDEPENDENT_SELECTION)) {
nsITextControlFrame *tcf = do_QueryFrame(frame);
if (tcf) {
nsITextControlFrame *tcf;
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsITextControlFrame),(void**)&tcf))) {
return tcf->GetOwnedFrameSelection();
}
frame = frame->GetParent();
@ -4373,8 +4407,9 @@ nsFrame::DumpBaseRegressionData(nsPresContext* aPresContext, FILE* out, PRInt32
}
aIndent++;
while (kid) {
nsIFrameDebug* frameDebug = do_QueryFrame(kid);
if (kid) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(kid->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) {
frameDebug->DumpRegressionData(aPresContext, out, aIndent, aIncludeStyleData);
}
kid = kid->GetNextSibling();
@ -4783,8 +4818,9 @@ FindBlockFrameOrBR(nsIFrame* aFrame, nsDirection aDirection)
// Treat form controls as inline leaves
// XXX we really need a way to determine whether a frame is inline-level
nsIFormControlFrame* fcf = do_QueryFrame(aFrame);
if (fcf)
nsIFormControlFrame* fcf; // used only for QI
nsresult rv = aFrame->QueryInterface(NS_GET_IID(nsIFormControlFrame), (void**)&fcf);
if (NS_SUCCEEDED(rv))
return result;
// Check the frame itself
@ -6050,7 +6086,7 @@ nsIFrame::IsFocusable(PRInt32 *aTabIndex, PRBool aWithMouse)
// because the extra focus outlines are considered unnecessarily ugly.
// When clicked on, the selection position within the element
// will be enough to make them keyboard scrollable.
nsIScrollableFrame *scrollFrame = do_QueryFrame(this);
nsCOMPtr<nsIScrollableFrame> scrollFrame = do_QueryInterface(this);
if (scrollFrame) {
nsMargin margin = scrollFrame->GetActualScrollbarSizes();
if (margin.top || margin.right || margin.bottom || margin.left) {
@ -7336,8 +7372,8 @@ void DR_State::DisplayFrameTypeInfo(nsIFrame* aFrame,
}
if(!strcmp(frameTypeInfo->mNameAbbrev, "unknown")) {
nsAutoString name;
nsIFrameDebug* frameDebug = do_QueryFrame(aFrame);
if (frameDebug) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(aFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) {
frameDebug->GetFrameName(name);
printf("%s %p ", NS_LossyConvertUTF16toASCII(name).get(), (void*)aFrame);
}

Просмотреть файл

@ -156,8 +156,8 @@ private:
public:
// nsQueryFrame
NS_DECL_QUERYFRAME
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIFrame
NS_IMETHOD Init(nsIContent* aContent,
@ -442,8 +442,9 @@ public:
static void ListTag(FILE* out, nsIFrame* aFrame) {
nsAutoString tmp;
nsIFrameDebug* frameDebug = do_QueryFrame(aFrame);
if (frameDebug) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(aFrame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) {
frameDebug->GetFrameName(tmp);
}
fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
@ -621,6 +622,10 @@ private:
NS_IMETHODIMP RefreshSizeCache(nsBoxLayoutState& aState);
virtual nsILineIterator* GetLineIterator();
protected:
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
};
// Start Display Reflow Debugging

Просмотреть файл

@ -120,7 +120,10 @@ public:
NS_IMETHOD GetFrameName(nsAString& aResult) const;
#endif
NS_DECL_QUERYFRAME
// nsISupports
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
NS_IMETHOD_(nsrefcnt) AddRef(void) { return 2; }
NS_IMETHOD_(nsrefcnt) Release(void) { return 1; }
virtual nsIAtom* GetType() const;
@ -239,9 +242,20 @@ NS_IMETHODIMP nsSubDocumentFrame::GetAccessible(nsIAccessible** aAccessible)
}
#endif
NS_QUERYFRAME_HEAD(nsSubDocumentFrame)
NS_QUERYFRAME_ENTRY(nsIFrameFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsLeafFrame)
//--------------------------------------------------------------
// Frames are not refcounted, no need to AddRef
NS_IMETHODIMP
nsSubDocumentFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsIFrameFrame))) {
*aInstancePtr = static_cast<nsIFrameFrame*>(this);
return NS_OK;
}
return nsLeafFrame::QueryInterface(aIID, aInstancePtr);
}
NS_IMETHODIMP
nsSubDocumentFrame::Init(nsIContent* aContent,
@ -642,7 +656,10 @@ nsSubDocumentFrame::AttributeChanged(PRInt32 aNameSpaceID,
if (parentFrame) {
// There is no interface for nsHTMLFramesetFrame so QI'ing to
// concrete class, yay!
nsHTMLFramesetFrame* framesetFrame = do_QueryFrame(parentFrame);
nsHTMLFramesetFrame* framesetFrame = nsnull;
parentFrame->QueryInterface(NS_GET_IID(nsHTMLFramesetFrame),
(void **)&framesetFrame);
if (framesetFrame) {
framesetFrame->RecalculateBorderResize();
}

Просмотреть файл

@ -414,8 +414,8 @@ nsFrameList::List(FILE* out) const
fputs("<\n", out);
for (nsIFrame* frame = mFirstChild; frame;
frame = frame->GetNextSibling()) {
nsIFrameDebug *frameDebug = do_QueryFrame(frame);
if (frameDebug) {
nsIFrameDebug* frameDebug;
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsIFrameDebug), (void**)&frameDebug))) {
frameDebug->List(out, 1);
}
}

Просмотреть файл

@ -253,9 +253,18 @@ nsHTMLFramesetFrame::~nsHTMLFramesetFrame()
FrameResizePrefCallback, this);
}
NS_QUERYFRAME_HEAD(nsHTMLFramesetFrame)
NS_QUERYFRAME_ENTRY(nsHTMLFramesetFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame)
NS_IMETHODIMP
nsHTMLFramesetFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
if (aIID.Equals(NS_GET_IID(nsHTMLFramesetFrame))) {
*aInstancePtr = (void*)this;
return NS_OK;
}
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}
// static
int
@ -302,7 +311,9 @@ nsHTMLFramesetFrame::Init(nsIContent* aContent,
nsIFrame* parentFrame = GetParent();
mTopLevelFrameset = (nsHTMLFramesetFrame*)this;
while (parentFrame) {
nsHTMLFramesetFrame* frameset = do_QueryFrame(parentFrame);
nsHTMLFramesetFrame* frameset = nsnull;
CallQueryInterface(parentFrame, &frameset);
if (frameset) {
mTopLevelFrameset = frameset;
parentFrame = parentFrame->GetParent();
@ -1298,7 +1309,8 @@ nsHTMLFramesetFrame::IsLeaf() const
PRBool
nsHTMLFramesetFrame::ChildIsFrameset(nsIFrame* aChild)
{
nsHTMLFramesetFrame* childFrame = do_QueryFrame(aChild);
nsIFrame* childFrame = nsnull;
aChild->QueryInterface(NS_GET_IID(nsHTMLFramesetFrame), (void**)&childFrame);
if (childFrame) {
return PR_TRUE;
}

Просмотреть файл

@ -59,6 +59,10 @@ class nsHTMLFramesetBorderFrame;
class nsGUIEvent;
class nsHTMLFramesetFrame;
#define NS_IFRAMESETFRAME_IID \
{ 0xf47deac0, 0x4200, 0x11d2, \
{ 0x80, 0x3c, 0x0, 0x60, 0x8, 0x15, 0xa7, 0x91 } }
#define NO_COLOR 0xFFFFFFFA
struct nsBorderColor
@ -104,13 +108,14 @@ struct nsFramesetDrag {
class nsHTMLFramesetFrame : public nsHTMLContainerFrame
{
public:
NS_DECLARE_FRAME_ACCESSOR(nsHTMLFramesetFrame)
// Woohoo, concrete class with an IID!
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFRAMESETFRAME_IID)
nsHTMLFramesetFrame(nsStyleContext* aContext);
virtual ~nsHTMLFramesetFrame();
NS_DECL_QUERYFRAME
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD Init(nsIContent* aContent,
nsIFrame* aParent,
@ -267,4 +272,6 @@ protected:
PRBool mForceFrameResizability;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsHTMLFramesetFrame, NS_IFRAMESETFRAME_IID)
#endif

Просмотреть файл

@ -878,6 +878,18 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
return rv;
}
NS_IMETHODIMP_(nsrefcnt)
nsHTMLScrollFrame::AddRef(void)
{
return NS_OK;
}
NS_IMETHODIMP_(nsrefcnt)
nsHTMLScrollFrame::Release(void)
{
return NS_OK;
}
#ifdef NS_DEBUG
NS_IMETHODIMP
nsHTMLScrollFrame::GetFrameName(nsAString& aResult) const
@ -911,15 +923,15 @@ nsHTMLScrollFrame::CurPosAttributeChanged(nsIContent* aChild,
mInner.CurPosAttributeChanged(aChild);
}
NS_QUERYFRAME_HEAD(nsHTMLScrollFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
NS_QUERYFRAME_ENTRY(nsIScrollableFrame)
NS_QUERYFRAME_ENTRY(nsIScrollableViewProvider)
NS_QUERYFRAME_ENTRY(nsIStatefulFrame)
#ifdef DEBUG
NS_QUERYFRAME_ENTRY(nsIFrameDebug)
NS_INTERFACE_MAP_BEGIN(nsHTMLScrollFrame)
NS_INTERFACE_MAP_ENTRY(nsIAnonymousContentCreator)
#ifdef NS_DEBUG
NS_INTERFACE_MAP_ENTRY(nsIFrameDebug)
#endif
NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame)
NS_INTERFACE_MAP_ENTRY(nsIScrollableFrame)
NS_INTERFACE_MAP_ENTRY(nsIScrollableViewProvider)
NS_INTERFACE_MAP_ENTRY(nsIStatefulFrame)
NS_INTERFACE_MAP_END_INHERITING(nsHTMLContainerFrame)
//----------nsXULScrollFrame-------------------------------------------
@ -1230,6 +1242,18 @@ nsXULScrollFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
}
#endif
NS_IMETHODIMP_(nsrefcnt)
nsXULScrollFrame::AddRef(void)
{
return NS_OK;
}
NS_IMETHODIMP_(nsrefcnt)
nsXULScrollFrame::Release(void)
{
return NS_OK;
}
#ifdef NS_DEBUG
NS_IMETHODIMP
nsXULScrollFrame::GetFrameName(nsAString& aResult) const
@ -1254,16 +1278,18 @@ nsXULScrollFrame::DoLayout(nsBoxLayoutState& aState)
return rv;
}
NS_QUERYFRAME_HEAD(nsXULScrollFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
NS_QUERYFRAME_ENTRY(nsIScrollableFrame)
NS_QUERYFRAME_ENTRY(nsIScrollableViewProvider)
NS_QUERYFRAME_ENTRY(nsIStatefulFrame)
#ifdef DEBUG
NS_QUERYFRAME_ENTRY(nsIFrameDebug)
NS_INTERFACE_MAP_BEGIN(nsXULScrollFrame)
NS_INTERFACE_MAP_ENTRY(nsIAnonymousContentCreator)
#ifdef NS_DEBUG
NS_INTERFACE_MAP_ENTRY(nsIFrameDebug)
#endif
NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame)
NS_INTERFACE_MAP_ENTRY(nsIScrollableFrame)
NS_INTERFACE_MAP_ENTRY(nsIScrollableViewProvider)
NS_INTERFACE_MAP_ENTRY(nsIStatefulFrame)
NS_INTERFACE_MAP_END_INHERITING(nsBoxFrame)
//-------------------- Inner ----------------------
nsGfxScrollFrameInner::nsGfxScrollFrameInner(nsContainerFrame* aOuter,
@ -1302,6 +1328,16 @@ nsGfxScrollFrameInner::~nsGfxScrollFrameInner()
{
}
NS_IMETHODIMP_(nsrefcnt) nsGfxScrollFrameInner::AddRef(void)
{
return 2;
}
NS_IMETHODIMP_(nsrefcnt) nsGfxScrollFrameInner::Release(void)
{
return 1;
}
NS_IMPL_QUERY_INTERFACE1(nsGfxScrollFrameInner, nsIScrollPositionListener)
nsresult
@ -1376,15 +1412,16 @@ nsGfxScrollFrameInner::NeedsClipWidget() const
return PR_FALSE;
/* If we're a form element, we don't need a widget. */
nsIFormControlFrame* fcFrame = do_QueryFrame(parentFrame);
if (fcFrame) {
nsIFormControlFrame* fcFrame;
if ((NS_SUCCEEDED(parentFrame->QueryInterface(NS_GET_IID(nsIFormControlFrame), (void**)&fcFrame)))) {
return PR_FALSE;
}
}
// Scrollports that don't ever show associated scrollbars don't get
// widgets, because they will seldom actually be scrolled.
nsIScrollableFrame *scrollableFrame = do_QueryFrame(mOuter);
nsIScrollableFrame *scrollableFrame;
CallQueryInterface(mOuter, &scrollableFrame);
ScrollbarStyles scrollbars = scrollableFrame->GetScrollbarStyles();
if ((scrollbars.mHorizontal == NS_STYLE_OVERFLOW_HIDDEN
|| scrollbars.mHorizontal == NS_STYLE_OVERFLOW_VISIBLE)
@ -1650,7 +1687,8 @@ nsGfxScrollFrameInner::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
}
}
nsIScrollableFrame *scrollable = do_QueryFrame(mOuter);
nsIScrollableFrame *scrollable;
CallQueryInterface(mOuter, &scrollable);
// At this stage in frame construction, the document element and/or
// BODY overflow styles have not yet been propagated to the
@ -1675,7 +1713,8 @@ nsGfxScrollFrameInner::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
}
// The anonymous <div> used by <inputs> never gets scrollbars.
nsITextControlFrame* textFrame = do_QueryFrame(parent);
nsITextControlFrame* textFrame = nsnull;
CallQueryInterface(parent, &textFrame);
if (textFrame) {
// Make sure we are not a text area.
nsCOMPtr<nsIDOMHTMLTextAreaElement> textAreaElement(do_QueryInterface(parent->GetContent()));
@ -2675,13 +2714,14 @@ nsGfxScrollFrameInner::SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisibl
if (!aScrollbar)
return;
nsIScrollbarFrame* scrollbar = do_QueryFrame(aScrollbar);
nsIScrollbarFrame* scrollbar;
CallQueryInterface(aScrollbar, &scrollbar);
if (scrollbar) {
// See if we have a mediator.
nsIScrollbarMediator* mediator = scrollbar->GetScrollbarMediator();
if (mediator) {
// Inform the mediator of the visibility change.
mediator->VisibilityChanged(aVisible);
mediator->VisibilityChanged(scrollbar, aVisible);
}
}
}
@ -2779,7 +2819,8 @@ nsGfxScrollFrameInner::SaveState(nsIStatefulFrame::SpecialStateID aStateID)
return nsnull;
}
nsIScrollbarMediator* mediator = do_QueryFrame(GetScrolledFrame());
nsIScrollbarMediator* mediator;
CallQueryInterface(GetScrolledFrame(), &mediator);
if (mediator) {
// child handles its own scroll state, so don't bother saving state here
return nsnull;

Просмотреть файл

@ -66,8 +66,8 @@ class nsGfxScrollFrameInner : public nsIScrollPositionListener,
public nsIReflowCallback {
public:
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
NS_IMETHOD_(nsrefcnt) AddRef(void) { return 2; }
NS_IMETHOD_(nsrefcnt) Release(void) { return 1; }
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
nsGfxScrollFrameInner(nsContainerFrame* aOuter, PRBool aIsRoot,
PRBool aIsXUL);
@ -248,7 +248,7 @@ class nsHTMLScrollFrame : public nsHTMLContainerFrame,
public:
friend nsIFrame* NS_NewHTMLScrollFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot);
NS_DECL_QUERYFRAME
NS_DECL_ISUPPORTS
// Called to set the child frames. We typically have three: the scroll area,
// the vertical scrollbar, and the horizontal scrollbar.
@ -433,8 +433,6 @@ class nsXULScrollFrame : public nsBoxFrame,
public nsIAnonymousContentCreator,
public nsIStatefulFrame {
public:
NS_DECL_QUERYFRAME
friend nsIFrame* NS_NewXULScrollFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, PRBool aIsRoot);
// Called to set the child frames. We typically have three: the scroll area,
@ -495,6 +493,9 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<nsIContent*>& aElements);
// nsIBox methods
NS_DECL_ISUPPORTS
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);

Просмотреть файл

@ -87,9 +87,7 @@ public:
: nsHTMLContainerFrame(aContext), mDoPaintFocus(PR_FALSE),
mAbsoluteContainer(nsGkAtoms::absoluteList) {}
NS_DECL_QUERYFRAME
// nsISupports (nsIScrollPositionListener)
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD Init(nsIContent* aContent,
@ -190,11 +188,24 @@ NS_NewCanvasFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
return new (aPresShell)CanvasFrame(aContext);
}
NS_IMPL_QUERY_INTERFACE1(CanvasFrame, nsIScrollPositionListener)
//--------------------------------------------------------------
// Frames are not refcounted, no need to AddRef
NS_IMETHODIMP
CanvasFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_PRECONDITION(aInstancePtr, "null out param");
NS_QUERYFRAME_HEAD(CanvasFrame)
NS_QUERYFRAME_ENTRY(nsICanvasFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame)
if (aIID.Equals(NS_GET_IID(nsIScrollPositionListener))) {
*aInstancePtr = static_cast<nsIScrollPositionListener*>(this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsICanvasFrame))) {
*aInstancePtr = static_cast<nsICanvasFrame*>(this);
return NS_OK;
}
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}
NS_IMETHODIMP
CanvasFrame::Init(nsIContent* aContent,
@ -396,7 +407,8 @@ nsRect CanvasFrame::CanvasArea() const
{
nsRect result(GetOverflowRect());
nsIScrollableFrame *scrollableFrame = do_QueryFrame(GetParent());
nsIScrollableFrame *scrollableFrame;
CallQueryInterface(GetParent(), &scrollableFrame);
if (scrollableFrame) {
nsIScrollableView* scrollableView = scrollableFrame->GetScrollableView();
nsRect vcr = scrollableView->View()->GetBounds();
@ -537,7 +549,9 @@ CanvasFrame::PaintFocus(nsIRenderingContext& aRenderingContext, nsPoint aPt)
{
nsRect focusRect(aPt, GetSize());
nsIScrollableFrame *scrollableFrame = do_QueryFrame(GetParent());
nsIScrollableFrame *scrollableFrame;
CallQueryInterface(GetParent(), &scrollableFrame);
if (scrollableFrame) {
nsIScrollableView* scrollableView = scrollableFrame->GetScrollableView();
nsRect vcr = scrollableView->View()->GetBounds();

Просмотреть файл

@ -43,13 +43,19 @@
#ifndef nsIAnonymousContentCreator_h___
#define nsIAnonymousContentCreator_h___
#include "nsQueryFrame.h"
#include "nsISupports.h"
#include "nsIContent.h"
class nsPresContext;
class nsIFrame;
template <class T> class nsTArray;
// {7568a516-3831-4db4-88a7-a42578acc136}
#define NS_IANONYMOUS_CONTENT_CREATOR_IID \
{ 0x7568a516, 0x3831, 0x4db4, \
{ 0x88, 0xa7, 0xa4, 0x25, 0x78, 0xac, 0xc1, 0x36 } }
/**
* Any source for anonymous content can implement this interface to provide it.
* HTML frames like nsFileControlFrame currently use this as well as XUL frames
@ -57,10 +63,9 @@ template <class T> class nsTArray;
*
* @see nsCSSFrameConstructor
*/
class nsIAnonymousContentCreator
{
class nsIAnonymousContentCreator : public nsISupports {
public:
NS_DECLARE_FRAME_ACCESSOR(nsIAnonymousContentCreator)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IANONYMOUS_CONTENT_CREATOR_IID)
/**
* Creates "native" anonymous content and adds the created content to
@ -88,5 +93,8 @@ public:
virtual void PostCreateFrames() {}
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIAnonymousContentCreator,
NS_IANONYMOUS_CONTENT_CREATOR_IID)
#endif

Просмотреть файл

@ -40,12 +40,16 @@
#ifndef nsICanvasFrame_h__
#define nsICanvasFrame_h__
#include "nsQueryFrame.h"
#include "nsISupports.h"
class nsICanvasFrame
// IID for the nsICanvasFrame interface
#define NS_ICANVASFRAME_IID \
{ 0x9df7db77, 0x49a2, 0x11d5, {0x97, 0x92, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x56} }
class nsICanvasFrame : public nsISupports
{
public:
NS_DECLARE_FRAME_ACCESSOR(nsICanvasFrame)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICANVASFRAME_IID)
/** SetHasFocus tells the CanvasFrame to draw with focus ring
* @param aHasFocus PR_TRUE to show focus ring, PR_FALSE to hide it
@ -54,5 +58,7 @@ public:
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsICanvasFrame, NS_ICANVASFRAME_IID)
#endif // nsICanvasFrame_h__

Просмотреть файл

@ -47,7 +47,7 @@
variables in this file. -dwh */
#include <stdio.h>
#include "nsQueryFrame.h"
#include "nsISupports.h"
#include "nsEvent.h"
#include "nsStyleStruct.h"
#include "nsStyleContext.h"
@ -464,10 +464,10 @@ typedef PRBool nsDidReflowStatus;
* If you're not in layout but you must call functions in here, at least
* restrict yourself to calling virtual methods, which won't hurt you as badly.
*/
class nsIFrame : public nsQueryFrame
class nsIFrame : public nsISupports
{
public:
NS_DECLARE_FRAME_ACCESSOR(nsIFrame)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFRAME_IID)
nsPresContext* PresContext() const {
return GetStyleContext()->GetRuleNode()->GetPresContext();
@ -2348,6 +2348,9 @@ protected:
nsresult PeekOffsetParagraph(nsPeekOffsetStruct *aPos);
private:
NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
NS_IMETHOD_(nsrefcnt) Release(void) = 0;
nsRect* GetOverflowAreaProperty(PRBool aCreateIfNecessary = PR_FALSE);
};
@ -2422,4 +2425,7 @@ private:
nsIFrame* mFrame;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIFrame, NS_IFRAME_IID)
#endif /* nsIFrame_h___ */

Просмотреть файл

@ -40,17 +40,23 @@
#ifndef nsIFrameDebug_h___
#define nsIFrameDebug_h___
#include "nsISupports.h"
#include "nsIFrame.h"
class nsPresContext;
struct PRLogModuleInfo;
// IID for the nsIFrameDebug interface {a6cf9069-15b3-11d2-932e-00805f8add32}
#define NS_IFRAMEDEBUG_IID \
{ 0xa6cf9069, 0x15b3, 0x11d2, \
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
/**
* Debug related functions
*/
class nsIFrameDebug {
class nsIFrameDebug : public nsISupports {
public:
NS_DECLARE_FRAME_ACCESSOR(nsIFrameDebug)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFRAMEDEBUG_IID)
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const = 0;
/**
@ -128,6 +134,12 @@ public:
static PRBool GetShowEventTargetFrameBorder();
static void PrintDisplayList(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList);
private:
NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
NS_IMETHOD_(nsrefcnt) Release(void) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIFrameDebug, NS_IFRAMEDEBUG_IID)
#endif /* nsIFrameDebug_h___ */

Просмотреть файл

@ -45,10 +45,14 @@
class nsIDocShell;
class nsIFrameFrame
#define NS_IFRAMEFRAME_IID \
{ 0x22e34108, 0xc24b, 0x40ea, { \
0xb9, 0x79, 0x50, 0x18, 0x38, 0x8d, 0xd5, 0x88 } }
class nsIFrameFrame : public nsISupports
{
public:
NS_DECLARE_FRAME_ACCESSOR(nsIFrameFrame)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFRAMEFRAME_IID)
NS_IMETHOD GetDocShell(nsIDocShell **aDocShell) = 0;
@ -61,4 +65,6 @@ public:
virtual void EndSwapDocShells(nsIFrame* aOther) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIFrameFrame, NS_IFRAMEFRAME_IID)
#endif

Просмотреть файл

@ -43,19 +43,25 @@
#ifndef nsIImageFrame_h___
#define nsIImageFrame_h___
#include "nsISupports.h"
struct nsSize;
class imgIRequest;
class nsPresContext;
class nsIImageMap;
class nsIImageFrame
{
// {B261A0D5-E696-11d4-9885-00C04FA0CF4B}
#define NS_IIMAGEFRAME_IID \
{ 0xb261a0d5, 0xe696, 0x11d4, { 0x98, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xcf, 0x4b } }
class nsIImageFrame : public nsISupports {
public:
NS_DECLARE_FRAME_ACCESSOR(nsIImageFrame)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IIMAGEFRAME_IID)
NS_IMETHOD GetIntrinsicImageSize(nsSize& aSize) = 0;
NS_IMETHOD GetImageMap(nsPresContext *aPresContext, nsIImageMap **aImageMap) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIImageFrame, NS_IIMAGEFRAME_IID)
#endif /* nsIImageFrame_h___ */

Просмотреть файл

@ -47,10 +47,13 @@
class nsIPluginInstance;
class nsIObjectFrame : public nsQueryFrame
{
// {3e2df1fe-a898-4e2e-8763-4ca904fa338e}
#define NS_IOBJECTFRAME_IID \
{ 0x3e2df1fe, 0xa898, 0x4e2e, { 0x87, 0x63, 0x4c, 0xa9, 0x4, 0xfa, 0x33, 0x8e } }
class nsIObjectFrame : public nsISupports {
public:
NS_DECLARE_FRAME_ACCESSOR(nsIObjectFrame)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IOBJECTFRAME_IID)
NS_IMETHOD GetPluginInstance(nsIPluginInstance*& aPluginInstance) = 0;
@ -91,4 +94,6 @@ public:
virtual void StopPlugin() = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIObjectFrame, NS_IOBJECTFRAME_IID)
#endif /* nsIObjectFrame_h___ */

Просмотреть файл

@ -37,21 +37,27 @@
#ifndef nsIPageSequenceFrame_h___
#define nsIPageSequenceFrame_h___
#include "nsQueryFrame.h"
#include "nsISupports.h"
#include "nsRect.h"
class nsPresContext;
class nsIPrintSettings;
// IID for the nsIPageSequenceFrame interface
// a6cf90d2-15b3-11d2-932e-00805f8add32
#define NS_IPAGESEQUENCEFRAME_IID \
{ 0xa6cf90d2, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
//----------------------------------------------------------------------
/**
* Interface for accessing special capabilities of the page sequence frame.
*
* Today all that exists are member functions for printing.
*/
class nsIPageSequenceFrame : public nsQueryFrame
{
class nsIPageSequenceFrame : public nsISupports {
public:
NS_DECLARE_FRAME_ACCESSOR(nsIPageSequenceFrame)
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPAGESEQUENCEFRAME_IID)
/**
* Print the set of pages.
@ -86,8 +92,14 @@ public:
// For Shrink To Fit
NS_IMETHOD GetSTFPercent(float& aSTFPercent) = 0;
private:
NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
NS_IMETHOD_(nsrefcnt) Release(void) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIPageSequenceFrame, NS_IPAGESEQUENCEFRAME_IID)
#endif /* nsIPageSequenceFrame_h___ */

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше