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

Side by Side Diff: Source/core/layout/FloatingObjects.cpp

Issue 1164933006: Create LineLayout api (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 bool floatIsNewExtreme = updateOffsetIfNeeded(*floatingObject); 508 bool floatIsNewExtreme = updateOffsetIfNeeded(*floatingObject);
509 if (floatIsNewExtreme) 509 if (floatIsNewExtreme)
510 m_outermostFloat = floatingObject; 510 m_outermostFloat = floatingObject;
511 } 511 }
512 512
513 template<> 513 template<>
514 inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::u pdateOffsetIfNeeded(const FloatingObject& floatingObject) 514 inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::u pdateOffsetIfNeeded(const FloatingObject& floatingObject)
515 { 515 {
516 LayoutUnit logicalRight = m_layoutObject->logicalRightForFloat(&floatingObje ct); 516 LayoutUnit logicalRight = m_layoutObject->logicalRightForFloat(&floatingObje ct);
517 if (ShapeOutsideInfo* shapeOutside = floatingObject.layoutObject()->shapeOut sideInfo()) { 517 if (ShapeOutsideInfo* shapeOutside = floatingObject.layoutObject()->shapeOut sideInfo()) {
518 ShapeOutsideDeltas shapeDeltas = shapeOutside->computeDeltasForContainin gBlockLine(*m_layoutObject, floatingObject, m_lineTop, m_lineBottom - m_lineTop) ; 518 ShapeOutsideDeltas shapeDeltas = shapeOutside->computeDeltasForContainin gBlockLine(const_cast<LayoutBlockFlow*>(m_layoutObject), floatingObject, m_lineT op, m_lineBottom - m_lineTop);
519 if (!shapeDeltas.lineOverlapsShape()) 519 if (!shapeDeltas.lineOverlapsShape())
520 return false; 520 return false;
521 521
522 logicalRight += shapeDeltas.rightMarginBoxDelta(); 522 logicalRight += shapeDeltas.rightMarginBoxDelta();
523 } 523 }
524 if (logicalRight > m_offset) { 524 if (logicalRight > m_offset) {
525 m_offset = logicalRight; 525 m_offset = logicalRight;
526 return true; 526 return true;
527 } 527 }
528 528
529 return false; 529 return false;
530 } 530 }
531 531
532 template<> 532 template<>
533 inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>:: updateOffsetIfNeeded(const FloatingObject& floatingObject) 533 inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>:: updateOffsetIfNeeded(const FloatingObject& floatingObject)
534 { 534 {
535 LayoutUnit logicalLeft = m_layoutObject->logicalLeftForFloat(&floatingObject ); 535 LayoutUnit logicalLeft = m_layoutObject->logicalLeftForFloat(&floatingObject );
536 if (ShapeOutsideInfo* shapeOutside = floatingObject.layoutObject()->shapeOut sideInfo()) { 536 if (ShapeOutsideInfo* shapeOutside = floatingObject.layoutObject()->shapeOut sideInfo()) {
537 ShapeOutsideDeltas shapeDeltas = shapeOutside->computeDeltasForContainin gBlockLine(*m_layoutObject, floatingObject, m_lineTop, m_lineBottom - m_lineTop) ; 537 ShapeOutsideDeltas shapeDeltas = shapeOutside->computeDeltasForContainin gBlockLine(const_cast<LayoutBlockFlow*>(m_layoutObject), floatingObject, m_lineT op, m_lineBottom - m_lineTop);
538 if (!shapeDeltas.lineOverlapsShape()) 538 if (!shapeDeltas.lineOverlapsShape())
539 return false; 539 return false;
540 540
541 logicalLeft += shapeDeltas.leftMarginBoxDelta(); 541 logicalLeft += shapeDeltas.leftMarginBoxDelta();
542 } 542 }
543 if (logicalLeft < m_offset) { 543 if (logicalLeft < m_offset) {
544 m_offset = logicalLeft; 544 m_offset = logicalLeft;
545 return true; 545 return true;
546 } 546 }
547 547
548 return false; 548 return false;
549 } 549 }
550 550
551 #ifndef NDEBUG 551 #ifndef NDEBUG
552 // These helpers are only used by the PODIntervalTree for debugging purposes. 552 // These helpers are only used by the PODIntervalTree for debugging purposes.
553 String ValueToString<int>::string(const int value) 553 String ValueToString<int>::string(const int value)
554 { 554 {
555 return String::number(value); 555 return String::number(value);
556 } 556 }
557 557
558 String ValueToString<FloatingObject*>::string(const FloatingObject* floatingObje ct) 558 String ValueToString<FloatingObject*>::string(const FloatingObject* floatingObje ct)
559 { 559 {
560 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped MaxY()); 560 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped MaxY());
561 } 561 }
562 #endif 562 #endif
563 563
564 564
565 } // namespace blink 565 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698