瀏覽代碼

LibWeb: Move the CSS parser into CSS/Parser/

Andreas Kling 5 年之前
父節點
當前提交
7daeddb9e9

+ 3 - 3
Applications/Browser/Tab.cpp

@@ -45,6 +45,7 @@
 #include <LibGUI/ToolBarContainer.h>
 #include <LibGUI/ToolBarContainer.h>
 #include <LibGUI/Window.h>
 #include <LibGUI/Window.h>
 #include <LibJS/Interpreter.h>
 #include <LibJS/Interpreter.h>
+#include <LibWeb/CSS/Parser/CSSParser.h>
 #include <LibWeb/DOM/Element.h>
 #include <LibWeb/DOM/Element.h>
 #include <LibWeb/DOMTreeModel.h>
 #include <LibWeb/DOMTreeModel.h>
 #include <LibWeb/Dump.h>
 #include <LibWeb/Dump.h>
@@ -55,7 +56,6 @@
 #include <LibWeb/Layout/LayoutNode.h>
 #include <LibWeb/Layout/LayoutNode.h>
 #include <LibWeb/Loader/ResourceLoader.h>
 #include <LibWeb/Loader/ResourceLoader.h>
 #include <LibWeb/PageView.h>
 #include <LibWeb/PageView.h>
-#include <LibWeb/Parser/CSSParser.h>
 #include <LibWeb/WebContentView.h>
 #include <LibWeb/WebContentView.h>
 
 
 namespace Browser {
 namespace Browser {
@@ -88,14 +88,14 @@ Tab::Tab(Type type)
     else
     else
         m_web_content_view = widget.add<WebContentView>();
         m_web_content_view = widget.add<WebContentView>();
 
 
-    m_go_back_action = GUI::CommonActions::make_go_back_action( [this](auto&) { go_back(); }, this);
+    m_go_back_action = GUI::CommonActions::make_go_back_action([this](auto&) { go_back(); }, this);
     m_go_forward_action = GUI::CommonActions::make_go_forward_action([this](auto&) { go_forward(); }, this);
     m_go_forward_action = GUI::CommonActions::make_go_forward_action([this](auto&) { go_forward(); }, this);
 
 
     toolbar.add_action(*m_go_back_action);
     toolbar.add_action(*m_go_back_action);
     toolbar.add_action(*m_go_forward_action);
     toolbar.add_action(*m_go_forward_action);
 
 
     toolbar.add_action(GUI::CommonActions::make_go_home_action([this](auto&) { load(g_home_url); }, this));
     toolbar.add_action(GUI::CommonActions::make_go_home_action([this](auto&) { load(g_home_url); }, this));
-    m_reload_action = GUI::CommonActions::make_reload_action( [this](auto&) { reload(); }, this);
+    m_reload_action = GUI::CommonActions::make_reload_action([this](auto&) { reload(); }, this);
 
 
     toolbar.add_action(*m_reload_action);
     toolbar.add_action(*m_reload_action);
 
 

+ 1 - 1
Libraries/LibWeb/CMakeLists.txt

@@ -11,6 +11,7 @@ set(SOURCES
     Bindings/XMLHttpRequestWrapper.cpp
     Bindings/XMLHttpRequestWrapper.cpp
     CSS/DefaultStyleSheetSource.cpp
     CSS/DefaultStyleSheetSource.cpp
     CSS/Length.cpp
     CSS/Length.cpp
+    CSS/Parser/CSSParser.cpp
     CSS/PropertyID.cpp
     CSS/PropertyID.cpp
     CSS/PropertyID.h
     CSS/PropertyID.h
     CSS/Selector.cpp
     CSS/Selector.cpp
@@ -107,7 +108,6 @@ set(SOURCES
     Page.cpp
     Page.cpp
     PageView.cpp
     PageView.cpp
     Painting/StackingContext.cpp
     Painting/StackingContext.cpp
-    Parser/CSSParser.cpp
     SVG/SVGElement.cpp
     SVG/SVGElement.cpp
     SVG/SVGGeometryElement.cpp
     SVG/SVGGeometryElement.cpp
     SVG/SVGGraphicsElement.cpp
     SVG/SVGGraphicsElement.cpp

+ 0 - 0
Libraries/LibWeb/Parser/CSSParser.cpp → Libraries/LibWeb/CSS/Parser/CSSParser.cpp


+ 0 - 0
Libraries/LibWeb/Parser/CSSParser.h → Libraries/LibWeb/CSS/Parser/CSSParser.h


+ 2 - 2
Libraries/LibWeb/CSS/StyleResolver.cpp

@@ -25,13 +25,13 @@
  */
  */
 
 
 #include <AK/QuickSort.h>
 #include <AK/QuickSort.h>
+#include <LibWeb/CSS/Parser/CSSParser.h>
 #include <LibWeb/CSS/SelectorEngine.h>
 #include <LibWeb/CSS/SelectorEngine.h>
 #include <LibWeb/CSS/StyleResolver.h>
 #include <LibWeb/CSS/StyleResolver.h>
 #include <LibWeb/CSS/StyleSheet.h>
 #include <LibWeb/CSS/StyleSheet.h>
 #include <LibWeb/DOM/Document.h>
 #include <LibWeb/DOM/Document.h>
 #include <LibWeb/DOM/Element.h>
 #include <LibWeb/DOM/Element.h>
 #include <LibWeb/Dump.h>
 #include <LibWeb/Dump.h>
-#include <LibWeb/Parser/CSSParser.h>
 #include <ctype.h>
 #include <ctype.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
@@ -344,7 +344,7 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
             auto right = parse_css_value(context, parts[1]);
             auto right = parse_css_value(context, parts[1]);
             auto bottom = parse_css_value(context, parts[2]);
             auto bottom = parse_css_value(context, parts[2]);
             auto left = parse_css_value(context, parts[3]);
             auto left = parse_css_value(context, parts[3]);
-            if (top && right && bottom &&left) {
+            if (top && right && bottom && left) {
                 style.set_property(CSS::PropertyID::BorderTopColor, *top);
                 style.set_property(CSS::PropertyID::BorderTopColor, *top);
                 style.set_property(CSS::PropertyID::BorderRightColor, *right);
                 style.set_property(CSS::PropertyID::BorderRightColor, *right);
                 style.set_property(CSS::PropertyID::BorderBottomColor, *bottom);
                 style.set_property(CSS::PropertyID::BorderBottomColor, *bottom);

+ 5 - 5
Libraries/LibWeb/DOM/Document.cpp

@@ -35,6 +35,7 @@
 #include <LibJS/Runtime/GlobalObject.h>
 #include <LibJS/Runtime/GlobalObject.h>
 #include <LibWeb/Bindings/DocumentWrapper.h>
 #include <LibWeb/Bindings/DocumentWrapper.h>
 #include <LibWeb/Bindings/WindowObject.h>
 #include <LibWeb/Bindings/WindowObject.h>
+#include <LibWeb/CSS/Parser/CSSParser.h>
 #include <LibWeb/CSS/SelectorEngine.h>
 #include <LibWeb/CSS/SelectorEngine.h>
 #include <LibWeb/CSS/StyleResolver.h>
 #include <LibWeb/CSS/StyleResolver.h>
 #include <LibWeb/DOM/AttributeNames.h>
 #include <LibWeb/DOM/AttributeNames.h>
@@ -42,20 +43,19 @@
 #include <LibWeb/DOM/DocumentType.h>
 #include <LibWeb/DOM/DocumentType.h>
 #include <LibWeb/DOM/Element.h>
 #include <LibWeb/DOM/Element.h>
 #include <LibWeb/DOM/ElementFactory.h>
 #include <LibWeb/DOM/ElementFactory.h>
+#include <LibWeb/DOM/Text.h>
+#include <LibWeb/DOM/Window.h>
+#include <LibWeb/Dump.h>
+#include <LibWeb/Frame/Frame.h>
 #include <LibWeb/HTML/HTMLBodyElement.h>
 #include <LibWeb/HTML/HTMLBodyElement.h>
 #include <LibWeb/HTML/HTMLHeadElement.h>
 #include <LibWeb/HTML/HTMLHeadElement.h>
 #include <LibWeb/HTML/HTMLHtmlElement.h>
 #include <LibWeb/HTML/HTMLHtmlElement.h>
 #include <LibWeb/HTML/HTMLScriptElement.h>
 #include <LibWeb/HTML/HTMLScriptElement.h>
 #include <LibWeb/HTML/HTMLTitleElement.h>
 #include <LibWeb/HTML/HTMLTitleElement.h>
-#include <LibWeb/DOM/Text.h>
-#include <LibWeb/DOM/Window.h>
-#include <LibWeb/Dump.h>
-#include <LibWeb/Frame/Frame.h>
 #include <LibWeb/Layout/LayoutDocument.h>
 #include <LibWeb/Layout/LayoutDocument.h>
 #include <LibWeb/Layout/LayoutTreeBuilder.h>
 #include <LibWeb/Layout/LayoutTreeBuilder.h>
 #include <LibWeb/Origin.h>
 #include <LibWeb/Origin.h>
 #include <LibWeb/PageView.h>
 #include <LibWeb/PageView.h>
-#include <LibWeb/Parser/CSSParser.h>
 #include <LibWeb/SVG/TagNames.h>
 #include <LibWeb/SVG/TagNames.h>
 #include <stdio.h>
 #include <stdio.h>
 
 

+ 1 - 1
Libraries/LibWeb/HTML/HTMLImageElement.cpp

@@ -27,13 +27,13 @@
 #include <LibCore/Timer.h>
 #include <LibCore/Timer.h>
 #include <LibGfx/Bitmap.h>
 #include <LibGfx/Bitmap.h>
 #include <LibGfx/ImageDecoder.h>
 #include <LibGfx/ImageDecoder.h>
+#include <LibWeb/CSS/Parser/CSSParser.h>
 #include <LibWeb/CSS/StyleResolver.h>
 #include <LibWeb/CSS/StyleResolver.h>
 #include <LibWeb/DOM/Document.h>
 #include <LibWeb/DOM/Document.h>
 #include <LibWeb/DOM/Event.h>
 #include <LibWeb/DOM/Event.h>
 #include <LibWeb/HTML/HTMLImageElement.h>
 #include <LibWeb/HTML/HTMLImageElement.h>
 #include <LibWeb/Layout/LayoutImage.h>
 #include <LibWeb/Layout/LayoutImage.h>
 #include <LibWeb/Loader/ResourceLoader.h>
 #include <LibWeb/Loader/ResourceLoader.h>
-#include <LibWeb/Parser/CSSParser.h>
 
 
 namespace Web::HTML {
 namespace Web::HTML {
 
 

+ 1 - 1
Libraries/LibWeb/HTML/HTMLLinkElement.cpp

@@ -27,10 +27,10 @@
 #include <AK/ByteBuffer.h>
 #include <AK/ByteBuffer.h>
 #include <AK/URL.h>
 #include <AK/URL.h>
 #include <LibCore/File.h>
 #include <LibCore/File.h>
+#include <LibWeb/CSS/Parser/CSSParser.h>
 #include <LibWeb/DOM/Document.h>
 #include <LibWeb/DOM/Document.h>
 #include <LibWeb/HTML/HTMLLinkElement.h>
 #include <LibWeb/HTML/HTMLLinkElement.h>
 #include <LibWeb/Loader/ResourceLoader.h>
 #include <LibWeb/Loader/ResourceLoader.h>
-#include <LibWeb/Parser/CSSParser.h>
 
 
 namespace Web::HTML {
 namespace Web::HTML {
 
 

+ 2 - 2
Libraries/LibWeb/HTML/HTMLStyleElement.cpp

@@ -25,10 +25,10 @@
  */
  */
 
 
 #include <AK/StringBuilder.h>
 #include <AK/StringBuilder.h>
+#include <LibWeb/CSS/Parser/CSSParser.h>
 #include <LibWeb/DOM/Document.h>
 #include <LibWeb/DOM/Document.h>
-#include <LibWeb/HTML/HTMLStyleElement.h>
 #include <LibWeb/DOM/Text.h>
 #include <LibWeb/DOM/Text.h>
-#include <LibWeb/Parser/CSSParser.h>
+#include <LibWeb/HTML/HTMLStyleElement.h>
 
 
 namespace Web::HTML {
 namespace Web::HTML {
 
 

+ 1 - 1
Libraries/LibWeb/HTML/HTMLTableCellElement.cpp

@@ -24,8 +24,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
  */
 
 
+#include <LibWeb/CSS/Parser/CSSParser.h>
 #include <LibWeb/HTML/HTMLTableCellElement.h>
 #include <LibWeb/HTML/HTMLTableCellElement.h>
-#include <LibWeb/Parser/CSSParser.h>
 
 
 namespace Web::HTML {
 namespace Web::HTML {
 
 

+ 1 - 1
Libraries/LibWeb/HTML/HTMLTableElement.cpp

@@ -24,8 +24,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
  */
 
 
+#include <LibWeb/CSS/Parser/CSSParser.h>
 #include <LibWeb/HTML/HTMLTableElement.h>
 #include <LibWeb/HTML/HTMLTableElement.h>
-#include <LibWeb/Parser/CSSParser.h>
 
 
 namespace Web::HTML {
 namespace Web::HTML {