|
|
|
@ -272,6 +272,14 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f
@@ -272,6 +272,14 @@ DocumentComponent::DocumentComponent(const float rawX, const float rawY, const f
|
|
|
|
|
} |
|
|
|
|
printf("\n\n"); |
|
|
|
|
} |
|
|
|
|
if (key == GLFW_KEY_V && action == GLFW_RELEASE) { |
|
|
|
|
printf("Printing JS Variables\n\n"); |
|
|
|
|
//std::cout << "DocumentComponent::render - JS var state" << std::endl;
|
|
|
|
|
for(auto it : this->mainScript->rootScope.variables) { |
|
|
|
|
std::cout << "[" << it.first << "=" << it.second << "]" << std::endl; |
|
|
|
|
} |
|
|
|
|
printf("\n\n"); |
|
|
|
|
} |
|
|
|
|
if (key == GLFW_KEY_T && action == GLFW_RELEASE) { |
|
|
|
|
browser->NextTheme(); |
|
|
|
|
} |
|
|
|
@ -393,6 +401,10 @@ void DocumentComponent::setDOM(const std::shared_ptr<Node> rootNode) {
@@ -393,6 +401,10 @@ void DocumentComponent::setDOM(const std::shared_ptr<Node> rootNode) {
|
|
|
|
|
if (domRootNode) { |
|
|
|
|
deleteNode(domRootNode); |
|
|
|
|
} |
|
|
|
|
// reset JS engine
|
|
|
|
|
//mainScript.clear();
|
|
|
|
|
mainScript = std::make_shared<JavaScript>(); |
|
|
|
|
|
|
|
|
|
// reset scroll position
|
|
|
|
|
//transformMatrix[13] = 2;
|
|
|
|
|
//transformMatrixDirty = true;
|
|
|
|
@ -420,6 +432,14 @@ void DocumentComponent::render() {
@@ -420,6 +432,14 @@ void DocumentComponent::render() {
|
|
|
|
|
|
|
|
|
|
//Component::printComponentTree(rootComponent, 0);
|
|
|
|
|
domDirty = false; |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
std::cout << "DocumentComponent::render - JS var state" << std::endl; |
|
|
|
|
for(auto it : this->mainScript->rootScope.variables) { |
|
|
|
|
std::cout << "[" << it.first << "=" << it.second << "]" << std::endl; |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
//std::cout << "root Height: " << static_cast<int>(rootComponent->height) << " window Height: " << windowHeight << " y " << static_cast<int>(this->y) << std::endl;
|
|
|
|
|
//scrollHeight = std::max(0, static_cast<int>(rootComponent->height - (windowHeight + (this->y * 2))));
|
|
|
|
|
|
|
|
|
@ -606,7 +626,7 @@ void DocumentComponent::handleResource(WebResource &res, std::string url) {
@@ -606,7 +626,7 @@ void DocumentComponent::handleResource(WebResource &res, std::string url) {
|
|
|
|
|
std::cout << "DocumentComponent::handleResource - Rendering text document" << std::endl; |
|
|
|
|
std::shared_ptr<Node> rootNode = std::make_shared<Node>(NodeType::ROOT); |
|
|
|
|
std::shared_ptr<TagNode> tagNode = std::make_shared<TagNode>(); |
|
|
|
|
tagNode->tag="p"; |
|
|
|
|
tagNode->tag = "p"; |
|
|
|
|
// bind tag to root
|
|
|
|
|
tagNode->parent = rootNode; |
|
|
|
|
rootNode->children.push_back(tagNode); |
|
|
|
|