update tab.cc

This commit is contained in:
Alexander Frick 2023-02-21 14:52:20 -06:00
parent 51f2997a2c
commit 284efe43e5
2 changed files with 21 additions and 45 deletions

View file

@ -545,13 +545,6 @@ void Tab::OnMouseReleased(const ui::MouseEvent& event) {
if (closest_tab)
controller_->CloseTab(closest_tab, CLOSE_TAB_FROM_MOUSE);
}
} else if (event.IsOnlyLeftMouseButton() && !event.IsShiftDown() &&
!IsSelectionModifierDown(event)) {
// If the tab was already selected mouse pressed doesn't change the
// selection. Reset it now to handle the case where multiple tabs were
// selected.
controller_->SelectTab(this, event);
}
// Close tab on double click, mirror of IsOnlyMiddleMouseButton
// Based on gz83's work.
} else if (base::CommandLine::ForCurrentProcess()->HasSwitch("double-click-close-tab")) {
@ -561,13 +554,21 @@ void Tab::OnMouseReleased(const ui::MouseEvent& event) {
} else if (closing_) {
// We're animating closed and the left mouse button was pushed on us but
// we don't contain the mouse anymore. We assume the user is clicking
// quicker than the animation and we should close the tab that falls under
// the mouse.
// quicker than the animation and we should close the tab that falls
// under the mouse.
gfx::Point location_in_parent = event.location();
ConvertPointToTarget(this, parent(), &location_in_parent);
Tab* closest_tab = controller_->GetTabAt(location_in_parent);
if (closest_tab)
controller_->CloseTab(closest_tab, CLOSE_TAB_FROM_MOUSE);
} else if (event.IsOnlyLeftMouseButton() && !event.IsShiftDown() &&
!IsSelectionModifierDown(event)) {
// If the tab was already selected mouse pressed doesn't change the
// selection. Reset it now to handle the case where multiple tabs were
// selected.
controller_->SelectTab(this, event);
}
}
}
}

View file

@ -1,4 +1,4 @@
// Copyright 2012 The Chromium Authors
// Copyright 2023 The Chromium Authors, Alex313031, and Midzer
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@ -47,12 +47,6 @@ VideoDecoderConfig::AlphaMode GetAlphaMode(const AVStream* stream) {
} // namespace
// Why AV_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are
// padded. Check here to ensure FFmpeg only receives data padded to its
// specifications.
static_assert(DecoderBuffer::kPaddingSize >= AV_INPUT_BUFFER_PADDING_SIZE,
"DecoderBuffer padding size does not fit ffmpeg requirement");
// Alignment requirement by FFmpeg for input and output buffers. This need to
// be updated to match FFmpeg when it changes.
#if defined(ARCH_CPU_ARM_FAMILY)
@ -61,12 +55,6 @@ static const int kFFmpegBufferAddressAlignment = 16;
static const int kFFmpegBufferAddressAlignment = 32;
#endif
// Check here to ensure FFmpeg only receives data aligned to its specifications.
static_assert(
DecoderBuffer::kAlignmentSize >= kFFmpegBufferAddressAlignment &&
DecoderBuffer::kAlignmentSize % kFFmpegBufferAddressAlignment == 0,
"DecoderBuffer alignment size does not fit ffmpeg requirement");
// Allows faster SIMD YUV convert. Also, FFmpeg overreads/-writes occasionally.
// See video_get_buffer() in libavcodec/utils.c.
static const int kFFmpegOutputBufferPaddingSize = 16;
@ -118,12 +106,6 @@ AudioCodec CodecIDToAudioCodec(AVCodecID codec_id) {
return AudioCodec::kPCM_S24BE;
case AV_CODEC_ID_FLAC:
return AudioCodec::kFLAC;
case AV_CODEC_ID_AMR_NB:
return AudioCodec::kAMR_NB;
case AV_CODEC_ID_AMR_WB:
return AudioCodec::kAMR_WB;
case AV_CODEC_ID_GSM_MS:
return AudioCodec::kGSM_MS;
case AV_CODEC_ID_PCM_ALAW:
return AudioCodec::kPCM_ALAW;
case AV_CODEC_ID_PCM_MULAW:
@ -179,12 +161,6 @@ AVCodecID AudioCodecToCodecID(AudioCodec audio_codec,
return AV_CODEC_ID_VORBIS;
case AudioCodec::kFLAC:
return AV_CODEC_ID_FLAC;
case AudioCodec::kAMR_NB:
return AV_CODEC_ID_AMR_NB;
case AudioCodec::kAMR_WB:
return AV_CODEC_ID_AMR_WB;
case AudioCodec::kGSM_MS:
return AV_CODEC_ID_GSM_MS;
case AudioCodec::kPCM_ALAW:
return AV_CODEC_ID_PCM_ALAW;
case AudioCodec::kPCM_MULAW:
@ -749,17 +725,16 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
AVMasteringDisplayMetadata* metadata =
reinterpret_cast<AVMasteringDisplayMetadata*>(side_data.data);
if (metadata->has_primaries) {
hdr_metadata.color_volume_metadata.primary_r =
gfx::PointF(av_q2d(metadata->display_primaries[0][0]),
av_q2d(metadata->display_primaries[0][1]));
hdr_metadata.color_volume_metadata.primary_g =
gfx::PointF(av_q2d(metadata->display_primaries[1][0]),
av_q2d(metadata->display_primaries[1][1]));
hdr_metadata.color_volume_metadata.primary_b =
gfx::PointF(av_q2d(metadata->display_primaries[2][0]),
av_q2d(metadata->display_primaries[2][1]));
hdr_metadata.color_volume_metadata.white_point = gfx::PointF(
av_q2d(metadata->white_point[0]), av_q2d(metadata->white_point[1]));
hdr_metadata.color_volume_metadata.primaries = {
static_cast<float>(av_q2d(metadata->display_primaries[0][0])),
static_cast<float>(av_q2d(metadata->display_primaries[0][1])),
static_cast<float>(av_q2d(metadata->display_primaries[1][0])),
static_cast<float>(av_q2d(metadata->display_primaries[1][1])),
static_cast<float>(av_q2d(metadata->display_primaries[2][0])),
static_cast<float>(av_q2d(metadata->display_primaries[2][1])),
static_cast<float>(av_q2d(metadata->white_point[0])),
static_cast<float>(av_q2d(metadata->white_point[1])),
};
}
if (metadata->has_luminance) {
hdr_metadata.color_volume_metadata.luminance_max =