зеркало из https://github.com/mozilla/gecko-dev.git
Bug 368554 - "[quirks] Image inside table inside table-cell with small width is wrapped" [p=chris@pearce.org.nz (Chris Pearce [cpearce]) r+sr=roc a=blocking1.9+]
This commit is contained in:
Родитель
3a4d5df30f
Коммит
0a89edbe84
|
@ -4040,6 +4040,9 @@ nsCSSFrameConstructor::ConstructTableCellFrame(nsFrameConstructorState& aState,
|
|||
aNewCellOuterFrame = NS_NewMathMLmtdFrame(mPresShell, aStyleContext);
|
||||
else
|
||||
#endif
|
||||
// Warning: If you change this and add a wrapper frame around table cell
|
||||
// frames, make sure Bug 368554 doesn't regress!
|
||||
// See IsInAutoWidthTableCellForQuirk() in nsImageFrame.cpp.
|
||||
aNewCellOuterFrame = NS_NewTableCellFrame(mPresShell, aStyleContext,
|
||||
IsBorderCollapse(parentFrame));
|
||||
|
||||
|
@ -10646,6 +10649,9 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
} else if (IS_TABLE_CELL(frameType)) {
|
||||
// Warning: If you change this and add a wrapper frame around table cell
|
||||
// frames, make sure Bug 368554 doesn't regress!
|
||||
// See IsInAutoWidthTableCellForQuirk() in nsImageFrame.cpp.
|
||||
newFrame = NS_NewTableCellFrame(shell, styleContext, IsBorderCollapse(aParentFrame));
|
||||
|
||||
if (newFrame) {
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "nsIDocument.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCSSAnonBoxes.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsImageMap.h"
|
||||
|
@ -1867,3 +1868,45 @@ NS_IMETHODIMP nsImageListener::FrameChanged(imgIContainer *aContainer,
|
|||
return mFrame->FrameChanged(aContainer, newframe, dirtyRect);
|
||||
}
|
||||
|
||||
static PRBool
|
||||
IsInAutoWidthTableCellForQuirk(nsIFrame *aFrame)
|
||||
{
|
||||
if (eCompatibility_NavQuirks != aFrame->PresContext()->CompatibilityMode())
|
||||
return PR_FALSE;
|
||||
// Check if the parent of the closest nsBlockFrame has auto width.
|
||||
nsBlockFrame *ancestor = nsLayoutUtils::FindNearestBlockAncestor(aFrame);
|
||||
if (ancestor->GetStyleContext()->GetPseudoType() == nsCSSAnonBoxes::cellContent) {
|
||||
// Assume direct parent is a table cell frame.
|
||||
nsFrame *grandAncestor = static_cast<nsFrame*>(ancestor->GetParent());
|
||||
return grandAncestor &&
|
||||
grandAncestor->GetStylePosition()->mWidth.GetUnit() == eStyleUnit_Auto;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
nsImageFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
|
||||
nsIFrame::InlineMinWidthData *aData)
|
||||
{
|
||||
|
||||
NS_ASSERTION(GetParent(), "Must have a parent if we get here!");
|
||||
|
||||
PRBool canBreak =
|
||||
!CanContinueTextRun() &&
|
||||
GetParent()->GetStyleText()->WhiteSpaceCanWrap() &&
|
||||
!IsInAutoWidthTableCellForQuirk(this);
|
||||
|
||||
if (canBreak)
|
||||
aData->OptionallyBreak(aRenderingContext);
|
||||
|
||||
aData->trailingWhitespace = 0;
|
||||
aData->skipWhitespace = PR_FALSE;
|
||||
aData->trailingTextFrame = nsnull;
|
||||
aData->currentLine += nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
|
||||
this, nsLayoutUtils::MIN_WIDTH);
|
||||
aData->atStartOfLine = PR_FALSE;
|
||||
|
||||
if (canBreak)
|
||||
aData->OptionallyBreak(aRenderingContext);
|
||||
|
||||
}
|
||||
|
|
|
@ -173,6 +173,9 @@ public:
|
|||
|
||||
nsImageMap* GetImageMap(nsPresContext* aPresContext);
|
||||
|
||||
virtual void AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
|
||||
InlineMinWidthData *aData);
|
||||
|
||||
protected:
|
||||
// nsISupports
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
<html>
|
||||
<head><title>[384322] Testcase</title>
|
||||
</head>
|
||||
<body bgcolor="white">
|
||||
|
||||
<p><img><img>Hello<img><img>
|
||||
|
||||
<table bgcolor="lightgray" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td bgcolor="red">
|
||||
<img width="50" height="50"><img width="50" height="50">Hello<img width="50" height="50"><img width="50" height="50">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><img><img>Hello</p>
|
||||
|
||||
<table bgcolor="lightgray" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td bgcolor="red">
|
||||
<img width="50" height="50"><img width="50" height="50">Hello
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p>Hello<img><img></p>
|
||||
|
||||
<table bgcolor="lightgray" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td bgcolor="red">
|
||||
Hello<img width="50" height="50"><img width="50" height="50">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><img>Hello</p>
|
||||
|
||||
<table bgcolor="lightgray" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td bgcolor="red">
|
||||
<img width="50" height="50">Hello
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,55 @@
|
|||
<html>
|
||||
<head><title>[384322] Testcase</title>
|
||||
</head>
|
||||
<body bgcolor="white">
|
||||
|
||||
<p><img><img>Hello<img><img>
|
||||
|
||||
<table bgcolor="lightgray" width="70" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td bgcolor="red">
|
||||
<img width="50" height="50"><img width="50" height="50">Hello<img width="50" height="50"><img width="50" height="50">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><img><img>Hello</p>
|
||||
|
||||
<table bgcolor="lightgray" width="70" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td bgcolor="red">
|
||||
<img width="50" height="50"><img width="50" height="50">Hello
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p>Hello<img><img></p>
|
||||
|
||||
<table bgcolor="lightgray" width="70" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td bgcolor="red">
|
||||
Hello<img width="50" height="50"><img width="50" height="50">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><img>Hello</p>
|
||||
|
||||
<table bgcolor="lightgray" width="70" border="0" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td bgcolor="red">
|
||||
<img width="50" height="50">Hello
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -377,6 +377,7 @@ random-if(MOZ_WIDGET_TOOLKIT=="cocoa") == 379316-2.html 379316-2-ref.html # bug
|
|||
== 383883-4.html 383883-4-ref.html
|
||||
== 383884-1.html 383884-1-ref.html
|
||||
== 383885-1.html 383885-1-ref.html
|
||||
== 384322-1.html 384322-1-ref.html
|
||||
== 384576-1.html 384576-1-ref.html
|
||||
== 384762-1.html about:blank
|
||||
== 384876-1.html 384876-1-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче