mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
LibWeb: Add ProcessingInstruction node
Not particuarly useful right now, but is used in ensure_pre_insertion_validity. I'm not totally sure on the constructor arguments.
This commit is contained in:
parent
c28a3a385b
commit
9e338a2be2
6 changed files with 101 additions and 0 deletions
|
@ -205,6 +205,8 @@
|
|||
#include <LibWeb/Bindings/PerformancePrototype.h>
|
||||
#include <LibWeb/Bindings/PerformanceTimingConstructor.h>
|
||||
#include <LibWeb/Bindings/PerformanceTimingPrototype.h>
|
||||
#include <LibWeb/Bindings/ProcessingInstructionConstructor.h>
|
||||
#include <LibWeb/Bindings/ProcessingInstructionPrototype.h>
|
||||
#include <LibWeb/Bindings/ProgressEventConstructor.h>
|
||||
#include <LibWeb/Bindings/ProgressEventPrototype.h>
|
||||
#include <LibWeb/Bindings/SVGElementConstructor.h>
|
||||
|
@ -337,6 +339,7 @@
|
|||
ADD_WINDOW_OBJECT_INTERFACE(Node) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(Performance) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(PerformanceTiming) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(ProcessingInstruction) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(ProgressEvent) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(Screen) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(ShadowRoot) \
|
||||
|
|
|
@ -54,6 +54,7 @@ set(SOURCES
|
|||
DOM/Node.cpp
|
||||
DOM/ParentNode.cpp
|
||||
DOM/Position.cpp
|
||||
DOM/ProcessingInstruction.cpp
|
||||
DOM/ShadowRoot.cpp
|
||||
DOM/Text.cpp
|
||||
DOM/Text.idl
|
||||
|
@ -305,6 +306,7 @@ libweb_js_wrapper(DOM/DOMImplementation)
|
|||
libweb_js_wrapper(DOM/Element)
|
||||
libweb_js_wrapper(DOM/Event)
|
||||
libweb_js_wrapper(DOM/EventTarget)
|
||||
libweb_js_wrapper(DOM/ProcessingInstruction)
|
||||
libweb_js_wrapper(DOM/ShadowRoot)
|
||||
libweb_js_wrapper(DOM/Node)
|
||||
libweb_js_wrapper(DOM/Range)
|
||||
|
|
42
Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp
Normal file
42
Userland/Libraries/LibWeb/DOM/ProcessingInstruction.cpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2021, the SerenityOS developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <LibWeb/DOM/ProcessingInstruction.h>
|
||||
#include <LibWeb/Layout/TextNode.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
|
||||
ProcessingInstruction::ProcessingInstruction(Document& document, const String& data, const String& target)
|
||||
: CharacterData(document, NodeType::PROCESSING_INSTRUCTION_NODE, data)
|
||||
, m_target(target)
|
||||
{
|
||||
}
|
||||
|
||||
ProcessingInstruction::~ProcessingInstruction()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
49
Userland/Libraries/LibWeb/DOM/ProcessingInstruction.h
Normal file
49
Userland/Libraries/LibWeb/DOM/ProcessingInstruction.h
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* Copyright (c) 2021, the SerenityOS developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/FlyString.h>
|
||||
#include <LibWeb/DOM/CharacterData.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
|
||||
class ProcessingInstruction final : public CharacterData {
|
||||
public:
|
||||
using WrapperType = Bindings::ProcessingInstructionWrapper;
|
||||
|
||||
ProcessingInstruction(Document&, const String&, const String&);
|
||||
virtual ~ProcessingInstruction() override;
|
||||
|
||||
virtual FlyString node_name() const override { return m_target; }
|
||||
|
||||
const String& target() const { return m_target; }
|
||||
|
||||
private:
|
||||
String m_target;
|
||||
};
|
||||
|
||||
}
|
3
Userland/Libraries/LibWeb/DOM/ProcessingInstruction.idl
Normal file
3
Userland/Libraries/LibWeb/DOM/ProcessingInstruction.idl
Normal file
|
@ -0,0 +1,3 @@
|
|||
interface ProcessingInstruction : CharacterData {
|
||||
readonly attribute DOMString target;
|
||||
};
|
|
@ -60,6 +60,7 @@ class MouseEvent;
|
|||
class Node;
|
||||
class ParentNode;
|
||||
class Position;
|
||||
class ProcessingInstruction;
|
||||
class ShadowRoot;
|
||||
class Text;
|
||||
class Timer;
|
||||
|
@ -300,6 +301,7 @@ class MouseEventWrapper;
|
|||
class NodeWrapper;
|
||||
class PerformanceTimingWrapper;
|
||||
class PerformanceWrapper;
|
||||
class ProcessingInstructionWrapper;
|
||||
class ProgressEventWrapper;
|
||||
class ScreenWrapper;
|
||||
class ScriptExecutionContext;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue