summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb
AgeCommit message (Collapse)Author
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling
2021-01-12AK: Simplify constructors and conversions from nullptr_tLenny Maiorani
Problem: - Many constructors are defined as `{}` rather than using the ` = default` compiler-provided constructor. - Some types provide an implicit conversion operator from `nullptr_t` instead of requiring the caller to default construct. This violates the C++ Core Guidelines suggestion to declare single-argument constructors explicit (https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c46-by-default-declare-single-argument-constructors-explicit). Solution: - Change default constructors to use the compiler-provided default constructor. - Remove implicit conversion operators from `nullptr_t` and change usage to enforce type consistency without conversion.
2021-01-11Everywhere: Fix incorrect uses of String::format and StringBuilder::appendfSahan Fernando
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
2021-01-09Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.Everything: The modifications in this commit were automatically made using the following command: find . -name '*.cpp' -exec sed -i -E 's/dbg\(\) << ("[^"{]*");/dbgln\(\1\);/' {} \;
2021-01-09LibWeb: No need to report that we encountered <svg> or <math>Andreas Kling
These things happen, and it's not particularly noteworthy.
2021-01-09LibWeb: Coalesce layouts that happen in response to style changesAndreas Kling
Instead of doing a forced layout synchronously whenever an element's style is changed, use a zero-timer to do the forced relayout on next event loop iteration. This effectively coalesces a lot of layouts and makes many pages such as GitHub spend way less time doing redundant layout work.
2021-01-09LibWeb: Convert a bunch of dbg() to dbgln()Andreas Kling
2021-01-07LibWeb: Implement most of the CSS table fixup algorithmAndreas Kling
This patch implements the "remove irrelevant boxes" and "generate missing child wrappers" parts of table fixup. "Generate missing parents" is left as a task for our future selves.
2021-01-07LibWeb: Specialize is<DOM::Element>() and is<Layout::Box>()Andreas Kling
These two show up in profiles, so let's add specializations for them.
2021-01-07LibWeb: Allow anonymous table, table-row and table-cell layout nodesAndreas Kling
2021-01-07LibWeb: Move remove_all_children() from Node to TreeNode<T>Andreas Kling
This is useful in all tree types.
2021-01-07LibWeb: Add the computed "display" values to CSS::ComputedValuesAndreas Kling
2021-01-07LibWeb: Add some more CSS "display" valuesAndreas Kling
2021-01-06LibWeb: Compute width of absolutely positioned, replaced elementsAndreas Kling
Fixes #4589.
2021-01-06LibWeb: Move absolute positioning up to FormattingContextAndreas Kling
It seems like both BFC and IFC can have absolutely positioned children. It's a bit strange, but consider the following HTML: <html><body>foobar<img style="position: absolute"></body></html> In such a document, the <img> element is an absolutely positioned child of a block-level element (<body>) with no block-level children. An IFC is established for <body>, and needs to handle layout for <img>.
2021-01-06LibWeb: Don't prune whitespace nodes from layout treeAndreas Kling
Various whitespace-related issues have been fixed, and support for the different CSS white-space values is improved enough that I think we can stop doing the hack where we just prune whitespace nodes from the tree and actually let them show up. This is a nice step forward for correctness with the slight downside of cluttering up layout tree dumps with tons of whitespace text nodes. But hey, that's the web we know & love. :^) Fixes #4427.
2021-01-06LibWeb: Make DOM::Node::create_layout_node() not need parent's styleAndreas Kling
The StyleResolver can find the specified CSS values for the parent element via the DOM. Forcing everyone to locate specified values for their parent was completely unnecessary.
2021-01-06LibWeb: Remove specified style from layout nodesAndreas Kling
Layout nodes now only carry CSS computer values with them. The main idea here is to give them only what they need to perform layout, and leave the rest back in the DOM.
2021-01-06LibWeb: Split CSS::ComputedValues members into structs by inheritanceAndreas Kling
Put all the inherited members in one struct and all the non-inherited ones in another. This makes it clear which is which, and also makes it easy to copy all the inherited values while ignoring the non-inherited ones.
2021-01-06LibWeb: Use the specified CSS values from element in more placesAndreas Kling
Instead of using the specified style stored on Layout::Node, use the specified CSS values kept by the DOM::Element in more places.
2021-01-06LibWeb: Use the cached background-image value in Layout::Box::paint()Andreas Kling
2021-01-06LibWeb: Rename Element::resolved_style() => specified_css_values()Andreas Kling
This object represents the specified CSS values, so let's call it that.
2021-01-06LibWeb: Copy some properties from specified style into layout nodeAndreas Kling
Another step towards not having to carry the full specified style with us everywhere. This isn't the ideal final layout, since we're mixing computed and used values a bit randomly here, but one step at a time.
2021-01-06LibWeb: Rename Layout::Node::style() => computed_values()Andreas Kling
2021-01-06LibWeb: Store the used font in Layout::NodeWithStyleAndreas Kling
This is a step towards not having to carry the full set of specified values around with every layout node.
2021-01-06LibWeb: Rename LayoutStyle => CSS::ComputedValuesAndreas Kling
This object represents the CSS "computed values" so let's call it that.
2021-01-06LibWeb: Simplify one kind of whitespace collapsingAndreas Kling
For a non-empty TextNode chunk that begins with collapsible whitespace, we can simply step right over the whitespace by adjusting the chunk.
2021-01-05LibWeb: Set override cursor on IPWV itself instead of whole windowAndreas Kling
When changing the mouse cursor (e.g when hovering over a link) we now only change the InProcessWebView's override cursor instead of setting the cursor at the window level. This fixes an issue where the I-beam or hand cursors would somehow "escape" from the web view and over to other widgets.
2021-01-05LibWeb: Add a basic content filter (ad blocking!) :^)Andreas Kling
This patch adds a global (per-process) filter list to LibWeb that is used to filter all outgoing resource load requests. Basically we check the URL against a list of filter patterns and if it's a match for any one of them, we immediately fail the load. The filter list is a simple text file: ~/.config/BrowserContentFilters.txt It's one filter per line and they are simple glob filters for now, with implicit asterisks (*) at the start and end of the line.
2021-01-04LibWeb: Don't careleslly insert inline-level boxes into inline-blocksAndreas Kling
Just because an inline-block is inline doesn't mean it's ready to accept random inline children. If it's a block, we may need to create an anonymous wrapper first. Fixes #4604.
2021-01-04LibWeb: Restart the cursor blink cycle whenever the user edits contentAndreas Kling
Having the text cursor disappear during rapid continuous editing is quite jarring, so let's make sure we always restart the blink cycle whenever the user performs some kind of editing action in a frame.
2021-01-03LibWeb: Convert a bunch of String::format() => String::formatted()Andreas Kling
2021-01-03LibWeb: Fully implement end tag parsing in foreign contentLuke
Required to view the Spotify home page
2021-01-02LibWeb: Use Gfx::Bitmap::create_shareable() in OOPWVAndreas Kling
We were jumping through some pretty wasteful hoops in the resize event handler of OOPWV by first creating a bitmap and then immediately creating a new (shareable) clone of that bitmap. Now we go straight to the shareable bitmap instead.
2021-01-02LibWeb: When collapsing margins, consider border box heightsAndreas Kling
Empty boxes should be fully collapsed, but a box with border and/or padding is not empty. This fixes an issue where <hr> elements were getting weirdly collapsed since they have zero content height (but some border height.)
2021-01-02LibWeb: Fix unnecessary wrapping of block boxes in anonymous blocksAndreas Kling
Outside of tables, we don't need to wrap block-level boxes in anymous blocks. Only inline-level boxes need this treatment.
2021-01-01LibWeb: Use is<T> in XMLHttpRequestPrototypeAndreas Kling
2021-01-01LibWeb: Remove hand-rolled is_foo() helpers in Layout::Node classesAndreas Kling
2021-01-01LibWeb: Remove more hand-rolled type information :^)Andreas Kling
Hoo boy, we've really accumulated a lot of this stuff.
2021-01-01LibJS+LibWeb: Stop generating is_foo_wrapper() for JS DOM wrappersAndreas Kling
2021-01-01LibJS: Use RTTI for inheritance checksAndreas Kling
This replaces the hand-rolled string-based inheritance check tech.
2021-01-01LibWeb: Demangle the names returned by Layout::Node::class_name()Andreas Kling
Note that these are only used in debugging/test output so it's not performance sensitive.
2021-01-01LibWeb: Simplify Layout::Node::class_name() with RTTIAndreas Kling
2021-01-01AK+LibGUI+LibWeb: Remove AK::TypeTraits in favor of RTTI-based helpersAndreas Kling
Now that we have RTTI in userspace, we can do away with all this manual hackery and use dynamic_cast. We keep the is<T> and downcast<T> helpers since they still provide good readability improvements. Note that unlike dynamic_cast<T>, downcast<T> does not fail in a recoverable way, but will assert if the object being casted is not a T.
2020-12-31LibWeb: Clear circular download reference when download finishedTom
2020-12-31Everywhere: Re-format with clang-format-11Linus Groh
Compared to version 10 this fixes a bunch of formatting issues, mostly around structs/classes with attributes like [[gnu::packed]], and incorrect insertion of spaces in parameter types ("T &"/"T &&"). I also removed a bunch of // clang-format off/on and FIXME comments that are no longer relevant - on the other hand it tried to destroy a couple of neatly formatted comments, so I had to add some as well.
2020-12-31LibWeb: Don't hold on to the Download instance after it's finishedAnotherTest
Fixes* 4668
2020-12-30LibGFX: Move default_xxx_font() methods from Font to FontDatabaseStephan Unverwerth
When we have an abstract font class it makes no sense to keep these methods in the Font class.
2020-12-30LibWeb: Re-enable favicons after forgotten if-0AnotherTest
2020-12-30ProtocolServer: Stream the downloaded data if possibleAnotherTest
This patchset makes ProtocolServer stream the downloads to its client (LibProtocol), and as such changes the download API; a possible download lifecycle could be as such: notation = client->server:'>', server->client:'<', pipe activity:'*' ``` > StartDownload(GET, url, headers, {}) < Response(0, fd 8) * {data, 1024b} < HeadersBecameAvailable(0, response_headers, 200) < DownloadProgress(0, 4K, 1024) * {data, 1024b} * {data, 1024b} < DownloadProgress(0, 4K, 2048) * {data, 1024b} < DownloadProgress(0, 4K, 1024) < DownloadFinished(0, true, 4K) ``` Since managing the received file descriptor is a pain, LibProtocol implements `Download::stream_into(OutputStream)`, which can be used to stream the download into any given output stream (be it a file, or memory, or writing stuff with a delay, etc.). Also, as some of the users of this API require all the downloaded data upfront, LibProtocol also implements `set_should_buffer_all_input()`, which causes the download instance to buffer all the data until the download is complete, and to call the `on_buffered_download_finish` hook.