зеркало из https://github.com/mozilla/pjs.git
Make image controls splittable just like regular images. Bug 409659, r+sr=roc, a=dsicore
This commit is contained in:
Родитель
f736aa7fdb
Коммит
6a06ad9346
|
@ -10698,6 +10698,12 @@ nsCSSFrameConstructor::CreateContinuingFrame(nsPresContext* aPresContext,
|
|||
if (newFrame) {
|
||||
newFrame->Init(content, aParentFrame, aFrame);
|
||||
}
|
||||
} else if (nsGkAtoms::imageControlFrame == frameType) {
|
||||
newFrame = NS_NewImageControlFrame(shell, styleContext);
|
||||
|
||||
if (newFrame) {
|
||||
newFrame->Init(content, aParentFrame, aFrame);
|
||||
}
|
||||
} else if (nsGkAtoms::placeholderFrame == frameType) {
|
||||
// create a continuing out of flow frame
|
||||
nsIFrame* oofFrame = nsPlaceholderFrame::GetRealFrameForPlaceholder(aFrame);
|
||||
|
|
|
@ -129,7 +129,9 @@ nsImageControlFrame::~nsImageControlFrame()
|
|||
void
|
||||
nsImageControlFrame::Destroy()
|
||||
{
|
||||
nsFormControlFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), PR_FALSE);
|
||||
if (!GetPrevInFlow()) {
|
||||
nsFormControlFrame::RegUnRegAccessKey(this, PR_FALSE);
|
||||
}
|
||||
nsImageControlFrameSuper::Destroy();
|
||||
}
|
||||
|
||||
|
@ -149,6 +151,10 @@ nsImageControlFrame::Init(nsIContent* aContent,
|
|||
|
||||
// nsIntPoint allocation can fail, in which case we just set the property
|
||||
// to null, which is safe
|
||||
if (aPrevInFlow) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return mContent->SetProperty(nsGkAtoms::imageClickedPoint,
|
||||
new nsIntPoint(0, 0),
|
||||
IntPointDtorFunc);
|
||||
|
@ -212,8 +218,8 @@ nsImageControlFrame::Reflow(nsPresContext* aPresContext,
|
|||
{
|
||||
DO_GLOBAL_REFLOW_COUNT("nsImageControlFrame");
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
if (mState & NS_FRAME_FIRST_REFLOW) {
|
||||
nsFormControlFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), PR_TRUE);
|
||||
if (!GetPrevInFlow() && (mState & NS_FRAME_FIRST_REFLOW)) {
|
||||
nsFormControlFrame::RegUnRegAccessKey(this, PR_TRUE);
|
||||
}
|
||||
return nsImageControlFrameSuper::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
}
|
||||
|
|
|
@ -834,12 +834,10 @@ nsImageFrame::Reflow(nsPresContext* aPresContext,
|
|||
((loadStatus & imgIRequest::STATUS_SIZE_AVAILABLE) || (mState & IMAGE_SIZECONSTRAINED)) &&
|
||||
NS_UNCONSTRAINEDSIZE != aReflowState.availableHeight &&
|
||||
aMetrics.height > aReflowState.availableHeight) {
|
||||
// split an image frame but not an image control frame
|
||||
if (nsGkAtoms::imageFrame == GetType()) {
|
||||
// our desired height was greater than 0, so to avoid infinite splitting, use 1 pixel as the min
|
||||
aMetrics.height = PR_MAX(nsPresContext::CSSPixelsToAppUnits(1), aReflowState.availableHeight);
|
||||
aStatus = NS_FRAME_NOT_COMPLETE;
|
||||
}
|
||||
// our desired height was greater than 0, so to avoid infinite
|
||||
// splitting, use 1 pixel as the min
|
||||
aMetrics.height = PR_MAX(nsPresContext::CSSPixelsToAppUnits(1), aReflowState.availableHeight);
|
||||
aStatus = NS_FRAME_NOT_COMPLETE;
|
||||
}
|
||||
|
||||
aMetrics.mOverflowArea.SetRect(0, 0, aMetrics.width, aMetrics.height);
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-print">
|
||||
<body>
|
||||
<img src="solidblue.png" style="height: 4in; width: 100px; display: block">
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,7 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-print">
|
||||
<body>
|
||||
<input type="image" src="solidblue.png"
|
||||
style="height: 4in; width: 100px; display: block">
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-print">
|
||||
<body>
|
||||
<img src="solidblue.png" style="height: 2in; width: 100px; display: block">
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-print">
|
||||
<body>
|
||||
<img src="solidblue.png" style="height: 30in; width: 100px; display: block">
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="reftest-print">
|
||||
<body>
|
||||
<img src="solidblue.png" style="height: 1in; width: 100px; display: block">
|
||||
<img src="solidblue.png" style="height: 1in; width: 100px; display: block">
|
||||
<img src="solidblue.png" style="height: 1in; width: 100px; display: block">
|
||||
<img src="solidblue.png" style="height: 1in; width: 100px; display: block">
|
||||
</body>
|
||||
</html>
|
|
@ -618,3 +618,7 @@ random == 403134-1.html 403134-1-ref.html # bug 405377
|
|||
== 408782-1b.html 408782-1-ref.html
|
||||
== 408782-2a.html 408782-2-ref.html
|
||||
== 408782-2b.html 408782-2-ref.html
|
||||
== 409659-1a.html 409659-1-ref.html
|
||||
!= 409659-1b.html 409659-1-ref.html
|
||||
!= 409659-1c.html 409659-1-ref.html
|
||||
== 409659-1d.html 409659-1-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче