summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/dom
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-11-18 16:35:47 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-11-18 15:45:54 +0000
commit32f5a1c56531e4210bc4cf8d8c7825d66e081888 (patch)
treeeeeec6822f4d738d8454525233fd0e2e3a659e6d /chromium/third_party/blink/renderer/core/dom
parent99677208ff3b216fdfec551fbe548da5520cd6fb (diff)
downloadqtwebengine-chromium-32f5a1c56531e4210bc4cf8d8c7825d66e081888.tar.gz
BASELINE: Update Chromium to 87.0.4280.67
Change-Id: Ib157360be8c2ffb2c73125751a89f60e049c1d54 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/dom')
-rw-r--r--chromium/third_party/blink/renderer/core/dom/aria_attributes.idl2
-rw-r--r--chromium/third_party/blink/renderer/core/dom/child_list_mutation_scope.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/container_node.cc9
-rw-r--r--chromium/third_party/blink/renderer/core/dom/container_node.h5
-rw-r--r--chromium/third_party/blink/renderer/core/dom/document.cc399
-rw-r--r--chromium/third_party/blink/renderer/core/dom/document.h54
-rw-r--r--chromium/third_party/blink/renderer/core/dom/document.idl6
-rw-r--r--chromium/third_party/blink/renderer/core/dom/document_data.h15
-rw-r--r--chromium/third_party/blink/renderer/core/dom/document_init.cc11
-rw-r--r--chromium/third_party/blink/renderer/core/dom/document_init.h11
-rw-r--r--chromium/third_party/blink/renderer/core/dom/document_lifecycle.h22
-rw-r--r--chromium/third_party/blink/renderer/core/dom/document_or_shadow_root.idl6
-rw-r--r--chromium/third_party/blink/renderer/core/dom/document_parser_timing.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/document_test.cc6
-rw-r--r--chromium/third_party/blink/renderer/core/dom/dom_implementation.cc7
-rw-r--r--chromium/third_party/blink/renderer/core/dom/dom_string_map.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/dom_string_map.idl2
-rw-r--r--chromium/third_party/blink/renderer/core/dom/dom_token_list.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/element.cc194
-rw-r--r--chromium/third_party/blink/renderer/core/dom/element.h20
-rw-r--r--chromium/third_party/blink/renderer/core/dom/element_rare_data.h3
-rw-r--r--chromium/third_party/blink/renderer/core/dom/events/event_dispatch_forbidden_scope.h9
-rw-r--r--chromium/third_party/blink/renderer/core/dom/events/event_listener.h5
-rw-r--r--chromium/third_party/blink/renderer/core/dom/events/event_listener_map.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/events/event_path.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/events/event_target.cc8
-rw-r--r--chromium/third_party/blink/renderer/core/dom/events/event_target.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/events/scoped_event_queue.h7
-rw-r--r--chromium/third_party/blink/renderer/core/dom/events/window_event_context.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/first_letter_pseudo_element.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/dom/first_letter_pseudo_element.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/flat_tree_node_data.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/flat_tree_traversal_forbidden_scope.h6
-rw-r--r--chromium/third_party/blink/renderer/core/dom/global_event_handlers.h5
-rw-r--r--chromium/third_party/blink/renderer/core/dom/global_event_handlers.idl7
-rw-r--r--chromium/third_party/blink/renderer/core/dom/id_target_observer_registry.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/idle_deadline_test.cc10
-rw-r--r--chromium/third_party/blink/renderer/core/dom/ignore_opens_during_unload_count_incrementer.h6
-rw-r--r--chromium/third_party/blink/renderer/core/dom/increment_load_event_delay_count.h5
-rw-r--r--chromium/third_party/blink/renderer/core/dom/iterator.idl2
-rw-r--r--chromium/third_party/blink/renderer/core/dom/layout_tree_builder.cc4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/layout_tree_builder.h2
-rw-r--r--chromium/third_party/blink/renderer/core/dom/live_node_list_registry.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/names_map.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/node.cc47
-rw-r--r--chromium/third_party/blink/renderer/core/dom/node.h27
-rw-r--r--chromium/third_party/blink/renderer/core/dom/node_iterator_base.cc5
-rw-r--r--chromium/third_party/blink/renderer/core/dom/node_lists_node_data.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/node_rare_data.h11
-rw-r--r--chromium/third_party/blink/renderer/core/dom/node_traversal.h3
-rw-r--r--chromium/third_party/blink/renderer/core/dom/nth_index_cache.h7
-rw-r--r--chromium/third_party/blink/renderer/core/dom/pseudo_element_data.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/range.cc3
-rw-r--r--chromium/third_party/blink/renderer/core/dom/scoped_window_focus_allowed_indicator.h6
-rw-r--r--chromium/third_party/blink/renderer/core/dom/scripted_idle_task_controller_test.cc11
-rw-r--r--chromium/third_party/blink/renderer/core/dom/shadow_root.h16
-rw-r--r--chromium/third_party/blink/renderer/core/dom/shadow_root_v0.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/sink_document.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/dom/slot_assignment_recalc_forbidden_scope.h13
-rw-r--r--chromium/third_party/blink/renderer/core/dom/synchronous_mutation_observer.cc6
-rw-r--r--chromium/third_party/blink/renderer/core/dom/synchronous_mutation_observer.h2
-rw-r--r--chromium/third_party/blink/renderer/core/dom/text.cc2
-rw-r--r--chromium/third_party/blink/renderer/core/dom/text_link_colors.cc4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/text_link_colors.h8
-rw-r--r--chromium/third_party/blink/renderer/core/dom/throw_on_dynamic_markup_insertion_count_incrementer.h6
-rw-r--r--chromium/third_party/blink/renderer/core/dom/transform_source.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/tree_ordered_list.h4
-rw-r--r--chromium/third_party/blink/renderer/core/dom/tree_scope.cc34
-rw-r--r--chromium/third_party/blink/renderer/core/dom/tree_scope.h7
69 files changed, 720 insertions, 422 deletions
diff --git a/chromium/third_party/blink/renderer/core/dom/aria_attributes.idl b/chromium/third_party/blink/renderer/core/dom/aria_attributes.idl
index 9f6a22ba398..9987d175edd 100644
--- a/chromium/third_party/blink/renderer/core/dom/aria_attributes.idl
+++ b/chromium/third_party/blink/renderer/core/dom/aria_attributes.idl
@@ -16,7 +16,7 @@
[CEReactions, Reflect=aria_colindex] attribute DOMString? ariaColIndex;
[CEReactions, Reflect=aria_colspan] attribute DOMString? ariaColSpan;
[CEReactions, Reflect=aria_current] attribute DOMString? ariaCurrent;
- [RuntimeEnabled=AccessibilityExposeARIAAnnotations, CEReactions, Reflect=aria_description] attribute DOMString? ariaDescription;
+ [CEReactions, Reflect=aria_description] attribute DOMString? ariaDescription;
[CEReactions, Reflect=aria_disabled] attribute DOMString? ariaDisabled;
[CEReactions, Reflect=aria_expanded] attribute DOMString? ariaExpanded;
[CEReactions, Reflect=aria_haspopup] attribute DOMString? ariaHasPopup;
diff --git a/chromium/third_party/blink/renderer/core/dom/child_list_mutation_scope.h b/chromium/third_party/blink/renderer/core/dom/child_list_mutation_scope.h
index 0f6bd80b2e1..213a1d65e6d 100644
--- a/chromium/third_party/blink/renderer/core/dom/child_list_mutation_scope.h
+++ b/chromium/third_party/blink/renderer/core/dom/child_list_mutation_scope.h
@@ -31,7 +31,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_CHILD_LIST_MUTATION_SCOPE_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_CHILD_LIST_MUTATION_SCOPE_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/mutation_observer.h"
#include "third_party/blink/renderer/core/dom/node.h"
@@ -99,6 +98,8 @@ class ChildListMutationScope final {
accumulator_->EnterMutationScope();
}
}
+ ChildListMutationScope(const ChildListMutationScope&) = delete;
+ ChildListMutationScope& operator=(const ChildListMutationScope&) = delete;
~ChildListMutationScope() {
if (accumulator_) {
@@ -120,7 +121,6 @@ class ChildListMutationScope final {
private:
ChildListMutationAccumulator* accumulator_ = nullptr;
- DISALLOW_COPY_AND_ASSIGN(ChildListMutationScope);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/container_node.cc b/chromium/third_party/blink/renderer/core/dom/container_node.cc
index 21ab2589958..d336d0ce494 100644
--- a/chromium/third_party/blink/renderer/core/dom/container_node.cc
+++ b/chromium/third_party/blink/renderer/core/dom/container_node.cc
@@ -658,6 +658,10 @@ void ContainerNode::WillRemoveChildren() {
ChildFrameDisconnector::kDescendantsOnly);
}
+LayoutBox* ContainerNode::GetLayoutBoxForScrolling() const {
+ return GetLayoutBox();
+}
+
void ContainerNode::Trace(Visitor* visitor) const {
visitor->Trace(first_child_);
visitor->Trace(last_child_);
@@ -990,8 +994,7 @@ void ContainerNode::RemovedFrom(ContainerNode& insertion_point) {
DISABLE_CFI_PERF
void ContainerNode::AttachLayoutTree(AttachContext& context) {
auto* element = DynamicTo<Element>(this);
- if (element && element->StyleRecalcBlockedByDisplayLock(
- DisplayLockLifecycleTarget::kChildren)) {
+ if (element && element->ChildStyleRecalcBlockedByDisplayLock()) {
// Since we block style recalc on descendants of this node due to display
// locking, none of its descendants should have the NeedsReattachLayoutTree
// bit set.
@@ -1081,7 +1084,7 @@ void ContainerNode::FocusStateChanged() {
if (this_element && this_element->ChildrenOrSiblingsAffectedByFocus())
this_element->PseudoStateChanged(CSSSelector::kPseudoFocus);
- GetLayoutObject()->InvalidateIfControlStateChanged(kFocusControlState);
+ InvalidateIfHasEffectiveAppearance();
FocusVisibleStateChanged();
FocusWithinStateChanged();
}
diff --git a/chromium/third_party/blink/renderer/core/dom/container_node.h b/chromium/third_party/blink/renderer/core/dom/container_node.h
index a698ddcdceb..6fddfe3a236 100644
--- a/chromium/third_party/blink/renderer/core/dom/container_node.h
+++ b/chromium/third_party/blink/renderer/core/dom/container_node.h
@@ -385,6 +385,11 @@ class CORE_EXPORT ContainerNode : public Node {
virtual bool ChildrenCanHaveStyle() const { return true; }
+ // This is similar to GetLayoutBox(), but returns nullptr if it's not
+ // scrollable. Some elements override this to delegate scroll operations to
+ // a descendant LayoutBox.
+ virtual LayoutBox* GetLayoutBoxForScrolling() const;
+
void Trace(Visitor*) const override;
protected:
diff --git a/chromium/third_party/blink/renderer/core/dom/document.cc b/chromium/third_party/blink/renderer/core/dom/document.cc
index 74856aabf5a..20688b7ab11 100644
--- a/chromium/third_party/blink/renderer/core/dom/document.cc
+++ b/chromium/third_party/blink/renderer/core/dom/document.cc
@@ -52,11 +52,9 @@
#include "services/metrics/public/cpp/mojo_ukm_recorder.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
-#include "services/metrics/public/mojom/ukm_interface.mojom-blink.h"
#include "services/network/public/mojom/ip_address_space.mojom-blink.h"
#include "services/network/public/mojom/trust_tokens.mojom-blink.h"
#include "services/network/public/mojom/web_sandbox_flags.mojom-blink.h"
-#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/browser_interface_broker_proxy.h"
#include "third_party/blink/public/common/css/preferred_color_scheme.h"
#include "third_party/blink/public/common/feature_policy/document_policy_features.h"
@@ -66,7 +64,7 @@
#include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h"
#include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h"
#include "third_party/blink/public/mojom/insecure_input/insecure_input_service.mojom-blink.h"
-#include "third_party/blink/public/mojom/ukm/ukm.mojom-blink.h"
+#include "third_party/blink/public/mojom/page_state/page_state.mojom-blink.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/public/platform/web_battery_savings.h"
@@ -182,6 +180,7 @@
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_client.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
+#include "third_party/blink/renderer/core/frame/page_dismissal_scope.h"
#include "third_party/blink/renderer/core/frame/performance_monitor.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/frame/viewport_data.h"
@@ -198,6 +197,7 @@
#include "third_party/blink/renderer/core/html/custom/v0_custom_element_registration_context.h"
#include "third_party/blink/renderer/core/html/document_all_name_collection.h"
#include "third_party/blink/renderer/core/html/document_name_collection.h"
+#include "third_party/blink/renderer/core/html/forms/email_input_type.h"
#include "third_party/blink/renderer/core/html/forms/form_controller.h"
#include "third_party/blink/renderer/core/html/forms/html_form_element.h"
#include "third_party/blink/renderer/core/html/forms/html_input_element.h"
@@ -275,6 +275,7 @@
#include "third_party/blink/renderer/core/page/scrolling/scrolling_coordinator.h"
#include "third_party/blink/renderer/core/page/scrolling/snap_coordinator.h"
#include "third_party/blink/renderer/core/page/scrolling/text_fragment_anchor.h"
+#include "third_party/blink/renderer/core/page/scrolling/text_fragment_selector_generator.h"
#include "third_party/blink/renderer/core/page/scrolling/top_document_root_scroller_controller.h"
#include "third_party/blink/renderer/core/page/spatial_navigation_controller.h"
#include "third_party/blink/renderer/core/page/validation_message_client.h"
@@ -297,7 +298,6 @@
#include "third_party/blink/renderer/core/trustedtypes/trusted_html.h"
#include "third_party/blink/renderer/core/xml/parser/xml_document_parser.h"
#include "third_party/blink/renderer/core/xml_names.h"
-#include "third_party/blink/renderer/core/xmlhttprequest/main_thread_disallow_synchronous_xhr_scope.h"
#include "third_party/blink/renderer/core/xmlns_names.h"
#include "third_party/blink/renderer/platform/bindings/dom_data_store.h"
#include "third_party/blink/renderer/platform/bindings/exception_messages.h"
@@ -620,7 +620,6 @@ class Document::NetworkStateObserver final
: public GarbageCollected<Document::NetworkStateObserver>,
public NetworkStateNotifier::NetworkStateObserver,
public ExecutionContextLifecycleObserver {
-
public:
explicit NetworkStateObserver(ExecutionContext* context)
: ExecutionContextLifecycleObserver(context) {
@@ -684,6 +683,7 @@ Document::Document(const DocumentInit& initializer,
DocumentClassFlags document_classes)
: ContainerNode(nullptr, kCreateDocument),
TreeScope(*this),
+ is_initial_empty_document_(initializer.IsInitialEmptyDocument()),
evaluate_media_queries_on_style_recalc_(false),
pending_sheet_layout_(kNoLayoutWithPendingSheets),
dom_window_(initializer.GetWindow()),
@@ -783,7 +783,15 @@ Document::Document(const DocumentInit& initializer,
: kAllowAsynchronousParsing),
node_count_(0),
logged_field_edit_(false),
- ukm_source_id_(ukm::UkmRecorder::GetNewSourceID()),
+ // Use the source id from the document initializer if it is available.
+ // Otherwise, generate a new source id to cover any cases that don't
+ // receive a valid source id, this for example includes but is not limited
+ // to SVGImage which does not have an associated RenderFrameHost. No URLs
+ // will be associated to this source id. No DocumentCreated events will be
+ // created either.
+ ukm_source_id_(initializer.UkmSourceId() == ukm::kInvalidSourceId
+ ? ukm::UkmRecorder::GetNewSourceID()
+ : initializer.UkmSourceId()),
needs_to_record_ukm_outlive_time_(false),
viewport_data_(MakeGarbageCollected<ViewportData>(*this)),
is_for_external_handler_(initializer.IsForExternalHandler()),
@@ -811,7 +819,8 @@ Document::Document(const DocumentInit& initializer,
*MakeGarbageCollected<NullResourceFetcherProperties>());
fetcher_ = MakeGarbageCollected<ResourceFetcher>(ResourceFetcherInit(
properties, &FetchContext::NullInstance(),
- GetTaskRunner(TaskType::kNetworking), nullptr /* loader_factory */));
+ GetTaskRunner(TaskType::kNetworking), nullptr /* loader_factory */,
+ GetExecutionContext()));
if (imports_controller_) {
// We don't expect the fetcher to be used, so count such unexpected use.
@@ -1694,7 +1703,7 @@ Element* Document::ScrollingElementNoLayout() {
lifecycle_.GetState() >= DocumentLifecycle::kStyleClean);
HTMLBodyElement* body = FirstBodyElement();
if (body && body->GetLayoutObject() &&
- body->GetLayoutObject()->HasOverflowClip())
+ body->GetLayoutObject()->IsScrollContainer())
return nullptr;
return body;
@@ -1881,7 +1890,7 @@ bool Document::IsPrefetchOnly() const {
return prerenderer_client && prerenderer_client->IsPrefetchOnly();
}
-String Document::visibilityState() const {
+AtomicString Document::visibilityState() const {
return PageHiddenStateString(hidden());
}
@@ -2215,7 +2224,7 @@ void Document::PropagateStyleToViewport() {
// viewport. This is a bit of a weird edge case in the CSS spec that we
// might want to try to eliminate some day (eg. for ScrollTopLeftInterop
// - see http://crbug.com/157855).
- if (body_style && !body_style->IsOverflowVisible()) {
+ if (body_style && body_style->IsScrollContainer()) {
UseCounter::Count(*this,
WebFeature::kBodyScrollsInAdditionToViewport);
}
@@ -2266,17 +2275,20 @@ void Document::PropagateStyleToViewport() {
overflow_y = overflow_style->OverflowY();
overflow_anchor = overflow_style->OverflowAnchor();
// Visible overflow on the viewport is meaningless, and the spec says to
- // treat it as 'auto':
+ // treat it as 'auto'. The spec also says to treat 'clip' as 'hidden'.
if (overflow_x == EOverflow::kVisible)
overflow_x = EOverflow::kAuto;
+ else if (overflow_x == EOverflow::kClip)
+ overflow_x = EOverflow::kHidden;
if (overflow_y == EOverflow::kVisible)
overflow_y = EOverflow::kAuto;
+ else if (overflow_y == EOverflow::kClip)
+ overflow_y = EOverflow::kHidden;
if (overflow_anchor == EOverflowAnchor::kVisible)
overflow_anchor = EOverflowAnchor::kAuto;
if (IsInMainFrame()) {
- using OverscrollBehaviorType =
- cc::OverscrollBehavior::OverscrollBehaviorType;
+ using OverscrollBehaviorType = cc::OverscrollBehavior::Type;
GetPage()->GetChromeClient().SetOverscrollBehavior(
*GetFrame(),
cc::OverscrollBehavior(static_cast<OverscrollBehaviorType>(
@@ -2355,8 +2367,7 @@ static void AssertLayoutTreeUpdated(Node& root) {
while (node) {
if (auto* element = DynamicTo<Element>(node)) {
if (RuntimeEnabledFeatures::CSSContentVisibilityEnabled() &&
- element->StyleRecalcBlockedByDisplayLock(
- DisplayLockLifecycleTarget::kChildren)) {
+ element->ChildStyleRecalcBlockedByDisplayLock()) {
node = FlatTreeTraversal::NextSkippingChildren(*node);
continue;
}
@@ -2450,7 +2461,7 @@ void Document::UpdateStyleAndLayoutTree() {
UpdateDistributionForLegacyDistributedNodes();
- UpdateActiveStyle();
+ GetStyleEngine().UpdateActiveStyle();
InvalidateStyleAndLayoutForFontUpdates();
UpdateStyleInvalidationIfNeeded();
UpdateStyle();
@@ -2466,6 +2477,9 @@ void Document::UpdateStyleAndLayoutTree() {
unsigned element_count =
GetStyleEngine().StyleForElementCount() - start_element_count;
+ // Make sure that document.fonts.ready fires, if appropriate.
+ FontFaceSetDocument::DidLayout(*this);
+
TRACE_EVENT_END1("blink,devtools.timeline", "UpdateLayoutTree",
"elementCount", element_count);
@@ -2474,13 +2488,6 @@ void Document::UpdateStyleAndLayoutTree() {
#endif
}
-void Document::UpdateActiveStyle() {
- DCHECK(IsActive());
- DCHECK(IsMainThread());
- TRACE_EVENT0("blink", "Document::updateActiveStyle");
- GetStyleEngine().UpdateActiveStyle();
-}
-
void Document::InvalidateStyleAndLayoutForFontUpdates() {
DCHECK(IsActive());
DCHECK(IsMainThread());
@@ -2671,8 +2678,8 @@ void Document::ApplyScrollRestorationLogic() {
if (!View()->GetScrollableArea()->HasPendingHistoryRestoreScrollOffset())
return;
- bool should_restore_scroll =
- history_item->ScrollRestorationType() != kScrollRestorationManual;
+ bool should_restore_scroll = history_item->ScrollRestorationType() !=
+ mojom::blink::ScrollRestorationType::kManual;
auto& scroll_offset = history_item->GetViewState()->scroll_offset_;
// This tries to balance:
@@ -2869,7 +2876,7 @@ void Document::ClearFocusedElementTimerFired(TimerBase*) {
focused_element_->blur();
}
-scoped_refptr<const ComputedStyle> Document::StyleForPage(int page_index) {
+scoped_refptr<const ComputedStyle> Document::StyleForPage(uint32_t page_index) {
UpdateDistributionForUnknownReasons();
AtomicString page_name;
@@ -2878,7 +2885,7 @@ scoped_refptr<const ComputedStyle> Document::StyleForPage(int page_index) {
page_name = mapper->NamedPageAtIndex(page_index);
}
- UpdateActiveStyle();
+ GetStyleEngine().UpdateActiveStyle();
return GetStyleEngine().GetStyleResolver().StyleForPage(page_index,
page_name);
}
@@ -2915,12 +2922,12 @@ void Document::EnsurePaintLocationDataValidForNode(
}
}
-bool Document::IsPageBoxVisible(int page_index) {
+bool Document::IsPageBoxVisible(uint32_t page_index) {
return StyleForPage(page_index)->Visibility() !=
EVisibility::kHidden; // display property doesn't apply to @page.
}
-void Document::GetPageDescription(int page_index,
+void Document::GetPageDescription(uint32_t page_index,
WebPrintPageDescription* description) {
scoped_refptr<const ComputedStyle> style = StyleForPage(page_index);
@@ -2965,12 +2972,6 @@ void Document::GetPageDescription(int page_index,
description->orientation = style->GetPageOrientation();
}
-void Document::SetIsViewSource(bool is_view_source) {
- is_view_source_ = is_view_source;
- if (!is_view_source_)
- return;
-}
-
void Document::SetIsXrOverlay(bool val, Element* overlay_element) {
if (!documentElement())
return;
@@ -3107,8 +3108,7 @@ void Document::Shutdown() {
GetViewportData().Shutdown();
View()->Dispose();
- // TODO(crbug.com/729196): Trace why LocalFrameView::DetachFromLayout crashes.
- CHECK(!View()->IsAttached());
+ DCHECK(!View()->IsAttached());
// If the EmbeddedContentView of the document's frame owner doesn't match
// view() then LocalFrameView::Dispose() didn't clear the owner's
@@ -3126,6 +3126,9 @@ void Document::Shutdown() {
markers_->PrepareForDestruction();
+ if (GetFrame()->GetTextFragmentSelectorGenerator())
+ GetFrame()->GetTextFragmentSelectorGenerator()->ClearSelection();
+
GetPage()->DocumentDetached(this);
probe::DocumentDetached(this);
@@ -3170,8 +3173,7 @@ void Document::Shutdown() {
layout_view_ = nullptr;
DetachLayoutTree();
- // TODO(crbug.com/729196): Trace why LocalFrameView::DetachFromLayout crashes.
- CHECK(!View()->IsAttached());
+ DCHECK(!View()->IsAttached());
if (this != &AXObjectCacheOwner()) {
if (AXObjectCache* cache = ExistingAXObjectCache()) {
@@ -3190,12 +3192,12 @@ void Document::Shutdown() {
GetFrame()->GetEventHandlerRegistry().DocumentDetached(*this);
// Signal destruction to mutation observers.
- synchronous_mutation_observer_list_.ForEachObserver(
+ synchronous_mutation_observer_set_.ForEachObserver(
[](SynchronousMutationObserver* observer) {
observer->ContextDestroyed();
- observer->ObserverListWillBeCleared();
+ observer->ObserverSetWillBeCleared();
});
- synchronous_mutation_observer_list_.Clear();
+ synchronous_mutation_observer_set_.Clear();
cookie_jar_ = nullptr; // Not accessible after navigated away.
fetcher_->ClearContext();
@@ -3211,8 +3213,7 @@ void Document::Shutdown() {
media_query_matcher_->DocumentDetached();
lifecycle_.AdvanceTo(DocumentLifecycle::kStopped);
- // TODO(crbug.com/729196): Trace why LocalFrameView::DetachFromLayout crashes.
- CHECK(!View()->IsAttached());
+ DCHECK(!View()->IsAttached());
needs_to_record_ukm_outlive_time_ = IsInMainFrame();
if (needs_to_record_ukm_outlive_time_) {
@@ -3535,6 +3536,8 @@ void Document::open() {
if (ScriptableDocumentParser* parser = GetScriptableDocumentParser())
parser->SetWasCreatedByScript(true);
+ // Calling document.open counts as committing the first real document load.
+ is_initial_empty_document_ = false;
if (GetFrame())
GetFrame()->Loader().DidExplicitOpen();
}
@@ -3702,7 +3705,7 @@ Element* Document::ViewportDefiningElement() const {
const ComputedStyle* root_style = root_element->GetComputedStyle();
if (!root_style || root_style->IsEnsuredInDisplayNone())
return nullptr;
- if (body_element && root_style->IsOverflowVisible() &&
+ if (body_element && root_style->IsOverflowVisibleAlongBothAxes() &&
IsA<HTMLHtmlElement>(root_element))
return body_element;
return root_element;
@@ -3853,6 +3856,7 @@ void Document::ImplicitClose() {
else
cache->HandleLayoutComplete(this);
}
+ FontFaceSetDocument::DidLayout(*this);
}
if (SvgExtensions())
@@ -3940,17 +3944,6 @@ bool Document::CheckCompletedInternal() {
if (!GetFrame())
return false;
- // Send the source ID of the document to the browser.
- if (GetFrame()->Client()->GetRemoteNavigationAssociatedInterfaces()) {
- mojo::AssociatedRemote<mojom::blink::UkmSourceIdFrameHost> ukm_binding;
- GetFrame()
- ->Client()
- ->GetRemoteNavigationAssociatedInterfaces()
- ->GetInterface(&ukm_binding);
- DCHECK(ukm_binding.is_bound());
- ukm_binding->SetDocumentSourceId(ukm_source_id_);
- }
-
GetFrame()->GetFrameScheduler()->RegisterStickyFeature(
SchedulingPolicy::Feature::kDocumentLoaded,
{SchedulingPolicy::RecordMetricsForBackForwardCache()});
@@ -3994,7 +3987,7 @@ bool Document::DispatchBeforeUnloadEvent(ChromeClient* chrome_client,
if (ProcessingBeforeUnload())
return false;
- MainThreadDisallowSynchronousXHRScope disallow_synchronous_xhr;
+ PageDismissalScope in_page_dismissal;
auto& before_unload_event = *MakeGarbageCollected<BeforeUnloadEvent>();
before_unload_event.initEvent(event_type_names::kBeforeunload, false, true);
const base::TimeTicks beforeunload_event_start = base::TimeTicks::Now();
@@ -4088,87 +4081,99 @@ void Document::DispatchUnloadEvents(
SecurityOrigin* committing_origin,
base::Optional<Document::UnloadEventTiming>* unload_timing) {
PluginScriptForbiddenScope forbid_plugin_destructor_scripting;
- MainThreadDisallowSynchronousXHRScope disallow_synchronous_xhr;
+ PageDismissalScope in_page_dismissal;
if (parser_)
parser_->StopParsing();
- if (load_event_progress_ == kLoadEventNotRun)
- return;
-
- if (load_event_progress_ <= kUnloadEventInProgress) {
- Element* current_focused_element = FocusedElement();
- if (auto* input = DynamicTo<HTMLInputElement>(current_focused_element))
- input->EndEditing();
- if (load_event_progress_ < kPageHideInProgress) {
- load_event_progress_ = kPageHideInProgress;
- LocalDOMWindow* window = domWindow();
- if (window && !GetPage()->DispatchedPagehideAndStillHidden()) {
- const base::TimeTicks pagehide_event_start = base::TimeTicks::Now();
- window->DispatchEvent(
- *PageTransitionEvent::Create(event_type_names::kPagehide, false),
- this);
- const base::TimeTicks pagehide_event_end = base::TimeTicks::Now();
- DEFINE_STATIC_LOCAL(
- CustomCountHistogram, pagehide_histogram,
- ("DocumentEventTiming.PageHideDuration", 0, 10000000, 50));
- pagehide_histogram.CountMicroseconds(pagehide_event_end -
- pagehide_event_start);
- }
- if (!dom_window_)
- return;
+ if (load_event_progress_ == kLoadEventNotRun ||
+ load_event_progress_ > kUnloadEventInProgress) {
+ return;
+ }
- // This must be queried before |load_event_progress_| is changed to
- // kUnloadVisibilityChangeInProgress because that would change the result.
- bool page_visible = IsPageVisible();
- load_event_progress_ = kUnloadVisibilityChangeInProgress;
- if (page_visible) {
- // Dispatch visibilitychange event, but don't bother doing
- // other notifications as we're about to be unloaded.
- const base::TimeTicks pagevisibility_hidden_event_start =
- base::TimeTicks::Now();
- DispatchEvent(
- *Event::CreateBubble(event_type_names::kVisibilitychange));
- const base::TimeTicks pagevisibility_hidden_event_end =
- base::TimeTicks::Now();
- DEFINE_STATIC_LOCAL(CustomCountHistogram, pagevisibility_histogram,
- ("DocumentEventTiming.PageVibilityHiddenDuration",
- 0, 10000000, 50));
- pagevisibility_histogram.CountMicroseconds(
- pagevisibility_hidden_event_end -
- pagevisibility_hidden_event_start);
- DispatchEvent(
- *Event::CreateBubble(event_type_names::kWebkitvisibilitychange));
- }
- if (!dom_window_)
- return;
+ Element* current_focused_element = FocusedElement();
+ if (auto* input = DynamicTo<HTMLInputElement>(current_focused_element))
+ input->EndEditing();
- GetFrame()->Loader().SaveScrollAnchor();
-
- load_event_progress_ = kUnloadEventInProgress;
- Event& unload_event = *Event::Create(event_type_names::kUnload);
- const base::TimeTicks unload_event_start = base::TimeTicks::Now();
- dom_window_->DispatchEvent(unload_event, this);
- const base::TimeTicks unload_event_end = base::TimeTicks::Now();
-
- if (unload_timing) {
- // Record unload event timing when navigating cross-document.
- DEFINE_STATIC_LOCAL(
- CustomCountHistogram, unload_histogram,
- ("DocumentEventTiming.UnloadDuration", 0, 10000000, 50));
- unload_histogram.CountMicroseconds(unload_event_end -
- unload_event_start);
-
- // Fill in the unload timing if the new document origin has access to
- // them.
- if (committing_origin->CanRequest(Url())) {
- auto& timing = unload_timing->emplace();
- timing.unload_event_start = unload_event_start;
- timing.unload_event_end = unload_event_end;
- }
- }
- }
+ // If we've dispatched the pagehide event with 'persisted' set to true, it
+ // means we've dispatched the visibilitychange event before too. Also, we
+ // shouldn't dispatch the unload event because that event should only be
+ // fired when the pagehide event's 'persisted' bit is set to false.
+ bool dispatched_pagehide_persisted =
+ GetPage() && GetPage()->DispatchedPagehidePersistedAndStillHidden();
+
+ if (load_event_progress_ >= kPageHideInProgress ||
+ dispatched_pagehide_persisted) {
load_event_progress_ = kUnloadEventHandled;
+ return;
+ }
+
+ load_event_progress_ = kPageHideInProgress;
+ LocalDOMWindow* window = domWindow();
+ // We check for DispatchedPagehideAndStillHidden() here because it's possible
+ // to dispath pagehide with 'persisted' set to false before this and pass the
+ // |dispatched_pagehide_persisted| above, if we enable same-site
+ // ProactivelySwapBrowsingInstance but not BackForwardCache.
+ if (window && !GetPage()->DispatchedPagehideAndStillHidden()) {
+ const base::TimeTicks pagehide_event_start = base::TimeTicks::Now();
+ window->DispatchEvent(
+ *PageTransitionEvent::Create(event_type_names::kPagehide, false), this);
+ const base::TimeTicks pagehide_event_end = base::TimeTicks::Now();
+ DEFINE_STATIC_LOCAL(
+ CustomCountHistogram, pagehide_histogram,
+ ("DocumentEventTiming.PageHideDuration", 0, 10000000, 50));
+ pagehide_histogram.CountMicroseconds(pagehide_event_end -
+ pagehide_event_start);
+ }
+ if (!dom_window_)
+ return;
+
+ // This must be queried before |load_event_progress_| is changed to
+ // kUnloadVisibilityChangeInProgress because that would change the result.
+ bool page_visible = IsPageVisible();
+ load_event_progress_ = kUnloadVisibilityChangeInProgress;
+ if (page_visible) {
+ // Dispatch visibilitychange event, but don't bother doing
+ // other notifications as we're about to be unloaded.
+ const base::TimeTicks pagevisibility_hidden_event_start =
+ base::TimeTicks::Now();
+ DispatchEvent(*Event::CreateBubble(event_type_names::kVisibilitychange));
+ const base::TimeTicks pagevisibility_hidden_event_end =
+ base::TimeTicks::Now();
+ DEFINE_STATIC_LOCAL(
+ CustomCountHistogram, pagevisibility_histogram,
+ ("DocumentEventTiming.PageVibilityHiddenDuration", 0, 10000000, 50));
+ pagevisibility_histogram.CountMicroseconds(
+ pagevisibility_hidden_event_end - pagevisibility_hidden_event_start);
+ DispatchEvent(
+ *Event::CreateBubble(event_type_names::kWebkitvisibilitychange));
+ }
+ if (!dom_window_)
+ return;
+
+ GetFrame()->Loader().SaveScrollAnchor();
+
+ load_event_progress_ = kUnloadEventInProgress;
+ Event& unload_event = *Event::Create(event_type_names::kUnload);
+ const base::TimeTicks unload_event_start = base::TimeTicks::Now();
+ dom_window_->DispatchEvent(unload_event, this);
+ const base::TimeTicks unload_event_end = base::TimeTicks::Now();
+
+ if (unload_timing) {
+ // Record unload event timing when navigating cross-document.
+ DEFINE_STATIC_LOCAL(
+ CustomCountHistogram, unload_histogram,
+ ("DocumentEventTiming.UnloadDuration", 0, 10000000, 50));
+ unload_histogram.CountMicroseconds(unload_event_end - unload_event_start);
+
+ // Fill in the unload timing if the new document origin has access to
+ // them.
+ if (committing_origin->CanRequest(Url())) {
+ auto& timing = unload_timing->emplace();
+ timing.unload_event_start = unload_event_start;
+ timing.unload_event_end = unload_event_end;
+ }
}
+ load_event_progress_ = kUnloadEventHandled;
}
void Document::DispatchFreezeEvent() {
@@ -4388,6 +4393,9 @@ void Document::SetURL(const KURL& url) {
if (new_url == url_)
return;
+ TRACE_EVENT1("navigation", "Document::SetURL", "url",
+ new_url.GetString().Utf8());
+
// Count non-targetText occurrences of :~: in the url fragment to make sure
// the delimiter is web-compatible. This can be removed once the feature
// ships.
@@ -4422,11 +4430,6 @@ void Document::SetURL(const KURL& url) {
UpdateBaseURL();
GetContextFeatures().UrlDidChange(this);
- // TODO(crbug/795354): Move handling of URL recording out of the renderer.
- // URL must only be recorded from the main frame.
- if (ukm_recorder_ && IsInMainFrame())
- ukm_recorder_->UpdateSourceURL(ukm_source_id_, url_);
-
if (GetFrame()) {
if (FrameScheduler* frame_scheduler = GetFrame()->GetFrameScheduler())
frame_scheduler->TraceUrlChange(url_.GetString());
@@ -5220,33 +5223,33 @@ void Document::SendFocusNotification(Element* new_focused_element,
return;
bool is_editable = false;
- gfx::Rect element_bounds;
+ gfx::Rect element_bounds_in_dips;
if (new_focused_element) {
is_editable = IsEditableElement(*new_focused_element);
- WebRect rect;
+ IntRect bounds_in_viewport;
if (new_focused_element->IsSVGElement()) {
// Convert to window coordinate system (this will be in DIPs).
- rect = new_focused_element->BoundsInViewport();
+ bounds_in_viewport = new_focused_element->BoundsInViewport();
} else {
Vector<IntRect> outline_rects =
new_focused_element->OutlineRectsInVisualViewport(
DocumentUpdateReason::kFocus);
- IntRect union_rect;
for (auto& outline_rect : outline_rects)
- union_rect.Unite(outline_rect);
- rect = union_rect;
+ bounds_in_viewport.Unite(outline_rect);
}
if (GetFrame()->GetWidgetForLocalRoot()) {
- GetFrame()->GetWidgetForLocalRoot()->Client()->ConvertViewportToWindow(
- &rect);
+ element_bounds_in_dips =
+ GetFrame()->GetWidgetForLocalRoot()->BlinkSpaceToEnclosedDIPs(
+ bounds_in_viewport);
+ } else {
+ element_bounds_in_dips = bounds_in_viewport;
}
- element_bounds = gfx::Rect(rect);
}
GetFrame()->GetLocalFrameHostRemote().FocusedElementChanged(
- is_editable, element_bounds, focus_type);
+ is_editable, element_bounds_in_dips, focus_type);
}
void Document::NotifyFocusedElementChanged(Element* old_focused_element,
@@ -5412,7 +5415,7 @@ void Document::DidMoveTreeToNewDocument(const Node& root) {
for (Range* range : ranges)
range->UpdateOwnerDocumentIfNeeded();
}
- synchronous_mutation_observer_list_.ForEachObserver(
+ synchronous_mutation_observer_set_.ForEachObserver(
[&](SynchronousMutationObserver* observer) {
observer->DidMoveTreeToNewDocument(root);
});
@@ -5431,7 +5434,7 @@ void Document::NodeChildrenWillBeRemoved(ContainerNode& container) {
ni->NodeWillBeRemoved(n);
}
- synchronous_mutation_observer_list_.ForEachObserver(
+ synchronous_mutation_observer_set_.ForEachObserver(
[&](SynchronousMutationObserver* observer) {
observer->NodeChildrenWillBeRemoved(container);
});
@@ -5452,7 +5455,7 @@ void Document::NodeWillBeRemoved(Node& n) {
range->FixupRemovedNodeAcrossShadowBoundary(n);
}
- synchronous_mutation_observer_list_.ForEachObserver(
+ synchronous_mutation_observer_set_.ForEachObserver(
[&](SynchronousMutationObserver* observer) {
observer->NodeWillBeRemoved(n);
});
@@ -5468,7 +5471,7 @@ void Document::NotifyUpdateCharacterData(CharacterData* character_data,
unsigned offset,
unsigned old_length,
unsigned new_length) {
- synchronous_mutation_observer_list_.ForEachObserver(
+ synchronous_mutation_observer_set_.ForEachObserver(
[&](SynchronousMutationObserver* observer) {
observer->DidUpdateCharacterData(character_data, offset, old_length,
new_length);
@@ -5476,7 +5479,7 @@ void Document::NotifyUpdateCharacterData(CharacterData* character_data,
}
void Document::NotifyChangeChildren(const ContainerNode& container) {
- synchronous_mutation_observer_list_.ForEachObserver(
+ synchronous_mutation_observer_set_.ForEachObserver(
[&](SynchronousMutationObserver* observer) {
observer->DidChangeChildren(container);
});
@@ -5506,7 +5509,7 @@ void Document::DidMergeTextNodes(const Text& merged_node,
range->DidMergeTextNodes(node_to_be_removed_with_index, old_length);
}
- synchronous_mutation_observer_list_.ForEachObserver(
+ synchronous_mutation_observer_set_.ForEachObserver(
[&](SynchronousMutationObserver* observer) {
observer->DidMergeTextNodes(merged_node, node_to_be_removed_with_index,
old_length);
@@ -5519,7 +5522,7 @@ void Document::DidSplitTextNode(const Text& old_node) {
for (Range* range : ranges_)
range->DidSplitTextNode(old_node);
- synchronous_mutation_observer_list_.ForEachObserver(
+ synchronous_mutation_observer_set_.ForEachObserver(
[&](SynchronousMutationObserver* observer) {
observer->DidSplitTextNode(old_node);
});
@@ -5753,13 +5756,13 @@ void Document::WillChangeFrameOwnerProperties(
int margin_width,
int margin_height,
mojom::blink::ScrollbarMode scrollbar_mode,
- bool is_display_none) {
+ bool is_display_none,
+ ColorScheme color_scheme) {
DCHECK(GetFrame() && GetFrame()->Owner());
FrameOwner* owner = GetFrame()->Owner();
if (is_display_none != owner->IsDisplayNone())
DisplayNoneChangedForFrame();
-
// body() may become null as a result of modification event listeners, so we
// check before each call.
if (margin_width != owner->MarginWidth()) {
@@ -5779,6 +5782,7 @@ void Document::WillChangeFrameOwnerProperties(
mojom::blink::ScrollbarMode::kAlwaysOff);
View()->SetNeedsLayout();
}
+ GetStyleEngine().SetOwnerColorScheme(color_scheme);
}
String Document::cookie(ExceptionState& exception_state) const {
@@ -5920,6 +5924,26 @@ void Document::setDomain(const String& raw_domain,
return;
}
+ if (RuntimeEnabledFeatures::OriginIsolationHeaderEnabled(dom_window_) &&
+ dom_window_->GetAgent()->IsOriginIsolated()) {
+ AddConsoleMessage(MakeGarbageCollected<ConsoleMessage>(
+ mojom::blink::ConsoleMessageSource::kSecurity,
+ mojom::blink::ConsoleMessageLevel::kWarning,
+ "document.domain mutation is ignored because the surrounding agent "
+ "cluster is origin-isolated."));
+ return;
+ }
+
+ if (RuntimeEnabledFeatures::CrossOriginIsolationEnabled() &&
+ Agent::IsCrossOriginIsolated()) {
+ AddConsoleMessage(MakeGarbageCollected<ConsoleMessage>(
+ mojom::blink::ConsoleMessageSource::kSecurity,
+ mojom::blink::ConsoleMessageLevel::kWarning,
+ "document.domain mutation is ignored because the surrounding agent "
+ "cluster is cross-origin isolated."));
+ return;
+ }
+
if (GetFrame()) {
UseCounter::Count(*this,
dom_window_->GetSecurityOrigin()->Port() == 0
@@ -5965,7 +5989,7 @@ void Document::setDomain(const String& raw_domain,
child_local_frame->View()->CrossOriginToParentFrameChanged();
}
- GetFrame()->GetScriptController().UpdateSecurityOrigin(
+ dom_window_->GetScriptController().UpdateSecurityOrigin(
dom_window_->GetSecurityOrigin());
}
}
@@ -6294,6 +6318,40 @@ ScriptPromise Document::hasTrustToken(ScriptState* script_state,
return promise;
}
+mojom::blink::FlocService* Document::GetFlocService(
+ ExecutionContext* execution_context) {
+ if (!data_->floc_service_.is_bound()) {
+ execution_context->GetBrowserInterfaceBroker().GetInterface(
+ data_->floc_service_.BindNewPipeAndPassReceiver(
+ execution_context->GetTaskRunner(TaskType::kMiscPlatformAPI)));
+ }
+ return data_->floc_service_.get();
+}
+
+ScriptPromise Document::interestCohort(ScriptState* script_state) {
+ ScriptPromiseResolver* resolver =
+ MakeGarbageCollected<ScriptPromiseResolver>(script_state);
+
+ ScriptPromise promise = resolver->Promise();
+
+ GetFlocService(ExecutionContext::From(script_state))
+ ->GetInterestCohort(WTF::Bind(
+ [](ScriptPromiseResolver* resolver, Document* document,
+ const String& interest_cohort) {
+ DCHECK(resolver);
+ DCHECK(document);
+
+ if (interest_cohort.IsEmpty()) {
+ resolver->Reject();
+ } else {
+ resolver->Resolve(interest_cohort);
+ }
+ },
+ WrapPersistent(resolver), WrapPersistent(this)));
+
+ return promise;
+}
+
void Document::HasTrustTokensAnswererConnectionError() {
data_->has_trust_tokens_answerer_.reset();
for (const auto& resolver : data_->pending_has_trust_tokens_resolvers_) {
@@ -6910,9 +6968,6 @@ void Document::FinishedParsing() {
// yet to avoid adding extra latency. Note that the first layout tree update
// can be expensive since it triggers the parsing of the default stylesheets
// which are compiled-in.
- const bool main_resource_was_already_requested =
- frame->Loader().StateMachine()->CommittedFirstRealDocumentLoad();
-
// FrameLoader::finishedParsing() might end up calling
// Document::implicitClose() if all resource loads are
// complete. HTMLObjectElements can start loading their resources from post
@@ -6922,7 +6977,7 @@ void Document::FinishedParsing() {
// the window load event too early. To avoid this we force the styles to be
// up to date before calling FrameLoader::finishedParsing(). See
// https://bugs.webkit.org/show_bug.cgi?id=36864 starting around comment 35.
- if (main_resource_was_already_requested)
+ if (!is_initial_empty_document_)
UpdateStyleAndLayoutTree();
BeginLifecycleUpdatesIfRenderingReady();
@@ -7059,9 +7114,9 @@ void Document::ColorSchemeMetaChanged() {
return;
const CSSValue* color_scheme = nullptr;
- if (auto* head_element = head()) {
+ if (auto* root_element = documentElement()) {
for (HTMLMetaElement& meta_element :
- Traversal<HTMLMetaElement>::DescendantsOf(*head_element)) {
+ Traversal<HTMLMetaElement>::DescendantsOf(*root_element)) {
if (EqualIgnoringASCIICase(meta_element.GetName(), "color-scheme")) {
if ((color_scheme = CSSParser::ParseSingleValue(
CSSPropertyID::kColorScheme,
@@ -7137,7 +7192,7 @@ bool Document::AllowedToUseDynamicMarkUpInsertion(
return true;
}
if (!GetFrame() || GetExecutionContext()->IsFeatureEnabled(
- mojom::blink::FeaturePolicyFeature::kDocumentWrite,
+ mojom::blink::DocumentPolicyFeature::kDocumentWrite,
ReportOptions::kReportOnFailure)) {
return true;
}
@@ -7165,10 +7220,6 @@ ukm::UkmRecorder* Document::UkmRecorder() {
recorder.InitWithNewPipeAndPassReceiver());
ukm_recorder_ = std::make_unique<ukm::MojoUkmRecorder>(std::move(recorder));
- // TODO(crbug/795354): Move handling of URL recording out of the renderer.
- // URL must only be recorded from the main frame.
- if (IsInMainFrame())
- ukm_recorder_->UpdateSourceURL(ukm_source_id_, url_);
return ukm_recorder_.get();
}
@@ -7308,6 +7359,12 @@ Document::EnsureDocumentExplicitRootIntersectionObserverData() {
return *document_explicit_root_intersection_observer_data_;
}
+const ScriptRegexp& Document::EnsureEmailRegexp() const {
+ if (!data_->email_regexp_)
+ data_->email_regexp_ = EmailInputType::CreateEmailRegexp();
+ return *data_->email_regexp_;
+}
+
void Document::AddConsoleMessage(ConsoleMessage* message,
bool discard_duplicates) const {
// Don't let non-attached Documents spam the console.
@@ -8204,7 +8261,7 @@ void Document::Trace(Visitor* visitor) const {
visitor->Trace(computed_node_mapping_);
visitor->Trace(mime_handler_view_before_unload_event_listener_);
visitor->Trace(cookie_jar_);
- visitor->Trace(synchronous_mutation_observer_list_);
+ visitor->Trace(synchronous_mutation_observer_set_);
visitor->Trace(fragment_directive_);
visitor->Trace(element_explicitly_set_attr_elements_map_);
visitor->Trace(display_lock_document_state_);
@@ -8295,12 +8352,12 @@ void Document::IncrementNumberOfCanvases() {
}
void Document::ExecuteJavaScriptUrls() {
- DCHECK(GetFrame());
+ DCHECK(dom_window_);
Vector<PendingJavascriptUrl> urls_to_execute;
urls_to_execute.swap(pending_javascript_urls_);
for (auto& url_to_execute : urls_to_execute) {
- GetFrame()->GetScriptController().ExecuteJavaScriptURL(
+ dom_window_->GetScriptController().ExecuteJavaScriptURL(
url_to_execute.url, network::mojom::CSPDisposition::CHECK,
url_to_execute.world.get());
if (!GetFrame())
@@ -8313,7 +8370,7 @@ void Document::ProcessJavaScriptUrl(
const KURL& url,
scoped_refptr<const DOMWrapperWorld> world) {
DCHECK(url.ProtocolIsJavaScript());
- if (GetFrame()->Loader().StateMachine()->IsDisplayingInitialEmptyDocument())
+ if (is_initial_empty_document_)
load_event_progress_ = kLoadEventNotRun;
GetFrame()->Loader().Progress().ProgressStarted();
pending_javascript_urls_.push_back(PendingJavascriptUrl(url, world));
diff --git a/chromium/third_party/blink/renderer/core/dom/document.h b/chromium/third_party/blink/renderer/core/dom/document.h
index 1aeda1f7b65..37ae8c5c8d7 100644
--- a/chromium/third_party/blink/renderer/core/dom/document.h
+++ b/chromium/third_party/blink/renderer/core/dom/document.h
@@ -41,6 +41,7 @@
#include "services/network/public/mojom/web_sandbox_flags.mojom-blink-forward.h"
#include "third_party/blink/public/common/metrics/document_update_reason.h"
#include "third_party/blink/public/mojom/feature_policy/document_policy_feature.mojom-blink-forward.h"
+#include "third_party/blink/public/mojom/federated_learning/floc.mojom-blink-forward.h"
#include "third_party/blink/public/mojom/input/focus_type.mojom-blink-forward.h"
#include "third_party/blink/public/mojom/permissions/permission.mojom-blink-forward.h"
#include "third_party/blink/public/mojom/scroll/scrollbar_mode.mojom-blink-forward.h"
@@ -67,7 +68,7 @@
#include "third_party/blink/renderer/core/loader/font_preload_manager.h"
#include "third_party/blink/renderer/platform/bindings/dom_wrapper_world.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
-#include "third_party/blink/renderer/platform/heap_observer_list.h"
+#include "third_party/blink/renderer/platform/heap_observer_set.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cancellable_task.h"
#include "third_party/blink/renderer/platform/supplementable.h"
@@ -188,6 +189,7 @@ class Text;
class TrustedHTML;
class ScriptElementBase;
class ScriptPromise;
+class ScriptRegexp;
class ScriptRunner;
class ScriptableDocumentParser;
class ScriptedAnimationController;
@@ -241,7 +243,6 @@ enum DocumentClass {
kMediaDocumentClass = 1 << 4,
kSVGDocumentClass = 1 << 5,
kXMLDocumentClass = 1 << 6,
- kViewSourceDocumentClass = 1 << 7,
};
enum ShadowCascadeOrder {
@@ -318,6 +319,14 @@ class CORE_EXPORT Document : public ContainerNode,
using TreeScope::getElementById;
+ bool IsInitialEmptyDocument() const { return is_initial_empty_document_; }
+ // Sometimes we permit an initial empty document to cease to be the initial
+ // empty document. This is needed for cross-process navigations, where a new
+ // LocalFrame needs to be created but the conceptual frame might have had
+ // other Documents in a different process. document.open() also causes the
+ // document to cease to be the initial empty document.
+ void OverrideIsInitialEmptyDocument() { is_initial_empty_document_ = false; }
+
// Gets the associated LocalDOMWindow even if this Document is associated with
// an HTMLImportsController.
LocalDOMWindow* ExecutingWindow() const;
@@ -438,7 +447,7 @@ class CORE_EXPORT Document : public ContainerNode,
has_xml_declaration_ = has_xml_declaration ? 1 : 0;
}
- String visibilityState() const;
+ AtomicString visibilityState() const;
bool IsPageVisible() const;
bool hidden() const;
void DidChangeVisibilityState();
@@ -495,7 +504,9 @@ class CORE_EXPORT Document : public ContainerNode,
StyleResolver& GetStyleResolver() const;
bool IsViewSource() const { return is_view_source_; }
- void SetIsViewSource(bool);
+ void SetIsViewSource(bool is_view_source) {
+ is_view_source_ = is_view_source;
+ }
// WebXR DOM Overlay support, cf https://immersive-web.github.io/dom-overlays/
// True if there's an ongoing "immersive-ar" WebXR session with a DOM Overlay
@@ -588,7 +599,7 @@ class CORE_EXPORT Document : public ContainerNode,
void IncLayoutBlockCounter() { ++layout_blocks_counter_; }
void IncLayoutBlockCounterNG() { ++layout_blocks_counter_ng_; }
- scoped_refptr<const ComputedStyle> StyleForPage(int page_index);
+ scoped_refptr<const ComputedStyle> StyleForPage(uint32_t page_index);
// Ensures that location-based data will be valid for a given node.
//
@@ -602,13 +613,13 @@ class CORE_EXPORT Document : public ContainerNode,
DocumentUpdateReason reason);
// Returns true if page box (margin boxes and page borders) is visible.
- bool IsPageBoxVisible(int page_index);
+ bool IsPageBoxVisible(uint32_t page_index);
// Gets the description for the specified page. This includes preferred page
// size and margins in pixels, assuming 96 pixels per inch. The size and
// margins must be initialized to the default values that are used if auto is
// specified.
- void GetPageDescription(int page_index, WebPrintPageDescription*);
+ void GetPageDescription(uint32_t page_index, WebPrintPageDescription*);
ResourceFetcher* Fetcher() const { return fetcher_.Get(); }
@@ -978,6 +989,8 @@ class CORE_EXPORT Document : public ContainerNode,
ElementIntersectionObserverData&
EnsureDocumentExplicitRootIntersectionObserverData();
+ const ScriptRegexp& EnsureEmailRegexp() const;
+
// Returns the owning element in the parent document. Returns nullptr if
// this is the top level document or the owner is remote.
HTMLFrameOwnerElement* LocalOwner() const;
@@ -985,7 +998,8 @@ class CORE_EXPORT Document : public ContainerNode,
void WillChangeFrameOwnerProperties(int margin_width,
int margin_height,
mojom::blink::ScrollbarMode,
- bool is_display_none);
+ bool is_display_none,
+ ColorScheme color_scheme);
String title() const { return title_; }
void setTitle(const String&);
@@ -1052,6 +1066,17 @@ class CORE_EXPORT Document : public ContainerNode,
const String& issuer,
ExceptionState&);
+ // Floc service helper methods to facilitate querying the floc (i.e.
+ // interestCohort).
+ mojom::blink::FlocService* GetFlocService(
+ ExecutionContext* execution_context);
+
+ // Sends a query via Mojo to ask for the interest cohort. This can reject on
+ // permissions errors (e.g. cookies not allowed, etc.) or when the interest
+ // cohort is unavailable.
+ // https://github.com/jkarlin/floc
+ ScriptPromise interestCohort(ScriptState* script_state);
+
// The following implements the rule from HTML 4 for what valid names are.
// To get this right for all the XML cases, we probably have to improve this
// or move it and make it sensitive to the type of document.
@@ -1381,7 +1406,6 @@ class CORE_EXPORT Document : public ContainerNode,
void SetResizedForViewportUnits();
void ClearResizedForViewportUnits();
- void UpdateActiveStyle();
void InvalidateStyleAndLayoutForFontUpdates();
void Trace(Visitor*) const override;
@@ -1618,9 +1642,9 @@ class CORE_EXPORT Document : public ContainerNode,
void CancelPendingJavaScriptUrls();
- HeapObserverList<SynchronousMutationObserver>&
- SynchronousMutationObserverList() {
- return synchronous_mutation_observer_list_;
+ HeapObserverSet<SynchronousMutationObserver>&
+ SynchronousMutationObserverSet() {
+ return synchronous_mutation_observer_set_;
}
void NotifyUpdateCharacterData(CharacterData* character_data,
@@ -1787,6 +1811,8 @@ class CORE_EXPORT Document : public ContainerNode,
DocumentLifecycle lifecycle_;
+ bool is_initial_empty_document_;
+
bool evaluate_media_queries_on_style_recalc_;
// If we do ignore the pending stylesheet count, then we need to add a boolean
@@ -2150,8 +2176,8 @@ class CORE_EXPORT Document : public ContainerNode,
HeapHashMap<WeakMember<Element>, Member<ExplicitlySetAttrElementsMap>>
element_explicitly_set_attr_elements_map_;
- HeapObserverList<SynchronousMutationObserver>
- synchronous_mutation_observer_list_;
+ HeapObserverSet<SynchronousMutationObserver>
+ synchronous_mutation_observer_set_;
Member<DisplayLockDocumentState> display_lock_document_state_;
diff --git a/chromium/third_party/blink/renderer/core/dom/document.idl b/chromium/third_party/blink/renderer/core/dom/document.idl
index 6be58a36929..e20a55bb164 100644
--- a/chromium/third_party/blink/renderer/core/dom/document.idl
+++ b/chromium/third_party/blink/renderer/core/dom/document.idl
@@ -135,7 +135,7 @@ typedef (HTMLScriptElement or SVGScriptElement) HTMLOrSVGScriptElement;
[RaisesException] boolean queryCommandSupported(DOMString commandId);
[RaisesException] DOMString queryCommandValue(DOMString commandId);
- [LenientThis] attribute EventHandler onreadystatechange;
+ [LegacyLenientThis] attribute EventHandler onreadystatechange;
// HTML obsolete features
// https://html.spec.whatwg.org/C/#Document-partial
@@ -188,6 +188,10 @@ typedef (HTMLScriptElement or SVGScriptElement) HTMLOrSVGScriptElement;
[CallWith=ScriptState, NewObject, RuntimeEnabled=StorageAccessAPI, MeasureAs=StorageAccessAPI_HasStorageAccess_Method] Promise<boolean> hasStorageAccess();
[CallWith=ScriptState, NewObject, RuntimeEnabled=StorageAccessAPI, MeasureAs=StorageAccessAPI_requestStorageAccess_Method] Promise<void> requestStorageAccess();
+ // Interest Cohort API
+ // TODO(yaoxia): Add web tests. http://crbug/1130074.
+ [CallWith=ScriptState, NewObject, RuntimeEnabled=InterestCohortAPI, MeasureAs=InterestCohortAPI_interestCohort_Method] Promise<DOMString> interestCohort();
+
// Text fragment directive API
// https://wicg.github.io/scroll-to-text-fragment/#feature-detectability
[SameObject, Measure, RuntimeEnabled=TextFragmentIdentifiers] readonly attribute FragmentDirective fragmentDirective;
diff --git a/chromium/third_party/blink/renderer/core/dom/document_data.h b/chromium/third_party/blink/renderer/core/dom/document_data.h
index 9a51244e9bf..66aa59eb73a 100644
--- a/chromium/third_party/blink/renderer/core/dom/document_data.h
+++ b/chromium/third_party/blink/renderer/core/dom/document_data.h
@@ -6,7 +6,9 @@
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_DOCUMENT_DATA_H_
#include "services/network/public/mojom/trust_tokens.mojom-blink.h"
+#include "third_party/blink/public/mojom/federated_learning/floc.mojom-blink.h"
#include "third_party/blink/public/mojom/permissions/permission.mojom-blink.h"
+#include "third_party/blink/renderer/bindings/core/v8/script_regexp.h"
#include "third_party/blink/renderer/platform/mojo/heap_mojo_remote.h"
namespace blink {
@@ -19,13 +21,16 @@ namespace blink {
// Other instances should not have strong references to the DocumentData.
// Lifetime: A DocumentData instance is created on a Document creation, and
// is never destructed before the Document.
-class DocumentData : public GarbageCollected<DocumentData> {
+class DocumentData final : public GarbageCollected<DocumentData> {
public:
explicit DocumentData(ExecutionContext* context)
- : permission_service_(context), has_trust_tokens_answerer_(context) {}
+ : permission_service_(context),
+ floc_service_(context),
+ has_trust_tokens_answerer_(context) {}
void Trace(Visitor* visitor) const {
visitor->Trace(permission_service_);
+ visitor->Trace(floc_service_);
visitor->Trace(has_trust_tokens_answerer_);
visitor->Trace(pending_has_trust_tokens_resolvers_);
}
@@ -35,6 +40,9 @@ class DocumentData : public GarbageCollected<DocumentData> {
// storage or not.
HeapMojoRemote<mojom::blink::PermissionService> permission_service_;
+ // Mojo remote used to query the floc (i.e. interestCohort).
+ HeapMojoRemote<mojom::blink::FlocService> floc_service_;
+
// Mojo remote used to answer API calls asking whether the user has trust
// tokens (https://github.com/wicg/trust-token-api). The other endpoint
// is in the network service, which may crash and restart. To handle this:
@@ -51,6 +59,9 @@ class DocumentData : public GarbageCollected<DocumentData> {
HeapHashSet<Member<ScriptPromiseResolver>>
pending_has_trust_tokens_resolvers_;
+ // To do email regex checks.
+ std::unique_ptr<ScriptRegexp> email_regexp_;
+
friend class Document;
};
diff --git a/chromium/third_party/blink/renderer/core/dom/document_init.cc b/chromium/third_party/blink/renderer/core/dom/document_init.cc
index ba112d79de9..d49dc7cb85d 100644
--- a/chromium/third_party/blink/renderer/core/dom/document_init.cc
+++ b/chromium/third_party/blink/renderer/core/dom/document_init.cc
@@ -29,6 +29,7 @@
#include "third_party/blink/renderer/core/dom/document_init.h"
+#include "services/metrics/public/cpp/ukm_source_id.h"
#include "third_party/blink/public/mojom/security_context/insecure_request_policy.mojom-blink.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/dom_implementation.h"
@@ -105,6 +106,11 @@ DocumentInit& DocumentInit::WithWindow(LocalDOMWindow* window,
return *this;
}
+DocumentInit& DocumentInit::ForInitialEmptyDocument(bool empty) {
+ is_initial_empty_document_ = empty;
+ return *this;
+}
+
// static
DocumentInit::Type DocumentInit::ComputeDocumentType(
LocalFrame* frame,
@@ -249,6 +255,11 @@ DocumentInit& DocumentInit::WithWebBundleClaimedUrl(
return *this;
}
+DocumentInit& DocumentInit::WithUkmSourceId(ukm::SourceId ukm_source_id) {
+ ukm_source_id_ = ukm_source_id;
+ return *this;
+}
+
Document* DocumentInit::CreateDocument() const {
#if DCHECK_IS_ON()
DCHECK(execution_context_ || for_test_);
diff --git a/chromium/third_party/blink/renderer/core/dom/document_init.h b/chromium/third_party/blink/renderer/core/dom/document_init.h
index b314a75b765..4040390a7d1 100644
--- a/chromium/third_party/blink/renderer/core/dom/document_init.h
+++ b/chromium/third_party/blink/renderer/core/dom/document_init.h
@@ -30,6 +30,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_DOCUMENT_INIT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_DOCUMENT_INIT_H_
+#include "services/metrics/public/cpp/ukm_source_id.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/execution_context/security_context.h"
#include "third_party/blink/renderer/core/html/custom/v0_custom_element_registration_context.h"
@@ -105,6 +106,9 @@ class CORE_EXPORT DocumentInit final {
DocumentInit& WithWindow(LocalDOMWindow*, Document* owner_document);
LocalDOMWindow* GetWindow() const { return window_; }
+ DocumentInit& ForInitialEmptyDocument(bool empty);
+ bool IsInitialEmptyDocument() const { return is_initial_empty_document_; }
+
// Compute the type of document to be loaded inside a |frame|, given its |url|
// and its |mime_type|.
//
@@ -138,12 +142,16 @@ class CORE_EXPORT DocumentInit final {
DocumentInit& WithWebBundleClaimedUrl(const KURL& web_bundle_claimed_url);
const KURL& GetWebBundleClaimedUrl() const { return web_bundle_claimed_url_; }
+ DocumentInit& WithUkmSourceId(ukm::SourceId ukm_source_id);
+ ukm::SourceId UkmSourceId() const { return ukm_source_id_; }
+
private:
DocumentInit() = default;
static PluginData* GetPluginData(LocalFrame* frame, const KURL& url);
Type type_ = Type::kUnspecified;
+ bool is_initial_empty_document_ = false;
String mime_type_;
LocalDOMWindow* window_ = nullptr;
HTMLImportsController* imports_controller_ = nullptr;
@@ -163,6 +171,9 @@ class CORE_EXPORT DocumentInit final {
// computation in the document.
KURL web_bundle_claimed_url_;
+ // Source id to set on the Document to be created.
+ ukm::SourceId ukm_source_id_ = ukm::kInvalidSourceId;
+
bool is_for_external_handler_ = false;
#if DCHECK_IS_ON()
diff --git a/chromium/third_party/blink/renderer/core/dom/document_lifecycle.h b/chromium/third_party/blink/renderer/core/dom/document_lifecycle.h
index d878d9eb13d..0d58f5cd660 100644
--- a/chromium/third_party/blink/renderer/core/dom/document_lifecycle.h
+++ b/chromium/third_party/blink/renderer/core/dom/document_lifecycle.h
@@ -32,7 +32,6 @@
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_DOCUMENT_LIFECYCLE_H_
#include "base/auto_reset.h"
-#include "base/macros.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/assertions.h"
@@ -99,12 +98,13 @@ class CORE_EXPORT DocumentLifecycle {
public:
Scope(DocumentLifecycle&, LifecycleState final_state);
+ Scope(const Scope&) = delete;
+ Scope& operator=(const Scope&) = delete;
~Scope();
private:
DocumentLifecycle& lifecycle_;
LifecycleState final_state_;
- DISALLOW_COPY_AND_ASSIGN(Scope);
};
class DeprecatedTransition {
@@ -112,6 +112,8 @@ class CORE_EXPORT DocumentLifecycle {
public:
DeprecatedTransition(LifecycleState from, LifecycleState to);
+ DeprecatedTransition(const DeprecatedTransition&) = delete;
+ DeprecatedTransition& operator=(const DeprecatedTransition&) = delete;
~DeprecatedTransition();
LifecycleState From() const { return from_; }
@@ -121,7 +123,6 @@ class CORE_EXPORT DocumentLifecycle {
DeprecatedTransition* previous_;
LifecycleState from_;
LifecycleState to_;
- DISALLOW_COPY_AND_ASSIGN(DeprecatedTransition);
};
// Within this scope, state transitions are not allowed.
@@ -134,6 +135,8 @@ class CORE_EXPORT DocumentLifecycle {
: document_lifecycle_(document_lifecycle) {
document_lifecycle_.IncrementNoTransitionCount();
}
+ DisallowTransitionScope(const DisallowTransitionScope&) = delete;
+ DisallowTransitionScope& operator=(const DisallowTransitionScope&) = delete;
~DisallowTransitionScope() {
document_lifecycle_.DecrementNoTransitionCount();
@@ -141,7 +144,6 @@ class CORE_EXPORT DocumentLifecycle {
private:
DocumentLifecycle& document_lifecycle_;
- DISALLOW_COPY_AND_ASSIGN(DisallowTransitionScope);
};
class DetachScope {
@@ -152,12 +154,13 @@ class CORE_EXPORT DocumentLifecycle {
: document_lifecycle_(document_lifecycle) {
document_lifecycle_.IncrementDetachCount();
}
+ DetachScope(const DetachScope&) = delete;
+ DetachScope& operator=(const DetachScope&) = delete;
~DetachScope() { document_lifecycle_.DecrementDetachCount(); }
private:
DocumentLifecycle& document_lifecycle_;
- DISALLOW_COPY_AND_ASSIGN(DetachScope);
};
// Throttling is disabled by default. Instantiating this class allows
@@ -169,8 +172,9 @@ class CORE_EXPORT DocumentLifecycle {
public:
AllowThrottlingScope(DocumentLifecycle&);
+ AllowThrottlingScope(const AllowThrottlingScope&) = delete;
+ AllowThrottlingScope& operator=(const AllowThrottlingScope&) = delete;
~AllowThrottlingScope();
- DISALLOW_COPY_AND_ASSIGN(AllowThrottlingScope);
};
class CORE_EXPORT DisallowThrottlingScope {
@@ -178,11 +182,12 @@ class CORE_EXPORT DocumentLifecycle {
public:
DisallowThrottlingScope(DocumentLifecycle&);
+ DisallowThrottlingScope(const DisallowThrottlingScope&) = delete;
+ DisallowThrottlingScope& operator=(const DisallowThrottlingScope&) = delete;
~DisallowThrottlingScope();
private:
int saved_count_;
- DISALLOW_COPY_AND_ASSIGN(DisallowThrottlingScope);
};
// If we hit a devtool break point in the middle of document lifecycle, for
@@ -217,6 +222,8 @@ class CORE_EXPORT DocumentLifecycle {
};
DocumentLifecycle();
+ DocumentLifecycle(const DocumentLifecycle&) = delete;
+ DocumentLifecycle& operator=(const DocumentLifecycle&) = delete;
bool IsActive() const { return state_ > kInactive && state_ < kStopping; }
LifecycleState GetState() const { return state_; }
@@ -265,7 +272,6 @@ class CORE_EXPORT DocumentLifecycle {
int disallow_transition_count_;
bool life_cycle_postponed_;
bool check_no_transition_;
- DISALLOW_COPY_AND_ASSIGN(DocumentLifecycle);
};
inline bool DocumentLifecycle::StateAllowsTreeMutations() const {
diff --git a/chromium/third_party/blink/renderer/core/dom/document_or_shadow_root.idl b/chromium/third_party/blink/renderer/core/dom/document_or_shadow_root.idl
index 212bde8455e..a642d35f492 100644
--- a/chromium/third_party/blink/renderer/core/dom/document_or_shadow_root.idl
+++ b/chromium/third_party/blink/renderer/core/dom/document_or_shadow_root.idl
@@ -15,8 +15,8 @@
[RuntimeEnabled=WebAnimationsAPI, Measure] sequence<Animation> getAnimations();
// CSSOM View Module
// https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface
- Element? elementFromPoint(double x, double y);
- sequence<Element> elementsFromPoint(double x, double y);
+ [Measure] Element? elementFromPoint(double x, double y);
+ [Measure] sequence<Element> elementsFromPoint(double x, double y);
[Affects=Nothing] readonly attribute Element? activeElement;
[SameObject] readonly attribute StyleSheetList styleSheets;
// PointerLock API
@@ -24,6 +24,6 @@
readonly attribute Element? pointerLockElement;
// Fullscreen API
// https://fullscreen.spec.whatwg.org/
- [LenientSetter] readonly attribute Element? fullscreenElement;
+ [LegacyLenientSetter] readonly attribute Element? fullscreenElement;
[MeasureAs=AdoptedStyleSheets, RaisesException=Setter] attribute FrozenArray<CSSStyleSheet> adoptedStyleSheets;
};
diff --git a/chromium/third_party/blink/renderer/core/dom/document_parser_timing.h b/chromium/third_party/blink/renderer/core/dom/document_parser_timing.h
index 9791c0c903b..91a52511f3f 100644
--- a/chromium/third_party/blink/renderer/core/dom/document_parser_timing.h
+++ b/chromium/third_party/blink/renderer/core/dom/document_parser_timing.h
@@ -5,7 +5,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_DOCUMENT_PARSER_TIMING_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_DOCUMENT_PARSER_TIMING_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/supplementable.h"
@@ -21,6 +20,8 @@ class DocumentParserTiming final
static const char kSupplementName[];
explicit DocumentParserTiming(Document&);
+ DocumentParserTiming(const DocumentParserTiming&) = delete;
+ DocumentParserTiming& operator=(const DocumentParserTiming&) = delete;
virtual ~DocumentParserTiming() = default;
static DocumentParserTiming& From(Document&);
@@ -108,7 +109,6 @@ class DocumentParserTiming final
base::TimeDelta
parser_blocked_on_script_execution_from_document_write_duration_;
bool parser_detached_ = false;
- DISALLOW_COPY_AND_ASSIGN(DocumentParserTiming);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/document_test.cc b/chromium/third_party/blink/renderer/core/dom/document_test.cc
index 8366d621777..5a8b9ce090c 100644
--- a/chromium/third_party/blink/renderer/core/dom/document_test.cc
+++ b/chromium/third_party/blink/renderer/core/dom/document_test.cc
@@ -151,6 +151,10 @@ class TestSynchronousMutationObserver
};
explicit TestSynchronousMutationObserver(Document&);
+ TestSynchronousMutationObserver(const TestSynchronousMutationObserver&) =
+ delete;
+ TestSynchronousMutationObserver& operator=(
+ const TestSynchronousMutationObserver&) = delete;
virtual ~TestSynchronousMutationObserver() = default;
int CountContextDestroyedCalled() const {
@@ -211,8 +215,6 @@ class TestSynchronousMutationObserver
HeapVector<Member<Node>> removed_nodes_;
HeapVector<Member<const Text>> split_text_nodes_;
HeapVector<Member<UpdateCharacterDataRecord>> updated_character_data_records_;
-
- DISALLOW_COPY_AND_ASSIGN(TestSynchronousMutationObserver);
};
TestSynchronousMutationObserver::TestSynchronousMutationObserver(
diff --git a/chromium/third_party/blink/renderer/core/dom/dom_implementation.cc b/chromium/third_party/blink/renderer/core/dom/dom_implementation.cc
index 3df0b80189a..99fe3246a18 100644
--- a/chromium/third_party/blink/renderer/core/dom/dom_implementation.cc
+++ b/chromium/third_party/blink/renderer/core/dom/dom_implementation.cc
@@ -73,11 +73,8 @@ XMLDocument* DOMImplementation::createDocument(
const AtomicString& qualified_name,
DocumentType* doctype,
ExceptionState& exception_state) {
- ExecutionContext* context = document_->GetExecutionContext();
- if (!context)
- return nullptr;
-
XMLDocument* doc = nullptr;
+ ExecutionContext* context = document_->GetExecutionContext();
DocumentInit init = DocumentInit::Create().WithExecutionContext(context);
if (namespace_uri == svg_names::kNamespaceURI) {
doc = XMLDocument::CreateSVG(init);
@@ -107,8 +104,6 @@ XMLDocument* DOMImplementation::createDocument(
}
Document* DOMImplementation::createHTMLDocument(const String& title) {
- if (!document_->GetExecutionContext())
- return nullptr;
DocumentInit init =
DocumentInit::Create()
.WithExecutionContext(document_->GetExecutionContext())
diff --git a/chromium/third_party/blink/renderer/core/dom/dom_string_map.h b/chromium/third_party/blink/renderer/core/dom/dom_string_map.h
index 5ae98a1a827..1a95d1e20e8 100644
--- a/chromium/third_party/blink/renderer/core/dom/dom_string_map.h
+++ b/chromium/third_party/blink/renderer/core/dom/dom_string_map.h
@@ -26,7 +26,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_DOM_STRING_MAP_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_DOM_STRING_MAP_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
@@ -54,6 +53,8 @@ class DOMStringMap : public ScriptWrappable {
SetItem(name, value, exception_state);
return NamedPropertySetterResult::kIntercepted;
}
+ DOMStringMap(const DOMStringMap&) = delete;
+ DOMStringMap& operator=(const DOMStringMap&) = delete;
NamedPropertyDeleterResult AnonymousNamedDeleter(const AtomicString& name) {
return DeleteItem(name) ? NamedPropertyDeleterResult::kDeleted
: NamedPropertyDeleterResult::kDidNotIntercept;
@@ -65,7 +66,6 @@ class DOMStringMap : public ScriptWrappable {
protected:
DOMStringMap() = default;
- DISALLOW_COPY_AND_ASSIGN(DOMStringMap);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/dom_string_map.idl b/chromium/third_party/blink/renderer/core/dom/dom_string_map.idl
index 8f47e3ba021..d9842fc2ef2 100644
--- a/chromium/third_party/blink/renderer/core/dom/dom_string_map.idl
+++ b/chromium/third_party/blink/renderer/core/dom/dom_string_map.idl
@@ -26,7 +26,7 @@
// https://html.spec.whatwg.org/C/#the-domstringmap-interface
[
- OverrideBuiltins,
+ LegacyOverrideBuiltIns,
Exposed=Window
] interface DOMStringMap {
[ImplementedAs=item] getter DOMString (DOMString name);
diff --git a/chromium/third_party/blink/renderer/core/dom/dom_token_list.h b/chromium/third_party/blink/renderer/core/dom/dom_token_list.h
index eb73388ce2b..9b8e18ac510 100644
--- a/chromium/third_party/blink/renderer/core/dom/dom_token_list.h
+++ b/chromium/third_party/blink/renderer/core/dom/dom_token_list.h
@@ -25,7 +25,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_DOM_TOKEN_LIST_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_DOM_TOKEN_LIST_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/dom/qualified_name.h"
#include "third_party/blink/renderer/core/dom/space_split_string.h"
@@ -45,6 +44,8 @@ class CORE_EXPORT DOMTokenList : public ScriptWrappable {
public:
DOMTokenList(Element& element, const QualifiedName& attr)
: element_(element), attribute_name_(attr) {}
+ DOMTokenList(const DOMTokenList&) = delete;
+ DOMTokenList& operator=(const DOMTokenList&) = delete;
~DOMTokenList() override = default;
void Trace(Visitor*) const override;
@@ -91,7 +92,6 @@ class CORE_EXPORT DOMTokenList : public ScriptWrappable {
// |attribute_name_| is |g_null_name| in that case.
const QualifiedName attribute_name_;
bool is_in_update_step_ = false;
- DISALLOW_COPY_AND_ASSIGN(DOMTokenList);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/element.cc b/chromium/third_party/blink/renderer/core/dom/element.cc
index 4e763c6f372..45a7fe8fd7a 100644
--- a/chromium/third_party/blink/renderer/core/dom/element.cc
+++ b/chromium/third_party/blink/renderer/core/dom/element.cc
@@ -151,6 +151,7 @@
#include "third_party/blink/renderer/core/scroll/scrollbar_theme.h"
#include "third_party/blink/renderer/core/scroll/smooth_scroll_sequencer.h"
#include "third_party/blink/renderer/core/svg/svg_a_element.h"
+#include "third_party/blink/renderer/core/svg/svg_animated_href.h"
#include "third_party/blink/renderer/core/svg/svg_element.h"
#include "third_party/blink/renderer/core/svg_names.h"
#include "third_party/blink/renderer/core/trustedtypes/trusted_types_util.h"
@@ -181,33 +182,27 @@ class DisplayLockStyleScope {
explicit DisplayLockStyleScope(Element* element) : element_(element) {
// Note that we don't store context as a member of this scope, since it may
// get created as part of element self style recalc.
- auto* context = element->GetDisplayLockContext();
- should_update_self_ =
- !context || context->ShouldStyle(DisplayLockLifecycleTarget::kSelf);
}
~DisplayLockStyleScope() {
if (auto* context = element_->GetDisplayLockContext()) {
if (did_update_children_)
- context->DidStyle(DisplayLockLifecycleTarget::kChildren);
+ context->DidStyleChildren();
}
}
- bool ShouldUpdateSelfStyle() const { return should_update_self_; }
bool ShouldUpdateChildStyle() const {
// We can't calculate this on construction time, because the element's lock
// state may changes after self-style calculation ShouldStyle(children).
auto* context = element_->GetDisplayLockContext();
- return !context ||
- context->ShouldStyle(DisplayLockLifecycleTarget::kChildren);
+ return !context || context->ShouldStyleChildren();
}
void DidUpdateChildStyle() { did_update_children_ = true; }
// Returns true if the element was force unlocked due to missing requirements.
bool DidUpdateSelfStyle() {
- DCHECK(should_update_self_);
if (auto* context = element_->GetDisplayLockContext()) {
bool was_locked = context->IsLocked();
- context->DidStyle(DisplayLockLifecycleTarget::kSelf);
+ context->DidStyleSelf();
return was_locked && !context->IsLocked();
}
return false;
@@ -231,7 +226,6 @@ class DisplayLockStyleScope {
private:
Element* element_;
- bool should_update_self_ = false;
bool did_update_children_ = false;
};
@@ -304,7 +298,7 @@ bool DefinitelyNewFormattingContext(const Node& node,
if (!IsA<HTMLDetailsElement>(node) && !IsA<HTMLSummaryElement>(node))
return true;
}
- if (!style.IsOverflowVisible())
+ if (style.IsScrollContainer())
return node.GetDocument().ViewportDefiningElement() != &node;
if (style.HasOutOfFlowPosition() ||
(style.IsFloating() && !style.IsFlexOrGridItem()) ||
@@ -330,6 +324,12 @@ bool DefinitelyNewFormattingContext(const Node& node,
element->IsFrameOwnerElement()) {
return true;
}
+
+ // foreignObject is absolutely-positioned for the purposes of CSS layout and
+ // so always establishes a new formatting context.
+ // https://svgwg.org/svg2-draft/embedded.html#Placement
+ if (IsA<SVGForeignObjectElement>(element))
+ return true;
}
if (const Node* parent = LayoutTreeBuilderTraversal::LayoutParent(node))
return parent->ComputedStyleRef().IsDisplayFlexibleOrGridBox();
@@ -340,8 +340,7 @@ bool CalculateStyleShouldForceLegacyLayout(const Element& element,
const ComputedStyle& style) {
Document& document = element.GetDocument();
- if (style.Display() == EDisplay::kLayoutCustom ||
- style.Display() == EDisplay::kInlineLayoutCustom)
+ if (style.DisplayTypeRequiresLayoutNG())
return false;
// TODO(layout-dev): Once LayoutNG handles inline content editable, we
@@ -355,8 +354,7 @@ bool CalculateStyleShouldForceLegacyLayout(const Element& element,
}
if (style.IsDeprecatedWebkitBox() &&
- (!style.IsDeprecatedWebkitBoxWithVerticalLineClamp() ||
- !RuntimeEnabledFeatures::BlockFlowHandlesWebkitLineClampEnabled())) {
+ !style.IsDeprecatedWebkitBoxWithVerticalLineClamp()) {
UseCounter::Count(
document, WebFeature::kLegacyLayoutByWebkitBoxWithoutVerticalLineClamp);
return true;
@@ -657,6 +655,13 @@ Node* Element::Clone(Document& factory, CloneChildrenFlag flag) const {
// set copy’s shadow root’s "is declarative shadow root" property to true.
cloned_shadow_root.SetIsDeclarativeShadowRoot(
shadow_root->IsDeclarativeShadowRoot());
+
+ // 7.NEW If node’s shadow root’s "is available to element internals" is
+ // true, then set copy’s shadow root’s "is available to element internals"
+ // property to true.
+ cloned_shadow_root.SetAvailableToElementInternals(
+ shadow_root->IsAvailableToElementInternals());
+
// 7.3 If the clone children flag is set, clone all the children of node’s
// shadow root and append them to copy’s shadow root, with document as
// specified, the clone children flag being set, and the clone shadows
@@ -1284,11 +1289,15 @@ int Element::clientWidth() {
GetDocument().UpdateStyleAndLayoutForNode(
this, DocumentUpdateReason::kJavaScript);
}
- if (GetDocument().GetPage()->GetSettings().GetForceZeroLayoutHeight())
+ if (GetDocument().GetPage()->GetSettings().GetForceZeroLayoutHeight()) {
+ // TODO(sky): deal with OverflowClipRect() being infinite along an
+ // axis (because of overflow: clip and overflow:visible along the
+ // opposite axis).
return AdjustForAbsoluteZoom::AdjustLayoutUnit(
layout_view->OverflowClipRect(PhysicalOffset()).Width(),
layout_view->StyleRef())
.Round();
+ }
return AdjustForAbsoluteZoom::AdjustLayoutUnit(
LayoutUnit(layout_view->GetLayoutSize().Width()),
layout_view->StyleRef())
@@ -1326,11 +1335,15 @@ int Element::clientHeight() {
GetDocument().UpdateStyleAndLayoutForNode(
this, DocumentUpdateReason::kJavaScript);
}
- if (GetDocument().GetPage()->GetSettings().GetForceZeroLayoutHeight())
+ if (GetDocument().GetPage()->GetSettings().GetForceZeroLayoutHeight()) {
+ // TODO(sky): deal with OverflowClipRect() being infinite along an
+ // axis (because of overflow: clip and overflow:visible along the
+ // opposite axis).
return AdjustForAbsoluteZoom::AdjustLayoutUnit(
layout_view->OverflowClipRect(PhysicalOffset()).Height(),
layout_view->StyleRef())
.Round();
+ }
return AdjustForAbsoluteZoom::AdjustLayoutUnit(
LayoutUnit(layout_view->GetLayoutSize().Height()),
layout_view->StyleRef())
@@ -1351,11 +1364,13 @@ int Element::clientHeight() {
return 0;
}
-PaintLayerScrollableArea* Element::GetScrollableArea() const {
+LayoutBox* Element::GetLayoutBoxForScrolling() const {
LayoutBox* box = GetLayoutBox();
- if (!box || !box->HasOverflowClip())
+ if (!box || (!box->IsScrollContainer() &&
+ !box->StyleRef().IsScrollbarGutterForce())) {
return nullptr;
- return box->GetScrollableArea();
+ }
+ return box;
}
double Element::scrollLeft() {
@@ -1371,7 +1386,10 @@ double Element::scrollLeft() {
return 0;
}
- if (PaintLayerScrollableArea* scrollable_area = GetScrollableArea()) {
+ LayoutBox* box = GetLayoutBoxForScrolling();
+ if (!box)
+ return 0;
+ if (PaintLayerScrollableArea* scrollable_area = box->GetScrollableArea()) {
DCHECK(GetLayoutBox());
if (HasLeftwardDirection(*this)) {
@@ -1409,7 +1427,10 @@ double Element::scrollTop() {
return 0;
}
- if (PaintLayerScrollableArea* scrollable_area = GetScrollableArea()) {
+ LayoutBox* box = GetLayoutBoxForScrolling();
+ if (!box)
+ return 0;
+ if (PaintLayerScrollableArea* scrollable_area = box->GetScrollableArea()) {
DCHECK(GetLayoutBox());
if (HasUpwardDirection(*this)) {
@@ -1449,10 +1470,13 @@ void Element::setScrollLeft(double new_left) {
options->setLeft(new_left);
window->scrollTo(options);
}
- } else if (PaintLayerScrollableArea* scrollable_area = GetScrollableArea()) {
- LayoutBox* box = GetLayoutBox();
- DCHECK(box);
+ return;
+ }
+ LayoutBox* box = GetLayoutBoxForScrolling();
+ if (!box)
+ return;
+ if (PaintLayerScrollableArea* scrollable_area = box->GetScrollableArea()) {
if (HasLeftwardDirection(*this)) {
UseCounter::Count(
GetDocument(),
@@ -1516,10 +1540,13 @@ void Element::setScrollTop(double new_top) {
options->setTop(new_top);
window->scrollTo(options);
}
- } else if (PaintLayerScrollableArea* scrollable_area = GetScrollableArea()) {
- LayoutBox* box = GetLayoutBox();
- DCHECK(box);
+ return;
+ }
+ LayoutBox* box = GetLayoutBoxForScrolling();
+ if (!box)
+ return;
+ if (PaintLayerScrollableArea* scrollable_area = box->GetScrollableArea()) {
if (HasUpwardDirection(*this)) {
UseCounter::Count(
GetDocument(),
@@ -1675,8 +1702,10 @@ void Element::ScrollLayoutBoxBy(const ScrollToOptions* scroll_to_options) {
mojom::blink::ScrollBehavior::kAuto;
ScrollableArea::ScrollBehaviorFromString(scroll_to_options->behavior(),
scroll_behavior);
- if (PaintLayerScrollableArea* scrollable_area = GetScrollableArea()) {
- LayoutBox* box = GetLayoutBox();
+ LayoutBox* box = GetLayoutBoxForScrolling();
+ if (!box)
+ return;
+ if (PaintLayerScrollableArea* scrollable_area = box->GetScrollableArea()) {
DCHECK(box);
gfx::ScrollOffset current_position(scrollable_area->ScrollPosition().X(),
scrollable_area->ScrollPosition().Y());
@@ -1701,9 +1730,10 @@ void Element::ScrollLayoutBoxTo(const ScrollToOptions* scroll_to_options) {
ScrollableArea::ScrollBehaviorFromString(scroll_to_options->behavior(),
scroll_behavior);
- if (PaintLayerScrollableArea* scrollable_area = GetScrollableArea()) {
- LayoutBox* box = GetLayoutBox();
- DCHECK(box);
+ LayoutBox* box = GetLayoutBoxForScrolling();
+ if (!box)
+ return;
+ if (PaintLayerScrollableArea* scrollable_area = box->GetScrollableArea()) {
if (scroll_to_options->hasLeft() && HasLeftwardDirection(*this)) {
UseCounter::Count(
GetDocument(),
@@ -2041,9 +2071,14 @@ DOMRect* Element::getBoundingClientRect() {
const AtomicString& Element::computedRole() {
Document& document = GetDocument();
- if (!document.IsActive())
+ if (!document.IsActive() || !document.View())
return g_null_atom;
- document.UpdateStyleAndLayoutForNode(this, DocumentUpdateReason::kJavaScript);
+ if (document.NeedsLayoutTreeUpdate() || document.View()->NeedsLayout() ||
+ document.Lifecycle().GetState() <
+ DocumentLifecycle::kCompositingAssignmentsClean) {
+ document.View()->UpdateLifecycleToCompositingCleanPlusScrolling(
+ DocumentUpdateReason::kJavaScript);
+ }
UpdateDistributionForFlatTreeTraversal();
AXContext ax_context(document);
return ax_context.GetAXObjectCache().ComputedRoleForNode(this);
@@ -2051,9 +2086,14 @@ const AtomicString& Element::computedRole() {
String Element::computedName() {
Document& document = GetDocument();
- if (!document.IsActive())
+ if (!document.IsActive() || !document.View())
return String();
- document.UpdateStyleAndLayoutForNode(this, DocumentUpdateReason::kJavaScript);
+ if (document.NeedsLayoutTreeUpdate() || document.View()->NeedsLayout() ||
+ document.Lifecycle().GetState() <
+ DocumentLifecycle::kCompositingAssignmentsClean) {
+ document.View()->UpdateLifecycleToCompositingCleanPlusScrolling(
+ DocumentUpdateReason::kJavaScript);
+ }
UpdateDistributionForFlatTreeTraversal();
AXContext ax_context(document);
return ax_context.GetAXObjectCache().ComputedNameForNode(this);
@@ -2653,10 +2693,7 @@ void Element::AttachLayoutTree(AttachContext& context) {
LayoutObject* layout_object = nullptr;
if (CanParticipateInFlatTree()) {
if (being_rendered) {
- // If an element requires forced legacy layout, all descendants need it
- // too.
- if (ShouldForceLegacyLayout())
- children_context.force_legacy_layout = true;
+ AdjustForceLegacyLayout(style, &children_context.force_legacy_layout);
LegacyLayout legacy = children_context.force_legacy_layout
? LegacyLayout::kForce
: LegacyLayout::kAuto;
@@ -2823,16 +2860,6 @@ void Element::RecalcStyle(const StyleRecalcChange change) {
DCHECK(!GetDocument().Lifecycle().InDetach());
DisplayLockStyleScope display_lock_style_scope(this);
- if (!display_lock_style_scope.ShouldUpdateSelfStyle()) {
- display_lock_style_scope.NotifyUpdateWasBlocked(
- change.RecalcChildren()
- ? (change.RecalcDescendants()
- ? DisplayLockContext::kStyleUpdateDescendants
- : DisplayLockContext::kStyleUpdateChildren)
- : DisplayLockContext::kStyleUpdateSelf);
- return;
- }
-
if (HasCustomStyleCallbacks())
WillRecalcStyle(change);
@@ -3109,7 +3136,6 @@ StyleRecalcChange Element::RecalcOwnStyle(const StyleRecalcChange change) {
void Element::RebuildLayoutTree(WhitespaceAttacher& whitespace_attacher) {
DCHECK(InActiveDocument());
DCHECK(parentNode());
- DCHECK(!StyleRecalcBlockedByDisplayLock(DisplayLockLifecycleTarget::kSelf));
if (NeedsReattachLayoutTree()) {
AttachContext reattach_context;
@@ -3120,8 +3146,7 @@ void Element::RebuildLayoutTree(WhitespaceAttacher& whitespace_attacher) {
ReattachLayoutTree(reattach_context);
whitespace_attacher.DidReattachElement(this,
reattach_context.previous_in_flow);
- } else if (!StyleRecalcBlockedByDisplayLock(
- DisplayLockLifecycleTarget::kChildren)) {
+ } else if (!ChildStyleRecalcBlockedByDisplayLock()) {
// TODO(crbug.com/972752): Make the condition above a DCHECK instead when
// style recalc and dirty bit propagation uses flat-tree traversal.
// We create a local WhitespaceAttacher when rebuilding children of an
@@ -3155,13 +3180,10 @@ void Element::RebuildLayoutTree(WhitespaceAttacher& whitespace_attacher) {
ClearChildNeedsReattachLayoutTree();
}
DCHECK(!NeedsStyleRecalc());
- DCHECK(
- !ChildNeedsStyleRecalc() ||
- StyleRecalcBlockedByDisplayLock(DisplayLockLifecycleTarget::kChildren));
+ DCHECK(!ChildNeedsStyleRecalc() || ChildStyleRecalcBlockedByDisplayLock());
DCHECK(!NeedsReattachLayoutTree());
- DCHECK(
- !ChildNeedsReattachLayoutTree() ||
- StyleRecalcBlockedByDisplayLock(DisplayLockLifecycleTarget::kChildren));
+ DCHECK(!ChildNeedsReattachLayoutTree() ||
+ ChildStyleRecalcBlockedByDisplayLock());
}
void Element::RebuildShadowRootLayoutTree(
@@ -3384,6 +3406,10 @@ ElementInternals& Element::EnsureElementInternals() {
return EnsureElementRareData().EnsureElementInternals(To<HTMLElement>(*this));
}
+const ElementInternals* Element::GetElementInternals() const {
+ return HasRareData() ? GetElementRareData()->GetElementInternals() : nullptr;
+}
+
ShadowRoot* Element::createShadowRoot(ExceptionState& exception_state) {
DCHECK(RuntimeEnabledFeatures::ShadowDOMV0Enabled(GetExecutionContext()));
if (ShadowRoot* root = GetShadowRoot()) {
@@ -3542,6 +3568,10 @@ void Element::AttachDeclarativeShadowRoot(HTMLTemplateElement* template_element,
// 13.1. Set declarative shadow host element's shadow host's "is declarative
// shadow root" property to true.
shadow_root.SetIsDeclarativeShadowRoot(true);
+ // 13.NEW. Set declarative shadow host element's shadow host's "available
+ // to element internals" to true.
+ shadow_root.SetAvailableToElementInternals(true);
+
// 13.2. Append the declarative template element's DocumentFragment to the
// newly-created shadow root.
shadow_root.appendChild(template_element->DeclarativeShadowContent());
@@ -3585,6 +3615,15 @@ ShadowRoot& Element::AttachShadowRootInternal(
FocusDelegation::kDelegateFocus);
// 8. Set shadow’s "is declarative shadow root" property to false.
shadow_root.SetIsDeclarativeShadowRoot(false);
+
+ // NEW. If shadow host is a custom element, and if custom element state is
+ // not "precustomized" or "custom", set shadow root's
+ // IsAvailableToElementInternals flag to false. Otherwise, set it to true.
+ shadow_root.SetAvailableToElementInternals(
+ !(IsCustomElement() &&
+ GetCustomElementState() != CustomElementState::kCustom &&
+ GetCustomElementState() != CustomElementState::kPreCustomized));
+
shadow_root.SetSlotAssignmentMode(slot_assignment_mode);
return shadow_root;
}
@@ -4301,8 +4340,7 @@ void Element::ForceLegacyLayoutInFormattingContext(
style->IsDisplayTableType();
}
if (needs_traverse_to_table) {
- EDisplay display = style->Display();
- if (display == EDisplay::kTable || display == EDisplay::kInlineTable)
+ if (style->IsDisplayTableBox())
needs_traverse_to_table = false;
}
ancestor->SetShouldForceLegacyLayoutForChild(true);
@@ -4538,6 +4576,20 @@ void Element::HideNonce() {
}
}
+void Element::AdjustForceLegacyLayout(const ComputedStyle* style,
+ bool* should_force_legacy_layout) {
+ // If an element requires forced legacy layout, all descendants need it too
+ // (but see below):
+ if (ShouldForceLegacyLayout())
+ *should_force_legacy_layout = true;
+
+ // However, any forcing of legacy layout, by this element, or by an acestor,
+ // must be reset here, if the legacy layout engine doesn't support the display
+ // type.
+ if (style && style->DisplayTypeRequiresLayoutNG())
+ *should_force_legacy_layout = false;
+}
+
ElementIntersectionObserverData* Element::IntersectionObserverData() const {
if (HasRareData())
return GetElementRareData()->IntersectionObserverData();
@@ -5887,6 +5939,13 @@ void Element::ClearMutableInlineStyleIfEmpty() {
}
}
+void Element::NotifyInlineStyleMutation() {
+ if (GetLayoutObject() && GetLayoutObject()->PreviousVisibilityVisible() &&
+ GetDocument().GetPage()) {
+ GetDocument().GetPage()->Animator().SetHasInlineStyleMutation();
+ }
+}
+
inline void Element::SetInlineStyleFromString(
const AtomicString& new_style_string) {
DCHECK(IsStyledElement());
@@ -6203,10 +6262,9 @@ const NamesMap* Element::PartNamesMap() const {
return HasRareData() ? GetElementRareData()->PartNamesMap() : nullptr;
}
-bool Element::StyleRecalcBlockedByDisplayLock(
- DisplayLockLifecycleTarget target) const {
+bool Element::ChildStyleRecalcBlockedByDisplayLock() const {
auto* context = GetDisplayLockContext();
- return context && !context->ShouldStyle(target);
+ return context && !context->ShouldStyleChildren();
}
void Element::SetHovered(bool hovered) {
@@ -6228,8 +6286,7 @@ void Element::SetHovered(bool hovered) {
if (ChildrenOrSiblingsAffectedByHover())
PseudoStateChanged(CSSSelector::kPseudoHover);
- if (LayoutObject* layout_object = GetLayoutObject())
- layout_object->InvalidateIfControlStateChanged(kHoverControlState);
+ InvalidateIfHasEffectiveAppearance();
}
void Element::SetActive(bool active) {
@@ -6263,7 +6320,8 @@ void Element::SetActive(bool active) {
if (ChildrenOrSiblingsAffectedByActive())
PseudoStateChanged(CSSSelector::kPseudoActive);
- GetLayoutObject()->InvalidateIfControlStateChanged(kPressedControlState);
+ if (!IsDisabledFormControl())
+ InvalidateIfHasEffectiveAppearance();
}
void Element::InvalidateStyleAttribute() {
diff --git a/chromium/third_party/blink/renderer/core/dom/element.h b/chromium/third_party/blink/renderer/core/dom/element.h
index 7d6143bec8d..39d31f21186 100644
--- a/chromium/third_party/blink/renderer/core/dom/element.h
+++ b/chromium/third_party/blink/renderer/core/dom/element.h
@@ -73,7 +73,6 @@ class InputDeviceCapabilities;
class Locale;
class MutableCSSPropertyValueSet;
class NamedNodeMap;
-class PaintLayerScrollableArea;
class PointerLockOptions;
class PseudoElement;
class PseudoElementStyleRequest;
@@ -93,7 +92,6 @@ class V0CustomElementDefinition;
enum class CSSPropertyID;
enum class CSSValueID;
enum class DisplayLockActivationReason;
-enum class DisplayLockLifecycleTarget;
enum class DocumentUpdateReason;
struct FocusParams;
@@ -325,9 +323,7 @@ class CORE_EXPORT Element : public ContainerNode, public Animatable {
void scrollBy(const ScrollToOptions*);
void scrollTo(double x, double y);
void scrollTo(const ScrollToOptions*);
- // This will return the |GetScrollableArea| of correspond LayoutBox. For
- // LayoutTextControlSingleLine, it will return its |InnerEditorElement|'s.
- virtual PaintLayerScrollableArea* GetScrollableArea() const;
+ LayoutBox* GetLayoutBoxForScrolling() const override;
IntRect BoundsInViewport() const;
// Returns an intersection rectangle of the bounds rectangle and the visual
@@ -802,7 +798,8 @@ class CORE_EXPORT Element : public ContainerNode, public Animatable {
// descendants. Note that even if this element returns true, it's not implied
// that all descendants will return the same. Once an element needs to force
// legacy layout, though, the layout engine knows that it will have to perform
- // legacy layout on the entire subtree.
+ // legacy layout on the entire subtree, unless this is overridden by
+ // ShouldForceNGLayout().
bool ShouldForceLegacyLayout() const {
if (TypeShouldForceLegacyLayout())
return true;
@@ -824,6 +821,7 @@ class CORE_EXPORT Element : public ContainerNode, public Animatable {
void SetDidAttachInternals();
bool DidAttachInternals() const;
ElementInternals& EnsureElementInternals();
+ const ElementInternals* GetElementInternals() const;
bool ContainsFullScreenElement() const {
return HasElementFlag(ElementFlags::kContainsFullScreenElement);
@@ -916,7 +914,7 @@ class CORE_EXPORT Element : public ContainerNode, public Animatable {
DisplayLockContext* GetDisplayLockContext() const;
DisplayLockContext& EnsureDisplayLockContext();
- bool StyleRecalcBlockedByDisplayLock(DisplayLockLifecycleTarget) const;
+ bool ChildStyleRecalcBlockedByDisplayLock() const;
// Activates all activatable (for a given reason) locked ancestors for this
// element. Return true if we activated at least one previously locked
@@ -930,6 +928,8 @@ class CORE_EXPORT Element : public ContainerNode, public Animatable {
// been determined to be from an ad. Returns false by default.
virtual bool IsAdRelated() const { return false; }
+ void NotifyInlineStyleMutation();
+
protected:
const ElementData* GetElementData() const { return element_data_.Get(); }
UniqueElementData& EnsureUniqueElementData();
@@ -1000,6 +1000,12 @@ class CORE_EXPORT Element : public ContainerNode, public Animatable {
// are met.
void HideNonce();
+ // Adjust the state of legacy layout forcing for this element (and its
+ // subtree). Input is the state inherited from the parent element. Output will
+ // be modified if required by this element.
+ void AdjustForceLegacyLayout(const ComputedStyle*,
+ bool* should_force_legacy_layout);
+
private:
friend class AXObject;
diff --git a/chromium/third_party/blink/renderer/core/dom/element_rare_data.h b/chromium/third_party/blink/renderer/core/dom/element_rare_data.h
index 21c5a80acac..24cdeb92ac3 100644
--- a/chromium/third_party/blink/renderer/core/dom/element_rare_data.h
+++ b/chromium/third_party/blink/renderer/core/dom/element_rare_data.h
@@ -144,6 +144,9 @@ class ElementRareData : public NodeRareData {
void SetDidAttachInternals() { did_attach_internals_ = true; }
bool DidAttachInternals() const { return did_attach_internals_; }
ElementInternals& EnsureElementInternals(HTMLElement& target);
+ const ElementInternals* GetElementInternals() const {
+ return element_internals_;
+ }
void SetStyleShouldForceLegacyLayout(bool force) {
style_should_force_legacy_layout_ = force;
diff --git a/chromium/third_party/blink/renderer/core/dom/events/event_dispatch_forbidden_scope.h b/chromium/third_party/blink/renderer/core/dom/events/event_dispatch_forbidden_scope.h
index b67041a3a34..f87c50143f0 100644
--- a/chromium/third_party/blink/renderer/core/dom/events/event_dispatch_forbidden_scope.h
+++ b/chromium/third_party/blink/renderer/core/dom/events/event_dispatch_forbidden_scope.h
@@ -6,7 +6,6 @@
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_EVENT_DISPATCH_FORBIDDEN_SCOPE_H_
#include "base/auto_reset.h"
-#include "base/macros.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
#include "third_party/blink/renderer/platform/wtf/assertions.h"
@@ -18,13 +17,15 @@ namespace blink {
class EventDispatchForbiddenScope {
STACK_ALLOCATED();
- DISALLOW_COPY_AND_ASSIGN(EventDispatchForbiddenScope);
public:
EventDispatchForbiddenScope() {
DCHECK(IsMainThread());
++count_;
}
+ EventDispatchForbiddenScope(const EventDispatchForbiddenScope&) = delete;
+ EventDispatchForbiddenScope& operator=(const EventDispatchForbiddenScope&) =
+ delete;
~EventDispatchForbiddenScope() {
DCHECK(IsMainThread());
@@ -57,10 +58,12 @@ class EventDispatchForbiddenScope {
class EventDispatchForbiddenScope {
STACK_ALLOCATED();
- DISALLOW_COPY_AND_ASSIGN(EventDispatchForbiddenScope);
public:
EventDispatchForbiddenScope() {}
+ EventDispatchForbiddenScope(const EventDispatchForbiddenScope&) = delete;
+ EventDispatchForbiddenScope& operator=(const EventDispatchForbiddenScope&) =
+ delete;
class AllowUserAgentEvents {
public:
diff --git a/chromium/third_party/blink/renderer/core/dom/events/event_listener.h b/chromium/third_party/blink/renderer/core/dom/events/event_listener.h
index 6235bc2b4cf..be9514501b5 100644
--- a/chromium/third_party/blink/renderer/core/dom/events/event_listener.h
+++ b/chromium/third_party/blink/renderer/core/dom/events/event_listener.h
@@ -21,7 +21,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_EVENT_LISTENER_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_EVENT_LISTENER_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/probe/async_task_id.h"
#include "third_party/blink/renderer/platform/bindings/name_client.h"
@@ -47,6 +46,8 @@ class ExecutionContext;
class CORE_EXPORT EventListener : public GarbageCollected<EventListener>,
public NameClient {
public:
+ EventListener(const EventListener&) = delete;
+ EventListener& operator=(const EventListener&) = delete;
virtual ~EventListener() = default;
// Invokes this event listener.
@@ -94,8 +95,6 @@ class CORE_EXPORT EventListener : public GarbageCollected<EventListener>,
// subclasses must inherit from either of them.
friend class JSBasedEventListener;
friend class NativeEventListener;
-
- DISALLOW_COPY_AND_ASSIGN(EventListener);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/events/event_listener_map.h b/chromium/third_party/blink/renderer/core/dom/events/event_listener_map.h
index bdccfd2e1bd..44002b91311 100644
--- a/chromium/third_party/blink/renderer/core/dom/events/event_listener_map.h
+++ b/chromium/third_party/blink/renderer/core/dom/events/event_listener_map.h
@@ -33,7 +33,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_EVENT_LISTENER_MAP_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_EVENT_LISTENER_MAP_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/dom/events/registered_event_listener.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string_hash.h"
@@ -50,6 +49,8 @@ class CORE_EXPORT EventListenerMap final {
public:
EventListenerMap();
+ EventListenerMap(const EventListenerMap&) = delete;
+ EventListenerMap& operator=(const EventListenerMap&) = delete;
bool IsEmpty() const { return entries_.IsEmpty(); }
bool Contains(const AtomicString& event_type) const;
@@ -87,7 +88,6 @@ class CORE_EXPORT EventListenerMap final {
#if DCHECK_IS_ON()
int active_iterator_count_ = 0;
#endif
- DISALLOW_COPY_AND_ASSIGN(EventListenerMap);
};
#if !DCHECK_IS_ON()
diff --git a/chromium/third_party/blink/renderer/core/dom/events/event_path.h b/chromium/third_party/blink/renderer/core/dom/events/event_path.h
index 691512e7049..a02ed7c83c5 100644
--- a/chromium/third_party/blink/renderer/core/dom/events/event_path.h
+++ b/chromium/third_party/blink/renderer/core/dom/events/event_path.h
@@ -27,7 +27,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_EVENT_PATH_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_EVENT_PATH_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/dom/events/node_event_context.h"
#include "third_party/blink/renderer/core/dom/events/tree_scope_event_context.h"
@@ -46,6 +45,8 @@ class WindowEventContext;
class CORE_EXPORT EventPath final : public GarbageCollected<EventPath> {
public:
explicit EventPath(Node&, Event* = nullptr);
+ EventPath(const EventPath&) = delete;
+ EventPath& operator=(const EventPath&) = delete;
void InitializeWith(Node&, Event*);
@@ -128,7 +129,6 @@ class CORE_EXPORT EventPath final : public GarbageCollected<EventPath> {
Member<Event> event_;
HeapVector<Member<TreeScopeEventContext>, 8> tree_scope_event_contexts_;
Member<WindowEventContext> window_event_context_;
- DISALLOW_COPY_AND_ASSIGN(EventPath);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/events/event_target.cc b/chromium/third_party/blink/renderer/core/dom/events/event_target.cc
index 8b908f39d3d..30c6510a402 100644
--- a/chromium/third_party/blink/renderer/core/dom/events/event_target.cc
+++ b/chromium/third_party/blink/renderer/core/dom/events/event_target.cc
@@ -207,6 +207,14 @@ void CountFiringEventListeners(const Event& event,
{event_type_names::kPointerover, WebFeature::kPointerOverOutFired},
{event_type_names::kPointerout, WebFeature::kPointerOverOutFired},
{event_type_names::kSearch, WebFeature::kSearchEventFired},
+ {event_type_names::kWebkitprerenderstart,
+ WebFeature::kWebkitPrerenderStartEventFired},
+ {event_type_names::kWebkitprerenderstop,
+ WebFeature::kWebkitPrerenderStopEventFired},
+ {event_type_names::kWebkitprerenderload,
+ WebFeature::kWebkitPrerenderLoadEventFired},
+ {event_type_names::kWebkitprerenderdomcontentloaded,
+ WebFeature::kWebkitPrerenderDOMContentLoadedEventFired},
};
for (const auto& counted_event : counted_events) {
if (CheckTypeThenUseCount(event, counted_event.event_type,
diff --git a/chromium/third_party/blink/renderer/core/dom/events/event_target.h b/chromium/third_party/blink/renderer/core/dom/events/event_target.h
index 5bf904caebf..2bec93e09d8 100644
--- a/chromium/third_party/blink/renderer/core/dom/events/event_target.h
+++ b/chromium/third_party/blink/renderer/core/dom/events/event_target.h
@@ -34,7 +34,6 @@
#include <memory>
-#include "base/macros.h"
#include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/dom/events/event_dispatch_result.h"
@@ -80,13 +79,14 @@ class CORE_EXPORT EventTargetData final
: public GarbageCollected<EventTargetData> {
public:
EventTargetData();
+ EventTargetData(const EventTargetData&) = delete;
+ EventTargetData& operator=(const EventTargetData&) = delete;
~EventTargetData();
void Trace(Visitor*) const;
EventListenerMap event_listener_map;
std::unique_ptr<FiringEventIteratorVector> firing_event_iterators;
- DISALLOW_COPY_AND_ASSIGN(EventTargetData);
};
// All DOM event targets extend EventTarget. The spec is defined here:
diff --git a/chromium/third_party/blink/renderer/core/dom/events/scoped_event_queue.h b/chromium/third_party/blink/renderer/core/dom/events/scoped_event_queue.h
index e2e9cb8b761..504b51b4663 100644
--- a/chromium/third_party/blink/renderer/core/dom/events/scoped_event_queue.h
+++ b/chromium/third_party/blink/renderer/core/dom/events/scoped_event_queue.h
@@ -31,7 +31,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_SCOPED_EVENT_QUEUE_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_SCOPED_EVENT_QUEUE_H_
-#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/dom/events/event.h"
@@ -45,6 +44,8 @@ class CORE_EXPORT ScopedEventQueue {
USING_FAST_MALLOC(ScopedEventQueue);
public:
+ ScopedEventQueue(const ScopedEventQueue&) = delete;
+ ScopedEventQueue& operator=(const ScopedEventQueue&) = delete;
~ScopedEventQueue();
void EnqueueEvent(Event&);
@@ -64,7 +65,6 @@ class CORE_EXPORT ScopedEventQueue {
unsigned scoping_level_;
static ScopedEventQueue* instance_;
- DISALLOW_COPY_AND_ASSIGN(ScopedEventQueue);
};
class EventQueueScope {
@@ -72,8 +72,9 @@ class EventQueueScope {
public:
EventQueueScope() { ScopedEventQueue::Instance()->IncrementScopingLevel(); }
+ EventQueueScope(const EventQueueScope&) = delete;
+ EventQueueScope& operator=(const EventQueueScope&) = delete;
~EventQueueScope() { ScopedEventQueue::Instance()->DecrementScopingLevel(); }
- DISALLOW_COPY_AND_ASSIGN(EventQueueScope);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/events/window_event_context.h b/chromium/third_party/blink/renderer/core/dom/events/window_event_context.h
index c5ce6665149..8b67d014098 100644
--- a/chromium/third_party/blink/renderer/core/dom/events/window_event_context.h
+++ b/chromium/third_party/blink/renderer/core/dom/events/window_event_context.h
@@ -27,7 +27,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_WINDOW_EVENT_CONTEXT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_WINDOW_EVENT_CONTEXT_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
namespace blink {
@@ -40,6 +39,8 @@ class NodeEventContext;
class WindowEventContext : public GarbageCollected<WindowEventContext> {
public:
WindowEventContext(Event&, const NodeEventContext& top_node_event_context);
+ WindowEventContext(const WindowEventContext&) = delete;
+ WindowEventContext& operator=(const WindowEventContext&) = delete;
LocalDOMWindow* Window() const;
EventTarget* Target() const;
@@ -52,7 +53,6 @@ class WindowEventContext : public GarbageCollected<WindowEventContext> {
Member<LocalDOMWindow> window_;
Member<EventTarget> target_;
Member<EventTarget> related_target_;
- DISALLOW_COPY_AND_ASSIGN(WindowEventContext);
};
inline LocalDOMWindow* WindowEventContext::Window() const {
diff --git a/chromium/third_party/blink/renderer/core/dom/first_letter_pseudo_element.cc b/chromium/third_party/blink/renderer/core/dom/first_letter_pseudo_element.cc
index 8c623f6bdc0..2766dca1b90 100644
--- a/chromium/third_party/blink/renderer/core/dom/first_letter_pseudo_element.cc
+++ b/chromium/third_party/blink/renderer/core/dom/first_letter_pseudo_element.cc
@@ -164,7 +164,7 @@ LayoutText* FirstLetterPseudoElement::FirstLetterTextLayoutObject(
first_letter_text_layout_object =
first_letter_text_layout_object->NextSibling();
} else if (first_letter_text_layout_object->IsAtomicInlineLevel() ||
- first_letter_text_layout_object->IsButtonOrNGButton() ||
+ first_letter_text_layout_object->IsButtonIncludingNG() ||
IsMenuList(first_letter_text_layout_object)) {
return nullptr;
} else if (first_letter_text_layout_object
diff --git a/chromium/third_party/blink/renderer/core/dom/first_letter_pseudo_element.h b/chromium/third_party/blink/renderer/core/dom/first_letter_pseudo_element.h
index 4b6e05a9b1e..64b94100dc8 100644
--- a/chromium/third_party/blink/renderer/core/dom/first_letter_pseudo_element.h
+++ b/chromium/third_party/blink/renderer/core/dom/first_letter_pseudo_element.h
@@ -25,7 +25,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_FIRST_LETTER_PSEUDO_ELEMENT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_FIRST_LETTER_PSEUDO_ELEMENT_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/pseudo_element.h"
#include "third_party/blink/renderer/platform/wtf/casting.h"
@@ -40,6 +39,8 @@ class LayoutTextFragment;
class CORE_EXPORT FirstLetterPseudoElement final : public PseudoElement {
public:
explicit FirstLetterPseudoElement(Element*);
+ FirstLetterPseudoElement(const FirstLetterPseudoElement&) = delete;
+ FirstLetterPseudoElement& operator=(const FirstLetterPseudoElement&) = delete;
~FirstLetterPseudoElement() override;
static LayoutText* FirstLetterTextLayoutObject(const Element&);
@@ -62,7 +63,6 @@ class CORE_EXPORT FirstLetterPseudoElement final : public PseudoElement {
void AttachFirstLetterTextLayoutObjects(LayoutText* first_letter_text);
LayoutTextFragment* remaining_text_layout_object_;
- DISALLOW_COPY_AND_ASSIGN(FirstLetterPseudoElement);
};
template <>
diff --git a/chromium/third_party/blink/renderer/core/dom/flat_tree_node_data.h b/chromium/third_party/blink/renderer/core/dom/flat_tree_node_data.h
index 4a8b63a2d69..46bc1e73ead 100644
--- a/chromium/third_party/blink/renderer/core/dom/flat_tree_node_data.h
+++ b/chromium/third_party/blink/renderer/core/dom/flat_tree_node_data.h
@@ -5,7 +5,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_FLAT_TREE_NODE_DATA_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_FLAT_TREE_NODE_DATA_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
@@ -16,6 +15,8 @@ class HTMLSlotElement;
class FlatTreeNodeData final : public GarbageCollected<FlatTreeNodeData> {
public:
FlatTreeNodeData() {}
+ FlatTreeNodeData(const FlatTreeNodeData&) = delete;
+ FlatTreeNodeData& operator=(const FlatTreeNodeData&) = delete;
void Clear() {
assigned_slot_ = nullptr;
previous_in_assigned_nodes_ = nullptr;
@@ -54,7 +55,6 @@ class FlatTreeNodeData final : public GarbageCollected<FlatTreeNodeData> {
WeakMember<HTMLSlotElement> assigned_slot_;
WeakMember<Node> previous_in_assigned_nodes_;
WeakMember<Node> next_in_assigned_nodes_;
- DISALLOW_COPY_AND_ASSIGN(FlatTreeNodeData);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/flat_tree_traversal_forbidden_scope.h b/chromium/third_party/blink/renderer/core/dom/flat_tree_traversal_forbidden_scope.h
index 668f2b186d6..3815d62b1c3 100644
--- a/chromium/third_party/blink/renderer/core/dom/flat_tree_traversal_forbidden_scope.h
+++ b/chromium/third_party/blink/renderer/core/dom/flat_tree_traversal_forbidden_scope.h
@@ -5,7 +5,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_FLAT_TREE_TRAVERSAL_FORBIDDEN_SCOPE_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_FLAT_TREE_TRAVERSAL_FORBIDDEN_SCOPE_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/core/dom/document.h"
namespace blink {
@@ -18,6 +17,10 @@ class FlatTreeTraversalForbiddenScope {
: count_(document.FlatTreeTraversalForbiddenRecursionDepth()) {
++count_;
}
+ FlatTreeTraversalForbiddenScope(const FlatTreeTraversalForbiddenScope&) =
+ delete;
+ FlatTreeTraversalForbiddenScope& operator=(
+ const FlatTreeTraversalForbiddenScope&) = delete;
~FlatTreeTraversalForbiddenScope() {
DCHECK_GT(count_, 0u);
@@ -26,7 +29,6 @@ class FlatTreeTraversalForbiddenScope {
private:
unsigned& count_;
- DISALLOW_COPY_AND_ASSIGN(FlatTreeTraversalForbiddenScope);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/global_event_handlers.h b/chromium/third_party/blink/renderer/core/dom/global_event_handlers.h
index 5f95a146dba..79acf7a4f32 100644
--- a/chromium/third_party/blink/renderer/core/dom/global_event_handlers.h
+++ b/chromium/third_party/blink/renderer/core/dom/global_event_handlers.h
@@ -115,13 +115,16 @@ class GlobalEventHandlers {
DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(stalled, kStalled)
DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(submit, kSubmit)
DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(suspend, kSuspend)
- DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(transitionend, kTransitionend)
DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(timeupdate, kTimeupdate)
DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(toggle, kToggle)
DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(touchcancel, kTouchcancel)
DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(touchend, kTouchend)
DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(touchmove, kTouchmove)
DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(touchstart, kTouchstart)
+ DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(transitioncancel, kTransitioncancel)
+ DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(transitionend, kTransitionend)
+ DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(transitionrun, kTransitionrun)
+ DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(transitionstart, kTransitionstart)
DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(volumechange, kVolumechange)
DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(waiting, kWaiting)
DEFINE_STATIC_ATTRIBUTE_EVENT_LISTENER(webkitanimationend,
diff --git a/chromium/third_party/blink/renderer/core/dom/global_event_handlers.idl b/chromium/third_party/blink/renderer/core/dom/global_event_handlers.idl
index 0ebea14f693..c7657dde823 100644
--- a/chromium/third_party/blink/renderer/core/dom/global_event_handlers.idl
+++ b/chromium/third_party/blink/renderer/core/dom/global_event_handlers.idl
@@ -67,8 +67,8 @@
attribute EventHandler onloadedmetadata;
attribute EventHandler onloadstart;
attribute EventHandler onmousedown;
- [LenientThis] attribute EventHandler onmouseenter;
- [LenientThis] attribute EventHandler onmouseleave;
+ [LegacyLenientThis] attribute EventHandler onmouseenter;
+ [LegacyLenientThis] attribute EventHandler onmouseleave;
attribute EventHandler onmousemove;
attribute EventHandler onmouseout;
attribute EventHandler onmouseover;
@@ -139,5 +139,8 @@
// CSS Transitions
// https://drafts.csswg.org/css-transitions/#interface-globaleventhandlers-idl
+ attribute EventHandler ontransitionrun;
+ attribute EventHandler ontransitionstart;
attribute EventHandler ontransitionend;
+ attribute EventHandler ontransitioncancel;
};
diff --git a/chromium/third_party/blink/renderer/core/dom/id_target_observer_registry.h b/chromium/third_party/blink/renderer/core/dom/id_target_observer_registry.h
index ea74a3a2d08..02b3b38b02c 100644
--- a/chromium/third_party/blink/renderer/core/dom/id_target_observer_registry.h
+++ b/chromium/third_party/blink/renderer/core/dom/id_target_observer_registry.h
@@ -26,7 +26,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_ID_TARGET_OBSERVER_REGISTRY_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_ID_TARGET_OBSERVER_REGISTRY_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/wtf/forward.h"
#include "third_party/blink/renderer/platform/wtf/hash_map.h"
@@ -43,6 +42,8 @@ class IdTargetObserverRegistry final
public:
IdTargetObserverRegistry() : notifying_observers_in_set_(nullptr) {}
+ IdTargetObserverRegistry(const IdTargetObserverRegistry&) = delete;
+ IdTargetObserverRegistry& operator=(const IdTargetObserverRegistry&) = delete;
void Trace(Visitor*) const;
void NotifyObservers(const AtomicString& id);
@@ -57,7 +58,6 @@ class IdTargetObserverRegistry final
typedef HeapHashMap<StringImpl*, Member<ObserverSet>> IdToObserverSetMap;
IdToObserverSetMap registry_;
Member<ObserverSet> notifying_observers_in_set_;
- DISALLOW_COPY_AND_ASSIGN(IdTargetObserverRegistry);
};
inline void IdTargetObserverRegistry::NotifyObservers(const AtomicString& id) {
diff --git a/chromium/third_party/blink/renderer/core/dom/idle_deadline_test.cc b/chromium/third_party/blink/renderer/core/dom/idle_deadline_test.cc
index bef2e1bde60..0a88fa980e2 100644
--- a/chromium/third_party/blink/renderer/core/dom/idle_deadline_test.cc
+++ b/chromium/third_party/blink/renderer/core/dom/idle_deadline_test.cc
@@ -8,6 +8,7 @@
#include "base/test/test_mock_time_task_runner.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/platform/platform.h"
+#include "third_party/blink/renderer/platform/scheduler/public/agent_group_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/blink/renderer/platform/testing/scoped_scheduler_overrider.h"
@@ -17,6 +18,9 @@ namespace {
class MockIdleDeadlineScheduler final : public ThreadScheduler {
public:
MockIdleDeadlineScheduler() = default;
+ MockIdleDeadlineScheduler(const MockIdleDeadlineScheduler&) = delete;
+ MockIdleDeadlineScheduler& operator=(const MockIdleDeadlineScheduler&) =
+ delete;
~MockIdleDeadlineScheduler() override = default;
// ThreadScheduler implementation:
@@ -36,6 +40,9 @@ class MockIdleDeadlineScheduler final : public ThreadScheduler {
PageScheduler::Delegate*) override {
return nullptr;
}
+ AgentGroupScheduler* GetCurrentAgentGroupScheduler() override {
+ return nullptr;
+ }
scoped_refptr<base::SingleThreadTaskRunner> CompositorTaskRunner() override {
return nullptr;
}
@@ -67,9 +74,6 @@ class MockIdleDeadlineScheduler final : public ThreadScheduler {
}
void SetV8Isolate(v8::Isolate* isolate) override {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockIdleDeadlineScheduler);
};
} // namespace
diff --git a/chromium/third_party/blink/renderer/core/dom/ignore_opens_during_unload_count_incrementer.h b/chromium/third_party/blink/renderer/core/dom/ignore_opens_during_unload_count_incrementer.h
index 6f2a222b0b4..3f013525f1f 100644
--- a/chromium/third_party/blink/renderer/core/dom/ignore_opens_during_unload_count_incrementer.h
+++ b/chromium/third_party/blink/renderer/core/dom/ignore_opens_during_unload_count_incrementer.h
@@ -5,7 +5,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_IGNORE_OPENS_DURING_UNLOAD_COUNT_INCREMENTER_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_IGNORE_OPENS_DURING_UNLOAD_COUNT_INCREMENTER_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
@@ -22,6 +21,10 @@ class IgnoreOpensDuringUnloadCountIncrementer {
return;
++(*count_);
}
+ IgnoreOpensDuringUnloadCountIncrementer(
+ const IgnoreOpensDuringUnloadCountIncrementer&) = delete;
+ IgnoreOpensDuringUnloadCountIncrementer& operator=(
+ const IgnoreOpensDuringUnloadCountIncrementer&) = delete;
~IgnoreOpensDuringUnloadCountIncrementer() {
if (!count_)
@@ -31,7 +34,6 @@ class IgnoreOpensDuringUnloadCountIncrementer {
private:
unsigned* count_;
- DISALLOW_COPY_AND_ASSIGN(IgnoreOpensDuringUnloadCountIncrementer);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/increment_load_event_delay_count.h b/chromium/third_party/blink/renderer/core/dom/increment_load_event_delay_count.h
index a4f0a3fc82c..106fe32664f 100644
--- a/chromium/third_party/blink/renderer/core/dom/increment_load_event_delay_count.h
+++ b/chromium/third_party/blink/renderer/core/dom/increment_load_event_delay_count.h
@@ -7,7 +7,6 @@
#include <memory>
-#include "base/macros.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
@@ -23,6 +22,9 @@ class CORE_EXPORT IncrementLoadEventDelayCount {
public:
explicit IncrementLoadEventDelayCount(Document&);
+ IncrementLoadEventDelayCount(const IncrementLoadEventDelayCount&) = delete;
+ IncrementLoadEventDelayCount& operator=(const IncrementLoadEventDelayCount&) =
+ delete;
~IncrementLoadEventDelayCount();
// Decrements the loadEventDelayCount and checks load event synchronously,
@@ -37,7 +39,6 @@ class CORE_EXPORT IncrementLoadEventDelayCount {
private:
WeakPersistent<Document> document_;
- DISALLOW_COPY_AND_ASSIGN(IncrementLoadEventDelayCount);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/iterator.idl b/chromium/third_party/blink/renderer/core/dom/iterator.idl
index 106a46a5466..64ed6ccc434 100644
--- a/chromium/third_party/blink/renderer/core/dom/iterator.idl
+++ b/chromium/third_party/blink/renderer/core/dom/iterator.idl
@@ -5,7 +5,7 @@
// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-iterator-interface
[
- NoInterfaceObject
+ LegacyNoInterfaceObject
] interface Iterator {
[CallWith=ScriptState, RaisesException] any next(optional any value);
};
diff --git a/chromium/third_party/blink/renderer/core/dom/layout_tree_builder.cc b/chromium/third_party/blink/renderer/core/dom/layout_tree_builder.cc
index b15d3178d5d..b5e43511757 100644
--- a/chromium/third_party/blink/renderer/core/dom/layout_tree_builder.cc
+++ b/chromium/third_party/blink/renderer/core/dom/layout_tree_builder.cc
@@ -102,6 +102,8 @@ void LayoutTreeBuilderForElement::CreateLayoutObject() {
LayoutObject* next_layout_object = NextLayoutObject();
// SetStyle() can depend on LayoutObject() already being set.
node_->SetLayoutObject(new_layout_object);
+
+ DCHECK(!new_layout_object->Style());
new_layout_object->SetStyle(style_);
// Note: Adding new_layout_object instead of LayoutObject(). LayoutObject()
@@ -164,7 +166,9 @@ void LayoutTreeBuilderForText::CreateLayoutObject() {
context_.parent->IsInsideFlowThread());
node_->SetLayoutObject(new_layout_object);
+ DCHECK(!new_layout_object->Style());
new_layout_object->SetStyle(&style);
+
layout_object_parent->AddChild(new_layout_object, next_layout_object);
}
diff --git a/chromium/third_party/blink/renderer/core/dom/layout_tree_builder.h b/chromium/third_party/blink/renderer/core/dom/layout_tree_builder.h
index ecbfb41c6dd..c359c171b9c 100644
--- a/chromium/third_party/blink/renderer/core/dom/layout_tree_builder.h
+++ b/chromium/third_party/blink/renderer/core/dom/layout_tree_builder.h
@@ -89,7 +89,7 @@ class LayoutTreeBuilder {
NodeType* node_;
Node::AttachContext& context_;
- const ComputedStyle* style_;
+ scoped_refptr<const ComputedStyle> style_;
};
class LayoutTreeBuilderForElement : public LayoutTreeBuilder<Element> {
diff --git a/chromium/third_party/blink/renderer/core/dom/live_node_list_registry.h b/chromium/third_party/blink/renderer/core/dom/live_node_list_registry.h
index b6ee3178084..ab9fc00be01 100644
--- a/chromium/third_party/blink/renderer/core/dom/live_node_list_registry.h
+++ b/chromium/third_party/blink/renderer/core/dom/live_node_list_registry.h
@@ -7,7 +7,6 @@
#include <algorithm>
-#include "base/macros.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/heap/heap_allocator.h"
@@ -34,6 +33,8 @@ class CORE_EXPORT LiveNodeListRegistry {
public:
LiveNodeListRegistry() = default;
+ LiveNodeListRegistry(const LiveNodeListRegistry&) = delete;
+ LiveNodeListRegistry& operator=(const LiveNodeListRegistry&) = delete;
void Add(const LiveNodeListBase*, NodeListInvalidationType);
void Remove(const LiveNodeListBase*, NodeListInvalidationType);
@@ -63,7 +64,6 @@ class CORE_EXPORT LiveNodeListRegistry {
Vector<Entry> data_;
unsigned mask_ = 0;
- DISALLOW_COPY_AND_ASSIGN(LiveNodeListRegistry);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/names_map.h b/chromium/third_party/blink/renderer/core/dom/names_map.h
index 659a2e30b10..3a0a3189c6d 100644
--- a/chromium/third_party/blink/renderer/core/dom/names_map.h
+++ b/chromium/third_party/blink/renderer/core/dom/names_map.h
@@ -27,6 +27,8 @@ class CORE_EXPORT NamesMap {
public:
NamesMap() = default;
+ NamesMap(const NamesMap&) = delete;
+ NamesMap& operator=(const NamesMap&) = delete;
explicit NamesMap(const AtomicString& string);
// Clears any existing mapping, parses the string and sets the mapping from
@@ -44,8 +46,6 @@ class CORE_EXPORT NamesMap {
void Set(const AtomicString&, const CharacterType*);
HashMap<AtomicString, base::Optional<SpaceSplitString>> data_;
-
- DISALLOW_COPY_AND_ASSIGN(NamesMap);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/node.cc b/chromium/third_party/blink/renderer/core/dom/node.cc
index e04ba069c64..cef59fe04df 100644
--- a/chromium/third_party/blink/renderer/core/dom/node.cc
+++ b/chromium/third_party/blink/renderer/core/dom/node.cc
@@ -549,10 +549,11 @@ void Node::NativeApplyScroll(ScrollState& scroll_state) {
// TODO: This should use updateStyleAndLayoutForNode.
GetDocument().UpdateStyleAndLayout(DocumentUpdateReason::kScroll);
- LayoutBox* box_to_scroll = ToLayoutBox(GetLayoutObject());
-
ScrollableArea* scrollable_area =
- box_to_scroll->EnclosingBox()->GetScrollableArea();
+ ScrollableArea::GetForScrolling(ToLayoutBox(GetLayoutObject()));
+ if (!scrollable_area)
+ return;
+ LayoutBox* box_to_scroll = scrollable_area->GetLayoutBox();
// TODO(bokan): This is a hack to fix https://crbug.com/977954. If we have a
// non-default root scroller, scrolling from one of its siblings or a fixed
@@ -569,12 +570,6 @@ void Node::NativeApplyScroll(ScrollState& scroll_state) {
DCHECK(!also_scroll_visual_viewport ||
!box_to_scroll->IsGlobalRootScroller());
- if (!scrollable_area) {
- // The LayoutView should always create a ScrollableArea.
- DCHECK(!also_scroll_visual_viewport);
- return;
- }
-
ScrollResult result =
scrollable_area->UserScroll(scroll_state.delta_granularity(), delta,
ScrollableArea::ScrollCallback());
@@ -1363,8 +1358,8 @@ void Node::MarkAncestorsWithChildNeedsStyleRecalc() {
// will be done when the lock is committed.
if (RuntimeEnabledFeatures::CSSContentVisibilityEnabled()) {
auto* ancestor_element = DynamicTo<Element>(ancestor);
- if (ancestor_element && ancestor_element->StyleRecalcBlockedByDisplayLock(
- DisplayLockLifecycleTarget::kChildren)) {
+ if (ancestor_element &&
+ ancestor_element->ChildStyleRecalcBlockedByDisplayLock()) {
break;
}
}
@@ -1401,8 +1396,7 @@ void Node::MarkAncestorsWithChildNeedsStyleRecalc() {
ancestor_copy = ancestor_copy->GetStyleRecalcParent()) {
auto* ancestor_copy_element = DynamicTo<Element>(ancestor_copy);
if (ancestor_copy_element &&
- ancestor_copy_element->StyleRecalcBlockedByDisplayLock(
- DisplayLockLifecycleTarget::kChildren)) {
+ ancestor_copy_element->ChildStyleRecalcBlockedByDisplayLock()) {
return;
}
}
@@ -1480,9 +1474,7 @@ void Node::SetNeedsStyleRecalc(StyleChangeType change_type,
SetStyleChange(change_type);
auto* this_element = DynamicTo<Element>(this);
- if (existing_change_type == kNoStyleChange &&
- (!this_element || !this_element->StyleRecalcBlockedByDisplayLock(
- DisplayLockLifecycleTarget::kSelf)))
+ if (existing_change_type == kNoStyleChange)
MarkAncestorsWithChildNeedsStyleRecalc();
if (this_element && HasRareData())
@@ -2334,6 +2326,17 @@ uint16_t Node::compareDocumentPosition(const Node* other_node,
kDocumentPositionContains | connection;
}
+void Node::InvalidateIfHasEffectiveAppearance() const {
+ auto* layout_object = GetLayoutObject();
+ if (!layout_object)
+ return;
+
+ if (!layout_object->StyleRef().HasEffectiveAppearance())
+ return;
+
+ layout_object->SetSubtreeShouldDoFullPaintInvalidation();
+}
+
String Node::DebugName() const {
StringBuilder name;
AppendUnsafe(name, DebugNodeName());
@@ -3065,10 +3068,9 @@ void Node::UpdateHadKeyboardEvent(const Event& event) {
GetDocument().SetHadKeyboardEvent(true);
// Changes to HadKeyboardEvent may affect :focus-visible matching,
- // ShouldHaveFocusAppearance and LayoutTheme::IsFocused().
- // Inform LayoutTheme if HadKeyboardEvent changes.
+ // ShouldHaveFocusAppearance and theme painting.
if (GetLayoutObject()) {
- GetLayoutObject()->InvalidateIfControlStateChanged(kFocusControlState);
+ InvalidateIfHasEffectiveAppearance();
auto* this_node = DynamicTo<ContainerNode>(this);
if (RuntimeEnabledFeatures::CSSFocusVisibleEnabled() && this_node)
@@ -3230,12 +3232,17 @@ void Node::SetCustomElementState(CustomElementState new_state) {
case CustomElementState::kCustom:
DCHECK(old_state == CustomElementState::kUndefined ||
- old_state == CustomElementState::kFailed);
+ old_state == CustomElementState::kFailed ||
+ old_state == CustomElementState::kPreCustomized);
break;
case CustomElementState::kFailed:
DCHECK_NE(CustomElementState::kFailed, old_state);
break;
+
+ case CustomElementState::kPreCustomized:
+ DCHECK_EQ(CustomElementState::kFailed, old_state);
+ break;
}
DCHECK(IsHTMLElement());
diff --git a/chromium/third_party/blink/renderer/core/dom/node.h b/chromium/third_party/blink/renderer/core/dom/node.h
index 3b1861c0ab1..261c41a49e2 100644
--- a/chromium/third_party/blink/renderer/core/dom/node.h
+++ b/chromium/third_party/blink/renderer/core/dom/node.h
@@ -101,8 +101,9 @@ enum class CustomElementState : uint32_t {
// https://dom.spec.whatwg.org/#concept-element-custom-element-state
kUncustomized = 0,
kCustom = 1 << kNodeCustomElementShift,
- kUndefined = 2 << kNodeCustomElementShift,
- kFailed = 3 << kNodeCustomElementShift,
+ kPreCustomized = 2 << kNodeCustomElementShift,
+ kUndefined = 3 << kNodeCustomElementShift,
+ kFailed = 4 << kNodeCustomElementShift,
};
enum class SlotChangeType {
@@ -970,24 +971,24 @@ class CORE_EXPORT Node : public EventTarget {
kChildNeedsStyleRecalcFlag = 1 << 16,
kStyleChangeMask = 0x3 << kNodeStyleChangeShift,
- kCustomElementStateMask = 0x3 << kNodeCustomElementShift,
+ kCustomElementStateMask = 0x7 << kNodeCustomElementShift,
- kHasNameOrIsEditingTextFlag = 1 << 21,
- kHasEventTargetDataFlag = 1 << 22,
+ kHasNameOrIsEditingTextFlag = 1 << 22,
+ kHasEventTargetDataFlag = 1 << 23,
- kV0CustomElementFlag = 1 << 23,
- kV0CustomElementUpgradedFlag = 1 << 24,
+ kV0CustomElementFlag = 1 << 24,
+ kV0CustomElementUpgradedFlag = 1 << 25,
- kNeedsReattachLayoutTree = 1 << 25,
- kChildNeedsReattachLayoutTree = 1 << 26,
+ kNeedsReattachLayoutTree = 1 << 26,
+ kChildNeedsReattachLayoutTree = 1 << 27,
- kHasDuplicateAttributes = 1 << 27,
+ kHasDuplicateAttributes = 1 << 28,
- kForceReattachLayoutTree = 1 << 28,
+ kForceReattachLayoutTree = 1 << 29,
kDefaultNodeFlags = kIsFinishedParsingChildrenFlag,
- // 4 bits remaining.
+ // 3 bits remaining.
};
ALWAYS_INLINE bool GetFlag(NodeFlags mask) const {
@@ -1087,6 +1088,8 @@ class CORE_EXPORT Node : public EventTarget {
SetFlag(value, kIsFinishedParsingChildrenFlag);
}
+ void InvalidateIfHasEffectiveAppearance() const;
+
private:
// Gets nodeName without caching AtomicStrings. Used by
// debugName. Compositor may call debugName from the "impl" thread
diff --git a/chromium/third_party/blink/renderer/core/dom/node_iterator_base.cc b/chromium/third_party/blink/renderer/core/dom/node_iterator_base.cc
index ffe3a3413dc..5fa62d32cde 100644
--- a/chromium/third_party/blink/renderer/core/dom/node_iterator_base.cc
+++ b/chromium/third_party/blink/renderer/core/dom/node_iterator_base.cc
@@ -80,9 +80,8 @@ unsigned NodeIteratorBase::AcceptNode(Node* node,
UseCounter::Count(
ExecutionContext::From(filter_->CallbackRelevantScriptState()),
- filter_->IsCallbackObjectCallableForNodeIteratorBase()
- ? WebFeature::kNodeFilterIsFunction
- : WebFeature::kNodeFilterIsObject);
+ filter_->IsCallbackObjectCallable() ? WebFeature::kNodeFilterIsFunction
+ : WebFeature::kNodeFilterIsObject);
// 7. Unset the active flag.
// 8. Return result.
diff --git a/chromium/third_party/blink/renderer/core/dom/node_lists_node_data.h b/chromium/third_party/blink/renderer/core/dom/node_lists_node_data.h
index 3818015bb38..f2457b59bc8 100644
--- a/chromium/third_party/blink/renderer/core/dom/node_lists_node_data.h
+++ b/chromium/third_party/blink/renderer/core/dom/node_lists_node_data.h
@@ -22,7 +22,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_NODE_LISTS_NODE_DATA_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_NODE_LISTS_NODE_DATA_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/core/dom/child_node_list.h"
#include "third_party/blink/renderer/core/dom/empty_node_list.h"
#include "third_party/blink/renderer/core/dom/qualified_name.h"
@@ -133,6 +132,8 @@ class NodeListsNodeData final : public GarbageCollected<NodeListsNodeData> {
}
NodeListsNodeData() : child_node_list_(nullptr) {}
+ NodeListsNodeData(const NodeListsNodeData&) = delete;
+ NodeListsNodeData& operator=(const NodeListsNodeData&) = delete;
void InvalidateCaches(const QualifiedName* attr_name = nullptr);
@@ -173,7 +174,6 @@ class NodeListsNodeData final : public GarbageCollected<NodeListsNodeData> {
Member<NodeList> child_node_list_;
NodeListAtomicNameCacheMap atomic_name_caches_;
TagCollectionNSCache tag_collection_ns_caches_;
- DISALLOW_COPY_AND_ASSIGN(NodeListsNodeData);
};
template <typename Collection>
diff --git a/chromium/third_party/blink/renderer/core/dom/node_rare_data.h b/chromium/third_party/blink/renderer/core/dom/node_rare_data.h
index 98589395482..95eb4e76758 100644
--- a/chromium/third_party/blink/renderer/core/dom/node_rare_data.h
+++ b/chromium/third_party/blink/renderer/core/dom/node_rare_data.h
@@ -22,7 +22,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_NODE_RARE_DATA_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_NODE_RARE_DATA_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/wtf/bit_field.h"
@@ -43,6 +42,8 @@ class NodeMutationObserverData final
: public GarbageCollected<NodeMutationObserverData> {
public:
NodeMutationObserverData() = default;
+ NodeMutationObserverData(const NodeMutationObserverData&) = delete;
+ NodeMutationObserverData& operator=(const NodeMutationObserverData&) = delete;
const HeapVector<Member<MutationObserverRegistration>>& Registry() {
return registry_;
@@ -62,7 +63,6 @@ class NodeMutationObserverData final
private:
HeapVector<Member<MutationObserverRegistration>> registry_;
HeapHashSet<Member<MutationObserverRegistration>> transient_registry_;
- DISALLOW_COPY_AND_ASSIGN(NodeMutationObserverData);
};
class GC_PLUGIN_IGNORE(
@@ -107,6 +107,8 @@ class GC_PLUGIN_IGNORE("Manual dispatch implemented in NodeData.")
public:
NodeRenderingData(LayoutObject*,
scoped_refptr<const ComputedStyle> computed_style);
+ NodeRenderingData(const NodeRenderingData&) = delete;
+ NodeRenderingData& operator=(const NodeRenderingData&) = delete;
LayoutObject* GetLayoutObject() const { return layout_object_; }
void SetLayoutObject(LayoutObject* layout_object) {
@@ -129,7 +131,6 @@ class GC_PLUGIN_IGNORE("Manual dispatch implemented in NodeData.")
private:
LayoutObject* layout_object_;
scoped_refptr<const ComputedStyle> computed_style_;
- DISALLOW_COPY_AND_ASSIGN(NodeRenderingData);
};
class GC_PLUGIN_IGNORE("Manual dispatch implemented in NodeData.") NodeRareData
@@ -137,6 +138,8 @@ class GC_PLUGIN_IGNORE("Manual dispatch implemented in NodeData.") NodeRareData
public:
explicit NodeRareData(NodeRenderingData* node_layout_data)
: NodeRareData(node_layout_data, false) {}
+ NodeRareData(const NodeRareData&) = delete;
+ NodeRareData& operator=(const NodeRareData&) = delete;
NodeRenderingData* GetNodeRenderingData() const { return node_layout_data_; }
void SetNodeRenderingData(NodeRenderingData* node_layout_data) {
@@ -223,8 +226,6 @@ class GC_PLUGIN_IGNORE("Manual dispatch implemented in NodeData.") NodeRareData
// Keeps strong scroll timeline pointers linked to this node to ensure
// the timelines are alive as long as the node is alive.
Member<HeapHashSet<Member<ScrollTimeline>>> scroll_timelines_;
-
- DISALLOW_COPY_AND_ASSIGN(NodeRareData);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/node_traversal.h b/chromium/third_party/blink/renderer/core/dom/node_traversal.h
index 764f7ac701b..7f0b6281eb4 100644
--- a/chromium/third_party/blink/renderer/core/dom/node_traversal.h
+++ b/chromium/third_party/blink/renderer/core/dom/node_traversal.h
@@ -62,7 +62,8 @@ class NodeTraversal {
// Like next, but skips children and starts with the next sibling.
CORE_EXPORT static Node* NextSkippingChildren(const Node&);
- static Node* NextSkippingChildren(const Node&, const Node* stay_within);
+ CORE_EXPORT static Node* NextSkippingChildren(const Node&,
+ const Node* stay_within);
static Node* FirstWithin(const Node& current) { return current.firstChild(); }
diff --git a/chromium/third_party/blink/renderer/core/dom/nth_index_cache.h b/chromium/third_party/blink/renderer/core/dom/nth_index_cache.h
index b3c38ed3740..1c3f636273e 100644
--- a/chromium/third_party/blink/renderer/core/dom/nth_index_cache.h
+++ b/chromium/third_party/blink/renderer/core/dom/nth_index_cache.h
@@ -5,7 +5,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_NTH_INDEX_CACHE_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_NTH_INDEX_CACHE_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
@@ -19,6 +18,8 @@ class CORE_EXPORT NthIndexData final : public GarbageCollected<NthIndexData> {
public:
NthIndexData(ContainerNode&);
NthIndexData(ContainerNode&, const QualifiedName& type);
+ NthIndexData(const NthIndexData&) = delete;
+ NthIndexData& operator=(const NthIndexData&) = delete;
unsigned NthIndex(Element&) const;
unsigned NthLastIndex(Element&) const;
@@ -30,7 +31,6 @@ class CORE_EXPORT NthIndexData final : public GarbageCollected<NthIndexData> {
private:
HeapHashMap<Member<Element>, unsigned> element_index_map_;
unsigned count_ = 0;
- DISALLOW_COPY_AND_ASSIGN(NthIndexData);
};
class CORE_EXPORT NthIndexCache final {
@@ -38,6 +38,8 @@ class CORE_EXPORT NthIndexCache final {
public:
explicit NthIndexCache(Document&);
+ NthIndexCache(const NthIndexCache&) = delete;
+ NthIndexCache& operator=(const NthIndexCache&) = delete;
~NthIndexCache();
static unsigned NthChildIndex(Element&);
@@ -62,7 +64,6 @@ class CORE_EXPORT NthIndexCache final {
#if DCHECK_IS_ON()
uint64_t dom_tree_version_;
#endif
- DISALLOW_COPY_AND_ASSIGN(NthIndexCache);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/pseudo_element_data.h b/chromium/third_party/blink/renderer/core/dom/pseudo_element_data.h
index 01f13551040..73a78bceff8 100644
--- a/chromium/third_party/blink/renderer/core/dom/pseudo_element_data.h
+++ b/chromium/third_party/blink/renderer/core/dom/pseudo_element_data.h
@@ -5,7 +5,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_PSEUDO_ELEMENT_DATA_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_PSEUDO_ELEMENT_DATA_H_
-#include "base/macros.h"
#include "build/build_config.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
@@ -14,6 +13,8 @@ namespace blink {
class PseudoElementData final : public GarbageCollected<PseudoElementData> {
public:
PseudoElementData() = default;
+ PseudoElementData(const PseudoElementData&) = delete;
+ PseudoElementData& operator=(const PseudoElementData&) = delete;
void SetPseudoElement(PseudoId, PseudoElement*);
PseudoElement* GetPseudoElement(PseudoId) const;
@@ -37,7 +38,6 @@ class PseudoElementData final : public GarbageCollected<PseudoElementData> {
Member<PseudoElement> generated_marker_;
Member<PseudoElement> generated_first_letter_;
Member<PseudoElement> backdrop_;
- DISALLOW_COPY_AND_ASSIGN(PseudoElementData);
};
inline bool PseudoElementData::HasPseudoElements() const {
diff --git a/chromium/third_party/blink/renderer/core/dom/range.cc b/chromium/third_party/blink/renderer/core/dom/range.cc
index 5b0e9013efa..d1f22b7b112 100644
--- a/chromium/third_party/blink/renderer/core/dom/range.cc
+++ b/chromium/third_party/blink/renderer/core/dom/range.cc
@@ -79,6 +79,8 @@ class RangeUpdateScope {
#endif
}
}
+ RangeUpdateScope(const RangeUpdateScope&) = delete;
+ RangeUpdateScope& operator=(const RangeUpdateScope&) = delete;
~RangeUpdateScope() {
DCHECK_GE(scope_count_, 1);
@@ -109,7 +111,6 @@ class RangeUpdateScope {
Range* range_ = nullptr;
Document* old_document_ = nullptr;
- DISALLOW_COPY_AND_ASSIGN(RangeUpdateScope);
};
int RangeUpdateScope::scope_count_ = 0;
diff --git a/chromium/third_party/blink/renderer/core/dom/scoped_window_focus_allowed_indicator.h b/chromium/third_party/blink/renderer/core/dom/scoped_window_focus_allowed_indicator.h
index 9dd6afb8330..a5316cc3e37 100644
--- a/chromium/third_party/blink/renderer/core/dom/scoped_window_focus_allowed_indicator.h
+++ b/chromium/third_party/blink/renderer/core/dom/scoped_window_focus_allowed_indicator.h
@@ -5,7 +5,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_SCOPED_WINDOW_FOCUS_ALLOWED_INDICATOR_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_SCOPED_WINDOW_FOCUS_ALLOWED_INDICATOR_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
namespace blink {
@@ -19,6 +18,10 @@ class ScopedWindowFocusAllowedIndicator final {
: execution_context_(execution_context) {
execution_context->AllowWindowInteraction();
}
+ ScopedWindowFocusAllowedIndicator(const ScopedWindowFocusAllowedIndicator&) =
+ delete;
+ ScopedWindowFocusAllowedIndicator& operator=(
+ const ScopedWindowFocusAllowedIndicator&) = delete;
~ScopedWindowFocusAllowedIndicator() {
execution_context_->ConsumeWindowInteraction();
}
@@ -27,7 +30,6 @@ class ScopedWindowFocusAllowedIndicator final {
// This doesn't create a cycle because ScopedWindowFocusAllowedIndicator
// is used only on a machine stack.
Persistent<ExecutionContext> execution_context_;
- DISALLOW_COPY_AND_ASSIGN(ScopedWindowFocusAllowedIndicator);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/scripted_idle_task_controller_test.cc b/chromium/third_party/blink/renderer/core/dom/scripted_idle_task_controller_test.cc
index dcb07426cd7..9343bf12f42 100644
--- a/chromium/third_party/blink/renderer/core/dom/scripted_idle_task_controller_test.cc
+++ b/chromium/third_party/blink/renderer/core/dom/scripted_idle_task_controller_test.cc
@@ -10,6 +10,7 @@
#include "third_party/blink/renderer/bindings/core/v8/v8_idle_request_callback.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_idle_request_options.h"
#include "third_party/blink/renderer/core/testing/null_execution_context.h"
+#include "third_party/blink/renderer/platform/scheduler/public/agent_group_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/blink/renderer/platform/scheduler/test/fake_task_runner.h"
#include "third_party/blink/renderer/platform/testing/scoped_scheduler_overrider.h"
@@ -23,6 +24,10 @@ class MockScriptedIdleTaskControllerScheduler final : public ThreadScheduler {
public:
explicit MockScriptedIdleTaskControllerScheduler(ShouldYield should_yield)
: should_yield_(should_yield == ShouldYield::YIELD) {}
+ MockScriptedIdleTaskControllerScheduler(
+ const MockScriptedIdleTaskControllerScheduler&) = delete;
+ MockScriptedIdleTaskControllerScheduler& operator=(
+ const MockScriptedIdleTaskControllerScheduler&) = delete;
~MockScriptedIdleTaskControllerScheduler() override = default;
// ThreadScheduler implementation:
@@ -60,7 +65,9 @@ class MockScriptedIdleTaskControllerScheduler final : public ThreadScheduler {
std::unique_ptr<RendererPauseHandle> PauseScheduler() override {
return nullptr;
}
-
+ AgentGroupScheduler* GetCurrentAgentGroupScheduler() override {
+ return nullptr;
+ }
base::TimeTicks MonotonicallyIncreasingVirtualTime() override {
return base::TimeTicks();
}
@@ -91,8 +98,6 @@ class MockScriptedIdleTaskControllerScheduler final : public ThreadScheduler {
Thread::IdleTask idle_task_;
scoped_refptr<scheduler::FakeTaskRunner> task_runner_ =
base::MakeRefCounted<scheduler::FakeTaskRunner>();
-
- DISALLOW_COPY_AND_ASSIGN(MockScriptedIdleTaskControllerScheduler);
};
class MockIdleTask : public ScriptedIdleTaskController::IdleTask {
diff --git a/chromium/third_party/blink/renderer/core/dom/shadow_root.h b/chromium/third_party/blink/renderer/core/dom/shadow_root.h
index e6bde410f76..d1e29347d9b 100644
--- a/chromium/third_party/blink/renderer/core/dom/shadow_root.h
+++ b/chromium/third_party/blink/renderer/core/dom/shadow_root.h
@@ -51,6 +51,8 @@ class CORE_EXPORT ShadowRoot final : public DocumentFragment, public TreeScope {
public:
ShadowRoot(Document&, ShadowRootType);
+ ShadowRoot(const ShadowRoot&) = delete;
+ ShadowRoot& operator=(const ShadowRoot&) = delete;
// Disambiguate between Node and TreeScope hierarchies; TreeScope's
// implementation is simpler.
@@ -161,6 +163,15 @@ class CORE_EXPORT ShadowRoot final : public DocumentFragment, public TreeScope {
}
bool IsDeclarativeShadowRoot() const { return is_declarative_shadow_root_; }
+ void SetAvailableToElementInternals(bool flag) {
+ DCHECK(!flag || GetType() == ShadowRootType::kOpen ||
+ GetType() == ShadowRootType::kClosed);
+ available_to_element_internals_ = flag;
+ }
+ bool IsAvailableToElementInternals() const {
+ return available_to_element_internals_;
+ }
+
bool ContainsShadowRoots() const { return child_shadow_root_count_; }
StyleSheetList& StyleSheets();
@@ -193,10 +204,9 @@ class CORE_EXPORT ShadowRoot final : public DocumentFragment, public TreeScope {
unsigned delegates_focus_ : 1;
unsigned slot_assignment_mode_ : 1;
unsigned is_declarative_shadow_root_ : 1;
+ unsigned available_to_element_internals_ : 1;
unsigned needs_distribution_recalc_ : 1;
- unsigned unused_ : 9;
-
- DISALLOW_COPY_AND_ASSIGN(ShadowRoot);
+ unsigned unused_ : 8;
};
inline Element* ShadowRoot::ActiveElement() const {
diff --git a/chromium/third_party/blink/renderer/core/dom/shadow_root_v0.h b/chromium/third_party/blink/renderer/core/dom/shadow_root_v0.h
index 4aae91a74b0..eb1fed968cb 100644
--- a/chromium/third_party/blink/renderer/core/dom/shadow_root_v0.h
+++ b/chromium/third_party/blink/renderer/core/dom/shadow_root_v0.h
@@ -43,6 +43,8 @@ class CORE_EXPORT ShadowRootV0 final : public GarbageCollected<ShadowRootV0> {
HeapHashMap<Member<const Node>, Member<DestinationInsertionPoints>>;
explicit ShadowRootV0(ShadowRoot& shadow_root) : shadow_root_(&shadow_root) {}
+ ShadowRootV0(const ShadowRootV0&) = delete;
+ ShadowRootV0& operator=(const ShadowRootV0&) = delete;
bool ContainsShadowElements() const {
return descendant_shadow_element_count_;
@@ -97,8 +99,6 @@ class CORE_EXPORT ShadowRootV0 final : public GarbageCollected<ShadowRootV0> {
SelectRuleFeatureSet select_features_;
bool needs_select_feature_set_ = false;
bool descendant_insertion_points_is_valid_ = false;
-
- DISALLOW_COPY_AND_ASSIGN(ShadowRootV0);
};
inline void ShadowRootV0::DidAddInsertionPoint(V0InsertionPoint* point) {
diff --git a/chromium/third_party/blink/renderer/core/dom/sink_document.cc b/chromium/third_party/blink/renderer/core/dom/sink_document.cc
index bac9cd8ba82..29e66fc2a36 100644
--- a/chromium/third_party/blink/renderer/core/dom/sink_document.cc
+++ b/chromium/third_party/blink/renderer/core/dom/sink_document.cc
@@ -42,7 +42,7 @@ class SinkDocumentParser : public RawDataDocumentParser {
SinkDocument::SinkDocument(const DocumentInit& initializer)
: HTMLDocument(initializer) {
- SetCompatibilityMode(kQuirksMode);
+ SetCompatibilityMode(kNoQuirksMode);
LockCompatibilityMode();
}
diff --git a/chromium/third_party/blink/renderer/core/dom/slot_assignment_recalc_forbidden_scope.h b/chromium/third_party/blink/renderer/core/dom/slot_assignment_recalc_forbidden_scope.h
index 8e25b44ca1e..6ed832a16b0 100644
--- a/chromium/third_party/blink/renderer/core/dom/slot_assignment_recalc_forbidden_scope.h
+++ b/chromium/third_party/blink/renderer/core/dom/slot_assignment_recalc_forbidden_scope.h
@@ -5,7 +5,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_SLOT_ASSIGNMENT_RECALC_FORBIDDEN_SCOPE_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_SLOT_ASSIGNMENT_RECALC_FORBIDDEN_SCOPE_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/core/dom/document.h"
namespace blink {
@@ -20,11 +19,14 @@ class SlotAssignmentRecalcForbiddenScope {
++count_;
}
+ SlotAssignmentRecalcForbiddenScope(
+ const SlotAssignmentRecalcForbiddenScope&) = delete;
+ SlotAssignmentRecalcForbiddenScope& operator=(
+ const SlotAssignmentRecalcForbiddenScope&) = delete;
~SlotAssignmentRecalcForbiddenScope() { --count_; }
private:
unsigned& count_;
- DISALLOW_COPY_AND_ASSIGN(SlotAssignmentRecalcForbiddenScope);
};
#else
class SlotAssignmentRecalcForbiddenScope {
@@ -32,9 +34,10 @@ class SlotAssignmentRecalcForbiddenScope {
public:
explicit SlotAssignmentRecalcForbiddenScope(Document&) {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(SlotAssignmentRecalcForbiddenScope);
+ SlotAssignmentRecalcForbiddenScope(
+ const SlotAssignmentRecalcForbiddenScope&) = delete;
+ SlotAssignmentRecalcForbiddenScope& operator=(
+ const SlotAssignmentRecalcForbiddenScope&) = delete;
};
#endif
diff --git a/chromium/third_party/blink/renderer/core/dom/synchronous_mutation_observer.cc b/chromium/third_party/blink/renderer/core/dom/synchronous_mutation_observer.cc
index 7deddd69373..156a0e8814f 100644
--- a/chromium/third_party/blink/renderer/core/dom/synchronous_mutation_observer.cc
+++ b/chromium/third_party/blink/renderer/core/dom/synchronous_mutation_observer.cc
@@ -8,7 +8,7 @@
namespace blink {
-void SynchronousMutationObserver::ObserverListWillBeCleared() {
+void SynchronousMutationObserver::ObserverSetWillBeCleared() {
document_ = nullptr;
}
@@ -17,12 +17,12 @@ void SynchronousMutationObserver::SetDocument(Document* document) {
return;
if (document_)
- document_->SynchronousMutationObserverList().RemoveObserver(this);
+ document_->SynchronousMutationObserverSet().RemoveObserver(this);
document_ = document;
if (document_)
- document_->SynchronousMutationObserverList().AddObserver(this);
+ document_->SynchronousMutationObserverSet().AddObserver(this);
}
void SynchronousMutationObserver::Trace(Visitor* visitor) const {
diff --git a/chromium/third_party/blink/renderer/core/dom/synchronous_mutation_observer.h b/chromium/third_party/blink/renderer/core/dom/synchronous_mutation_observer.h
index 82a35ed8d0e..e574de51210 100644
--- a/chromium/third_party/blink/renderer/core/dom/synchronous_mutation_observer.h
+++ b/chromium/third_party/blink/renderer/core/dom/synchronous_mutation_observer.h
@@ -76,7 +76,7 @@ class CORE_EXPORT SynchronousMutationObserver : public GarbageCollectedMixin {
virtual void ContextDestroyed() {}
// Call before clearing an observer list.
- void ObserverListWillBeCleared();
+ void ObserverSetWillBeCleared();
Document* GetDocument() const { return document_; }
void SetDocument(Document*);
diff --git a/chromium/third_party/blink/renderer/core/dom/text.cc b/chromium/third_party/blink/renderer/core/dom/text.cc
index beec5e55b85..d21d14ea7c2 100644
--- a/chromium/third_party/blink/renderer/core/dom/text.cc
+++ b/chromium/third_party/blink/renderer/core/dom/text.cc
@@ -254,7 +254,7 @@ static inline bool CanHaveWhitespaceChildren(
const LayoutObject& parent = *context.parent;
// <button> and <fieldset> should allow whitespace even though
// LayoutFlexibleBox doesn't.
- if (parent.IsButtonOrNGButton() || parent.IsFieldset())
+ if (parent.IsButtonIncludingNG() || parent.IsFieldset())
return true;
if (parent.IsTable() || parent.IsTableRow() || parent.IsTableSection() ||
diff --git a/chromium/third_party/blink/renderer/core/dom/text_link_colors.cc b/chromium/third_party/blink/renderer/core/dom/text_link_colors.cc
index 9fd69e7280a..2f7e10a7cfc 100644
--- a/chromium/third_party/blink/renderer/core/dom/text_link_colors.cc
+++ b/chromium/third_party/blink/renderer/core/dom/text_link_colors.cc
@@ -58,14 +58,14 @@ void TextLinkColors::ResetActiveLinkColor() {
Color TextLinkColors::ColorFromCSSValue(const CSSValue& value,
Color current_color,
- WebColorScheme color_scheme,
+ ColorScheme color_scheme,
bool for_visited_link) const {
if (auto* color_value = DynamicTo<cssvalue::CSSColorValue>(value))
return color_value->Value();
if (auto* pair = DynamicTo<CSSLightDarkValuePair>(value)) {
const CSSValue& color_value =
- color_scheme == WebColorScheme::kLight ? pair->First() : pair->Second();
+ color_scheme == ColorScheme::kLight ? pair->First() : pair->Second();
return ColorFromCSSValue(color_value, current_color, color_scheme,
for_visited_link);
}
diff --git a/chromium/third_party/blink/renderer/core/dom/text_link_colors.h b/chromium/third_party/blink/renderer/core/dom/text_link_colors.h
index f21ebc53c04..755b0a589ca 100644
--- a/chromium/third_party/blink/renderer/core/dom/text_link_colors.h
+++ b/chromium/third_party/blink/renderer/core/dom/text_link_colors.h
@@ -30,8 +30,7 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_TEXT_LINK_COLORS_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_TEXT_LINK_COLORS_H_
-#include "base/macros.h"
-#include "third_party/blink/public/platform/web_color_scheme.h"
+#include "third_party/blink/public/common/css/color_scheme.h"
#include "third_party/blink/renderer/platform/graphics/color.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
@@ -44,6 +43,8 @@ class TextLinkColors {
public:
TextLinkColors();
+ TextLinkColors(const TextLinkColors&) = delete;
+ TextLinkColors& operator=(const TextLinkColors&) = delete;
void SetTextColor(const Color& color) { text_color_ = color; }
Color TextColor() const { return text_color_; }
@@ -59,7 +60,7 @@ class TextLinkColors {
void ResetActiveLinkColor();
Color ColorFromCSSValue(const CSSValue&,
Color current_color,
- WebColorScheme color_scheme,
+ ColorScheme color_scheme,
bool for_visited_link = false) const;
private:
@@ -67,7 +68,6 @@ class TextLinkColors {
Color link_color_;
Color visited_link_color_;
Color active_link_color_;
- DISALLOW_COPY_AND_ASSIGN(TextLinkColors);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/throw_on_dynamic_markup_insertion_count_incrementer.h b/chromium/third_party/blink/renderer/core/dom/throw_on_dynamic_markup_insertion_count_incrementer.h
index 706b40aedf8..bbb9d2cfa7c 100644
--- a/chromium/third_party/blink/renderer/core/dom/throw_on_dynamic_markup_insertion_count_incrementer.h
+++ b/chromium/third_party/blink/renderer/core/dom/throw_on_dynamic_markup_insertion_count_incrementer.h
@@ -5,7 +5,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_THROW_ON_DYNAMIC_MARKUP_INSERTION_COUNT_INCREMENTER_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_THROW_ON_DYNAMIC_MARKUP_INSERTION_COUNT_INCREMENTER_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
@@ -22,6 +21,10 @@ class ThrowOnDynamicMarkupInsertionCountIncrementer {
return;
++(*count_);
}
+ ThrowOnDynamicMarkupInsertionCountIncrementer(
+ const ThrowOnDynamicMarkupInsertionCountIncrementer&) = delete;
+ ThrowOnDynamicMarkupInsertionCountIncrementer& operator=(
+ const ThrowOnDynamicMarkupInsertionCountIncrementer&) = delete;
~ThrowOnDynamicMarkupInsertionCountIncrementer() {
if (!count_)
@@ -31,7 +34,6 @@ class ThrowOnDynamicMarkupInsertionCountIncrementer {
private:
unsigned* count_;
- DISALLOW_COPY_AND_ASSIGN(ThrowOnDynamicMarkupInsertionCountIncrementer);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/transform_source.h b/chromium/third_party/blink/renderer/core/dom/transform_source.h
index 46ba990df5a..a3d223fefd6 100644
--- a/chromium/third_party/blink/renderer/core/dom/transform_source.h
+++ b/chromium/third_party/blink/renderer/core/dom/transform_source.h
@@ -21,7 +21,6 @@
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_TRANSFORM_SOURCE_H_
#include <libxml/tree.h>
-#include "base/macros.h"
#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
namespace blink {
@@ -31,13 +30,14 @@ class TransformSource {
public:
explicit TransformSource(xmlDocPtr source);
+ TransformSource(const TransformSource&) = delete;
+ TransformSource& operator=(const TransformSource&) = delete;
~TransformSource();
xmlDocPtr PlatformSource() const { return source_; }
private:
xmlDocPtr source_;
- DISALLOW_COPY_AND_ASSIGN(TransformSource);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/tree_ordered_list.h b/chromium/third_party/blink/renderer/core/dom/tree_ordered_list.h
index 057cf5b5a16..212fdb8bce5 100644
--- a/chromium/third_party/blink/renderer/core/dom/tree_ordered_list.h
+++ b/chromium/third_party/blink/renderer/core/dom/tree_ordered_list.h
@@ -30,7 +30,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_TREE_ORDERED_LIST_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_TREE_ORDERED_LIST_H_
-#include "base/macros.h"
#include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/wtf/list_hash_set.h"
@@ -43,6 +42,8 @@ class TreeOrderedList final {
public:
TreeOrderedList() = default;
+ TreeOrderedList(const TreeOrderedList&) = delete;
+ TreeOrderedList& operator=(const TreeOrderedList&) = delete;
void Add(Node*);
void Remove(const Node*);
@@ -67,7 +68,6 @@ class TreeOrderedList final {
private:
HeapListHashSet<Member<Node>, 32> nodes_;
- DISALLOW_COPY_AND_ASSIGN(TreeOrderedList);
};
} // namespace blink
diff --git a/chromium/third_party/blink/renderer/core/dom/tree_scope.cc b/chromium/third_party/blink/renderer/core/dom/tree_scope.cc
index d3d75babf5c..da0e951e56b 100644
--- a/chromium/third_party/blink/renderer/core/dom/tree_scope.cc
+++ b/chromium/third_party/blink/renderer/core/dom/tree_scope.cc
@@ -379,7 +379,7 @@ DOMSelection* TreeScope::GetSelection() const {
return selection_.Get();
}
-Element* TreeScope::FindAnchor(const String& name) {
+Element* TreeScope::FindAnchorWithName(const String& name) {
if (name.IsEmpty())
return nullptr;
if (Element* element = getElementById(AtomicString(name)))
@@ -399,6 +399,38 @@ Element* TreeScope::FindAnchor(const String& name) {
return nullptr;
}
+Node* TreeScope::FindAnchor(const String& fragment) {
+ Node* anchor = nullptr;
+ // https://html.spec.whatwg.org/C/#the-indicated-part-of-the-document
+ // 1. Let fragment be the document's URL's fragment.
+
+ // 2. If fragment is "", top of the document.
+ // TODO(1117212) Move empty check to here.
+
+ // 3. Try the raw fragment (for HTML documents; skip it for `svgView()`).
+ // TODO(1117212) Remove this 'raw' check, or make it actually 'raw'
+ if (!GetDocument().IsSVGDocument()) {
+ anchor = FindAnchorWithName(fragment);
+ if (anchor)
+ return anchor;
+ }
+
+ // 4. Let fragmentBytes be the percent-decoded fragment.
+ // 5. Let decodedFragment be the UTF-8 decode without BOM of fragmentBytes.
+ String name = DecodeURLEscapeSequences(fragment, DecodeURLMode::kUTF8);
+ // 6. Try decodedFragment.
+ anchor = FindAnchorWithName(name);
+ if (anchor)
+ return anchor;
+
+ // 7. If decodedFragment is "top", top of the document.
+ // TODO(1117212) Move the IsEmpty check to step 2.
+ if (fragment.IsEmpty() || EqualIgnoringASCIICase(name, "top"))
+ anchor = &GetDocument();
+
+ return anchor;
+}
+
void TreeScope::AdoptIfNeeded(Node& node) {
// Script is forbidden to protect against event handlers firing in the middle
// of rescoping in |didMoveToNewDocument| callbacks. See
diff --git a/chromium/third_party/blink/renderer/core/dom/tree_scope.h b/chromium/third_party/blink/renderer/core/dom/tree_scope.h
index 1487a3d76b0..be9845962e8 100644
--- a/chromium/third_party/blink/renderer/core/dom/tree_scope.h
+++ b/chromium/third_party/blink/renderer/core/dom/tree_scope.h
@@ -102,12 +102,14 @@ class CORE_EXPORT TreeScope : public GarbageCollectedMixin {
Element* AdjustedFocusedElementInternal(const Element& target) const;
- // Find first anchor with the given name.
+ // Find first anchor which matches the given URL fragment.
// First searches for an element with the given ID, but if that fails, then
// looks for an anchor with the given name. ID matching is always case
// sensitive, but Anchor name matching is case sensitive in strict mode and
// not case sensitive in quirks mode for historical compatibility reasons.
- Element* FindAnchor(const String& name);
+ // First searches for the raw fragment if not an SVG document, then searches
+ // with the URL decoded fragment.
+ Node* FindAnchor(const String& fragment);
// Used by the basic DOM mutation methods (e.g., appendChild()).
void AdoptIfNeeded(Node&);
@@ -158,6 +160,7 @@ class CORE_EXPORT TreeScope : public GarbageCollectedMixin {
private:
Element* HitTestPointInternal(Node*, HitTestPointType) const;
+ Element* FindAnchorWithName(const String& name);
Member<ContainerNode> root_node_;
Member<Document> document_;