Changeset 224312 in webkit


Ignore:
Timestamp:
Nov 1, 2017 8:08:53 PM (6 years ago)
Author:
Simon Fraser
Message:

Misc display list and other cleanup
https://bugs.webkit.org/show_bug.cgi?id=179150

Reviewed by Tim Horton.

Source/WebCore:

A few functions in GraphicsContext would assert when using display lists, because they
had no recording clause. Fix them (ellipse drawing, and focus ring drawing).

Use #pragma once in more places.

Add system trace points for display list recording.

No behavior change for non-display list code.

  • platform/graphics/GraphicsContext.cpp:

(WebCore::GraphicsContext::fillEllipse):
(WebCore::GraphicsContext::strokeEllipse):

  • platform/graphics/PlatformLayer.h:
  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::recursiveCommitChanges):

  • platform/graphics/ca/cocoa/WebSystemBackdropLayer.h:
  • platform/graphics/ca/cocoa/WebTiledBackingLayer.h:
  • platform/graphics/cg/GraphicsContextCG.h:
  • platform/graphics/cocoa/GraphicsContextCocoa.mm:

(WebCore::GraphicsContext::drawFocusRing):

  • platform/graphics/displaylists/DisplayList.h:
  • platform/graphics/displaylists/DisplayListItems.h:

(WebCore::DisplayList::DrawFocusRingPath::create):
(WebCore::DisplayList::DrawFocusRingPath::width const):
(WebCore::DisplayList::DrawFocusRingPath::offset const):
(WebCore::DisplayList::DrawFocusRingPath::DrawFocusRingPath):
(WebCore::DisplayList::DrawFocusRingRects::create):
(WebCore::DisplayList::DrawFocusRingRects::width const):
(WebCore::DisplayList::DrawFocusRingRects::offset const):
(WebCore::DisplayList::DrawFocusRingRects::DrawFocusRingRects):

  • platform/graphics/displaylists/DisplayListRecorder.cpp:

(WebCore::DisplayList::Recorder::restore):
(WebCore::DisplayList::Recorder::drawFocusRing):

  • platform/graphics/displaylists/DisplayListRecorder.h:
  • platform/graphics/displaylists/DisplayListReplayer.h:
  • platform/graphics/mac/WebLayer.h:

Source/WTF:

Add system trace points for display list recording.

  • wtf/SystemTracing.h:

Tools:

Add system trace points for display list recording.

  • Tracing/SystemTracePoints.plist:
