diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-08 13:13:08 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-10-04 10:18:09 +0200 |
commit | 86e861c8d425225667dacc9e8402ad2a33d7b1bd (patch) | |
tree | c04d17ce009ad8b6df1ccc341503398a4494044b | |
parent | 94f8cf16432dcc5f3ed06e2f7821fc5574888a81 (diff) | |
download | qtwebengine-chromium-86e861c8d425225667dacc9e8402ad2a33d7b1bd.tar.gz |
Fix misuse of {} initialization
Narrowing is supposed to be forbidden in {} initialization, but Chromium
doesn't appear to care upstream.
Change-Id: Ia3d1dac6ef19ef86afcbeee4ed11d807c53faaaa
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
92 files changed, 234 insertions, 232 deletions
diff --git a/chromium/base/allocator/partition_allocator/thread_cache.cc b/chromium/base/allocator/partition_allocator/thread_cache.cc index df069a8d24c..3b62584ce9f 100644 --- a/chromium/base/allocator/partition_allocator/thread_cache.cc +++ b/chromium/base/allocator/partition_allocator/thread_cache.cc @@ -345,7 +345,7 @@ void ThreadCache::SetGlobalLimits(PartitionRoot<ThreadSafe>* root, constexpr uint8_t kMinLimit = 1; // |PutInBucket()| is called on a full bucket, which should not overflow. constexpr uint8_t kMaxLimit = std::numeric_limits<uint8_t>::max() - 1; - global_limits_[index] = std::max(kMinLimit, {std::min(value, {kMaxLimit})}); + global_limits_[index] = std::max(kMinLimit, uint8_t(std::min(value, size_t(kMaxLimit)))); PA_DCHECK(global_limits_[index] >= kMinLimit); PA_DCHECK(global_limits_[index] <= kMaxLimit); } diff --git a/chromium/base/task/thread_pool/job_task_source.cc b/chromium/base/task/thread_pool/job_task_source.cc index d44e3bc70ca..4b71ac7f984 100644 --- a/chromium/base/task/thread_pool/job_task_source.cc +++ b/chromium/base/task/thread_pool/job_task_source.cc @@ -46,13 +46,13 @@ JobTaskSource::State::Value JobTaskSource::State::DecrementWorkerCount() { const size_t value_before_sub = value_.fetch_sub(kWorkerCountIncrement, std::memory_order_relaxed); DCHECK((value_before_sub >> kWorkerCountBitOffset) > 0); - return {value_before_sub}; + return {uint32_t(value_before_sub)}; } JobTaskSource::State::Value JobTaskSource::State::IncrementWorkerCount() { size_t value_before_add = value_.fetch_add(kWorkerCountIncrement, std::memory_order_relaxed); - return {value_before_add}; + return {uint32_t(value_before_add)}; } JobTaskSource::State::Value JobTaskSource::State::Load() const { diff --git a/chromium/base/time/time.cc b/chromium/base/time/time.cc index 973003b609c..ad31a0675ed 100644 --- a/chromium/base/time/time.cc +++ b/chromium/base/time/time.cc @@ -63,7 +63,7 @@ int TimeDelta::InDaysFloored() const { double TimeDelta::InMillisecondsF() const { if (!is_inf()) - return double{delta_} / Time::kMicrosecondsPerMillisecond; + return double(delta_) / Time::kMicrosecondsPerMillisecond; return (delta_ < 0) ? -std::numeric_limits<double>::infinity() : std::numeric_limits<double>::infinity(); } @@ -87,7 +87,7 @@ int64_t TimeDelta::InMillisecondsRoundedUp() const { double TimeDelta::InMicrosecondsF() const { if (!is_inf()) - return double{delta_}; + return double(delta_); return (delta_ < 0) ? -std::numeric_limits<double>::infinity() : std::numeric_limits<double>::infinity(); } @@ -188,7 +188,7 @@ double Time::ToDoubleT() const { #if defined(OS_POSIX) || defined(OS_FUCHSIA) // static Time Time::FromTimeSpec(const timespec& ts) { - return FromDoubleT(ts.tv_sec + double{ts.tv_nsec} / kNanosecondsPerSecond); + return FromDoubleT(ts.tv_sec + double(ts.tv_nsec) / kNanosecondsPerSecond); } #endif diff --git a/chromium/base/time/time_delta_from_string.cc b/chromium/base/time/time_delta_from_string.cc index 1dd4161f4c8..3602eb8b817 100644 --- a/chromium/base/time/time_delta_from_string.cc +++ b/chromium/base/time/time_delta_from_string.cc @@ -149,7 +149,7 @@ absl::optional<TimeDelta> TimeDeltaFromString(StringPiece duration_string) { if (number.int_part != 0) delta += sign * number.int_part * unit; if (number.frac_part != 0) - delta += (double{sign} * number.frac_part / number.frac_scale) * unit; + delta += (double(sign) * number.frac_part / number.frac_scale) * unit; } return delta; } diff --git a/chromium/base/win/embedded_i18n/language_selector.cc b/chromium/base/win/embedded_i18n/language_selector.cc index fde6a282b0f..7956e873d2e 100644 --- a/chromium/base/win/embedded_i18n/language_selector.cc +++ b/chromium/base/win/embedded_i18n/language_selector.cc @@ -268,7 +268,7 @@ void SelectLanguageMatchingCandidate( DCHECK(matched_candidate); DCHECK(selected_language); DCHECK(!languages_to_offset.empty()); - DCHECK_EQ(size_t{*selected_offset}, languages_to_offset.size()); + DCHECK_EQ(size_t(*selected_offset), languages_to_offset.size()); DCHECK(matched_candidate->empty()); DCHECK(selected_language->empty()); // Note: While DCHECK_IS_ON() seems redundant here, this is required to avoid diff --git a/chromium/base/win/enum_variant.cc b/chromium/base/win/enum_variant.cc index 654cfc67c13..8c845406862 100644 --- a/chromium/base/win/enum_variant.cc +++ b/chromium/base/win/enum_variant.cc @@ -35,7 +35,7 @@ HRESULT EnumVariant::Next(ULONG requested_count, return E_INVALIDARG; DCHECK_LE(current_index_, items_.size()); - ULONG available_count = ULONG{items_.size()} - current_index_; + ULONG available_count = ULONG(items_.size()) - current_index_; ULONG count = std::min(requested_count, available_count); for (ULONG i = 0; i < count; ++i) out_elements[i] = items_[current_index_ + i].Copy(); @@ -51,8 +51,8 @@ HRESULT EnumVariant::Next(ULONG requested_count, HRESULT EnumVariant::Skip(ULONG skip_count) { ULONG count = skip_count; - if (current_index_ + count > ULONG{items_.size()}) - count = ULONG{items_.size()} - current_index_; + if (current_index_ + count > ULONG(items_.size())) + count = ULONG(items_.size()) - current_index_; current_index_ += count; return (count == skip_count ? S_OK : S_FALSE); @@ -69,7 +69,7 @@ HRESULT EnumVariant::Clone(IEnumVARIANT** out_cloned_object) { size_t count = items_.size(); Microsoft::WRL::ComPtr<EnumVariant> other = - Microsoft::WRL::Make<EnumVariant>(ULONG{count}); + Microsoft::WRL::Make<EnumVariant>(ULONG(count)); for (size_t i = 0; i < count; ++i) other->items_[i] = static_cast<const VARIANT&>(items_[i]); diff --git a/chromium/cc/input/scrollbar_animation_controller.cc b/chromium/cc/input/scrollbar_animation_controller.cc index ec851edea31..32c088a2867 100644 --- a/chromium/cc/input/scrollbar_animation_controller.cc +++ b/chromium/cc/input/scrollbar_animation_controller.cc @@ -160,7 +160,7 @@ bool ScrollbarAnimationController::Animate(base::TimeTicks now) { float ScrollbarAnimationController::AnimationProgressAtTime( base::TimeTicks now) { const base::TimeDelta delta = now - last_awaken_time_; - return base::ClampToRange(float{delta / fade_duration_}, 0.0f, 1.0f); + return base::ClampToRange(float(delta / fade_duration_), 0.0f, 1.0f); } void ScrollbarAnimationController::RunAnimationFrame(float progress) { diff --git a/chromium/cc/input/single_scrollbar_animation_controller_thinning.cc b/chromium/cc/input/single_scrollbar_animation_controller_thinning.cc index 75a458650f3..7e25420efdc 100644 --- a/chromium/cc/input/single_scrollbar_animation_controller_thinning.cc +++ b/chromium/cc/input/single_scrollbar_animation_controller_thinning.cc @@ -99,7 +99,7 @@ float SingleScrollbarAnimationControllerThinning::AnimationProgressAtTime( return 1.0f; const base::TimeDelta delta = now - last_awaken_time_; - return base::ClampToRange(float{delta / thinning_duration_}, 0.0f, 1.0f); + return base::ClampToRange(float(delta / thinning_duration_), 0.0f, 1.0f); } void SingleScrollbarAnimationControllerThinning::RunAnimationFrame( diff --git a/chromium/cc/layers/mirror_layer_impl.h b/chromium/cc/layers/mirror_layer_impl.h index 3ccf20183c1..e7f89b025f6 100644 --- a/chromium/cc/layers/mirror_layer_impl.h +++ b/chromium/cc/layers/mirror_layer_impl.h @@ -55,7 +55,7 @@ class CC_EXPORT MirrorLayerImpl : public LayerImpl { private: const char* LayerTypeAsString() const override; viz::CompositorRenderPassId mirrored_layer_render_pass_id() const { - return viz::CompositorRenderPassId{mirrored_layer_id()}; + return viz::CompositorRenderPassId(mirrored_layer_id()); } int mirrored_layer_id_ = 0; diff --git a/chromium/cc/metrics/frame_sequence_metrics.cc b/chromium/cc/metrics/frame_sequence_metrics.cc index 30259bd2a9c..17de3f0f732 100644 --- a/chromium/cc/metrics/frame_sequence_metrics.cc +++ b/chromium/cc/metrics/frame_sequence_metrics.cc @@ -225,7 +225,7 @@ void FrameSequenceMetrics::ReportMetrics() { .Run({ main_throughput_.frames_expected, main_throughput_.frames_produced, - jank_reporter_->jank_count(), + uint32_t(jank_reporter_->jank_count()), }); main_throughput_ = {}; diff --git a/chromium/cc/metrics/video_playback_roughness_reporter.cc b/chromium/cc/metrics/video_playback_roughness_reporter.cc index 33ef9c517be..df000677278 100644 --- a/chromium/cc/metrics/video_playback_roughness_reporter.cc +++ b/chromium/cc/metrics/video_playback_roughness_reporter.cc @@ -60,7 +60,7 @@ void VideoPlaybackRoughnessReporter::FrameSubmitted( FrameInfo info; info.token = token; info.decode_time = frame.metadata().decode_end_time; - info.refresh_rate_hz = int{std::round(1.0 / render_interval.InSecondsF())}; + info.refresh_rate_hz = int(std::round(1.0 / render_interval.InSecondsF())); info.size = frame.natural_size(); info.intended_duration = frame.metadata().wallclock_frame_duration; diff --git a/chromium/cc/paint/paint_op_buffer.h b/chromium/cc/paint/paint_op_buffer.h index aafee1295a1..7ede03341af 100644 --- a/chromium/cc/paint/paint_op_buffer.h +++ b/chromium/cc/paint/paint_op_buffer.h @@ -1092,7 +1092,7 @@ class CC_PAINT_EXPORT PaintOpBuffer : public SkRefCnt { uint16_t skip = static_cast<uint16_t>(ComputeOpSkip(sizeof(T))); T* op = reinterpret_cast<T*>(AllocatePaintOp(skip)); - new (op) T{std::forward<Args>(args)...}; + new (op) T(std::forward<Args>(args)...); DCHECK_EQ(op->type, static_cast<uint32_t>(T::kType)); op->skip = skip; AnalyzeAddedOp(op); diff --git a/chromium/cc/tiles/gpu_image_decode_cache.cc b/chromium/cc/tiles/gpu_image_decode_cache.cc index e61eefa6f15..17f00ef554a 100644 --- a/chromium/cc/tiles/gpu_image_decode_cache.cc +++ b/chromium/cc/tiles/gpu_image_decode_cache.cc @@ -2960,7 +2960,7 @@ sk_sp<SkImage> GpuImageDecodeCache::CreateImageFromYUVATexturesInternal( DCHECK(uploaded_y_image); DCHECK(uploaded_u_image); DCHECK(uploaded_v_image); - SkYUVAInfo yuva_info({image_width, image_height}, yuva_plane_config, + SkYUVAInfo yuva_info({int(image_width), int(image_height)}, yuva_plane_config, yuva_subsampling, yuv_color_space); GrBackendTexture yuv_textures[3]{}; yuv_textures[0] = uploaded_y_image->getBackendTexture(false); diff --git a/chromium/components/crx_file/crx_creator.cc b/chromium/components/crx_file/crx_creator.cc index be342042620..9180a69f1db 100644 --- a/chromium/components/crx_file/crx_creator.cc +++ b/chromium/components/crx_file/crx_creator.cc @@ -73,8 +73,8 @@ CreatorResult SignArchiveAndCreateHeader(const base::FilePath& output_path, signed_header_data.SerializeAsString(); const int signed_header_size = signed_header_data_str.size(); const uint8_t signed_header_size_octets[] = { - signed_header_size, signed_header_size >> 8, signed_header_size >> 16, - signed_header_size >> 24}; + uint8_t(signed_header_size), uint8_t(signed_header_size >> 8), + uint8_t(signed_header_size >> 16), uint8_t(signed_header_size >> 24)}; // Create a signer, init with purpose, SignedData length, run SignedData // through, run ZIP through. @@ -106,8 +106,9 @@ CreatorResult WriteCRX(const CrxFileHeader& header, base::File* file) { const std::string header_str = header.SerializeAsString(); const int header_size = header_str.size(); - const uint8_t header_size_octets[] = {header_size, header_size >> 8, - header_size >> 16, header_size >> 24}; + const uint8_t header_size_octets[] = { + uint8_t(header_size), uint8_t(header_size >> 8), + uint8_t(header_size >> 16), uint8_t(header_size >> 24)}; const uint8_t format_version_octets[] = {3, 0, 0, 0}; base::File crx(output_path, diff --git a/chromium/components/crx_file/crx_verifier.cc b/chromium/components/crx_file/crx_verifier.cc index 0d7f97a6d89..8780da01cb8 100644 --- a/chromium/components/crx_file/crx_verifier.cc +++ b/chromium/components/crx_file/crx_verifier.cc @@ -133,8 +133,8 @@ VerifierResult VerifyCrx3( // Create a little-endian representation of [signed-header-size]. const int signed_header_size = signed_header_data_str.size(); const uint8_t header_size_octets[] = { - signed_header_size, signed_header_size >> 8, signed_header_size >> 16, - signed_header_size >> 24}; + uint8_t(signed_header_size), uint8_t(signed_header_size >> 8), + uint8_t(signed_header_size >> 16), uint8_t(signed_header_size >> 24)}; // Create a set of all required key hashes. std::set<std::vector<uint8_t>> required_key_set(required_key_hashes.begin(), diff --git a/chromium/components/pdf/renderer/pdf_ax_action_target.cc b/chromium/components/pdf/renderer/pdf_ax_action_target.cc index 597349587e9..a8b95ea8552 100644 --- a/chromium/components/pdf/renderer/pdf_ax_action_target.cc +++ b/chromium/components/pdf/renderer/pdf_ax_action_target.cc @@ -140,10 +140,10 @@ bool PdfAXActionTarget::SetSelection(const ui::AXActionTarget* anchor_object, } pdf_action_data.action = PP_PdfAccessibilityAction::PP_PDF_SET_SELECTION; pdf_action_data.target_rect = { - {target_plugin_node_.data().relative_bounds.bounds.x(), - target_plugin_node_.data().relative_bounds.bounds.y()}, - {target_plugin_node_.data().relative_bounds.bounds.width(), - target_plugin_node_.data().relative_bounds.bounds.height()}}; + {int(target_plugin_node_.data().relative_bounds.bounds.x()), + int(target_plugin_node_.data().relative_bounds.bounds.y())}, + {int(target_plugin_node_.data().relative_bounds.bounds.width()), + int(target_plugin_node_.data().relative_bounds.bounds.height())}}; pdf_accessibility_tree_source_->HandleAction(pdf_action_data); return true; } @@ -169,10 +169,10 @@ bool PdfAXActionTarget::ScrollToMakeVisibleWithSubFocus( pdf_action_data.vertical_scroll_alignment = ConvertAXScrollToPdfScrollAlignment(vertical_scroll_alignment); pdf_action_data.target_rect = { - {target_plugin_node_.data().relative_bounds.bounds.x(), - target_plugin_node_.data().relative_bounds.bounds.y()}, - {target_plugin_node_.data().relative_bounds.bounds.width(), - target_plugin_node_.data().relative_bounds.bounds.height()}}; + {int32_t(target_plugin_node_.data().relative_bounds.bounds.x()), + int32_t(target_plugin_node_.data().relative_bounds.bounds.y())}, + {int32_t(target_plugin_node_.data().relative_bounds.bounds.width()), + int32_t(target_plugin_node_.data().relative_bounds.bounds.height())}}; pdf_accessibility_tree_source_->HandleAction(pdf_action_data); return true; } @@ -183,10 +183,10 @@ bool PdfAXActionTarget::ScrollToGlobalPoint(const gfx::Point& point) const { PP_PdfAccessibilityAction::PP_PDF_SCROLL_TO_GLOBAL_POINT; pdf_action_data.target_point = {point.x(), point.y()}; pdf_action_data.target_rect = { - {target_plugin_node_.data().relative_bounds.bounds.x(), - target_plugin_node_.data().relative_bounds.bounds.y()}, - {target_plugin_node_.data().relative_bounds.bounds.width(), - target_plugin_node_.data().relative_bounds.bounds.height()}}; + {int32_t(target_plugin_node_.data().relative_bounds.bounds.x()), + int32_t(target_plugin_node_.data().relative_bounds.bounds.y())}, + {int32_t(target_plugin_node_.data().relative_bounds.bounds.width()), + int32_t(target_plugin_node_.data().relative_bounds.bounds.height())}}; pdf_accessibility_tree_source_->HandleAction(pdf_action_data); return true; } diff --git a/chromium/components/viz/common/gl_scaler.cc b/chromium/components/viz/common/gl_scaler.cc index 129fc129987..5d97d3384e4 100644 --- a/chromium/components/viz/common/gl_scaler.cc +++ b/chromium/components/viz/common/gl_scaler.cc @@ -1408,8 +1408,8 @@ void GLScaler::ScalerStage::ScaleToMultipleOutputs( gfx::RectF GLScaler::ScalerStage::ToSourceRect( const gfx::Rect& output_rect) const { return gfx::ScaleRect(gfx::RectF(output_rect), - float{scale_from_.x()} / scale_to_.x(), - float{scale_from_.y()} / scale_to_.y()); + float(scale_from_.x()) / scale_to_.x(), + float(scale_from_.y()) / scale_to_.y()); } gfx::Rect GLScaler::ScalerStage::ToInputRect(gfx::RectF source_rect) const { diff --git a/chromium/content/browser/accessibility/browser_accessibility.cc b/chromium/content/browser/accessibility/browser_accessibility.cc index 394b756777c..e13e8eb91a1 100644 --- a/chromium/content/browser/accessibility/browser_accessibility.cc +++ b/chromium/content/browser/accessibility/browser_accessibility.cc @@ -1424,12 +1424,12 @@ const ui::AXTree::Selection BrowserAccessibility::GetUnignoredSelection() manager()->GetFromID(selection.anchor_object_id); if (anchor_object && !anchor_object->PlatformIsLeaf()) { DCHECK_GE(selection.anchor_offset, 0); - if (size_t{selection.anchor_offset} < + if (size_t(selection.anchor_offset) < anchor_object->node()->children().size()) { const ui::AXNode* anchor_child = anchor_object->node()->children()[selection.anchor_offset]; DCHECK(anchor_child); - selection.anchor_offset = int{anchor_child->GetUnignoredIndexInParent()}; + selection.anchor_offset = int(anchor_child->GetUnignoredIndexInParent()); } else { selection.anchor_offset = anchor_object->GetChildCount(); } @@ -1439,12 +1439,12 @@ const ui::AXTree::Selection BrowserAccessibility::GetUnignoredSelection() manager()->GetFromID(selection.focus_object_id); if (focus_object && !focus_object->PlatformIsLeaf()) { DCHECK_GE(selection.focus_offset, 0); - if (size_t{selection.focus_offset} < + if (size_t(selection.focus_offset) < focus_object->node()->children().size()) { const ui::AXNode* focus_child = focus_object->node()->children()[selection.focus_offset]; DCHECK(focus_child); - selection.focus_offset = int{focus_child->GetUnignoredIndexInParent()}; + selection.focus_offset = int(focus_child->GetUnignoredIndexInParent()); } else { selection.focus_offset = focus_object->GetChildCount(); } @@ -1480,7 +1480,7 @@ gfx::NativeViewAccessible BrowserAccessibility::GetParent() { } int BrowserAccessibility::GetChildCount() const { - return int{PlatformChildCount()}; + return int(PlatformChildCount()); } gfx::NativeViewAccessible BrowserAccessibility::ChildAtIndex(int index) { @@ -1898,16 +1898,16 @@ bool BrowserAccessibility::AccessibilityPerformAction( if (!anchor_object->PlatformIsLeaf()) { DCHECK_GE(selection.anchor_offset, 0); const BrowserAccessibility* anchor_child = - anchor_object->InternalGetChild(uint32_t{selection.anchor_offset}); + anchor_object->InternalGetChild(uint32_t(selection.anchor_offset)); if (anchor_child) { selection.anchor_offset = - int{anchor_child->node()->index_in_parent()}; + int(anchor_child->node()->index_in_parent()); selection.anchor_node_id = anchor_child->node()->parent()->id(); } else { // Since the child was not found, the only alternative is that this is // an "after children" position. selection.anchor_offset = - int{anchor_object->node()->children().size()}; + int(anchor_object->node()->children().size()); } } @@ -1921,14 +1921,14 @@ bool BrowserAccessibility::AccessibilityPerformAction( if (!focus_object->PlatformIsLeaf()) { DCHECK_GE(selection.focus_offset, 0); const BrowserAccessibility* focus_child = - focus_object->InternalGetChild(uint32_t{selection.focus_offset}); + focus_object->InternalGetChild(uint32_t(selection.focus_offset)); if (focus_child) { - selection.focus_offset = int{focus_child->node()->index_in_parent()}; + selection.focus_offset = int(focus_child->node()->index_in_parent()); selection.focus_node_id = focus_child->node()->parent()->id(); } else { // Since the child was not found, the only alternative is that this is // an "after children" position. - selection.focus_offset = int{focus_object->node()->children().size()}; + selection.focus_offset = int(focus_object->node()->children().size()); } } diff --git a/chromium/content/browser/accessibility/browser_accessibility_manager.cc b/chromium/content/browser/accessibility/browser_accessibility_manager.cc index e9b52f160c9..b893140dec4 100644 --- a/chromium/content/browser/accessibility/browser_accessibility_manager.cc +++ b/chromium/content/browser/accessibility/browser_accessibility_manager.cc @@ -463,7 +463,7 @@ bool BrowserAccessibilityManager::OnAccessibilityEvents( // means a node just got repeated or something harmless like that, // but it should still be investigated and could be the sign of a // performance issue. - DCHECK_LE(int{tree_update.nodes.size()}, ax_tree()->size()); + DCHECK_LE(int(tree_update.nodes.size()), ax_tree()->size()); } // If this page is hidden by an interstitial, suppress all events. diff --git a/chromium/content/browser/download/download_manager_impl.cc b/chromium/content/browser/download/download_manager_impl.cc index d62a36a287c..55a65906247 100644 --- a/chromium/content/browser/download/download_manager_impl.cc +++ b/chromium/content/browser/download/download_manager_impl.cc @@ -1289,7 +1289,7 @@ void DownloadManagerImpl::BeginResourceDownloadOnChecksComplete( } } - DCHECK_EQ(params->url().SchemeIsBlob(), bool{blob_url_loader_factory}); + DCHECK_EQ(params->url().SchemeIsBlob(), bool(blob_url_loader_factory)); std::unique_ptr<network::PendingSharedURLLoaderFactory> pending_url_loader_factory; if (blob_url_loader_factory) { diff --git a/chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc b/chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc index 4772e275b75..b43d23fce76 100644 --- a/chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc +++ b/chromium/content/renderer/pepper/pepper_plugin_instance_impl.cc @@ -1867,7 +1867,7 @@ void PepperPluginInstanceImpl::PrintPage(int page_number, metafile_ = metafile; } - PP_PrintPageNumberRange_Dev page_range = {page_number, page_number}; + PP_PrintPageNumberRange_Dev page_range = {uint32_t(page_number), uint32_t(page_number)}; ranges_.push_back(page_range); #endif } diff --git a/chromium/device/fido/public_key_credential_params.cc b/chromium/device/fido/public_key_credential_params.cc index cd0ec5701e5..ab6da5d26cd 100644 --- a/chromium/device/fido/public_key_credential_params.cc +++ b/chromium/device/fido/public_key_credential_params.cc @@ -39,7 +39,8 @@ PublicKeyCredentialParams::CreateFromCBORValue(const cbor::Value& cbor_value) { } credential_params.push_back(PublicKeyCredentialParams::CredentialInfo{ - CredentialType::kPublicKey, algorithm_type_it->second.GetInteger()}); + CredentialType::kPublicKey, + static_cast<int>(algorithm_type_it->second.GetInteger())}); } return PublicKeyCredentialParams(std::move(credential_params)); diff --git a/chromium/device/fido/win/type_conversions.cc b/chromium/device/fido/win/type_conversions.cc index 9b7f74420ba..e8458fbb863 100644 --- a/chromium/device/fido/win/type_conversions.cc +++ b/chromium/device/fido/win/type_conversions.cc @@ -172,7 +172,7 @@ std::vector<WEBAUTHN_CREDENTIAL> ToWinCredentialVector( } result.push_back(WEBAUTHN_CREDENTIAL{ WEBAUTHN_CREDENTIAL_CURRENT_VERSION, - credential.id().size(), + DWORD(credential.id().size()), const_cast<unsigned char*>(credential.id().data()), WEBAUTHN_CREDENTIAL_TYPE_PUBLIC_KEY, }); @@ -188,7 +188,7 @@ std::vector<WEBAUTHN_CREDENTIAL_EX> ToWinCredentialExVector( continue; } result.push_back(WEBAUTHN_CREDENTIAL_EX{ - WEBAUTHN_CREDENTIAL_EX_CURRENT_VERSION, credential.id().size(), + WEBAUTHN_CREDENTIAL_EX_CURRENT_VERSION, DWORD(credential.id().size()), const_cast<unsigned char*>(credential.id().data()), WEBAUTHN_CREDENTIAL_TYPE_PUBLIC_KEY, ToWinTransportsMask(credential.transports())}); diff --git a/chromium/device/fido/win/webauthn_api.cc b/chromium/device/fido/win/webauthn_api.cc index cfd5a2090b6..2c83fcc4a15 100644 --- a/chromium/device/fido/win/webauthn_api.cc +++ b/chromium/device/fido/win/webauthn_api.cc @@ -310,7 +310,7 @@ AuthenticatorMakeCredentialBlocking(WinWebAuthnApi* webauthn_api, kWinWebAuthnTimeoutMilliseconds, WEBAUTHN_CREDENTIALS{ 0, nullptr}, // Ignored because pExcludeCredentialList is set. - WEBAUTHN_EXTENSIONS{extensions.size(), extensions.data()}, + WEBAUTHN_EXTENSIONS{DWORD(extensions.size()), extensions.data()}, authenticator_attachment, request.resident_key_required, ToWinUserVerificationRequirement(request.user_verification), @@ -421,7 +421,7 @@ AuthenticatorGetAssertionBlocking(WinWebAuthnApi* webauthn_api, // As a workaround, MS tells us to also set the CredentialList // parameter with an accurate cCredentials count and some arbitrary // pCredentials data. - WEBAUTHN_CREDENTIALS{legacy_credentials.size(), + WEBAUTHN_CREDENTIALS{DWORD(legacy_credentials.size()), legacy_credentials.data()}, WEBAUTHN_EXTENSIONS{0, nullptr}, authenticator_attachment, diff --git a/chromium/device/gamepad/dualshock4_controller.cc b/chromium/device/gamepad/dualshock4_controller.cc index 63fc079d377..3ee4c38abe2 100644 --- a/chromium/device/gamepad/dualshock4_controller.cc +++ b/chromium/device/gamepad/dualshock4_controller.cc @@ -233,8 +233,8 @@ void Dualshock4Controller::SetVibrationUsb(double strong_magnitude, control_report.fill(0); control_report[0] = kReportId05; control_report[1] = 0x01; // motor only, don't update LEDs - control_report[4] = uint8_t{weak_magnitude * kRumbleMagnitudeMax}; - control_report[5] = uint8_t{strong_magnitude * kRumbleMagnitudeMax}; + control_report[4] = uint8_t(weak_magnitude * kRumbleMagnitudeMax); + control_report[5] = uint8_t(strong_magnitude * kRumbleMagnitudeMax); writer_->WriteOutputReport(control_report); } @@ -252,8 +252,8 @@ void Dualshock4Controller::SetVibrationBluetooth(double strong_magnitude, control_report[2] = 0x20; // unknown control_report[3] = 0xf1; // motor only, don't update LEDs control_report[4] = 0x04; // unknown - control_report[6] = uint8_t{weak_magnitude * kRumbleMagnitudeMax}; - control_report[7] = uint8_t{strong_magnitude * kRumbleMagnitudeMax}; + control_report[6] = uint8_t(weak_magnitude * kRumbleMagnitudeMax); + control_report[7] = uint8_t(strong_magnitude * kRumbleMagnitudeMax); control_report[21] = 0x43; // volume left control_report[22] = 0x43; // volume right control_report[24] = 0x4d; // volume speaker diff --git a/chromium/device/gamepad/gamepad_device_linux.cc b/chromium/device/gamepad/gamepad_device_linux.cc index 087744dbe6e..a6e20831e18 100644 --- a/chromium/device/gamepad/gamepad_device_linux.cc +++ b/chromium/device/gamepad/gamepad_device_linux.cc @@ -393,7 +393,7 @@ bool GamepadDeviceLinux::ReadEvdevSpecialKeys(Gamepad* pad) { ssize_t bytes_read; while ((bytes_read = HANDLE_EINTR( read(evdev_fd_.get(), &ev, sizeof(input_event)))) > 0) { - if (size_t{bytes_read} < sizeof(input_event)) + if (size_t(bytes_read) < sizeof(input_event)) break; if (ev.type != EV_KEY) continue; diff --git a/chromium/device/gamepad/gamepad_uma.cc b/chromium/device/gamepad/gamepad_uma.cc index eea53e55bd3..9fb930a1f41 100644 --- a/chromium/device/gamepad/gamepad_uma.cc +++ b/chromium/device/gamepad/gamepad_uma.cc @@ -19,7 +19,7 @@ void RecordConnectedGamepad(GamepadId gamepad_id) { auto gamepad_id_as_underlying_type = static_cast<std::underlying_type<GamepadId>::type>(gamepad_id); base::UmaHistogramSparse("Gamepad.KnownGamepadConnectedWithId", - int32_t{gamepad_id_as_underlying_type}); + int32_t(gamepad_id_as_underlying_type)); } void RecordUnknownGamepad(GamepadSource source) { diff --git a/chromium/device/gamepad/nintendo_controller.cc b/chromium/device/gamepad/nintendo_controller.cc index e9205a69468..963e3db28a9 100644 --- a/chromium/device/gamepad/nintendo_controller.cc +++ b/chromium/device/gamepad/nintendo_controller.cc @@ -1554,7 +1554,7 @@ void NintendoController::SubCommand(uint8_t sub_command, // Serial subcommands also carry vibration data. Configure the vibration // portion of the report for a neutral vibration effect (zero amplitude). // https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/bluetooth_hid_notes.md#output-0x12 - report_bytes[0] = uint8_t{output_report_counter_++ & 0xff}; + report_bytes[0] = uint8_t(output_report_counter_++ & 0xff); report_bytes[1] = 0x00; report_bytes[2] = 0x01; report_bytes[3] = 0x40; @@ -1608,7 +1608,7 @@ void NintendoController::RequestVibration(double left_frequency, FrequencyToHex(left_frequency, left_magnitude, &lhf, &llf, &lhfa, &llfa); FrequencyToHex(right_frequency, right_magnitude, &rhf, &rlf, &rhfa, &rlfa); std::vector<uint8_t> report_bytes(output_report_size_bytes_ - 1); - uint8_t counter = uint8_t{output_report_counter_++ & 0x0f}; + uint8_t counter = uint8_t(output_report_counter_++ & 0x0f); report_bytes[0] = counter; report_bytes[1] = lhf & 0xff; report_bytes[2] = lhfa + ((lhf >> 8) & 0xff); @@ -1635,11 +1635,11 @@ void NintendoController::RequestEnableUsbTimeout(bool enable) { } void NintendoController::RequestEnableImu(bool enable) { - SubCommand(kSubCommandEnableImu, {enable ? 0x01 : 0x00}); + SubCommand(kSubCommandEnableImu, {uint8_t(enable ? 0x01 : 0x00)}); } void NintendoController::RequestEnableVibration(bool enable) { - SubCommand(kSubCommandEnableVibration, {enable ? 0x01 : 0x00}); + SubCommand(kSubCommandEnableVibration, {uint8_t(enable ? 0x01 : 0x00)}); } void NintendoController::RequestSetPlayerLights(uint8_t light_pattern) { @@ -1658,8 +1658,8 @@ void NintendoController::RequestSetHomeLight( DCHECK_LE(cycle_count, 0xf); if ((cycle_count > 0 && minicycle_count == 1) || minicycle_duration == 0) minicycle_count = 0; - std::vector<uint8_t> bytes = {(minicycle_count << 4) | minicycle_duration, - (start_intensity << 4) | cycle_count}; + std::vector<uint8_t> bytes = {uint8_t((minicycle_count << 4) | minicycle_duration), + uint8_t((start_intensity << 4) | cycle_count)}; bytes.insert(bytes.end(), minicycle_data.begin(), minicycle_data.end()); SubCommand(kSubCommandSetHomeLight, bytes); } @@ -1676,7 +1676,7 @@ void NintendoController::RequestSetHomeLightIntensity(double intensity) { // 1x minicycle duration. Because |minicycle_count| and |cycle_count| are // both zero, the device will transition to the 1st minicycle and then stay at // |led_intensity|. - RequestSetHomeLight(0, 1, led_intensity, 0, {led_intensity << 4, 0x00}); + RequestSetHomeLight(0, 1, led_intensity, 0, {uint8_t(led_intensity << 4), 0x00}); } void NintendoController::RequestSetImuSensitivity( @@ -1699,7 +1699,7 @@ void NintendoController::ReadSpi(uint16_t address, size_t length) { uint8_t address_high = (address >> 8) & 0xff; uint8_t address_low = address & 0xff; SubCommand(kSubCommandReadSpi, - {address_low, address_high, 0x00, 0x00, uint8_t{length}}); + {address_low, address_high, 0x00, 0x00, uint8_t(length)}); } void NintendoController::RequestImuCalibration() { diff --git a/chromium/device/gamepad/raw_input_gamepad_device_win.cc b/chromium/device/gamepad/raw_input_gamepad_device_win.cc index 29a681276e6..a186b39d3b3 100644 --- a/chromium/device/gamepad/raw_input_gamepad_device_win.cc +++ b/chromium/device/gamepad/raw_input_gamepad_device_win.cc @@ -156,7 +156,7 @@ void RawInputGamepadDeviceWin::UpdateGamepad(RAWINPUT* input) { uint16_t usage_page = usages[j].UsagePage; uint16_t usage = usages[j].Usage; if (usage_page == kButtonUsagePage && usage > 0) { - size_t button_index = size_t{usage - 1}; + size_t button_index = size_t(usage - 1); if (button_index < Gamepad::kButtonsLengthCap) buttons_[button_index] = true; } else if (usage_page != kButtonUsagePage && @@ -445,8 +445,8 @@ void RawInputGamepadDeviceWin::QueryNormalButtonCapabilities( uint16_t usage_max = button_caps[i].Range.UsageMax; if (usage_min == 0 || usage_max == 0) continue; - size_t button_index_min = size_t{usage_min - 1}; - size_t button_index_max = size_t{usage_max - 1}; + size_t button_index_min = size_t(usage_min - 1); + size_t button_index_max = size_t(usage_max - 1); if (usage_page == kButtonUsagePage && button_index_min < Gamepad::kButtonsLengthCap) { button_index_max = diff --git a/chromium/device/gamepad/raw_input_gamepad_device_win.h b/chromium/device/gamepad/raw_input_gamepad_device_win.h index 25ea942b762..c0898853f6f 100644 --- a/chromium/device/gamepad/raw_input_gamepad_device_win.h +++ b/chromium/device/gamepad/raw_input_gamepad_device_win.h @@ -124,7 +124,7 @@ class RawInputGamepadDeviceWin final : public AbstractHapticGamepad { bool buttons_[Gamepad::kButtonsLengthCap]; // Keep track of which button indices are in use. - std::vector<bool> button_indices_used_{Gamepad::kButtonsLengthCap, false}; + std::vector<bool> button_indices_used_{(Gamepad::kButtonsLengthCap != 0), false}; // Bitfield to keep track of which axes indices are in use. uint32_t axes_used_ = 0; diff --git a/chromium/extensions/browser/blob_reader.cc b/chromium/extensions/browser/blob_reader.cc index 791422d84b1..5dc9eb89322 100644 --- a/chromium/extensions/browser/blob_reader.cc +++ b/chromium/extensions/browser/blob_reader.cc @@ -22,7 +22,7 @@ void BlobReader::Read(content::BrowserContext* browser_context, CHECK_GT(length, 0); CHECK_LE(offset, std::numeric_limits<int64_t>::max() - length); - absl::optional<Range> range = Range{offset, length}; + absl::optional<Range> range = Range{uint64_t(offset), uint64_t(length)}; Read(browser_context, blob_uuid, std::move(callback), std::move(range)); } diff --git a/chromium/extensions/renderer/api/automation/automation_internal_custom_bindings.cc b/chromium/extensions/renderer/api/automation/automation_internal_custom_bindings.cc index 6019937b74d..ce404e4949b 100644 --- a/chromium/extensions/renderer/api/automation/automation_internal_custom_bindings.cc +++ b/chromium/extensions/renderer/api/automation/automation_internal_custom_bindings.cc @@ -837,14 +837,14 @@ void AutomationInternalCustomBindings::AddRoutes() { else child_count = node->GetUnignoredChildCount(); - result.Set(v8::Integer::New(isolate, int32_t{child_count})); + result.Set(v8::Integer::New(isolate, int32_t(child_count))); }); RouteNodeIDFunction( "GetIndexInParent", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, AutomationAXTreeWrapper* tree_wrapper, ui::AXNode* node) { result.Set(v8::Integer::New( - isolate, int32_t{node->GetUnignoredIndexInParent()})); + isolate, int32_t(node->GetUnignoredIndexInParent()))); }); RouteNodeIDFunction( "GetRole", [](v8::Isolate* isolate, v8::ReturnValue<v8::Value> result, @@ -2351,10 +2351,10 @@ void AutomationInternalCustomBindings::GetChildIDAtIndex( // Check for a child tree, which is guaranteed to always be the only child. if (index == 0 && GetRootOfChildTree(&node, &tree_wrapper)) child_id = node->id(); - else if (index < 0 || size_t{index} >= node->GetUnignoredChildCount()) + else if (index < 0 || size_t(index) >= node->GetUnignoredChildCount()) return; else - child_id = node->GetUnignoredChildAtIndex(size_t{index})->id(); + child_id = node->GetUnignoredChildAtIndex(size_t(index))->id(); gin::DataObjectBuilder response(GetIsolate()); response.Set("treeId", tree_wrapper->GetTreeID().ToString()); diff --git a/chromium/gpu/command_buffer/service/gles2_cmd_decoder.cc b/chromium/gpu/command_buffer/service/gles2_cmd_decoder.cc index 33892f4e94f..acebb77e87c 100644 --- a/chromium/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/chromium/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -15163,7 +15163,7 @@ error::Error GLES2DecoderImpl::HandleTexImage2D(uint32_t immediate_data_size, texture_state_.tex_image_failed = true; GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); - GLint internal_format = static_cast<GLint>(c.internalformat); + GLenum internal_format = static_cast<GLenum>(c.internalformat); GLsizei width = static_cast<GLsizei>(c.width); GLsizei height = static_cast<GLsizei>(c.height); GLint border = static_cast<GLint>(c.border); @@ -15270,7 +15270,7 @@ error::Error GLES2DecoderImpl::HandleTexImage3D(uint32_t immediate_data_size, texture_state_.tex_image_failed = true; GLenum target = static_cast<GLenum>(c.target); GLint level = static_cast<GLint>(c.level); - GLint internal_format = static_cast<GLint>(c.internalformat); + GLenum internal_format = static_cast<GLenum>(c.internalformat); GLsizei width = static_cast<GLsizei>(c.width); GLsizei height = static_cast<GLsizei>(c.height); GLsizei depth = static_cast<GLsizei>(c.depth); diff --git a/chromium/gpu/vulkan/vulkan_swap_chain.cc b/chromium/gpu/vulkan/vulkan_swap_chain.cc index e7d2a28b04d..f6dc5718f78 100644 --- a/chromium/gpu/vulkan/vulkan_swap_chain.cc +++ b/chromium/gpu/vulkan/vulkan_swap_chain.cc @@ -178,7 +178,7 @@ bool VulkanSwapChain::InitializeSwapChain( .minImageCount = min_image_count, .imageFormat = surface_format.format, .imageColorSpace = surface_format.colorSpace, - .imageExtent = {image_size.width(), image_size.height()}, + .imageExtent = {(uint32_t)image_size.width(), (uint32_t)image_size.height()}; .imageArrayLayers = 1, .imageUsage = image_usage_flags, .imageSharingMode = VK_SHARING_MODE_EXCLUSIVE, diff --git a/chromium/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc b/chromium/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc index 6ba5ef76e69..c4e4b8a2d1b 100644 --- a/chromium/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc +++ b/chromium/media/gpu/windows/media_foundation_video_encode_accelerator_win.cc @@ -871,8 +871,8 @@ HRESULT MediaFoundationVideoEncodeAccelerator::PopulateInputSampleBuffer( input_texture->GetDesc(&input_desc); Microsoft::WRL::ComPtr<ID3D11Texture2D> sample_texture; - if (input_desc.Width != uint32_t{input_visible_size_.width()} || - input_desc.Height != uint32_t{input_visible_size_.height()}) { + if (input_desc.Width != uint32_t(input_visible_size_.width()) || + input_desc.Height != uint32_t(input_visible_size_.height())) { hr = PerformD3DScaling(input_texture.Get()); RETURN_ON_HR_FAILURE(hr, "Failed to perform D3D video processing", hr); sample_texture = scaled_d3d11_texture_; @@ -929,7 +929,7 @@ HRESULT MediaFoundationVideoEncodeAccelerator::PopulateInputSampleBuffer( frame->row_bytes(VideoFrame::kYPlane) * frame->rows(VideoFrame::kYPlane); uint8_t* end = dst_uv + frame->row_bytes(VideoFrame::kUVPlane) * frame->rows(VideoFrame::kUVPlane); - DCHECK_GE(std::ptrdiff_t{scoped_buffer.max_length()}, + DCHECK_GE(std::ptrdiff_t(scoped_buffer.max_length()), end - scoped_buffer.get()); if (frame->format() == PIXEL_FORMAT_NV12) { diff --git a/chromium/media/mojo/common/mojo_shared_buffer_video_frame.cc b/chromium/media/mojo/common/mojo_shared_buffer_video_frame.cc index fab1dc1b489..60b6c1d02ca 100644 --- a/chromium/media/mojo/common/mojo_shared_buffer_video_frame.cc +++ b/chromium/media/mojo/common/mojo_shared_buffer_video_frame.cc @@ -61,7 +61,7 @@ MojoSharedBufferVideoFrame::CreateDefaultForTesting( return Create( format, coded_size, visible_rect, dimensions, std::move(handle), allocation_size, - {0 /* y_offset */, coded_size.GetArea(), coded_size.GetArea() * 5 / 4}, + {0 /* y_offset */, uint32_t(coded_size.GetArea()), uint32_t(coded_size.GetArea() * 5 / 4)}, {coded_size.width(), coded_size.width() / 2, coded_size.width() / 2}, timestamp); } else { @@ -73,7 +73,7 @@ MojoSharedBufferVideoFrame::CreateDefaultForTesting( // - UVplane, full width, half height (each pair represents a 2x2 block) return Create(format, coded_size, visible_rect, dimensions, std::move(handle), allocation_size, - {0 /* y_offset */, coded_size.GetArea()}, + {0 /* y_offset */, uint32_t(coded_size.GetArea())}, {coded_size.width(), coded_size.width()}, timestamp); } } diff --git a/chromium/media/mojo/services/mojo_cdm_allocator.cc b/chromium/media/mojo/services/mojo_cdm_allocator.cc index f0b6d97c91a..a6d41d80e8d 100644 --- a/chromium/media/mojo/services/mojo_cdm_allocator.cc +++ b/chromium/media/mojo/services/mojo_cdm_allocator.cc @@ -141,7 +141,7 @@ class MojoCdmVideoFrame final : public VideoFrameImpl { natural_size, std::move(handle), buffer_size, {PlaneOffset(cdm::kYPlane), PlaneOffset(cdm::kUPlane), PlaneOffset(cdm::kVPlane)}, - {Stride(cdm::kYPlane), Stride(cdm::kUPlane), Stride(cdm::kVPlane)}, + {int(Stride(cdm::kYPlane)), int(Stride(cdm::kUPlane)), int(Stride(cdm::kVPlane))}, base::TimeDelta::FromMicroseconds(Timestamp())); // |frame| could fail to be created if the memory can't be mapped into diff --git a/chromium/media/renderers/win/media_foundation_audio_stream.cc b/chromium/media/renderers/win/media_foundation_audio_stream.cc index 68f4485e6c3..1e7b23445bb 100644 --- a/chromium/media/renderers/win/media_foundation_audio_stream.cc +++ b/chromium/media/renderers/win/media_foundation_audio_stream.cc @@ -170,7 +170,7 @@ HRESULT GetAacAudioType(const AudioDecoderConfig decoder_config, aac_wave_format->wfx.nBlockAlign = 1; size_t extra_size = wave_format_size - sizeof(WAVEFORMATEX); - aac_wave_format->wfx.cbSize = WORD{extra_size}; + aac_wave_format->wfx.cbSize = (WORD)extra_size; aac_wave_format->wPayloadType = 0; // RAW AAC aac_wave_format->wAudioProfileLevelIndication = 0xFE; // no audio profile specified diff --git a/chromium/media/renderers/win/media_foundation_renderer.cc b/chromium/media/renderers/win/media_foundation_renderer.cc index 4e97cec3b74..34915fcabb9 100644 --- a/chromium/media/renderers/win/media_foundation_renderer.cc +++ b/chromium/media/renderers/win/media_foundation_renderer.cc @@ -599,7 +599,7 @@ void MediaFoundationRenderer::OnVideoNaturalSizeChange() { << hr; native_video_size_ = {640, 320}; } else { - native_video_size_ = {native_width, native_height}; + native_video_size_ = {int(native_width), int(native_height)}; } // TODO(frankli): Use actual dest rect provided by client instead of video diff --git a/chromium/media/video/openh264_video_encoder.cc b/chromium/media/video/openh264_video_encoder.cc index fd01eea3fa5..68d9a3358a8 100644 --- a/chromium/media/video/openh264_video_encoder.cc +++ b/chromium/media/video/openh264_video_encoder.cc @@ -38,8 +38,8 @@ Status SetUpOpenH264Params(const VideoEncoder::Options& options, if (options.bitrate.has_value()) { params->iRCMode = RC_BITRATE_MODE; - params->iTargetBitrate = int{std::min( - options.bitrate.value(), uint64_t{std::numeric_limits<int>::max()})}; + params->iTargetBitrate = (int)std::min( + options.bitrate.value(), uint64_t{std::numeric_limits<int>::max()}); } else { params->iRCMode = RC_OFF_MODE; } diff --git a/chromium/media/video/video_encode_accelerator_adapter.cc b/chromium/media/video/video_encode_accelerator_adapter.cc index 8e47cf2406e..3e44f11ce96 100644 --- a/chromium/media/video/video_encode_accelerator_adapter.cc +++ b/chromium/media/video/video_encode_accelerator_adapter.cc @@ -343,10 +343,10 @@ void VideoEncodeAcceleratorAdapter::ChangeOptionsOnAcceleratorThread( std::min(options.bitrate.value_or(options.frame_size.width() * options.frame_size.height() * kVEADefaultBitratePerPixel), - uint64_t{std::numeric_limits<uint32_t>::max()}); + uint64_t(std::numeric_limits<uint32_t>::max())); - uint32_t framerate = uint32_t{std::round( - options.framerate.value_or(VideoEncodeAccelerator::kDefaultFramerate))}; + uint32_t framerate = uint32_t(std::round( + options.framerate.value_or(VideoEncodeAccelerator::kDefaultFramerate))); accelerator_->RequestEncodingParametersChange(bitrate, framerate); diff --git a/chromium/media/video/vpx_video_encoder.cc b/chromium/media/video/vpx_video_encoder.cc index f3b8b350272..d7cdd57ac29 100644 --- a/chromium/media/video/vpx_video_encoder.cc +++ b/chromium/media/video/vpx_video_encoder.cc @@ -114,7 +114,7 @@ Status SetUpVpxConfig(const VideoEncoder::Options& opts, } else { config->rc_end_usage = VPX_VBR; config->rc_target_bitrate = - double{opts.frame_size.GetCheckedArea().ValueOrDie()} / config->g_w / + double(opts.frame_size.GetCheckedArea().ValueOrDie()) / config->g_w / config->g_h * config->rc_target_bitrate; } @@ -180,8 +180,8 @@ Status ReallocateVpxImageIfNeeded(vpx_image_t* vpx_image, const vpx_img_fmt fmt, int width, int height) { - if (vpx_image->fmt != fmt || int{vpx_image->w} != width || - int{vpx_image->h} != height) { + if (vpx_image->fmt != fmt || int(vpx_image->w) != width || + int(vpx_image->h) != height) { vpx_img_free(vpx_image); if (vpx_image != vpx_img_alloc(vpx_image, fmt, width, height, 1)) { return Status(StatusCode::kEncoderFailedEncode, diff --git a/chromium/pdf/pdf_view_plugin_base.cc b/chromium/pdf/pdf_view_plugin_base.cc index 6b19a79eec9..5a40c4a13eb 100644 --- a/chromium/pdf/pdf_view_plugin_base.cc +++ b/chromium/pdf/pdf_view_plugin_base.cc @@ -663,10 +663,10 @@ void PdfViewPluginBase::UpdateScroll() { gfx::PointF PdfViewPluginBase::BoundScrollPositionToDocument( const gfx::PointF& scroll_position) { float max_x = std::max( - document_size_.width() * float{zoom_} - plugin_dip_size_.width(), 0.0f); + document_size_.width() * float(zoom_) - plugin_dip_size_.width(), 0.0f); float x = base::ClampToRange(scroll_position.x(), 0.0f, max_x); float max_y = std::max( - document_size_.height() * float{zoom_} - plugin_dip_size_.height(), 0.0f); + document_size_.height() * float(zoom_) - plugin_dip_size_.height(), 0.0f); float y = base::ClampToRange(scroll_position.y(), 0.0f, max_y); return gfx::PointF(x, y); } diff --git a/chromium/pdf/pdfium/pdfium_page.cc b/chromium/pdf/pdfium/pdfium_page.cc index c8af6ea5e58..bdf4b44a80d 100644 --- a/chromium/pdf/pdfium/pdfium_page.cc +++ b/chromium/pdf/pdfium/pdfium_page.cc @@ -850,7 +850,7 @@ PDFiumPage::Area PDFiumPage::FormTypeToArea(int form_type) { char16_t PDFiumPage::GetCharAtIndex(int index) { if (!available_) return L'\0'; - return char16_t{FPDFText_GetUnicode(GetTextPage(), index)}; + return char16_t(FPDFText_GetUnicode(GetTextPage(), index)); } int PDFiumPage::GetCharCount() { diff --git a/chromium/printing/print_settings_conversion.cc b/chromium/printing/print_settings_conversion.cc index 167e114a7b5..c6e20ce9964 100644 --- a/chromium/printing/print_settings_conversion.cc +++ b/chromium/printing/print_settings_conversion.cc @@ -91,7 +91,7 @@ PageRanges GetPageRangesFromJobSettings(const base::Value& job_settings) { // Page numbers are 1-based in the dictionary. // Page numbers are 0-based for the printing context. - page_ranges.push_back(PageRange{from.value() - 1, to.value() - 1}); + page_ranges.push_back(PageRange{uint32_t(from.value() - 1), uint32_t(to.value() - 1)}); } } return page_ranges; diff --git a/chromium/services/device/public/cpp/hid/hid_collection.cc b/chromium/services/device/public/cpp/hid/hid_collection.cc index 3b665541dec..e82f5ae2dd9 100644 --- a/chromium/services/device/public/cpp/hid/hid_collection.cc +++ b/chromium/services/device/public/cpp/hid/hid_collection.cc @@ -251,7 +251,7 @@ void HidCollection::GetMaxReportSizes(size_t* max_input_report_bits, } DCHECK_LE(report_bits, kMaxReasonableReportLengthBits); entry.max_report_bits = - std::max(entry.max_report_bits, size_t{report_bits}); + std::max(entry.max_report_bits, size_t(report_bits)); } } } diff --git a/chromium/services/device/public/cpp/hid/hid_item_state_table.cc b/chromium/services/device/public/cpp/hid/hid_item_state_table.cc index 247062c5533..6887da4fbcf 100644 --- a/chromium/services/device/public/cpp/hid/hid_item_state_table.cc +++ b/chromium/services/device/public/cpp/hid/hid_item_state_table.cc @@ -50,10 +50,10 @@ int32_t Int32FromValueAndSize(uint32_t value, size_t payload_size) { return 0; if (payload_size == 1) - return int8_t{uint8_t{value}}; + return int8_t(uint8_t(value)); if (payload_size == 2) - return int16_t{uint16_t{value}}; + return int16_t(uint16_t(value)); DCHECK_EQ(payload_size, 4u); return value; diff --git a/chromium/storage/browser/blob/blob_impl.cc b/chromium/storage/browser/blob/blob_impl.cc index d366316e02b..78cd2c4a3e2 100644 --- a/chromium/storage/browser/blob/blob_impl.cc +++ b/chromium/storage/browser/blob/blob_impl.cc @@ -221,7 +221,7 @@ void BlobImpl::CaptureSnapshot(CaptureSnapshotCallback callback) { } struct SizeAndTime { - uint64_t size; + int64_t size; absl::optional<base::Time> time; }; base::ThreadPool::PostTaskAndReplyWithResult( diff --git a/chromium/third_party/blink/renderer/core/css/counter_style.cc b/chromium/third_party/blink/renderer/core/css/counter_style.cc index b49e0fc43eb..beff44c5dae 100644 --- a/chromium/third_party/blink/renderer/core/css/counter_style.cc +++ b/chromium/third_party/blink/renderer/core/css/counter_style.cc @@ -85,7 +85,7 @@ Vector<wtf_size_t> CyclicAlgorithm(int value, wtf_size_t num_symbols) { value -= 1; if (value < 0) value += num_symbols; - return {value}; + return {wtf_size_t(value)}; } // https://drafts.csswg.org/css-counter-styles/#fixed-system @@ -95,7 +95,7 @@ Vector<wtf_size_t> FixedAlgorithm(int value, if (value < first_symbol_value || static_cast<unsigned>(value - first_symbol_value) >= num_symbols) return Vector<wtf_size_t>(); - return {value - first_symbol_value}; + return {wtf_size_t(value - first_symbol_value)}; } // https://drafts.csswg.org/css-counter-styles/#symbolic-system diff --git a/chromium/third_party/blink/renderer/core/html/anchor_element_metrics_sender.cc b/chromium/third_party/blink/renderer/core/html/anchor_element_metrics_sender.cc index 65e052da13b..f0846fc3e8a 100644 --- a/chromium/third_party/blink/renderer/core/html/anchor_element_metrics_sender.cc +++ b/chromium/third_party/blink/renderer/core/html/anchor_element_metrics_sender.cc @@ -122,7 +122,7 @@ AnchorElementMetricsSender::AnchorElementMetricsSender(Document& document) document.View()->RegisterForLifecycleNotifications(this); intersection_observer_ = IntersectionObserver::Create( - {}, {INTERSECTION_RATIO_THRESHOLD}, &document, + {}, {float(INTERSECTION_RATIO_THRESHOLD)}, &document, WTF::BindRepeating(&AnchorElementMetricsSender::UpdateVisibleAnchors, WrapWeakPersistent(this)), LocalFrameUkmAggregator::kAnchorElementMetricsIntersectionObserver, diff --git a/chromium/third_party/blink/renderer/core/inspector/inspector_dom_snapshot_agent.cc b/chromium/third_party/blink/renderer/core/inspector/inspector_dom_snapshot_agent.cc index e6b149c3123..9c492c3eaa0 100644 --- a/chromium/third_party/blink/renderer/core/inspector/inspector_dom_snapshot_agent.cc +++ b/chromium/third_party/blink/renderer/core/inspector/inspector_dom_snapshot_agent.cc @@ -61,7 +61,7 @@ std::unique_ptr<protocol::Array<double>> BuildRectForLayout(const int x, const int width, const int height) { return std::make_unique<std::vector<double>, std::initializer_list<double>>( - {x, y, width, height}); + {double(x), double(y), double(width), double(height)}); } Document* GetEmbeddedDocument(PaintLayer* layer) { diff --git a/chromium/third_party/blink/renderer/core/layout/layout_block_flow_line.cc b/chromium/third_party/blink/renderer/core/layout/layout_block_flow_line.cc index 0fa4693004d..0199915cf78 100644 --- a/chromium/third_party/blink/renderer/core/layout/layout_block_flow_line.cc +++ b/chromium/third_party/blink/renderer/core/layout/layout_block_flow_line.cc @@ -59,7 +59,7 @@ class ExpansionOpportunities { unsigned opportunities_in_run; if (text.Is8Bit()) { opportunities_in_run = Character::ExpansionOpportunityCount( - {text.Characters8() + run.start_, run.stop_ - run.start_}, + {text.Characters8() + run.start_, size_t(run.stop_ - run.start_)}, run.box_->Direction(), is_after_expansion, text_justify); } else if (run.line_layout_item_.IsCombineText()) { // Justfication applies to before and after the combined text as if @@ -69,7 +69,7 @@ class ExpansionOpportunities { is_after_expansion = true; } else { opportunities_in_run = Character::ExpansionOpportunityCount( - {text.Characters16() + run.start_, run.stop_ - run.start_}, + {text.Characters16() + run.start_, size_t(run.stop_ - run.start_)}, run.box_->Direction(), is_after_expansion, text_justify); } runs_with_expansions_.push_back(opportunities_in_run); diff --git a/chromium/third_party/blink/renderer/core/layout/layout_table_section.cc b/chromium/third_party/blink/renderer/core/layout/layout_table_section.cc index 5d96a9f30fc..1be0a20770c 100644 --- a/chromium/third_party/blink/renderer/core/layout/layout_table_section.cc +++ b/chromium/third_party/blink/renderer/core/layout/layout_table_section.cc @@ -2072,7 +2072,7 @@ void LayoutTableSection::AdjustRowForPagination(LayoutTableRow& row_object, row_is_at_top_of_column = !offset_from_top_of_page || offset_from_top_of_page <= OffsetForRepeatedHeader() || - offset_from_top_of_page <= Table()->VBorderSpacing(); + offset_from_top_of_page <= int{Table()->VBorderSpacing()}; } if (!row_is_at_top_of_column) diff --git a/chromium/third_party/blink/renderer/core/layout/line/abstract_inline_text_box.cc b/chromium/third_party/blink/renderer/core/layout/line/abstract_inline_text_box.cc index cbf40a2cfa8..1a33a329267 100644 --- a/chromium/third_party/blink/renderer/core/layout/line/abstract_inline_text_box.cc +++ b/chromium/third_party/blink/renderer/core/layout/line/abstract_inline_text_box.cc @@ -172,7 +172,7 @@ unsigned LegacyAbstractInlineTextBox::TextOffsetInFormattingContext( // return a more exact offset in our formatting context. Otherwise, we need to // approximate the offset using our associated layout object. if (node && node->IsTextNode()) { - const Position position(node, int{offset_in_parent}); + const Position position(node, int(offset_in_parent)); LayoutBlockFlow* formatting_context = NGOffsetMapping::GetInlineFormattingContextOf(position); // If "formatting_context" is not a Layout NG object, the offset mappings @@ -254,7 +254,7 @@ void AbstractInlineTextBox::GetWordBoundaries( TextBreakIterator* it = WordBreakIterator(text, 0, text.length()); absl::optional<int> word_start; - for (int offset = 0; offset != kTextBreakDone && offset < int{text.length()}; + for (int offset = 0; offset != kTextBreakDone && offset < int(text.length()); offset = it->following(offset)) { // Unlike in ICU's WordBreakIterator, a word boundary is valid only if it is // before, or immediately preceded by, an alphanumeric character, a series diff --git a/chromium/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.cc b/chromium/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.cc index 37aa2e5d2f5..30cd29faf18 100644 --- a/chromium/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.cc +++ b/chromium/third_party/blink/renderer/core/scroll/scrollbar_theme_overlay_mobile.cc @@ -16,7 +16,7 @@ namespace blink { static const WebThemeEngine::ScrollbarStyle& ScrollbarStyle() { static bool initialized = false; DEFINE_STATIC_LOCAL(WebThemeEngine::ScrollbarStyle, style, - (WebThemeEngine::ScrollbarStyle{3, 4, 0x80808080})); + (WebThemeEngine::ScrollbarStyle{3, 4, int(0x80808080)})); if (!initialized) { // During device emulation, the chrome WebThemeEngine implementation may not // be the mobile theme which can provide the overlay scrollbar styles. diff --git a/chromium/third_party/blink/renderer/modules/accessibility/ax_inline_text_box.cc b/chromium/third_party/blink/renderer/modules/accessibility/ax_inline_text_box.cc index f6f95831d8f..28e2d55354a 100644 --- a/chromium/third_party/blink/renderer/modules/accessibility/ax_inline_text_box.cc +++ b/chromium/third_party/blink/renderer/modules/accessibility/ax_inline_text_box.cc @@ -98,7 +98,7 @@ void AXInlineTextBox::TextCharacterOffsets(Vector<int>& offsets) const { Vector<float> widths; inline_text_box_->CharacterWidths(widths); - DCHECK_EQ(int{widths.size()}, TextLength()); + DCHECK_EQ(int(widths.size()), TextLength()); offsets.resize(TextLength()); float width_so_far = 0; @@ -131,8 +131,8 @@ int AXInlineTextBox::TextOffsetInFormattingContext(int offset) const { return 0; // Retrieve the text offset from the start of the layout block flow ancestor. - return int{inline_text_box_->TextOffsetInFormattingContext( - static_cast<unsigned int>(offset))}; + return int(inline_text_box_->TextOffsetInFormattingContext( + static_cast<unsigned int>(offset))); } int AXInlineTextBox::TextOffsetInContainer(int offset) const { @@ -389,7 +389,7 @@ bool AXInlineTextBox::IsLineBreakingObject() const { int AXInlineTextBox::TextLength() const { if (IsDetached()) return 0; - return int{inline_text_box_->Len()}; + return int(inline_text_box_->Len()); } void AXInlineTextBox::ClearChildren() const { diff --git a/chromium/third_party/blink/renderer/modules/accessibility/ax_node_object.cc b/chromium/third_party/blink/renderer/modules/accessibility/ax_node_object.cc index 4455cbe96ab..189db818383 100644 --- a/chromium/third_party/blink/renderer/modules/accessibility/ax_node_object.cc +++ b/chromium/third_party/blink/renderer/modules/accessibility/ax_node_object.cc @@ -3337,7 +3337,7 @@ int AXNodeObject::TextOffsetInFormattingContext(int offset) const { inline_offset_mapping->GetMappingUnitsForLayoutObject(*layout_obj); if (mapping_units.empty()) return AXObject::TextOffsetInFormattingContext(offset); - return int{mapping_units.front().TextContentStart()} + offset; + return int(mapping_units.front().TextContentStart()) + offset; } // diff --git a/chromium/third_party/blink/renderer/modules/accessibility/ax_object.cc b/chromium/third_party/blink/renderer/modules/accessibility/ax_object.cc index fa0a78a291f..6b98623db64 100644 --- a/chromium/third_party/blink/renderer/modules/accessibility/ax_object.cc +++ b/chromium/third_party/blink/renderer/modules/accessibility/ax_object.cc @@ -3749,7 +3749,7 @@ AXObject::InOrderTraversalIterator AXObject::GetInOrderTraversalIterator() { } int AXObject::ChildCountIncludingIgnored() const { - return int{ChildrenIncludingIgnored().size()}; + return int(ChildrenIncludingIgnored().size()); } AXObject* AXObject::ChildAtIncludingIgnored(int index) const { @@ -3982,12 +3982,12 @@ AXObject* AXObject::PreviousInPostOrderIncludingIgnored( } int AXObject::UnignoredChildCount() const { - return int{UnignoredChildren().size()}; + return int(UnignoredChildren().size()); } AXObject* AXObject::UnignoredChildAt(int index) const { const AXObjectVector unignored_children = UnignoredChildren(); - if (index < 0 || index >= int{unignored_children.size()}) + if (index < 0 || index >= int(unignored_children.size())) return nullptr; return unignored_children[index]; } @@ -4558,14 +4558,14 @@ int AXObject::AriaRowCount() const { if (!HasAOMPropertyOrARIAAttribute(AOMIntProperty::kRowCount, row_count)) return 0; - if (row_count > int{RowCount()}) + if (row_count > int(RowCount())) return row_count; // Spec says that if all of the rows are present in the DOM, it is // not necessary to set this attribute as the user agent can // automatically calculate the total number of rows. // It returns 0 in order not to set this attribute. - if (row_count == int{RowCount()} || row_count != -1) + if (row_count == int(RowCount()) || row_count != -1) return 0; // In the spec, -1 explicitly means an unknown number of rows. diff --git a/chromium/third_party/blink/renderer/modules/accessibility/ax_position.cc b/chromium/third_party/blink/renderer/modules/accessibility/ax_position.cc index 6f89a2c4936..62039908e1a 100644 --- a/chromium/third_party/blink/renderer/modules/accessibility/ax_position.cc +++ b/chromium/third_party/blink/renderer/modules/accessibility/ax_position.cc @@ -266,9 +266,9 @@ const AXPosition AXPosition::FromPosition( // same formatting context. int container_offset = container->TextOffsetInFormattingContext(0); int text_offset = - int{container_offset_mapping + int(container_offset_mapping ->GetTextContentOffset(parent_anchored_position) - .value_or(static_cast<unsigned int>(container_offset))} - + .value_or(static_cast<unsigned int>(container_offset))) - container_offset; DCHECK_GE(text_offset, 0); ax_position.text_offset_or_child_index_ = text_offset; @@ -463,8 +463,8 @@ int AXPosition::MaxTextOffset() const { container_offset_mapping->GetMappingUnitsForNode(*container_node); if (mapping_units.empty()) return container_object_->ComputedName().length(); - return int{mapping_units.back().TextContentEnd() - - mapping_units.front().TextContentStart()}; + return int(mapping_units.back().TextContentEnd() - + mapping_units.front().TextContentStart()); } TextAffinity AXPosition::Affinity() const { diff --git a/chromium/third_party/blink/renderer/modules/accessibility/ax_selection.cc b/chromium/third_party/blink/renderer/modules/accessibility/ax_selection.cc index 2b0c51e6fd7..83af3b6c672 100644 --- a/chromium/third_party/blink/renderer/modules/accessibility/ax_selection.cc +++ b/chromium/third_party/blink/renderer/modules/accessibility/ax_selection.cc @@ -158,13 +158,13 @@ AXSelection AXSelection::FromCurrentSelection( const bool is_backward = (text_control.selectionDirection() == "backward"); const auto ax_base = AXPosition::CreatePositionInTextObject( *ax_text_control, - (is_backward ? int{text_control.selectionEnd()} - : int{text_control.selectionStart()}), + (is_backward ? int(text_control.selectionEnd()) + : int(text_control.selectionStart())), base_affinity); const auto ax_extent = AXPosition::CreatePositionInTextObject( *ax_text_control, - (is_backward ? int{text_control.selectionStart()} - : int{text_control.selectionEnd()}), + (is_backward ? int(text_control.selectionStart()) + : int(text_control.selectionEnd())), extent_affinity); if (!ax_base.IsValid() || !ax_extent.IsValid()) diff --git a/chromium/third_party/blink/renderer/modules/encoding/text_encoder_stream.cc b/chromium/third_party/blink/renderer/modules/encoding/text_encoder_stream.cc index da6a889469f..dd20625c2e8 100644 --- a/chromium/third_party/blink/renderer/modules/encoding/text_encoder_stream.cc +++ b/chromium/third_party/blink/renderer/modules/encoding/text_encoder_stream.cc @@ -102,7 +102,7 @@ class TextEncoderStream::Transformer final : public TransformStreamTransformer { private: static std::string ReplacementCharacterInUtf8() { - constexpr char kRawBytes[] = {0xEF, 0xBF, 0xBD}; + constexpr char kRawBytes[] = {(char)0xEF, (char)0xBF, (char)0xBD}; return std::string(kRawBytes, sizeof(kRawBytes)); } diff --git a/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc b/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc index 6a7e722d407..737bb2777ff 100644 --- a/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc +++ b/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc @@ -228,7 +228,7 @@ WebAXObject WebAXObject::ChildAt(unsigned index) const { if (IsDetached()) return WebAXObject(); - return WebAXObject(private_->ChildAtIncludingIgnored(int{index})); + return WebAXObject(private_->ChildAtIncludingIgnored(int(index))); } WebAXObject WebAXObject::ParentObject() const { diff --git a/chromium/third_party/blink/renderer/modules/hid/hid_device.cc b/chromium/third_party/blink/renderer/modules/hid/hid_device.cc index b10e14ebf2f..5d42e6d6784 100644 --- a/chromium/third_party/blink/renderer/modules/hid/hid_device.cc +++ b/chromium/third_party/blink/renderer/modules/hid/hid_device.cc @@ -164,7 +164,7 @@ int8_t UnitFactorExponentToInt(uint8_t unit_factor_exponent) { DCHECK_LE(unit_factor_exponent, 0x0f); // Values from 0x08 to 0x0f encode negative exponents. if (unit_factor_exponent > 0x08) - return int8_t{unit_factor_exponent} - 16; + return int8_t(unit_factor_exponent) - 16; return unit_factor_exponent; } diff --git a/chromium/third_party/blink/renderer/modules/mediastream/input_device_info.cc b/chromium/third_party/blink/renderer/modules/mediastream/input_device_info.cc index 40c6cf6da06..8e3523efb69 100644 --- a/chromium/third_party/blink/renderer/modules/mediastream/input_device_info.cc +++ b/chromium/third_party/blink/renderer/modules/mediastream/input_device_info.cc @@ -44,8 +44,8 @@ void InputDeviceInfo::SetVideoInputCapabilities( max_height = std::max(max_height, format.frame_size.height()); max_frame_rate = std::max(max_frame_rate, format.frame_rate); } - platform_capabilities_.width = {1, max_width}; - platform_capabilities_.height = {1, max_height}; + platform_capabilities_.width = {1U, uint32_t(max_width)}; + platform_capabilities_.height = {1U, uint32_t(max_height)}; platform_capabilities_.aspect_ratio = {1.0 / max_height, static_cast<double>(max_width)}; platform_capabilities_.frame_rate = {min_frame_rate, max_frame_rate}; diff --git a/chromium/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util.cc b/chromium/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util.cc index f6caec91552..b0599a717b6 100644 --- a/chromium/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util.cc +++ b/chromium/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util.cc @@ -304,8 +304,8 @@ MediaStreamSource::Capabilities ComputeCapabilitiesForVideoSource( max_height = std::max(max_height, format.frame_size.height()); max_frame_rate = std::max(max_frame_rate, format.frame_rate); } - capabilities.width = {1, max_width}; - capabilities.height = {1, max_height}; + capabilities.width = {1, unsigned(max_width)}; + capabilities.height = {1, unsigned(max_height)}; capabilities.aspect_ratio = {1.0 / max_height, static_cast<double>(max_width)}; capabilities.frame_rate = {min_frame_rate, max_frame_rate}; diff --git a/chromium/third_party/blink/renderer/modules/webcodecs/decoder_template.cc b/chromium/third_party/blink/renderer/modules/webcodecs/decoder_template.cc index 2247ac3c10e..921a079961f 100644 --- a/chromium/third_party/blink/renderer/modules/webcodecs/decoder_template.cc +++ b/chromium/third_party/blink/renderer/modules/webcodecs/decoder_template.cc @@ -338,7 +338,7 @@ bool DecoderTemplate<Traits>::ProcessConfigureRequest(Request* request) { } if (pending_decodes_.size() + 1 > - size_t{Traits::GetMaxDecodeRequests(*decoder_)}) { + size_t(Traits::GetMaxDecodeRequests(*decoder_))) { // Try again after OnDecodeDone(). return false; } @@ -369,7 +369,7 @@ bool DecoderTemplate<Traits>::ProcessDecodeRequest(Request* request) { } if (pending_decodes_.size() + 1 > - size_t{Traits::GetMaxDecodeRequests(*decoder_)}) { + size_t(Traits::GetMaxDecodeRequests(*decoder_))) { // Try again after OnDecodeDone(). return false; } @@ -420,7 +420,7 @@ bool DecoderTemplate<Traits>::ProcessFlushRequest(Request* request) { DCHECK(decoder_); if (pending_decodes_.size() + 1 > - size_t{Traits::GetMaxDecodeRequests(*decoder_)}) { + size_t(Traits::GetMaxDecodeRequests(*decoder_))) { // Try again after OnDecodeDone(). return false; } diff --git a/chromium/third_party/blink/renderer/modules/webcodecs/video_encoder.cc b/chromium/third_party/blink/renderer/modules/webcodecs/video_encoder.cc index 6d08bca1a86..04832ef4211 100644 --- a/chromium/third_party/blink/renderer/modules/webcodecs/video_encoder.cc +++ b/chromium/third_party/blink/renderer/modules/webcodecs/video_encoder.cc @@ -123,7 +123,7 @@ bool IsAcceleratedConfigurationSupported( } double max_supported_framerate = - double{supported_profile.max_framerate_numerator} / + double(supported_profile.max_framerate_numerator) / supported_profile.max_framerate_denominator; if (options.framerate.has_value() && options.framerate.value() > max_supported_framerate) { diff --git a/chromium/third_party/blink/renderer/modules/xr/xr_ray.cc b/chromium/third_party/blink/renderer/modules/xr/xr_ray.cc index 8be9ce9e129..d73069bdb88 100644 --- a/chromium/third_party/blink/renderer/modules/xr/xr_ray.cc +++ b/chromium/third_party/blink/renderer/modules/xr/xr_ray.cc @@ -136,7 +136,7 @@ DOMFloat32Array* XRRay::matrix() { TransformationMatrix matrix; const blink::FloatPoint3D desiredRayDirection = { - direction_->x(), direction_->y(), direction_->z()}; + float(direction_->x()), float(direction_->y()), float(direction_->z())}; // Translation from 0 to |origin_| is simply translation by |origin_|. // (implicit) Step 6: Let translation be the translation matrix with diff --git a/chromium/third_party/blink/renderer/modules/xr/xr_session.cc b/chromium/third_party/blink/renderer/modules/xr/xr_session.cc index 488d627568b..582c780bf7c 100644 --- a/chromium/third_party/blink/renderer/modules/xr/xr_session.cc +++ b/chromium/third_party/blink/renderer/modules/xr/xr_session.cc @@ -882,11 +882,11 @@ ScriptPromise XRSession::requestHitTestSourceForTransientInput( : MakeGarbageCollected<XRRay>(); device::mojom::blink::XRRayPtr ray_mojo = device::mojom::blink::XRRay::New(); - ray_mojo->origin = {offsetRay->origin()->x(), offsetRay->origin()->y(), - offsetRay->origin()->z()}; - ray_mojo->direction = {offsetRay->direction()->x(), - offsetRay->direction()->y(), - offsetRay->direction()->z()}; + ray_mojo->origin = {float(offsetRay->origin()->x()), float(offsetRay->origin()->y()), + float(offsetRay->origin()->z())}; + ray_mojo->direction = {float(offsetRay->direction()->x()), + float(offsetRay->direction()->y()), + float(offsetRay->direction()->z())}; auto* resolver = MakeGarbageCollected<ScriptPromiseResolver>(script_state); ScriptPromise promise = resolver->Promise(); diff --git a/chromium/third_party/blink/renderer/platform/audio/dynamics_compressor_kernel.cc b/chromium/third_party/blink/renderer/platform/audio/dynamics_compressor_kernel.cc index 5e3862d2587..36335549390 100644 --- a/chromium/third_party/blink/renderer/platform/audio/dynamics_compressor_kernel.cc +++ b/chromium/third_party/blink/renderer/platform/audio/dynamics_compressor_kernel.cc @@ -63,8 +63,8 @@ DynamicsCompressorKernel::DynamicsCompressorKernel(float sample_rate, Reset(); metering_release_k_ = - float{audio_utilities::DiscreteTimeConstantForSampleRate( - kMeteringReleaseTimeConstant, sample_rate)}; + float(audio_utilities::DiscreteTimeConstantForSampleRate( + kMeteringReleaseTimeConstant, sample_rate)); } void DynamicsCompressorKernel::SetNumberOfChannels( diff --git a/chromium/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc b/chromium/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc index c18c2b9fdf7..b98576bb34b 100644 --- a/chromium/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc +++ b/chromium/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc @@ -157,7 +157,7 @@ FontPlatformData FontCustomPlatformData::GetFontPlatformData( } SkFontArguments font_args; - font_args.setVariationDesignPosition({variation.data(), variation.size()}); + font_args.setVariationDesignPosition({variation.data(), int(variation.size())}); sk_sp<SkTypeface> sk_variation_font(base_typeface_->makeClone(font_args)); if (sk_variation_font) { diff --git a/chromium/third_party/blink/renderer/platform/fonts/opentype/open_type_math_support.cc b/chromium/third_party/blink/renderer/platform/fonts/opentype/open_type_math_support.cc index 419bde25fb8..f8f4b3029f2 100644 --- a/chromium/third_party/blink/renderer/platform/fonts/opentype/open_type_math_support.cc +++ b/chromium/third_party/blink/renderer/platform/fonts/opentype/open_type_math_support.cc @@ -229,11 +229,11 @@ OpenTypeMathSupport::GetGlyphPartRecords( auto converter = base::BindRepeating([](hb_ot_math_glyph_part_t record) -> OpenTypeMathStretchData::GlyphPartRecord { - return {record.glyph, + return {blink::Glyph(record.glyph), HarfBuzzUnitsToFloat(record.start_connector_length), HarfBuzzUnitsToFloat(record.end_connector_length), HarfBuzzUnitsToFloat(record.full_advance), - record.flags & HB_MATH_GLYPH_PART_FLAG_EXTENDER}; + bool(record.flags & HB_MATH_GLYPH_PART_FLAG_EXTENDER)}; }); Vector<OpenTypeMathStretchData::GlyphPartRecord> parts = GetHarfBuzzMathRecord( diff --git a/chromium/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.cc b/chromium/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.cc index c41eeae4d4c..d8a903118d9 100644 --- a/chromium/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.cc +++ b/chromium/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.cc @@ -378,7 +378,7 @@ void ShapeResultView::GetRunFontData( Vector<ShapeResult::RunFontData>* font_data) const { for (const auto& part : RunsOrParts()) { font_data->push_back(ShapeResult::RunFontData( - {part.run_->font_data_.get(), part.end() - part.begin()})); + {part.run_->font_data_.get(), WTF::wtf_size_t(part.end() - part.begin())})); } } diff --git a/chromium/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc b/chromium/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc index 44640ec509d..2b305eda20f 100644 --- a/chromium/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc +++ b/chromium/third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.cc @@ -197,7 +197,7 @@ void YUVAToRGBA(const avifImage* image, avifGetPixelFormatInfo(image->yuvFormat, &format_info); gfx::Point3F pixel; const int max_channel_i = (1 << image->depth) - 1; - const float max_channel = float{max_channel_i}; + const float max_channel = (float)max_channel_i; for (uint32_t j = 0; j < image->height; ++j) { const int uv_j = j >> format_info.chromaShiftY; diff --git a/chromium/third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_decoder.cc b/chromium/third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_decoder.cc index c2fa20b0988..a0d34a2b2af 100644 --- a/chromium/third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_decoder.cc +++ b/chromium/third_party/blink/renderer/platform/image-decoders/bmp/bmp_image_decoder.cc @@ -141,7 +141,7 @@ bool BMPImageDecoder::GetFileType(const FastSharedBufferReader& fast_reader, return false; file_header = fast_reader.GetConsecutiveData(decoded_offset_, kSizeOfFileHeader, buffer); - file_type = (uint16_t{file_header[0]} << 8) | uint8_t{file_header[1]}; + file_type = (uint16_t(file_header[0]) << 8) | uint8_t(file_header[1]); return true; } diff --git a/chromium/third_party/blink/renderer/platform/text/text_boundaries.cc b/chromium/third_party/blink/renderer/platform/text/text_boundaries.cc index 9bb388a70e5..61dc36dfa7e 100644 --- a/chromium/third_party/blink/renderer/platform/text/text_boundaries.cc +++ b/chromium/third_party/blink/renderer/platform/text/text_boundaries.cc @@ -55,7 +55,7 @@ int StartOfLastWordBoundaryContext(const UChar* characters, int length) { } int FindNextWordForward(const UChar* chars, int len, int position) { - TextBreakIterator* it = WordBreakIterator({chars, len}); + TextBreakIterator* it = WordBreakIterator({chars, size_t(len)}); position = it->following(position); while (position != kTextBreakDone) { @@ -72,7 +72,7 @@ int FindNextWordForward(const UChar* chars, int len, int position) { } int FindNextWordBackward(const UChar* chars, int len, int position) { - TextBreakIterator* it = WordBreakIterator({chars, len}); + TextBreakIterator* it = WordBreakIterator({chars, size_t(len)}); position = it->preceding(position); while (position != kTextBreakDone) { @@ -95,7 +95,7 @@ std::pair<int, int> FindWordBackward(const UChar* chars, DCHECK_LE(position, len); if (len == 0) return {0, 0}; - TextBreakIterator* it = WordBreakIterator({chars, len}); + TextBreakIterator* it = WordBreakIterator({chars, size_t(len)}); const int start = it->preceding(position); const int end = it->next(); if (start < 0) { @@ -110,7 +110,7 @@ std::pair<int, int> FindWordForward(const UChar* chars, int len, int position) { DCHECK_LE(position, len); if (len == 0) return {0, 0}; - TextBreakIterator* it = WordBreakIterator({chars, len}); + TextBreakIterator* it = WordBreakIterator({chars, size_t(len)}); const int end = it->following(position); const int start = it->previous(); if (end < 0) { @@ -121,13 +121,13 @@ std::pair<int, int> FindWordForward(const UChar* chars, int len, int position) { } int FindWordStartBoundary(const UChar* chars, int len, int position) { - TextBreakIterator* it = WordBreakIterator({chars, len}); + TextBreakIterator* it = WordBreakIterator({chars, size_t(len)}); it->following(position); return it->previous(); } int FindWordEndBoundary(const UChar* chars, int len, int position) { - TextBreakIterator* it = WordBreakIterator({chars, len}); + TextBreakIterator* it = WordBreakIterator({chars, size_t(len)}); int end = it->following(position); return end < 0 ? it->last() : end; } diff --git a/chromium/third_party/ced/src/compact_enc_det/compact_enc_det.cc b/chromium/third_party/ced/src/compact_enc_det/compact_enc_det.cc index fcac75a9311..b6cd50f8e4a 100644 --- a/chromium/third_party/ced/src/compact_enc_det/compact_enc_det.cc +++ b/chromium/third_party/ced/src/compact_enc_det/compact_enc_det.cc @@ -1479,7 +1479,7 @@ void InitDetectEncodingState(DetectEncodingState* destatep) { // {{0x6e,0x6c,0x5f,0x5f, 0x05,0xb2,0xae,0xa0,0x32,0xa1,0x36,0x31,0x42,0x39,0x3b,0x33,0x45,0x11,0x6f,0x00,}}, // "nl__" // // ASCII-7-bit=178 Latin1=174 UTF8=160 GB=50 CP1252=161 BIG5=49 Latin2=66 CP1251=57 CP1256=59 CP1250=51 Latin5=69 ISO-8859-15=111 [top ASCII-7-bit] -int ApplyCompressedProb(const char* iprob, int len, +int ApplyCompressedProb(const unsigned char* iprob, int len, int weight, DetectEncodingState* destatep) { int* dst = &destatep->enc_prob[0]; int* dst2 = &destatep->hint_weight[0]; @@ -1528,7 +1528,7 @@ int ApplyCompressedProb(const char* iprob, int len, // Returns subscript of largest (most probable) value [for unit test] -int TopCompressedProb(const char* iprob, int len) { +int TopCompressedProb(const unsigned char* iprob, int len) { const uint8* prob = reinterpret_cast<const uint8*>(iprob); const uint8* problimit = prob + len; int next_prob_sub = 0; diff --git a/chromium/third_party/ced/src/compact_enc_det/compact_enc_det_generated_tables.h b/chromium/third_party/ced/src/compact_enc_det/compact_enc_det_generated_tables.h index 317afb66f48..471a20c6d17 100644 --- a/chromium/third_party/ced/src/compact_enc_det/compact_enc_det_generated_tables.h +++ b/chromium/third_party/ced/src/compact_enc_det/compact_enc_det_generated_tables.h @@ -165,7 +165,7 @@ static const Encoding kMapToEncoding[NUM_RANKEDENCODING] = { // Massaged TLD or charset, followed by packed encoding probs typedef struct { - char key_prob[20]; + unsigned char key_prob[20]; } HintEntry; static const HintEntry kLangHintProbs[] = { // MaxRange 192 diff --git a/chromium/ui/accessibility/ax_language_detection.cc b/chromium/ui/accessibility/ax_language_detection.cc index b031e72166a..75f22f361fc 100644 --- a/chromium/ui/accessibility/ax_language_detection.cc +++ b/chromium/ui/accessibility/ax_language_detection.cc @@ -423,7 +423,7 @@ AXLanguageDetectionManager::GetLanguageAnnotationForStringAttribute( if (node.HasStringAttribute(ax::mojom::StringAttribute::kLanguage)) { // Use author-provided language if present. language_annotation.push_back(AXLanguageSpan{ - 0 /* start_index */, attr_value.length() /* end_index */, + 0 /* start_index */, int(attr_value.length()) /* end_index */, node.GetStringAttribute( ax::mojom::StringAttribute::kLanguage) /* language */, 1 /* probability */}); diff --git a/chromium/ui/accessibility/ax_node.cc b/chromium/ui/accessibility/ax_node.cc index e6cf4b3c4df..ad4c6f14cd5 100644 --- a/chromium/ui/accessibility/ax_node.cc +++ b/chromium/ui/accessibility/ax_node.cc @@ -661,7 +661,7 @@ std::u16string AXNode::GetHypertext() const { // Note that the word "hypertext" comes from the IAccessible2 Standard and // has nothing to do with HTML. const std::u16string embedded_character_str(kEmbeddedCharacter); - DCHECK_EQ(int{embedded_character_str.length()}, kEmbeddedCharacterLength); + DCHECK_EQ(int(embedded_character_str.length()), kEmbeddedCharacterLength); for (size_t i = 0; i < GetUnignoredChildCountCrossingTreeBoundary(); ++i) { const AXNode* child = GetUnignoredChildAtIndexCrossingTreeBoundary(i); // Similar to Firefox, we don't expose text nodes in IAccessible2 and ATK @@ -670,10 +670,10 @@ std::u16string AXNode::GetHypertext() const { if (child->IsText()) { hypertext_.hypertext += base::UTF8ToUTF16(child->GetInnerText()); } else { - int character_offset = int{hypertext_.hypertext.size()}; + int character_offset = int(hypertext_.hypertext.size()); auto inserted = hypertext_.hypertext_offset_to_hyperlink_child_index.emplace( - character_offset, int{i}); + character_offset, int(i)); DCHECK(inserted.second) << "An embedded object at " << character_offset << " has already been encountered."; hypertext_.hypertext += embedded_character_str; @@ -810,7 +810,7 @@ int AXNode::GetInnerTextLength() const { // computing the length of their inner text if that text should be derived // from their descendant nodes. if (node->IsLeaf() && !is_atomic_text_field_with_descendants) - return int{node->GetInnerText().length()}; + return int(node->GetInnerText().length()); int inner_text_length = 0; for (auto it = node->UnignoredChildrenBegin(); @@ -866,7 +866,7 @@ absl::optional<int> AXNode::GetTableColCount() const { const AXTableInfo* table_info = GetAncestorTableInfo(); if (!table_info) return absl::nullopt; - return int{table_info->col_count}; + return int(table_info->col_count); } absl::optional<int> AXNode::GetTableRowCount() const { @@ -874,7 +874,7 @@ absl::optional<int> AXNode::GetTableRowCount() const { const AXTableInfo* table_info = GetAncestorTableInfo(); if (!table_info) return absl::nullopt; - return int{table_info->row_count}; + return int(table_info->row_count); } absl::optional<int> AXNode::GetTableAriaColCount() const { @@ -918,11 +918,11 @@ AXNode* AXNode::GetTableCellFromIndex(int index) const { return nullptr; // There is a table but there is no cell with the given index. - if (index < 0 || size_t{index} >= table_info->unique_cell_ids.size()) { + if (index < 0 || size_t(index) >= table_info->unique_cell_ids.size()) { return nullptr; } - return tree_->GetFromId(table_info->unique_cell_ids[size_t{index}]); + return tree_->GetFromId(table_info->unique_cell_ids[size_t(index)]); } AXNode* AXNode::GetTableCaption() const { @@ -941,13 +941,13 @@ AXNode* AXNode::GetTableCellFromCoords(int row_index, int col_index) const { return nullptr; // There is a table but the given coordinates are outside the table. - if (row_index < 0 || size_t{row_index} >= table_info->row_count || - col_index < 0 || size_t{col_index} >= table_info->col_count) { + if (row_index < 0 || size_t(row_index) >= table_info->row_count || + col_index < 0 || size_t(col_index) >= table_info->col_count) { return nullptr; } return tree_->GetFromId( - table_info->cell_ids[size_t{row_index}][size_t{col_index}]); + table_info->cell_ids[size_t(row_index)][size_t(col_index)]); } std::vector<AXNodeID> AXNode::GetTableColHeaderNodeIds() const { @@ -972,10 +972,10 @@ std::vector<AXNodeID> AXNode::GetTableColHeaderNodeIds(int col_index) const { if (!table_info) return std::vector<AXNodeID>(); - if (col_index < 0 || size_t{col_index} >= table_info->col_count) + if (col_index < 0 || size_t(col_index) >= table_info->col_count) return std::vector<AXNodeID>(); - return std::vector<AXNodeID>(table_info->col_headers[size_t{col_index}]); + return std::vector<AXNodeID>(table_info->col_headers[(size_t)col_index]); } std::vector<AXNodeID> AXNode::GetTableRowHeaderNodeIds(int row_index) const { @@ -984,10 +984,10 @@ std::vector<AXNodeID> AXNode::GetTableRowHeaderNodeIds(int row_index) const { if (!table_info) return std::vector<AXNodeID>(); - if (row_index < 0 || size_t{row_index} >= table_info->row_count) + if (row_index < 0 || size_t(row_index) >= table_info->row_count) return std::vector<AXNodeID>(); - return std::vector<AXNodeID>(table_info->row_headers[size_t{row_index}]); + return std::vector<AXNodeID>(table_info->row_headers[size_t(row_index)]); } std::vector<AXNodeID> AXNode::GetTableUniqueCellIds() const { @@ -1028,7 +1028,7 @@ absl::optional<int> AXNode::GetTableRowRowIndex() const { const auto& iter = table_info->row_id_to_index.find(id()); if (iter == table_info->row_id_to_index.end()) return absl::nullopt; - return int{iter->second}; + return int(iter->second); } std::vector<AXNodeID> AXNode::GetTableRowNodeIds() const { @@ -1090,7 +1090,7 @@ absl::optional<int> AXNode::GetTableCellIndex() const { const auto& iter = table_info->cell_id_to_index.find(id()); if (iter != table_info->cell_id_to_index.end()) - return int{iter->second}; + return int(iter->second); return absl::nullopt; } @@ -1103,7 +1103,7 @@ absl::optional<int> AXNode::GetTableCellColIndex() const { if (!index) return absl::nullopt; - return int{table_info->cell_data_vector[*index].col_index}; + return int(table_info->cell_data_vector[*index].col_index); } absl::optional<int> AXNode::GetTableCellRowIndex() const { @@ -1115,7 +1115,7 @@ absl::optional<int> AXNode::GetTableCellRowIndex() const { if (!index) return absl::nullopt; - return int{table_info->cell_data_vector[*index].row_index}; + return int(table_info->cell_data_vector[*index].row_index); } absl::optional<int> AXNode::GetTableCellColSpan() const { @@ -1153,7 +1153,7 @@ absl::optional<int> AXNode::GetTableCellAriaColIndex() const { if (!index) return absl::nullopt; - return int{table_info->cell_data_vector[*index].aria_col_index}; + return int(table_info->cell_data_vector[*index].aria_col_index); } absl::optional<int> AXNode::GetTableCellAriaRowIndex() const { @@ -1165,7 +1165,7 @@ absl::optional<int> AXNode::GetTableCellAriaRowIndex() const { if (!index) return absl::nullopt; - return int{table_info->cell_data_vector[*index].aria_row_index}; + return int(table_info->cell_data_vector[*index].aria_row_index); } std::vector<AXNodeID> AXNode::GetTableCellColHeaderNodeIds() const { diff --git a/chromium/ui/accessibility/ax_position.h b/chromium/ui/accessibility/ax_position.h index da51be470a5..4ea73710043 100644 --- a/chromium/ui/accessibility/ax_position.h +++ b/chromium/ui/accessibility/ax_position.h @@ -348,9 +348,9 @@ class AXPosition { const std::u16string text = GetText(); DCHECK_GE(text_offset_, 0); const size_t max_text_offset = text.size(); - DCHECK_LE(text_offset_, int{max_text_offset}) << text; + DCHECK_LE(text_offset_, int(max_text_offset)) << text; std::u16string annotated_text; - if (text_offset_ == int{max_text_offset}) { + if (text_offset_ == int(max_text_offset)) { annotated_text = text + u"<>"; } else { annotated_text = text.substr(0, text_offset_) + u"<" + @@ -2340,13 +2340,13 @@ class AXPosition { text_position->GetGraphemeIterator(); DCHECK_GE(text_position->text_offset_, 0); DCHECK_LE(text_position->text_offset_, - int{text_position->name_.length()}); + int(text_position->name_.length())); while ( !text_position->AtStartOfAnchor() && (!gfx::IsValidCodePointIndex(text_position->name_, - size_t{text_position->text_offset_}) || + size_t(text_position->text_offset_)) || (grapheme_iterator && !grapheme_iterator->IsGraphemeBoundary( - size_t{text_position->text_offset_})))) { + size_t(text_position->text_offset_))))) { --text_position->text_offset_; } return text_position; @@ -2390,18 +2390,18 @@ class AXPosition { // // TODO(nektar): Remove this workaround as soon as the source of the bug // is identified. - if (text_position->text_offset_ > int{text_position->name_.length()}) + if (text_position->text_offset_ > int(text_position->name_.length())) return CreateNullPosition(); DCHECK_GE(text_position->text_offset_, 0); DCHECK_LE(text_position->text_offset_, - int{text_position->name_.length()}); + int(text_position->name_.length())); while ( !text_position->AtEndOfAnchor() && (!gfx::IsValidCodePointIndex(text_position->name_, - size_t{text_position->text_offset_}) || + size_t(text_position->text_offset_)) || (grapheme_iterator && !grapheme_iterator->IsGraphemeBoundary( - size_t{text_position->text_offset_})))) { + size_t(text_position->text_offset_))))) { ++text_position->text_offset_; } @@ -2470,7 +2470,7 @@ class AXPosition { } while (text_position->text_offset_ < max_text_offset && grapheme_iterator && !grapheme_iterator->IsGraphemeBoundary( - size_t{text_position->text_offset_})); + size_t(text_position->text_offset_))); DCHECK_GT(text_position->text_offset_, 0); DCHECK_LE(text_position->text_offset_, text_position->MaxTextOffset()); @@ -2544,7 +2544,7 @@ class AXPosition { --text_position->text_offset_; } while (!text_position->AtStartOfAnchor() && grapheme_iterator && !grapheme_iterator->IsGraphemeBoundary( - size_t{text_position->text_offset_})); + size_t(text_position->text_offset_))); DCHECK_GE(text_position->text_offset_, 0); DCHECK_LT(text_position->text_offset_, text_position->MaxTextOffset()); @@ -3895,9 +3895,9 @@ class AXPosition { case AXEmbeddedObjectBehavior::kSuppressCharacter: // TODO(nektar): Switch to anchor->GetInnerTextLength() after AXPosition // switches to using UTF8. - return int{base::UTF8ToUTF16(GetAnchor()->GetInnerText()).length()}; + return int(base::UTF8ToUTF16(GetAnchor()->GetInnerText()).length()); case AXEmbeddedObjectBehavior::kExposeCharacter: - return int{GetAnchor()->GetHypertext().length()}; + return int(GetAnchor()->GetHypertext().length()); } } @@ -4008,7 +4008,7 @@ class AXPosition { int AnchorChildCount() const { if (!GetAnchor()) return 0; - return int{GetAnchor()->GetChildCountCrossingTreeBoundary()}; + return int(GetAnchor()->GetChildCountCrossingTreeBoundary()); } // When a child is ignored, it looks for unignored nodes of that child's @@ -4022,12 +4022,12 @@ class AXPosition { int AnchorUnignoredChildCount() const { if (!GetAnchor()) return 0; - return int{GetAnchor()->GetUnignoredChildCountCrossingTreeBoundary()}; + return int(GetAnchor()->GetUnignoredChildCountCrossingTreeBoundary()); } int AnchorIndexInParent() const { // If this is the root tree, the index in parent will be 0. - return GetAnchor() ? int{GetAnchor()->index_in_parent()} : INVALID_INDEX; + return GetAnchor() ? int(GetAnchor()->index_in_parent()) : INVALID_INDEX; } base::stack<AXNode*> GetAncestorAnchors() const { @@ -4829,7 +4829,7 @@ class AXPosition { // can safely move the iterator one position back, even if it's // currently at the vector's end. --offsets_iterator; - text_position->text_offset_ = int{*offsets_iterator}; + text_position->text_offset_ = int(*offsets_iterator); text_position->affinity_ = ax::mojom::TextAffinity::kDownstream; } break; @@ -4840,7 +4840,7 @@ class AXPosition { int32_t{text_position->text_offset_}); // If there is no next offset, the current offset should be unchanged. if (offsets_iterator < boundary_offsets.end()) { - text_position->text_offset_ = int{*offsets_iterator}; + text_position->text_offset_ = int(*offsets_iterator); text_position->affinity_ = ax::mojom::TextAffinity::kDownstream; } break; @@ -4875,7 +4875,7 @@ class AXPosition { return text_position->CreatePositionAtStartOfAnchor(); } else { text_position->text_offset_ = - int{boundary_offsets[boundary_offsets.size() - 1]}; + int(boundary_offsets[boundary_offsets.size() - 1]); return text_position; } break; @@ -4883,7 +4883,7 @@ class AXPosition { if (boundary_offsets.empty()) { return text_position->CreatePositionAtEndOfAnchor(); } else { - text_position->text_offset_ = int{boundary_offsets[0]}; + text_position->text_offset_ = int(boundary_offsets[0]); return text_position; } break; diff --git a/chromium/ui/accessibility/ax_range.h b/chromium/ui/accessibility/ax_range.h index 7671b17bf10..7163ec1d597 100644 --- a/chromium/ui/accessibility/ax_range.h +++ b/chromium/ui/accessibility/ax_range.h @@ -336,7 +336,7 @@ class AXRange { if (current_end_offset > start->text_offset()) { int characters_to_append = (max_count > 0) - ? std::min(max_count - int{range_text.length()}, + ? std::min(max_count - int(range_text.length()), current_end_offset - start->text_offset()) : current_end_offset - start->text_offset(); @@ -349,12 +349,12 @@ class AXRange { (found_trailing_newline && start->IsInWhiteSpace()); } - DCHECK(max_count < 0 || int{range_text.length()} <= max_count); + DCHECK(max_count < 0 || int(range_text.length()) <= max_count); is_first_unignored_leaf = false; } if (start->GetAnchor() == end->GetAnchor() || - int{range_text.length()} == max_count) { + int(range_text.length()) == max_count) { break; } else if (concatenation_behavior == AXTextConcatenationBehavior::kAsInnerText && diff --git a/chromium/ui/accessibility/ax_table_info.cc b/chromium/ui/accessibility/ax_table_info.cc index 39076ca04ad..a4d1f3fa397 100644 --- a/chromium/ui/accessibility/ax_table_info.cc +++ b/chromium/ui/accessibility/ax_table_info.cc @@ -300,12 +300,12 @@ void AXTableInfo::BuildCellDataVectorFromRowAndCellNodes( if (aria_row_count != ax::mojom::kUnknownAriaColumnOrRowCount) { aria_row_count = std::max((aria_row_count), - int{current_aria_row_index + cell_data.row_span - 1}); + int(current_aria_row_index + cell_data.row_span - 1)); } if (aria_col_count != ax::mojom::kUnknownAriaColumnOrRowCount) { aria_col_count = std::max((aria_col_count), - int{current_aria_col_index + cell_data.col_span - 1}); + int(current_aria_col_index + cell_data.col_span - 1)); } // Update |current_col_index| to reflect the next available index after // this cell including its colspan. The next column index in this row @@ -481,7 +481,7 @@ void AXTableInfo::UpdateExtraMacColumnNodeAttributes(size_t col_index) { data.int_attributes.clear(); // Update the column index. - data.AddIntAttribute(IntAttribute::kTableColumnIndex, int32_t{col_index}); + data.AddIntAttribute(IntAttribute::kTableColumnIndex, int32_t(col_index)); // Update the column header. if (!col_headers[col_index].empty()) { diff --git a/chromium/ui/accessibility/ax_text_utils.cc b/chromium/ui/accessibility/ax_text_utils.cc index eef04fb6e26..8d2e779a732 100644 --- a/chromium/ui/accessibility/ax_text_utils.cc +++ b/chromium/ui/accessibility/ax_text_utils.cc @@ -72,7 +72,7 @@ size_t FindAccessibleTextBoundary(const std::u16string& text, if (boundary == ax::mojom::TextBoundary::kLineStart) { if (direction == ax::mojom::MoveDirection::kForward) { for (int line_break : line_breaks) { - size_t clamped_line_break = size_t{std::max(0, line_break)}; + size_t clamped_line_break = (size_t)std::max(0, line_break); if ((affinity == ax::mojom::TextAffinity::kDownstream && clamped_line_break > start_offset) || (affinity == ax::mojom::TextAffinity::kUpstream && diff --git a/chromium/ui/accessibility/platform/ax_platform_node_delegate_base.cc b/chromium/ui/accessibility/platform/ax_platform_node_delegate_base.cc index 3198084626d..7934623861f 100644 --- a/chromium/ui/accessibility/platform/ax_platform_node_delegate_base.cc +++ b/chromium/ui/accessibility/platform/ax_platform_node_delegate_base.cc @@ -80,7 +80,7 @@ std::u16string AXPlatformNodeDelegateBase::GetValueForControl() const { const AXTree::Selection AXPlatformNodeDelegateBase::GetUnignoredSelection() const { - return AXTree::Selection{-1, -1, -1, ax::mojom::TextAffinity::kDownstream}; + return AXTree::Selection{true, -1, -1, ax::mojom::TextAffinity::kDownstream}; } AXNodePosition::AXPositionInstance diff --git a/chromium/ui/base/ime/win/input_method_win_base.cc b/chromium/ui/base/ime/win/input_method_win_base.cc index bc80f95a689..49ce849c04c 100644 --- a/chromium/ui/base/ime/win/input_method_win_base.cc +++ b/chromium/ui/base/ime/win/input_method_win_base.cc @@ -229,7 +229,7 @@ ui::EventDispatchDetails InputMethodWinBase::DispatchKeyEvent( // If only 1 WM_CHAR per the key event, set it as the character of it. if (char_msgs.size() == 1 && !std::iswcntrl(static_cast<wint_t>(char_msgs[0].wParam))) - event->set_character(char16_t{char_msgs[0].wParam}); + event->set_character(static_cast<char16_t>(char_msgs[0].wParam)); return ProcessUnhandledKeyEvent(event, &char_msgs); } @@ -278,7 +278,7 @@ LRESULT InputMethodWinBase::OnChar(HWND window_handle, // its text input type is ui::TEXT_INPUT_TYPE_NONE. if (GetTextInputClient()) { const char16_t kCarriageReturn = L'\r'; - const char16_t ch{wparam}; + const char16_t ch(wparam); // A mask to determine the previous key state from |lparam|. The value is 1 // if the key is down before the message is sent, or it is 0 if the key is // up. diff --git a/chromium/ui/display/win/screen_win.cc b/chromium/ui/display/win/screen_win.cc index 08be405da51..50d040ca672 100644 --- a/chromium/ui/display/win/screen_win.cc +++ b/chromium/ui/display/win/screen_win.cc @@ -60,7 +60,7 @@ absl::optional<int> GetPerMonitorDPI(HMONITOR monitor) { return absl::nullopt; DCHECK_EQ(dpi_x, dpi_y); - return int{dpi_x}; + return int(dpi_x); } float GetScaleFactorForDPI(int dpi, bool include_accessibility) { @@ -187,7 +187,7 @@ DisplaySettings GetDisplaySettingsForDevice(const wchar_t* device_name) { if (!::EnumDisplaySettings(device_name, ENUM_CURRENT_SETTINGS, &mode)) return {Display::ROTATE_0, 0}; return {OrientationToRotation(mode.dmDisplayOrientation), - mode.dmDisplayFrequency}; + int(mode.dmDisplayFrequency)}; } std::vector<DisplayInfo> FindAndRemoveTouchingDisplayInfos( @@ -454,7 +454,7 @@ std::vector<DisplayInfo> GetDisplayInfosFromSystem() { std::vector<DisplayInfo> display_infos; EnumDisplayMonitors(nullptr, nullptr, EnumMonitorForDisplayInfoCallback, reinterpret_cast<LPARAM>(&display_infos)); - DCHECK_EQ(::GetSystemMetrics(SM_CMONITORS), int{display_infos.size()}); + DCHECK_EQ(::GetSystemMetrics(SM_CMONITORS), int(display_infos.size())); return display_infos; } @@ -710,7 +710,7 @@ gfx::NativeWindow ScreenWin::GetLocalProcessWindowAtPoint( } int ScreenWin::GetNumDisplays() const { - return int{screen_win_displays_.size()}; + return int(screen_win_displays_.size()); } const std::vector<Display>& ScreenWin::GetAllDisplays() const { diff --git a/chromium/ui/display/win/uwp_text_scale_factor.cc b/chromium/ui/display/win/uwp_text_scale_factor.cc index a5be273160b..95946a3aa15 100644 --- a/chromium/ui/display/win/uwp_text_scale_factor.cc +++ b/chromium/ui/display/win/uwp_text_scale_factor.cc @@ -163,7 +163,7 @@ class UwpTextScaleFactorImpl : public UwpTextScaleFactor { // equal to 1. Let's make sure that's the case - if we don't, we could get // bizarre behavior and divide-by-zeros later on. DCHECK_GE(result, 1.0); - return float{result}; + return float(result); } private: diff --git a/chromium/ui/events/event.cc b/chromium/ui/events/event.cc index b55d5ba508f..9af9b70dafe 100644 --- a/chromium/ui/events/event.cc +++ b/chromium/ui/events/event.cc @@ -1057,7 +1057,7 @@ char16_t KeyEvent::GetCharacter() const { // Historically ui::KeyEvent has held only BMP characters. // Until this explicitly changes, require |key_| to hold a BMP character. DomKey::Base utf32_character = key_.ToCharacter(); - char16_t ucs2_character{utf32_character}; + char16_t ucs2_character(utf32_character); DCHECK_EQ(static_cast<DomKey::Base>(ucs2_character), utf32_character); // Check if the control character is down. Note that ALTGR is represented // on Windows as CTRL|ALT, so we need to make sure that is not set. diff --git a/chromium/ui/gfx/color_utils.cc b/chromium/ui/gfx/color_utils.cc index 98494103346..27c6114ed65 100644 --- a/chromium/ui/gfx/color_utils.cc +++ b/chromium/ui/gfx/color_utils.cc @@ -271,7 +271,7 @@ SkColor AlphaBlend(SkColor foreground, SkColor background, float alpha) { SkColor GetResultingPaintColor(SkColor foreground, SkColor background) { return AlphaBlend(SkColorSetA(foreground, SK_AlphaOPAQUE), background, - SkAlpha{SkColorGetA(foreground)}); + SkAlpha(SkColorGetA(foreground))); } bool IsDark(SkColor color) { diff --git a/chromium/ui/gfx/paint_throbber.cc b/chromium/ui/gfx/paint_throbber.cc index e7131745769..8e21c7052f3 100644 --- a/chromium/ui/gfx/paint_throbber.cc +++ b/chromium/ui/gfx/paint_throbber.cc @@ -174,8 +174,8 @@ void PaintThrobberSpinningAfterWaiting(Canvas* canvas, // Blend the color between "waiting" and "spinning" states. constexpr auto kColorFadeTime = base::TimeDelta::FromMilliseconds(900); - const float color_progress = float{Tween::CalculateValue( - Tween::LINEAR_OUT_SLOW_IN, std::min(elapsed_time / kColorFadeTime, 1.0))}; + const float color_progress = (float)Tween::CalculateValue( + Tween::LINEAR_OUT_SLOW_IN, std::min(elapsed_time / kColorFadeTime, 1.0)); const SkColor blend_color = color_utils::AlphaBlend(color, waiting_state->color, color_progress); diff --git a/chromium/ui/gfx/system_fonts_win.cc b/chromium/ui/gfx/system_fonts_win.cc index 58b498b8144..ae9c4295f7b 100644 --- a/chromium/ui/gfx/system_fonts_win.cc +++ b/chromium/ui/gfx/system_fonts_win.cc @@ -69,7 +69,7 @@ class SystemFonts { LOGFONT* logfont) { DCHECK_GT(font_adjustment.font_scale, 0.0); LONG new_height = - LONG{std::round(logfont->lfHeight * font_adjustment.font_scale)}; + LONG(std::round(logfont->lfHeight * font_adjustment.font_scale)); if (logfont->lfHeight && !new_height) new_height = logfont->lfHeight > 0 ? 1 : -1; logfont->lfHeight = new_height; |