#612: M969874 M1525628

This commit is contained in:
Cameron Kaiser 2020-06-14 14:23:43 -07:00
parent f187b2dfeb
commit 689819e12b
4 changed files with 42 additions and 0 deletions

View File

@ -5889,6 +5889,11 @@ nsIFrame::IsBlockWrapper() const
pseudoType == nsCSSAnonBoxes::cellContent); pseudoType == nsCSSAnonBoxes::cellContent);
} }
bool nsIFrame::IsBlockFrameOrSubclass() {
nsBlockFrame* thisAsBlock = do_QueryFrame(this);
return !!thisAsBlock;
}
static nsIFrame* static nsIFrame*
GetNearestBlockContainer(nsIFrame* frame) GetNearestBlockContainer(nsIFrame* frame)
{ {

View File

@ -972,6 +972,29 @@ nsHTMLScrollFrame::AccessibleType()
} }
#endif #endif
nscoord nsHTMLScrollFrame::GetLogicalBaseline(WritingMode aWritingMode) const {
// This function implements some of the spec text here:
// https://drafts.csswg.org/css-align/#baseline-export
//
// Specifically: if our scrolled frame is a block, we just use the inherited
// GetLogicalBaseline() impl, which synthesizes a baseline from the
// margin-box. Otherwise, we defer to our scrolled frame, considering it
// to be scrolled to its initial scroll position.
if (mHelper.mScrolledFrame->IsBlockFrameOrSubclass()) {
return nsContainerFrame::GetLogicalBaseline(aWritingMode);
}
// OK, here's where we defer to our scrolled frame. We have to add our
// border BStart thickness to whatever it returns, to produce an offset in
// our frame-rect's coordinate system. (We don't have to add padding,
// because the scrolled frame handles our padding.)
LogicalMargin border = GetLogicalUsedBorder(aWritingMode);
return border.BStart(aWritingMode) +
mHelper.mScrolledFrame->GetLogicalBaseline(aWritingMode);
}
NS_QUERYFRAME_HEAD(nsHTMLScrollFrame) NS_QUERYFRAME_HEAD(nsHTMLScrollFrame)
NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator) NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
NS_QUERYFRAME_ENTRY(nsIScrollableFrame) NS_QUERYFRAME_ENTRY(nsIScrollableFrame)

View File

@ -943,6 +943,8 @@ public:
virtual mozilla::a11y::AccType AccessibleType() override; virtual mozilla::a11y::AccType AccessibleType() override;
#endif #endif
nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) const override;
protected: protected:
nsHTMLScrollFrame(nsStyleContext* aContext, bool aIsRoot); nsHTMLScrollFrame(nsStyleContext* aContext, bool aIsRoot);
void SetSuppressScrollbarUpdate(bool aSuppress) { void SetSuppressScrollbarUpdate(bool aSuppress) {

View File

@ -2162,6 +2162,18 @@ public:
*/ */
bool IsBlockWrapper() const; bool IsBlockWrapper() const;
/**
* Returns true if the frame is an instance of nsBlockFrame or one of its
* subclasses.
*
* XXXdholbert this is non-const because it uses nsIFrame::QueryFrame which
* is non-const. If we need this accessor to be 'const' down the road, the
* right way to do it would be to make the QueryFrame machinery
* const-friendly. But it may not be worth the trouble, because we rarely
* handle const frame pointers anyway.
*/
bool IsBlockFrameOrSubclass();
/** /**
* Get this frame's CSS containing block. * Get this frame's CSS containing block.
* *