OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/paint/InlineTextBoxPainter.h" | 5 #include "core/paint/InlineTextBoxPainter.h" |
6 | 6 |
7 #include "core/editing/CompositionUnderline.h" | 7 #include "core/editing/CompositionUnderline.h" |
8 #include "core/editing/Editor.h" | 8 #include "core/editing/Editor.h" |
9 #include "core/editing/markers/DocumentMarkerController.h" | 9 #include "core/editing/markers/DocumentMarkerController.h" |
10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 gTextBlobCache->remove(&inlineTextBox); | 32 gTextBlobCache->remove(&inlineTextBox); |
33 } | 33 } |
34 | 34 |
35 static TextBlobPtr* addToTextBlobCache(const InlineTextBox& inlineTextBox) | 35 static TextBlobPtr* addToTextBlobCache(const InlineTextBox& inlineTextBox) |
36 { | 36 { |
37 if (!gTextBlobCache) | 37 if (!gTextBlobCache) |
38 gTextBlobCache = new InlineTextBoxBlobCacheMap; | 38 gTextBlobCache = new InlineTextBoxBlobCacheMap; |
39 return &gTextBlobCache->add(&inlineTextBox, nullptr).storedValue->value; | 39 return &gTextBlobCache->add(&inlineTextBox, nullptr).storedValue->value; |
40 } | 40 } |
41 | 41 |
| 42 void InlineTextBoxPainter::invalidateTextBlobCache() |
| 43 { |
| 44 delete gTextBlobCache; |
| 45 gTextBlobCache = nullptr; |
| 46 } |
| 47 |
42 bool InlineTextBoxPainter::paintsMarkerHighlights(const LayoutObject& layoutObje
ct) | 48 bool InlineTextBoxPainter::paintsMarkerHighlights(const LayoutObject& layoutObje
ct) |
43 { | 49 { |
44 return layoutObject.node() && layoutObject.document().markers().hasMarkers(l
ayoutObject.node()); | 50 return layoutObject.node() && layoutObject.document().markers().hasMarkers(l
ayoutObject.node()); |
45 } | 51 } |
46 | 52 |
47 static bool paintsCompositionMarkers(const LayoutObject& layoutObject) | 53 static bool paintsCompositionMarkers(const LayoutObject& layoutObject) |
48 { | 54 { |
49 return layoutObject.node() && layoutObject.document().markers().markersFor(l
ayoutObject.node(), DocumentMarker::Composition).size() > 0; | 55 return layoutObject.node() && layoutObject.document().markers().markersFor(l
ayoutObject.node(), DocumentMarker::Composition).size() > 0; |
50 } | 56 } |
51 | 57 |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 GraphicsContext& context = paintInfo.context; | 846 GraphicsContext& context = paintInfo.context; |
841 GraphicsContextStateSaver stateSaver(context); | 847 GraphicsContextStateSaver stateSaver(context); |
842 | 848 |
843 LayoutRect boxRect(boxOrigin, LayoutSize(m_inlineTextBox.logicalWidth(), m_i
nlineTextBox.logicalHeight())); | 849 LayoutRect boxRect(boxOrigin, LayoutSize(m_inlineTextBox.logicalWidth(), m_i
nlineTextBox.logicalHeight())); |
844 context.clip(FloatRect(boxRect)); | 850 context.clip(FloatRect(boxRect)); |
845 context.drawHighlightForText(font, run, FloatPoint(boxOrigin), boxRect.heigh
t(), color, sPos, ePos); | 851 context.drawHighlightForText(font, run, FloatPoint(boxOrigin), boxRect.heigh
t(), color, sPos, ePos); |
846 } | 852 } |
847 | 853 |
848 | 854 |
849 } // namespace blink | 855 } // namespace blink |
OLD | NEW |