mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-06-06 22:29:34 +00:00
#493: image max-width M823483 M1247929
This commit is contained in:
parent
84b5506db7
commit
5f4c3c9c15
|
@ -1971,6 +1971,7 @@ GK_ATOM(letterFrame, "LetterFrame")
|
||||||
GK_ATOM(lineFrame, "LineFrame")
|
GK_ATOM(lineFrame, "LineFrame")
|
||||||
GK_ATOM(listControlFrame,"ListControlFrame")
|
GK_ATOM(listControlFrame,"ListControlFrame")
|
||||||
GK_ATOM(menuFrame,"MenuFrame")
|
GK_ATOM(menuFrame,"MenuFrame")
|
||||||
|
GK_ATOM(meterFrame, "MeterFrame")
|
||||||
GK_ATOM(menuPopupFrame,"MenuPopupFrame")
|
GK_ATOM(menuPopupFrame,"MenuPopupFrame")
|
||||||
GK_ATOM(numberControlFrame, "NumberControlFrame")
|
GK_ATOM(numberControlFrame, "NumberControlFrame")
|
||||||
GK_ATOM(objectFrame, "ObjectFrame")
|
GK_ATOM(objectFrame, "ObjectFrame")
|
||||||
|
@ -1979,6 +1980,7 @@ GK_ATOM(pageBreakFrame, "PageBreakFrame")
|
||||||
GK_ATOM(pageContentFrame, "PageContentFrame")
|
GK_ATOM(pageContentFrame, "PageContentFrame")
|
||||||
GK_ATOM(placeholderFrame, "PlaceholderFrame")
|
GK_ATOM(placeholderFrame, "PlaceholderFrame")
|
||||||
GK_ATOM(popupSetFrame, "PopupSetFrame")
|
GK_ATOM(popupSetFrame, "PopupSetFrame")
|
||||||
|
GK_ATOM(progressFrame, "ProgressFrame")
|
||||||
GK_ATOM(canvasFrame, "CanvasFrame")
|
GK_ATOM(canvasFrame, "CanvasFrame")
|
||||||
GK_ATOM(rangeFrame, "RangeFrame")
|
GK_ATOM(rangeFrame, "RangeFrame")
|
||||||
GK_ATOM(rootFrame, "RootFrame")
|
GK_ATOM(rootFrame, "RootFrame")
|
||||||
|
|
|
@ -4489,6 +4489,43 @@ GetIntrinsicCoord(const nsStyleCoord& aStyle,
|
||||||
static int32_t gNoiseIndent = 0;
|
static int32_t gNoiseIndent = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Return true for form controls whose minimum intrinsic inline-size
|
||||||
|
// shrinks to 0 when they have a percentage inline-size (but not
|
||||||
|
// percentage max-inline-size). (Proper replaced elements, whose
|
||||||
|
// intrinsic minimium inline-size shrinks to 0 for both percentage
|
||||||
|
// inline-size and percentage max-inline-size, are handled elsewhere.)
|
||||||
|
inline static bool
|
||||||
|
FormControlShrinksForPercentISize(nsIFrame* aFrame)
|
||||||
|
{
|
||||||
|
if (!aFrame->IsFrameOfType(nsIFrame::eReplaced)) {
|
||||||
|
// Quick test to reject most frames.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsIAtom* fType = aFrame->GetType();
|
||||||
|
if (fType == nsGkAtoms::meterFrame || fType == nsGkAtoms::progressFrame) {
|
||||||
|
// progress and meter do have this shrinking behavior
|
||||||
|
// FIXME: Maybe these should be nsIFormControlFrame?
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!static_cast<nsIFormControlFrame*>(do_QueryFrame(aFrame))) {
|
||||||
|
// Not a form control. This includes fieldsets, which do not
|
||||||
|
// shrink.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fType == nsGkAtoms::gfxButtonControlFrame ||
|
||||||
|
fType == nsGkAtoms::HTMLButtonControlFrame) {
|
||||||
|
// Buttons don't have this shrinking behavior. (Note that color
|
||||||
|
// inputs do, even though they inherit from button, so we can't use
|
||||||
|
// do_QueryFrame here.)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add aOffsets which describes what to add on outside of the content box
|
* Add aOffsets which describes what to add on outside of the content box
|
||||||
* aContentSize (controlled by 'box-sizing') and apply min/max properties.
|
* aContentSize (controlled by 'box-sizing') and apply min/max properties.
|
||||||
|
@ -4565,19 +4602,23 @@ AddIntrinsicSizeOffset(nsRenderingContext* aRenderingContext,
|
||||||
pctTotal += pctOutsideSize;
|
pctTotal += pctOutsideSize;
|
||||||
|
|
||||||
nscoord size;
|
nscoord size;
|
||||||
if (GetAbsoluteCoord(aStyleSize, size) ||
|
if (aType == nsLayoutUtils::MIN_ISIZE &&
|
||||||
GetIntrinsicCoord(aStyleSize, aRenderingContext, aFrame,
|
(((aStyleSize.HasPercent() || aStyleMaxSize.HasPercent()) &&
|
||||||
PROP_WIDTH, size)) {
|
aFrame->IsFrameOfType(nsIFrame::eReplacedSizing)) ||
|
||||||
|
(aStyleSize.HasPercent() &&
|
||||||
|
FormControlShrinksForPercentISize(aFrame)))) {
|
||||||
|
// A percentage width or max-width on replaced elements means they
|
||||||
|
// can shrink to 0.
|
||||||
|
// This is also true for percentage widths (but not max-widths) on
|
||||||
|
// text inputs.
|
||||||
|
// Note that if this is max-width, this overrides the fixed-width
|
||||||
|
// rule in the next condition.
|
||||||
|
result = 0; // let |min| handle padding/border/margin
|
||||||
|
} else if (GetAbsoluteCoord(aStyleSize, size) ||
|
||||||
|
GetIntrinsicCoord(aStyleSize, aRenderingContext, aFrame,
|
||||||
|
PROP_WIDTH, size)) {
|
||||||
result = nsLayoutUtils::AddPercents(aType, size + coordOutsideSize,
|
result = nsLayoutUtils::AddPercents(aType, size + coordOutsideSize,
|
||||||
pctOutsideSize);
|
pctOutsideSize);
|
||||||
} else if (aType == nsLayoutUtils::MIN_ISIZE &&
|
|
||||||
// The only cases of coord-percent-calc() units that
|
|
||||||
// GetAbsoluteCoord didn't handle are percent and calc()s
|
|
||||||
// containing percent.
|
|
||||||
aStyleSize.IsCoordPercentCalcUnit() &&
|
|
||||||
aFrame->IsFrameOfType(nsIFrame::eReplaced)) {
|
|
||||||
// A percentage width on replaced elements means they can shrink to 0.
|
|
||||||
result = 0; // let |min| handle padding/border/margin
|
|
||||||
} else {
|
} else {
|
||||||
// NOTE: We could really do a lot better for percents and for some
|
// NOTE: We could really do a lot better for percents and for some
|
||||||
// cases of calc() containing percent (certainly including any where
|
// cases of calc() containing percent (certainly including any where
|
||||||
|
|
|
@ -56,6 +56,12 @@ nsMeterFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
||||||
nsContainerFrame::DestroyFrom(aDestructRoot);
|
nsContainerFrame::DestroyFrom(aDestructRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsIAtom*
|
||||||
|
nsMeterFrame::GetType() const
|
||||||
|
{
|
||||||
|
return nsGkAtoms::meterFrame;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsMeterFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
nsMeterFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,6 +32,8 @@ public:
|
||||||
const nsHTMLReflowState& aReflowState,
|
const nsHTMLReflowState& aReflowState,
|
||||||
nsReflowStatus& aStatus) override;
|
nsReflowStatus& aStatus) override;
|
||||||
|
|
||||||
|
virtual nsIAtom* GetType() const override;
|
||||||
|
|
||||||
#ifdef DEBUG_FRAME_DUMP
|
#ifdef DEBUG_FRAME_DUMP
|
||||||
virtual nsresult GetFrameName(nsAString& aResult) const override {
|
virtual nsresult GetFrameName(nsAString& aResult) const override {
|
||||||
return MakeFrameName(NS_LITERAL_STRING("Meter"), aResult);
|
return MakeFrameName(NS_LITERAL_STRING("Meter"), aResult);
|
||||||
|
|
|
@ -55,6 +55,12 @@ nsProgressFrame::DestroyFrom(nsIFrame* aDestructRoot)
|
||||||
nsContainerFrame::DestroyFrom(aDestructRoot);
|
nsContainerFrame::DestroyFrom(aDestructRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsIAtom*
|
||||||
|
nsProgressFrame::GetType() const
|
||||||
|
{
|
||||||
|
return nsGkAtoms::progressFrame;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsProgressFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
nsProgressFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,6 +35,8 @@ public:
|
||||||
const nsHTMLReflowState& aReflowState,
|
const nsHTMLReflowState& aReflowState,
|
||||||
nsReflowStatus& aStatus) override;
|
nsReflowStatus& aStatus) override;
|
||||||
|
|
||||||
|
virtual nsIAtom* GetType() const override;
|
||||||
|
|
||||||
#ifdef DEBUG_FRAME_DUMP
|
#ifdef DEBUG_FRAME_DUMP
|
||||||
virtual nsresult GetFrameName(nsAString& aResult) const override {
|
virtual nsresult GetFrameName(nsAString& aResult) const override {
|
||||||
return MakeFrameName(NS_LITERAL_STRING("Progress"), aResult);
|
return MakeFrameName(NS_LITERAL_STRING("Progress"), aResult);
|
||||||
|
|
|
@ -86,7 +86,8 @@ public:
|
||||||
|
|
||||||
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
||||||
{
|
{
|
||||||
return nsSplittableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced));
|
return nsSplittableFrame::IsFrameOfType(aFlags &
|
||||||
|
~(nsIFrame::eReplaced | nsIFrame::eReplacedSizing));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_FRAME_DUMP
|
#ifdef DEBUG_FRAME_DUMP
|
||||||
|
|
|
@ -2123,6 +2123,11 @@ public:
|
||||||
eExcludesIgnorableWhitespace = 1 << 14,
|
eExcludesIgnorableWhitespace = 1 << 14,
|
||||||
eSupportsCSSTransforms = 1 << 15,
|
eSupportsCSSTransforms = 1 << 15,
|
||||||
|
|
||||||
|
// A replaced element that has replaced-element sizing
|
||||||
|
// characteristics (i.e., like images or iframes), as opposed to
|
||||||
|
// inline-block sizing characteristics (like form controls).
|
||||||
|
eReplacedSizing = 1 << 16,
|
||||||
|
|
||||||
// These are to allow nsFrame::Init to assert that IsFrameOfType
|
// These are to allow nsFrame::Init to assert that IsFrameOfType
|
||||||
// implementations all call the base class method. They are only
|
// implementations all call the base class method. They are only
|
||||||
// meaningful in DEBUG builds.
|
// meaningful in DEBUG builds.
|
||||||
|
|
|
@ -112,7 +112,8 @@ public:
|
||||||
|
|
||||||
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
||||||
{
|
{
|
||||||
return ImageFrameSuper::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced));
|
return ImageFrameSuper::IsFrameOfType(aFlags &
|
||||||
|
~(nsIFrame::eReplaced | nsIFrame::eReplacedSizing));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_FRAME_DUMP
|
#ifdef DEBUG_FRAME_DUMP
|
||||||
|
|
|
@ -91,7 +91,8 @@ public:
|
||||||
|
|
||||||
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
||||||
{
|
{
|
||||||
return nsPluginFrameSuper::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced));
|
return nsPluginFrameSuper::IsFrameOfType(aFlags &
|
||||||
|
~(nsIFrame::eReplaced | nsIFrame::eReplacedSizing));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool NeedsView() override { return true; }
|
virtual bool NeedsView() override { return true; }
|
||||||
|
|
|
@ -37,7 +37,9 @@ public:
|
||||||
{
|
{
|
||||||
// nsLeafFrame is already eReplacedContainsBlock, but that's somewhat bogus
|
// nsLeafFrame is already eReplacedContainsBlock, but that's somewhat bogus
|
||||||
return nsLeafFrame::IsFrameOfType(aFlags &
|
return nsLeafFrame::IsFrameOfType(aFlags &
|
||||||
~(nsIFrame::eReplaced | nsIFrame::eReplacedContainsBlock));
|
~(nsIFrame::eReplaced |
|
||||||
|
nsIFrame::eReplacedSizing |
|
||||||
|
nsIFrame::eReplacedContainsBlock));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Init(nsIContent* aContent,
|
virtual void Init(nsIContent* aContent,
|
||||||
|
|
|
@ -77,7 +77,8 @@ public:
|
||||||
|
|
||||||
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
||||||
{
|
{
|
||||||
return nsSplittableFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced));
|
return nsSplittableFrame::IsFrameOfType(aFlags &
|
||||||
|
~(nsIFrame::eReplaced | nsIFrame::eReplacedSizing));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
|
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user