Bug 157846. nsTextControlFrame's padding should be inherited into its anonymous child so it appears inside the scroll area. r=roc

The new code in nsTextControlFrame was written by Charly Molter :lahabana <charly.molter@gmail.com>

--HG--
extra : rebase_source : c9d91c3aef3a6029fc3b5d9693a2f3cc81b7b57e
This commit is contained in:
Alex Henrie 2013-12-27 17:44:07 -07:00
Родитель 6dd488e952
Коммит 6b31d5cec1
17 изменённых файлов: 111 добавлений и 60 удалений

Просмотреть файл

@ -3,12 +3,12 @@
#mac html|input, #mac html|textarea {
margin: 4px;
padding: 0;
padding: 0 1px;
}
#win html|input, #win html|textarea {
margin: 2px 4px;
padding: 2px 2px 3px;
padding: 2px 3px 3px;
-moz-padding-start: 4px;
}
@ -19,7 +19,7 @@
#linux html|input, #linux html|textarea {
margin: 2px 4px;
padding: 2px 4px 3px;
padding: 2px 5px 3px;
}
textbox[multiline="true"], html|textarea {
@ -34,7 +34,7 @@ html|input, html|textarea {
}
html|input.ac {
padding: 0 3px !important;
padding: 0 4px !important;
}
html|input.empty {
@ -54,12 +54,12 @@ html|input.num {
}
#win html|input.num {
padding: 0 !important;
padding: 0 1px !important;
}
#linux html|input.num {
-moz-margin-end: 3px;
padding: 3px;
padding: 3px 4px;
}
html|div.plainfield {

Просмотреть файл

@ -15,9 +15,9 @@ fails-if(Android||B2G) == emptytextbox-5.xul emptytextbox-ref.xul # bug 783658
# Therefore, the equlity tests below should be marked as failing.
!= number-1.xul number-ref.xul
!= number-2.xul number-ref.xul
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012])/.test(http.oscpu)) == number-3.xul number-ref.xul # bug 783658
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012])/.test(http.oscpu)) fuzzy(7,4) == number-3.xul number-ref.xul # bug 783658
!= number-4.xul number-ref.xul
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012])/.test(http.oscpu)) == number-5.xul number-ref.xul # bug 783658
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012])/.test(http.oscpu)) fuzzy(7,4) == number-5.xul number-ref.xul # bug 783658
fails-if(Android||B2G) fails-if(windowsDefaultTheme&&/^Windows\x20NT\x20(5\.[12]|6\.[012])/.test(http.oscpu)) == numberwithvalue-1.xul numberwithvalue-ref.xul # bug 783658
fails-if(Android||B2G) == passwd-1.xul passwd-ref.xul # bug 783658
fails-if(Android||B2G) == passwd-2.xul passwd-ref.xul # bug 783658

Просмотреть файл

