tree: f24525508e00d83af817f824cca045bdca5a7a31 [path history] [tgz]
  1. test_data/
  2. BackgroundImageGeometry.cpp
  3. BackgroundImageGeometry.h
  4. BlockFlowPainter.cpp
  5. BlockFlowPainter.h
  6. BlockPainter.cpp
  7. BlockPainter.h
  8. BoxBorderPainter.cpp
  9. BoxBorderPainter.h
  10. BoxClipper.cpp
  11. BoxClipper.h
  12. BoxDecorationData.cpp
  13. BoxDecorationData.h
  14. BoxPainter.cpp
  15. BoxPainter.h
  16. ClipScope.cpp
  17. ClipScope.h
  18. DetailsMarkerPainter.cpp
  19. DetailsMarkerPainter.h
  20. EllipsisBoxPainter.cpp
  21. EllipsisBoxPainter.h
  22. EmbeddedObjectPainter.cpp
  23. EmbeddedObjectPainter.h
  24. FieldsetPainter.cpp
  25. FieldsetPainter.h
  26. FileUploadControlPainter.cpp
  27. FileUploadControlPainter.h
  28. FilterEffectBuilder.cpp
  29. FilterEffectBuilder.h
  30. FilterPainter.cpp
  31. FilterPainter.h
  32. FloatClipRecorder.cpp
  33. FloatClipRecorder.h
  34. FramePainter.cpp
  35. FramePainter.h
  36. FrameSetPainter.cpp
  37. FrameSetPainter.h
  38. GridPainter.cpp
  39. GridPainter.h
  40. HTMLCanvasPainter.cpp
  41. HTMLCanvasPainter.h
  42. ImagePainter.cpp
  43. ImagePainter.h
  44. InlineFlowBoxPainter.cpp
  45. InlineFlowBoxPainter.h
  46. InlinePainter.cpp
  47. InlinePainter.h
  48. InlineTextBoxPainter.cpp
  49. InlineTextBoxPainter.h
  50. LayerClipRecorder.cpp
  51. LayerClipRecorder.h
  52. LayerClipRecorderTest.cpp
  53. LayoutObjectDrawingRecorder.h
  54. LayoutObjectDrawingRecorderTest.cpp
  55. LineBoxListPainter.cpp
  56. LineBoxListPainter.h
  57. ListItemPainter.cpp
  58. ListItemPainter.h
  59. ListMarkerPainter.cpp
  60. ListMarkerPainter.h
  61. MediaControlsPainter.cpp
  62. MediaControlsPainter.h
  63. MultiColumnSetPainter.cpp
  64. MultiColumnSetPainter.h
  65. NinePieceImageGrid.cpp
  66. NinePieceImageGrid.h
  67. NinePieceImageGridTest.cpp
  68. NinePieceImagePainter.cpp
  69. NinePieceImagePainter.h
  70. ObjectPainter.cpp
  71. ObjectPainter.h
  72. ObjectPaintProperties.h
  73. OWNERS
  74. PaintControllerPaintTest.cpp
  75. PaintControllerPaintTest.h
  76. PaintInfo.cpp
  77. PaintInfo.h
  78. PaintInfoTest.cpp
  79. PaintInvalidationCapableScrollableArea.cpp
  80. PaintInvalidationCapableScrollableArea.h
  81. PaintLayer.cpp
  82. PaintLayer.h
  83. PaintLayerClipper.cpp
  84. PaintLayerClipper.h
  85. PaintLayerFilterInfo.cpp
  86. PaintLayerFilterInfo.h
  87. PaintLayerFragment.h
  88. PaintLayerPainter.cpp
  89. PaintLayerPainter.h
  90. PaintLayerPainterTest.cpp
  91. PaintLayerPaintingInfo.h
  92. PaintLayerReflectionInfo.cpp
  93. PaintLayerReflectionInfo.h
  94. PaintLayerScrollableArea.cpp
  95. PaintLayerScrollableArea.h
  96. PaintLayerStackingNode.cpp
  97. PaintLayerStackingNode.h
  98. PaintLayerStackingNodeIterator.cpp
  99. PaintLayerStackingNodeIterator.h
  100. PaintPhase.cpp
  101. PaintPhase.h
  102. PaintPropertyTreeBuilder.cpp
  103. PaintPropertyTreeBuilder.h
  104. PaintPropertyTreeBuilderTest.cpp
  105. PaintPropertyTreePrinter.cpp
  106. PaintPropertyTreePrinter.h
  107. PaintTiming.cpp
  108. PaintTiming.h
  109. PartPainter.cpp
  110. PartPainter.h
  112. ReplacedPainter.cpp
  113. ReplacedPainter.h
  114. ReplicaPainter.cpp
  115. ReplicaPainter.h
  116. RootInlineBoxPainter.cpp
  117. RootInlineBoxPainter.h
  118. RoundedInnerRectClipper.cpp
  119. RoundedInnerRectClipper.h
  120. ScopeRecorder.cpp
  121. ScopeRecorder.h
  122. ScrollableAreaPainter.cpp
  123. ScrollableAreaPainter.h
  124. ScrollbarPainter.cpp
  125. ScrollbarPainter.h
  126. ScrollRecorder.cpp
  127. ScrollRecorder.h
  128. SVGClipPainter.cpp
  129. SVGClipPainter.h
  130. SVGContainerPainter.cpp
  131. SVGContainerPainter.h
  132. SVGFilterPainter.cpp
  133. SVGFilterPainter.h
  134. SVGForeignObjectPainter.cpp
  135. SVGForeignObjectPainter.h
  136. SVGImagePainter.cpp
  137. SVGImagePainter.h
  138. SVGInlineFlowBoxPainter.cpp
  139. SVGInlineFlowBoxPainter.h
  140. SVGInlineTextBoxPainter.cpp
  141. SVGInlineTextBoxPainter.h
  142. SVGMaskPainter.cpp
  143. SVGMaskPainter.h
  144. SVGPaintContext.cpp
  145. SVGPaintContext.h
  146. SVGRootInlineBoxPainter.cpp
  147. SVGRootInlineBoxPainter.h
  148. SVGRootPainter.cpp
  149. SVGRootPainter.h
  150. SVGShapePainter.cpp
  151. SVGShapePainter.h
  152. SVGTextPainter.cpp
  153. SVGTextPainter.h
  154. TableCellPainter.cpp
  155. TableCellPainter.h
  156. TableCellPainterTest.cpp
  157. TablePainter.cpp
  158. TablePainter.h
  159. TableRowPainter.cpp
  160. TableRowPainter.h
  161. TableSectionPainter.cpp
  162. TableSectionPainter.h
  163. TextPainter.cpp
  164. TextPainter.h
  165. TextPainterTest.cpp
  166. ThemePainter.cpp
  167. ThemePainter.h
  168. ThemePainterDefault.cpp
  169. ThemePainterDefault.h
  170. ThemePainterMac.h
  172. Transform3DRecorder.cpp
  173. Transform3DRecorder.h
  174. TransformRecorder.cpp
  175. TransformRecorder.h
  176. VideoPainter.cpp
  177. VideoPainter.h
  178. ViewPainter.cpp
  179. ViewPainter.h


