Chromium Code Reviews| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 LayoutBox* enclosingScrollableBox() const; | 285 LayoutBox* enclosingScrollableBox() const; |
| 286 | 286 |
| 287 // Function to return our enclosing flow thread if we are contained inside | 287 // Function to return our enclosing flow thread if we are contained inside |
| 288 // one. This function follows the containing block chain. | 288 // one. This function follows the containing block chain. |
| 289 LayoutFlowThread* flowThreadContainingBlock() const { | 289 LayoutFlowThread* flowThreadContainingBlock() const { |
| 290 if (!isInsideFlowThread()) | 290 if (!isInsideFlowThread()) |
| 291 return nullptr; | 291 return nullptr; |
| 292 return locateFlowThreadContainingBlock(); | 292 return locateFlowThreadContainingBlock(); |
| 293 } | 293 } |
| 294 | 294 |
| 295 #if ENABLE(ASSERT) | 295 #if DCHECK_IS_ON() |
| 296 void setHasAXObject(bool flag) { m_hasAXObject = flag; } | 296 void setHasAXObject(bool flag) { m_hasAXObject = flag; } |
| 297 bool hasAXObject() const { return m_hasAXObject; } | 297 bool hasAXObject() const { return m_hasAXObject; } |
| 298 | 298 |
| 299 // Helper class forbidding calls to setNeedsLayout() during its lifetime. | 299 // Helper class forbidding calls to setNeedsLayout() during its lifetime. |
| 300 class SetLayoutNeededForbiddenScope { | 300 class SetLayoutNeededForbiddenScope { |
| 301 public: | 301 public: |
| 302 explicit SetLayoutNeededForbiddenScope(LayoutObject&); | 302 explicit SetLayoutNeededForbiddenScope(LayoutObject&); |
| 303 ~SetLayoutNeededForbiddenScope(); | 303 ~SetLayoutNeededForbiddenScope(); |
| 304 | 304 |
| 305 private: | 305 private: |
| 306 LayoutObject& m_layoutObject; | 306 LayoutObject& m_layoutObject; |
| 307 bool m_preexistingForbidden; | 307 bool m_preexistingForbidden; |
| 308 }; | 308 }; |
| 309 | 309 |
| 310 void assertLaidOut() const { | 310 void assertLaidOut() const { |
| 311 #ifndef NDEBUG | 311 #ifndef NDEBUG |
| 312 if (needsLayout()) | 312 if (needsLayout()) |
| 313 showLayoutTreeForThis(); | 313 showLayoutTreeForThis(); |
| 314 #endif | 314 #endif |
| 315 SECURITY_DCHECK(!needsLayout()); | 315 SECURITY_DCHECK(!needsLayout()); |
| 316 } | 316 } |
| 317 | 317 |
| 318 void assertSubtreeIsLaidOut() const { | 318 void assertSubtreeIsLaidOut() const { |
| 319 for (const LayoutObject* layoutObject = this; layoutObject; | 319 for (const LayoutObject* layoutObject = this; layoutObject; |
| 320 layoutObject = layoutObject->nextInPreOrder()) | 320 layoutObject = layoutObject->nextInPreOrder()) |
| 321 layoutObject->assertLaidOut(); | 321 layoutObject->assertLaidOut(); |
| 322 } | 322 } |
| 323 | 323 |
| 324 void assertClearedPaintInvalidationFlags() const { | 324 void assertClearedPaintInvalidationFlags() const { |
| 325 if (paintInvalidationStateIsDirty()) { | |
|
Yuta Kitamura
2016/12/01 08:18:56
Why did this get out of #ifndef block? This check
mstensho (USE GERRIT)
2016/12/01 08:29:21
This code is already inside an #if DCHECK_IS_ON(),
Alexander Alekseev
2016/12/01 08:54:39
Yes, you are absolutely right.
Yuta Kitamura
2016/12/01 09:51:06
I still don't agree. I feel like there may be some
mstensho (USE GERRIT)
2016/12/01 10:00:37
See assertLaidOut() for a similar pattern. That on
Yuta Kitamura
2016/12/01 10:56:50
Please don't do that either unless you confirm add
mstensho (USE GERRIT)
2016/12/01 12:44:10
I'm a layout owner, but landing this piece as a se
Alexander Alekseev
2016/12/02 03:39:31
That's fine. Let's move this to another CL.
| |
| 325 #ifndef NDEBUG | 326 #ifndef NDEBUG |
| 326 if (paintInvalidationStateIsDirty()) { | |
| 327 showLayoutTreeForThis(); | 327 showLayoutTreeForThis(); |
| 328 #endif | |
| 328 ASSERT_NOT_REACHED(); | 329 ASSERT_NOT_REACHED(); |
| 329 } | 330 } |
| 330 #endif | |
| 331 } | 331 } |
| 332 | 332 |
| 333 void assertSubtreeClearedPaintInvalidationFlags() const { | 333 void assertSubtreeClearedPaintInvalidationFlags() const { |
| 334 for (const LayoutObject* layoutObject = this; layoutObject; | 334 for (const LayoutObject* layoutObject = this; layoutObject; |
| 335 layoutObject = layoutObject->nextInPreOrder()) | 335 layoutObject = layoutObject->nextInPreOrder()) |
| 336 layoutObject->assertClearedPaintInvalidationFlags(); | 336 layoutObject->assertClearedPaintInvalidationFlags(); |
| 337 } | 337 } |
| 338 | 338 |
| 339 #endif | 339 #endif |
| 340 | 340 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 412 // if we're not a LayoutFlowThread. | 412 // if we're not a LayoutFlowThread. |
| 413 // A LayoutFlowThread is always considered to be inside itself, so it never | 413 // A LayoutFlowThread is always considered to be inside itself, so it never |
| 414 // has to change its state in response to parent changes. | 414 // has to change its state in response to parent changes. |
| 415 bool insideFlowThread = parent && parent->isInsideFlowThread(); | 415 bool insideFlowThread = parent && parent->isInsideFlowThread(); |
| 416 if (insideFlowThread != isInsideFlowThread() && !isLayoutFlowThread()) | 416 if (insideFlowThread != isInsideFlowThread() && !isLayoutFlowThread()) |
| 417 setIsInsideFlowThreadIncludingDescendants(insideFlowThread); | 417 setIsInsideFlowThreadIncludingDescendants(insideFlowThread); |
| 418 } | 418 } |
| 419 | 419 |
| 420 ////////////////////////////////////////// | 420 ////////////////////////////////////////// |
| 421 private: | 421 private: |
| 422 #if ENABLE(ASSERT) | 422 #if DCHECK_IS_ON() |
| 423 bool isSetNeedsLayoutForbidden() const { return m_setNeedsLayoutForbidden; } | 423 bool isSetNeedsLayoutForbidden() const { return m_setNeedsLayoutForbidden; } |
| 424 void setNeedsLayoutIsForbidden(bool flag) { | 424 void setNeedsLayoutIsForbidden(bool flag) { |
| 425 m_setNeedsLayoutForbidden = flag; | 425 m_setNeedsLayoutForbidden = flag; |
| 426 } | 426 } |
| 427 #endif | 427 #endif |
| 428 | 428 |
| 429 void addAbsoluteRectForLayer(IntRect& result); | 429 void addAbsoluteRectForLayer(IntRect& result); |
| 430 bool requiresAnonymousTableWrappers(const LayoutObject*) const; | 430 bool requiresAnonymousTableWrappers(const LayoutObject*) const; |
| 431 | 431 |
| 432 // Gets pseudoStyle from Shadow host(in case of input elements) | 432 // Gets pseudoStyle from Shadow host(in case of input elements) |
| (...skipping 1599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2032 void removeFromLayoutFlowThreadRecursive(LayoutFlowThread*); | 2032 void removeFromLayoutFlowThreadRecursive(LayoutFlowThread*); |
| 2033 | 2033 |
| 2034 ComputedStyle* cachedFirstLineStyle() const; | 2034 ComputedStyle* cachedFirstLineStyle() const; |
| 2035 StyleDifference adjustStyleDifference(StyleDifference) const; | 2035 StyleDifference adjustStyleDifference(StyleDifference) const; |
| 2036 | 2036 |
| 2037 Color selectionColor(int colorProperty, const GlobalPaintFlags) const; | 2037 Color selectionColor(int colorProperty, const GlobalPaintFlags) const; |
| 2038 | 2038 |
| 2039 void removeShapeImageClient(ShapeValue*); | 2039 void removeShapeImageClient(ShapeValue*); |
| 2040 void removeCursorImageClient(const CursorList*); | 2040 void removeCursorImageClient(const CursorList*); |
| 2041 | 2041 |
| 2042 #if ENABLE(ASSERT) | 2042 #if DCHECK_IS_ON() |
| 2043 void checkBlockPositionedObjectsNeedLayout(); | 2043 void checkBlockPositionedObjectsNeedLayout(); |
| 2044 #endif | 2044 #endif |
| 2045 | 2045 |
| 2046 bool isTextOrSVGChild() const { | 2046 bool isTextOrSVGChild() const { |
| 2047 return isText() || (isSVG() && !isSVGRoot()); | 2047 return isText() || (isSVG() && !isSVGRoot()); |
| 2048 } | 2048 } |
| 2049 | 2049 |
| 2050 static bool isAllowedToModifyLayoutTreeStructure(Document&); | 2050 static bool isAllowedToModifyLayoutTreeStructure(Document&); |
| 2051 | 2051 |
| 2052 // Returns the parent for paint invalidation. | 2052 // Returns the parent for paint invalidation. |
| 2053 // - For LayoutView, returns the owner layout object in the containing frame | 2053 // - For LayoutView, returns the owner layout object in the containing frame |
| 2054 // if any or nullptr; | 2054 // if any or nullptr; |
| 2055 // - For multi-column spanner, returns the spanner placeholder; | 2055 // - For multi-column spanner, returns the spanner placeholder; |
| 2056 // - Otherwise returns parent(). | 2056 // - Otherwise returns parent(). |
| 2057 LayoutObject* paintInvalidationParent() const; | 2057 LayoutObject* paintInvalidationParent() const; |
| 2058 | 2058 |
| 2059 RefPtr<ComputedStyle> m_style; | 2059 RefPtr<ComputedStyle> m_style; |
| 2060 | 2060 |
| 2061 // Oilpan: This untraced pointer to the owning Node is considered safe. | 2061 // Oilpan: This untraced pointer to the owning Node is considered safe. |
| 2062 UntracedMember<Node> m_node; | 2062 UntracedMember<Node> m_node; |
| 2063 | 2063 |
| 2064 LayoutObject* m_parent; | 2064 LayoutObject* m_parent; |
| 2065 LayoutObject* m_previous; | 2065 LayoutObject* m_previous; |
| 2066 LayoutObject* m_next; | 2066 LayoutObject* m_next; |
| 2067 | 2067 |
| 2068 #if ENABLE(ASSERT) | 2068 #if DCHECK_IS_ON() |
| 2069 unsigned m_hasAXObject : 1; | 2069 unsigned m_hasAXObject : 1; |
| 2070 unsigned m_setNeedsLayoutForbidden : 1; | 2070 unsigned m_setNeedsLayoutForbidden : 1; |
| 2071 #endif | 2071 #endif |
| 2072 | 2072 |
| 2073 #define ADD_BOOLEAN_BITFIELD(name, Name) \ | 2073 #define ADD_BOOLEAN_BITFIELD(name, Name) \ |
| 2074 private: \ | 2074 private: \ |
| 2075 unsigned m_##name : 1; \ | 2075 unsigned m_##name : 1; \ |
| 2076 \ | 2076 \ |
| 2077 public: \ | 2077 public: \ |
| 2078 bool name() const { return m_##name; } \ | 2078 bool name() const { return m_##name; } \ |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2513 setMayNeedPaintInvalidation(); | 2513 setMayNeedPaintInvalidation(); |
| 2514 | 2514 |
| 2515 // Clear needsLayout flags. | 2515 // Clear needsLayout flags. |
| 2516 setSelfNeedsLayout(false); | 2516 setSelfNeedsLayout(false); |
| 2517 setPosChildNeedsLayout(false); | 2517 setPosChildNeedsLayout(false); |
| 2518 setNeedsSimplifiedNormalFlowLayout(false); | 2518 setNeedsSimplifiedNormalFlowLayout(false); |
| 2519 setNormalChildNeedsLayout(false); | 2519 setNormalChildNeedsLayout(false); |
| 2520 setNeedsPositionedMovementLayout(false); | 2520 setNeedsPositionedMovementLayout(false); |
| 2521 setAncestorLineBoxDirty(false); | 2521 setAncestorLineBoxDirty(false); |
| 2522 | 2522 |
| 2523 #if ENABLE(ASSERT) | 2523 #if DCHECK_IS_ON() |
| 2524 checkBlockPositionedObjectsNeedLayout(); | 2524 checkBlockPositionedObjectsNeedLayout(); |
| 2525 #endif | 2525 #endif |
| 2526 | 2526 |
| 2527 setScrollAnchorDisablingStyleChanged(false); | 2527 setScrollAnchorDisablingStyleChanged(false); |
| 2528 } | 2528 } |
| 2529 | 2529 |
| 2530 inline void LayoutObject::setChildNeedsLayout(MarkingBehavior markParents, | 2530 inline void LayoutObject::setChildNeedsLayout(MarkingBehavior markParents, |
| 2531 SubtreeLayoutScope* layouter) { | 2531 SubtreeLayoutScope* layouter) { |
| 2532 ASSERT(!isSetNeedsLayoutForbidden()); | 2532 ASSERT(!isSetNeedsLayoutForbidden()); |
| 2533 bool alreadyNeededLayout = normalChildNeedsLayout(); | 2533 bool alreadyNeededLayout = normalChildNeedsLayout(); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2645 CORE_EXPORT void showLineTree(const blink::LayoutObject*); | 2645 CORE_EXPORT void showLineTree(const blink::LayoutObject*); |
| 2646 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); | 2646 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1); |
| 2647 // We don't make object2 an optional parameter so that showLayoutTree | 2647 // We don't make object2 an optional parameter so that showLayoutTree |
| 2648 // can be called from gdb easily. | 2648 // can be called from gdb easily. |
| 2649 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, | 2649 CORE_EXPORT void showLayoutTree(const blink::LayoutObject* object1, |
| 2650 const blink::LayoutObject* object2); | 2650 const blink::LayoutObject* object2); |
| 2651 | 2651 |
| 2652 #endif | 2652 #endif |
| 2653 | 2653 |
| 2654 #endif // LayoutObject_h | 2654 #endif // LayoutObject_h |
| OLD | NEW |