Bug 1195857: Make nsPresContext::HasAuthorSpecifiedRules()'s arg 'const', to remove need for const_cast in callers. r=jwatt

This commit is contained in:
Daniel Holbert 2015-08-18 15:41:24 -07:00
parent b9e9d253f8
commit c2f9caa032
5 changed files with 7 additions and 5 deletions

View File

@ -2115,7 +2115,8 @@ nsPresContext::UpdateIsChrome()
} }
/* virtual */ bool /* virtual */ bool
nsPresContext::HasAuthorSpecifiedRules(nsIFrame *aFrame, uint32_t ruleTypeMask) const nsPresContext::HasAuthorSpecifiedRules(const nsIFrame *aFrame,
uint32_t ruleTypeMask) const
{ {
return return
nsRuleNode::HasAuthorSpecifiedRules(aFrame->StyleContext(), nsRuleNode::HasAuthorSpecifiedRules(aFrame->StyleContext(),

View File

@ -854,7 +854,8 @@ public:
void UpdateIsChrome(); void UpdateIsChrome();
// Public API for native theme code to get style internals. // Public API for native theme code to get style internals.
virtual bool HasAuthorSpecifiedRules(nsIFrame *aFrame, uint32_t ruleTypeMask) const; virtual bool HasAuthorSpecifiedRules(const nsIFrame *aFrame,
uint32_t ruleTypeMask) const;
// Is it OK to let the page specify colors and backgrounds? // Is it OK to let the page specify colors and backgrounds?
bool UseDocumentColors() const { bool UseDocumentColors() const {

View File

@ -271,7 +271,7 @@ nsMeterFrame::ShouldUseNativeStyle() const
// background. // background.
return StyleDisplay()->mAppearance == NS_THEME_METERBAR && return StyleDisplay()->mAppearance == NS_THEME_METERBAR &&
mBarDiv->GetPrimaryFrame()->StyleDisplay()->mAppearance == NS_THEME_METERBAR_CHUNK && mBarDiv->GetPrimaryFrame()->StyleDisplay()->mAppearance == NS_THEME_METERBAR_CHUNK &&
!PresContext()->HasAuthorSpecifiedRules(const_cast<nsMeterFrame*>(this), !PresContext()->HasAuthorSpecifiedRules(this,
NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND) && NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND) &&
!PresContext()->HasAuthorSpecifiedRules(mBarDiv->GetPrimaryFrame(), !PresContext()->HasAuthorSpecifiedRules(mBarDiv->GetPrimaryFrame(),
NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND); NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND);

View File

@ -277,7 +277,7 @@ nsProgressFrame::ShouldUseNativeStyle() const
// background. // background.
return StyleDisplay()->mAppearance == NS_THEME_PROGRESSBAR && return StyleDisplay()->mAppearance == NS_THEME_PROGRESSBAR &&
mBarDiv->GetPrimaryFrame()->StyleDisplay()->mAppearance == NS_THEME_PROGRESSBAR_CHUNK && mBarDiv->GetPrimaryFrame()->StyleDisplay()->mAppearance == NS_THEME_PROGRESSBAR_CHUNK &&
!PresContext()->HasAuthorSpecifiedRules(const_cast<nsProgressFrame*>(this), !PresContext()->HasAuthorSpecifiedRules(this,
NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND) && NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND) &&
!PresContext()->HasAuthorSpecifiedRules(mBarDiv->GetPrimaryFrame(), !PresContext()->HasAuthorSpecifiedRules(mBarDiv->GetPrimaryFrame(),
NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND); NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND);

View File

@ -838,7 +838,7 @@ bool
nsRangeFrame::ShouldUseNativeStyle() const nsRangeFrame::ShouldUseNativeStyle() const
{ {
return (StyleDisplay()->mAppearance == NS_THEME_RANGE) && return (StyleDisplay()->mAppearance == NS_THEME_RANGE) &&
!PresContext()->HasAuthorSpecifiedRules(const_cast<nsRangeFrame*>(this), !PresContext()->HasAuthorSpecifiedRules(this,
(NS_AUTHOR_SPECIFIED_BORDER | (NS_AUTHOR_SPECIFIED_BORDER |
NS_AUTHOR_SPECIFIED_BACKGROUND)) && NS_AUTHOR_SPECIFIED_BACKGROUND)) &&
!PresContext()->HasAuthorSpecifiedRules(mTrackDiv->GetPrimaryFrame(), !PresContext()->HasAuthorSpecifiedRules(mTrackDiv->GetPrimaryFrame(),