Changeset 289416 in webkit


Ignore:
Timestamp:
Feb 8, 2022 12:25:39 PM (5 months ago)
Author:
Razvan Caliman
Message:

Web Inspector: [Flexbox] Add support for showing/hiding flex container overlays and basic overlay drawing
https://bugs.webkit.org/show_bug.cgi?id=236013
<rdar://87893201>

Reviewed by Patrick Angle.

Source/JavaScriptCore:

Add new commands to show and hide flex overlays.

  • inspector/protocol/DOM.json:

Source/WebCore:

Test: inspector/dom/showFlexOverlay.html

  • The test follows the example for checking grid overlays at inspector/dom/showGridOverlay.html

Implement backend commands to toggle the visibility of a specialized page overlay shown on top of a flex container.
At this stage, the overlay consists of an outline around the bounding box of the flex container.
Future patches will add more detail regarding flex items and gaps between them.

This patch follows closely the example for toggling the visibility of CSS Grid overlays implemented in
https://bugs.webkit.org/show_bug.cgi?id=221062

  • inspector/InspectorController.cpp:

(WebCore::InspectorController::flexOverlayCount const):

  • inspector/InspectorController.h:
  • inspector/InspectorOverlay.cpp:

(WebCore::InspectorOverlay::paint):
(WebCore::InspectorOverlay::getHighlight):
(WebCore::InspectorOverlay::shouldShowOverlay const):
(WebCore::InspectorOverlay::removeFlexOverlayForNode):

(WebCore::InspectorOverlay::setFlexOverlayForNode):
(WebCore::InspectorOverlay::clearFlexOverlayForNode):
(WebCore::InspectorOverlay::clearAllFlexOverlays):

  • Maintain a list of active flex overlays. A node can have only one flex overlay at a time.

(WebCore::InspectorOverlay::drawFlexOverlay):
(WebCore::InspectorOverlay::buildFlexOverlay):

  • inspector/InspectorOverlay.h:

(WebCore::InspectorOverlay::flexOverlayCount const):
(WebCore::InspectorOverlay::Highlight::FlexHighlightOverlay::encode const):
(WebCore::InspectorOverlay::Highlight::FlexHighlightOverlay::decode):

  • The signature of the flex overlay includes the color for the outline and a quad expressing the bounding box of the flex container.
  • inspector/agents/InspectorDOMAgent.cpp:

(WebCore::InspectorDOMAgent::showFlexOverlay):
(WebCore::InspectorDOMAgent::hideFlexOverlay):

  • Translate protocol commands into InspectorOverlay method calls.
  • inspector/agents/InspectorDOMAgent.h:
  • testing/Internals.cpp:

(WebCore::Internals::inspectorFlexOverlayCount):

  • testing/Internals.h:
  • testing/Internals.idl:
  • Helper used in testing to check the number of shown flex overlays.

Source/WebKit:

Add basic logic to draw a flex overlay on top of a flex container on iOS/iPadOS. Used by Web Inspector.

  • Shared/WebCoreArgumentCoders.cpp:

(IPC::ArgumentCoder<InspectorOverlay::Highlight>::encode):
(IPC::ArgumentCoder<InspectorOverlay::Highlight>::decode):

  • UIProcess/Inspector/ios/WKInspectorHighlightView.mm:

(-[WKInspectorHighlightView drawRect:]):

LayoutTests:

  • inspector/dom/showFlexOverlay-expected.txt: Added.
  • inspector/dom/showFlexOverlay.html: Added.
  • inspector/dom/showGridOverlay.html:
  • Drive-by clean-up of out-of-context comments.
