Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: Source/core/rendering/RenderSelectionInfo.h

Issue 337173003: Compute paint invalidation rects for selection in the space of the backing GraphicsLayer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added comment. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 RenderObject* m_object; 55 RenderObject* m_object;
56 const RenderLayerModelObject* m_repaintContainer; 56 const RenderLayerModelObject* m_repaintContainer;
57 RenderObject::SelectionState m_state; 57 RenderObject::SelectionState m_state;
58 }; 58 };
59 59
60 // This struct is used when the selection changes to cache the old and new state of the selection for each RenderObject. 60 // This struct is used when the selection changes to cache the old and new state of the selection for each RenderObject.
61 class RenderSelectionInfo : public RenderSelectionInfoBase { 61 class RenderSelectionInfo : public RenderSelectionInfoBase {
62 public: 62 public:
63 RenderSelectionInfo(RenderObject* o, bool clipToVisibleContent) 63 RenderSelectionInfo(RenderObject* o, bool clipToVisibleContent)
64 : RenderSelectionInfoBase(o) 64 : RenderSelectionInfoBase(o)
65 , m_rect(o->canUpdateSelectionOnRootLineBoxes() ? o->selectionRectForPai ntInvalidation(m_repaintContainer, clipToVisibleContent) : LayoutRect())
66 { 65 {
66 if (o->canUpdateSelectionOnRootLineBoxes()) {
67 m_rect = o->selectionRectForPaintInvalidation(m_repaintContainer, cl ipToVisibleContent);
68 // FIXME: groupedMapping() leaks the squashing abstraction. See Rend erBlockSelectionInfo for more details.
69 if (m_repaintContainer && m_repaintContainer->groupedMapping())
70 RenderLayer::mapRectToRepaintBacking(m_repaintContainer, m_repai ntContainer, m_rect);
71 } else {
72 m_rect = LayoutRect();
73 }
67 } 74 }
68 75
69 void repaint() 76 void repaint()
70 { 77 {
71 m_object->invalidatePaintUsingContainer(m_repaintContainer, enclosingInt Rect(m_rect), InvalidationSelection); 78 m_object->invalidatePaintUsingContainer(m_repaintContainer, enclosingInt Rect(m_rect), InvalidationSelection);
72 } 79 }
73 80
74 LayoutRect rect() const { return m_rect; } 81 LayoutRect rect() const { return m_rect; }
75 82
76 private: 83 private:
77 LayoutRect m_rect; // relative to repaint container 84 LayoutRect m_rect; // relative to repaint container
78 }; 85 };
79 86
80 87
81 // This struct is used when the selection changes to cache the old and new state of the selection for each RenderBlock. 88 // This struct is used when the selection changes to cache the old and new state of the selection for each RenderBlock.
82 class RenderBlockSelectionInfo : public RenderSelectionInfoBase { 89 class RenderBlockSelectionInfo : public RenderSelectionInfoBase {
83 public: 90 public:
84 RenderBlockSelectionInfo(RenderBlock* b) 91 RenderBlockSelectionInfo(RenderBlock* b)
85 : RenderSelectionInfoBase(b) 92 : RenderSelectionInfoBase(b)
86 , m_rects(b->canUpdateSelectionOnRootLineBoxes() ? block()->selectionGap RectsForRepaint(m_repaintContainer) : GapRects())
87 { 93 {
94 if (b->canUpdateSelectionOnRootLineBoxes())
95 m_rects = block()->selectionGapRectsForRepaint(m_repaintContainer);
96 else
97 m_rects = GapRects();
88 } 98 }
89 99
90 void repaint() 100 void repaint()
91 { 101 {
92 m_object->invalidatePaintUsingContainer(m_repaintContainer, enclosingInt Rect(m_rects), InvalidationSelection); 102 LayoutRect repaintRect = enclosingIntRect(m_rects);
103 // FIXME: this is leaking the squashing abstraction. However, removing t he groupedMapping() condiitional causes
104 // RenderBox::mapRectToRepaintBacking to get called, which makes rect ad justments even if you pass the same
105 // repaintContainer as the render object. Find out why it does that and fix.
106 if (m_repaintContainer && m_repaintContainer->groupedMapping())
107 RenderLayer::mapRectToRepaintBacking(m_repaintContainer, m_repaintCo ntainer, repaintRect);
108 m_object->invalidatePaintUsingContainer(m_repaintContainer, enclosingInt Rect(repaintRect), InvalidationSelection);
93 } 109 }
94 110
95 RenderBlock* block() const { return toRenderBlock(m_object); } 111 RenderBlock* block() const { return toRenderBlock(m_object); }
96 GapRects rects() const { return m_rects; } 112 GapRects rects() const { return m_rects; }
97 113
98 private: 114 private:
99 GapRects m_rects; // relative to repaint container 115 GapRects m_rects; // relative to repaint container
100 }; 116 };
101 117
102 } // namespace WebCore 118 } // namespace WebCore
103 119
104 120
105 #endif // RenderSelectionInfo_h 121 #endif // RenderSelectionInfo_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698