This directory contains implementation of painters of layout objects.


Paint invalidation

Paint invalidation marks anything that need to be painted differently from the original cached painting.

Slimming paint v1

Though described in this document, most of the actual paint invalidation code is under Source/core/layout.

Paint invalidation is a document cycle stage after compositing update and before paint. During the previous stages, objects are marked for needing paint invalidation checking if needed by style change, layout change, compositing change, etc. In paint invalidation stage, we traverse the layout tree for marked subtrees and objects and send the following information to GraphicsLayers and PaintControllers:

  • paint invalidation rects: must cover all areas that will generete different pixels.
  • invalidated display item clients: must invalidate all display item clients that will generate different display items.

Paint invalidation of texts

Texts are painted by InlineTextBoxPainter using InlineTextBox as display item client. Text backgrounds and masks are painted by InlineTextFlowPainter using InlineFlowBox as display item client. We should invalidate these display item clients when their painting will change.

LayoutInlines and LayoutTexts are marked for full paint invalidation if needed when new style is set on them. During paint invalidation, we invalidate the InlineFlowBoxs directly contained by the LayoutInline in LayoutInline::invalidateDisplayItemClients() and InlineTextBoxs contained by the LayoutText in LayoutText::invalidateDisplayItemClients(). We don't need to traverse into the subtree of InlineFlowBoxs in LayoutInline::invalidateDisplayItemClients() because the descendant InlineFlowBoxs and InlineTextBoxs will be handled by their owning LayoutInlines and LayoutTexts, respectively, when changed style is propagated.

Specialty of ::first-line

::first-line pseudo style dynamically applies to all InlineBox's in the first line in the block having ::first-line style. The actual applied style is computed from the ::first-line style and other applicable styles.

If the first line contains any LayoutInline, we compute the style from the ::first-line style and the style of the LayoutInline and apply the computed style to the first line part of the LayoutInline. In blink's style implementation, the combined first line style of LayoutInline is identified with FIRST_LINE_INHERITED pseudo ID.

The normal paint invalidation of texts doesn't work for first line because

  • ComputedStyle::visualInvalidationDiff() can't detect first line style changes;
  • The normal paint invalidation is based on whole LayoutObject's, not aware of the first line.

We have a special path for first line style change: the style system informs the layout system when the computed first-line style changes through LayoutObject::firstLineStyleDidChange(). When this happens, we invalidate all InlineBoxes in the first line.

Slimming paint v2

TODO(wangxianzhu): add details

Paint result caching

PaintController holds the previous painting result as a cache of display items. If some painter would generate results same as those of the previous painting, we'll skip the painting and reuse the display items from cache.

Display item caching

We'll create a CachedDisplayItem when a painter would create a DrawingDisplayItem exactly the same as the display item created in the previous painting. After painting, PaintController will replace CachedDisplayItem with the corresponding display item from the cache.

Subsequence caching

When possible, we enclose the display items that PaintLayerPainter::paintContents() generates (including display items generated by sublayers) in a pair of BeginSubsequence/EndSubsequence display items.

In a subsequence paint, if the layer would generate exactly the same display items, we'll simply output a CachedSubsequence display item in place of the display items, and skip all paintings of the layer and its descendants in painting order. After painting, PaintController will replace CacheSubsequence with cached display items created in previous paintings.

There are many conditions affecting

  • whether we need to generate subsequence for a PaintLayer;
  • whether we can use cached subsequence for a PaintLayer. See shouldCreateSubsequence() and shouldRepaintSubsequence() in PaintLayerPainter.cpp for the conditions.