#399: implement scrollingElement, fix HTTP/2 options, enable SourceMap header

This commit is contained in:
Cameron Kaiser 2017-08-15 16:47:33 -07:00
parent e085a5b30e
commit 3436d24318
5 changed files with 57 additions and 4 deletions

View File

@ -9,7 +9,7 @@
*/
#include "nsDocument.h"
#include "nsIDocumentInlines.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/BinarySearch.h"
@ -10726,6 +10726,54 @@ nsDocument::CaretPositionFromPoint(float aX, float aY, nsISupports** aCaretPos)
return NS_OK;
}
static bool
IsPotentiallyScrollable(HTMLBodyElement* aBody)
{
// An element is potentially scrollable if all of the following conditions are
// true:
// The element has an associated CSS layout box.
nsIFrame* bodyFrame = aBody->GetPrimaryFrame();
if (!bodyFrame) {
return false;
}
// The element is not the HTML body element, or it is and the root element's
// used value of the overflow-x or overflow-y properties is not visible.
MOZ_ASSERT(aBody->GetParent() == aBody->OwnerDoc()->GetRootElement());
nsIFrame* parentFrame = aBody->GetParent()->GetPrimaryFrame();
if (parentFrame &&
parentFrame->StyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE &&
parentFrame->StyleDisplay()->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE) {
return false;
}
// The element's used value of the overflow-x or overflow-y properties is not
// visible.
if (bodyFrame->StyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_VISIBLE &&
bodyFrame->StyleDisplay()->mOverflowY == NS_STYLE_OVERFLOW_VISIBLE) {
return false;
}
return true;
}
Element*
nsIDocument::GetScrollingElement()
{
if (GetCompatibilityMode() == eCompatibility_NavQuirks) {
FlushPendingNotifications(Flush_Layout);
HTMLBodyElement* body = GetBodyElement();
if (body && !IsPotentiallyScrollable(body)) {
return body;
}
return nullptr;
}
return GetRootElement();
}
void
nsIDocument::ObsoleteSheet(nsIURI *aSheetURI, ErrorResult& rv)
{

View File

@ -2529,6 +2529,8 @@ public:
already_AddRefed<nsDOMCaretPosition>
CaretPositionFromPoint(float aX, float aY);
Element* GetScrollingElement();
// QuerySelector and QuerySelectorAll already defined on nsINode
nsINodeList* GetAnonymousNodes(Element& aElement);
Element* GetAnonymousElementByAttribute(Element& aElement,

View File

@ -1552,7 +1552,9 @@ nsScriptLoader::PrepareLoadedRequest(nsScriptLoadRequest* aRequest,
}
nsAutoCString sourceMapURL;
rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("X-SourceMap"), sourceMapURL);
rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("SourceMap"), sourceMapURL);
if (NS_FAILED(rv))
rv = httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("X-SourceMap"), sourceMapURL);
if (NS_SUCCEEDED(rv)) {
aRequest->mHasSourceMapURL = true;
aRequest->mSourceMapURL = NS_ConvertUTF8toUTF16(sourceMapURL);

View File

@ -280,6 +280,8 @@ partial interface Document {
Element? elementFromPoint (float x, float y);
CaretPosition? caretPositionFromPoint (float x, float y);
readonly attribute Element? scrollingElement;
};
// http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html

View File

@ -576,8 +576,7 @@ Http2Stream::GenerateOpen()
firstFrameFlags |= Http2Session::kFlag_END_STREAM;
} else if (head->IsPost() ||
head->IsPut() ||
head->IsConnect() ||
head->IsOptions()) {
head->IsConnect()) {
// place fin in a data frame even for 0 length messages for iterop
} else if (!mRequestBodyLenRemaining) {
// for other HTTP extension methods, rely on the content-length