diff --git a/mozilla/layout/forms/nsGfxButtonControlFrame.cpp b/mozilla/layout/forms/nsGfxButtonControlFrame.cpp index 0c8b1c7d5bd..c10527ed544 100644 --- a/mozilla/layout/forms/nsGfxButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxButtonControlFrame.cpp @@ -258,8 +258,6 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext aDesiredSize.width = desiredSize.width; aDesiredSize.height = desiredSize.height; - aDesiredSize.ascent = aDesiredSize.height; - aDesiredSize.descent = 0; } else { // XXX ASSERT HERE desiredSize.width = 0; @@ -305,7 +303,7 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext } } - // now reflow the first child (genertaed content) + // now reflow the first child (generated content) nsHTMLReflowState reflowState(aPresContext, aReflowState, firstKid, desiredSize, reason); reflowState.mComputedWidth = desiredSize.width; reflowState.mComputedHeight = desiredSize.height; @@ -315,6 +313,10 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext firstKid->GetRect(kidRect); ReflowChild(firstKid, aPresContext, childReflowMetrics, reflowState, kidRect.x, kidRect.y, 0, aStatus); + aDesiredSize.ascent = childReflowMetrics.ascent + + aReflowState.mComputedBorderPadding.top; + aDesiredSize.descent = aDesiredSize.height - aDesiredSize.ascent; + // Center the child and add back in the border and badding // our inner area frame is already doing centering so we only need to center vertically. nsRect rect = nsRect(aReflowState.mComputedBorderPadding.left, diff --git a/mozilla/layout/forms/nsTextControlFrame.cpp b/mozilla/layout/forms/nsTextControlFrame.cpp index 5b7612cdd9c..15496d06135 100644 --- a/mozilla/layout/forms/nsTextControlFrame.cpp +++ b/mozilla/layout/forms/nsTextControlFrame.cpp @@ -2235,9 +2235,21 @@ nsTextControlFrame::GetMaxSize(nsBoxLayoutState& aState, nsSize& aSize) NS_IMETHODIMP nsTextControlFrame::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent) { - nsSize size; - nsresult rv = GetPrefSize(aState, size); - aAscent = size.height; + nsresult rv; + if (IsSingleLineTextControl()) { + // First calculate the ascent of the text inside + rv = nsStackFrame::GetAscent(aState, aAscent); + NS_ENSURE_SUCCESS(rv, rv); + + // Now adjust the ascent for our borders and padding + aAscent += aState.GetReflowState()->mComputedBorderPadding.top; + } else { + // For a textarea or , just don't bother for now + nsSize size; + rv = GetPrefSize(aState, size); + aAscent = size.height; + } + return rv; } diff --git a/mozilla/layout/html/document/src/forms.css b/mozilla/layout/html/document/src/forms.css index e4e2f5cf028..de0e3d34cf7 100644 --- a/mozilla/layout/html/document/src/forms.css +++ b/mozilla/layout/html/document/src/forms.css @@ -81,7 +81,6 @@ input { font: -moz-field; text-align: start; text-transform: none; - vertical-align: text-bottom; cursor: text; -moz-box-sizing: border-box; -moz-user-focus: normal; @@ -261,7 +260,6 @@ input[type="image"] { background-color: transparent; font-family: sans-serif; font-size: small; - vertical-align: baseline; cursor: pointer; -moz-binding: none; } @@ -309,7 +307,6 @@ input[type="radio"] { height: 13px; margin: 3px 3px 0px 5px; padding: 0; - vertical-align: baseline; cursor: default; -moz-binding: none; diff --git a/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp index 0c8b1c7d5bd..c10527ed544 100644 --- a/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp @@ -258,8 +258,6 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext aDesiredSize.width = desiredSize.width; aDesiredSize.height = desiredSize.height; - aDesiredSize.ascent = aDesiredSize.height; - aDesiredSize.descent = 0; } else { // XXX ASSERT HERE desiredSize.width = 0; @@ -305,7 +303,7 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext } } - // now reflow the first child (genertaed content) + // now reflow the first child (generated content) nsHTMLReflowState reflowState(aPresContext, aReflowState, firstKid, desiredSize, reason); reflowState.mComputedWidth = desiredSize.width; reflowState.mComputedHeight = desiredSize.height; @@ -315,6 +313,10 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext firstKid->GetRect(kidRect); ReflowChild(firstKid, aPresContext, childReflowMetrics, reflowState, kidRect.x, kidRect.y, 0, aStatus); + aDesiredSize.ascent = childReflowMetrics.ascent + + aReflowState.mComputedBorderPadding.top; + aDesiredSize.descent = aDesiredSize.height - aDesiredSize.ascent; + // Center the child and add back in the border and badding // our inner area frame is already doing centering so we only need to center vertically. nsRect rect = nsRect(aReflowState.mComputedBorderPadding.left, diff --git a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp index 5b7612cdd9c..15496d06135 100644 --- a/mozilla/layout/html/forms/src/nsTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsTextControlFrame.cpp @@ -2235,9 +2235,21 @@ nsTextControlFrame::GetMaxSize(nsBoxLayoutState& aState, nsSize& aSize) NS_IMETHODIMP nsTextControlFrame::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent) { - nsSize size; - nsresult rv = GetPrefSize(aState, size); - aAscent = size.height; + nsresult rv; + if (IsSingleLineTextControl()) { + // First calculate the ascent of the text inside + rv = nsStackFrame::GetAscent(aState, aAscent); + NS_ENSURE_SUCCESS(rv, rv); + + // Now adjust the ascent for our borders and padding + aAscent += aState.GetReflowState()->mComputedBorderPadding.top; + } else { + // For a textarea or , just don't bother for now + nsSize size; + rv = GetPrefSize(aState, size); + aAscent = size.height; + } + return rv; } diff --git a/mozilla/layout/style/forms.css b/mozilla/layout/style/forms.css index e4e2f5cf028..de0e3d34cf7 100644 --- a/mozilla/layout/style/forms.css +++ b/mozilla/layout/style/forms.css @@ -81,7 +81,6 @@ input { font: -moz-field; text-align: start; text-transform: none; - vertical-align: text-bottom; cursor: text; -moz-box-sizing: border-box; -moz-user-focus: normal; @@ -261,7 +260,6 @@ input[type="image"] { background-color: transparent; font-family: sans-serif; font-size: small; - vertical-align: baseline; cursor: pointer; -moz-binding: none; } @@ -309,7 +307,6 @@ input[type="radio"] { height: 13px; margin: 3px 3px 0px 5px; padding: 0; - vertical-align: baseline; cursor: default; -moz-binding: none;