Revert "backout bug 1134280 for fixing yandex search "Read more" link"

This reverts commit 980f33daef.
This commit is contained in:
2019-04-18 22:23:06 +08:00
parent 980f33daef
commit 01ed5ad3ac
249 changed files with 1850 additions and 1879 deletions
+48 -46
View File
@@ -1625,14 +1625,14 @@ nsCSSFrameConstructor::CreateGeneratedContent(nsFrameConstructorState& aState,
attrNameSpace = nameSpaceVal.ToInteger(&error);
contentString.Cut(0, barIndex + 1);
if (contentString.Length()) {
if (mDocument->IsHTML() && aParentContent->IsHTML()) {
if (mDocument->IsHTMLDocument() && aParentContent->IsHTMLElement()) {
ToLowerCase(contentString);
}
attrName = do_GetAtom(contentString);
}
}
else {
if (mDocument->IsHTML() && aParentContent->IsHTML()) {
if (mDocument->IsHTMLDocument() && aParentContent->IsHTMLElement()) {
ToLowerCase(contentString);
}
attrName = do_GetAtom(contentString);
@@ -1700,7 +1700,7 @@ nsCSSFrameConstructor::CreateGeneratedContent(nsFrameConstructorState& aState,
return content.forget();
}
if (aParentContent->IsHTML() &&
if (aParentContent->IsHTMLElement() &&
aParentContent->NodeInfo()->Equals(nsGkAtoms::input)) {
if (aParentContent->HasAttr(kNameSpaceID_None, nsGkAtoms::value)) {
nsCOMPtr<nsIContent> content;
@@ -2370,7 +2370,7 @@ nsCSSFrameConstructor::PropagateScrollToViewport()
// of the viewport
// XXX what about XHTML?
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc(do_QueryInterface(mDocument));
if (!htmlDoc || !docElement->IsHTML()) {
if (!htmlDoc || !docElement->IsHTMLElement()) {
return nullptr;
}
@@ -2537,7 +2537,7 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
// Check whether we need to build a XUL box or SVG root frame
#ifdef MOZ_XUL
if (aDocElement->IsXUL()) {
if (aDocElement->IsXULElement()) {
contentFrame = NS_NewDocElementBoxFrame(mPresShell, styleContext);
InitAndRestoreFrame(state, aDocElement, mDocElementContainingBlock,
contentFrame);
@@ -2546,8 +2546,8 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
}
else
#endif
if (aDocElement->IsSVG()) {
if (aDocElement->Tag() != nsGkAtoms::svg) {
if (aDocElement->IsSVGElement()) {
if (!aDocElement->IsSVGElement(nsGkAtoms::svg)) {
return nullptr;
}
// We're going to call the right function ourselves, so no need to give a
@@ -2562,8 +2562,9 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
already_AddRefed<nsStyleContext> extraRef =
nsRefPtr<nsStyleContext>(styleContext).forget();
FrameConstructionItem item(&rootSVGData, aDocElement,
aDocElement->Tag(), kNameSpaceID_SVG,
nullptr, extraRef, true, nullptr);
aDocElement->NodeInfo()->NameAtom(),
kNameSpaceID_SVG, nullptr, extraRef, true,
nullptr);
nsFrameItems frameItems;
contentFrame = static_cast<nsContainerFrame*>(
@@ -2597,8 +2598,9 @@ nsCSSFrameConstructor::ConstructDocElementFrame(Element* aDocEle
already_AddRefed<nsStyleContext> extraRef =
nsRefPtr<nsStyleContext>(styleContext).forget();
FrameConstructionItem item(&rootTableData, aDocElement,
aDocElement->Tag(), kNameSpaceID_None,
nullptr, extraRef, true, nullptr);
aDocElement->NodeInfo()->NameAtom(),
kNameSpaceID_None, nullptr, extraRef, true,
nullptr);
nsFrameItems frameItems;
// if the document is a table then just populate it.
@@ -2795,7 +2797,7 @@ nsCSSFrameConstructor::SetUpDocElementContainingBlock(nsIContent* aDocElement)
if (!isPaginated) {
#ifdef MOZ_XUL
if (aDocElement->IsXUL())
if (aDocElement->IsXULElement())
{
// pass a temporary stylecontext, the correct one will be set later
rootFrame = NS_NewRootBoxFrame(mPresShell, viewportPseudoStyle);
@@ -2824,11 +2826,11 @@ nsCSSFrameConstructor::SetUpDocElementContainingBlock(nsIContent* aDocElement)
// will act as the scrolling mechanism for the viewport.
// XXX Do we even need a viewport when printing to a printer?
bool isHTML = aDocElement->IsHTML();
bool isHTML = aDocElement->IsHTMLElement();
bool isXUL = false;
if (!isHTML) {
isXUL = aDocElement->IsXUL();
isXUL = aDocElement->IsXULElement();
}
// Never create scrollbars for XUL documents
@@ -3502,7 +3504,7 @@ nsCSSFrameConstructor::FindHTMLData(Element* aElement,
(!aParentFrame ||
!IsFrameForFieldSet(aParentFrame, aParentFrame->GetType()) ||
!aElement->GetParent() ||
!aElement->GetParent()->IsHTML(nsGkAtoms::fieldset) ||
!aElement->GetParent()->IsHTMLElement(nsGkAtoms::fieldset) ||
aStyleContext->StyleDisplay()->IsFloatingStyle() ||
aStyleContext->StyleDisplay()->IsAbsolutelyPositionedStyle())) {
// <legend> is only special inside fieldset, check both the frame tree
@@ -3727,8 +3729,8 @@ nsCSSFrameConstructor::ConstructFrameFromItemInternal(FrameConstructionItem& aIt
"Unexpected FCDATA_FORCED_NON_SCROLLABLE_BLOCK flag");
// Don't create a subdocument frame for iframes if we're creating extra frames
if (aState.mCreatingExtraFrames && aItem.mContent->IsHTML() &&
aItem.mContent->Tag() == nsGkAtoms::iframe)
if (aState.mCreatingExtraFrames &&
aItem.mContent->IsHTMLElement(nsGkAtoms::iframe))
{
return;
}
@@ -4598,7 +4600,7 @@ nsCSSFrameConstructor::FindDisplayData(const nsStyleDisplay* aDisplay,
// XXXbz is this the right place to do this? If this code moves,
// make this function static.
bool propagatedScrollToViewport = false;
if (aElement->IsHTML(nsGkAtoms::body)) {
if (aElement->IsHTMLElement(nsGkAtoms::body)) {
propagatedScrollToViewport =
PropagateScrollToViewport() == aElement;
}
@@ -5501,7 +5503,8 @@ nsCSSFrameConstructor::DoAddFrameConstructionItems(nsFrameConstructorState& aSta
}
}
AddFrameConstructionItemsInternal(aState, aContent, aParentFrame,
aContent->Tag(), aContent->GetNameSpaceID(),
aContent->NodeInfo()->NameAtom(),
aContent->GetNameSpaceID(),
aSuppressWhiteSpaceOptimizations,
aStyleContext,
flags, aAnonChildren,
@@ -5565,7 +5568,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
aContent->IsElement(),
"Shouldn't get anything else here!");
MOZ_ASSERT(!aContent->GetPrimaryFrame() || aState.mCreatingExtraFrames ||
aContent->Tag() == nsGkAtoms::area);
aContent->NodeInfo()->NameAtom() == nsGkAtoms::area);
// The following code allows the user to specify the base tag
// of an element using XBL. XUL and HTML objects (like boxes, menus, etc.)
@@ -5625,14 +5628,12 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
nsIContent *parent = aContent->GetParent();
if (parent) {
// Check tag first, since that check will usually fail
nsIAtom* parentTag = parent->Tag();
if ((parentTag == nsGkAtoms::select || parentTag == nsGkAtoms::optgroup) &&
parent->IsHTML() &&
if (parent->IsAnyOfHTMLElements(nsGkAtoms::select, nsGkAtoms::optgroup) &&
// <option> is ok no matter what
!aContent->IsHTML(nsGkAtoms::option) &&
!aContent->IsHTMLElement(nsGkAtoms::option) &&
// <optgroup> is OK in <select> but not in <optgroup>
(!aContent->IsHTML(nsGkAtoms::optgroup) ||
parentTag != nsGkAtoms::select) &&
(!aContent->IsHTMLElement(nsGkAtoms::optgroup) ||
!parent->IsHTMLElement(nsGkAtoms::select)) &&
// Allow native anonymous content no matter what
!aContent->IsRootOfNativeAnonymousSubtree()) {
// No frame for aContent
@@ -6224,7 +6225,7 @@ AdjustAppendParentForAfterContent(nsFrameManager* aFrameManager,
nsIContent* c = child->GetContent();
if (child->IsGeneratedContentFrame()) {
nsIContent* p = c->GetParent();
if (c->Tag() == nsGkAtoms::mozgeneratedcontentafter) {
if (c->NodeInfo()->NameAtom() == nsGkAtoms::mozgeneratedcontentafter) {
if (!nsContentUtils::ContentIsDescendantOf(aChild, p) &&
p != aContainer &&
nsContentUtils::PositionIsBefore(p, aChild)) {
@@ -6504,7 +6505,7 @@ nsCSSFrameConstructor::IsValidSibling(nsIFrame* aSibling,
aSibling = cif;
}
nsIAtom* sibType = aSibling->GetType();
bool legendContent = aContent->IsHTML(nsGkAtoms::legend);
bool legendContent = aContent->IsHTMLElement(nsGkAtoms::legend);
if ((legendContent && (nsGkAtoms::legendFrame != sibType)) ||
(!legendContent && (nsGkAtoms::legendFrame == sibType)))
@@ -6638,7 +6639,7 @@ GetAdjustedParentFrame(nsContainerFrame* aParentFrame,
if (nsGkAtoms::fieldSetFrame == aParentFrameType) {
// If the parent is a fieldSet, use the fieldSet's area frame as the
// parent unless the new content is a legend.
if (!aChildContent->IsHTML(nsGkAtoms::legend)) {
if (!aChildContent->IsHTMLElement(nsGkAtoms::legend)) {
newParent = GetFieldSetBlockFrame(aParentFrame);
}
}
@@ -6800,9 +6801,7 @@ static bool
IsSpecialFramesetChild(nsIContent* aContent)
{
// IMPORTANT: This must match the conditions in nsHTMLFramesetFrame::Init.
return aContent->IsHTML() &&
(aContent->Tag() == nsGkAtoms::frameset ||
aContent->Tag() == nsGkAtoms::frame);
return aContent->IsAnyOfHTMLElements(nsGkAtoms::frameset, nsGkAtoms::frame);
}
static void
@@ -6814,7 +6813,7 @@ static
bool
IsXULListBox(nsIContent* aContainer)
{
return (aContainer->IsXUL() && aContainer->Tag() == nsGkAtoms::listbox);
return (aContainer->IsXULElement(nsGkAtoms::listbox));
}
static
@@ -6825,7 +6824,7 @@ MaybeGetListBoxBodyFrame(nsIContent* aContainer, nsIContent* aChild)
return nullptr;
if (IsXULListBox(aContainer) &&
aChild->IsXUL() && aChild->Tag() == nsGkAtoms::listitem) {
aChild->IsXULElement(nsGkAtoms::listitem)) {
nsCOMPtr<nsIDOMXULElement> xulElement = do_QueryInterface(aContainer);
nsCOMPtr<nsIBoxObject> boxObject;
xulElement->GetBoxObject(getter_AddRefs(boxObject));
@@ -6883,7 +6882,7 @@ nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation,
nsIContent* aChild)
{
if (mPresShell->GetPresContext()->IsChrome() || !aContainer ||
aContainer->IsInNativeAnonymousSubtree() || aContainer->IsXUL()) {
aContainer->IsInNativeAnonymousSubtree() || aContainer->IsXULElement()) {
return false;
}
@@ -6891,7 +6890,7 @@ nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation,
if (aChild->IsRootOfAnonymousSubtree() ||
(aChild->HasFlag(NODE_IS_IN_SHADOW_TREE) &&
!aChild->IsInNativeAnonymousSubtree()) ||
aChild->IsEditable() || aChild->IsXUL()) {
aChild->IsEditable() || aChild->IsXULElement()) {
return false;
}
} else { // CONTENTAPPEND
@@ -6900,7 +6899,7 @@ nsCSSFrameConstructor::MaybeConstructLazily(Operation aOperation,
for (nsIContent* child = aChild; child; child = child->GetNextSibling()) {
NS_ASSERTION(!child->IsRootOfAnonymousSubtree(),
"Should be coming through the CONTENTAPPEND case");
if (child->IsXUL() || child->IsEditable()) {
if (child->IsXULElement() || child->IsEditable()) {
return false;
}
}
@@ -7730,7 +7729,7 @@ nsCSSFrameConstructor::ContentRangeInserted(nsIContent* aContainer,
NS_ASSERTION(isSingleInsert || frameType != nsGkAtoms::fieldSetFrame,
"Unexpected parent");
if (IsFrameForFieldSet(insertion.mParentFrame, frameType) &&
aStartChild->Tag() == nsGkAtoms::legend) {
aStartChild->NodeInfo()->NameAtom() == nsGkAtoms::legend) {
// Just reframe the parent, since figuring out whether this
// should be the new legend and then handling it is too complex.
// We could do a little better here --- check if the fieldset already
@@ -8452,8 +8451,7 @@ InvalidateCanvasIfNeeded(nsIPresShell* presShell, nsIContent* node)
}
// Check whether it's an HTML body
if (node->Tag() != nsGkAtoms::body ||
!node->IsHTML()) {
if (!node->IsHTMLElement(nsGkAtoms::body)) {
return;
}
}
@@ -9014,7 +9012,7 @@ nsCSSFrameConstructor::ReplicateFixedFrames(nsPageContentFrame* aParentFrame)
nsLayoutUtils::GetStyleFrame(content)->StyleContext();
FrameConstructionItemList items;
AddFrameConstructionItemsInternal(state, content, canvasFrame,
content->Tag(),
content->NodeInfo()->NameAtom(),
content->GetNameSpaceID(),
true,
styleContext,
@@ -9085,7 +9083,7 @@ nsCSSFrameConstructor::GetInsertionPoint(nsIContent* aContainer,
insertionElement);
// Fieldsets have multiple insertion points.
if (insertionElement->IsHTML(nsGkAtoms::fieldset)) {
if (insertionElement->IsHTMLElement(nsGkAtoms::fieldset)) {
insertion.mMultiple = true;
}
@@ -10471,7 +10469,8 @@ nsCSSFrameConstructor::AddFCItemsForAnonymousContent(
ITEM_IS_ANONYMOUSCONTENTCREATOR_CONTENT | aExtraFlags;
AddFrameConstructionItemsInternal(aState, content, aFrame,
content->Tag(), content->GetNameSpaceID(),
content->NodeInfo()->NameAtom(),
content->GetNameSpaceID(),
true, styleContext, flags,
anonChildren, aItemsToConstruct);
}
@@ -10647,7 +10646,8 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
if (!aFrame->IsGeneratedContentFrame() &&
mPresShell->GetPresContext()->IsChrome()) {
nsIContent *badKid = AnyKidsNeedBlockParent(aFrameItems.FirstChild());
nsDependentAtomString parentTag(aContent->Tag()), kidTag(badKid->Tag());
nsDependentAtomString parentTag(aContent->NodeInfo()->NameAtom()),
kidTag(badKid->NodeInfo()->NameAtom());
const char16_t* params[] = { parentTag.get(), kidTag.get() };
const nsStyleDisplay *display = frameStyleContext->StyleDisplay();
const char *message =
@@ -11532,7 +11532,8 @@ nsCSSFrameConstructor::CreateListBoxContent(nsPresContext* aPresContext,
FrameConstructionItemList items;
AddFrameConstructionItemsInternal(state, aChild, aParentFrame,
aChild->Tag(), aChild->GetNameSpaceID(),
aChild->NodeInfo()->NameAtom(),
aChild->GetNameSpaceID(),
true, styleContext,
ITEM_ALLOW_XBL_BASE, nullptr, items);
ConstructFramesFromItemList(state, items, aParentFrame, frameItems);
@@ -11927,7 +11928,8 @@ nsCSSFrameConstructor::BuildInlineChildItems(nsFrameConstructorState& aState,
nsRefPtr<nsStyleContext> childContext =
ResolveStyleContext(parentStyleContext, content, &aState);
AddFrameConstructionItemsInternal(aState, content, nullptr, content->Tag(),
AddFrameConstructionItemsInternal(aState, content, nullptr,
content->NodeInfo()->NameAtom(),
content->GetNameSpaceID(),
iter.XBLInvolved(), childContext,
flags, nullptr,