| OLD | NEW |
| 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, 2012 Apple Inc. | 6 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. |
| 7 * All rights reserved. | 7 * All rights reserved. |
| 8 * Copyright (C) 2009 Google Inc. All rights reserved. | 8 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 // ***** INTRINSIC SIZES / PREFERRED LOGICAL WIDTHS ***** | 175 // ***** INTRINSIC SIZES / PREFERRED LOGICAL WIDTHS ***** |
| 176 // The preferred logical widths are the intrinsic sizes of this element | 176 // The preferred logical widths are the intrinsic sizes of this element |
| 177 // (https://drafts.csswg.org/css-sizing-3/#intrinsic). Intrinsic sizes depend | 177 // (https://drafts.csswg.org/css-sizing-3/#intrinsic). Intrinsic sizes depend |
| 178 // mostly on the content and a limited set of style properties (e.g. any | 178 // mostly on the content and a limited set of style properties (e.g. any |
| 179 // font-related property for text, 'min-width'/'max-width', | 179 // font-related property for text, 'min-width'/'max-width', |
| 180 // 'min-height'/'max-height'). | 180 // 'min-height'/'max-height'). |
| 181 // | 181 // |
| 182 // Those widths are used to determine the final layout logical width, which | 182 // Those widths are used to determine the final layout logical width, which |
| 183 // depends on the layout algorithm used and the available logical width. | 183 // depends on the layout algorithm used and the available logical width. |
| 184 // | 184 // |
| 185 // LayoutObject only has getters for the widths (minPreferredLogicalWidth and | 185 // LayoutObject only has getters for the widths (MinPreferredLogicalWidth and |
| 186 // maxPreferredLogicalWidth). However the storage for them is in LayoutBox | 186 // MaxPreferredLogicalWidth). However the storage for them is in LayoutBox (see |
| 187 // (see m_minPreferredLogicalWidth and m_maxPreferredLogicalWidth). This is | 187 // min_preferred_logical_width_ and max_preferred_logical_width_). This is |
| 188 // because only boxes implementing the full box model have a need for them. | 188 // because only boxes implementing the full box model have a need for them. |
| 189 // Because LayoutBlockFlow's intrinsic widths rely on the underlying text | 189 // Because LayoutBlockFlow's intrinsic widths rely on the underlying text |
| 190 // content, LayoutBlockFlow may call LayoutText::computePreferredLogicalWidths. | 190 // content, LayoutBlockFlow may call LayoutText::ComputePreferredLogicalWidths. |
| 191 // | 191 // |
| 192 // The 2 widths are computed lazily during layout when the getters are called. | 192 // The 2 widths are computed lazily during layout when the getters are called. |
| 193 // The computation is done by calling computePreferredLogicalWidths() behind the | 193 // The computation is done by calling ComputePreferredLogicalWidths() behind the |
| 194 // scene. The boolean used to control the lazy recomputation is | 194 // scene. The boolean used to control the lazy recomputation is |
| 195 // preferredLogicalWidthsDirty. | 195 // PreferredLogicalWidthsDirty. |
| 196 // | 196 // |
| 197 // See the individual getters below for more details about what each width is. | 197 // See the individual getters below for more details about what each width is. |
| 198 class CORE_EXPORT LayoutObject : public ImageResourceObserver, | 198 class CORE_EXPORT LayoutObject : public ImageResourceObserver, |
| 199 public DisplayItemClient { | 199 public DisplayItemClient { |
| 200 friend class LayoutObjectChildList; | 200 friend class LayoutObjectChildList; |
| 201 FRIEND_TEST_ALL_PREFIXES(LayoutObjectTest, MutableForPaintingClearPaintFlags); | 201 FRIEND_TEST_ALL_PREFIXES(LayoutObjectTest, MutableForPaintingClearPaintFlags); |
| 202 friend class VisualRectMappingTest; | 202 friend class VisualRectMappingTest; |
| 203 WTF_MAKE_NONCOPYABLE(LayoutObject); | 203 WTF_MAKE_NONCOPYABLE(LayoutObject); |
| 204 | 204 |
| 205 public: | 205 public: |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 // For SlimmingPaintInvalidation/SPv2 only. | 397 // For SlimmingPaintInvalidation/SPv2 only. |
| 398 // The ObjectPaintProperties structure holds references to the property tree | 398 // The ObjectPaintProperties structure holds references to the property tree |
| 399 // nodes that are created by the layout object. The property nodes should only | 399 // nodes that are created by the layout object. The property nodes should only |
| 400 // be updated during InPrePaint phase of the document lifecycle. | 400 // be updated during InPrePaint phase of the document lifecycle. |
| 401 const ObjectPaintProperties* PaintProperties() const { | 401 const ObjectPaintProperties* PaintProperties() const { |
| 402 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); | 402 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); |
| 403 return rare_paint_data_ ? rare_paint_data_->PaintProperties() : nullptr; | 403 return rare_paint_data_ ? rare_paint_data_->PaintProperties() : nullptr; |
| 404 } | 404 } |
| 405 | 405 |
| 406 // The complete set of property nodes that should be used as a starting point | 406 // The complete set of property nodes that should be used as a starting point |
| 407 // to paint this LayoutObject. See: m_localBorderBoxProperties comment. | 407 // to paint this LayoutObject. See also the comment for |
| 408 // RarePaintData::local_border_box_properties_. |
| 408 const PropertyTreeState* LocalBorderBoxProperties() const { | 409 const PropertyTreeState* LocalBorderBoxProperties() const { |
| 409 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); | 410 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()); |
| 410 if (rare_paint_data_) | 411 if (rare_paint_data_) |
| 411 return rare_paint_data_->LocalBorderBoxProperties(); | 412 return rare_paint_data_->LocalBorderBoxProperties(); |
| 412 return nullptr; | 413 return nullptr; |
| 413 } | 414 } |
| 414 | 415 |
| 415 // The complete set of property nodes that should be used as a starting point | 416 // The complete set of property nodes that should be used as a starting point |
| 416 // to paint contents of this LayoutObject. | 417 // to paint contents of this LayoutObject. |
| 417 PropertyTreeState ContentsProperties() const; | 418 PropertyTreeState ContentsProperties() const; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 unsigned depth = 0) const; | 467 unsigned depth = 0) const; |
| 467 #endif | 468 #endif |
| 468 | 469 |
| 469 // This function is used to create the appropriate LayoutObject based | 470 // This function is used to create the appropriate LayoutObject based |
| 470 // on the style, in particular 'display' and 'content'. | 471 // on the style, in particular 'display' and 'content'. |
| 471 // "display: none" or "display: contents" are the only times this function | 472 // "display: none" or "display: contents" are the only times this function |
| 472 // will return nullptr. | 473 // will return nullptr. |
| 473 // | 474 // |
| 474 // For renderer creation, the inline-* values create the same renderer | 475 // For renderer creation, the inline-* values create the same renderer |
| 475 // as the non-inline version. The difference is that inline-* sets | 476 // as the non-inline version. The difference is that inline-* sets |
| 476 // m_isInline during initialization. This means that | 477 // is_inline_ during initialization. This means that |
| 477 // "display: inline-table" creates a LayoutTable, like "display: table". | 478 // "display: inline-table" creates a LayoutTable, like "display: table". |
| 478 // | 479 // |
| 479 // Ideally every Element::createLayoutObject would call this function to | 480 // Ideally every Element::createLayoutObject would call this function to |
| 480 // respond to 'display' but there are deep rooted assumptions about | 481 // respond to 'display' but there are deep rooted assumptions about |
| 481 // which LayoutObject is created on a fair number of Elements. This | 482 // which LayoutObject is created on a fair number of Elements. This |
| 482 // function also doesn't handle the default association between a tag | 483 // function also doesn't handle the default association between a tag |
| 483 // and its renderer (e.g. <iframe> creates a LayoutIFrame even if the | 484 // and its renderer (e.g. <iframe> creates a LayoutIFrame even if the |
| 484 // initial 'display' value is inline). | 485 // initial 'display' value is inline). |
| 485 static LayoutObject* CreateObject(Element*, const ComputedStyle&); | 486 static LayoutObject* CreateObject(Element*, const ComputedStyle&); |
| 486 | 487 |
| (...skipping 1632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2119 } | 2120 } |
| 2120 | 2121 |
| 2121 RarePaintData& EnsureRarePaintData(); | 2122 RarePaintData& EnsureRarePaintData(); |
| 2122 RarePaintData* GetRarePaintData() const { return rare_paint_data_.get(); } | 2123 RarePaintData* GetRarePaintData() const { return rare_paint_data_.get(); } |
| 2123 | 2124 |
| 2124 private: | 2125 private: |
| 2125 // Used only by applyFirstLineChanges to get a first line style based off of a | 2126 // Used only by applyFirstLineChanges to get a first line style based off of a |
| 2126 // given new style, without accessing the cache. | 2127 // given new style, without accessing the cache. |
| 2127 PassRefPtr<ComputedStyle> UncachedFirstLineStyle() const; | 2128 PassRefPtr<ComputedStyle> UncachedFirstLineStyle() const; |
| 2128 | 2129 |
| 2129 // Adjusts a visual rect in the space of |m_visualRect| to be in the | 2130 // Adjusts a visual rect in the space of |visual_rect_| to be in the space of |
| 2130 // space of the |paintInvalidationContainer|, if needed. They can be different | 2131 // the |paint_invalidation_container|, if needed. They can be different only |
| 2131 // only if |paintInvalidationContainer| is a composited scroller. | 2132 // if |paint_invalidation_container| is a composited scroller. |
| 2132 void AdjustVisualRectForCompositedScrolling( | 2133 void AdjustVisualRectForCompositedScrolling( |
| 2133 LayoutRect&, | 2134 LayoutRect&, |
| 2134 const LayoutBoxModelObject& paint_invalidation_container) const; | 2135 const LayoutBoxModelObject& paint_invalidation_container) const; |
| 2135 | 2136 |
| 2136 FloatQuad LocalToAncestorQuadInternal(const FloatQuad&, | 2137 FloatQuad LocalToAncestorQuadInternal(const FloatQuad&, |
| 2137 const LayoutBoxModelObject* ancestor, | 2138 const LayoutBoxModelObject* ancestor, |
| 2138 MapCoordinatesFlags = 0) const; | 2139 MapCoordinatesFlags = 0) const; |
| 2139 | 2140 |
| 2140 void ClearLayoutRootIfNeeded() const; | 2141 void ClearLayoutRootIfNeeded() const; |
| 2141 | 2142 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2207 | 2208 |
| 2208 LayoutObject* parent_; | 2209 LayoutObject* parent_; |
| 2209 LayoutObject* previous_; | 2210 LayoutObject* previous_; |
| 2210 LayoutObject* next_; | 2211 LayoutObject* next_; |
| 2211 | 2212 |
| 2212 #if DCHECK_IS_ON() | 2213 #if DCHECK_IS_ON() |
| 2213 unsigned has_ax_object_ : 1; | 2214 unsigned has_ax_object_ : 1; |
| 2214 unsigned set_needs_layout_forbidden_ : 1; | 2215 unsigned set_needs_layout_forbidden_ : 1; |
| 2215 #endif | 2216 #endif |
| 2216 | 2217 |
| 2217 #define ADD_BOOLEAN_BITFIELD(name, Name) \ | 2218 #define ADD_BOOLEAN_BITFIELD(field_name_, MethodNameBase) \ |
| 2218 private: \ | 2219 private: \ |
| 2219 unsigned m_##name : 1; \ | 2220 unsigned field_name_ : 1; \ |
| 2220 \ | 2221 \ |
| 2221 public: \ | 2222 public: \ |
| 2222 bool name() const { return m_##name; } \ | 2223 bool MethodNameBase() const { return field_name_; } \ |
| 2223 void Set##Name(bool name) { m_##name = name; } | 2224 void Set##MethodNameBase(bool new_value) { field_name_ = new_value; } |
| 2224 | 2225 |
| 2225 class LayoutObjectBitfields { | 2226 class LayoutObjectBitfields { |
| 2226 enum PositionedState { | 2227 enum PositionedState { |
| 2227 kIsStaticallyPositioned = 0, | 2228 kIsStaticallyPositioned = 0, |
| 2228 kIsRelativelyPositioned = 1, | 2229 kIsRelativelyPositioned = 1, |
| 2229 kIsOutOfFlowPositioned = 2, | 2230 kIsOutOfFlowPositioned = 2, |
| 2230 kIsStickyPositioned = 3, | 2231 kIsStickyPositioned = 3, |
| 2231 }; | 2232 }; |
| 2232 | 2233 |
| 2233 public: | 2234 public: |
| 2234 // LayoutObjectBitfields holds all the boolean values for LayoutObject. | 2235 // LayoutObjectBitfields holds all the boolean values for LayoutObject. |
| 2235 // | 2236 // |
| 2236 // This is done to promote better packing on LayoutObject (at the expense of | 2237 // This is done to promote better packing on LayoutObject (at the expense of |
| 2237 // preventing bit field packing for the subclasses). Classes concerned about | 2238 // preventing bit field packing for the subclasses). Classes concerned about |
| 2238 // packing and memory use should hoist their boolean to this class. See | 2239 // packing and memory use should hoist their boolean to this class. See |
| 2239 // below the field from sub-classes (e.g. childrenInline). | 2240 // below the field from sub-classes (e.g. childrenInline). |
| 2240 // | 2241 // |
| 2241 // Some of those booleans are caches of ComputedStyle values (e.g. | 2242 // Some of those booleans are caches of ComputedStyle values (e.g. |
| 2242 // positionState). This enables better memory locality and thus better | 2243 // positionState). This enables better memory locality and thus better |
| 2243 // performance. | 2244 // performance. |
| 2244 // | 2245 // |
| 2245 // This class is an artifact of the WebKit era where LayoutObject wasn't | 2246 // This class is an artifact of the WebKit era where LayoutObject wasn't |
| 2246 // allowed to grow and each sub-class was strictly monitored for memory | 2247 // allowed to grow and each sub-class was strictly monitored for memory |
| 2247 // increase. Our measurements indicate that the size of LayoutObject and | 2248 // increase. Our measurements indicate that the size of LayoutObject and |
| 2248 // subsequent classes do not impact memory or speed in a significant | 2249 // subsequent classes do not impact memory or speed in a significant |
| 2249 // manner. This is based on growing LayoutObject in | 2250 // manner. This is based on growing LayoutObject in |
| 2250 // https://codereview.chromium.org/44673003 and subsequent relaxations | 2251 // https://codereview.chromium.org/44673003 and subsequent relaxations |
| 2251 // of the memory constraints on layout objects. | 2252 // of the memory constraints on layout objects. |
| 2252 LayoutObjectBitfields(Node* node) | 2253 LayoutObjectBitfields(Node* node) |
| 2253 : m_SelfNeedsLayout(false), | 2254 : self_needs_layout_(false), |
| 2254 m_NeedsPositionedMovementLayout(false), | 2255 needs_positioned_movement_layout_(false), |
| 2255 m_NormalChildNeedsLayout(false), | 2256 normal_child_needs_layout_(false), |
| 2256 m_PosChildNeedsLayout(false), | 2257 pos_child_needs_layout_(false), |
| 2257 m_NeedsSimplifiedNormalFlowLayout(false), | 2258 needs_simplified_normal_flow_layout_(false), |
| 2258 m_SelfNeedsOverflowRecalcAfterStyleChange(false), | 2259 self_needs_overflow_recalc_after_style_change_(false), |
| 2259 m_ChildNeedsOverflowRecalcAfterStyleChange(false), | 2260 child_needs_overflow_recalc_after_style_change_(false), |
| 2260 m_PreferredLogicalWidthsDirty(false), | 2261 preferred_logical_widths_dirty_(false), |
| 2261 m_MayNeedPaintInvalidation(false), | 2262 may_need_paint_invalidation_(false), |
| 2262 m_MayNeedPaintInvalidationSubtree(false), | 2263 may_need_paint_invalidation_subtree_(false), |
| 2263 m_MayNeedPaintInvalidationAnimatedBackgroundImage(false), | 2264 may_need_paint_invalidation_animated_background_image_(false), |
| 2264 m_NeedsPaintOffsetAndVisualRectUpdate(false), | 2265 needs_paint_offset_and_visual_rect_update_(false), |
| 2265 m_ShouldInvalidateSelection(false), | 2266 should_invalidate_selection_(false), |
| 2266 m_Floating(false), | 2267 floating_(false), |
| 2267 m_IsAnonymous(!node), | 2268 is_anonymous_(!node), |
| 2268 m_IsText(false), | 2269 is_text_(false), |
| 2269 m_IsBox(false), | 2270 is_box_(false), |
| 2270 m_IsInline(true), | 2271 is_inline_(true), |
| 2271 m_IsAtomicInlineLevel(false), | 2272 is_atomic_inline_level_(false), |
| 2272 m_HorizontalWritingMode(true), | 2273 horizontal_writing_mode_(true), |
| 2273 m_HasLayer(false), | 2274 has_layer_(false), |
| 2274 m_HasOverflowClip(false), | 2275 has_overflow_clip_(false), |
| 2275 m_HasTransformRelatedProperty(false), | 2276 has_transform_related_property_(false), |
| 2276 m_HasReflection(false), | 2277 has_reflection_(false), |
| 2277 m_CanContainFixedPositionObjects(false), | 2278 can_contain_fixed_position_objects_(false), |
| 2278 m_HasCounterNodeMap(false), | 2279 has_counter_node_map_(false), |
| 2279 m_EverHadLayout(false), | 2280 ever_had_layout_(false), |
| 2280 m_AncestorLineBoxDirty(false), | 2281 ancestor_line_box_dirty_(false), |
| 2281 m_IsInsideFlowThread(false), | 2282 is_inside_flow_thread_(false), |
| 2282 m_SubtreeChangeListenerRegistered(false), | 2283 subtree_change_listener_registered_(false), |
| 2283 m_NotifiedOfSubtreeChange(false), | 2284 notified_of_subtree_change_(false), |
| 2284 m_ConsumesSubtreeChangeNotification(false), | 2285 consumes_subtree_change_notification_(false), |
| 2285 m_ChildrenInline(false), | 2286 children_inline_(false), |
| 2286 m_ContainsInlineWithOutlineAndContinuation(false), | 2287 contains_inline_with_outline_and_continuation_(false), |
| 2287 m_AlwaysCreateLineBoxesForLayoutInline(false), | 2288 always_create_line_boxes_for_layout_inline_(false), |
| 2288 m_PreviousBackgroundObscured(false), | 2289 previous_background_obscured_(false), |
| 2289 m_IsBackgroundAttachmentFixedObject(false), | 2290 is_background_attachment_fixed_object_(false), |
| 2290 m_IsScrollAnchorObject(false), | 2291 is_scroll_anchor_object_(false), |
| 2291 m_ScrollAnchorDisablingStyleChanged(false), | 2292 scroll_anchor_disabling_style_changed_(false), |
| 2292 m_HasBoxDecorationBackground(false), | 2293 has_box_decoration_background_(false), |
| 2293 m_HasPreviousLocationInBacking(false), | 2294 has_previous_location_in_backing_(false), |
| 2294 m_HasPreviousSelectionVisualRect(false), | 2295 has_previous_selection_visual_rect_(false), |
| 2295 m_NeedsPaintPropertyUpdate(true), | 2296 needs_paint_property_update_(true), |
| 2296 m_SubtreeNeedsPaintPropertyUpdate(true), | 2297 subtree_needs_paint_property_update_(true), |
| 2297 m_DescendantNeedsPaintPropertyUpdate(true), | 2298 descendant_needs_paint_property_update_(true), |
| 2298 m_BackgroundChangedSinceLastPaintInvalidation(false), | 2299 background_changed_since_last_paint_invalidation_(false), |
| 2299 m_OutlineMayBeAffectedByDescendants(false), | 2300 outline_may_be_affected_by_descendants_(false), |
| 2300 m_PreviousOutlineMayBeAffectedByDescendants(false), | 2301 previous_outline_may_be_affected_by_descendants_(false), |
| 2301 positioned_state_(kIsStaticallyPositioned), | 2302 positioned_state_(kIsStaticallyPositioned), |
| 2302 selection_state_(SelectionNone), | 2303 selection_state_(SelectionNone), |
| 2303 background_obscuration_state_(kBackgroundObscurationStatusInvalid), | 2304 background_obscuration_state_(kBackgroundObscurationStatusInvalid), |
| 2304 full_paint_invalidation_reason_(kPaintInvalidationNone) {} | 2305 full_paint_invalidation_reason_(kPaintInvalidationNone) {} |
| 2305 | 2306 |
| 2306 // Self needs layout means that this layout object is marked for a full | 2307 // Self needs layout means that this layout object is marked for a full |
| 2307 // layout. This is the default layout but it is expensive as it recomputes | 2308 // layout. This is the default layout but it is expensive as it recomputes |
| 2308 // everything. For CSS boxes, this includes the width (laying out the line | 2309 // everything. For CSS boxes, this includes the width (laying out the line |
| 2309 // boxes again), the margins (due to block collapsing margins), the | 2310 // boxes again), the margins (due to block collapsing margins), the |
| 2310 // positions, the height and the potential overflow. | 2311 // positions, the height and the potential overflow. |
| 2311 ADD_BOOLEAN_BITFIELD(SelfNeedsLayout, SelfNeedsLayout); | 2312 ADD_BOOLEAN_BITFIELD(self_needs_layout_, SelfNeedsLayout); |
| 2312 | 2313 |
| 2313 // A positioned movement layout is a specialized type of layout used on | 2314 // A positioned movement layout is a specialized type of layout used on |
| 2314 // positioned objects that only visually moved. This layout is used when | 2315 // positioned objects that only visually moved. This layout is used when |
| 2315 // changing 'top'/'left' on a positioned element or margins on an | 2316 // changing 'top'/'left' on a positioned element or margins on an |
| 2316 // out-of-flow one. Because the following operations don't impact the size | 2317 // out-of-flow one. Because the following operations don't impact the size |
| 2317 // of the object or sibling LayoutObjects, this layout is very lightweight. | 2318 // of the object or sibling LayoutObjects, this layout is very lightweight. |
| 2318 // | 2319 // |
| 2319 // Positioned movement layout is implemented in | 2320 // Positioned movement layout is implemented in |
| 2320 // LayoutBlock::simplifiedLayout. | 2321 // LayoutBlock::simplifiedLayout. |
| 2321 ADD_BOOLEAN_BITFIELD(NeedsPositionedMovementLayout, | 2322 ADD_BOOLEAN_BITFIELD(needs_positioned_movement_layout_, |
| 2322 NeedsPositionedMovementLayout); | 2323 NeedsPositionedMovementLayout); |
| 2323 | 2324 |
| 2324 // This boolean is set when a normal flow ('position' == static || relative) | 2325 // This boolean is set when a normal flow ('position' == static || relative) |
| 2325 // child requires layout (but this object doesn't). Due to the nature of | 2326 // child requires layout (but this object doesn't). Due to the nature of |
| 2326 // CSS, laying out a child can cause the parent to resize (e.g., if 'height' | 2327 // CSS, laying out a child can cause the parent to resize (e.g., if 'height' |
| 2327 // is auto). | 2328 // is auto). |
| 2328 ADD_BOOLEAN_BITFIELD(NormalChildNeedsLayout, NormalChildNeedsLayout); | 2329 ADD_BOOLEAN_BITFIELD(normal_child_needs_layout_, NormalChildNeedsLayout); |
| 2329 | 2330 |
| 2330 // This boolean is set when an out-of-flow positioned ('position' == fixed | 2331 // This boolean is set when an out-of-flow positioned ('position' == fixed |
| 2331 // || absolute) child requires layout (but this object doesn't). | 2332 // || absolute) child requires layout (but this object doesn't). |
| 2332 ADD_BOOLEAN_BITFIELD(PosChildNeedsLayout, PosChildNeedsLayout); | 2333 ADD_BOOLEAN_BITFIELD(pos_child_needs_layout_, PosChildNeedsLayout); |
| 2333 | 2334 |
| 2334 // Simplified normal flow layout only relayouts the normal flow children, | 2335 // Simplified normal flow layout only relayouts the normal flow children, |
| 2335 // ignoring the out-of-flow descendants. | 2336 // ignoring the out-of-flow descendants. |
| 2336 // | 2337 // |
| 2337 // The implementation of this layout is in | 2338 // The implementation of this layout is in |
| 2338 // LayoutBlock::simplifiedNormalFlowLayout. | 2339 // LayoutBlock::simplifiedNormalFlowLayout. |
| 2339 ADD_BOOLEAN_BITFIELD(NeedsSimplifiedNormalFlowLayout, | 2340 ADD_BOOLEAN_BITFIELD(needs_simplified_normal_flow_layout_, |
| 2340 NeedsSimplifiedNormalFlowLayout); | 2341 NeedsSimplifiedNormalFlowLayout); |
| 2341 | 2342 |
| 2342 // Some properties only have a visual impact and don't impact the actual | 2343 // Some properties only have a visual impact and don't impact the actual |
| 2343 // layout position and sizes of the object. An example of this is the | 2344 // layout position and sizes of the object. An example of this is the |
| 2344 // 'transform' property, who doesn't modify the layout but gets applied at | 2345 // 'transform' property, who doesn't modify the layout but gets applied at |
| 2345 // paint time. Setting this flag only recomputes the overflow information. | 2346 // paint time. Setting this flag only recomputes the overflow information. |
| 2346 ADD_BOOLEAN_BITFIELD(SelfNeedsOverflowRecalcAfterStyleChange, | 2347 ADD_BOOLEAN_BITFIELD(self_needs_overflow_recalc_after_style_change_, |
| 2347 SelfNeedsOverflowRecalcAfterStyleChange); | 2348 SelfNeedsOverflowRecalcAfterStyleChange); |
| 2348 | 2349 |
| 2349 // This flag is set on the ancestor of a LayoutObject needing | 2350 // This flag is set on the ancestor of a LayoutObject needing |
| 2350 // selfNeedsOverflowRecalcAfterStyleChange. This is needed as a descendant | 2351 // selfNeedsOverflowRecalcAfterStyleChange. This is needed as a descendant |
| 2351 // overflow can bleed into its containing block's so we have to recompute it | 2352 // overflow can bleed into its containing block's so we have to recompute it |
| 2352 // in some cases. | 2353 // in some cases. |
| 2353 ADD_BOOLEAN_BITFIELD(ChildNeedsOverflowRecalcAfterStyleChange, | 2354 ADD_BOOLEAN_BITFIELD(child_needs_overflow_recalc_after_style_change_, |
| 2354 ChildNeedsOverflowRecalcAfterStyleChange); | 2355 ChildNeedsOverflowRecalcAfterStyleChange); |
| 2355 | 2356 |
| 2356 // This boolean marks preferred logical widths for lazy recomputation. | 2357 // This boolean marks preferred logical widths for lazy recomputation. |
| 2357 // | 2358 // |
| 2358 // See INTRINSIC SIZES / PREFERRED LOGICAL WIDTHS above about those | 2359 // See INTRINSIC SIZES / PREFERRED LOGICAL WIDTHS above about those |
| 2359 // widths. | 2360 // widths. |
| 2360 ADD_BOOLEAN_BITFIELD(PreferredLogicalWidthsDirty, | 2361 ADD_BOOLEAN_BITFIELD(preferred_logical_widths_dirty_, |
| 2361 PreferredLogicalWidthsDirty); | 2362 PreferredLogicalWidthsDirty); |
| 2362 | 2363 |
| 2363 ADD_BOOLEAN_BITFIELD(MayNeedPaintInvalidation, MayNeedPaintInvalidation); | 2364 ADD_BOOLEAN_BITFIELD(may_need_paint_invalidation_, |
| 2364 ADD_BOOLEAN_BITFIELD(MayNeedPaintInvalidationSubtree, | 2365 MayNeedPaintInvalidation); |
| 2366 ADD_BOOLEAN_BITFIELD(may_need_paint_invalidation_subtree_, |
| 2365 MayNeedPaintInvalidationSubtree); | 2367 MayNeedPaintInvalidationSubtree); |
| 2366 ADD_BOOLEAN_BITFIELD(MayNeedPaintInvalidationAnimatedBackgroundImage, | 2368 ADD_BOOLEAN_BITFIELD(may_need_paint_invalidation_animated_background_image_, |
| 2367 MayNeedPaintInvalidationAnimatedBackgroundImage); | 2369 MayNeedPaintInvalidationAnimatedBackgroundImage); |
| 2368 ADD_BOOLEAN_BITFIELD(NeedsPaintOffsetAndVisualRectUpdate, | 2370 ADD_BOOLEAN_BITFIELD(needs_paint_offset_and_visual_rect_update_, |
| 2369 NeedsPaintOffsetAndVisualRectUpdate); | 2371 NeedsPaintOffsetAndVisualRectUpdate); |
| 2370 ADD_BOOLEAN_BITFIELD(ShouldInvalidateSelection, ShouldInvalidateSelection); | 2372 ADD_BOOLEAN_BITFIELD(should_invalidate_selection_, |
| 2373 ShouldInvalidateSelection); |
| 2371 | 2374 |
| 2372 // This boolean is the cached value of 'float' | 2375 // This boolean is the cached value of 'float' |
| 2373 // (see ComputedStyle::isFloating). | 2376 // (see ComputedStyle::isFloating). |
| 2374 ADD_BOOLEAN_BITFIELD(Floating, Floating); | 2377 ADD_BOOLEAN_BITFIELD(floating_, Floating); |
| 2375 | 2378 |
| 2376 ADD_BOOLEAN_BITFIELD(IsAnonymous, IsAnonymous); | 2379 ADD_BOOLEAN_BITFIELD(is_anonymous_, IsAnonymous); |
| 2377 ADD_BOOLEAN_BITFIELD(IsText, IsText); | 2380 ADD_BOOLEAN_BITFIELD(is_text_, IsText); |
| 2378 ADD_BOOLEAN_BITFIELD(IsBox, IsBox); | 2381 ADD_BOOLEAN_BITFIELD(is_box_, IsBox); |
| 2379 | 2382 |
| 2380 // This boolean represents whether the LayoutObject is 'inline-level' | 2383 // This boolean represents whether the LayoutObject is 'inline-level' |
| 2381 // (a CSS concept). Inline-level boxes are laid out inside a line. If | 2384 // (a CSS concept). Inline-level boxes are laid out inside a line. If |
| 2382 // unset, the box is 'block-level' and thus stack on top of its | 2385 // unset, the box is 'block-level' and thus stack on top of its |
| 2383 // siblings (think of paragraphs). | 2386 // siblings (think of paragraphs). |
| 2384 ADD_BOOLEAN_BITFIELD(IsInline, IsInline); | 2387 ADD_BOOLEAN_BITFIELD(is_inline_, IsInline); |
| 2385 | 2388 |
| 2386 // This boolean is set if the element is an atomic inline-level box. | 2389 // This boolean is set if the element is an atomic inline-level box. |
| 2387 // | 2390 // |
| 2388 // In CSS, atomic inline-level boxes are laid out on a line but they | 2391 // In CSS, atomic inline-level boxes are laid out on a line but they |
| 2389 // are opaque from the perspective of line layout. This means that they | 2392 // are opaque from the perspective of line layout. This means that they |
| 2390 // can't be split across lines like normal inline boxes (LayoutInline). | 2393 // can't be split across lines like normal inline boxes (LayoutInline). |
| 2391 // Examples of atomic inline-level elements: inline tables, inline | 2394 // Examples of atomic inline-level elements: inline tables, inline |
| 2392 // blocks and replaced inline elements. | 2395 // blocks and replaced inline elements. |
| 2393 // See http://www.w3.org/TR/CSS2/visuren.html#inline-boxes. | 2396 // See http://www.w3.org/TR/CSS2/visuren.html#inline-boxes. |
| 2394 // | 2397 // |
| 2395 // Our code is confused about the use of this boolean and confuses it | 2398 // Our code is confused about the use of this boolean and confuses it |
| 2396 // with being replaced (see LayoutReplaced about this). | 2399 // with being replaced (see LayoutReplaced about this). |
| 2397 // TODO(jchaffraix): We should inspect callers and clarify their use. | 2400 // TODO(jchaffraix): We should inspect callers and clarify their use. |
| 2398 // TODO(jchaffraix): We set this boolean for replaced elements that are | 2401 // TODO(jchaffraix): We set this boolean for replaced elements that are |
| 2399 // not inline but shouldn't (crbug.com/567964). This should be enforced. | 2402 // not inline but shouldn't (crbug.com/567964). This should be enforced. |
| 2400 ADD_BOOLEAN_BITFIELD(IsAtomicInlineLevel, IsAtomicInlineLevel); | 2403 ADD_BOOLEAN_BITFIELD(is_atomic_inline_level_, IsAtomicInlineLevel); |
| 2401 ADD_BOOLEAN_BITFIELD(HorizontalWritingMode, HorizontalWritingMode); | 2404 ADD_BOOLEAN_BITFIELD(horizontal_writing_mode_, HorizontalWritingMode); |
| 2402 | 2405 |
| 2403 ADD_BOOLEAN_BITFIELD(HasLayer, HasLayer); | 2406 ADD_BOOLEAN_BITFIELD(has_layer_, HasLayer); |
| 2404 | 2407 |
| 2405 // This boolean is set if overflow != 'visible'. | 2408 // This boolean is set if overflow != 'visible'. |
| 2406 // This means that this object may need an overflow clip to be applied | 2409 // This means that this object may need an overflow clip to be applied |
| 2407 // at paint time to its visual overflow (see OverflowModel for more | 2410 // at paint time to its visual overflow (see OverflowModel for more |
| 2408 // details). Only set for LayoutBoxes and descendants. | 2411 // details). Only set for LayoutBoxes and descendants. |
| 2409 ADD_BOOLEAN_BITFIELD(HasOverflowClip, HasOverflowClip); | 2412 ADD_BOOLEAN_BITFIELD(has_overflow_clip_, HasOverflowClip); |
| 2410 | 2413 |
| 2411 // This boolean is the cached value from | 2414 // This boolean is the cached value from |
| 2412 // ComputedStyle::hasTransformRelatedProperty. | 2415 // ComputedStyle::hasTransformRelatedProperty. |
| 2413 ADD_BOOLEAN_BITFIELD(HasTransformRelatedProperty, | 2416 ADD_BOOLEAN_BITFIELD(has_transform_related_property_, |
| 2414 HasTransformRelatedProperty); | 2417 HasTransformRelatedProperty); |
| 2415 ADD_BOOLEAN_BITFIELD(HasReflection, HasReflection); | 2418 ADD_BOOLEAN_BITFIELD(has_reflection_, HasReflection); |
| 2416 | 2419 |
| 2417 // This boolean is used to know if this LayoutObject is a container for | 2420 // This boolean is used to know if this LayoutObject is a container for |
| 2418 // fixed position descendants. | 2421 // fixed position descendants. |
| 2419 ADD_BOOLEAN_BITFIELD(CanContainFixedPositionObjects, | 2422 ADD_BOOLEAN_BITFIELD(can_contain_fixed_position_objects_, |
| 2420 CanContainFixedPositionObjects); | 2423 CanContainFixedPositionObjects); |
| 2421 | 2424 |
| 2422 // This boolean is used to know if this LayoutObject has one (or more) | 2425 // This boolean is used to know if this LayoutObject has one (or more) |
| 2423 // associated CounterNode(s). | 2426 // associated CounterNode(s). |
| 2424 // See class comment in LayoutCounter.h for more detail. | 2427 // See class comment in LayoutCounter.h for more detail. |
| 2425 ADD_BOOLEAN_BITFIELD(HasCounterNodeMap, HasCounterNodeMap); | 2428 ADD_BOOLEAN_BITFIELD(has_counter_node_map_, HasCounterNodeMap); |
| 2426 | 2429 |
| 2427 ADD_BOOLEAN_BITFIELD(EverHadLayout, EverHadLayout); | 2430 ADD_BOOLEAN_BITFIELD(ever_had_layout_, EverHadLayout); |
| 2428 ADD_BOOLEAN_BITFIELD(AncestorLineBoxDirty, AncestorLineBoxDirty); | 2431 ADD_BOOLEAN_BITFIELD(ancestor_line_box_dirty_, AncestorLineBoxDirty); |
| 2429 | 2432 |
| 2430 ADD_BOOLEAN_BITFIELD(IsInsideFlowThread, IsInsideFlowThread); | 2433 ADD_BOOLEAN_BITFIELD(is_inside_flow_thread_, IsInsideFlowThread); |
| 2431 | 2434 |
| 2432 ADD_BOOLEAN_BITFIELD(SubtreeChangeListenerRegistered, | 2435 ADD_BOOLEAN_BITFIELD(subtree_change_listener_registered_, |
| 2433 SubtreeChangeListenerRegistered); | 2436 SubtreeChangeListenerRegistered); |
| 2434 ADD_BOOLEAN_BITFIELD(NotifiedOfSubtreeChange, NotifiedOfSubtreeChange); | 2437 ADD_BOOLEAN_BITFIELD(notified_of_subtree_change_, NotifiedOfSubtreeChange); |
| 2435 ADD_BOOLEAN_BITFIELD(ConsumesSubtreeChangeNotification, | 2438 ADD_BOOLEAN_BITFIELD(consumes_subtree_change_notification_, |
| 2436 ConsumesSubtreeChangeNotification); | 2439 ConsumesSubtreeChangeNotification); |
| 2437 | 2440 |
| 2438 // from LayoutBlock | 2441 // from LayoutBlock |
| 2439 ADD_BOOLEAN_BITFIELD(ChildrenInline, ChildrenInline); | 2442 ADD_BOOLEAN_BITFIELD(children_inline_, ChildrenInline); |
| 2440 | 2443 |
| 2441 // from LayoutBlockFlow | 2444 // from LayoutBlockFlow |
| 2442 ADD_BOOLEAN_BITFIELD(ContainsInlineWithOutlineAndContinuation, | 2445 ADD_BOOLEAN_BITFIELD(contains_inline_with_outline_and_continuation_, |
| 2443 ContainsInlineWithOutlineAndContinuation); | 2446 ContainsInlineWithOutlineAndContinuation); |
| 2444 | 2447 |
| 2445 // from LayoutInline | 2448 // from LayoutInline |
| 2446 ADD_BOOLEAN_BITFIELD(AlwaysCreateLineBoxesForLayoutInline, | 2449 ADD_BOOLEAN_BITFIELD(always_create_line_boxes_for_layout_inline_, |
| 2447 AlwaysCreateLineBoxesForLayoutInline); | 2450 AlwaysCreateLineBoxesForLayoutInline); |
| 2448 | 2451 |
| 2449 // Background obscuration status of the previous frame. | 2452 // Background obscuration status of the previous frame. |
| 2450 ADD_BOOLEAN_BITFIELD(PreviousBackgroundObscured, | 2453 ADD_BOOLEAN_BITFIELD(previous_background_obscured_, |
| 2451 PreviousBackgroundObscured); | 2454 PreviousBackgroundObscured); |
| 2452 | 2455 |
| 2453 ADD_BOOLEAN_BITFIELD(IsBackgroundAttachmentFixedObject, | 2456 ADD_BOOLEAN_BITFIELD(is_background_attachment_fixed_object_, |
| 2454 IsBackgroundAttachmentFixedObject); | 2457 IsBackgroundAttachmentFixedObject); |
| 2455 ADD_BOOLEAN_BITFIELD(IsScrollAnchorObject, IsScrollAnchorObject); | 2458 ADD_BOOLEAN_BITFIELD(is_scroll_anchor_object_, IsScrollAnchorObject); |
| 2456 | 2459 |
| 2457 // Whether changes in this LayoutObject's CSS properties since the last | 2460 // Whether changes in this LayoutObject's CSS properties since the last |
| 2458 // layout should suppress any adjustments that would be made during the next | 2461 // layout should suppress any adjustments that would be made during the next |
| 2459 // layout by ScrollAnchor objects for which this LayoutObject is on the path | 2462 // layout by ScrollAnchor objects for which this LayoutObject is on the path |
| 2460 // from the anchor node to the scroller. | 2463 // from the anchor node to the scroller. |
| 2461 // See http://bit.ly/sanaclap for more info. | 2464 // See http://bit.ly/sanaclap for more info. |
| 2462 ADD_BOOLEAN_BITFIELD(ScrollAnchorDisablingStyleChanged, | 2465 ADD_BOOLEAN_BITFIELD(scroll_anchor_disabling_style_changed_, |
| 2463 ScrollAnchorDisablingStyleChanged); | 2466 ScrollAnchorDisablingStyleChanged); |
| 2464 | 2467 |
| 2465 ADD_BOOLEAN_BITFIELD(HasBoxDecorationBackground, | 2468 ADD_BOOLEAN_BITFIELD(has_box_decoration_background_, |
| 2466 HasBoxDecorationBackground); | 2469 HasBoxDecorationBackground); |
| 2467 | 2470 |
| 2468 ADD_BOOLEAN_BITFIELD(HasPreviousLocationInBacking, | 2471 ADD_BOOLEAN_BITFIELD(has_previous_location_in_backing_, |
| 2469 HasPreviousLocationInBacking); | 2472 HasPreviousLocationInBacking); |
| 2470 ADD_BOOLEAN_BITFIELD(HasPreviousSelectionVisualRect, | 2473 ADD_BOOLEAN_BITFIELD(has_previous_selection_visual_rect_, |
| 2471 HasPreviousSelectionVisualRect); | 2474 HasPreviousSelectionVisualRect); |
| 2472 | 2475 |
| 2473 // Whether the paint properties need to be updated. For more details, see | 2476 // Whether the paint properties need to be updated. For more details, see |
| 2474 // LayoutObject::needsPaintPropertyUpdate(). | 2477 // LayoutObject::needsPaintPropertyUpdate(). |
| 2475 ADD_BOOLEAN_BITFIELD(NeedsPaintPropertyUpdate, NeedsPaintPropertyUpdate); | 2478 ADD_BOOLEAN_BITFIELD(needs_paint_property_update_, |
| 2479 NeedsPaintPropertyUpdate); |
| 2476 // Whether paint properties of the whole subtree need to be updated. | 2480 // Whether paint properties of the whole subtree need to be updated. |
| 2477 ADD_BOOLEAN_BITFIELD(SubtreeNeedsPaintPropertyUpdate, | 2481 ADD_BOOLEAN_BITFIELD(subtree_needs_paint_property_update_, |
| 2478 SubtreeNeedsPaintPropertyUpdate) | 2482 SubtreeNeedsPaintPropertyUpdate) |
| 2479 // Whether the paint properties of a descendant need to be updated. For more | 2483 // Whether the paint properties of a descendant need to be updated. For more |
| 2480 // details, see LayoutObject::descendantNeedsPaintPropertyUpdate(). | 2484 // details, see LayoutObject::descendantNeedsPaintPropertyUpdate(). |
| 2481 ADD_BOOLEAN_BITFIELD(DescendantNeedsPaintPropertyUpdate, | 2485 ADD_BOOLEAN_BITFIELD(descendant_needs_paint_property_update_, |
| 2482 DescendantNeedsPaintPropertyUpdate); | 2486 DescendantNeedsPaintPropertyUpdate); |
| 2483 | 2487 |
| 2484 ADD_BOOLEAN_BITFIELD(BackgroundChangedSinceLastPaintInvalidation, | 2488 ADD_BOOLEAN_BITFIELD(background_changed_since_last_paint_invalidation_, |
| 2485 BackgroundChangedSinceLastPaintInvalidation); | 2489 BackgroundChangedSinceLastPaintInvalidation); |
| 2486 | 2490 |
| 2487 // Whether shape of outline may be affected by any descendants. This is | 2491 // Whether shape of outline may be affected by any descendants. This is |
| 2488 // updated before paint invalidation, checked during paint invalidation. | 2492 // updated before paint invalidation, checked during paint invalidation. |
| 2489 ADD_BOOLEAN_BITFIELD(OutlineMayBeAffectedByDescendants, | 2493 ADD_BOOLEAN_BITFIELD(outline_may_be_affected_by_descendants_, |
| 2490 OutlineMayBeAffectedByDescendants); | 2494 OutlineMayBeAffectedByDescendants); |
| 2491 // The outlineMayBeAffectedByDescendants status of the last paint | 2495 // The outlineMayBeAffectedByDescendants status of the last paint |
| 2492 // invalidation. | 2496 // invalidation. |
| 2493 ADD_BOOLEAN_BITFIELD(PreviousOutlineMayBeAffectedByDescendants, | 2497 ADD_BOOLEAN_BITFIELD(previous_outline_may_be_affected_by_descendants_, |
| 2494 PreviousOutlineMayBeAffectedByDescendants); | 2498 PreviousOutlineMayBeAffectedByDescendants); |
| 2495 | 2499 |
| 2496 protected: | 2500 protected: |
| 2497 // Use protected to avoid warning about unused variable. | 2501 // Use protected to avoid warning about unused variable. |
| 2498 unsigned unused_bits_ : 4; | 2502 unsigned unused_bits_ : 4; |
| 2499 | 2503 |
| 2500 private: | 2504 private: |
| 2501 // This is the cached 'position' value of this object | 2505 // This is the cached 'position' value of this object |
| 2502 // (see ComputedStyle::position). | 2506 // (see ComputedStyle::position). |
| 2503 unsigned positioned_state_ : 2; // PositionedState | 2507 unsigned positioned_state_ : 2; // PositionedState |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2825 CORE_EXPORT void showLineTree(const blink::LayoutObject*); | 2829 CORE_EXPORT void showLineTree(const blink::LayoutObject*); |
| 2826 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); | 2830 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); |
| 2827 // We don't make object2 an optional parameter so that showLayoutTree | 2831 // We don't make object2 an optional parameter so that showLayoutTree |
| 2828 // can be called from gdb easily. | 2832 // can be called from gdb easily. |
| 2829 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, | 2833 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, |
| 2830 const blink::LayoutObject* object2); | 2834 const blink::LayoutObject* object2); |
| 2831 | 2835 |
| 2832 #endif | 2836 #endif |
| 2833 | 2837 |
| 2834 #endif // LayoutObject_h | 2838 #endif // LayoutObject_h |
| OLD | NEW |