diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 9f28646b506..c5e64c06fb7 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -855,6 +855,7 @@ nsCSSFrameConstructor::CreateInputFrame(nsIPresContext *aPresContext, rv = ConstructButtonControlFrame(aPresContext, aFrame); } else if (val.EqualsIgnoreCase("image")) { + //rv = NS_NewGfxImageControlFrame(&aFrame); rv = NS_NewImageControlFrame(&aFrame); } else if (val.EqualsIgnoreCase("password")) { @@ -4520,19 +4521,41 @@ nsCSSFrameConstructor::GetFrameFor(nsIPresShell* aPresShell, aPresShell->GetPrimaryFrameFor(aContent, &frame); if (nsnull != frame) { - // If the primary frame is a scroll frame, then get the scrolled frame. - // That's the frame that gets the reflow command - const nsStyleDisplay* display; - frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display); + // Check to see if the content is a select and + // then if it has a drop down (thus making it a combobox) + // The drop down is a ListControlFrame derived from a + // nsScrollFrame then get the area frame and + // that will be the parent + nsCOMPtr selectElement; + nsresult res = aContent->QueryInterface(nsCOMTypeInfo::GetIID(), + (void**)getter_AddRefs(selectElement)); + if (NS_SUCCEEDED(res) && selectElement) { + nsIComboboxControlFrame * comboboxFrame; + res = frame->QueryInterface(nsCOMTypeInfo::GetIID(), + (void**)&comboboxFrame); + if (comboboxFrame) { + nsIFrame * listFrame; + comboboxFrame->GetDropDown(&listFrame); + if (nsnull != listFrame) { + listFrame->FirstChild(nsnull, &frame); + } + } + } else { - if (display->IsBlockLevel() && IsScrollable(aPresContext, display)) { - frame->FirstChild(nsnull, &frame); - } - // if we get an outer table frame use its 1st child which is a table inner frame - // if we get a table cell frame use its 1st child which is an area frame - else if ((NS_STYLE_DISPLAY_TABLE == display->mDisplay) || - (NS_STYLE_DISPLAY_TABLE_CELL == display->mDisplay)) { - frame->FirstChild(nsnull, &frame); + // If the primary frame is a scroll frame, then get the scrolled frame. + // That's the frame that gets the reflow command + const nsStyleDisplay* display; + frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display); + + if (display->IsBlockLevel() && IsScrollable(aPresContext, display)) { + frame->FirstChild(nsnull, &frame); + } + // if we get an outer table frame use its 1st child which is a table inner frame + // if we get a table cell frame use its 1st child which is an area frame + else if ((NS_STYLE_DISPLAY_TABLE == display->mDisplay) || + (NS_STYLE_DISPLAY_TABLE_CELL == display->mDisplay)) { + frame->FirstChild(nsnull, &frame); + } } } diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index 9f28646b506..c5e64c06fb7 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -855,6 +855,7 @@ nsCSSFrameConstructor::CreateInputFrame(nsIPresContext *aPresContext, rv = ConstructButtonControlFrame(aPresContext, aFrame); } else if (val.EqualsIgnoreCase("image")) { + //rv = NS_NewGfxImageControlFrame(&aFrame); rv = NS_NewImageControlFrame(&aFrame); } else if (val.EqualsIgnoreCase("password")) { @@ -4520,19 +4521,41 @@ nsCSSFrameConstructor::GetFrameFor(nsIPresShell* aPresShell, aPresShell->GetPrimaryFrameFor(aContent, &frame); if (nsnull != frame) { - // If the primary frame is a scroll frame, then get the scrolled frame. - // That's the frame that gets the reflow command - const nsStyleDisplay* display; - frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display); + // Check to see if the content is a select and + // then if it has a drop down (thus making it a combobox) + // The drop down is a ListControlFrame derived from a + // nsScrollFrame then get the area frame and + // that will be the parent + nsCOMPtr selectElement; + nsresult res = aContent->QueryInterface(nsCOMTypeInfo::GetIID(), + (void**)getter_AddRefs(selectElement)); + if (NS_SUCCEEDED(res) && selectElement) { + nsIComboboxControlFrame * comboboxFrame; + res = frame->QueryInterface(nsCOMTypeInfo::GetIID(), + (void**)&comboboxFrame); + if (comboboxFrame) { + nsIFrame * listFrame; + comboboxFrame->GetDropDown(&listFrame); + if (nsnull != listFrame) { + listFrame->FirstChild(nsnull, &frame); + } + } + } else { - if (display->IsBlockLevel() && IsScrollable(aPresContext, display)) { - frame->FirstChild(nsnull, &frame); - } - // if we get an outer table frame use its 1st child which is a table inner frame - // if we get a table cell frame use its 1st child which is an area frame - else if ((NS_STYLE_DISPLAY_TABLE == display->mDisplay) || - (NS_STYLE_DISPLAY_TABLE_CELL == display->mDisplay)) { - frame->FirstChild(nsnull, &frame); + // If the primary frame is a scroll frame, then get the scrolled frame. + // That's the frame that gets the reflow command + const nsStyleDisplay* display; + frame->GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display); + + if (display->IsBlockLevel() && IsScrollable(aPresContext, display)) { + frame->FirstChild(nsnull, &frame); + } + // if we get an outer table frame use its 1st child which is a table inner frame + // if we get a table cell frame use its 1st child which is an area frame + else if ((NS_STYLE_DISPLAY_TABLE == display->mDisplay) || + (NS_STYLE_DISPLAY_TABLE_CELL == display->mDisplay)) { + frame->FirstChild(nsnull, &frame); + } } }