Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2695963005: WIP: redirect some LayoutBox methods to ng fragments
Patch Set: tot Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2013 Adobe Systems Incorporated. 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 static OverrideSizeMap* gExtraInlineOffsetMap = nullptr; 78 static OverrideSizeMap* gExtraInlineOffsetMap = nullptr;
79 static OverrideSizeMap* gExtraBlockOffsetMap = nullptr; 79 static OverrideSizeMap* gExtraBlockOffsetMap = nullptr;
80 80
81 // Size of border belt for autoscroll. When mouse pointer in border belt, 81 // Size of border belt for autoscroll. When mouse pointer in border belt,
82 // autoscroll is started. 82 // autoscroll is started.
83 static const int autoscrollBeltSize = 20; 83 static const int autoscrollBeltSize = 20;
84 static const unsigned backgroundObscurationTestMaxDepth = 4; 84 static const unsigned backgroundObscurationTestMaxDepth = 4;
85 85
86 struct SameSizeAsLayoutBox : public LayoutBoxModelObject { 86 struct SameSizeAsLayoutBox : public LayoutBoxModelObject {
87 LayoutRect frameRect; 87 // LayoutRect frameRect;
88 LayoutSize previousSize; 88 LayoutSize previousSize;
89 LayoutUnit intrinsicContentLogicalHeight; 89 LayoutUnit intrinsicContentLogicalHeight;
90 LayoutRectOutsets marginBoxOutsets; 90 LayoutRectOutsets marginBoxOutsets;
91 LayoutUnit preferredLogicalWidth[2]; 91 LayoutUnit preferredLogicalWidth[2];
92 void* pointers[3]; 92 void* pointers[3];
93 RefPtr<NGPhysicalBoxFragment> transitionToLayoutNG;
93 }; 94 };
94 95
95 static_assert(sizeof(LayoutBox) == sizeof(SameSizeAsLayoutBox), 96 static_assert(sizeof(LayoutBox) == sizeof(SameSizeAsLayoutBox),
96 "LayoutBox should stay small"); 97 "LayoutBox should stay small");
97 98
98 LayoutBox::LayoutBox(ContainerNode* node) 99 LayoutBox::LayoutBox(ContainerNode* node)
99 : LayoutBoxModelObject(node), 100 : LayoutBoxModelObject(node),
101 m_ngPhysicalBoxFragment(adoptRef(new NGPhysicalBoxFragment())),
100 m_intrinsicContentLogicalHeight(-1), 102 m_intrinsicContentLogicalHeight(-1),
101 m_minPreferredLogicalWidth(-1), 103 m_minPreferredLogicalWidth(-1),
102 m_maxPreferredLogicalWidth(-1), 104 m_maxPreferredLogicalWidth(-1),
103 m_inlineBoxWrapper(nullptr) { 105 m_inlineBoxWrapper(nullptr) {
104 setIsBox(); 106 setIsBox();
105 } 107 }
106 108
107 PaintLayerType LayoutBox::layerTypeRequired() const { 109 PaintLayerType LayoutBox::layerTypeRequired() const {
108 // hasAutoZIndex only returns true if the element is positioned or a flex-item 110 // hasAutoZIndex only returns true if the element is positioned or a flex-item
109 // since position:static elements that are not flex-items get their z-index 111 // since position:static elements that are not flex-items get their z-index
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 } 506 }
505 507
506 // More IE extensions. clientWidth and clientHeight represent the interior of 508 // More IE extensions. clientWidth and clientHeight represent the interior of
507 // an object excluding border and scrollbar. 509 // an object excluding border and scrollbar.
508 DISABLE_CFI_PERF 510 DISABLE_CFI_PERF
509 LayoutUnit LayoutBox::clientWidth() const { 511 LayoutUnit LayoutBox::clientWidth() const {
510 // We need to clamp negative values. The scrollbar may be wider than the 512 // We need to clamp negative values. The scrollbar may be wider than the
511 // padding box. Another reason: While border side values are currently limited 513 // padding box. Another reason: While border side values are currently limited
512 // to 2^20px (a recent change in the code), if this limit is raised again in 514 // to 2^20px (a recent change in the code), if this limit is raised again in
513 // the future, we'd have ill effects of saturated arithmetic otherwise. 515 // the future, we'd have ill effects of saturated arithmetic otherwise.
514 return (m_frameRect.width() - borderLeft() - borderRight() - 516 return (m_ngPhysicalBoxFragment->Width() - borderLeft() - borderRight() -
515 verticalScrollbarWidth()) 517 verticalScrollbarWidth())
516 .clampNegativeToZero(); 518 .clampNegativeToZero();
517 } 519 }
518 520
519 DISABLE_CFI_PERF 521 DISABLE_CFI_PERF
520 LayoutUnit LayoutBox::clientHeight() const { 522 LayoutUnit LayoutBox::clientHeight() const {
521 // We need to clamp negative values. The scrollbar may be wider than the 523 // We need to clamp negative values. The scrollbar may be wider than the
522 // padding box. Another reason: While border side values are currently limited 524 // padding box. Another reason: While border side values are currently limited
523 // to 2^20px (a recent change in the code), if this limit is raised again in 525 // to 2^20px (a recent change in the code), if this limit is raised again in
524 // the future, we'd have ill effects of saturated arithmetic otherwise. 526 // the future, we'd have ill effects of saturated arithmetic otherwise.
525 return (m_frameRect.height() - borderTop() - borderBottom() - 527 return (m_ngPhysicalBoxFragment->Height() - borderTop() - borderBottom() -
526 horizontalScrollbarHeight()) 528 horizontalScrollbarHeight())
527 .clampNegativeToZero(); 529 .clampNegativeToZero();
528 } 530 }
529 531
530 int LayoutBox::pixelSnappedClientWidth() const { 532 int LayoutBox::pixelSnappedClientWidth() const {
531 return snapSizeToPixel(clientWidth(), location().x() + clientLeft()); 533 return snapSizeToPixel(clientWidth(), location().x() + clientLeft());
532 } 534 }
533 535
534 DISABLE_CFI_PERF 536 DISABLE_CFI_PERF
535 int LayoutBox::pixelSnappedClientHeight() const { 537 int LayoutBox::pixelSnappedClientHeight() const {
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 const LayoutPoint& accumulatedOffset) const { 727 const LayoutPoint& accumulatedOffset) const {
726 rects.push_back(pixelSnappedIntRect(accumulatedOffset, size())); 728 rects.push_back(pixelSnappedIntRect(accumulatedOffset, size()));
727 } 729 }
728 730
729 void LayoutBox::absoluteQuads(Vector<FloatQuad>& quads, 731 void LayoutBox::absoluteQuads(Vector<FloatQuad>& quads,
730 MapCoordinatesFlags mode) const { 732 MapCoordinatesFlags mode) const {
731 if (LayoutFlowThread* flowThread = flowThreadContainingBlock()) { 733 if (LayoutFlowThread* flowThread = flowThreadContainingBlock()) {
732 flowThread->absoluteQuadsForDescendant(*this, quads, mode); 734 flowThread->absoluteQuadsForDescendant(*this, quads, mode);
733 return; 735 return;
734 } 736 }
735 quads.push_back( 737 quads.push_back(localToAbsoluteQuad(
736 localToAbsoluteQuad(FloatRect(0, 0, m_frameRect.width().toFloat(), 738 FloatRect(0, 0, m_ngPhysicalBoxFragment->Width().toFloat(),
737 m_frameRect.height().toFloat()), 739 m_ngPhysicalBoxFragment->Height().toFloat()),
738 mode)); 740 mode));
739 } 741 }
740 742
741 FloatRect LayoutBox::localBoundingBoxRectForAccessibility() const { 743 FloatRect LayoutBox::localBoundingBoxRectForAccessibility() const {
742 return FloatRect(0, 0, m_frameRect.width().toFloat(), 744 return FloatRect(0, 0, m_ngPhysicalBoxFragment->Width().toFloat(),
743 m_frameRect.height().toFloat()); 745 m_ngPhysicalBoxFragment->Height().toFloat());
744 } 746 }
745 747
746 void LayoutBox::updateLayerTransformAfterLayout() { 748 void LayoutBox::updateLayerTransformAfterLayout() {
747 // Transform-origin depends on box size, so we need to update the layer 749 // Transform-origin depends on box size, so we need to update the layer
748 // transform after layout. 750 // transform after layout.
749 if (hasLayer()) 751 if (hasLayer())
750 layer()->updateTransformationMatrix(); 752 layer()->updateTransformationMatrix();
751 } 753 }
752 754
753 LayoutUnit LayoutBox::logicalHeightWithVisibleOverflow() const { 755 LayoutUnit LayoutBox::logicalHeightWithVisibleOverflow() const {
(...skipping 4960 matching lines...) Expand 10 before | Expand all | Expand 10 after
5714 5716
5715 void LayoutBox::MutableForPainting:: 5717 void LayoutBox::MutableForPainting::
5716 savePreviousContentBoxSizeAndLayoutOverflowRect() { 5718 savePreviousContentBoxSizeAndLayoutOverflowRect() {
5717 auto& rareData = layoutBox().ensureRareData(); 5719 auto& rareData = layoutBox().ensureRareData();
5718 rareData.m_hasPreviousContentBoxSizeAndLayoutOverflowRect = true; 5720 rareData.m_hasPreviousContentBoxSizeAndLayoutOverflowRect = true;
5719 rareData.m_previousContentBoxSize = layoutBox().contentBoxRect().size(); 5721 rareData.m_previousContentBoxSize = layoutBox().contentBoxRect().size();
5720 rareData.m_previousLayoutOverflowRect = layoutBox().layoutOverflowRect(); 5722 rareData.m_previousLayoutOverflowRect = layoutBox().layoutOverflowRect();
5721 } 5723 }
5722 5724
5723 } // namespace blink 5725 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | third_party/WebKit/Source/core/layout/ng/ng_physical_box_fragment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698