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

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

Issue 1653673002: Even more explicit LayoutUnit conversion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@moarConstructors
Patch Set: address comments Created 4 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) 2000 Simon Hausmann <hausmann@kde.org> 3 * (C) 2000 Simon Hausmann <hausmann@kde.org>
4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 return toHTMLFrameSetElement(node()); 59 return toHTMLFrameSetElement(node());
60 } 60 }
61 61
62 void LayoutFrameSet::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO ffset) const 62 void LayoutFrameSet::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO ffset) const
63 { 63 {
64 FrameSetPainter(*this).paint(paintInfo, paintOffset); 64 FrameSetPainter(*this).paint(paintInfo, paintOffset);
65 } 65 }
66 66
67 void LayoutFrameSet::computePreferredLogicalWidths() 67 void LayoutFrameSet::computePreferredLogicalWidths()
68 { 68 {
69 m_minPreferredLogicalWidth = 0; 69 m_minPreferredLogicalWidth = LayoutUnit();
70 m_maxPreferredLogicalWidth = 0; 70 m_maxPreferredLogicalWidth = LayoutUnit();
71 clearPreferredLogicalWidthsDirty(); 71 clearPreferredLogicalWidthsDirty();
72 } 72 }
73 73
74 void LayoutFrameSet::GridAxis::resize(int size) 74 void LayoutFrameSet::GridAxis::resize(int size)
75 { 75 {
76 m_sizes.resize(size); 76 m_sizes.resize(size);
77 m_deltas.resize(size); 77 m_deltas.resize(size);
78 m_deltas.fill(0); 78 m_deltas.fill(0);
79 79
80 // To track edges for resizability and borders, we need to be (size + 1). Th is is because a parent frameset 80 // To track edges for resizability and borders, we need to be (size + 1). Th is is because a parent frameset
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 } 353 }
354 354
355 return result; 355 return result;
356 } 356 }
357 357
358 void LayoutFrameSet::layout() 358 void LayoutFrameSet::layout()
359 { 359 {
360 ASSERT(needsLayout()); 360 ASSERT(needsLayout());
361 361
362 if (!parent()->isFrameSet() && !document().printing()) { 362 if (!parent()->isFrameSet() && !document().printing()) {
363 setWidth(view()->viewWidth()); 363 setWidth(LayoutUnit(view()->viewWidth()));
364 setHeight(view()->viewHeight()); 364 setHeight(LayoutUnit(view()->viewHeight()));
365 } 365 }
366 366
367 unsigned cols = frameSet()->totalCols(); 367 unsigned cols = frameSet()->totalCols();
368 unsigned rows = frameSet()->totalRows(); 368 unsigned rows = frameSet()->totalRows();
369 369
370 if (m_rows.m_sizes.size() != rows || m_cols.m_sizes.size() != cols) { 370 if (m_rows.m_sizes.size() != rows || m_cols.m_sizes.size() != cols) {
371 m_rows.resize(rows); 371 m_rows.resize(rows);
372 m_cols.resize(cols); 372 m_cols.resize(cols);
373 } 373 }
374 374
375 LayoutUnit borderThickness = frameSet()->border(); 375 LayoutUnit borderThickness(frameSet()->border());
376 layOutAxis(m_rows, frameSet()->rowLengths(), size().height() - (rows - 1) * borderThickness); 376 layOutAxis(m_rows, frameSet()->rowLengths(), size().height() - (rows - 1) * borderThickness);
377 layOutAxis(m_cols, frameSet()->colLengths(), size().width() - (cols - 1) * b orderThickness); 377 layOutAxis(m_cols, frameSet()->colLengths(), size().width() - (cols - 1) * b orderThickness);
378 378
379 positionFrames(); 379 positionFrames();
380 380
381 LayoutBox::layout(); 381 LayoutBox::layout();
382 382
383 computeEdgeInfo(); 383 computeEdgeInfo();
384 384
385 updateLayerTransformAfterLayout(); 385 updateLayerTransformAfterLayout();
386 386
387 clearNeedsLayout(); 387 clearNeedsLayout();
388 } 388 }
389 389
390 static void clearNeedsLayoutOnHiddenFrames(LayoutBox* frame) 390 static void clearNeedsLayoutOnHiddenFrames(LayoutBox* frame)
391 { 391 {
392 for (; frame; frame = frame->nextSiblingBox()) { 392 for (; frame; frame = frame->nextSiblingBox()) {
393 frame->setWidth(0); 393 frame->setWidth(LayoutUnit());
394 frame->setHeight(0); 394 frame->setHeight(LayoutUnit());
395 frame->clearNeedsLayout(); 395 frame->clearNeedsLayout();
396 clearNeedsLayoutOnHiddenFrames(frame->firstChildBox()); 396 clearNeedsLayoutOnHiddenFrames(frame->firstChildBox());
397 } 397 }
398 } 398 }
399 399
400 void LayoutFrameSet::positionFrames() 400 void LayoutFrameSet::positionFrames()
401 { 401 {
402 LayoutBox* child = firstChildBox(); 402 LayoutBox* child = firstChildBox();
403 if (!child) 403 if (!child)
404 return; 404 return;
405 405
406 int rows = frameSet()->totalRows(); 406 int rows = frameSet()->totalRows();
407 int cols = frameSet()->totalCols(); 407 int cols = frameSet()->totalCols();
408 408
409 int borderThickness = frameSet()->border(); 409 int borderThickness = frameSet()->border();
410 LayoutSize size; 410 LayoutSize size;
411 LayoutPoint position; 411 LayoutPoint position;
412 for (int r = 0; r < rows; r++) { 412 for (int r = 0; r < rows; r++) {
413 position.setX(0); 413 position.setX(LayoutUnit());
414 size.setHeight(m_rows.m_sizes[r]); 414 size.setHeight(LayoutUnit(m_rows.m_sizes[r]));
415 for (int c = 0; c < cols; c++) { 415 for (int c = 0; c < cols; c++) {
416 child->setLocation(position); 416 child->setLocation(position);
417 size.setWidth(m_cols.m_sizes[c]); 417 size.setWidth(LayoutUnit(m_cols.m_sizes[c]));
418 418
419 // has to be resized and itself resize its contents 419 // has to be resized and itself resize its contents
420 if (size != child->size()) { 420 if (size != child->size()) {
421 child->setSize(size); 421 child->setSize(size);
422 child->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidation Reason::SizeChanged); 422 child->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidation Reason::SizeChanged);
423 child->layout(); 423 child->layout();
424 } 424 }
425 425
426 position.setX(position.x() + size.width() + borderThickness); 426 position.setX(position.x() + size.width() + borderThickness);
427 427
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 return SetCursor; 566 return SetCursor;
567 } 567 }
568 if (canResizeColumn(roundedPoint)) { 568 if (canResizeColumn(roundedPoint)) {
569 cursor = columnResizeCursor(); 569 cursor = columnResizeCursor();
570 return SetCursor; 570 return SetCursor;
571 } 571 }
572 return LayoutBox::getCursor(point, cursor); 572 return LayoutBox::getCursor(point, cursor);
573 } 573 }
574 574
575 } // namespace blink 575 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutGrid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698