Commit graph

17562 commits

Author SHA1 Message Date
Andreas Kling
b6bd793ede LibWeb: Clear the "is initial about:blank" flag in Document.write() 2022-08-05 12:46:41 +02:00
Andreas Kling
c46a8194b4 LibWeb: Use Document::m_type to check for XML documents
...instead of doing a string compare on the DOCTYPE node.
2022-08-05 12:46:41 +02:00
Andreas Kling
99ecc216d7 LibWeb: Show iframe URLs in layout tree dumps 2022-08-05 12:46:40 +02:00
Andreas Kling
602f927982 LibWeb: Start implementing "create and initialize a Document" from HTML
The way we've been creating DOM::Document has been pretty far from what
the spec tells us to do, and this is a first big step towards getting us
closer to spec.

The new Document::create_and_initialize() is called by FrameLoader after
loading a "text/html" resource.

We create the JS Realm and the Window object when creating the Document
(previously, we'd do it on first access to Document::interpreter().)

The realm execution context is owned by the Environment Settings Object.
2022-08-05 12:46:40 +02:00
Andreas Kling
0781bdb23e LibWeb: Add HTML::NavigationParams 2022-08-05 12:46:39 +02:00
Andreas Kling
fb1900e79c LibJS: Make Interpreter::create() call InitializeHostDefinedRealm()
Instead of having two implementations of this AO, let's just have
Interpreter::create() call the new full version of the AO in Realm.
2022-08-05 12:46:39 +02:00
Andreas Kling
8a03b17007 LibJS: Implement a more general InitializeHostDefinedRealm AO
The existing implementation of this AO lives in Interpreter::create(),
which makes it impossible to use without also constructing an
Interpreter.

This patch adds a new Realm::initialize_host_defined_realm() and takes
the global object and global this customization steps as Function
callback objects. This will be used by LibWeb to create realms during
Document construction.
2022-08-05 12:46:38 +02:00
Andreas Kling
e756b5450d LibWeb: Add a way to construct HTML::Window without a DOM::Document
This will be used to implement the rather intricate construction order
in the HTML spec.
2022-08-05 12:42:46 +02:00
Andreas Kling
eca0873245 LibWeb: Always put a dummy execution context on the main thread VM stack
A lot of code assumes that there's a current execution context. By
setting up a dummy context right after creating the main thread VM,
we ensure that such code can always run.
2022-08-05 12:42:46 +02:00
Andreas Kling
2801ddfa76 LibWeb: Implement (naive) version of HTMLIFrameElement.contentWindow
This should really return the WindowProxy, but since we don't have the
infrastructure set up just yet, just return the window object itself
for now.
2022-08-05 12:42:46 +02:00
Andreas Kling
8909ef5b90 LibWeb: Add HTML::SandboxingFlagSet 2022-08-05 12:42:46 +02:00
Andreas Kling
5d773732b7 LibWeb: Add HTML::CrossOriginOpenerPolicyEnforcementResult 2022-08-05 12:42:46 +02:00
Andreas Kling
b73bd4f988 LibWeb: Add HTML::CrossOriginOpenerPolicy 2022-08-05 12:42:46 +02:00
Andreas Kling
b838f2029b LibWeb: Move DOM::Document factory functions out of line 2022-08-05 12:42:46 +02:00
Andreas Kling
50d951aea2 LibJS: Let Shape store a Realm instead of a GlobalObject
This is a cautious first step towards being able to create JS objects
before a global object has been instantiated.
2022-08-05 12:42:46 +02:00
Andreas Kling
7a6935a2ff LibJS: Remove unused ShapeWithoutGlobalObject constructor mechanism 2022-08-05 12:42:46 +02:00
Andreas Kling
69a45adfbe LibWeb: Remove page_did_set_document_in_top_level_browsing_context()
This PageClient callback was never used for anything.
2022-08-05 12:42:46 +02:00
Andreas Kling
ffb23db57f LibWeb: Add browsing context "still on its initial about:blank Document" 2022-08-05 12:42:46 +02:00
Andreas Kling
c4a0b7057b LibWeb: Add basic skeleton of HTML "session history" to BrowsingContext 2022-08-05 12:42:46 +02:00
Andreas Kling
29a4266367 LibWeb: Add the "is initial about:blank" flag to DOM::Document 2022-08-05 12:42:46 +02:00
demostanis
1ce23eb640 LibMarkdown: Fix coloring of the first line
The escape sequence to color a section's name was separated
by a newline from the section's name, making less(1) trim
the escape sequence off when the section's name was on the
first line.
2022-08-04 16:57:26 +00:00
demostanis
55b7f8ab27 LibMarkdown: Indent code blocks 2022-08-04 16:57:26 +00:00
thankyouverycool
7537a045e5 Applications: Make a few of the larger Toolbars collapsible
Some Toolbars for FileManager, FontEditor and PixelPaint can now
collapse on resize.
2022-08-04 02:56:17 +02:00
thankyouverycool
97b381652a LibGUI: Let Toolbars collapse into an overflow menu
Previously Toolbars were governed by a strict minimum size which
guaranteed all actions remained visible. Now, if set collapsible,
extra actions will fold into an overflow menu on the Toolbar.
2022-08-04 02:56:17 +02:00
thankyouverycool
58955d37cc LibGUI: Let Buttons set their menu popup position
The previous ButtonStyle::Tray conditional was a hack for Statusbars.
2022-08-04 02:56:17 +02:00
thankyouverycool
1084eaea0b LibGUI: Remove button padding on Toolbar construction
And assume 24x24 button sizes by default.
There currently aren't any toolbars with custom button sizes, but if
the need arises, they can always determine their own padding.
2022-08-04 02:56:17 +02:00
thankyouverycool
99a00dc39b LibGUI: Remove useless frame members from Toolbar
Frames had no effect within Toolbar and are now superceded
by ToolbarContainer.
2022-08-04 02:56:17 +02:00
thankyouverycool
407231f11c FontEditor: Move new font creation to NewFontDialog and handle errors
Fixes potential OOM crashes when creating a new font and an oversight
in which glyph spacing was not being set.
2022-08-04 02:54:00 +02:00
thankyouverycool
807bd6da6c FontEditor: Improve error handling opening, saving and editing fonts
Adds fallible functions for opening and saving fonts and cutting
and copying selections. FontEditor now falls back on a guaranteed
default BitmapFont on startup. Fixes crashing on start when the
default system font is set to TrueType.
2022-08-04 02:54:00 +02:00
thankyouverycool
e9a150c87c FontEditor: Add show_error() helper 2022-08-04 02:54:00 +02:00
thankyouverycool
c044a556db FontEditor: Let editor recover from failed initializations
Fail early during font initialization and leave the editor in a
valid state in case of errors during UndoSelection creation.
2022-08-04 02:54:00 +02:00
thankyouverycool
cc291a0ca7 LibGfx: Improve error handling for BitmapFonts
Adds fallible functions for cloning, creating, loading and writing
BitmapFonts.
2022-08-04 02:54:00 +02:00
David Smith
1bdaf92414 Profiler: Add scrollbar to FlameGraphView
The flame graph view used to draw only so much of the graph that could
be displayed. Change to draw the whole graph, and add a scrollbar.

Does some tricks with the scrolling to keep the bottom of the graph
fixed when resizing or double-clicking, since it works better then.
2022-08-04 02:52:39 +02:00
MacDue
8140b1fa18 LibMarkdown: Implement the image size extension
This implements the image size extension that's quite commonly used:
https://github.com/commonmark/commonmark-spec/wiki/Deployed-Extensions#image-size

This supports specifying...

Both width and height: ![](foo.png =100x200)
Width only: ![](foo.png =100x)
Height only: ![](foo.png =x200)

The size is always in pixels (relative sizing does not seem
to be spec'd anywhere).
2022-08-04 02:49:29 +02:00
Linus Groh
fb47a87340 LibJS: Add previously skipped assertion in RegulateTime
The spec issue preventing us from doing this in the past has long been
fixed.
2022-08-03 22:46:38 +01:00
Filiph Siitam Sandström
3c1594e9ca DisplaySettings: Capitalize s in screen settings 2022-08-03 21:49:41 +01:00
davidot
301bba8c19 LibJS: Only coerce value once in BigInt constructor
See https://github.com/tc39/ecma262/pull/2812.
2022-08-03 20:59:59 +01:00
James Puleo
8c11786145 HexEditor: Rename camel case variable names in HexEditor::save_as
This also changes those variables to be references to the casted
document type, instead of pointers.
2022-08-03 10:12:11 -04:00
James Puleo
88cf40179d HexEditor: Make HexEditor::open_new_file fallible and reduce branching
Returning a `bool` is meaningless, so let's make it more expresive :^)
2022-08-03 10:12:11 -04:00
James Puleo
035d63f528 HexEditor: Remove unused readonly flag
`HexEditor::set_readonly` was never called, even though
`HexEditor::is_readonly` was occasionally queried -- so it's entirely
been removed.
2022-08-03 10:12:11 -04:00
James Puleo
8695ae4c50 HexEditor: Don't spam debug output when finding all strings
For each string found we would output it, which was way too much noise
:^)
2022-08-03 10:12:11 -04:00
James Puleo
0bfcbf0b0a HexEditor: Change Find All Strings shortcut to Ctrl + Shift + F
The previous shortcut of `Ctrl + Shift + S` conflicted with `Save As...`
action shortcut.
2022-08-03 10:12:11 -04:00
0xbigshaq
af46734497 LibHTTP+WebServer: Add querystring support
Split the path from querystring when determining the requested resource.
2022-08-02 21:05:32 +00:00
Timothy Flynn
a4a7efaf5f LibC+LibCore: Use tm_isdst to handle time zone offsets in DST
Previously, we were incorrectly assuming that the daylight global
variable indicated whether the current time zone is in DST. In reality,
the daylight variable only indicates whether a time zone *can* be in
DST.

Instead, the tm structure has a tm_isdst member that should be used for
this purpose. Ensure our LibC handles tm_isdst, and avoid errant usage
of the daylight variable in Core::DateTime.
2022-08-02 21:10:44 +01:00
Timothy Flynn
e683ca00cc LibC: Split time_t range validation to separate helper function
Right now, the tm_to_time helper invokes time_to_tm to validate the
time_t it creates. Soon, both tm_to_time and time_to_tm will perform
some TZDB lookups to handle DST. This isn't a huge cost, but let's
avoid the double lookup here.
2022-08-02 21:10:44 +01:00
Timothy Flynn
91e3a2aaca LibC: Cache the time zone name found by tzset()
The time zone name will be needed for TZDB lookups in various time.h
functions. Cache the value found by tzset(), defaulting to the system-
wide default of UTC.

This also moves the time.h global definitions to the top of the file.
The cached time zone name will be needed above where these variables are
defined, so this is just to keep them all together.
2022-08-02 21:10:44 +01:00
Jelle Raaijmakers
379c7c2f64 Run: Trigger on escape key only once
When you press the escape key in the Browse dialog, the key down event
closes the dialog while the key up event then closes the Run window.

Prevent this by only listening to key down events.
2022-08-02 12:54:39 +01:00
Kenneth Myhra
1e5d107649 LibWeb: Declare variable with the auto keyword
Use the auto keyword instead of the full type name like we do elsewhere
in the codebase.
2022-08-02 08:20:40 +01:00
Kenneth Myhra
c8c5f05de5 LibWeb: Make sure Blob type is not outside range 0x0020-0x007E
This makes sure that type is set to an empty string if
BlobPropertyBag::type is outside the range 0x0020 to 0x007E.
2022-08-02 08:20:40 +01:00
Kenneth Myhra
73aec263b1 LibWeb: Move is_basic_latin() to Blob.{cpp,h}
This method needs to be accessible from both Blob and File.
2022-08-02 08:20:40 +01:00