@ -190,17 +190,6 @@ nsTextControlFrame::CalcIntrinsicSize(nsRenderingContext* aRenderingContext,
if (PresContext()->CompatibilityMode() == eCompatibility_FullStandards) {
aIntrinsicSize.width += 1;
}
// Also add in the padding of our value div child. Note that it hasn't
// been reflowed yet, so we can't get its used padding, but it shouldn't be
// using percentage padding anyway.
nsMargin childPadding;
nsIFrame* firstChild = GetFirstPrincipalChild();
if (firstChild && firstChild->StylePadding()->GetPadding(childPadding)) {
aIntrinsicSize.width += childPadding.LeftRight();
} else {
NS_ERROR("Percentage padding on value div?");
}
}
// Increment width with cols * letter-spacing.
@ -535,32 +524,28 @@ nsTextControlFrame::ReflowTextControlChild(nsIFrame* aKid,
nsHTMLReflowMetrics& aParentDesiredSize)
{
// compute available size and frame offsets for child
nsSize availSize(aReflowState.ComputedWidth(),
aReflowState.ComputedHeight());
availSize.width = std::max(availSize.width, 0);
availSize.height = std::max(availSize.height, 0);
nsSize availSize(aReflowState.ComputedWidth() +
aReflowState.ComputedPhysicalPadding().LeftRight(),
aReflowState.ComputedHeight() +
aReflowState.ComputedPhysicalPadding().TopBottom());
nsHTMLReflowState kidReflowState(aPresContext, aReflowState,
aKid, availSize);
// Set computed width and computed height for the child
nscoord width = availSize.width;
width -= kidReflowState.ComputedPhysicalMargin().LeftRight() +
kidReflowState.ComputedPhysicalBorderPadding().LeftRight();
width = std::max(width, 0);
kidReflowState.SetComputedWidth(width);
// Set computed height for the child
kidReflowState.SetComputedHeight(aReflowState.ComputedHeight());
kidReflowState.SetComputedWidth(aReflowState.ComputedWidth());
nscoord height = availSize.height;
height -= kidReflowState.ComputedPhysicalMargin().TopBottom() +
kidReflowState.ComputedPhysicalBorderPadding().TopBottom();
height = std::max(height, 0);
kidReflowState.SetComputedHeight(height);
// Set computed height for the child
kidReflowState.SetComputedHeight(aReflowState.ComputedHeight());
kidReflowState.SetComputedWidth(aReflowState.ComputedWidth());
// compute the offsets
nscoord xOffset = aReflowState.ComputedPhysicalBorderPadding().left
+ kidReflowState.ComputedPhysicalMargin().left;
nscoord yOffset = aReflowState.ComputedPhysicalBorderPadding().top
+ kidReflowState.ComputedPhysicalMargin().top;
// Offset the frame by the size of the parent's border.
nscoord xOffset = aReflowState.ComputedPhysicalBorderPadding().left -
aReflowState.ComputedPhysicalPadding().left;
nscoord yOffset = aReflowState.ComputedPhysicalBorderPadding().top -
aReflowState.ComputedPhysicalPadding().top;
// reflow the child
nsHTMLReflowMetrics desiredSize(aReflowState.GetWritingMode());

Просмотреть файл

@ -15,7 +15,7 @@ fuzzy-if(/^Windows\x20NT\x205\.1/.test(http.oscpu),64,4) fuzzy-if(cocoaWidget,63
== from-number-to-other-type-unthemed-1.html from-number-to-other-type-unthemed-1-ref.html
# dynamic value changes:
== show-value.html show-value-ref.html
fuzzy(2,6) == show-value.html show-value-ref.html
# disabled
== number-disabled.html number-disabled-ref.html

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Intrinsic Size Test Reference</title>
</head>
<body>
<div>
<span style="border:2px solid black; padding-left:200px"><input style="background-color:transparent; border:none; font-family:monospace"/></span>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>Intrinsic Size Test</title>
</head>
<body>
<div>
<span style="border:2px solid black"><input style="background-color:transparent; border:none; font-family:monospace; padding-left:201px"/></span>
</div>
</body>
</html>

Просмотреть файл

@ -5,3 +5,4 @@ HTTP(..) == baseline-1.html baseline-1-ref.html
HTTP(..) == centering-1.xul centering-1-ref.xul
== dynamic-height-1.xul dynamic-height-1-ref.xul
needs-focus == select.html select-ref.html
== intrinsic-size.html intrinsic-size-ref.html

Просмотреть файл

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Padding and Scrollbar Placement Test Reference</title>
<style type="text/css">
div {
display: block;
padding: 50px;
width: 300px;
height: 100px;
border: 5px solid red;
margin: 10px;
overflow: scroll;
font-family: verdana;
white-space: pre-wrap;
}
</style>
</head>
<body>
<div>a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a </div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Padding and Scrollbar Placement Test</title>
<style type="text/css">
textarea {
display: block;
padding: 50px;
width: 300px;
height: 100px;
border: 5px solid red;
margin: 10px;
overflow: scroll;
font-family: verdana;
resize: none;
}
</style>
</head>
<body>
<textarea>a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a </textarea>
</body>
</html>

Просмотреть файл

@ -10,3 +10,4 @@ skip-if(B2G) fails-if(Android) fails-if(gtk2Widget) != rtl.html no-resize.html #
== rtl.html rtl-dynamic-style.html
== rtl.html in-dynamic-rtl-doc.html
== setvalue-framereconstruction-1.html setvalue-framereconstruction-ref.html
fuzzy(51,6749) == padding-scrollbar-placement.html padding-scrollbar-placement-ref.html

Просмотреть файл

@ -54,7 +54,7 @@ input {
/* The sum of border-top, border-bottom, padding-top, padding-bottom
must be the same here, for buttons, and for <select> (including its
internal padding magic) */
padding: 1px 0 1px 0;
padding: 1px;
border: 2px inset ThreeDFace;
background-color: -moz-Field;
color: -moz-FieldText;
@ -97,6 +97,8 @@ input::-moz-placeholder {
textarea {
margin: 1px 0 1px 0;
border: 2px inset ThreeDFace;
/* The 1px horizontal padding is for parity with Win/IE */
padding: 0px 1px;
background-color: -moz-Field;
color: -moz-FieldText;
font: medium -moz-fixed;
@ -127,12 +129,7 @@ textarea::-moz-placeholder {
white-space: pre;
overflow: auto;
border: 0px !important;
/*
* The 1px horizontal padding is for parity with Win/IE.
* We need to mark it !important to make sure it can't be changed on the
* placeholder.
*/
padding: 0px 1px !important;
padding: inherit !important;
margin: 0px;
text-decoration: inherit;
-moz-text-decoration-color: inherit;

Просмотреть файл

@ -15,8 +15,8 @@ textbox {
cursor: text;
margin: 2px 4px;
border: 1px solid #555555;
padding: 2px 2px 3px;
-moz-padding-start: 4px;
padding: 2px 3px 3px;
-moz-padding-start: 5px;
background-color: white;
color: black;
}
@ -54,7 +54,7 @@ textbox[disabled="true"] {
textbox.plain {
background-color: transparent;
padding: 0px !important;
padding: 0px 1px !important;
margin: 0px !important;
border: none !important;
}

Просмотреть файл

@ -14,7 +14,7 @@
/* .padded is used by autocomplete widgets that don't have an icon. Gross. -dwh */
textbox:not(.padded) {
cursor: default;
padding: 0;
padding: 0 1px;
}
textbox[enablehistory="true"] {

Просмотреть файл

@ -30,7 +30,7 @@ html|*.numberbox-input {
-moz-border-right-colors: ThreeDHighlight ThreeDLightShadow;
-moz-border-bottom-colors: ThreeDHighlight ThreeDLightShadow;
-moz-border-left-colors: ThreeDShadow ThreeDDarkShadow;
padding: 3px;
padding: 3px 4px;
}
textbox[hidespinbuttons="true"] > .numberbox-input-box {

Просмотреть файл

@ -20,8 +20,8 @@ textbox {
-moz-border-right-colors: ThreeDHighlight ThreeDLightShadow;
-moz-border-bottom-colors: ThreeDHighlight ThreeDLightShadow;
-moz-border-left-colors: ThreeDShadow ThreeDDarkShadow;
padding: 2px 2px 3px;
-moz-padding-start: 4px;
padding: 2px 3px 3px;
-moz-padding-start: 5px;
background-color: -moz-Field;
color: -moz-FieldText;
}
@ -60,7 +60,7 @@ textbox[disabled="true"] {
textbox.plain {
-moz-appearance: none !important;
background-color: transparent;
padding: 0px !important;
padding: 0px 1px !important;
margin: 0px !important;
border: none !important;
}

Просмотреть файл

@ -16,8 +16,7 @@ textbox {
-moz-border-left-colors: transparent #888888 #000000;
border-top-right-radius: 2px;
border-bottom-left-radius: 2px;
/*padding: 1px 0px 1px 2px ;*/
padding: 0px;
padding: 0px 1px;
background-color: -moz-Field;
color: -moz-FieldText;
}
@ -61,7 +60,7 @@ textbox[disabled="true"] {
textbox.plain {
-moz-appearance: none !important;
background-color: transparent;
padding: 0px !important;
padding: 0px 1px !important;
margin: 0px !important;
border: none !important;
}

Просмотреть файл

@ -20,8 +20,8 @@ textbox {
-moz-border-right-colors: ThreeDHighlight ThreeDLightShadow;
-moz-border-bottom-colors: ThreeDHighlight ThreeDLightShadow;
-moz-border-left-colors: ThreeDShadow ThreeDDarkShadow;
padding: 2px 2px 3px;
-moz-padding-start: 4px;
padding: 2px 3px 3px;
-moz-padding-start: 5px;
background-color: -moz-Field;
color: -moz-FieldText;
}
@ -60,7 +60,7 @@ textbox[disabled="true"] {
textbox.plain {
-moz-appearance: none !important;
background-color: transparent;
padding: 0px !important;
padding: 0px 1px !important;
margin: 0px !important;
border: none !important;
}