Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Web Inspector: Timelines Tab: Screenshots: images flash while recordi…
…ng is still active https://bugs.webkit.org/show_bug.cgi?id=240852 Reviewed by Patrick Angle. * Source/WebInspectorUI/UserInterface/Views/ScreenshotsTimelineOverviewGraph.js: (WI.ScreenshotsTimelineOverviewGraph): (WI.ScreenshotsTimelineOverviewGraph.prototype.reset): (WI.ScreenshotsTimelineOverviewGraph.prototype.layout): * Source/WebInspectorUI/UserInterface/Views/ScreenshotsTimelineView.js: (WI.ScreenshotsTimelineView): (WI.ScreenshotsTimelineView.prototype.reset): (WI.ScreenshotsTimelineView.prototype.layout): (WI.ScreenshotsTimelineView.prototype.selectRecord): (WI.ScreenshotsTimelineView.prototype.clear): Deleted. Keep a `WeakMap` of `<img>` for each `WI.ScreenshotsTimelineRecord` so that we don't recreate it over and over in `layout`. Also, don't show the `<img>` until after it `"load"`. * Source/WebInspectorUI/UserInterface/Views/ScreenshotsTimelineView.css: (.timeline-view.screenshots): (.timeline-view.screenshots > img.selected): Remove scroll snapping as it prevents the selected image from being scrolled offscreen, which is unnecessarily hostile. The changing border color is enough to identify it as the selected image. * Source/WebInspectorUI/UserInterface/Base/Utilities.js: (Map.prototype.getOrInitialize): (WeakMap.prototype.getOrInitialize): Added. Adjust utility function to allow for `value` to be a function that's only executed if the `key` does not exist in the `Map`/`WeakMap`. * LayoutTests/inspector/unit-tests/map-utilities.html: * LayoutTests/inspector/unit-tests/map-utilities-expected.txt: * LayoutTests/inspector/unit-tests/weakmap-utilities.html: Added. * LayoutTests/inspector/unit-tests/weakmap-utilities-expected.txt: Added. Canonical link: https://commits.webkit.org/250939@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294775 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
8 changed files
with
195 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -0,0 +1,16 @@ | ||
|
|
||
| == Running test suite: WeakMap | ||
| -- Running test case: WeakMap.prototype.getOrInitialize.Raw | ||
| PASS: Map does not have `key`. | ||
| PASS: Map should have initialized `key` with `value`. | ||
| PASS: Map does have `key` => `value`. | ||
| PASS: Map should get `key` with `value` without re-initializing. | ||
| PASS: Map still has `key` => `value`. | ||
|
|
||
| -- Running test case: WeakMap.prototype.getOrInitialize.Function | ||
| PASS: Map does not have `key`. | ||
| PASS: Map should have initialized `key` with `value`. | ||
| PASS: Map does have `key` => `value`. | ||
| PASS: Map should get `key` with `value` without re-initializing. | ||
| PASS: Map still has `key` => `value`. | ||
|
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @@ -0,0 +1,48 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <script src="../../http/tests/inspector/resources/inspector-test.js"></script> | ||
| <script> | ||
| function test() | ||
| { | ||
| let suite = InspectorTest.createSyncSuite("WeakMap"); | ||
|
|
||
| suite.addTestCase({ | ||
| name: "WeakMap.prototype.getOrInitialize.Raw", | ||
| test() { | ||
| const key = {value: "key"}; | ||
| const value = "value"; | ||
| const value2 = "value2"; | ||
|
|
||
| let map = new WeakMap; | ||
| InspectorTest.expectEqual(map.get(key), undefined, "Map does not have `key`."); | ||
| InspectorTest.expectEqual(map.getOrInitialize(key, value), value, "Map should have initialized `key` with `value`."); | ||
| InspectorTest.expectEqual(map.get(key), value, "Map does have `key` => `value`."); | ||
| InspectorTest.expectEqual(map.getOrInitialize(key, value2), value, "Map should get `key` with `value` without re-initializing."); | ||
| InspectorTest.expectEqual(map.get(key), value, "Map still has `key` => `value`."); | ||
| } | ||
| }); | ||
|
|
||
| suite.addTestCase({ | ||
| name: "WeakMap.prototype.getOrInitialize.Function", | ||
| test() { | ||
| const key = {value: "key"}; | ||
| const value = () => "value"; | ||
| const value2 = () => InspectorTest.fail("Should not be reached."); | ||
|
|
||
| let map = new WeakMap; | ||
| InspectorTest.expectEqual(map.get(key), undefined, "Map does not have `key`."); | ||
| InspectorTest.expectEqual(map.getOrInitialize(key, value), value(), "Map should have initialized `key` with `value`."); | ||
| InspectorTest.expectEqual(map.get(key), value(), "Map does have `key` => `value`."); | ||
| InspectorTest.expectEqual(map.getOrInitialize(key, value2), value(), "Map should get `key` with `value` without re-initializing."); | ||
| InspectorTest.expectEqual(map.get(key), value(), "Map still has `key` => `value`."); | ||
| } | ||
| }); | ||
|
|
||
| suite.runTestCasesAndFinish(); | ||
| } | ||
| </script> | ||
| </head> | ||
| <body onLoad="runTest()"> | ||
| </body> | ||
| </html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters