Files
palemoon27/dom/html/HTMLDetailsElement.cpp
T
roytam1 38663d2b9f import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1230163 - White-space copy issue: Add conditional compile also for SeaMonkey. r=ehsan (6c6cf03257)
- Bug 1066663, move call to SetDragState to happen when a window is lowered to avoid the issue with selection being prevented, r=smaug (7a15008ac3)
- Bug 1245452, null check window->GetDocShell return value, r=khuey (77fee59e52)
- Bug 1168398 - Ensure that the presshell is initialized before attempting to scroll something into its view; r=enndeakin (4aba157104)
- Bug 1227461, don't iterate multiple times past the top-level document during tab navigation, prevents hang navigating in page info dialog, r=smaug (0a69f5085d)
- Bug 1263443 - Typo in nsGkAtomList.h; r=smaug (9a0b34d075)
- Bug 1260480 - Remove mozNoMarginBoxes. r=dbaron (fb06487de9)
- Bug 1254378 - Make SpeechSynthesis an event target with a "voiceschanged" event. r=smaug (8d00157559)
- some missing bits to be reapplied (e046af733d)
- Bug 1097398 Part 1 - Move AccessibleCaret default assets to layout/style/. r=nalexander, r=heycam (694c4617d2)
- Bug 1097398 Part 2 - Add preferences to make carets always tilt. r=roc (61ccfa508e)
- Bug 1252368 - Move resource files in layout/style/ into layout/style/res/ directory. r=nalexander (6049fec5ba)
- partial of Bug 1258177 - Make the list-item markers non-selectable. r=bz (9387a5a1f7)
- Bug 1259889 Part 2 - Load html.css lazily for pref changes. r=heycam (16f139a9b4)
- Bug 1258657 Part 1 - Change summary default style to "display: list-item" to match html spec. r=bz (a90a87025c)
- Bug 1258657 Part 2 - Remove SummaryFrame. r=bz (7e555a570e)
- Bug 1236828 part 1 - Apply proper clip state to top layer frames. r=mstange (5f3b55e475)
- Bug 1236828 part 2 - Make frame constructor support absolutely-positioned top layer frame. r=bz (052f7d5d71)
- Bug 1236828 part 3 - Allow setting position: absolute for top layer element and add test. r=heycam (ddf55b2e57)
- Bug 1264533 - Correct the universal selector for summary to include all namespaces. r=bz (4bd53c11cc)
- simple formatting (f19a2351a2)
- Bug 1235321 - Enable using line cursor to optimize reflowing absolute frames. r=bz (35199c6780)
- Bug 1260090 - Remove nsBlockFrameSuper as nsContainerFrame alias. r=dholbert (dbf60b2ef2)
- minor format fix (a057efcf1c)
- minor format fix (ac1f3b6691)
- Bug 1145218 followup - Properly parenthesize macro argument. No review. (6a5d9fcf64)
- Bug 1256727 - Back out the functional parts of cset 59a1ca7d784c now that we have a better fix using empty transactions. r=me (007080dd0a)
- Bug 1256040 - Follow-up fix for nsGridContainerFrame.h/cpp compile errors in non-unified build. r=me (9c08e31572)
- Bug 1243125 - patch 0 - Relax overly-harsh writing mode assertions in nsReflowMetrics size accessors. r=dholbert (3f75521c74)
- Bug 1243125 - patch 1 - Check block size instead of height when detecting truncated frames. r=jfkthame (66a36d7c35)
- Bug 1243125 - patch 2 - Don't ever set NS_FRAME_TRUNCATED for orthogonal flows. r=dholbert (ce4650213c)
- Bug 1243125 - Reftest for floats overflowing container, with diverse writing-modes. r=jfkthame (f621d8d17e)
- Bug 1250674 - Don't print header/footer if larger than user defined margins. r=dbaron (604e4c8f28)
- Bug 1182247 - Only RegisterPluginForGeometryUpdates in nsPluginFrame::EndSwapDocShells if mInstanceOwner is non-null. r=tnikkel (8958766501)
- fix misspatch compared to esr52 (06be2eb39c)
- Bug 1237236 - When collapsing the selection to the end of textframe that ends in a significant newline then set mHint to CARET_ASSOCIATE_AFTER so that the caret is rendered at the start of the next line if any. r=ehsan (1f86bf7a57)
- Bug 1258308 - Lookup the frame (continuation) associated with aParentNode/aOffset instead of assuming it's always the primary frame (follow-up from bug 1237236). r=ehsa (8849eecf94)
- Bug 1259949 - Set the CARET_ASSOCIATE_AFTER hint also when we collapse just after a text node that ends with a significant newline. r=ehsan (065b4f6c9a)
- Bug 1261718. In nsSubDocumentFrame when getting the document from a view go through the view manager because it is more like to succeed. r=mats (508f485aeb)
- Bug 1178060 - Ensure that if there is a document-level apz-aware event listener on a subdocument, we build the nsDisplaySubdocument item to hold that information. r=tn (8e235581a5)
- Bug 1240799 - Apply axis height for mfrac elements without bar. r=fredw (6a5fb4a3fa)
- Bug 1224113 - fix ref count issue during channel close. r=jdm (35c5a01787)
2024-08-02 16:52:24 +08:00

