зеркало из 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;
|
nscoord textHeight = (2 * aDesiredSize.height) / 3;
|
||||||
|
|
||||||
// Center the child and add back in the border and badding
|
// 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.height - textHeight)/2) + aReflowState.mComputedBorderPadding.top,
|
||||||
desiredSize.width,
|
desiredSize.width,
|
||||||
desiredSize.height);
|
desiredSize.height);
|
||||||
|
|
|
@ -619,10 +619,19 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
focusPadding.top + aReflowState.mComputedBorderPadding.top,
|
focusPadding.top + aReflowState.mComputedBorderPadding.top,
|
||||||
0, aStatus);
|
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
|
// Place the child
|
||||||
FinishReflowChild(firstKid, aPresContext, aDesiredSize,
|
FinishReflowChild(firstKid, aPresContext, aDesiredSize,
|
||||||
focusPadding.left + aReflowState.mComputedBorderPadding.left,
|
focusPadding.left + aReflowState.mComputedBorderPadding.left,
|
||||||
focusPadding.top + aReflowState.mComputedBorderPadding.top, 0);
|
yoff + focusPadding.top + aReflowState.mComputedBorderPadding.top, 0);
|
||||||
|
|
||||||
#if 0 // old way
|
#if 0 // old way
|
||||||
// if computed use the computed values.
|
// if computed use the computed values.
|
||||||
|
|
|
@ -78,6 +78,7 @@ center {
|
||||||
div {
|
div {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 2em;
|
font-size: 2em;
|
||||||
|
@ -1458,6 +1459,7 @@ sourcetext { /* XXX should not be in HTML namespace */
|
||||||
|
|
||||||
:button-content {
|
:button-content {
|
||||||
display: block;
|
display: block;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
:label-content {
|
:label-content {
|
||||||
|
|
|
@ -305,7 +305,8 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext
|
||||||
nscoord textHeight = (2 * aDesiredSize.height) / 3;
|
nscoord textHeight = (2 * aDesiredSize.height) / 3;
|
||||||
|
|
||||||
// Center the child and add back in the border and badding
|
// 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.height - textHeight)/2) + aReflowState.mComputedBorderPadding.top,
|
||||||
desiredSize.width,
|
desiredSize.width,
|
||||||
desiredSize.height);
|
desiredSize.height);
|
||||||
|
|
|
@ -619,10 +619,19 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
|
||||||
focusPadding.top + aReflowState.mComputedBorderPadding.top,
|
focusPadding.top + aReflowState.mComputedBorderPadding.top,
|
||||||
0, aStatus);
|
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
|
// Place the child
|
||||||
FinishReflowChild(firstKid, aPresContext, aDesiredSize,
|
FinishReflowChild(firstKid, aPresContext, aDesiredSize,
|
||||||
focusPadding.left + aReflowState.mComputedBorderPadding.left,
|
focusPadding.left + aReflowState.mComputedBorderPadding.left,
|
||||||
focusPadding.top + aReflowState.mComputedBorderPadding.top, 0);
|
yoff + focusPadding.top + aReflowState.mComputedBorderPadding.top, 0);
|
||||||
|
|
||||||
#if 0 // old way
|
#if 0 // old way
|
||||||
// if computed use the computed values.
|
// if computed use the computed values.
|
||||||
|
|
|
@ -78,6 +78,7 @@ center {
|
||||||
div {
|
div {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
display: block;
|
display: block;
|
||||||
font-size: 2em;
|
font-size: 2em;
|
||||||
|
@ -1458,6 +1459,7 @@ sourcetext { /* XXX should not be in HTML namespace */
|
||||||
|
|
||||||
:button-content {
|
:button-content {
|
||||||
display: block;
|
display: block;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
:label-content {
|
:label-content {
|
||||||
|
|
|
@ -190,9 +190,9 @@ nsScrollbarButtonFrame::GetChildWithTag(nsIAtom* atom, nsIFrame* start, nsIFrame
|
||||||
|
|
||||||
if (child) {
|
if (child) {
|
||||||
// see if it is the child
|
// see if it is the child
|
||||||
nsIAtom* tag = nsnull;
|
nsCOMPtr<nsIAtom> tag;
|
||||||
child->GetTag(tag);
|
child->GetTag(*getter_AddRefs(tag));
|
||||||
if (tag == atom)
|
if (atom == tag.get())
|
||||||
{
|
{
|
||||||
result = childFrame;
|
result = childFrame;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -224,8 +224,8 @@ nsScrollbarButtonFrame::GetParentWithTag(nsIAtom* toFind, nsIFrame* start, nsIFr
|
||||||
nsCOMPtr<nsIContent> child;
|
nsCOMPtr<nsIContent> child;
|
||||||
start->GetContent(getter_AddRefs(child));
|
start->GetContent(getter_AddRefs(child));
|
||||||
|
|
||||||
nsIAtom* atom;
|
nsCOMPtr<nsIAtom> atom;
|
||||||
if (child && child->GetTag(atom) == NS_OK && atom == toFind) {
|
if (child && child->GetTag(*getter_AddRefs(atom)) == NS_OK && atom.get() == toFind) {
|
||||||
result = start;
|
result = start;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче