Skip to content

Commit

Permalink
squash 'resources/unpacked/devtools' changes from ef68b16..d55d486
Browse files Browse the repository at this point in the history
d55d486 Fix horizontal scroll on Application tab side bar
b557580 Update DevTools DEPS.
70d5eb3 Update DevTools Chromium DEPS.
d33b94c Update DevTools DEPS.
892b638 Reland "Support emulating vision deficiencies"
0dce8fe Cleanup _checkWithNodeScript
50f2c19 Cleanup _CheckFormat presubmit check
251715e Remove unnecessary _CheckCSSViolations check
fd873e7 Remove Sinon and associated deps

git-subtree-dir: resources/unpacked/devtools
git-subtree-split: d55d486
  • Loading branch information
darwin committed Mar 7, 2020
1 parent e2e8684 commit c2fd23a
Show file tree
Hide file tree
Showing 237 changed files with 191 additions and 89,966 deletions.
10 changes: 5 additions & 5 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

vars = {
'build_url': 'https://chromium.googlesource.com/chromium/src/build.git',
'build_revision': 'e393474c8c5e0e8c7437574379709915e55b14f2',
'build_revision': '54fe4c7ea6338c333ec5f05c29c321fb22d9ec5d',

'buildtools_url': 'https://chromium.googlesource.com/chromium/src/buildtools.git',
'buildtools_revision': 'fa6ae42dcfbf3bf965439c0bdfeb03cf4e2a5840',

'depot_tools_url': 'https://chromium.googlesource.com/chromium/tools/depot_tools.git',
'depot_tools_revision': 'ee8be8a368620af69739f41046464630ed4f2309',
'depot_tools_revision': 'ffd02955e6680f9f5a32872682bd03227487014e',

'inspector_protocol_url': 'https://chromium.googlesource.com/deps/inspector_protocol',
'inspector_protocol_revision': '81ef742ba3587767fc08652d299df9e9b7051407',
Expand All @@ -23,11 +23,11 @@ vars = {

# Chromium build number for unit tests. It should be regularly updated to
# the content of https://commondatastorage.googleapis.com/chromium-browser-snapshots/Linux_x64/LAST_CHANGE
'chromium_linux': '747553',
'chromium_linux': '747986',
# the content of https://commondatastorage.googleapis.com/chromium-browser-snapshots/Win_x64/LAST_CHANGE
'chromium_win': '747549',
'chromium_win': '747980',
# the content of https://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac/LAST_CHANGE
'chromium_mac': '747547',
'chromium_mac': '747969',
}

# Only these hosts are allowed for dependencies in this DEPS file.
Expand Down
60 changes: 8 additions & 52 deletions PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"""

import sys
import six

EXCLUSIVE_CHANGE_DIRECTORIES = [
[ 'third_party', 'v8' ],
Expand All @@ -44,8 +45,10 @@


def _ExecuteSubProcess(input_api, output_api, script_path, args, results):
process = input_api.subprocess.Popen(
[input_api.python_executable, script_path] + args, stdout=input_api.subprocess.PIPE, stderr=input_api.subprocess.STDOUT)
if isinstance(script_path, six.string_types):
script_path = [input_api.python_executable, script_path]

process = input_api.subprocess.Popen(script_path + args, stdout=input_api.subprocess.PIPE, stderr=input_api.subprocess.STDOUT)
out, _ = process.communicate()
if process.returncode != 0:
results.append(output_api.PresubmitError(out))
Expand Down Expand Up @@ -113,16 +116,8 @@ def _CheckLicenses(input_api, output_api):

def _CheckFormat(input_api, output_api):
results = [output_api.PresubmitNotifyResult('Running Format Checks:')]
def popen(args):
return input_api.subprocess.Popen(args=args, stdout=input_api.subprocess.PIPE, stderr=input_api.subprocess.STDOUT)

format_args = ['git', 'cl', 'format', '--js']
format_process = popen(format_args)
format_out, _ = format_process.communicate()
if format_process.returncode != 0:
results.append(output_api.PresubmitError(format_out))

return results
return _ExecuteSubProcess(input_api, output_api, ['git', 'cl', 'format', '--js'], [], results)


def _CheckDevtoolsLocalization(input_api, output_api, check_all_files=False): # pylint: disable=invalid-name
Expand Down Expand Up @@ -186,18 +181,6 @@ def _CheckOptimizeSVGHashes(input_api, output_api):
return results


def _CheckCSSViolations(input_api, output_api):
results = [output_api.PresubmitNotifyResult('Running CSS Violation Check:')]
for f in input_api.AffectedFiles(include_deletes=False):
if not f.LocalPath().endswith('.css'):
continue
for line_number, line in f.ChangedContents():
if '/deep/' in line:
results.append(output_api.PresubmitError(('%s:%d uses /deep/ selector') % (f.LocalPath(), line_number)))
if '::shadow' in line:
results.append(output_api.PresubmitError(('%s:%d uses ::shadow selector') % (f.LocalPath(), line_number)))
return results


def _CheckGeneratedFiles(input_api, output_api):
v8_directory_path = input_api.os_path.join(input_api.PresubmitLocalPath(), 'v8')
Expand Down Expand Up @@ -288,7 +271,6 @@ def _CommonChecks(input_api, output_api):
results.extend(_CheckDevtoolsStyle(input_api, output_api))
results.extend(_CheckFormat(input_api, output_api))
results.extend(_CheckOptimizeSVGHashes(input_api, output_api))
results.extend(_CheckCSSViolations(input_api, output_api))
results.extend(_CheckChangesAreExclusiveToDirectory(input_api, output_api))
results.extend(_CheckNoUncheckedFiles(input_api, output_api))
results.extend(_CheckForTooLargeFiles(input_api, output_api))
Expand Down Expand Up @@ -325,38 +307,12 @@ def _getAffectedFiles(input_api, parent_directories, excluded_actions, accepted_
return affected_files


def _getAffectedFrontEndFiles(input_api):
devtools_root = input_api.PresubmitLocalPath()
devtools_front_end = input_api.os_path.join(devtools_root, 'front_end')
affected_front_end_files = _getAffectedFiles(input_api, [devtools_front_end], ['D'], ['.js'])
return [input_api.os_path.relpath(file_name, devtools_root) for file_name in affected_front_end_files]


def _getAffectedJSFiles(input_api):
devtools_root = input_api.PresubmitLocalPath()
devtools_front_end = input_api.os_path.join(devtools_root, 'front_end')
devtools_scripts = input_api.os_path.join(devtools_root, 'scripts')
affected_js_files = _getAffectedFiles(input_api, [devtools_front_end, devtools_scripts], ['D'], ['.js'])
return [input_api.os_path.relpath(file_name, devtools_root) for file_name in affected_js_files]


def _checkWithNodeScript(input_api, output_api, script_path, script_arguments=None): # pylint: disable=invalid-name
def _checkWithNodeScript(input_api, output_api, script_path, script_arguments=[]): # pylint: disable=invalid-name
original_sys_path = sys.path
try:
sys.path = sys.path + [input_api.os_path.join(input_api.PresubmitLocalPath(), 'scripts')]
import devtools_paths
finally:
sys.path = original_sys_path

node_path = devtools_paths.node_path()

if script_arguments is None:
script_arguments = []

process = input_api.subprocess.Popen(
[node_path, script_path] + script_arguments, stdout=input_api.subprocess.PIPE, stderr=input_api.subprocess.STDOUT)
out, _ = process.communicate()

if process.returncode != 0:
return [output_api.PresubmitError(out)]
return [output_api.PresubmitNotifyResult(out)]
return _ExecuteSubProcess(input_api, output_api, [devtools_paths.node_path(), script_path], script_arguments, [])
4 changes: 4 additions & 0 deletions front_end/inspector_main/RenderingOptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ export class RenderingOptionsView extends UI.Widget.VBox {
this._appendSelect(
ls`Forces CSS prefers-reduced-motion media feature`,
self.Common.settings.moduleSetting('emulatedCSSMediaFeaturePrefersReducedMotion'));
this.contentElement.createChild('div').classList.add('panel-section-separator');

this._appendSelect(
ls`Forces vision deficiency emulation`, self.Common.settings.moduleSetting('emulatedVisionDeficiency'));
}

/**
Expand Down
24 changes: 24 additions & 0 deletions front_end/inspector_main/inspector_main_strings.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<message name="IDS_DEVTOOLS_035f93937dfd06c795a75877c9e6ddeb" desc="Checkbox subtitle for 'FPS meter' in the Rendering tool">
Plots frames per second, frame rate distribution, and GPU memory.
</message>
<message name="IDS_DEVTOOLS_05934928102b17827b8f03ed60c3e6e0" desc="Command Menu search query that points to the Rendering tool">
fps
</message>
<message name="IDS_DEVTOOLS_099969ccad146161b304e766f9a1fe56" desc="Title of a setting under the Network category that can be invoked through the Command Menu">
Show ads on this site, if allowed
</message>
Expand All @@ -21,18 +24,30 @@
<message name="IDS_DEVTOOLS_1e7cf45a622bb0fe494f9e4da1016982" desc="Text in Rendering Options">
Layout Shift Regions
</message>
<message name="IDS_DEVTOOLS_22858c2062e610f015f64e2090f77f8a" desc="Command Menu search query that points to the Rendering tool">
color vision deficiency
</message>
<message name="IDS_DEVTOOLS_2b1a578586beb46008e1542e9283ad99" desc="Checkbox title in Rendering tool">
Scrolling performance issues
</message>
<message name="IDS_DEVTOOLS_36bec95bf12fb795a5a100251f0cc421" desc="Checkbox subtitle for 'Layer boarders' in the Rendering tool">
Shows layer borders (orange/olive) and tiles (cyan).
</message>
<message name="IDS_DEVTOOLS_3a3d5225e008ed3017e9572ab8160815" desc="Command Menu search query that points to the Rendering tool">
CSS media type
</message>
<message name="IDS_DEVTOOLS_4047b37213dd5663ffd2cfbfe54826b0" desc="Command Menu search query that points to the Rendering tool">
vision deficiency
</message>
<message name="IDS_DEVTOOLS_417316246f12b8235535182cc9eebe45" desc="Accessibility subtitle for media select element in Rendering tool">
Forces media type for testing print and screen styles
</message>
<message name="IDS_DEVTOOLS_43f244627bf87f76a0dee86f364df473" desc="Checkbox subtitle for 'Layout Shift Regions' in the Rendering tool">
Highlights areas of the page (blue) that were shifted. May not be suitable for people prone to photosensitive epilepsy.
</message>
<message name="IDS_DEVTOOLS_508386d4665c7d3d7b4958a52e28eab1" desc="Command Menu search query that points to the Rendering tool">
CSS media feature
</message>
<message name="IDS_DEVTOOLS_53f2f05226edcd77bd4351cb27d07ba8" desc="Text in Rendering Options">
Highlights frames (red) detected to be ads.
</message>
Expand Down Expand Up @@ -81,6 +96,12 @@
<message name="IDS_DEVTOOLS_a4c766a2e6eb33e7575331b6affd9778" desc="Checkbox subtitle for 'Paint flashing' in the Rendering tool">
Highlights areas of the page (green) that need to be repainted. May not be suitable for people prone to photosensitive epilepsy.
</message>
<message name="IDS_DEVTOOLS_c1940aeeb9693a02e28c52eb85ce261c" desc="Command Menu search query that points to the Rendering tool">
paint
</message>
<message name="IDS_DEVTOOLS_c61404957758dfda283709e89376ab3e" desc="Command Menu search query that points to the Rendering tool">
layout
</message>
<message name="IDS_DEVTOOLS_cb835af5f855f79e8611dd3f8fec6aac" desc="Title of an action in the inspector main tool to reload">
Reload page
</message>
Expand All @@ -90,4 +111,7 @@
<message name="IDS_DEVTOOLS_f23c9ba06e7123f0b4c906de90fbcc9f" desc="Title of a setting under the DevTools category that can be invoked through the Command Menu">
Auto-open <ph name="LOCKED_1">DevTools</ph> for popups
</message>
<message name="IDS_DEVTOOLS_fe904c39945840470511a9ff798e9812" desc="Accessibility subtitle for vision deficiency select element in Rendering tool">
Forces vision deficiency emulation
</message>
</grit-part>
3 changes: 2 additions & 1 deletion front_end/inspector_main/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@
"title": "Rendering",
"persistence": "closeable",
"order": 50,
"className": "InspectorMain.RenderingOptionsView"
"className": "InspectorMain.RenderingOptionsView",
"tags": "paint, layout, fps, CSS media type, CSS media feature, vision deficiency, color vision deficiency"
}
],
"dependencies": [
Expand Down
1 change: 1 addition & 0 deletions front_end/resources/resourcesPanel.css
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,5 @@

.resources-sidebar {
padding: 0;
overflow-x: auto;
}
13 changes: 13 additions & 0 deletions front_end/sdk/EmulationModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ export class EmulationModel extends SDKModel {
});
this._updateCssMedia();

const visionDeficiencySetting = self.Common.settings.moduleSetting('emulatedVisionDeficiency');
visionDeficiencySetting.addChangeListener(() => this._emulateVisionDeficiency(visionDeficiencySetting.get()));
if (visionDeficiencySetting.get()) {
this._emulateVisionDeficiency(visionDeficiencySetting.get());
}

this._touchEnabled = false;
this._touchMobile = false;
this._customTouchEnabled = false;
Expand Down Expand Up @@ -140,6 +146,13 @@ export class EmulationModel extends SDKModel {
}
}

/**
* @param {string} type
*/
_emulateVisionDeficiency(type) {
this._emulationAgent.setEmulatedVisionDeficiency(type);
}

/**
* @param {number} rate
*/
Expand Down
82 changes: 72 additions & 10 deletions front_end/sdk/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,20 +302,82 @@
"storageType": "session",
"defaultValue": "",
"options": [
{
"title": "Do not emulate CSS prefers-reduced-motion",
"text": "No emulation",
"value": ""
},
{
"title": "Emulate CSS prefers-reduced-motion: reduce",
"text": "prefers-reduced-motion: reduce",
"value": "reduce"
}
{
"title": "Do not emulate CSS prefers-reduced-motion",
"text": "No emulation",
"value": ""
},
{
"title": "Emulate CSS prefers-reduced-motion: reduce",
"text": "prefers-reduced-motion: reduce",
"value": "reduce"
}
],
"tags": "query",
"title": "Emulate CSS media feature prefers-reduced-motion"
},
{
"type": "setting",
"category": "Rendering",
"settingName": "emulatedVisionDeficiency",
"settingType": "enum",
"storageType": "session",
"defaultValue": "",
"options": [
{
"title": "Do not emulate any vision deficiency",
"text": "No emulation",
"value": "none"
},
{
"title": "Emulate blurred vision",
"text": "Blurred vision",
"value": "blurredVision"
},
{
"title": "Emulate protanopia",
"text": "Protanopia",
"value": "protanopia"
},
{
"title": "Emulate protanomaly",
"text": "Protanomaly",
"value": "protanomaly"
},
{
"title": "Emulate deuteranopia",
"text": "Deuteranopia",
"value": "deuteranopia"
},
{
"title": "Emulate deuteranomaly",
"text": "Deuteranomaly",
"value": "deuteranomaly"
},
{
"title": "Emulate tritanopia",
"text": "Tritanopia",
"value": "tritanopia"
},
{
"title": "Emulate tritanomaly",
"text": "Tritanomaly",
"value": "tritanomaly"
},
{
"title": "Emulate achromatopsia",
"text": "Achromatopsia",
"value": "achromatopsia"
},
{
"title": "Emulate achromatomaly",
"text": "Achromatomaly",
"value": "achromatomaly"
}
],
"tags": "query",
"title": "Emulate vision deficiencies"
},
{
"type": "setting",
"category": "Console",
Expand Down
Loading

0 comments on commit c2fd23a

Please sign in to comment.