mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWebView: Log the result of taking screenshots to Inspector's console
It probably isn't obvious that screenshots are saved to the user's Downloads folder, so add a console message to inform them.
This commit is contained in:
committed by
Andreas Kling
parent
e0450301ab
commit
42c0ac9352
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#include <AK/Error.h>
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/DateTime.h>
|
||||
#include <LibCore/StandardPaths.h>
|
||||
@@ -394,7 +393,7 @@ void ViewImplementation::handle_web_content_process_crash()
|
||||
load_html(builder.to_deprecated_string());
|
||||
}
|
||||
|
||||
static ErrorOr<void> save_screenshot(Gfx::ShareableBitmap const& bitmap)
|
||||
static ErrorOr<LexicalPath> save_screenshot(Gfx::ShareableBitmap const& bitmap)
|
||||
{
|
||||
if (!bitmap.is_valid())
|
||||
return Error::from_string_view("Failed to take a screenshot"sv);
|
||||
@@ -407,10 +406,10 @@ static ErrorOr<void> save_screenshot(Gfx::ShareableBitmap const& bitmap)
|
||||
auto screenshot_file = TRY(Core::File::open(path.string(), Core::File::OpenMode::Write));
|
||||
TRY(screenshot_file->write_until_depleted(encoded));
|
||||
|
||||
return {};
|
||||
return path;
|
||||
}
|
||||
|
||||
ErrorOr<void> ViewImplementation::take_screenshot(ScreenshotType type)
|
||||
ErrorOr<LexicalPath> ViewImplementation::take_screenshot(ScreenshotType type)
|
||||
{
|
||||
Gfx::ShareableBitmap bitmap;
|
||||
|
||||
@@ -424,16 +423,13 @@ ErrorOr<void> ViewImplementation::take_screenshot(ScreenshotType type)
|
||||
break;
|
||||
}
|
||||
|
||||
TRY(save_screenshot(bitmap));
|
||||
return {};
|
||||
return save_screenshot(bitmap);
|
||||
}
|
||||
|
||||
ErrorOr<void> ViewImplementation::take_dom_node_screenshot(i32 node_id)
|
||||
ErrorOr<LexicalPath> ViewImplementation::take_dom_node_screenshot(i32 node_id)
|
||||
{
|
||||
auto bitmap = client().take_dom_node_screenshot(node_id);
|
||||
TRY(save_screenshot(bitmap));
|
||||
|
||||
return {};
|
||||
return save_screenshot(bitmap);
|
||||
}
|
||||
|
||||
void ViewImplementation::set_user_style_sheet(String source)
|
||||
|
||||
Reference in New Issue
Block a user