Location:
trunk
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r224277 r224312  
     12017-11-01  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Misc display list and other cleanup
     4        https://bugs.webkit.org/show_bug.cgi?id=179150
     5
     6        Reviewed by Tim Horton.
     7
     8        Add system trace points for display list recording.
     9
     10        * wtf/SystemTracing.h:
     11
    1122017-11-01  Fujii Hironori  <Hironori.Fujii@sony.com>
    213
  • trunk/Source/WTF/wtf/SystemTracing.h

    r215967 r224312  
    7272    UpdateTouchRegionsStart,
    7373    UpdateTouchRegionsEnd,
     74    DisplayListRecordStart,
     75    DisplayListRecordEnd,
    7476
    7577    WebKitRange = 10000,
  • trunk/Source/WebCore/ChangeLog

    r224311 r224312  
     12017-11-01  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Misc display list and other cleanup
     4        https://bugs.webkit.org/show_bug.cgi?id=179150
     5
     6        Reviewed by Tim Horton.
     7
     8        A few functions in GraphicsContext would assert when using display lists, because they
     9        had no recording clause. Fix them (ellipse drawing, and focus ring drawing).
     10       
     11        Use #pragma once in more places.
     12
     13        Add system trace points for display list recording.
     14
     15        No behavior change for non-display list code.
     16
     17        * platform/graphics/GraphicsContext.cpp:
     18        (WebCore::GraphicsContext::fillEllipse):
     19        (WebCore::GraphicsContext::strokeEllipse):
     20        * platform/graphics/PlatformLayer.h:
     21        * platform/graphics/ca/GraphicsLayerCA.cpp:
     22        (WebCore::GraphicsLayerCA::recursiveCommitChanges):
     23        * platform/graphics/ca/cocoa/WebSystemBackdropLayer.h:
     24        * platform/graphics/ca/cocoa/WebTiledBackingLayer.h:
     25        * platform/graphics/cg/GraphicsContextCG.h:
     26        * platform/graphics/cocoa/GraphicsContextCocoa.mm:
     27        (WebCore::GraphicsContext::drawFocusRing):
     28        * platform/graphics/displaylists/DisplayList.h:
     29        * platform/graphics/displaylists/DisplayListItems.h:
     30        (WebCore::DisplayList::DrawFocusRingPath::create):
     31        (WebCore::DisplayList::DrawFocusRingPath::width const):
     32        (WebCore::DisplayList::DrawFocusRingPath::offset const):
     33        (WebCore::DisplayList::DrawFocusRingPath::DrawFocusRingPath):
     34        (WebCore::DisplayList::DrawFocusRingRects::create):
     35        (WebCore::DisplayList::DrawFocusRingRects::width const):
     36        (WebCore::DisplayList::DrawFocusRingRects::offset const):
     37        (WebCore::DisplayList::DrawFocusRingRects::DrawFocusRingRects):
     38        * platform/graphics/displaylists/DisplayListRecorder.cpp:
     39        (WebCore::DisplayList::Recorder::restore):
     40        (WebCore::DisplayList::Recorder::drawFocusRing):
     41        * platform/graphics/displaylists/DisplayListRecorder.h:
     42        * platform/graphics/displaylists/DisplayListReplayer.h:
     43        * platform/graphics/mac/WebLayer.h:
     44
    1452017-11-01  Per Arne Vollan  <pvollan@apple.com>
    246
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp

    r222253 r224312  
    10461046void GraphicsContext::fillEllipse(const FloatRect& ellipse)
    10471047{
     1048    if (isRecording()) {
     1049        m_displayListRecorder->fillEllipse(ellipse);
     1050        return;
     1051    }
     1052
    10481053    platformFillEllipse(ellipse);
    10491054}
     
    10511056void GraphicsContext::strokeEllipse(const FloatRect& ellipse)
    10521057{
     1058    if (isRecording()) {
     1059        m_displayListRecorder->strokeEllipse(ellipse);
     1060        return;
     1061    }
     1062
    10531063    platformStrokeEllipse(ellipse);
    10541064}
  • trunk/Source/WebCore/platform/graphics/PlatformLayer.h

    r193630 r224312  
    2424 */
    2525
    26 #ifndef PlatformLayer_h
    27 #define PlatformLayer_h
     26#pragma once
    2827
    2928#if PLATFORM(COCOA)
     
    4645#endif
    4746
    48 #endif // PlatformLayer_h
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r224198 r224312  
    15451545
    15461546    if (usesDisplayListDrawing() && m_drawsContent && (!m_hasEverPainted || hadDirtyRects)) {
    1547 #ifdef LOG_RECORDING_TIME
    1548         double startTime = currentTime();
    1549 #endif
     1547        TraceScope tracingScope(DisplayListRecordStart, DisplayListRecordEnd);
     1548
    15501549        m_displayList = std::make_unique<DisplayList::DisplayList>();
    15511550       
     
    15561555        std::unique_ptr<DisplayList::Recorder> recorder = std::make_unique<DisplayList::Recorder>(context, *m_displayList, initialClip, AffineTransform());
    15571556        paintGraphicsLayerContents(context, FloatRect(FloatPoint(), size()));
    1558 
    1559 #ifdef LOG_RECORDING_TIME
    1560         double duration = currentTime() - startTime;
    1561         WTFLogAlways("Recording took %.5fms", duration * 1000.0);
    1562 #endif
    15631557    }
    15641558}
  • trunk/Source/WebCore/platform/graphics/ca/cocoa/WebSystemBackdropLayer.h

    r185888 r224312  
    2424 */
    2525
    26 #ifndef WebSystemBackdropLayer_h
    27 #define WebSystemBackdropLayer_h
     26#pragma once
    2827
    2928#import <QuartzCore/QuartzCore.h>
     
    3837@end
    3938
    40 #endif // WebSystemBackdropLayer_h
  • trunk/Source/WebCore/platform/graphics/ca/cocoa/WebTiledBackingLayer.h

    r212776 r224312  
    2424 */
    2525
    26 #ifndef WebTiledBackingLayer_h
    27 #define WebTiledBackingLayer_h
     26#pragma once
    2827
    2928#import <QuartzCore/QuartzCore.h>
     
    5251@end
    5352
    54 #endif // WebTiledBackingLayer_h
  • trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.h

    r208020 r224312  
    2424 */
    2525
    26 #ifndef GraphicsContextCG_h
    27 #define GraphicsContextCG_h
     26#pragma once
    2827
    2928#include "GraphicsContext.h"
     
    102101}
    103102
    104 #endif
  • trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextCocoa.mm

    r222898 r224312  
    2727#import "GraphicsContext.h"
    2828
     29#import "DisplayListRecorder.h"
    2930#import "GraphicsContextCG.h"
    3031#import "GraphicsContextPlatformPrivateCG.h"
     
    113114#endif // !PLATFORM(IOS)
    114115
    115 void GraphicsContext::drawFocusRing(const Path& path, float /* width */, float /* offset */, const Color&)
     116void GraphicsContext::drawFocusRing(const Path& path, float width, float offset, const Color& color)
    116117{
    117118#if PLATFORM(MAC)
     
    119120        return;
    120121
     122    if (isRecording()) {
     123        m_displayListRecorder->drawFocusRing(path, width, offset, color);
     124        return;
     125    }
     126
    121127    drawFocusRingToContext(platformContext(), path.platformPath());
    122128#else
     
    130136    if (paintingDisabled() || path.isNull())
    131137        return;
    132    
     138
     139    if (isRecording()) // FIXME: implement animated focus ring drawing.
     140        return;
     141
    133142    needsRedraw = drawFocusRingToContextAtTime(platformContext(), path.platformPath(), timeOffset);
    134143}
     
    137146{
    138147    if (paintingDisabled())
     148        return;
     149
     150    if (isRecording()) // FIXME: implement animated focus ring drawing.
    139151        return;
    140152
     
    147159#endif
    148160
    149 void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, float, float offset, const Color&)
     161void GraphicsContext::drawFocusRing(const Vector<FloatRect>& rects, float width, float offset, const Color& color)
    150162{
    151163#if !PLATFORM(IOS)
    152164    if (paintingDisabled())
    153165        return;
     166
     167    if (isRecording()) {
     168        m_displayListRecorder->drawFocusRing(rects, width, offset, color);
     169        return;
     170    }
    154171
    155172    RetainPtr<CGMutablePathRef> focusRingPath = adoptCF(CGPathCreateMutable());
  • trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h

    r220503 r224312  
    2424 */
    2525
    26 #ifndef DisplayList_h
    27 #define DisplayList_h
     26#pragma once
    2827
    2928#include "DisplayListItems.h"
     
    112111using WebCore::DisplayList::DisplayList;
    113112
    114 #endif /* DisplayList_h */
  • trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h

    r223728 r224312  
    2424 */
    2525
    26 #ifndef DisplayListItems_h
    27 #define DisplayListItems_h
     26#pragma once
    2827
    2928#include "FloatPoint.h"
     
    905904class DrawFocusRingPath : public DrawingItem {
    906905public:
    907     static Ref<DrawFocusRingPath> create(const Path& path, int width, int offset, const Color& color)
     906    static Ref<DrawFocusRingPath> create(const Path& path, float width, float offset, const Color& color)
    908907    {
    909908        return adoptRef(*new DrawFocusRingPath(path, width, offset, color));
     
    911910
    912911    const Path& path() const { return m_path; }
    913     int width() const { return m_width; }
    914     int offset() const { return m_offset; }
     912    float width() const { return m_width; }
     913    float offset() const { return m_offset; }
    915914    const Color& color() const { return m_color; }
    916915
    917916private:
    918     DrawFocusRingPath(const Path& path, int width, int offset, const Color& color)
     917    DrawFocusRingPath(const Path& path, float width, float offset, const Color& color)
    919918        : DrawingItem(ItemType::DrawFocusRingPath)
    920919        , m_path(path)
     
    930929
    931930    const Path m_path;
    932     int m_width;
    933     int m_offset;
     931    float m_width;
     932    float m_offset;
    934933    Color m_color;
    935934};
     
    937936class DrawFocusRingRects : public DrawingItem {
    938937public:
    939     static Ref<DrawFocusRingRects> create(const Vector<FloatRect>& rects, int width, int offset, const Color& color)
     938    static Ref<DrawFocusRingRects> create(const Vector<FloatRect>& rects, float width, float offset, const Color& color)
    940939    {
    941940        return adoptRef(*new DrawFocusRingRects(rects, width, offset, color));
     
    943942
    944943    const Vector<FloatRect> rects() const { return m_rects; }
    945     int width() const { return m_width; }
    946     int offset() const { return m_offset; }
     944    float width() const { return m_width; }
     945    float offset() const { return m_offset; }
    947946    const Color& color() const { return m_color; }
    948947
    949948private:
    950     DrawFocusRingRects(const Vector<FloatRect>& rects, int width, int offset, const Color& color)
     949    DrawFocusRingRects(const Vector<FloatRect>& rects, float width, float offset, const Color& color)
    951950        : DrawingItem(ItemType::DrawFocusRingRects)
    952951        , m_rects(rects)
     
    962961
    963962    Vector<FloatRect> m_rects;
    964     int m_width;
    965     int m_offset;
     963    float m_width;
     964    float m_offset;
    966965    Color m_color;
    967966};
     
    13881387SPECIALIZE_TYPE_TRAITS_DISPLAYLIST_ITEM(ClearShadow)
    13891388
    1390 #endif // DisplayListItems_h
  • trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp

    r220503 r224312  
    149149    if (!m_stateStack.size())
    150150        return;
    151    
     151
    152152    bool stateUsedForDrawing = currentState().wasUsedForDrawing;
    153153    size_t saveIndex = currentState().saveItemIndex;
    154    
     154
    155155    m_stateStack.removeLast();
    156156    // Have to avoid eliding nested Save/Restore when a descendant state contains drawing items.
     
    164164
    165165    appendItem(Restore::create());
    166    
     166
    167167    if (saveIndex) {
    168168        Save& saveItem = downcast<Save>(m_displayList.itemAt(saveIndex));
     
    242242}
    243243
    244 void Recorder::drawFocusRing(const Path& path, int width, int offset, const Color& color)
     244void Recorder::drawFocusRing(const Path& path, float width, float offset, const Color& color)
    245245{
    246246    DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawFocusRingPath::create(path, width, offset, color)));
     
    248248}
    249249
    250 void Recorder::drawFocusRing(const Vector<FloatRect>& rects, int width, int offset, const Color& color)
     250void Recorder::drawFocusRing(const Vector<FloatRect>& rects, float width, float offset, const Color& color)
    251251{
    252252    DrawingItem& newItem = downcast<DrawingItem>(appendItem(DrawFocusRingRects::create(rects, width, offset, color)));
  • trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h

    r206631 r224312  
    2424 */
    2525
    26 #ifndef DisplayListRecorder_h
    27 #define DisplayListRecorder_h
     26#pragma once
    2827
    2928#include "DisplayList.h"
     
    9897    void drawPath(const Path&);
    9998
    100     void drawFocusRing(const Path&, int width, int offset, const Color&);
    101     void drawFocusRing(const Vector<FloatRect>&, int width, int offset, const Color&);
     99    void drawFocusRing(const Path&, float width, float offset, const Color&);
     100    void drawFocusRing(const Vector<FloatRect>&, float width, float offset, const Color&);
    102101
    103102    void save();
     
    172171}
    173172
    174 #endif // DisplayListRecorder_h
  • trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h

    r195515 r224312  
    2424 */
    2525
    26 #ifndef DisplayListReplayer_h
    27 #define DisplayListReplayer_h
     26#pragma once
    2827
    2928#include "DisplayList.h"
     
    5453}
    5554
    56 #endif // DisplayListReplayer_h
  • trunk/Source/WebCore/platform/graphics/mac/WebLayer.h

    r217296 r224312  
    2424 */
    2525
    26 #ifndef WebLayer_h
    27 #define WebLayer_h
     26#pragma once
    2827
    2928#include <QuartzCore/QuartzCore.h>
     
    4039#endif
    4140
    42 #endif // WebLayer_h
  • trunk/Tools/ChangeLog

    r224291 r224312  
     12017-11-01  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Misc display list and other cleanup
     4        https://bugs.webkit.org/show_bug.cgi?id=179150
     5
     6        Reviewed by Tim Horton.
     7
     8        Add system trace points for display list recording.
     9
     10        * Tracing/SystemTracePoints.plist:
     11
    1122017-11-01  Stephan Szabo  <stephan.szabo@sony.com>
    213
  • trunk/Tools/Tracing/SystemTracePoints.plist

    r215967 r224312  
    185185             <dict>
    186186                 <key>Name</key>
     187                 <string>Record display list</string>
     188                 <key>Type</key>
     189                 <string>Interval</string>
     190                 <key>Component</key>
     191                 <string>47</string>
     192                 <key>CodeBegin</key>
     193                 <string>5023</string>
     194                 <key>CodeEnd</key>
     195                 <string>5024</string>
     196             </dict>
     197             <dict>
     198                 <key>Name</key>
    187199                 <string>Paint WebHTMLView</string>
    188200                 <key>Type</key>
Note: See TracChangeset for help on using the changeset viewer.