Browse Source

Fix debugger title update

Michael Ragazzon 6 years ago
parent
commit
e479360211
3 changed files with 21 additions and 26 deletions
  1. 17 16
      Source/Debugger/ElementInfo.cpp
  2. 2 0
      Source/Debugger/ElementInfo.h
  3. 2 10
      Source/Debugger/InfoSource.h

+ 17 - 16
Source/Debugger/ElementInfo.cpp

@@ -111,6 +111,7 @@ ElementInfo::ElementInfo(const Core::String& tag) : Core::ElementDocument(tag)
 	show_source_element = true;
 	show_source_element = true;
 	update_source_element = true;
 	update_source_element = true;
 	force_update_once = false;
 	force_update_once = false;
+	title_dirty = true;
 	previous_update_time = 0.0;
 	previous_update_time = 0.0;
 
 
 	RMLUI_ASSERT(TestPrettyFormat("0.15", "0.15"));
 	RMLUI_ASSERT(TestPrettyFormat("0.15", "0.15"));
@@ -188,6 +189,12 @@ void ElementInfo::OnUpdate()
 			UpdateSourceElement();
 			UpdateSourceElement();
 		}
 		}
 	}
 	}
+
+	if (title_dirty)
+	{
+		UpdateTitle();
+		title_dirty = false;
+	}
 }
 }
 
 
 // Called when an element is destroyed.
 // Called when an element is destroyed.
@@ -363,18 +370,15 @@ void ElementInfo::ProcessEvent(Core::Event& event)
 					hover_element = nullptr;
 					hover_element = nullptr;
 				}
 				}
 
 
-				if(event.GetPhase() == Core::EventPhase::Bubble)
+				if (id == "show_source" && !show_source_element)
 				{
 				{
-					if (id == "show_source" && !show_source_element)
-					{
-						// Preview the source element view while hovering
-						show_source_element = true;
-					}
+					// Preview the source element view while hovering
+					show_source_element = true;
+				}
 
 
-					if (id == "show_source" || id == "update_source")
-					{
-						UpdateTitle();
-					}
+				if (id == "show_source" || id == "update_source")
+				{
+					title_dirty = true;
 				}
 				}
 			}
 			}
 			// Otherwise we just want to focus on the clicked element (unless it's on a debug element)
 			// Otherwise we just want to focus on the clicked element (unless it's on a debug element)
@@ -383,7 +387,7 @@ void ElementInfo::ProcessEvent(Core::Event& event)
 				hover_element = target_element;
 				hover_element = target_element;
 			}
 			}
 		}
 		}
-		else if (event == Core::EventId::Mouseout && event.GetPhase() == Core::EventPhase::Bubble)
+		else if (event == Core::EventId::Mouseout)
 		{
 		{
 			Core::Element* target_element = event.GetTargetElement();
 			Core::Element* target_element = event.GetTargetElement();
 			Core::ElementDocument* owner_document = target_element->GetOwnerDocument();
 			Core::ElementDocument* owner_document = target_element->GetOwnerDocument();
@@ -399,8 +403,7 @@ void ElementInfo::ProcessEvent(Core::Event& event)
 
 
 				if (id == "show_source" || id == "update_source")
 				if (id == "show_source" || id == "update_source")
 				{
 				{
-					UpdateTitle();
-					event.StopPropagation();
+					title_dirty = true;
 				}
 				}
 			}
 			}
 		}
 		}
@@ -416,9 +419,7 @@ void ElementInfo::SetSourceElement(Core::Element* new_source_element)
 void ElementInfo::UpdateSourceElement()
 void ElementInfo::UpdateSourceElement()
 {
 {
 	previous_update_time = Core::GetSystemInterface()->GetElapsedTime();
 	previous_update_time = Core::GetSystemInterface()->GetElapsedTime();
-
-	// Set the title
-	UpdateTitle();
+	title_dirty = true;
 
 
 	// Set the pseudo classes
 	// Set the pseudo classes
 	if (Core::Element* pseudo = GetElementById("pseudo"))
 	if (Core::Element* pseudo = GetElementById("pseudo"))

+ 2 - 0
Source/Debugger/ElementInfo.h

@@ -86,6 +86,8 @@ private:
 	bool update_source_element;
 	bool update_source_element;
 	// Forces an update to the source element during the next update loop.
 	// Forces an update to the source element during the next update loop.
 	bool force_update_once;
 	bool force_update_once;
+	
+	bool title_dirty;
 
 
 	Core::Element* hover_element;
 	Core::Element* hover_element;
 	Core::Element* source_element;
 	Core::Element* source_element;

+ 2 - 10
Source/Debugger/InfoSource.h

@@ -70,20 +70,12 @@ h3.strong
 	color: #900;
 	color: #900;
 	background-color: #eee;
 	background-color: #eee;
 }
 }
-#pseudo
-{
-	line-height: 1.4em;
-	padding: 2px 0;
-}
 #pseudo pseudo
 #pseudo pseudo
 {
 {
-	padding: 0 3dp;
+	padding: 0 8dp 0 3dp;
 	background-color: #ddd;
 	background-color: #ddd;
 	border: 2px #aaa;
 	border: 2px #aaa;
-}
-#pseudo span
-{
-	padding-left: 3dp;
+	display: inline-block;
 }
 }
 #pseudo pseudo.active
 #pseudo pseudo.active
 {
 {