OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Google Inc. All rights reserved. | 2 * Copyright (c) 2013, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 bool LayoutRectRecorder::shouldRecordLayoutRects() | 38 bool LayoutRectRecorder::shouldRecordLayoutRects() |
39 { | 39 { |
40 bool isTracing; | 40 bool isTracing; |
41 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.debug.la
yout"), &isTracing); | 41 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.debug.la
yout"), &isTracing); |
42 return RuntimeEnabledFeatures::repaintAfterLayoutEnabled() || isTracing; | 42 return RuntimeEnabledFeatures::repaintAfterLayoutEnabled() || isTracing; |
43 } | 43 } |
44 | 44 |
45 LayoutRectRecorder::LayoutRectRecorder(RenderObject& object, bool skipRecording) | 45 LayoutRectRecorder::LayoutRectRecorder(RenderObject& object, bool record) |
46 : m_object(object) | 46 : m_object(object) |
47 , m_skipRecording(skipRecording) | 47 , m_record(record) |
48 { | 48 { |
49 if (!shouldRecordLayoutRects()) | 49 if (!shouldRecordLayoutRects()) |
50 return; | 50 return; |
51 if (m_skipRecording) | 51 if (!m_record) |
52 return; | 52 return; |
53 | 53 |
54 if (!m_object.layoutDidGetCalled()) { | 54 if (!m_object.layoutDidGetCalled()) { |
55 RenderLayerModelObject* containerForRepaint = m_object.containerForRepai
nt(); | 55 RenderLayerModelObject* containerForRepaint = m_object.containerForRepai
nt(); |
56 m_object.setOldRepaintRect(m_object.clippedOverflowRectForRepaint(contai
nerForRepaint)); | 56 m_object.setOldRepaintRect(m_object.clippedOverflowRectForRepaint(contai
nerForRepaint)); |
57 | 57 |
58 if (m_object.hasOutline()) | 58 if (m_object.hasOutline()) |
59 m_object.setOldOutlineRect(m_object.outlineBoundsForRepaint(containe
rForRepaint)); | 59 m_object.setOldOutlineRect(m_object.outlineBoundsForRepaint(containe
rForRepaint)); |
60 } | 60 } |
61 | 61 |
62 // If should do repaint was set previously make sure we don't accidentally u
nset it. | 62 // If should do repaint was set previously make sure we don't accidentally u
nset it. |
63 if (!m_object.shouldDoFullRepaintAfterLayout()) | 63 if (!m_object.shouldDoFullRepaintAfterLayout()) |
64 m_object.setShouldDoFullRepaintAfterLayout(m_object.selfNeedsLayout()); | 64 m_object.setShouldDoFullRepaintAfterLayout(m_object.selfNeedsLayout()); |
65 if (m_object.needsPositionedMovementLayoutOnly()) | 65 if (m_object.needsPositionedMovementLayoutOnly()) |
66 m_object.setOnlyNeededPositionedMovementLayout(true); | 66 m_object.setOnlyNeededPositionedMovementLayout(true); |
67 | 67 |
68 m_object.setLayoutDidGetCalled(true); | 68 m_object.setLayoutDidGetCalled(true); |
69 } | 69 } |
70 | 70 |
71 LayoutRectRecorder::~LayoutRectRecorder() | 71 LayoutRectRecorder::~LayoutRectRecorder() |
72 { | 72 { |
73 if (!shouldRecordLayoutRects()) | 73 if (!shouldRecordLayoutRects()) |
74 return; | 74 return; |
75 if (m_skipRecording) | 75 if (!m_record) |
76 return; | 76 return; |
77 | 77 |
78 // Note, we don't store the repaint container because it can change during l
ayout. | 78 // Note, we don't store the repaint container because it can change during l
ayout. |
79 RenderLayerModelObject* containerForRepaint = m_object.containerForRepaint()
; | 79 RenderLayerModelObject* containerForRepaint = m_object.containerForRepaint()
; |
80 m_object.setNewRepaintRect(m_object.clippedOverflowRectForRepaint(containerF
orRepaint)); | 80 m_object.setNewRepaintRect(m_object.clippedOverflowRectForRepaint(containerF
orRepaint)); |
81 | 81 |
82 if (m_object.hasOutline()) | 82 if (m_object.hasOutline()) |
83 m_object.setNewOutlineRect(m_object.outlineBoundsForRepaint(containerFor
Repaint)); | 83 m_object.setNewOutlineRect(m_object.outlineBoundsForRepaint(containerFor
Repaint)); |
84 } | 84 } |
85 | 85 |
86 } // namespace WebCore | 86 } // namespace WebCore |
87 | 87 |
OLD | NEW |