зеркало из https://github.com/mozilla/pjs.git
Bug 598833 part 7. Make IntrinsicState protected. r=smaug
This commit is contained in:
Родитель
f164dbb98f
Коммит
3857c96081
|
@ -696,16 +696,16 @@ nsAccessible::NativeState()
|
|||
PRUint64 state = 0;
|
||||
PRBool disabled = PR_FALSE;
|
||||
if (mContent->IsElement()) {
|
||||
nsEventStates intrinsicState = mContent->AsElement()->IntrinsicState();
|
||||
nsEventStates elementState = mContent->AsElement()->State();
|
||||
|
||||
if (intrinsicState.HasState(NS_EVENT_STATE_INVALID))
|
||||
if (elementState.HasState(NS_EVENT_STATE_INVALID))
|
||||
state |= states::INVALID;
|
||||
|
||||
if (intrinsicState.HasState(NS_EVENT_STATE_REQUIRED))
|
||||
if (elementState.HasState(NS_EVENT_STATE_REQUIRED))
|
||||
state |= states::REQUIRED;
|
||||
|
||||
disabled = mContent->IsHTML() ?
|
||||
(intrinsicState.HasState(NS_EVENT_STATE_DISABLED)) :
|
||||
(elementState.HasState(NS_EVENT_STATE_DISABLED)) :
|
||||
(mContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsAccessibilityAtoms::disabled,
|
||||
nsAccessibilityAtoms::_true,
|
||||
|
|
|
@ -81,7 +81,7 @@ nsHTMLLinkAccessible::NativeState()
|
|||
states |= states::SELECTABLE;
|
||||
}
|
||||
|
||||
nsEventStates state = mContent->AsElement()->IntrinsicState();
|
||||
nsEventStates state = mContent->AsElement()->State();
|
||||
if (state.HasAtLeastOneOfStates(NS_EVENT_STATE_VISITED |
|
||||
NS_EVENT_STATE_UNVISITED)) {
|
||||
states |= states::LINKED;
|
||||
|
@ -187,7 +187,7 @@ nsHTMLLinkAccessible::IsLinked()
|
|||
if (IsDefunct())
|
||||
return PR_FALSE;
|
||||
|
||||
nsEventStates state = mContent->AsElement()->IntrinsicState();
|
||||
nsEventStates state = mContent->AsElement()->State();
|
||||
return state.HasAtLeastOneOfStates(NS_EVENT_STATE_VISITED |
|
||||
NS_EVENT_STATE_UNVISITED);
|
||||
}
|
||||
|
|
|
@ -92,14 +92,6 @@ public:
|
|||
Element(already_AddRefed<nsINodeInfo> aNodeInfo) : nsIContent(aNodeInfo) {}
|
||||
#endif // MOZILLA_INTERNAL_API
|
||||
|
||||
/**
|
||||
* Method to get the _intrinsic_ content state of this element. This is the
|
||||
* state that is independent of the element's presentation. To get the full
|
||||
* content state, use State(). See nsEventStates.h for
|
||||
* the possible bits that could be set here.
|
||||
*/
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
/**
|
||||
* Method to get the full state of this element. See nsEventStates.h for
|
||||
* the possible bits that could be set here.
|
||||
|
@ -108,6 +100,15 @@ public:
|
|||
return IntrinsicState() | mState;
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Method to get the _intrinsic_ content state of this element. This is the
|
||||
* state that is independent of the element's presentation. To get the full
|
||||
* content state, use State(). See nsEventStates.h for
|
||||
* the possible bits that could be set here.
|
||||
*/
|
||||
virtual nsEventStates IntrinsicState() const;
|
||||
|
||||
private:
|
||||
// Need to allow the ESM, nsGlobalWindow, and the focus manager to
|
||||
// set our state
|
||||
|
|
|
@ -3553,11 +3553,11 @@ MakeContentDescendantsEditable(nsIContent *aContent, nsIDocument *aDocument)
|
|||
}
|
||||
|
||||
Element *element = aContent->AsElement();
|
||||
nsEventStates stateBefore = element->IntrinsicState();
|
||||
nsEventStates stateBefore = element->State();
|
||||
|
||||
element->UpdateEditableState();
|
||||
|
||||
if (aDocument && stateBefore != element->IntrinsicState()) {
|
||||
if (aDocument && stateBefore != element->State()) {
|
||||
aDocument->ContentStateChanged(element,
|
||||
NS_EVENT_STATE_MOZ_READONLY |
|
||||
NS_EVENT_STATE_MOZ_READWRITE);
|
||||
|
|
|
@ -3626,9 +3626,9 @@ nsCSSFrameConstructor::FindObjectData(Element* aElement,
|
|||
// cases when the object is broken/suppressed/etc (e.g. a broken image), but
|
||||
// we want to treat those cases as TYPE_NULL
|
||||
PRUint32 type;
|
||||
if (aElement->IntrinsicState().HasAtLeastOneOfStates(NS_EVENT_STATE_BROKEN |
|
||||
NS_EVENT_STATE_USERDISABLED |
|
||||
NS_EVENT_STATE_SUPPRESSED)) {
|
||||
if (aElement->State().HasAtLeastOneOfStates(NS_EVENT_STATE_BROKEN |
|
||||
NS_EVENT_STATE_USERDISABLED |
|
||||
NS_EVENT_STATE_SUPPRESSED)) {
|
||||
type = nsIObjectLoadingContent::TYPE_NULL;
|
||||
} else {
|
||||
nsCOMPtr<nsIObjectLoadingContent> objContent(do_QueryInterface(aElement));
|
||||
|
|
|
@ -86,10 +86,8 @@ nsButtonFrameRenderer::SetDisabled(PRBool aDisabled, PRBool notify)
|
|||
PRBool
|
||||
nsButtonFrameRenderer::isDisabled()
|
||||
{
|
||||
// NOTE: we might want to remove this method to prevent calling too often
|
||||
// IntrinsicState().
|
||||
return mFrame->GetContent()->AsElement()->
|
||||
IntrinsicState().HasState(NS_EVENT_STATE_DISABLED);
|
||||
State().HasState(NS_EVENT_STATE_DISABLED);
|
||||
}
|
||||
|
||||
class nsDisplayButtonBoxShadowOuter : public nsDisplayItem {
|
||||
|
|
|
@ -749,7 +749,7 @@ nsComboboxControlFrame::GetFrameName(nsAString& aResult) const
|
|||
void
|
||||
nsComboboxControlFrame::ShowDropDown(PRBool aDoDropDown)
|
||||
{
|
||||
nsEventStates eventStates = mContent->AsElement()->IntrinsicState();
|
||||
nsEventStates eventStates = mContent->AsElement()->State();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
|
||||
return;
|
||||
}
|
||||
|
@ -949,7 +949,7 @@ nsComboboxControlFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsEventStates eventStates = mContent->AsElement()->IntrinsicState();
|
||||
nsEventStates eventStates = mContent->AsElement()->State();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1405,7 +1405,7 @@ void nsComboboxControlFrame::PaintFocus(nsRenderingContext& aRenderingContext,
|
|||
nsPoint aPt)
|
||||
{
|
||||
/* Do we need to do anything? */
|
||||
nsEventStates eventStates = mContent->AsElement()->IntrinsicState();
|
||||
nsEventStates eventStates = mContent->AsElement()->State();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED) || mFocused != this)
|
||||
return;
|
||||
|
||||
|
|
|
@ -591,7 +591,7 @@ nsFileControlFrame::SyncAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
|||
void
|
||||
nsFileControlFrame::SyncDisabledState()
|
||||
{
|
||||
nsEventStates eventStates = mContent->AsElement()->IntrinsicState();
|
||||
nsEventStates eventStates = mContent->AsElement()->State();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
|
||||
mTextContent->SetAttr(kNameSpaceID_None, nsGkAtoms::disabled, EmptyString(),
|
||||
PR_TRUE);
|
||||
|
@ -704,7 +704,7 @@ nsFileControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
// Disabled file controls don't pass mouse events to their children, so we
|
||||
// put an invisible item in the display list above the children
|
||||
// just to catch events
|
||||
nsEventStates eventStates = mContent->AsElement()->IntrinsicState();
|
||||
nsEventStates eventStates = mContent->AsElement()->State();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED) && IsVisibleForPainting(aBuilder)) {
|
||||
rv = aLists.Content()->AppendNewToTop(
|
||||
new (aBuilder) nsDisplayEventReceiver(aBuilder, this));
|
||||
|
|
|
@ -1074,7 +1074,7 @@ nsListControlFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE || uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED)
|
||||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
||||
nsEventStates eventStates = mContent->AsElement()->IntrinsicState();
|
||||
nsEventStates eventStates = mContent->AsElement()->State();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED))
|
||||
return NS_OK;
|
||||
|
||||
|
@ -1915,7 +1915,7 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
|
|||
|
||||
mButtonDown = PR_FALSE;
|
||||
|
||||
nsEventStates eventStates = mContent->AsElement()->IntrinsicState();
|
||||
nsEventStates eventStates = mContent->AsElement()->State();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2124,7 +2124,7 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
|
||||
UpdateInListState(aMouseEvent);
|
||||
|
||||
nsEventStates eventStates = mContent->AsElement()->IntrinsicState();
|
||||
nsEventStates eventStates = mContent->AsElement()->State();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2431,7 +2431,7 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
{
|
||||
NS_ASSERTION(aKeyEvent, "keyEvent is null.");
|
||||
|
||||
nsEventStates eventStates = mContent->AsElement()->IntrinsicState();
|
||||
nsEventStates eventStates = mContent->AsElement()->State();
|
||||
if (eventStates.HasState(NS_EVENT_STATE_DISABLED))
|
||||
return NS_OK;
|
||||
|
||||
|
|
|
@ -476,7 +476,7 @@ PRBool
|
|||
nsImageFrame::ShouldCreateImageFrameFor(Element* aElement,
|
||||
nsStyleContext* aStyleContext)
|
||||
{
|
||||
nsEventStates state = aElement->IntrinsicState();
|
||||
nsEventStates state = aElement->State();
|
||||
if (IMAGE_OK(state,
|
||||
HaveFixedSize(aStyleContext->GetStylePosition()))) {
|
||||
// Image is fine; do the image frame thing
|
||||
|
@ -1164,7 +1164,7 @@ static void PaintAltFeedback(nsIFrame* aFrame, nsRenderingContext* aCtx,
|
|||
const nsRect& aDirtyRect, nsPoint aPt)
|
||||
{
|
||||
nsImageFrame* f = static_cast<nsImageFrame*>(aFrame);
|
||||
nsEventStates state = f->GetContent()->AsElement()->IntrinsicState();
|
||||
nsEventStates state = f->GetContent()->AsElement()->State();
|
||||
f->DisplayAltFeedback(*aCtx,
|
||||
aDirtyRect,
|
||||
IMAGE_OK(state, PR_TRUE)
|
||||
|
@ -1328,7 +1328,7 @@ nsImageFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
getter_AddRefs(currentRequest));
|
||||
}
|
||||
|
||||
nsEventStates contentState = mContent->AsElement()->IntrinsicState();
|
||||
nsEventStates contentState = mContent->AsElement()->State();
|
||||
PRBool imageOK = IMAGE_OK(contentState, PR_TRUE);
|
||||
|
||||
nsCOMPtr<imgIContainer> imgCon;
|
||||
|
|
|
@ -1168,7 +1168,7 @@ nsCSSRuleProcessor::GetContentState(Element* aElement)
|
|||
PRBool
|
||||
nsCSSRuleProcessor::IsLink(Element* aElement)
|
||||
{
|
||||
nsEventStates state = aElement->IntrinsicState();
|
||||
nsEventStates state = aElement->State();
|
||||
return state.HasAtLeastOneOfStates(NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче