Title: [188337] trunk/Source
Revision
188337
Author
[email protected]
Date
2015-08-12 10:53:55 -0700 (Wed, 12 Aug 2015)

Log Message

Web Inspector: Implement selector highlighting for iOS
https://bugs.webkit.org/show_bug.cgi?id=147919

Reviewed by Timothy Hatcher.

Source/WebCore:

* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::getHighlight):
If the current highlight is a nodeList, generate highlights for each node in the list and
return the concatenated value of those highlights.

Source/WebKit2:

* UIProcess/WKInspectorHighlightView.mm:
(-[WKInspectorHighlightView _layoutForNodeHighlight:offset:]):
Added offset parameter to start drawing the highlight at that index of the highlight quad list.

(-[WKInspectorHighlightView _layoutForNodeListHighlight:]):
Loops through the highlight quads and draws a new highlight for every 4 highlight quad objects.

(-[WKInspectorHighlightView update:]):
Now uses the light highlighting for both nodes and lists of nodes.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (188336 => 188337)


--- trunk/Source/WebCore/ChangeLog	2015-08-12 14:28:25 UTC (rev 188336)
+++ trunk/Source/WebCore/ChangeLog	2015-08-12 17:53:55 UTC (rev 188337)
@@ -1,3 +1,15 @@
+2015-08-12  Devin Rousso  <[email protected]>
+
+        Web Inspector: Implement selector highlighting for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=147919
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::getHighlight):
+        If the current highlight is a nodeList, generate highlights for each node in the list and
+        return the concatenated value of those highlights.
+
 2015-08-12  Youenn Fablet  <[email protected]>
 
         Remove promise attribute specific handling from binding generator

Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (188336 => 188337)


--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2015-08-12 14:28:25 UTC (rev 188336)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2015-08-12 17:53:55 UTC (rev 188337)
@@ -226,13 +226,22 @@
 
 void InspectorOverlay::getHighlight(Highlight& highlight, InspectorOverlay::CoordinateSystem coordinateSystem) const
 {
-    if (!m_highlightNode && !m_highlightQuad)
+    if (!m_highlightNode && !m_highlightQuad && !m_highlightNodeList)
         return;
 
     highlight.type = HighlightType::Rects;
     if (m_highlightNode)
         buildNodeHighlight(*m_highlightNode, nullptr, m_nodeHighlightConfig, highlight, coordinateSystem);
-    else
+    else if (m_highlightNodeList) {
+        highlight.setDataFromConfig(m_nodeHighlightConfig);
+        for (unsigned i = 0; i < m_highlightNodeList->length(); ++i) {
+            Highlight nodeHighlight;
+            buildNodeHighlight(*(m_highlightNodeList->item(i)), nullptr, m_nodeHighlightConfig, nodeHighlight, coordinateSystem);
+            if (nodeHighlight.type == HighlightType::Node)
+                highlight.quads.appendVector(nodeHighlight.quads);
+        }
+        highlight.type = HighlightType::NodeList;
+    } else
         buildQuadHighlight(*m_highlightQuad, m_quadHighlightConfig, highlight);
 }
 

Modified: trunk/Source/WebKit2/ChangeLog (188336 => 188337)


--- trunk/Source/WebKit2/ChangeLog	2015-08-12 14:28:25 UTC (rev 188336)
+++ trunk/Source/WebKit2/ChangeLog	2015-08-12 17:53:55 UTC (rev 188337)
@@ -1,3 +1,20 @@
+2015-08-12  Devin Rousso  <[email protected]>
+
+        Web Inspector: Implement selector highlighting for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=147919
+
+        Reviewed by Timothy Hatcher.
+
+        * UIProcess/WKInspectorHighlightView.mm:
+        (-[WKInspectorHighlightView _layoutForNodeHighlight:offset:]):
+        Added offset parameter to start drawing the highlight at that index of the highlight quad list.
+
+        (-[WKInspectorHighlightView _layoutForNodeListHighlight:]):
+        Loops through the highlight quads and draws a new highlight for every 4 highlight quad objects.
+
+        (-[WKInspectorHighlightView update:]):
+        Now uses the light highlighting for both nodes and lists of nodes.
+
 2015-08-11  Carlos Garcia Campos  <[email protected]>
 
         NetworkProcess: DNS prefetch happens in the Web Process

Modified: trunk/Source/WebKit2/UIProcess/WKInspectorHighlightView.mm (188336 => 188337)


--- trunk/Source/WebKit2/UIProcess/WKInspectorHighlightView.mm	2015-08-12 14:28:25 UTC (rev 188336)
+++ trunk/Source/WebKit2/UIProcess/WKInspectorHighlightView.mm	2015-08-12 17:53:55 UTC (rev 188337)
@@ -212,25 +212,23 @@
     CGPathRelease(path);
 }
 
-- (void)_layoutForNodeHighlight:(const Highlight&)highlight
+- (void)_layoutForNodeHighlight:(const Highlight&)highlight offset:(unsigned)offset
 {
-    if (!highlight.quads.size()) {
-        [self _removeAllLayers];
+    ASSERT([_layers count] >= offset + 4);
+    ASSERT(highlight.quads.size() >= offset + 4);
+    if ([_layers count] < offset + 4 || highlight.quads.size() < offset + 4)
         return;
-    }
 
-    [self _createLayers:4];
+    CAShapeLayer *marginLayer = [_layers objectAtIndex:offset];
+    CAShapeLayer *borderLayer = [_layers objectAtIndex:offset + 1];
+    CAShapeLayer *paddingLayer = [_layers objectAtIndex:offset + 2];
+    CAShapeLayer *contentLayer = [_layers objectAtIndex:offset + 3];
 
-    CAShapeLayer *marginLayer = [_layers objectAtIndex:0];
-    CAShapeLayer *borderLayer = [_layers objectAtIndex:1];
-    CAShapeLayer *paddingLayer = [_layers objectAtIndex:2];
-    CAShapeLayer *contentLayer = [_layers objectAtIndex:3];
+    FloatQuad marginQuad = highlight.quads[offset];
+    FloatQuad borderQuad = highlight.quads[offset + 1];
+    FloatQuad paddingQuad = highlight.quads[offset + 2];
+    FloatQuad contentQuad = highlight.quads[offset + 3];
 
-    FloatQuad marginQuad = highlight.quads[0];
-    FloatQuad borderQuad = highlight.quads[1];
-    FloatQuad paddingQuad = highlight.quads[2];
-    FloatQuad contentQuad = highlight.quads[3];
-
     marginLayer.fillColor = cachedCGColor(highlight.marginColor, ColorSpaceDeviceRGB);
     borderLayer.fillColor = cachedCGColor(highlight.borderColor, ColorSpaceDeviceRGB);
     paddingLayer.fillColor = cachedCGColor(highlight.paddingColor, ColorSpaceDeviceRGB);
@@ -242,6 +240,20 @@
     layerPath(contentLayer, contentQuad);
 }
 
+- (void)_layoutForNodeListHighlight:(const Highlight&)highlight
+{
+    if (!highlight.quads.size()) {
+        [self _removeAllLayers];
+        return;
+    }
+
+    unsigned nodeCount = highlight.quads.size() / 4;
+    [self _createLayers:nodeCount * 4];
+
+    for (unsigned i = 0; i < nodeCount; ++i)
+        [self _layoutForNodeHighlight:highlight offset:i * 4];
+}
+
 - (void)_layoutForRectsHighlight:(const Highlight&)highlight
 {
     NSUInteger numLayers = highlight.quads.size();
@@ -262,8 +274,8 @@
 
 - (void)update:(const Highlight&)highlight
 {
-    if (highlight.type == HighlightType::Node)
-        [self _layoutForNodeHighlight:highlight];
+    if (highlight.type == HighlightType::Node || highlight.type == HighlightType::NodeList)
+        [self _layoutForNodeListHighlight:highlight];
     else if (highlight.type == HighlightType::Rects)
         [self _layoutForRectsHighlight:highlight];
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to