101 lines
2.8 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/HTMLDetailsElement.h"
#include "mozilla/dom/HTMLDetailsElementBinding.h"
#include "mozilla/dom/HTMLUnknownElement.h"
#include "mozilla/Preferences.h"
// Expand NS_IMPL_NS_NEW_HTML_ELEMENT(Details) to add pref check.
nsGenericHTMLElement*
NS_NewHTMLDetailsElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
mozilla::dom::FromParser aFromParser)
{
if (!mozilla::dom::HTMLDetailsElement::IsDetailsEnabled()) {
return new mozilla::dom::HTMLUnknownElement(aNodeInfo);
}
return new mozilla::dom::HTMLDetailsElement(aNodeInfo);
}
namespace mozilla {
namespace dom {
/* static */ bool
HTMLDetailsElement::IsDetailsEnabled()
{
static bool isDetailsEnabled = false;
static bool added = false;
if (!added) {
Preferences::AddBoolVarCache(&isDetailsEnabled,
"dom.details_element.enabled");
added = true;
}
return isDetailsEnabled;
}
HTMLDetailsElement::~HTMLDetailsElement()
{
}
NS_IMPL_ELEMENT_CLONE(HTMLDetailsElement)
nsIContent*
HTMLDetailsElement::GetFirstSummary() const
{
// XXX: Bug 1245032: Might want to cache the first summary element.
for (nsIContent* child = nsINode::GetFirstChild();
child;
child = child->GetNextSibling()) {
if (child->IsHTMLElement(nsGkAtoms::summary)) {
return child;
}
}
return nullptr;
}
nsChangeHint
HTMLDetailsElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
int32_t aModType) const
{
nsChangeHint hint =
nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsGkAtoms::open) {
NS_UpdateHint(hint, nsChangeHint_ReconstructFrame);
}
return hint;
}
nsresult
HTMLDetailsElement::BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
nsAttrValueOrString* aValue, bool aNotify)
{
if (aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::open) {
bool setOpen = aValue != nullptr;
if (Open() != setOpen) {
if (mToggleEventDispatcher) {
mToggleEventDispatcher->Cancel();
}
mToggleEventDispatcher = new ToggleEventDispatcher(this);
mToggleEventDispatcher->PostDOMEvent();
}
}
return nsGenericHTMLElement::BeforeSetAttr(aNameSpaceID, aName, aValue,
aNotify);
}
JSObject*
HTMLDetailsElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return HTMLDetailsElementBinding::Wrap(aCx, this, aGivenProto);
}
} // namespace dom
} // namespace mozilla