Bug 1182414, part 1 - Fix printing crash with range input controls. r=dholbert

This commit is contained in:
Jonathan Watt 2015-08-03 12:08:32 +01:00
parent f6c85e45b0
commit 179d0aeed2
3 changed files with 20 additions and 7 deletions

View File

@ -265,15 +265,18 @@ nsMeterFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
bool
nsMeterFrame::ShouldUseNativeStyle() const
{
nsIFrame* barFrame = mBarDiv->GetPrimaryFrame();
// Use the native style if these conditions are satisfied:
// - both frames use the native appearance;
// - neither frame has author specified rules setting the border or the
// background.
return StyleDisplay()->mAppearance == NS_THEME_METERBAR &&
mBarDiv->GetPrimaryFrame()->StyleDisplay()->mAppearance == NS_THEME_METERBAR_CHUNK &&
!PresContext()->HasAuthorSpecifiedRules(this,
NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND) &&
!PresContext()->HasAuthorSpecifiedRules(mBarDiv->GetPrimaryFrame(),
barFrame &&
barFrame->StyleDisplay()->mAppearance == NS_THEME_METERBAR_CHUNK &&
!PresContext()->HasAuthorSpecifiedRules(barFrame,
NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND);
}

View File

@ -271,15 +271,18 @@ nsProgressFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
bool
nsProgressFrame::ShouldUseNativeStyle() const
{
nsIFrame* barFrame = mBarDiv->GetPrimaryFrame();
// Use the native style if these conditions are satisfied:
// - both frames use the native appearance;
// - neither frame has author specified rules setting the border or the
// background.
return StyleDisplay()->mAppearance == NS_THEME_PROGRESSBAR &&
mBarDiv->GetPrimaryFrame()->StyleDisplay()->mAppearance == NS_THEME_PROGRESSBAR_CHUNK &&
!PresContext()->HasAuthorSpecifiedRules(this,
NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND) &&
!PresContext()->HasAuthorSpecifiedRules(mBarDiv->GetPrimaryFrame(),
barFrame &&
barFrame->StyleDisplay()->mAppearance == NS_THEME_PROGRESSBAR_CHUNK &&
!PresContext()->HasAuthorSpecifiedRules(barFrame,
NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND);
}

View File

@ -837,15 +837,22 @@ nsRangeFrame::GetType() const
bool
nsRangeFrame::ShouldUseNativeStyle() const
{
nsIFrame* trackFrame = mTrackDiv->GetPrimaryFrame();
nsIFrame* progressFrame = mProgressDiv->GetPrimaryFrame();
nsIFrame* thumbFrame = mThumbDiv->GetPrimaryFrame();
return (StyleDisplay()->mAppearance == NS_THEME_RANGE) &&
!PresContext()->HasAuthorSpecifiedRules(this,
(NS_AUTHOR_SPECIFIED_BORDER |
NS_AUTHOR_SPECIFIED_BACKGROUND)) &&
!PresContext()->HasAuthorSpecifiedRules(mTrackDiv->GetPrimaryFrame(),
trackFrame &&
!PresContext()->HasAuthorSpecifiedRules(trackFrame,
STYLES_DISABLING_NATIVE_THEMING) &&
!PresContext()->HasAuthorSpecifiedRules(mProgressDiv->GetPrimaryFrame(),
progressFrame &&
!PresContext()->HasAuthorSpecifiedRules(progressFrame,
STYLES_DISABLING_NATIVE_THEMING) &&
!PresContext()->HasAuthorSpecifiedRules(mThumbDiv->GetPrimaryFrame(),
thumbFrame &&
!PresContext()->HasAuthorSpecifiedRules(thumbFrame,
STYLES_DISABLING_NATIVE_THEMING);
}