зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1639893 Part 1 - Partial Imlementation of GetOverflowingChildrenOfElement. r=bradwerth,emilio
Differential Revision: https://phabricator.services.mozilla.com/D80216
This commit is contained in:
Родитель
708a37603c
Коммит
14bc521eda
|
@ -80,6 +80,8 @@ namespace InspectorUtils {
|
|||
boolean isElementThemed(Element element);
|
||||
|
||||
Element? containingBlockOf(Element element);
|
||||
|
||||
[NewObject] NodeList getOverflowingChildrenOfElement(Element element);
|
||||
};
|
||||
|
||||
dictionary PropertyNamesOptions {
|
||||
|
|
|
@ -703,5 +703,32 @@ Element* InspectorUtils::ContainingBlockOf(GlobalObject&, Element& aElement) {
|
|||
return Element::FromNodeOrNull(cb->GetContent());
|
||||
}
|
||||
|
||||
already_AddRefed<nsINodeList> InspectorUtils::GetOverflowingChildrenOfElement(
|
||||
GlobalObject& aGlobal, Element& aElement) {
|
||||
RefPtr<nsSimpleContentList> list = new nsSimpleContentList(&aElement);
|
||||
nsIFrame* scrollableFrame = aElement.GetPrimaryFrame();
|
||||
|
||||
std::function<void(const nsIFrame*)> GetOverflowingElement =
|
||||
[&](const nsIFrame* aFrame) {
|
||||
MOZ_ASSERT(aFrame, "we assume the passed-in frame is non-null");
|
||||
for (const auto& childList : aFrame->ChildLists()) {
|
||||
for (const nsIFrame* child : childList.mList) {
|
||||
bool isBlameElem = true; // change this so that it becomes true iff
|
||||
// child is causing overflow.
|
||||
if (!isBlameElem) {
|
||||
GetOverflowingElement(child);
|
||||
} else {
|
||||
list->AppendElement(child->GetContent());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (scrollableFrame) {
|
||||
GetOverflowingElement(scrollableFrame);
|
||||
}
|
||||
return list.forget();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -238,6 +238,9 @@ class InspectorUtils {
|
|||
|
||||
static Element* ContainingBlockOf(GlobalObject&, Element&);
|
||||
|
||||
static already_AddRefed<nsINodeList> GetOverflowingChildrenOfElement(
|
||||
GlobalObject& aGlobal, Element& element);
|
||||
|
||||
/**
|
||||
* Parse CSS and update the style sheet in place.
|
||||
*
|
||||
|
|
Загрузка…
Ссылка в новой задаче