2015-11-25 04:14:39 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_ServoBindings_h
|
|
|
|
#define mozilla_ServoBindings_h
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* API for Servo to access Gecko data structures. This file must compile as valid
|
|
|
|
* C code in order for the binding generator to parse it.
|
|
|
|
*
|
|
|
|
* Functions beginning with Gecko_ are implemented in Gecko and invoked from Servo.
|
|
|
|
* Functions beginning with Servo_ are implemented in Servo and invoked from Gecko.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
class nsINode;
|
|
|
|
typedef nsINode RawGeckoNode;
|
|
|
|
namespace mozilla { namespace dom { class Element; } }
|
|
|
|
using mozilla::dom::Element;
|
|
|
|
typedef mozilla::dom::Element RawGeckoElement;
|
|
|
|
class nsIDocument;
|
|
|
|
typedef nsIDocument RawGeckoDocument;
|
2016-02-24 04:28:50 +03:00
|
|
|
struct ServoNodeData;
|
2016-02-26 04:51:01 +03:00
|
|
|
struct RawServoStyleSheet;
|
2016-01-27 05:02:04 +03:00
|
|
|
struct RawServoStyleSet;
|
2015-11-25 04:14:39 +03:00
|
|
|
#else
|
|
|
|
struct RawGeckoNode;
|
|
|
|
typedef struct RawGeckoNode RawGeckoNode;
|
|
|
|
struct RawGeckoElement;
|
|
|
|
typedef struct RawGeckoElement RawGeckoElement;
|
|
|
|
struct RawGeckoDocument;
|
|
|
|
typedef struct RawGeckoDocument RawGeckoDocument;
|
2016-02-24 04:28:50 +03:00
|
|
|
struct ServoNodeData;
|
|
|
|
typedef struct ServoNodeData ServoNodeData;
|
2016-02-26 04:51:01 +03:00
|
|
|
struct RawServoStyleSheet;
|
|
|
|
typedef struct RawServoStyleSheet RawServoStyleSheet;
|
2016-01-27 05:02:04 +03:00
|
|
|
struct RawServoStyleSet;
|
|
|
|
typedef struct RawServoStyleSet RawServoStyleSet;
|
2015-11-25 04:14:39 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// DOM Traversal.
|
|
|
|
uint32_t Gecko_ChildrenCount(RawGeckoNode* node);
|
|
|
|
int Gecko_NodeIsElement(RawGeckoNode* node);
|
|
|
|
RawGeckoNode* Gecko_GetParentNode(RawGeckoNode* node);
|
|
|
|
RawGeckoNode* Gecko_GetFirstChild(RawGeckoNode* node);
|
|
|
|
RawGeckoNode* Gecko_GetLastChild(RawGeckoNode* node);
|
|
|
|
RawGeckoNode* Gecko_GetPrevSibling(RawGeckoNode* node);
|
|
|
|
RawGeckoNode* Gecko_GetNextSibling(RawGeckoNode* node);
|
|
|
|
RawGeckoElement* Gecko_GetParentElement(RawGeckoElement* element);
|
|
|
|
RawGeckoElement* Gecko_GetFirstChildElement(RawGeckoElement* element);
|
|
|
|
RawGeckoElement* Gecko_GetLastChildElement(RawGeckoElement* element);
|
|
|
|
RawGeckoElement* Gecko_GetPrevSiblingElement(RawGeckoElement* element);
|
|
|
|
RawGeckoElement* Gecko_GetNextSiblingElement(RawGeckoElement* element);
|
|
|
|
RawGeckoElement* Gecko_GetDocumentElement(RawGeckoDocument* document);
|
|
|
|
|
|
|
|
// Selector Matching.
|
2016-02-24 04:51:47 +03:00
|
|
|
uint8_t Gecko_ElementState(RawGeckoElement* element);
|
2015-11-25 04:14:39 +03:00
|
|
|
int Gecko_IsHTMLElementInHTMLDocument(RawGeckoElement* element);
|
|
|
|
int Gecko_IsLink(RawGeckoElement* element);
|
|
|
|
int Gecko_IsTextNode(RawGeckoNode* node);
|
|
|
|
int Gecko_IsVisitedLink(RawGeckoElement* element);
|
|
|
|
int Gecko_IsUnvisitedLink(RawGeckoElement* element);
|
|
|
|
int Gecko_IsRootElement(RawGeckoElement* element);
|
|
|
|
|
2016-02-24 04:28:50 +03:00
|
|
|
// Node data.
|
|
|
|
ServoNodeData* Gecko_GetNodeData(RawGeckoNode* node);
|
|
|
|
void Gecko_SetNodeData(RawGeckoNode* node, ServoNodeData* data);
|
|
|
|
void Servo_DropNodeData(ServoNodeData* data);
|
|
|
|
|
2016-01-27 05:02:04 +03:00
|
|
|
// Styleset and Stylesheet management.
|
|
|
|
//
|
|
|
|
// TODO: Make these return already_AddRefed and UniquePtr when the binding
|
|
|
|
// generator is smart enough to handle them.
|
2016-02-26 04:51:01 +03:00
|
|
|
RawServoStyleSheet* Servo_StylesheetFromUTF8Bytes(const uint8_t* bytes, uint32_t length);
|
|
|
|
void Servo_ReleaseStylesheet(RawServoStyleSheet* sheet);
|
2016-01-27 05:02:04 +03:00
|
|
|
RawServoStyleSet* Servo_InitStyleSet();
|
|
|
|
void Servo_DropStyleSet(RawServoStyleSet* set);
|
2016-02-26 04:51:01 +03:00
|
|
|
|
2015-11-25 04:14:39 +03:00
|
|
|
// Servo API.
|
2016-01-27 05:02:04 +03:00
|
|
|
void Servo_RestyleDocument(RawGeckoDocument* doc, RawServoStyleSet* set);
|
2015-11-25 04:14:39 +03:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} // extern "C"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // mozilla_ServoBindings_h
|