Make the display frame resize correctly when the <select>'s width changes. Bug

370422, r+sr=dbaron
This commit is contained in:
bzbarsky%mit.edu 2007-02-28 03:04:38 +00:00
parent 9eb1226efe
commit 7bf5f8b7a1
6 changed files with 46 additions and 1 deletions

View File

@ -1350,6 +1350,7 @@ GK_ATOM(brFrame, "BRFrame")
GK_ATOM(bulletFrame, "BulletFrame")
GK_ATOM(columnSetFrame, "ColumnSetFrame")
GK_ATOM(comboboxControlFrame, "ComboboxControlFrame")
GK_ATOM(comboboxDisplayFrame, "ComboboxDisplayFrame")
GK_ATOM(directionalFrame, "DirectionalFrame")
GK_ATOM(fieldSetFrame, "FieldSetFrame")
GK_ATOM(frameSetFrame, "FrameSetFrame")

View File

@ -1041,6 +1041,10 @@ public:
mComboBox(aComboBox)
{}
// Need this so that line layout knows that this block's width
// depends on the available width.
virtual nsIAtom* GetType() const;
virtual PRBool IsFrameOfType(PRUint32 aFlags) const
{
return nsBlockFrame::IsFrameOfType(aFlags &
@ -1056,6 +1060,12 @@ protected:
nsComboboxControlFrame* mComboBox;
};
nsIAtom*
nsComboboxDisplayFrame::GetType() const
{
return nsGkAtoms::comboboxDisplayFrame;
}
NS_IMETHODIMP
nsComboboxDisplayFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,

View File

@ -748,7 +748,8 @@ IsPercentageAware(const nsIFrame* aFrame)
disp->mDisplay == NS_STYLE_DISPLAY_INLINE_TABLE ||
fType == nsGkAtoms::HTMLButtonControlFrame ||
fType == nsGkAtoms::gfxButtonControlFrame ||
fType == nsGkAtoms::fieldSetFrame) {
fType == nsGkAtoms::fieldSetFrame ||
fType == nsGkAtoms::comboboxDisplayFrame) {
return PR_TRUE;
}
}

View File

@ -0,0 +1,16 @@
<html>
<head>
<title>Testcase bug - Select drop down button doesn't update its position in this case when document widens</title>
</head>
<body onload="test()">
The dropwdown button should be on the right of the select<br>
<iframe src="data:text/html;charset=utf-8,%3Chtml%3E%3Chead%3E%0A%3Cstyle%3E%0Aselect%0A%7B%0A%20%20HEIGHT%3A%20100px%3B%0A%20%20WIDTH%3A%20100%25%3B%20%0A%7D%0A%3C/style%3E%0A%3C/head%3E%0A%3Cbody%3E%0A%3Cselect%3E%3Coption%20value%3D%222%22%3Etext%3C/option%3E%3C/select%3E%20%20%20%20%20%20%20%20%0A%3C/body%3E%0A%3C/html%3E" style="width: 400px;">
</iframe>
<script>
function test() {
document.getElementsByTagName('iframe')[0].style.width = '400px';
}
</script>
</body>
</html>

View File

@ -0,0 +1,16 @@
<html>
<head>
<title>Testcase bug - Select drop down button doesn't update its position in this case when document widens</title>
</head>
<body onload="test()">
The dropwdown button should be on the right of the select<br>
<iframe src="data:text/html;charset=utf-8,%3Chtml%3E%3Chead%3E%0A%3Cstyle%3E%0Aselect%0A%7B%0A%20%20HEIGHT%3A%20100px%3B%0A%20%20WIDTH%3A%20100%25%3B%20%0A%7D%0A%3C/style%3E%0A%3C/head%3E%0A%3Cbody%3E%0A%3Cselect%3E%3Coption%20value%3D%222%22%3Etext%3C/option%3E%3C/select%3E%20%20%20%20%20%20%20%20%0A%3C/body%3E%0A%3C/html%3E" style="width: 200px;">
</iframe>
<script>
function test() {
document.getElementsByTagName('iframe')[0].style.width = '400px';
}
</script>
</body>
</html>

View File

@ -152,6 +152,7 @@ fails == 368020-4.html 368020-4-ref.html # bug 368085
== 368020-5.html 368020-5-ref.html
== 368622-1.html 368622-1-ref.html
== 368622-1.html 368622-1-ref.html
== 370422-1.html 370422-1-ref.html
== 370586-1.xhtml 370586-1-ref.xhtml
== 370629-1.html 370629-1-ref.html
== 370629-2.html 370629-2-ref.html