Commit Graph

40054 Commits

Author SHA1 Message Date
Linus Groh
c8f1651761 LibJS+LibWeb: Restore type safety of Realm::set_global_object()
The changes from 8a03b17 to allow any JS::Value aren't a good fit, as
shown by the excessive amount of verify_cast needed :^)
2022-08-06 12:02:48 +02:00
Andreas Kling
64b29eb459 LibJS: Implement string concatenation using ropes
Instead of concatenating string data every time you add two strings
together in JavaScript, we now create a new PrimitiveString that points
to the two concatenated strings instead.

This turns concatenated strings into a tree structure that doesn't have
to be serialized until someone wants the characters in the string.

This *dramatically* reduces the peak memory footprint when running
the SunSpider benchmark (from ~6G to ~1G on my machine). It's also
significantly faster (1.39x) :^)
2022-08-06 00:29:15 +02:00
FrHun
cf62d08b2a Base: Add symbols that were previously emoji pngs 2022-08-05 21:47:03 +01:00
FrHun
bfe99ebc3e Base: Remove black only symbols from emojis 2022-08-05 21:47:03 +01:00
Beckett Normington
8f3639e7eb Base: Add yet more colorized emojis
This commit adds more colorized emojis.

🌻 - U+1F33B SUNFLOWER
🐌 - U+1F40C SNAIL
👑 - U+1F451 CROWN
📵 - U+1F4F5 NO MOBILE PHONES
🥇 - U+1F947 FIRST PLACE MEDAL
🥈 - U+1F948 SECOND PLACE MEDAL
🥑 - U+1F951 AVOCADO
🥕 - U+1F955 CARROT
🩸 - U+1FA78 DROP OF BLOOD
2022-08-05 21:42:21 +01:00
djwisdom
449935e096 Base: Update FontEditor manual use images with improved resolution 2022-08-05 13:56:15 +02:00
thankyouverycool
517c03f920 Minesweeper: Update GML and fix layout issues
Converts Minesweeper's main widget to GML, polishes the custom
game window, formats the clock as human readable digital time, and
defers invoking Field's callback until the main widget has finished
relayout. Fixes inability to downsize the main window when shrinking
field size.
2022-08-05 13:55:13 +02:00
thankyouverycool
4d09b5c4ba LibGUI: Register "bitmap" GML property for ImageWidget 2022-08-05 13:55:13 +02:00
thankyouverycool
75b6097c55 AK: Add human_readable_digital_time() helper
Converts seconds into a readable digital format. For example:
30 seconds	= "00:30"
90 seconds	= "01:30"
86401 seconds	= "24:00:01"
And so on.
2022-08-05 13:55:13 +02:00
thankyouverycool
a808cfa75c LibGUI+Applications: Govern Splitter resizing by opportunistic growth
This patch replaces the concept of fixed resizees with opportunistic
ones which use the new SpecialDimension::OpportunisticGrow UISize.
This lets us simplify splitter resize code and take advantage of
the layout system's automatic calculations for minimum size and
expansion. Functionally the same as before, but fixes Splitter's
unintended ability to grow window size.
2022-08-05 13:54:18 +02:00
thankyouverycool
6f2a304971 LibGUI: Calculate maximum primary size for Splitter resizees 2022-08-05 13:54:18 +02:00
Andreas Kling
aaa4f6d287 LibJS: Run clang-format on Realm.cpp 2022-08-05 12:55:25 +02:00
Andreas Kling
c77a0974ab LibWeb: Port web workers to the "create a new JavaScript realm" API 2022-08-05 12:46:42 +02:00
Andreas Kling
94d54069f4 LibWeb: Don't paint non-visible frames
This fixes an issue where iframes hidden with CSS `visibility: none`
would still be visible.
2022-08-05 12:46:42 +02:00
Andreas Kling
e2ae286132 LibJS: Actually create a new Realm in $262.createRealm() 2022-08-05 12:46:42 +02:00
Andreas Kling
95e011e2a0 LibWeb: Support assigning to window.location
Assignments actually forward to window.location.href, as the spec
requires. Since the window object is implemented by hand, this looks a
little janky. Eventually we should move all this stuff to IDL.
2022-08-05 12:46:42 +02:00
Andreas Kling
2a7924f96c LibWeb: Bring browsing context creation closer to spec
This patch implements the "create a new browsing context" function from
the HTML spec and replaces our existing logic with it.

The big difference is that browsing contexts now initially navigate to
"about:blank" instead of starting out in a strange "empty" state.
This makes it possible for websites to create a new iframe and start
scripting inside it right away, without having to load an URL into it.
2022-08-05 12:46:42 +02:00
Andreas Kling
73f77969a6 LibWeb: Add API for setting a document's referrer 2022-08-05 12:46:42 +02:00
Andreas Kling
6e71e400e6 LibWeb: Store document origin as a HTML::Origin object
This will allow us to remember an arbitrary origin instead of deriving
it from the document's URL.
2022-08-05 12:46:42 +02:00
Andreas Kling
130be479cb LibGfx: Don't use Span<u32> as hash key for cached emojis
We can't rely on the caller to keep the code points alive, and this
was sometimes causing incorrect cache hits, leading to the wrong
emoji being displayed.

Fixes #14693
2022-08-05 12:46:41 +02:00
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
Andreas Kling
b6307f73a2 AK: Suppress -Wunqualified-std-cast-call in the CLion IDE 2022-08-05 12:42:46 +02:00
Beckett Normington
e6871c1af7 Base: Add various misc. emojis
This commit adds various color emojis to the system.

🎨 - U+1F3A8 ARTIST PALETTE
💡 - U+1F4A1 ELECTRIC LIGHT BULB
🤍 - U+1F90D WHITE HEART
🤎 - U+1F90E BROWN HEART
🥝 - U+1F95D KIWIFRUIT
🍩 - U+1F369 DOUGHNUT
🎄 - U+1F384 CHRISTMAS TREE
🤤 - U+1F924 DROOLING FACE
🥓 - U+1F953 BACON

I'm happy that we're improving our support for color emoji. :^)
2022-08-05 10:21:09 +01:00
Beckett Normington
dba1aab66c Base: Add Bubble Tea emoji (U+1F9CB)
This commit adds the bubble tea emoji (U+1F9CB) to the system.
2022-08-04 18:03:40 +01: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
6891bfa965 Base: Add an overflow-menu icon 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