зеркало из https://github.com/mozilla/pjs.git
Fixed html and input button to center and size correctly. #17474,#17353,#23270, #21249 -r Rod
This commit is contained in:
Родитель
479827e7d1
Коммит
c7a2e2d937
|
@ -305,7 +305,8 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext
|
|||
nscoord textHeight = (2 * aDesiredSize.height) / 3;
|
||||
|
||||
// Center the child and add back in the border and badding
|
||||
nsRect rect = nsRect(((desiredSize.width - textWidth)/2)+ aReflowState.mComputedBorderPadding.left,
|
||||
// our inner area frame is already doing centering so we only need to center vertically.
|
||||
nsRect rect = nsRect(aReflowState.mComputedBorderPadding.left,
|
||||
((desiredSize.height - textHeight)/2) + aReflowState.mComputedBorderPadding.top,
|
||||
desiredSize.width,
|
||||
desiredSize.height);
|
||||
|
|
|
@ -619,10 +619,19 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
|||
focusPadding.top + aReflowState.mComputedBorderPadding.top,
|
||||
0, aStatus);
|
||||
|
||||
// center child vertically
|
||||
nscoord yoff = 0;
|
||||
if (aReflowState.mComputedHeight != NS_INTRINSICSIZE) {
|
||||
yoff = (aReflowState.mComputedHeight - aDesiredSize.height)/2;
|
||||
if (yoff < 0)
|
||||
yoff = 0;
|
||||
}
|
||||
|
||||
|
||||
// Place the child
|
||||
FinishReflowChild(firstKid, aPresContext, aDesiredSize,
|
||||
focusPadding.left + aReflowState.mComputedBorderPadding.left,
|
||||
focusPadding.top + aReflowState.mComputedBorderPadding.top, 0);
|
||||
yoff + focusPadding.top + aReflowState.mComputedBorderPadding.top, 0);
|
||||
|
||||
#if 0 // old way
|
||||
// if computed use the computed values.
|
||||
|
|
|
@ -78,6 +78,7 @@ center {
|
|||
div {
|
||||
display: block;
|
||||
}
|
||||
|
||||
h1 {
|
||||
display: block;
|
||||
font-size: 2em;
|
||||
|
@ -1458,6 +1459,7 @@ sourcetext { /* XXX should not be in HTML namespace */
|
|||
|
||||
:button-content {
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
:label-content {
|
||||
|
|
|
@ -305,7 +305,8 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext
|
|||
nscoord textHeight = (2 * aDesiredSize.height) / 3;
|
||||
|
||||
// Center the child and add back in the border and badding
|
||||
nsRect rect = nsRect(((desiredSize.width - textWidth)/2)+ aReflowState.mComputedBorderPadding.left,
|
||||
// our inner area frame is already doing centering so we only need to center vertically.
|
||||
nsRect rect = nsRect(aReflowState.mComputedBorderPadding.left,
|
||||
((desiredSize.height - textHeight)/2) + aReflowState.mComputedBorderPadding.top,
|
||||
desiredSize.width,
|
||||
desiredSize.height);
|
||||
|
|
|
@ -619,10 +619,19 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
|||
focusPadding.top + aReflowState.mComputedBorderPadding.top,
|
||||
0, aStatus);
|
||||
|
||||
// center child vertically
|
||||
nscoord yoff = 0;
|
||||
if (aReflowState.mComputedHeight != NS_INTRINSICSIZE) {
|
||||
yoff = (aReflowState.mComputedHeight - aDesiredSize.height)/2;
|
||||
if (yoff < 0)
|
||||
yoff = 0;
|
||||
}
|
||||
|
||||
|
||||
// Place the child
|
||||
FinishReflowChild(firstKid, aPresContext, aDesiredSize,
|
||||
focusPadding.left + aReflowState.mComputedBorderPadding.left,
|
||||
focusPadding.top + aReflowState.mComputedBorderPadding.top, 0);
|
||||
yoff + focusPadding.top + aReflowState.mComputedBorderPadding.top, 0);
|
||||
|
||||
#if 0 // old way
|
||||
// if computed use the computed values.
|
||||
|
|
|
@ -78,6 +78,7 @@ center {
|
|||
div {
|
||||
display: block;
|
||||
}
|
||||
|
||||
h1 {
|
||||
display: block;
|
||||
font-size: 2em;
|
||||
|
@ -1458,6 +1459,7 @@ sourcetext { /* XXX should not be in HTML namespace */
|
|||
|
||||
:button-content {
|
||||
display: block;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
:label-content {
|
||||
|
|
|
@ -190,9 +190,9 @@ nsScrollbarButtonFrame::GetChildWithTag(nsIAtom* atom, nsIFrame* start, nsIFrame
|
|||
|
||||
if (child) {
|
||||
// see if it is the child
|
||||
nsIAtom* tag = nsnull;
|
||||
child->GetTag(tag);
|
||||
if (tag == atom)
|
||||
nsCOMPtr<nsIAtom> tag;
|
||||
child->GetTag(*getter_AddRefs(tag));
|
||||
if (atom == tag.get())
|
||||
{
|
||||
result = childFrame;
|
||||
return NS_OK;
|
||||
|
@ -224,8 +224,8 @@ nsScrollbarButtonFrame::GetParentWithTag(nsIAtom* toFind, nsIFrame* start, nsIFr
|
|||
nsCOMPtr<nsIContent> child;
|
||||
start->GetContent(getter_AddRefs(child));
|
||||
|
||||
nsIAtom* atom;
|
||||
if (child && child->GetTag(atom) == NS_OK && atom == toFind) {
|
||||
nsCOMPtr<nsIAtom> atom;
|
||||
if (child && child->GetTag(*getter_AddRefs(atom)) == NS_OK && atom.get() == toFind) {
|
||||
result = start;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче