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

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

Issue 2695963005: WIP: redirect some LayoutBox methods to ng fragments
Patch Set: Created 3 years, 10 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 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2006, 2007 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 * 20 *
21 */ 21 */
22 22
23 #ifndef LayoutBox_h 23 #ifndef LayoutBox_h
24 #define LayoutBox_h 24 #define LayoutBox_h
25 25
26 #include "core/CoreExport.h" 26 #include "core/CoreExport.h"
27 #include "core/layout/ng/ng_physical_box_fragment.h"
27 #include "core/layout/LayoutBoxModelObject.h" 28 #include "core/layout/LayoutBoxModelObject.h"
28 #include "core/layout/OverflowModel.h" 29 #include "core/layout/OverflowModel.h"
29 #include "platform/scroll/ScrollTypes.h" 30 #include "platform/scroll/ScrollTypes.h"
30 #include "wtf/Compiler.h" 31 #include "wtf/Compiler.h"
31 #include "wtf/PtrUtil.h" 32 #include "wtf/PtrUtil.h"
32 #include <memory> 33 #include <memory>
33 34
34 namespace blink { 35 namespace blink {
35 36
36 class LayoutBlockFlow; 37 class LayoutBlockFlow;
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 198
198 bool backgroundIsKnownToBeOpaqueInRect( 199 bool backgroundIsKnownToBeOpaqueInRect(
199 const LayoutRect& localRect) const override; 200 const LayoutRect& localRect) const override;
200 201
201 virtual bool backgroundShouldAlwaysBeClipped() const { return false; } 202 virtual bool backgroundShouldAlwaysBeClipped() const { return false; }
202 203
203 // Use this with caution! No type checking is done! 204 // Use this with caution! No type checking is done!
204 LayoutBox* firstChildBox() const; 205 LayoutBox* firstChildBox() const;
205 LayoutBox* firstInFlowChildBox() const; 206 LayoutBox* firstInFlowChildBox() const;
206 LayoutBox* lastChildBox() const; 207 LayoutBox* lastChildBox() const;
207 208 private:
209 RefPtr<NGPhysicalBoxFragment> m_ngPhysicalBoxFragment;
210 public:
211 void setNGPhysicalFragment(RefPtr<NGPhysicalBoxFragment> fragment) {
212 m_ngPhysicalBoxFragment = fragment;
213 }
208 int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); } 214 int pixelSnappedWidth() const { return m_frameRect.pixelSnappedWidth(); }
209 int pixelSnappedHeight() const { return m_frameRect.pixelSnappedHeight(); } 215 int pixelSnappedHeight() const { return m_frameRect.pixelSnappedHeight(); }
210 216
211 void setX(LayoutUnit x) { 217 void setX(LayoutUnit x) {
212 if (x == m_frameRect.x()) 218 if (x == m_frameRect.x())
213 return; 219 return;
214 m_frameRect.setX(x); 220 m_frameRect.setX(x);
221 // m_ngPhysicalBoxFragment->setX(x);
ikilpatrick 2017/02/16 18:24:20 yeah so this is what i had in mind, I'd delete m_f
dgrogan 2017/02/16 18:54:09 What should I do about layout calling location() (
215 locationChanged(); 222 locationChanged();
216 } 223 }
217 void setY(LayoutUnit y) { 224 void setY(LayoutUnit y) {
218 if (y == m_frameRect.y()) 225 if (y == m_frameRect.y())
219 return; 226 return;
220 m_frameRect.setY(y); 227 m_frameRect.setY(y);
221 locationChanged(); 228 locationChanged();
222 } 229 }
223 void setWidth(LayoutUnit width) { 230 void setWidth(LayoutUnit width) {
224 if (width == m_frameRect.width()) 231 if (width == m_frameRect.width())
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 else 313 else
307 setHeight(size); 314 setHeight(size);
308 } 315 }
309 void setLogicalHeight(LayoutUnit size) { 316 void setLogicalHeight(LayoutUnit size) {
310 if (style()->isHorizontalWritingMode()) 317 if (style()->isHorizontalWritingMode())
311 setHeight(size); 318 setHeight(size);
312 else 319 else
313 setWidth(size); 320 setWidth(size);
314 } 321 }
315 322
316 LayoutPoint location() const { return m_frameRect.location(); } 323 LayoutPoint location() const {
324 if (m_ngPhysicalBoxFragment) {
dgrogan 2017/02/16 03:16:00 location() is called during layout before NGFragme
325 DCHECK(m_frameRect.location() == m_ngPhysicalBoxFragment->Location());
326 }
327 return m_frameRect.location();
328 }
329
317 LayoutSize locationOffset() const { 330 LayoutSize locationOffset() const {
318 return LayoutSize(m_frameRect.x(), m_frameRect.y()); 331 return LayoutSize(m_frameRect.x(), m_frameRect.y());
319 } 332 }
320 LayoutSize size() const { return m_frameRect.size(); } 333 LayoutSize size() const {
334 if (m_ngPhysicalBoxFragment) {
335 DCHECK(m_frameRect.size() == m_ngPhysicalBoxFragment->LegacySize());
336 }
337 return m_frameRect.size();
338 }
321 IntSize pixelSnappedSize() const { return m_frameRect.pixelSnappedSize(); } 339 IntSize pixelSnappedSize() const { return m_frameRect.pixelSnappedSize(); }
322 340
323 void setLocation(const LayoutPoint& location) { 341 void setLocation(const LayoutPoint& location) {
324 if (location == m_frameRect.location()) 342 if (location == m_frameRect.location())
325 return; 343 return;
326 m_frameRect.setLocation(location); 344 m_frameRect.setLocation(location);
327 locationChanged(); 345 locationChanged();
328 } 346 }
329 347
330 // The ancestor box that this object's location and physicalLocation are 348 // The ancestor box that this object's location and physicalLocation are
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1634 breakValue == EBreakBetween::kLeft || 1652 breakValue == EBreakBetween::kLeft ||
1635 breakValue == EBreakBetween::kPage || 1653 breakValue == EBreakBetween::kPage ||
1636 breakValue == EBreakBetween::kRecto || 1654 breakValue == EBreakBetween::kRecto ||
1637 breakValue == EBreakBetween::kRight || 1655 breakValue == EBreakBetween::kRight ||
1638 breakValue == EBreakBetween::kVerso; 1656 breakValue == EBreakBetween::kVerso;
1639 } 1657 }
1640 1658
1641 } // namespace blink 1659 } // namespace blink
1642 1660
1643 #endif // LayoutBox_h 1661 #endif // LayoutBox_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698