mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 23:35:34 +00:00
Backed out 2 changesets (bug 1473813, bug 1472403) for bustages in /builds/worker/workspace/build/src/dom/base/MessageSender.cpp:24:19 on a CLOSED TREE
Backed out changeset 93e4dff7e346 (bug 1473813) Backed out changeset 365a0841117a (bug 1472403)
This commit is contained in:
parent
71b46df0d4
commit
ba72001f71
@ -1,52 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/GeneratedImageContent.h"
|
||||
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
#include "mozilla/dom/HTMLElementBinding.h"
|
||||
#include "mozilla/dom/NameSpaceConstants.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(GeneratedImageContent);
|
||||
|
||||
already_AddRefed<GeneratedImageContent>
|
||||
GeneratedImageContent::Create(nsIDocument& aDocument, uint32_t aContentIndex)
|
||||
{
|
||||
RefPtr<dom::NodeInfo> nodeInfo =
|
||||
aDocument.NodeInfoManager()->
|
||||
GetNodeInfo(nsGkAtoms::mozgeneratedcontentimage,
|
||||
nullptr,
|
||||
kNameSpaceID_XHTML,
|
||||
nsINode::ELEMENT_NODE);
|
||||
|
||||
// Work around not being able to bind a non-const lvalue reference
|
||||
// to an rvalue of non-reference type by just creating an rvalue
|
||||
// reference. And we can't change the constructor signature,
|
||||
// because then the macro-generated Clone() method fails to compile.
|
||||
already_AddRefed<dom::NodeInfo>&& rvalue = nodeInfo.forget();
|
||||
|
||||
auto image =
|
||||
MakeRefPtr<GeneratedImageContent>(rvalue);
|
||||
image->mIndex = aContentIndex;
|
||||
return image.forget();
|
||||
}
|
||||
|
||||
JSObject*
|
||||
GeneratedImageContent::WrapNode(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return dom::HTMLElement_Binding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -1,64 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef dom_base_GeneratedImageContent_h
|
||||
#define dom_base_GeneratedImageContent_h
|
||||
|
||||
/* A content node that keeps track of an index in the parent's `content`
|
||||
* property value, used for url() values in the content of a ::before or ::after
|
||||
* pseudo-element. */
|
||||
|
||||
#include "mozilla/dom/HTMLElementBinding.h"
|
||||
#include "mozilla/dom/NameSpaceConstants.h"
|
||||
#include "mozilla/dom/NodeInfo.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class GeneratedImageContent final
|
||||
: public nsGenericHTMLElement
|
||||
{
|
||||
public:
|
||||
static already_AddRefed<GeneratedImageContent>
|
||||
Create(nsIDocument&, uint32_t aContentIndex);
|
||||
|
||||
explicit GeneratedImageContent(already_AddRefed<dom::NodeInfo>& aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
{
|
||||
MOZ_ASSERT(IsInNamespace(kNameSpaceID_XHTML), "Someone messed up our nodeinfo");
|
||||
}
|
||||
|
||||
nsresult Clone(dom::NodeInfo* aNodeInfo,
|
||||
nsINode** aResult,
|
||||
bool aPreallocateChildren) const final;
|
||||
|
||||
nsresult CopyInnerTo(GeneratedImageContent* aDest, bool aPreallocateChildren)
|
||||
{
|
||||
nsresult rv =
|
||||
nsGenericHTMLElement::CopyInnerTo(aDest, aPreallocateChildren);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
aDest->mIndex = mIndex;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t Index() const
|
||||
{
|
||||
return mIndex;
|
||||
}
|
||||
|
||||
protected:
|
||||
JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) final;
|
||||
|
||||
private:
|
||||
virtual ~GeneratedImageContent() = default;
|
||||
uint32_t mIndex = 0;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // dom_base_GeneratedImageContent_h
|
@ -179,7 +179,6 @@ EXPORTS.mozilla.dom += [
|
||||
'FormData.h',
|
||||
'FragmentOrElement.h',
|
||||
'FromParser.h',
|
||||
'GeneratedImageContent.h',
|
||||
'IdleDeadline.h',
|
||||
'IdleRequest.h',
|
||||
'IDTracker.h',
|
||||
@ -270,7 +269,6 @@ UNIFIED_SOURCES += [
|
||||
'EventSource.cpp',
|
||||
'FormData.cpp',
|
||||
'FragmentOrElement.cpp',
|
||||
'GeneratedImageContent.cpp',
|
||||
'IdleDeadline.cpp',
|
||||
'IdleRequest.cpp',
|
||||
'IDTracker.cpp',
|
||||
@ -310,6 +308,7 @@ UNIFIED_SOURCES += [
|
||||
'nsDOMWindowList.cpp',
|
||||
'nsFocusManager.cpp',
|
||||
'nsFrameLoader.cpp',
|
||||
'nsGenConImageContent.cpp',
|
||||
'nsGlobalWindowCommands.cpp',
|
||||
'nsHistory.cpp',
|
||||
'nsHTMLContentSerializer.cpp',
|
||||
|
@ -76,4 +76,11 @@ NS_NewSVGElement(mozilla::dom::Element** aResult,
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser);
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
already_AddRefed<nsIContent>
|
||||
CreateGenConImageContent(nsIDocument* aDocument, imgRequestProxy* aImageRequest);
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // nsContentCreatorFunctions_h__
|
||||
|
166
dom/base/nsGenConImageContent.cpp
Normal file
166
dom/base/nsGenConImageContent.cpp
Normal file
@ -0,0 +1,166 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/**
|
||||
* A fake content node class so that the image frame for
|
||||
* content: url(foo);
|
||||
* in CSS can have an nsIImageLoadingContent but use an
|
||||
* imgIRequest that's already been loaded from the style system.
|
||||
*/
|
||||
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsImageLoadingContent.h"
|
||||
#include "imgIRequest.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/dom/HTMLElementBinding.h"
|
||||
#include "mozilla/dom/NameSpaceConstants.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
class nsGenConImageContent final : public nsGenericHTMLElement,
|
||||
public nsImageLoadingContent
|
||||
{
|
||||
public:
|
||||
explicit nsGenConImageContent(already_AddRefed<dom::NodeInfo>& aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
{
|
||||
// nsImageLoadingContent starts out broken, so we start out
|
||||
// suppressed to match it.
|
||||
AddStatesSilently(NS_EVENT_STATE_SUPPRESSED);
|
||||
MOZ_ASSERT(IsInNamespace(kNameSpaceID_XHTML), "Someone messed up our nodeinfo");
|
||||
}
|
||||
|
||||
nsresult Init(imgRequestProxy* aImageRequest)
|
||||
{
|
||||
// No need to notify, since we have no frame.
|
||||
return UseAsPrimaryRequest(aImageRequest, false, eImageLoadType_Normal);
|
||||
}
|
||||
|
||||
// nsIContent overrides
|
||||
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers) override;
|
||||
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
|
||||
virtual EventStates IntrinsicState() const override;
|
||||
|
||||
void GetEventTargetParent(EventChainPreVisitor& aVisitor) override
|
||||
{
|
||||
MOZ_ASSERT(IsInNativeAnonymousSubtree());
|
||||
if (aVisitor.mEvent->mMessage == eLoad ||
|
||||
aVisitor.mEvent->mMessage == eLoadError) {
|
||||
// Don't propagate the events to the parent.
|
||||
return;
|
||||
}
|
||||
nsGenericHTMLElement::GetEventTargetParent(aVisitor);
|
||||
}
|
||||
|
||||
protected:
|
||||
nsIContent* AsContent() override { return this; }
|
||||
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
virtual nsresult Clone(dom::NodeInfo* aNodeInfo,
|
||||
nsINode** aResult,
|
||||
bool aPreallocateChildren) const override;
|
||||
|
||||
private:
|
||||
virtual ~nsGenConImageContent();
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsGenConImageContent,
|
||||
nsGenericHTMLElement,
|
||||
nsIImageLoadingContent,
|
||||
imgINotificationObserver)
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(nsGenConImageContent)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
already_AddRefed<nsIContent>
|
||||
CreateGenConImageContent(nsIDocument* aDocument, imgRequestProxy* aImageRequest)
|
||||
{
|
||||
MOZ_ASSERT(aImageRequest, "Must have request!");
|
||||
RefPtr<NodeInfo> nodeInfo =
|
||||
aDocument->NodeInfoManager()->
|
||||
GetNodeInfo(nsGkAtoms::mozgeneratedcontentimage,
|
||||
nullptr,
|
||||
kNameSpaceID_XHTML,
|
||||
nsINode::ELEMENT_NODE);
|
||||
// Work around not being able to bind a non-const lvalue reference
|
||||
// to an rvalue of non-reference type by just creating an rvalue
|
||||
// reference. And we can't change the constructor signature,
|
||||
// because then the macro-generated Clone() method fails to compile.
|
||||
already_AddRefed<NodeInfo>&& rvalue = nodeInfo.forget();
|
||||
RefPtr<nsGenConImageContent> it = new nsGenConImageContent(rvalue);
|
||||
nsresult rv = it->Init(aImageRequest);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return it.forget();
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
nsGenConImageContent::~nsGenConImageContent()
|
||||
{
|
||||
DestroyImageLoadingContent();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenConImageContent::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
bool aCompileEventHandlers)
|
||||
{
|
||||
nsresult rv;
|
||||
rv = nsGenericHTMLElement::BindToTree(aDocument, aParent, aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsImageLoadingContent::BindToTree(aDocument, aParent, aBindingParent,
|
||||
aCompileEventHandlers);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsGenConImageContent::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
{
|
||||
nsImageLoadingContent::UnbindFromTree(aDeep, aNullParent);
|
||||
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
||||
}
|
||||
|
||||
EventStates
|
||||
nsGenConImageContent::IntrinsicState() const
|
||||
{
|
||||
EventStates state = nsGenericHTMLElement::IntrinsicState();
|
||||
|
||||
EventStates imageState = nsImageLoadingContent::ImageState();
|
||||
if (imageState.HasAtLeastOneOfStates(NS_EVENT_STATE_BROKEN | NS_EVENT_STATE_USERDISABLED)) {
|
||||
// We should never be in an error state; if the image fails to load, we
|
||||
// just go to the suppressed state.
|
||||
imageState |= NS_EVENT_STATE_SUPPRESSED;
|
||||
imageState &= ~NS_EVENT_STATE_BROKEN;
|
||||
}
|
||||
imageState &= ~NS_EVENT_STATE_LOADING;
|
||||
return state | imageState;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
nsGenConImageContent::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
|
||||
{
|
||||
return dom::HTMLElement_Binding::Wrap(aCx, this, aGivenProto);
|
||||
}
|
||||
|
@ -1165,6 +1165,32 @@ nsImageLoadingContent::CancelImageRequests(bool aNotify)
|
||||
ClearCurrentRequest(NS_BINDING_ABORTED, Some(OnNonvisible::DISCARD_IMAGES));
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsImageLoadingContent::UseAsPrimaryRequest(imgRequestProxy* aRequest,
|
||||
bool aNotify,
|
||||
ImageLoadType aImageLoadType)
|
||||
{
|
||||
// Our state will change. Watch it.
|
||||
AutoStateChanger changer(this, aNotify);
|
||||
|
||||
// Get rid if our existing images
|
||||
ClearPendingRequest(NS_BINDING_ABORTED, Some(OnNonvisible::DISCARD_IMAGES));
|
||||
ClearCurrentRequest(NS_BINDING_ABORTED, Some(OnNonvisible::DISCARD_IMAGES));
|
||||
|
||||
// Clone the request we were given.
|
||||
RefPtr<imgRequestProxy>& req = PrepareNextRequest(aImageLoadType);
|
||||
nsresult rv = aRequest->SyncClone(this, GetOurOwnerDoc(), getter_AddRefs(req));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
CloneScriptedRequests(req);
|
||||
TrackImage(req);
|
||||
} else {
|
||||
MOZ_ASSERT(!req, "Shouldn't have non-null request here");
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
nsImageLoadingContent::GetOurOwnerDoc()
|
||||
{
|
||||
|
@ -190,6 +190,15 @@ protected:
|
||||
*/
|
||||
void CancelImageRequests(bool aNotify);
|
||||
|
||||
/**
|
||||
* UseAsPrimaryRequest is called by subclasses when they have an existing
|
||||
* imgRequestProxy that they want this nsImageLoadingContent to use. This may
|
||||
* effectively be called instead of LoadImage or LoadImageWithChannel.
|
||||
* If aNotify is true, this method will notify on state changes.
|
||||
*/
|
||||
nsresult UseAsPrimaryRequest(imgRequestProxy* aRequest, bool aNotify,
|
||||
ImageLoadType aImageLoadType);
|
||||
|
||||
/**
|
||||
* Derived classes of nsImageLoadingContent MUST call
|
||||
* DestroyImageLoadingContent from their destructor, or earlier. It
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "mozilla/ComputedStyleInlines.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/GeneratedImageContent.h"
|
||||
#include "mozilla/dom/HTMLDetailsElement.h"
|
||||
#include "mozilla/dom/HTMLSelectElement.h"
|
||||
#include "mozilla/dom/HTMLSummaryElement.h"
|
||||
@ -324,9 +323,6 @@ NS_NewScrollbarButtonFrame (nsIPresShell* aPresShell, ComputedStyle* aStyle);
|
||||
nsIFrame*
|
||||
NS_NewImageFrameForContentProperty(nsIPresShell*, ComputedStyle*);
|
||||
|
||||
nsIFrame*
|
||||
NS_NewImageFrameForGeneratedContentIndex(nsIPresShell*, ComputedStyle*);
|
||||
|
||||
|
||||
#ifdef NOISY_FINDFRAME
|
||||
static int32_t FFWC_totalCount=0;
|
||||
@ -1591,21 +1587,6 @@ MoveChildrenTo(nsIFrame* aOldParent,
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
ShouldCreateImageFrameForContent(const Element& aElement, ComputedStyle& aStyle)
|
||||
{
|
||||
if (aElement.IsRootOfNativeAnonymousSubtree()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto& content = *aStyle.StyleContent();
|
||||
if (content.ContentCount() != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return content.ContentAt(0).GetType() == StyleContentType::Image;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
nsCSSFrameConstructor::nsCSSFrameConstructor(nsIDocument* aDocument,
|
||||
@ -1728,7 +1709,7 @@ already_AddRefed<nsIContent>
|
||||
nsCSSFrameConstructor::CreateGeneratedContent(nsFrameConstructorState& aState,
|
||||
Element* aParentContent,
|
||||
ComputedStyle* aComputedStyle,
|
||||
uint32_t aContentIndex)
|
||||
uint32_t aContentIndex)
|
||||
{
|
||||
// Get the content value
|
||||
const nsStyleContentData& data =
|
||||
@ -1736,8 +1717,19 @@ nsCSSFrameConstructor::CreateGeneratedContent(nsFrameConstructorState& aState,
|
||||
const StyleContentType type = data.GetType();
|
||||
|
||||
switch (type) {
|
||||
case StyleContentType::Image:
|
||||
return GeneratedImageContent::Create(*mDocument, aContentIndex);
|
||||
case StyleContentType::Image: {
|
||||
imgRequestProxy* image = data.GetImage();
|
||||
if (!image) {
|
||||
// CSS had something specified that couldn't be converted to an
|
||||
// image object
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Create an image content object and pass it the image request.
|
||||
// XXX Check if it's an image type we can handle...
|
||||
|
||||
return CreateGenConImageContent(mDocument, image);
|
||||
}
|
||||
|
||||
case StyleContentType::String:
|
||||
return CreateGenConTextNode(aState,
|
||||
@ -3626,7 +3618,7 @@ nsCSSFrameConstructor::FindHTMLData(Element* aElement,
|
||||
static const FrameConstructionDataByTag sHTMLData[] = {
|
||||
SIMPLE_TAG_CHAIN(img, nsCSSFrameConstructor::FindImgData),
|
||||
SIMPLE_TAG_CHAIN(mozgeneratedcontentimage,
|
||||
nsCSSFrameConstructor::FindGeneratedImageData),
|
||||
nsCSSFrameConstructor::FindImgData),
|
||||
{ &nsGkAtoms::br,
|
||||
FCDATA_DECL(FCDATA_IS_LINE_PARTICIPANT | FCDATA_IS_LINE_BREAK,
|
||||
NS_NewBRFrame) },
|
||||
@ -3660,20 +3652,6 @@ nsCSSFrameConstructor::FindHTMLData(Element* aElement,
|
||||
ArrayLength(sHTMLData));
|
||||
}
|
||||
|
||||
/* static */
|
||||
const nsCSSFrameConstructor::FrameConstructionData*
|
||||
nsCSSFrameConstructor::FindGeneratedImageData(Element* aElement,
|
||||
ComputedStyle* aStyle)
|
||||
{
|
||||
if (!aElement->IsInNativeAnonymousSubtree()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static const FrameConstructionData sImgData =
|
||||
SIMPLE_FCDATA(NS_NewImageFrameForGeneratedContentIndex);
|
||||
return &sImgData;
|
||||
}
|
||||
|
||||
/* static */
|
||||
const nsCSSFrameConstructor::FrameConstructionData*
|
||||
nsCSSFrameConstructor::FindImgData(Element* aElement,
|
||||
@ -5651,6 +5629,17 @@ ShouldSuppressFrameInNonOpenDetails(const HTMLDetailsElement* aDetails,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
ShouldCreateImageFrameForContent(ComputedStyle& aStyle)
|
||||
{
|
||||
auto& content = *aStyle.StyleContent();
|
||||
if (content.ContentCount() != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return content.ContentAt(0).GetType() == StyleContentType::Image;
|
||||
}
|
||||
|
||||
void
|
||||
nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState& aState,
|
||||
nsIContent* aContent,
|
||||
@ -5817,7 +5806,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
||||
|
||||
// Check for 'content: <image-url>' on the element (which makes us ignore
|
||||
// 'display' values other than 'none' or 'contents').
|
||||
if (!data && ShouldCreateImageFrameForContent(*element, *computedStyle)) {
|
||||
if (!data && ShouldCreateImageFrameForContent(*computedStyle)) {
|
||||
static const FrameConstructionData sImgData =
|
||||
SIMPLE_FCDATA(NS_NewImageFrameForContentProperty);
|
||||
data = &sImgData;
|
||||
|
@ -1456,14 +1456,16 @@ private:
|
||||
nsIFrame* aParentFrame,
|
||||
ComputedStyle* aComputedStyle);
|
||||
// HTML data-finding helper functions
|
||||
static const FrameConstructionData* FindImgData(Element*, ComputedStyle*);
|
||||
static const FrameConstructionData* FindGeneratedImageData(Element*,
|
||||
ComputedStyle*);
|
||||
static const FrameConstructionData* FindImgControlData(Element*,
|
||||
ComputedStyle*);
|
||||
static const FrameConstructionData* FindInputData(Element*, ComputedStyle*);
|
||||
static const FrameConstructionData* FindObjectData(Element*, ComputedStyle*);
|
||||
static const FrameConstructionData* FindCanvasData(Element*, ComputedStyle*);
|
||||
static const FrameConstructionData*
|
||||
FindImgData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
static const FrameConstructionData*
|
||||
FindImgControlData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
static const FrameConstructionData*
|
||||
FindInputData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
static const FrameConstructionData*
|
||||
FindObjectData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
static const FrameConstructionData*
|
||||
FindCanvasData(Element* aElement, ComputedStyle* aComputedStyle);
|
||||
|
||||
/* Construct a frame from the given FrameConstructionItem. This function
|
||||
will handle adding the frame to frame lists, processing children, setting
|
||||
|
@ -1,6 +0,0 @@
|
||||
<!doctype html>
|
||||
<div id="target"></div>
|
||||
<script>
|
||||
let element = document.createElement('_moz_generated_content_image');
|
||||
target.appendChild(element);
|
||||
</script>
|
@ -704,4 +704,3 @@ load 1460158-3.html
|
||||
load 1461039.html
|
||||
load 1461979-1.html
|
||||
load 1467239.html
|
||||
load 1472403.html
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "mozilla/gfx/Helpers.h"
|
||||
#include "mozilla/gfx/PathHelpers.h"
|
||||
#include "mozilla/dom/GeneratedImageContent.h"
|
||||
#include "mozilla/dom/HTMLImageElement.h"
|
||||
#include "mozilla/dom/ResponsiveImageSelector.h"
|
||||
#include "mozilla/layers/WebRenderLayerManager.h"
|
||||
@ -140,15 +139,7 @@ NS_NewImageFrameForContentProperty(nsIPresShell* aPresShell,
|
||||
ComputedStyle* aStyle)
|
||||
{
|
||||
return new (aPresShell) nsImageFrame(
|
||||
aStyle, nsImageFrame::Kind::ContentProperty);
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
NS_NewImageFrameForGeneratedContentIndex(nsIPresShell* aPresShell,
|
||||
ComputedStyle* aStyle)
|
||||
{
|
||||
return new (aPresShell) nsImageFrame(
|
||||
aStyle, nsImageFrame::Kind::ContentPropertyAtIndex);
|
||||
aStyle, nsImageFrame::Kind::NonGeneratedContentProperty);
|
||||
}
|
||||
|
||||
nsImageFrame*
|
||||
@ -325,25 +316,7 @@ nsImageFrame::Init(nsIContent* aContent,
|
||||
// that it can register images.
|
||||
imageLoader->FrameCreated(this);
|
||||
} else {
|
||||
uint32_t contentIndex = 0;
|
||||
const nsStyleContent* styleContent = StyleContent();
|
||||
if (mKind == Kind::ContentPropertyAtIndex) {
|
||||
MOZ_RELEASE_ASSERT(
|
||||
aParent->GetContent()->IsGeneratedContentContainerForAfter() ||
|
||||
aParent->GetContent()->IsGeneratedContentContainerForBefore());
|
||||
MOZ_RELEASE_ASSERT(aContent->IsHTMLElement(nsGkAtoms::mozgeneratedcontentimage));
|
||||
nsIFrame* nonAnonymousParent = aParent;
|
||||
while (nonAnonymousParent->Style()->IsAnonBox()) {
|
||||
nonAnonymousParent = nonAnonymousParent->GetParent();
|
||||
}
|
||||
MOZ_RELEASE_ASSERT(aParent->GetContent() == nonAnonymousParent->GetContent());
|
||||
styleContent = nonAnonymousParent->StyleContent();
|
||||
contentIndex = static_cast<GeneratedImageContent*>(aContent)->Index();
|
||||
}
|
||||
MOZ_RELEASE_ASSERT(contentIndex < styleContent->ContentCount());
|
||||
MOZ_RELEASE_ASSERT(styleContent->ContentAt(contentIndex).GetType() ==
|
||||
StyleContentType::Image);
|
||||
if (auto* proxy = styleContent->ContentAt(contentIndex).GetImage()) {
|
||||
if (auto* proxy = StyleContent()->ContentAt(0).GetImage()) {
|
||||
proxy->Clone(mListener,
|
||||
mContent->OwnerDoc(),
|
||||
getter_AddRefs(mContentURLRequest));
|
||||
@ -514,7 +487,7 @@ bool
|
||||
nsImageFrame::IsPendingLoad(imgIRequest* aRequest) const
|
||||
{
|
||||
// Default to pending load in case of errors
|
||||
if (mKind != Kind::ImageElement) {
|
||||
if (mKind == Kind::NonGeneratedContentProperty) {
|
||||
MOZ_ASSERT(aRequest == mContentURLRequest);
|
||||
return false;
|
||||
}
|
||||
@ -948,7 +921,7 @@ nsImageFrame::EnsureIntrinsicSizeAndRatio()
|
||||
// NOTE(emilio, https://github.com/w3c/csswg-drafts/issues/2832): WebKit
|
||||
// and Blink behave differently here for content: url(..), for now adapt to
|
||||
// Blink's behavior.
|
||||
const bool mayDisplayBrokenIcon = mKind == Kind::ImageElement;
|
||||
const bool mayDisplayBrokenIcon = IsForNonGeneratedImageElement();
|
||||
if (!mayDisplayBrokenIcon) {
|
||||
return;
|
||||
}
|
||||
@ -1895,7 +1868,7 @@ nsImageFrame::PaintImage(gfxContext& aRenderingContext, nsPoint aPt,
|
||||
already_AddRefed<imgIRequest>
|
||||
nsImageFrame::GetCurrentRequest() const
|
||||
{
|
||||
if (mKind != Kind::ImageElement) {
|
||||
if (mKind == Kind::NonGeneratedContentProperty) {
|
||||
return do_AddRef(mContentURLRequest);
|
||||
}
|
||||
|
||||
|
@ -184,22 +184,27 @@ public:
|
||||
// The kind of image frame we are.
|
||||
enum class Kind : uint8_t
|
||||
{
|
||||
// For an nsImageLoadingContent.
|
||||
// For an nsImageLoadingContent, including generated ::before and ::after
|
||||
// content, which are an nsGenConImageContent.
|
||||
ImageElement,
|
||||
// For css 'content: url(..)' on non-generated content.
|
||||
ContentProperty,
|
||||
// For a child of a ::before / ::after pseudo-element that had an url() item
|
||||
// for the content property.
|
||||
ContentPropertyAtIndex,
|
||||
// For css 'content: url(..)' on other elements.
|
||||
NonGeneratedContentProperty,
|
||||
};
|
||||
|
||||
// Whether this frame is for a non-generated image element, that is, one that
|
||||
// isn't a ::before / ::after.
|
||||
bool IsForNonGeneratedImageElement() const
|
||||
{
|
||||
return mKind == Kind::ImageElement &&
|
||||
!HasAnyStateBits(NS_FRAME_GENERATED_CONTENT);
|
||||
}
|
||||
|
||||
// Creates a suitable continuing frame for this frame.
|
||||
nsImageFrame* CreateContinuingFrame(nsIPresShell*, ComputedStyle*) const;
|
||||
|
||||
private:
|
||||
friend nsIFrame* NS_NewImageFrame(nsIPresShell*, ComputedStyle*);
|
||||
friend nsIFrame* NS_NewImageFrameForContentProperty(nsIPresShell*, ComputedStyle*);
|
||||
friend nsIFrame* NS_NewImageFrameForGeneratedContentIndex(nsIPresShell*, ComputedStyle*);
|
||||
|
||||
nsImageFrame(ComputedStyle* aStyle, Kind aKind)
|
||||
: nsImageFrame(aStyle, kClassID, aKind)
|
||||
|
@ -1,11 +0,0 @@
|
||||
<!doctype html>
|
||||
<html class="reftest-paged">
|
||||
<style>
|
||||
div {
|
||||
display: block;
|
||||
height: 20in;
|
||||
}
|
||||
</style>
|
||||
<div>
|
||||
<img src="data:image/gif,GIF89a%01%00%E8%03%80%00%00%00%00%00%FF%FF%FF!%F9%04%00%00%00%00%00%2C%00%00%00%00%01%00%E8%03%00%02%1E%84%8F%A9%CB%ED%0F%A3%9C%B4%DA%8B%B3%DE%BC%FB%0F%86%E2H%96%E6%89%A6%EA%CA%B6%EE%0B%3B%05%00%3B">
|
||||
</div>
|
@ -118,4 +118,4 @@ fuzzy-if(cocoaWidget,1,5000) == 745025-1.html 745025-1-ref.html
|
||||
== 1166147.html 1166147-ref.html
|
||||
== 1321803-1a.html 1321803-1-ref.html
|
||||
== content-url-element.html image.html
|
||||
== content-url-pseudo.html content-url-pseudo-ref.html
|
||||
== content-url-pseudo.html image.html
|
||||
|
@ -109675,18 +109675,6 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/css-content/pseudo-element-inline-box.html": [
|
||||
[
|
||||
"/css/css-content/pseudo-element-inline-box.html",
|
||||
[
|
||||
[
|
||||
"/css/css-content/pseudo-element-inline-box-ref.html",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/css-counter-styles/broken-symbols.htm": [
|
||||
[
|
||||
"/css/css-counter-styles/broken-symbols.htm",
|
||||
@ -241749,11 +241737,6 @@
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/css-content/pseudo-element-inline-box-ref.html": [
|
||||
[
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/css-content/resources/blank.html": [
|
||||
[
|
||||
{}
|
||||
@ -507633,14 +507616,6 @@
|
||||
"f491ddf2b3062ea2f9b616c968c88b9cc95f22eb",
|
||||
"reftest"
|
||||
],
|
||||
"css/css-content/pseudo-element-inline-box-ref.html": [
|
||||
"9dac06a226bb54ce2c735bfb00aca30d204b2dfd",
|
||||
"support"
|
||||
],
|
||||
"css/css-content/pseudo-element-inline-box.html": [
|
||||
"af67630b8d0f14c2a3512c942c1f8b487388ee69",
|
||||
"reftest"
|
||||
],
|
||||
"css/css-content/resources/blank.html": [
|
||||
"d96d45f3a57b58460787fcde5fd15ccb324b123c",
|
||||
"support"
|
||||
|
@ -1,8 +0,0 @@
|
||||
<!doctype html>
|
||||
<title>CSS Test Reference</title>
|
||||
<p>Should see a green image with a blue border</p>
|
||||
<div>
|
||||
<span style="border: 10px solid blue">
|
||||
<img src="resources/rect.svg">
|
||||
</span>
|
||||
</div>
|
@ -1,15 +0,0 @@
|
||||
<!doctype html>
|
||||
<title>CSS Test: content: url() on pseudo-elements is under a non-replaced box.</title>
|
||||
<link rel="match" href="pseudo-element-inline-box-ref.html">
|
||||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
|
||||
<link rel="author" title="Boris Zbarsky" href="mailto:bzbarsky@mit.edu">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-content/#typedef-content-content-list">
|
||||
<style>
|
||||
div::before {
|
||||
border: 10px solid blue;
|
||||
content: url(resources/rect.svg);
|
||||
display: inline;
|
||||
}
|
||||
</style>
|
||||
<p>Should see a green image with a blue border</p>
|
||||
<div></div>
|
Loading…
Reference in New Issue
Block a user