Bug 1528199 - Make nsTreeColFrame::InvalidateColumns not flush. r=dholbert

That's not sound.

Differential Revision: https://phabricator.services.mozilla.com/D19934

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-02-15 19:05:09 +00:00
Родитель 1d1e39ab16
Коммит 16314d820b
3 изменённых файлов: 27 добавлений и 20 удалений

Просмотреть файл

@ -79,7 +79,9 @@ static nsIContent* FindBodyElement(nsIContent* aParent) {
return nullptr;
}
nsTreeBodyFrame* XULTreeElement::GetTreeBodyFrame(bool aFlushLayout) {
nsTreeBodyFrame* XULTreeElement::GetTreeBodyFrame(FlushType aFlushType) {
MOZ_ASSERT(aFlushType == FlushType::Frames ||
aFlushType == FlushType::Layout || aFlushType == FlushType::None);
nsCOMPtr<nsIContent> kungFuDeathGrip = this; // keep a reference
RefPtr<Document> doc = GetUncomposedDoc();
@ -89,7 +91,7 @@ nsTreeBodyFrame* XULTreeElement::GetTreeBodyFrame(bool aFlushLayout) {
// is true we need to make sure to flush no matter what.
// XXXbz except that flushing style when we were not asked to flush
// layout here breaks things. See bug 585123.
if (aFlushLayout && doc) {
if (aFlushType == FlushType::Layout && doc) {
doc->FlushPendingNotifications(FlushType::Layout);
}
@ -98,12 +100,11 @@ nsTreeBodyFrame* XULTreeElement::GetTreeBodyFrame(bool aFlushLayout) {
return mTreeBody;
}
if (!aFlushLayout && doc) {
if (aFlushType == FlushType::Frames && doc) {
doc->FlushPendingNotifications(FlushType::Frames);
}
nsCOMPtr<nsIContent> tree = FindBodyElement(this);
if (tree) {
if (nsCOMPtr<nsIContent> tree = FindBodyElement(this)) {
mTreeBody = do_QueryFrame(tree->GetPrimaryFrame());
}
@ -252,7 +253,7 @@ void XULTreeElement::EnsureCellIsVisible(int32_t aRow, nsTreeColumn* aCol,
}
void XULTreeElement::ScrollToRow(int32_t aRow) {
nsTreeBodyFrame* body = GetTreeBodyFrame(true);
nsTreeBodyFrame* body = GetTreeBodyFrame(FlushType::Layout);
if (!body) {
return;
}

Просмотреть файл

@ -38,7 +38,7 @@ class XULTreeElement final : public nsXULElement {
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeElement, nsXULElement)
nsTreeBodyFrame* GetTreeBodyFrame(bool aFlushLayout = false);
nsTreeBodyFrame* GetTreeBodyFrame(FlushType = FlushType::Frames);
nsTreeBodyFrame* GetCachedTreeBodyFrame() { return mTreeBody; }
already_AddRefed<nsTreeColumns> GetColumns();

Просмотреть файл

@ -15,8 +15,10 @@
#include "nsDisplayList.h"
#include "nsTreeBodyFrame.h"
#include "nsXULElement.h"
#include "mozilla/dom/XULTreeElement.h"
using namespace mozilla;
using namespace mozilla::dom;
//
// NS_NewTreeColFrame
@ -151,18 +153,22 @@ XULTreeElement* nsTreeColFrame::GetTree() {
void nsTreeColFrame::InvalidateColumns(bool aCanWalkFrameTree) {
RefPtr<XULTreeElement> tree = GetTree();
if (tree) {
RefPtr<nsTreeColumns> columns;
if (aCanWalkFrameTree) {
columns = tree->GetColumns();
} else {
nsTreeBodyFrame* body = tree->GetCachedTreeBodyFrame();
if (body) {
columns = body->Columns();
}
}
if (columns) columns->InvalidateColumns();
if (!tree) {
return;
}
nsTreeBodyFrame* body = aCanWalkFrameTree
? tree->GetTreeBodyFrame(FlushType::None)
: tree->GetCachedTreeBodyFrame();
if (!body) {
return;
}
RefPtr<nsTreeColumns> columns = body->Columns();
if (!columns) {
return;
}
columns->InvalidateColumns();
}