зеркало из https://github.com/mozilla/gecko-dev.git
Merge mozilla-central to mozilla-inbound
This commit is contained in:
Коммит
5c6d6db828
|
@ -2516,6 +2516,13 @@ nsEventStateManager::DispatchLegacyMouseScrollEvents(nsIFrame* aTargetFrame,
|
|||
nsPresContext::AppUnitsToIntCSSPixels(scrollAmount.width),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(scrollAmount.height));
|
||||
|
||||
// XXX We don't deal with fractional amount in legacy event, though the
|
||||
// default action handler (DoScrollText()) deals with it.
|
||||
// If we implemented such strict computation, we would need additional
|
||||
// accumulated delta values. It would made the code more complicated.
|
||||
// And also it would computes different delta values from older version.
|
||||
// It doesn't make sense to implement such code for legacy events and
|
||||
// rare cases.
|
||||
PRInt32 scrollDeltaX, scrollDeltaY, pixelDeltaX, pixelDeltaY;
|
||||
switch (aEvent->deltaMode) {
|
||||
case nsIDOMWheelEvent::DOM_DELTA_PAGE:
|
||||
|
@ -2734,26 +2741,23 @@ nsEventStateManager::ComputeScrollTarget(nsIFrame* aTargetFrame,
|
|||
continue;
|
||||
}
|
||||
|
||||
// Check if the scrollable view can be scrolled any further.
|
||||
if (frameToScroll->GetLineScrollAmount().height) {
|
||||
// For default action, we should climb up the tree if cannot scroll it
|
||||
// by the event actually.
|
||||
bool canScroll = CanScrollOn(frameToScroll,
|
||||
aEvent->deltaX, aEvent->deltaY);
|
||||
// Comboboxes need special care.
|
||||
nsIComboboxControlFrame* comboBox = do_QueryFrame(scrollFrame);
|
||||
if (comboBox) {
|
||||
if (comboBox->IsDroppedDown()) {
|
||||
// Don't propagate to parent when drop down menu is active.
|
||||
return canScroll ? frameToScroll : nullptr;
|
||||
}
|
||||
// Always propagate when not dropped down (even if focused).
|
||||
continue;
|
||||
// For default action, we should climb up the tree if cannot scroll it
|
||||
// by the event actually.
|
||||
bool canScroll = CanScrollOn(frameToScroll,
|
||||
aEvent->deltaX, aEvent->deltaY);
|
||||
// Comboboxes need special care.
|
||||
nsIComboboxControlFrame* comboBox = do_QueryFrame(scrollFrame);
|
||||
if (comboBox) {
|
||||
if (comboBox->IsDroppedDown()) {
|
||||
// Don't propagate to parent when drop down menu is active.
|
||||
return canScroll ? frameToScroll : nullptr;
|
||||
}
|
||||
// Always propagate when not dropped down (even if focused).
|
||||
continue;
|
||||
}
|
||||
|
||||
if (canScroll) {
|
||||
return frameToScroll;
|
||||
}
|
||||
if (canScroll) {
|
||||
return frameToScroll;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2825,18 +2829,6 @@ nsEventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
|
|||
return;
|
||||
}
|
||||
|
||||
// If the wheel event is line scroll and the delta value is computed from
|
||||
// system settings, allow to override the system speed.
|
||||
bool allowScrollSpeedOverride =
|
||||
(!aEvent->customizedByUserPrefs &&
|
||||
aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE);
|
||||
DeltaValues acceleratedDelta =
|
||||
nsMouseWheelTransaction::AccelerateWheelDelta(aEvent,
|
||||
allowScrollSpeedOverride);
|
||||
|
||||
bool isDeltaModePixel =
|
||||
(aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL);
|
||||
|
||||
// Default action's actual scroll amount should be computed from device
|
||||
// pixels.
|
||||
nsPresContext* pc = scrollFrame->PresContext();
|
||||
|
@ -2844,17 +2836,9 @@ nsEventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
|
|||
nsIntSize scrollAmountInDevPixels(
|
||||
pc->AppUnitsToDevPixels(scrollAmount.width),
|
||||
pc->AppUnitsToDevPixels(scrollAmount.height));
|
||||
|
||||
nsIntPoint actualDevPixelScrollAmount(0, 0);
|
||||
if (isDeltaModePixel) {
|
||||
actualDevPixelScrollAmount.x = RoundDown(acceleratedDelta.deltaX);
|
||||
actualDevPixelScrollAmount.y = RoundDown(acceleratedDelta.deltaY);
|
||||
} else {
|
||||
actualDevPixelScrollAmount.x =
|
||||
RoundDown(scrollAmountInDevPixels.width * acceleratedDelta.deltaX);
|
||||
actualDevPixelScrollAmount.y =
|
||||
RoundDown(scrollAmountInDevPixels.height * acceleratedDelta.deltaY);
|
||||
}
|
||||
nsIntPoint actualDevPixelScrollAmount =
|
||||
DeltaAccumulator::GetInstance()->
|
||||
ComputeScrollAmountForDefaultAction(aEvent, scrollAmountInDevPixels);
|
||||
|
||||
nsIAtom* origin = nullptr;
|
||||
switch (aEvent->deltaMode) {
|
||||
|
@ -2888,6 +2872,9 @@ nsEventStateManager::DoScrollText(nsIScrollableFrame* aScrollableFrame,
|
|||
-devPixelPageSize.height;
|
||||
}
|
||||
|
||||
bool isDeltaModePixel =
|
||||
(aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL);
|
||||
|
||||
nsIScrollableFrame::ScrollMode mode;
|
||||
switch (aEvent->scrollType) {
|
||||
case widget::WheelEvent::SCROLL_DEFAULT:
|
||||
|
@ -5087,13 +5074,6 @@ nsEventStateManager::DeltaAccumulator::InitLineOrPageDelta(
|
|||
MOZ_ASSERT(aESM);
|
||||
MOZ_ASSERT(aEvent);
|
||||
|
||||
if (!(aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL &&
|
||||
aEvent->isPixelOnlyDevice) &&
|
||||
!WheelPrefs::GetInstance()->NeedToComputeLineOrPageDelta(aEvent)) {
|
||||
Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset if the previous wheel event is too old.
|
||||
if (!mLastTime.IsNull()) {
|
||||
TimeDuration duration = TimeStamp::Now() - mLastTime;
|
||||
|
@ -5102,7 +5082,7 @@ nsEventStateManager::DeltaAccumulator::InitLineOrPageDelta(
|
|||
}
|
||||
}
|
||||
// If we have accumulated delta, we may need to reset it.
|
||||
if (mHandlingDeltaMode != PR_UINT32_MAX) {
|
||||
if (IsInTransaction()) {
|
||||
// If wheel event type is changed, reset the values.
|
||||
if (mHandlingDeltaMode != aEvent->deltaMode ||
|
||||
mHandlingPixelOnlyDevice != aEvent->isPixelOnlyDevice) {
|
||||
|
@ -5111,10 +5091,10 @@ nsEventStateManager::DeltaAccumulator::InitLineOrPageDelta(
|
|||
// If the delta direction is changed, we should reset only the
|
||||
// accumulated values.
|
||||
if (mX && aEvent->deltaX && ((aEvent->deltaX > 0.0) != (mX > 0.0))) {
|
||||
mX = 0.0;
|
||||
mX = mPendingScrollAmountX = 0.0;
|
||||
}
|
||||
if (mY && aEvent->deltaY && ((aEvent->deltaY > 0.0) != (mY > 0.0))) {
|
||||
mY = 0.0;
|
||||
mY = mPendingScrollAmountY = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5122,6 +5102,28 @@ nsEventStateManager::DeltaAccumulator::InitLineOrPageDelta(
|
|||
mHandlingDeltaMode = aEvent->deltaMode;
|
||||
mHandlingPixelOnlyDevice = aEvent->isPixelOnlyDevice;
|
||||
|
||||
// If it's handling neither pixel scroll mode for pixel only device nor
|
||||
// delta values multiplied by prefs, we must not modify lineOrPageDelta
|
||||
// values.
|
||||
if (!(mHandlingDeltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL &&
|
||||
mHandlingPixelOnlyDevice) &&
|
||||
!nsEventStateManager::WheelPrefs::GetInstance()->
|
||||
NeedToComputeLineOrPageDelta(aEvent)) {
|
||||
// Set the delta values to mX and mY. They would be used when above block
|
||||
// resets mX/mY/mPendingScrollAmountX/mPendingScrollAmountY if the direction
|
||||
// is changed.
|
||||
// NOTE: We shouldn't accumulate the delta values, it might could cause
|
||||
// overflow even though it's not a realistic situation.
|
||||
if (aEvent->deltaX) {
|
||||
mX = aEvent->deltaX;
|
||||
}
|
||||
if (aEvent->deltaY) {
|
||||
mY = aEvent->deltaY;
|
||||
}
|
||||
mLastTime = TimeStamp::Now();
|
||||
return;
|
||||
}
|
||||
|
||||
mX += aEvent->deltaX;
|
||||
mY += aEvent->deltaY;
|
||||
|
||||
|
@ -5162,10 +5164,45 @@ void
|
|||
nsEventStateManager::DeltaAccumulator::Reset()
|
||||
{
|
||||
mX = mY = 0.0;
|
||||
mPendingScrollAmountX = mPendingScrollAmountY = 0.0;
|
||||
mHandlingDeltaMode = PR_UINT32_MAX;
|
||||
mHandlingPixelOnlyDevice = false;
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
nsEventStateManager::DeltaAccumulator::ComputeScrollAmountForDefaultAction(
|
||||
widget::WheelEvent* aEvent,
|
||||
const nsIntSize& aScrollAmountInDevPixels)
|
||||
{
|
||||
MOZ_ASSERT(aEvent);
|
||||
|
||||
// If the wheel event is line scroll and the delta value is computed from
|
||||
// system settings, allow to override the system speed.
|
||||
bool allowScrollSpeedOverride =
|
||||
(!aEvent->customizedByUserPrefs &&
|
||||
aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_LINE);
|
||||
DeltaValues acceleratedDelta =
|
||||
nsMouseWheelTransaction::AccelerateWheelDelta(aEvent,
|
||||
allowScrollSpeedOverride);
|
||||
|
||||
nsIntPoint result(0, 0);
|
||||
if (aEvent->deltaMode == nsIDOMWheelEvent::DOM_DELTA_PIXEL) {
|
||||
mPendingScrollAmountX += acceleratedDelta.deltaX;
|
||||
mPendingScrollAmountY += acceleratedDelta.deltaY;
|
||||
} else {
|
||||
mPendingScrollAmountX +=
|
||||
aScrollAmountInDevPixels.width * acceleratedDelta.deltaX;
|
||||
mPendingScrollAmountY +=
|
||||
aScrollAmountInDevPixels.height * acceleratedDelta.deltaY;
|
||||
}
|
||||
result.x = RoundDown(mPendingScrollAmountX);
|
||||
result.y = RoundDown(mPendingScrollAmountY);
|
||||
mPendingScrollAmountX -= result.x;
|
||||
mPendingScrollAmountY -= result.y;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/******************************************************************/
|
||||
/* nsEventStateManager::WheelPrefs */
|
||||
/******************************************************************/
|
||||
|
|
|
@ -529,6 +529,8 @@ protected:
|
|||
sInstance = nullptr;
|
||||
}
|
||||
|
||||
bool IsInTransaction() { return mHandlingDeltaMode != PR_UINT32_MAX; }
|
||||
|
||||
/**
|
||||
* InitLineOrPageDelta() stores pixel delta values of WheelEvents which are
|
||||
* caused if it's needed. And if the accumulated delta becomes a
|
||||
|
@ -539,19 +541,34 @@ protected:
|
|||
mozilla::widget::WheelEvent* aEvent);
|
||||
|
||||
/**
|
||||
* Reset() resets both delta values.
|
||||
* Reset() resets all members.
|
||||
*/
|
||||
void Reset();
|
||||
|
||||
/**
|
||||
* ComputeScrollAmountForDefaultAction() computes the default action's
|
||||
* scroll amount in device pixels with mPendingScrollAmount*.
|
||||
*/
|
||||
nsIntPoint ComputeScrollAmountForDefaultAction(
|
||||
mozilla::widget::WheelEvent* aEvent,
|
||||
const nsIntSize& aScrollAmountInDevPixels);
|
||||
|
||||
private:
|
||||
DeltaAccumulator() :
|
||||
mX(0.0), mY(0.0), mHandlingDeltaMode(PR_UINT32_MAX),
|
||||
mHandlingPixelOnlyDevice(false)
|
||||
mX(0.0), mY(0.0), mPendingScrollAmountX(0.0), mPendingScrollAmountY(0.0),
|
||||
mHandlingDeltaMode(PR_UINT32_MAX), mHandlingPixelOnlyDevice(false)
|
||||
{
|
||||
}
|
||||
|
||||
double mX;
|
||||
double mY;
|
||||
|
||||
// When default action of a wheel event is scroll but some delta values
|
||||
// are ignored because the computed amount values are not integer, the
|
||||
// fractional values are saved by these members.
|
||||
double mPendingScrollAmountX;
|
||||
double mPendingScrollAmountY;
|
||||
|
||||
TimeStamp mLastTime;
|
||||
|
||||
PRUint32 mHandlingDeltaMode;
|
||||
|
|
|
@ -2734,12 +2734,14 @@ nsLayoutUtils::ComputeWidthValue(
|
|||
|
||||
nscoord result;
|
||||
if (aCoord.IsCoordPercentCalcUnit()) {
|
||||
result = nsRuleNode::ComputeCoordPercentCalc(aCoord, aContainingBlockWidth);
|
||||
result = nsRuleNode::ComputeCoordPercentCalc(aCoord,
|
||||
aContainingBlockWidth);
|
||||
// The result of a calc() expression might be less than 0; we
|
||||
// should clamp at runtime (below). (Percentages and coords that
|
||||
// are less than 0 have already been dropped by the parser.)
|
||||
result -= aContentEdgeToBoxSizing;
|
||||
} else if (eStyleUnit_Enumerated == aCoord.GetUnit()) {
|
||||
} else {
|
||||
MOZ_ASSERT(eStyleUnit_Enumerated == aCoord.GetUnit());
|
||||
// If aFrame is a container for font size inflation, then shrink
|
||||
// wrapping inside of it should not apply font size inflation.
|
||||
AutoMaybeDisableFontInflation an(aFrame);
|
||||
|
@ -2768,15 +2770,10 @@ nsLayoutUtils::ComputeWidthValue(
|
|||
result = aContainingBlockWidth -
|
||||
(aBoxSizingToMarginEdge + aContentEdgeToBoxSizing);
|
||||
}
|
||||
} else {
|
||||
NS_NOTREACHED("unexpected width value");
|
||||
result = 0;
|
||||
}
|
||||
if (result < 0)
|
||||
result = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
return NS_MAX(0, result);
|
||||
}
|
||||
|
||||
/* static */ nscoord
|
||||
nsLayoutUtils::ComputeHeightDependentValue(
|
||||
|
@ -2842,14 +2839,12 @@ nsLayoutUtils::ComputeSizeWithIntrinsicDimensions(
|
|||
width = nsLayoutUtils::ComputeWidthValue(aRenderingContext,
|
||||
aFrame, aCBSize.width, boxSizingAdjust.width,
|
||||
boxSizingToMarginEdgeWidth, stylePos->mWidth);
|
||||
NS_ASSERTION(width >= 0, "negative result from ComputeWidthValue");
|
||||
}
|
||||
|
||||
if (stylePos->mMaxWidth.GetUnit() != eStyleUnit_None) {
|
||||
maxWidth = nsLayoutUtils::ComputeWidthValue(aRenderingContext,
|
||||
aFrame, aCBSize.width, boxSizingAdjust.width,
|
||||
boxSizingToMarginEdgeWidth, stylePos->mMaxWidth);
|
||||
NS_ASSERTION(maxWidth >= 0, "negative result from ComputeWidthValue");
|
||||
} else {
|
||||
maxWidth = nscoord_MAX;
|
||||
}
|
||||
|
@ -2857,32 +2852,25 @@ nsLayoutUtils::ComputeSizeWithIntrinsicDimensions(
|
|||
minWidth = nsLayoutUtils::ComputeWidthValue(aRenderingContext,
|
||||
aFrame, aCBSize.width, boxSizingAdjust.width,
|
||||
boxSizingToMarginEdgeWidth, stylePos->mMinWidth);
|
||||
NS_ASSERTION(minWidth >= 0, "negative result from ComputeWidthValue");
|
||||
|
||||
if (!isAutoHeight) {
|
||||
height = nsLayoutUtils::
|
||||
ComputeHeightValue(aCBSize.height, stylePos->mHeight) -
|
||||
boxSizingAdjust.height;
|
||||
if (height < 0)
|
||||
height = 0;
|
||||
height = nsLayoutUtils::ComputeHeightValue(aCBSize.height,
|
||||
boxSizingAdjust.height,
|
||||
stylePos->mHeight);
|
||||
}
|
||||
|
||||
if (!IsAutoHeight(stylePos->mMaxHeight, aCBSize.height)) {
|
||||
maxHeight = nsLayoutUtils::
|
||||
ComputeHeightValue(aCBSize.height, stylePos->mMaxHeight) -
|
||||
boxSizingAdjust.height;
|
||||
if (maxHeight < 0)
|
||||
maxHeight = 0;
|
||||
maxHeight = nsLayoutUtils::ComputeHeightValue(aCBSize.height,
|
||||
boxSizingAdjust.height,
|
||||
stylePos->mMaxHeight);
|
||||
} else {
|
||||
maxHeight = nscoord_MAX;
|
||||
}
|
||||
|
||||
if (!IsAutoHeight(stylePos->mMinHeight, aCBSize.height)) {
|
||||
minHeight = nsLayoutUtils::
|
||||
ComputeHeightValue(aCBSize.height, stylePos->mMinHeight) -
|
||||
boxSizingAdjust.height;
|
||||
if (minHeight < 0)
|
||||
minHeight = 0;
|
||||
minHeight = nsLayoutUtils::ComputeHeightValue(aCBSize.height,
|
||||
boxSizingAdjust.height,
|
||||
stylePos->mMinHeight);
|
||||
} else {
|
||||
minHeight = 0;
|
||||
}
|
||||
|
|
|
@ -913,13 +913,17 @@ public:
|
|||
* Likewise, but for 'height', 'min-height', or 'max-height'.
|
||||
*/
|
||||
static nscoord ComputeHeightValue(nscoord aContainingBlockHeight,
|
||||
nscoord aContentEdgeToBoxSizingBoxEdge,
|
||||
const nsStyleCoord& aCoord)
|
||||
{
|
||||
MOZ_ASSERT(aContainingBlockHeight != NS_AUTOHEIGHT || !aCoord.HasPercent(),
|
||||
"caller must deal with %% of unconstrained height");
|
||||
MOZ_ASSERT(aCoord.IsCoordPercentCalcUnit());
|
||||
|
||||
nscoord result =
|
||||
ComputeHeightDependentValue(aContainingBlockHeight, aCoord);
|
||||
if (result < 0)
|
||||
result = 0; // clamp calc()
|
||||
return result;
|
||||
nsRuleNode::ComputeCoordPercentCalc(aCoord, aContainingBlockHeight);
|
||||
// Clamp calc(), and the subtraction for box-sizing.
|
||||
return NS_MAX(0, result - aContentEdgeToBoxSizingBoxEdge);
|
||||
}
|
||||
|
||||
static bool IsAutoHeight(const nsStyleCoord &aCoord, nscoord aCBHeight)
|
||||
|
|
|
@ -514,14 +514,12 @@ nsTextControlFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
// set values of reflow's out parameters
|
||||
aDesiredSize.width = aReflowState.ComputedWidth() +
|
||||
aReflowState.mComputedBorderPadding.LeftRight();
|
||||
aDesiredSize.height = NS_CSS_MINMAX(aReflowState.ComputedHeight(),
|
||||
aReflowState.mComputedMinHeight,
|
||||
aReflowState.mComputedMaxHeight);
|
||||
nscoord lineHeight = aDesiredSize.height;
|
||||
aDesiredSize.height += aReflowState.mComputedBorderPadding.TopBottom();
|
||||
aReflowState.mComputedBorderPadding.LeftRight();
|
||||
aDesiredSize.height = aReflowState.ComputedHeight() +
|
||||
aReflowState.mComputedBorderPadding.TopBottom();
|
||||
|
||||
// computation of the ascent wrt the input height
|
||||
nscoord lineHeight = aReflowState.ComputedHeight();
|
||||
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||
if (!IsSingleLineTextControl()) {
|
||||
lineHeight = nsHTMLReflowState::CalcLineHeight(GetStyleContext(),
|
||||
|
|
|
@ -3872,7 +3872,6 @@ nsFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
|||
}
|
||||
nscoord boxSizingToMarginEdgeWidth =
|
||||
aMargin.width + aBorder.width + aPadding.width - boxSizingAdjust.width;
|
||||
|
||||
// Compute width
|
||||
|
||||
if (stylePos->mWidth.GetUnit() != eStyleUnit_Auto) {
|
||||
|
@ -3887,40 +3886,38 @@ nsFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
|||
nsLayoutUtils::ComputeWidthValue(aRenderingContext, this,
|
||||
aCBSize.width, boxSizingAdjust.width, boxSizingToMarginEdgeWidth,
|
||||
stylePos->mMaxWidth);
|
||||
if (maxWidth < result.width)
|
||||
result.width = maxWidth;
|
||||
result.width = NS_MIN(maxWidth, result.width);
|
||||
}
|
||||
|
||||
nscoord minWidth =
|
||||
nsLayoutUtils::ComputeWidthValue(aRenderingContext, this,
|
||||
aCBSize.width, boxSizingAdjust.width, boxSizingToMarginEdgeWidth,
|
||||
stylePos->mMinWidth);
|
||||
if (minWidth > result.width)
|
||||
result.width = minWidth;
|
||||
result.width = NS_MAX(minWidth, result.width);
|
||||
|
||||
// Compute height
|
||||
|
||||
if (!nsLayoutUtils::IsAutoHeight(stylePos->mHeight, aCBSize.height)) {
|
||||
result.height =
|
||||
nsLayoutUtils::ComputeHeightValue(aCBSize.height, stylePos->mHeight) -
|
||||
boxSizingAdjust.height;
|
||||
nsLayoutUtils::ComputeHeightValue(aCBSize.height,
|
||||
boxSizingAdjust.height,
|
||||
stylePos->mHeight);
|
||||
}
|
||||
|
||||
if (result.height != NS_UNCONSTRAINEDSIZE) {
|
||||
if (!nsLayoutUtils::IsAutoHeight(stylePos->mMaxHeight, aCBSize.height)) {
|
||||
nscoord maxHeight =
|
||||
nsLayoutUtils::ComputeHeightValue(aCBSize.height, stylePos->mMaxHeight) -
|
||||
boxSizingAdjust.height;
|
||||
if (maxHeight < result.height)
|
||||
result.height = maxHeight;
|
||||
nsLayoutUtils::ComputeHeightValue(aCBSize.height,
|
||||
boxSizingAdjust.height,
|
||||
stylePos->mMaxHeight);
|
||||
result.height = NS_MIN(maxHeight, result.height);
|
||||
}
|
||||
|
||||
if (!nsLayoutUtils::IsAutoHeight(stylePos->mMinHeight, aCBSize.height)) {
|
||||
nscoord minHeight =
|
||||
nsLayoutUtils::ComputeHeightValue(aCBSize.height, stylePos->mMinHeight) -
|
||||
boxSizingAdjust.height;
|
||||
if (minHeight > result.height)
|
||||
result.height = minHeight;
|
||||
nsLayoutUtils::ComputeHeightValue(aCBSize.height,
|
||||
boxSizingAdjust.height,
|
||||
stylePos->mMinHeight);
|
||||
result.height = NS_MAX(minHeight, result.height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3947,11 +3944,8 @@ nsFrame::ComputeSize(nsRenderingContext *aRenderingContext,
|
|||
result.width = size.width;
|
||||
}
|
||||
|
||||
if (result.width < 0)
|
||||
result.width = 0;
|
||||
|
||||
if (result.height < 0)
|
||||
result.height = 0;
|
||||
result.width = NS_MAX(0, result.width);
|
||||
result.height = NS_MAX(0, result.height);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -2548,9 +2548,16 @@ nsGfxScrollFrameInner::GetLineScrollAmount() const
|
|||
nsLayoutUtils::GetFontMetricsForFrame(mOuter, getter_AddRefs(fm),
|
||||
nsLayoutUtils::FontSizeInflationFor(mOuter));
|
||||
NS_ASSERTION(fm, "FontMetrics is null, assuming fontHeight == 1 appunit");
|
||||
nscoord fontHeight = 1;
|
||||
static nscoord sMinLineScrollAmountInPixels = -1;
|
||||
if (sMinLineScrollAmountInPixels < 0) {
|
||||
Preferences::AddIntVarCache(&sMinLineScrollAmountInPixels,
|
||||
"mousewheel.min_line_scroll_amount", 1);
|
||||
}
|
||||
PRUint32 appUnitsPerDevPixel = mOuter->PresContext()->AppUnitsPerDevPixel();
|
||||
nscoord fontHeight =
|
||||
NS_MAX(1, sMinLineScrollAmountInPixels) * appUnitsPerDevPixel;
|
||||
if (fm) {
|
||||
fontHeight = fm->MaxHeight();
|
||||
fontHeight = NS_MAX(fm->MaxHeight(), fontHeight);
|
||||
}
|
||||
|
||||
return nsSize(fontHeight, fontHeight);
|
||||
|
|
|
@ -220,6 +220,24 @@ nsCSSOffsetState::ComputeWidthValue(nscoord aContainingBlockWidth,
|
|||
outside, aCoord);
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsCSSOffsetState::ComputeHeightValue(nscoord aContainingBlockHeight,
|
||||
PRUint8 aBoxSizing,
|
||||
const nsStyleCoord& aCoord)
|
||||
{
|
||||
nscoord inside = 0;
|
||||
switch (aBoxSizing) {
|
||||
case NS_STYLE_BOX_SIZING_BORDER:
|
||||
inside = mComputedBorderPadding.TopBottom();
|
||||
break;
|
||||
case NS_STYLE_BOX_SIZING_PADDING:
|
||||
inside = mComputedPadding.TopBottom();
|
||||
break;
|
||||
}
|
||||
return nsLayoutUtils::ComputeHeightValue(aContainingBlockHeight,
|
||||
inside, aCoord);
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLReflowState::SetComputedWidth(nscoord aComputedWidth)
|
||||
{
|
||||
|
@ -1962,8 +1980,9 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
|
|||
} else {
|
||||
NS_ASSERTION(heightUnit == mStylePosition->mHeight.GetUnit(),
|
||||
"unexpected height unit change");
|
||||
mComputedHeight = nsLayoutUtils::
|
||||
ComputeHeightValue(aContainingBlockHeight, mStylePosition->mHeight);
|
||||
mComputedHeight = ComputeHeightValue(aContainingBlockHeight,
|
||||
mStylePosition->mBoxSizing,
|
||||
mStylePosition->mHeight);
|
||||
}
|
||||
|
||||
// Doesn't apply to table elements
|
||||
|
@ -2468,8 +2487,9 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
|
|||
minHeight.IsCalcUnit())) {
|
||||
mComputedMinHeight = 0;
|
||||
} else {
|
||||
mComputedMinHeight = nsLayoutUtils::
|
||||
ComputeHeightValue(aContainingBlockHeight, minHeight);
|
||||
mComputedMinHeight = ComputeHeightValue(aContainingBlockHeight,
|
||||
mStylePosition->mBoxSizing,
|
||||
minHeight);
|
||||
}
|
||||
const nsStyleCoord &maxHeight = mStylePosition->mMaxHeight;
|
||||
nsStyleUnit maxHeightUnit = maxHeight.GetUnit();
|
||||
|
@ -2487,8 +2507,9 @@ nsHTMLReflowState::ComputeMinMaxValues(nscoord aContainingBlockWidth,
|
|||
maxHeight.IsCalcUnit())) {
|
||||
mComputedMaxHeight = NS_UNCONSTRAINEDSIZE;
|
||||
} else {
|
||||
mComputedMaxHeight = nsLayoutUtils::
|
||||
ComputeHeightValue(aContainingBlockHeight, maxHeight);
|
||||
mComputedMaxHeight = ComputeHeightValue(aContainingBlockHeight,
|
||||
mStylePosition->mBoxSizing,
|
||||
maxHeight);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -192,6 +192,10 @@ protected:
|
|||
nscoord ComputeWidthValue(nscoord aContainingBlockWidth,
|
||||
PRUint8 aBoxSizing,
|
||||
const nsStyleCoord& aCoord);
|
||||
|
||||
nscoord ComputeHeightValue(nscoord aContainingBlockHeight,
|
||||
PRUint8 aBoxSizing,
|
||||
const nsStyleCoord& aCoord);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for bug 776265</title>
|
||||
<style type="text/css">
|
||||
textarea {
|
||||
float: left;
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
border: 1px solid #aaa;
|
||||
padding: 4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body><textarea></textarea>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for bug 776265 - checks min-height with box-sizing: border-box</title>
|
||||
<style type="text/css">
|
||||
textarea {
|
||||
float: left;
|
||||
height: 40px;
|
||||
width: 50px;
|
||||
min-height: 50px;
|
||||
border: 1px solid #aaa;
|
||||
padding: 4px;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body><textarea></textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for bug 776265 checks max-height with box-sizing: border-box</title>
|
||||
<style type="text/css">
|
||||
textarea {
|
||||
float: left;
|
||||
height: 70px;
|
||||
width: 50px;
|
||||
max-height: 50px;
|
||||
border: 1px solid #aaa;
|
||||
padding: 4px;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body><textarea></textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for bug 776265 - checks min-width with box-sizing: border-box</title>
|
||||
<style type="text/css">
|
||||
textarea {
|
||||
float: left;
|
||||
width: 40px;
|
||||
height: 50px;
|
||||
min-width: 50px;
|
||||
border: 1px solid #aaa;
|
||||
padding: 4px;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body><textarea></textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,21 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for bug 776265 - checks max-width with box-sizing: border-box</title>
|
||||
<style type="text/css">
|
||||
textarea {
|
||||
float: left;
|
||||
width: 70px;
|
||||
height: 50px;
|
||||
max-width: 50px;
|
||||
border: 1px solid #aaa;
|
||||
padding: 4px;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body><textarea></textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for bug 776265</title>
|
||||
<style type="text/css">
|
||||
textarea {
|
||||
float: left;
|
||||
height: 50px;
|
||||
width: 50px;
|
||||
border: 1px solid #aaa;
|
||||
padding: 4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body><textarea></textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for bug 776265 - checks min-height</title>
|
||||
<style type="text/css">
|
||||
textarea {
|
||||
float: left;
|
||||
height: 30px;
|
||||
width: 50px;
|
||||
min-height: 50px;
|
||||
border: 1px solid #aaa;
|
||||
padding: 4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body><textarea></textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for bug 776265 - checks max-height</title>
|
||||
<style type="text/css">
|
||||
textarea {
|
||||
float: left;
|
||||
height: 70px;
|
||||
width: 50px;
|
||||
max-height: 50px;
|
||||
border: 1px solid #aaa;
|
||||
padding: 4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body><textarea></textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for bug 776265 - checks min-width</title>
|
||||
<style type="text/css">
|
||||
textarea {
|
||||
float: left;
|
||||
height: 50px;
|
||||
width: 30px;
|
||||
min-width: 50px;
|
||||
border: 1px solid #aaa;
|
||||
padding: 4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body><textarea></textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for bug 776265 - checks max-width</title>
|
||||
<style type="text/css">
|
||||
textarea {
|
||||
float: left;
|
||||
height: 50px;
|
||||
width: 70px;
|
||||
max-width: 50px;
|
||||
border: 1px solid #aaa;
|
||||
padding: 4px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body><textarea></textarea>
|
||||
</body>
|
||||
</html>
|
|
@ -1711,3 +1711,11 @@ needs-focus == 731726-1.html 731726-1-ref.html
|
|||
== 758561-1.html 758561-1-ref.html
|
||||
fuzzy-if(true,1,19) == 759036-1.html 759036-1-ref.html
|
||||
fuzzy-if(true,17,5859) == 759036-2.html 759036-2-ref.html
|
||||
== 776265-1a.html 776265-1-ref.html
|
||||
== 776265-1b.html 776265-1-ref.html
|
||||
== 776265-1c.html 776265-1-ref.html
|
||||
== 776265-1d.html 776265-1-ref.html
|
||||
== 776265-2a.html 776265-2-ref.html
|
||||
== 776265-2b.html 776265-2-ref.html
|
||||
== 776265-2c.html 776265-2-ref.html
|
||||
== 776265-2d.html 776265-2-ref.html
|
||||
|
|
|
@ -60,7 +60,7 @@ load 433296-1.xul
|
|||
load 434458-1.xul
|
||||
load 460900-1.xul
|
||||
load 464149-1.xul
|
||||
load 464407-1.xhtml
|
||||
asserts-if(winWidget,1) load 464407-1.xhtml # Bug 450974
|
||||
load 467481-1.xul
|
||||
load 470063-1.html
|
||||
load 472189.xul
|
||||
|
|
|
@ -1417,6 +1417,10 @@ pref("mousewheel.with_win.delta_multiplier_x", 100);
|
|||
pref("mousewheel.with_win.delta_multiplier_y", 100);
|
||||
pref("mousewheel.with_win.delta_multiplier_z", 100);
|
||||
|
||||
// If line-height is lower than this value (in device pixels), 1 line scroll
|
||||
// scrolls this height.
|
||||
pref("mousewheel.min_line_scroll_amount", 5);
|
||||
|
||||
// These define the smooth scroll behavior (min ms, max ms) for different triggers
|
||||
// Some triggers:
|
||||
// mouseWheel: Discrete mouse wheel events, Synaptics touchpads on windows (generate wheel events)
|
||||
|
|
Загрузка…
Ссылка в новой задаче