Location:
trunk
Files:
2 added
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r289408 r289416  
     12022-02-08  Razvan Caliman  <rcaliman@apple.com>
     2
     3        Web Inspector: [Flexbox] Add support for showing/hiding flex container overlays and basic overlay drawing
     4        https://bugs.webkit.org/show_bug.cgi?id=236013
     5        <rdar://87893201>
     6
     7        Reviewed by Patrick Angle.
     8
     9        * inspector/dom/showFlexOverlay-expected.txt: Added.
     10        * inspector/dom/showFlexOverlay.html: Added.
     11
     12        * inspector/dom/showGridOverlay.html:
     13        - Drive-by clean-up of out-of-context comments.
     14
    1152022-02-08  Jon Lee  <jonlee@apple.com>
    216
  • trunk/LayoutTests/inspector/dom/showGridOverlay.html

    r272197 r289416  
    7373            await checkGridOverlayCount(1);
    7474
    75             // No error should occur if showing grid overlay for a node that already has one.
    7675            InspectorTest.log("Requesting to show second grid overlay");
    7776            await DOMAgent.showGridOverlay(second.id, WI.Color.fromString("green").toProtocol());
     
    101100            await checkGridOverlayCount(1);
    102101
    103             // No error should occur if showing grid overlay for a node that already has one.
    104102            InspectorTest.log("Requesting to show a different grid overlay");
    105103            await DOMAgent.showGridOverlay(second.id, WI.Color.fromString("green").toProtocol());
  • trunk/Source/JavaScriptCore/ChangeLog

    r289359 r289416  
     12022-02-08  Razvan Caliman  <rcaliman@apple.com>
     2
     3        Web Inspector: [Flexbox] Add support for showing/hiding flex container overlays and basic overlay drawing
     4        https://bugs.webkit.org/show_bug.cgi?id=236013
     5        <rdar://87893201>
     6
     7        Reviewed by Patrick Angle.
     8
     9        Add new commands to show and hide flex overlays.
     10
     11        * inspector/protocol/DOM.json:
     12
    1132022-02-07  Yusuke Suzuki  <ysuzuki@apple.com>
    214
  • trunk/Source/JavaScriptCore/inspector/protocol/DOM.json

    r288623 r289416  
    527527        },
    528528        {
     529            "name": "showFlexOverlay",
     530            "description": "Shows a flex overlay for a node that begins a 'flex' layout context. The command has no effect if <code>nodeId</code> is invalid or the associated node does not begin a 'flex' layout context. A node can only have one flex overlay at a time; subsequent calls with the same <code>nodeId</code> will override earlier calls.",
     531            "targetTypes": ["page"],
     532            "parameters": [
     533                { "name": "nodeId", "$ref": "NodeId", "description": "The node for which a flex overlay should be shown." },
     534                { "name": "flexColor", "$ref": "RGBAColor", "description": "The primary color to use for the flex overlay." }
     535            ]
     536        },
     537        {
     538            "name": "hideFlexOverlay",
     539            "description": "Hides a flex overlay for a node that begins a 'flex' layout context. The command has no effect if <code>nodeId</code> is specified and invalid, or if there is not currently an overlay set for the <code>nodeId</code>.",
     540            "targetTypes": ["page"],
     541            "parameters": [
     542                { "name": "nodeId", "$ref": "NodeId", "optional": true, "description": "The node for which a flex overlay should be hidden. If a <code>nodeId</code> is not specified, all flex overlays will be hidden." }
     543            ]
     544        },
     545        {
    529546            "name": "pushNodeByPathToFrontend",
    530547            "description": "Requests that the node is sent to the caller given its path.",
  • trunk/Source/WebCore/ChangeLog

    r289410 r289416  
     12022-02-08  Razvan Caliman  <rcaliman@apple.com>
     2
     3        Web Inspector: [Flexbox] Add support for showing/hiding flex container overlays and basic overlay drawing
     4        https://bugs.webkit.org/show_bug.cgi?id=236013
     5        <rdar://87893201>
     6
     7        Reviewed by Patrick Angle.
     8
     9        Test: inspector/dom/showFlexOverlay.html
     10        - The test follows the example for checking grid overlays at inspector/dom/showGridOverlay.html
     11
     12        Implement backend commands to toggle the visibility of a specialized page overlay shown on top of a flex container.
     13        At this stage, the overlay consists of an outline around the bounding box of the flex container.
     14        Future patches will add more detail regarding flex items and gaps between them.
     15
     16        This patch follows closely the example for toggling the visibility of CSS Grid overlays implemented in
     17        https://bugs.webkit.org/show_bug.cgi?id=221062
     18
     19        * inspector/InspectorController.cpp:
     20        (WebCore::InspectorController::flexOverlayCount const):
     21        * inspector/InspectorController.h:
     22        * inspector/InspectorOverlay.cpp:
     23        (WebCore::InspectorOverlay::paint):
     24        (WebCore::InspectorOverlay::getHighlight):
     25        (WebCore::InspectorOverlay::shouldShowOverlay const):
     26        (WebCore::InspectorOverlay::removeFlexOverlayForNode):
     27
     28        (WebCore::InspectorOverlay::setFlexOverlayForNode):
     29        (WebCore::InspectorOverlay::clearFlexOverlayForNode):
     30        (WebCore::InspectorOverlay::clearAllFlexOverlays):
     31        - Maintain a list of active flex overlays. A node can have only one flex overlay at a time.
     32
     33        (WebCore::InspectorOverlay::drawFlexOverlay):
     34        (WebCore::InspectorOverlay::buildFlexOverlay):
     35        * inspector/InspectorOverlay.h:
     36        (WebCore::InspectorOverlay::flexOverlayCount const):
     37        (WebCore::InspectorOverlay::Highlight::FlexHighlightOverlay::encode const):
     38        (WebCore::InspectorOverlay::Highlight::FlexHighlightOverlay::decode):
     39        - The signature of the flex overlay includes the color for the outline and a quad expressing the bounding box of the flex container.
     40
     41        * inspector/agents/InspectorDOMAgent.cpp:
     42        (WebCore::InspectorDOMAgent::showFlexOverlay):
     43        (WebCore::InspectorDOMAgent::hideFlexOverlay):
     44        - Translate protocol commands into InspectorOverlay method calls.
     45
     46        * inspector/agents/InspectorDOMAgent.h:
     47
     48        * testing/Internals.cpp:
     49        (WebCore::Internals::inspectorFlexOverlayCount):
     50        * testing/Internals.h:
     51        * testing/Internals.idl:
     52        - Helper used in testing to check the number of shown flex overlays.
     53
    1542022-02-08  Cameron McCormack  <heycam@apple.com>
    255
  • trunk/Source/WebCore/inspector/InspectorController.cpp

    r288361 r289416  
    370370}
    371371
     372unsigned InspectorController::flexOverlayCount() const
     373{
     374    return m_overlay->flexOverlayCount();
     375}
     376
    372377unsigned InspectorController::paintRectCount() const
    373378{
  • trunk/Source/WebCore/inspector/InspectorController.h

    r288361 r289416  
    107107    WEBCORE_EXPORT void evaluateForTestInFrontend(const String& script);
    108108    WEBCORE_EXPORT unsigned gridOverlayCount() const;
     109    WEBCORE_EXPORT unsigned flexOverlayCount() const;
    109110    WEBCORE_EXPORT unsigned paintRectCount() const;
    110111
  • trunk/Source/WebCore/inspector/InspectorOverlay.cpp

    r288942 r289416  
    6262#include "RenderBox.h"
    6363#include "RenderBoxModelObject.h"
     64#include "RenderFlexibleBox.h"
    6465#include "RenderGrid.h"
    6566#include "RenderInline.h"
     
    438439    }
    439440
     441    for (const InspectorOverlay::Flex& flexOverlay : m_activeFlexOverlays) {
     442        if (auto flexHighlightOverlay = buildFlexOverlay(flexOverlay))
     443            drawFlexOverlay(context, *flexHighlightOverlay);
     444    }
     445
    440446    if (!m_paintRects.isEmpty())
    441447        drawPaintRects(context, m_paintRects);
     
    447453void InspectorOverlay::getHighlight(InspectorOverlay::Highlight& highlight, InspectorOverlay::CoordinateSystem coordinateSystem)
    448454{
    449     if (!m_highlightNode && !m_highlightQuad && !m_highlightNodeList && !m_activeGridOverlays.size())
     455    if (!m_highlightNode && !m_highlightQuad && !m_highlightNodeList && !m_activeGridOverlays.size() && !m_activeFlexOverlays.size())
    450456        return;
    451457
     
    471477            highlight.gridHighlightOverlays.append(*gridHighlightOverlay);
    472478    }
     479
     480    for (const InspectorOverlay::Flex& flexOverlay : m_activeFlexOverlays) {
     481        if (auto flexHighlightOverlay = buildFlexOverlay(flexOverlay))
     482            highlight.flexHighlightOverlays.append(*flexHighlightOverlay);
     483    }
    473484}
    474485
     
    531542    // Don't show the overlay when m_showRulersDuringElementSelection is true, as it's only supposed
    532543    // to have an effect when element selection is active (e.g. a node is hovered).
    533     return m_highlightNode || m_highlightNodeList || m_highlightQuad || m_indicating || m_showPaintRects || m_showRulers || m_activeGridOverlays.size();
     544    return m_highlightNode || m_highlightNodeList || m_highlightQuad || m_indicating || m_showPaintRects || m_showRulers || m_activeGridOverlays.size() || m_activeFlexOverlays.size();
    534545}
    535546
     
    627638{
    628639    m_activeGridOverlays.clear();
     640
     641    update();
     642}
     643
     644bool InspectorOverlay::removeFlexOverlayForNode(Node& node)
     645{
     646    // Try to remove `node`. Also clear any grid overlays whose WeakPtr<Node> has been cleared.
     647    return m_activeFlexOverlays.removeAllMatching([&] (const InspectorOverlay::Flex& flexOverlay) {
     648        return !flexOverlay.flexNode || flexOverlay.flexNode.get() == &node;
     649    });
     650}
     651
     652ErrorStringOr<void> InspectorOverlay::setFlexOverlayForNode(Node& node, const InspectorOverlay::Flex::Config& flexOverlayConfig)
     653{
     654    if (!is<RenderFlexibleBox>(node.renderer()))
     655        return makeUnexpected("Node does not initiate a flex context");
     656
     657    removeFlexOverlayForNode(node);
     658
     659    m_activeFlexOverlays.append({ node, flexOverlayConfig });
     660
     661    update();
     662
     663    return { };
     664}
     665
     666ErrorStringOr<void> InspectorOverlay::clearFlexOverlayForNode(Node& node)
     667{
     668    if (!removeFlexOverlayForNode(node))
     669        return makeUnexpected("No flex overlay exists for the node, so cannot clear.");
     670
     671    update();
     672
     673    return { };
     674}
     675
     676void InspectorOverlay::clearAllFlexOverlays()
     677{
     678    m_activeFlexOverlays.clear();
    629679
    630680    update();
     
    19381988}
    19391989
     1990void InspectorOverlay::drawFlexOverlay(GraphicsContext& context, const InspectorOverlay::Highlight::FlexHighlightOverlay& flexHighlightOverlay)
     1991{
     1992    GraphicsContextStateSaver saver(context);
     1993    context.setStrokeThickness(1);
     1994    context.setStrokeColor(flexHighlightOverlay.color);
     1995    context.strokePath(quadToPath(flexHighlightOverlay.containerBounds));
     1996}
     1997
     1998std::optional<InspectorOverlay::Highlight::FlexHighlightOverlay> InspectorOverlay::buildFlexOverlay(const InspectorOverlay::Flex& flexOverlay)
     1999{
     2000    // If the node WeakPtr has been cleared, then the node is gone and there's nothing to draw.
     2001    if (!flexOverlay.flexNode) {
     2002        m_activeFlexOverlays.removeAllMatching([&] (const InspectorOverlay::Flex& flexOverlay) {
     2003            return !flexOverlay.flexNode;
     2004        });
     2005        return { };
     2006    }
     2007
     2008    // Always re-check because the node's renderer may have changed since being added.
     2009    // If renderer is no longer a flex, then remove the flex overlay for the node.
     2010    Node* node = flexOverlay.flexNode.get();
     2011    auto renderer = node->renderer();
     2012    if (!is<RenderFlexibleBox>(renderer)) {
     2013        removeFlexOverlayForNode(*node);
     2014        return { };
     2015    }
     2016
     2017    auto& renderFlex = *downcast<RenderFlexibleBox>(renderer);
     2018
     2019    Frame* containingFrame = node->document().frame();
     2020    if (!containingFrame)
     2021        return { };
     2022    FrameView* containingView = containingFrame->view();
     2023
     2024    auto localQuadToRootQuad = [&](const FloatQuad& quad) -> FloatQuad {
     2025        return {
     2026            localPointToRootPoint(containingView, quad.p1()),
     2027            localPointToRootPoint(containingView, quad.p2()),
     2028            localPointToRootPoint(containingView, quad.p3()),
     2029            localPointToRootPoint(containingView, quad.p4())
     2030        };
     2031    };
     2032
     2033    InspectorOverlay::Highlight::FlexHighlightOverlay flexHighlightOverlay;
     2034    flexHighlightOverlay.color = flexOverlay.config.flexColor;
     2035    flexHighlightOverlay.containerBounds = localQuadToRootQuad({ renderFlex.absoluteContentQuad() });
     2036
     2037    return { flexHighlightOverlay };
     2038}
     2039
    19402040} // namespace WebCore
  • trunk/Source/WebCore/inspector/InspectorOverlay.h

    r286588 r289416  
    142142        };
    143143
     144        struct FlexHighlightOverlay {
     145            WTF_MAKE_STRUCT_FAST_ALLOCATED;
     146
     147            Color color;
     148            FloatQuad containerBounds;
     149
     150#if PLATFORM(IOS_FAMILY)
     151            template<class Encoder> void encode(Encoder&) const;
     152            template<class Decoder> static std::optional<InspectorOverlay::Highlight::FlexHighlightOverlay> decode(Decoder&);
     153#endif
     154        };
     155
    144156        void setDataFromConfig(const Config& config)
    145157        {
     
    161173        Vector<FloatQuad> quads;
    162174        Vector<GridHighlightOverlay> gridHighlightOverlays;
     175        Vector<FlexHighlightOverlay> flexHighlightOverlays;
    163176        bool usePageCoordinates {true};
    164177
     
    184197    };
    185198
     199    struct Flex {
     200        WTF_MAKE_STRUCT_FAST_ALLOCATED;
     201
     202        struct Config {
     203            WTF_MAKE_STRUCT_FAST_ALLOCATED;
     204
     205            Color flexColor;
     206        };
     207
     208        WeakPtr<Node> flexNode;
     209        Config config;
     210    };
     211
    186212    enum class CoordinateSystem {
    187213        View, // Adjusts for the main frame's scroll offset.
     
    208234    Node* highlightedNode() const;
    209235    unsigned gridOverlayCount() const { return m_activeGridOverlays.size(); }
     236    unsigned flexOverlayCount() const { return m_activeFlexOverlays.size(); }
    210237
    211238    void didSetSearchingForNode(bool enabled);
     
    213240    void setIndicating(bool indicating);
    214241
    215     // Multiple grid overlays can be active at the same time. These methods
     242    // Multiple grid and flex overlays can be active at the same time. These methods
    216243    // will fail if the node is not a grid or if the node has been GC'd.
    217244    Inspector::ErrorStringOr<void> setGridOverlayForNode(Node&, const InspectorOverlay::Grid::Config&);
     
    219246    void clearAllGridOverlays();
    220247
     248    Inspector::ErrorStringOr<void> setFlexOverlayForNode(Node&, const InspectorOverlay::Flex::Config&);
     249    Inspector::ErrorStringOr<void> clearFlexOverlayForNode(Node&);
     250    void clearAllFlexOverlays();
     251
    221252    WEBCORE_EXPORT static void drawGridOverlay(GraphicsContext&, const InspectorOverlay::Highlight::GridHighlightOverlay&);
     253    WEBCORE_EXPORT static void drawFlexOverlay(GraphicsContext&, const InspectorOverlay::Highlight::FlexHighlightOverlay&);
    222254private:
    223255    using TimeRectPair = std::pair<MonotonicTime, FloatRect>;
     
    237269   
    238270    std::optional<InspectorOverlay::Highlight::GridHighlightOverlay> buildGridOverlay(const InspectorOverlay::Grid&, bool offsetBoundsByScroll = false);
     271    std::optional<InspectorOverlay::Highlight::FlexHighlightOverlay> buildFlexOverlay(const InspectorOverlay::Flex&);
    239272
    240273    void updatePaintRectsTimerFired();
    241274
    242275    bool removeGridOverlayForNode(Node&);
     276    bool removeFlexOverlayForNode(Node&);
    243277
    244278    Page& m_page;
     
    256290
    257291    Vector<InspectorOverlay::Grid> m_activeGridOverlays;
     292    Vector<InspectorOverlay::Flex> m_activeFlexOverlays;
    258293
    259294    bool m_indicating { false };
     
    265300#if PLATFORM(IOS_FAMILY)
    266301
     302template<class Encoder> void InspectorOverlay::Highlight::FlexHighlightOverlay::encode(Encoder& encoder) const
     303{
     304    encoder << color;
     305    encoder << containerBounds;
     306}
     307
     308template<class Decoder> std::optional<InspectorOverlay::Highlight::FlexHighlightOverlay> InspectorOverlay::Highlight::FlexHighlightOverlay::decode(Decoder& decoder)
     309{
     310    InspectorOverlay::Highlight::FlexHighlightOverlay flexHighlightOverlay;
     311    if (!decoder.decode(flexHighlightOverlay.color))
     312        return { };
     313    if (!decoder.decode(flexHighlightOverlay.containerBounds))
     314        return { };
     315    return { flexHighlightOverlay };
     316}
     317
    267318template<class Encoder> void InspectorOverlay::Highlight::GridHighlightOverlay::encode(Encoder& encoder) const
    268319{
  • trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp

    r288646 r289416  
    15431543}
    15441544
     1545Inspector::Protocol::ErrorStringOr<void> InspectorDOMAgent::showFlexOverlay(Inspector::Protocol::DOM::NodeId nodeId, Ref<JSON::Object>&& flexColor)
     1546{
     1547    Protocol::ErrorString errorString;
     1548    Node* node = assertNode(errorString, nodeId);
     1549    if (!node)
     1550        return makeUnexpected(errorString);
     1551
     1552    auto parsedColor = parseColor(WTFMove(flexColor));
     1553    if (!parsedColor)
     1554        return makeUnexpected("Invalid color could not be parsed.");
     1555
     1556    InspectorOverlay::Flex::Config config;
     1557    config.flexColor = *parsedColor;
     1558
     1559    m_overlay->setFlexOverlayForNode(*node, config);
     1560
     1561    return { };
     1562}
     1563
     1564Inspector::Protocol::ErrorStringOr<void> InspectorDOMAgent::hideFlexOverlay(std::optional<Protocol::DOM::NodeId>&& nodeId)
     1565{
     1566    if (nodeId) {
     1567        Protocol::ErrorString errorString;
     1568        auto node = assertNode(errorString, *nodeId);
     1569        if (!node)
     1570            return makeUnexpected(errorString);
     1571
     1572        return m_overlay->clearFlexOverlayForNode(*node);
     1573    }
     1574
     1575    m_overlay->clearAllFlexOverlays();
     1576
     1577    return { };
     1578}
     1579
    15451580Protocol::ErrorStringOr<Protocol::DOM::NodeId> InspectorDOMAgent::moveTo(Protocol::DOM::NodeId nodeId, Protocol::DOM::NodeId targetNodeId, std::optional<Protocol::DOM::NodeId>&& insertBeforeNodeId)
    15461581{
  • trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.h

    r288623 r289416  
    150150    Inspector::Protocol::ErrorStringOr<void> showGridOverlay(Inspector::Protocol::DOM::NodeId, Ref<JSON::Object>&& gridColor, std::optional<bool>&& showLineNames, std::optional<bool>&& showLineNumbers, std::optional<bool>&& showExtendedGridLines, std::optional<bool>&& showTrackSizes, std::optional<bool>&& showAreaNames);
    151151    Inspector::Protocol::ErrorStringOr<void> hideGridOverlay(std::optional<Inspector::Protocol::DOM::NodeId>&&);
     152    Inspector::Protocol::ErrorStringOr<void> showFlexOverlay(Inspector::Protocol::DOM::NodeId, Ref<JSON::Object>&& flexColor);
     153    Inspector::Protocol::ErrorStringOr<void> hideFlexOverlay(std::optional<Inspector::Protocol::DOM::NodeId>&&);
    152154    Inspector::Protocol::ErrorStringOr<Inspector::Protocol::DOM::NodeId> moveTo(Inspector::Protocol::DOM::NodeId nodeId, Inspector::Protocol::DOM::NodeId targetNodeId, std::optional<Inspector::Protocol::DOM::NodeId>&& insertBeforeNodeId);
    153155    Inspector::Protocol::ErrorStringOr<void> undo();
  • trunk/Source/WebCore/testing/Internals.cpp

    r288950 r289416  
    17641764}
    17651765
     1766ExceptionOr<unsigned> Internals::inspectorFlexOverlayCount()
     1767{
     1768    Document* document = contextDocument();
     1769    if (!document || !document->page())
     1770        return Exception { InvalidAccessError };
     1771
     1772    return document->page()->inspectorController().flexOverlayCount();
     1773}
     1774
    17661775ExceptionOr<Ref<DOMRectList>> Internals::inspectorHighlightRects()
    17671776{
  • trunk/Source/WebCore/testing/Internals.h

    r288621 r289416  
    295295    ExceptionOr<Ref<DOMRectList>> inspectorHighlightRects();
    296296    ExceptionOr<unsigned> inspectorGridOverlayCount();
     297    ExceptionOr<unsigned> inspectorFlexOverlayCount();
    297298    ExceptionOr<unsigned> inspectorPaintRectCount();
    298299
  • trunk/Source/WebCore/testing/Internals.idl

    r289117 r289416  
    407407
    408408    unsigned long inspectorGridOverlayCount();
     409    unsigned long inspectorFlexOverlayCount();
    409410    DOMRectList inspectorHighlightRects();
    410411    unsigned long inspectorPaintRectCount();
  • trunk/Source/WebKit/ChangeLog

    r289381 r289416  
     12022-02-08  Razvan Caliman  <rcaliman@apple.com>
     2
     3        Web Inspector: [Flexbox] Add support for showing/hiding flex container overlays and basic overlay drawing
     4        https://bugs.webkit.org/show_bug.cgi?id=236013
     5        <rdar://87893201>
     6
     7        Reviewed by Patrick Angle.
     8
     9        Add basic logic to draw a flex overlay on top of a flex container on iOS/iPadOS. Used by Web Inspector.
     10
     11        * Shared/WebCoreArgumentCoders.cpp:
     12        (IPC::ArgumentCoder<InspectorOverlay::Highlight>::encode):
     13        (IPC::ArgumentCoder<InspectorOverlay::Highlight>::decode):
     14        * UIProcess/Inspector/ios/WKInspectorHighlightView.mm:
     15        (-[WKInspectorHighlightView drawRect:]):
     16
    1172022-02-08  Youenn Fablet  <youenn@apple.com>
    218
  • trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp

    r287953 r289416  
    16811681    encoder << highlight.quads;
    16821682    encoder << highlight.gridHighlightOverlays;
     1683    encoder << highlight.flexHighlightOverlays;
    16831684}
    16841685
     
    17051706        return false;
    17061707    if (!decoder.decode(highlight.gridHighlightOverlays))
     1708        return false;
     1709    if (!decoder.decode(highlight.flexHighlightOverlays))
    17071710        return false;
    17081711    return true;
  • trunk/Source/WebKit/UIProcess/Inspector/ios/WKInspectorHighlightView.mm

    r286588 r289416  
    278278    for (auto gridHighlightOverlay : _highlight->gridHighlightOverlays)
    279279        WebCore::InspectorOverlay::drawGridOverlay(context, gridHighlightOverlay);
     280
     281    for (auto flexHighlightOverlay : _highlight->flexHighlightOverlays)
     282        WebCore::InspectorOverlay::drawFlexOverlay(context, flexHighlightOverlay);
    280283}
    281284
Note: See TracChangeset for help on using the changeset viewer.