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: Source/core/rendering/RenderBox.h

Issue 669803002: Optimize for horizontal writing mode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: w compile fix Created 6 years, 2 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 *
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 bool isDeprecatedFlexItem() const { return !isInline() && !isFloatingOrOutOf FlowPositioned() && parent() && parent()->isDeprecatedFlexibleBox(); } 530 bool isDeprecatedFlexItem() const { return !isInline() && !isFloatingOrOutOf FlowPositioned() && parent() && parent()->isDeprecatedFlexibleBox(); }
531 bool isFlexItemIncludingDeprecated() const { return !isInline() && !isFloati ngOrOutOfFlowPositioned() && parent() && parent()->isFlexibleBoxIncludingDepreca ted(); } 531 bool isFlexItemIncludingDeprecated() const { return !isInline() && !isFloati ngOrOutOfFlowPositioned() && parent() && parent()->isFlexibleBoxIncludingDepreca ted(); }
532 532
533 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositio nMode = PositionOnContainingLine) const override; 533 virtual LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositio nMode = PositionOnContainingLine) const override;
534 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode , LinePositionMode = PositionOnContainingLine) const override; 534 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode , LinePositionMode = PositionOnContainingLine) const override;
535 535
536 virtual LayoutUnit offsetLeft() const override; 536 virtual LayoutUnit offsetLeft() const override;
537 virtual LayoutUnit offsetTop() const override; 537 virtual LayoutUnit offsetTop() const override;
538 538
539 LayoutPoint flipForWritingModeForChild(const RenderBox* child, const LayoutP oint&) const; 539 LayoutPoint flipForWritingModeForChild(const RenderBox* child, const LayoutP oint&) const;
540 LayoutUnit flipForWritingMode(LayoutUnit position) const; // The offset is i n the block direction (y for horizontal writing modes, x for vertical writing mo des). 540 LayoutUnit flipForWritingMode(LayoutUnit position) const
541 LayoutPoint flipForWritingMode(const LayoutPoint&) const; 541 {
542 // The offset is in the block direction (y for horizontal writing modes, x for vertical writing modes).
543 if (!UNLIKELY(hasFlippedBlocksWritingMode()))
544 return position;
545 return logicalHeight() - position;
546 }
547 LayoutPoint flipForWritingMode(const LayoutPoint& position) const
548 {
549 if (!UNLIKELY(hasFlippedBlocksWritingMode()))
550 return position;
551 return isHorizontalWritingMode() ? LayoutPoint(position.x(), height() - position.y()) : LayoutPoint(width() - position.x(), position.y());
552 }
542 LayoutPoint flipForWritingModeIncludingColumns(const LayoutPoint&) const; 553 LayoutPoint flipForWritingModeIncludingColumns(const LayoutPoint&) const;
543 LayoutSize flipForWritingMode(const LayoutSize&) const; 554 LayoutSize flipForWritingMode(const LayoutSize& offset) const
544 void flipForWritingMode(LayoutRect&) const; 555 {
545 FloatPoint flipForWritingMode(const FloatPoint&) const; 556 if (!UNLIKELY(hasFlippedBlocksWritingMode()))
546 void flipForWritingMode(FloatRect&) const; 557 return offset;
558 return isHorizontalWritingMode() ? LayoutSize(offset.width(), height() - offset.height()) : LayoutSize(width() - offset.width(), offset.height());
559 }
560 void flipForWritingMode(LayoutRect& rect) const
561 {
562 if (!UNLIKELY(hasFlippedBlocksWritingMode()))
563 return;
564 if (isHorizontalWritingMode())
565 rect.setY(height() - rect.maxY());
566 else
567 rect.setX(width() - rect.maxX());
568 }
569 FloatPoint flipForWritingMode(const FloatPoint& position) const
570 {
571 if (!UNLIKELY(hasFlippedBlocksWritingMode()))
572 return position;
573 return isHorizontalWritingMode() ? FloatPoint(position.x(), height() - p osition.y()) : FloatPoint(width() - position.x(), position.y());
574 }
575 void flipForWritingMode(FloatRect& rect) const
576 {
577 if (!UNLIKELY(hasFlippedBlocksWritingMode()))
578 return;
579 if (isHorizontalWritingMode())
580 rect.setY(height() - rect.maxY());
581 else
582 rect.setX(width() - rect.maxX());
583 }
547 // These represent your location relative to your container as a physical of fset. 584 // These represent your location relative to your container as a physical of fset.
548 // In layout related methods you almost always want the logical location (e. g. x() and y()). 585 // In layout related methods you almost always want the logical location (e. g. x() and y()).
549 LayoutPoint topLeftLocation() const; 586 LayoutPoint topLeftLocation() const;
550 LayoutSize topLeftLocationOffset() const; 587 LayoutSize topLeftLocationOffset() const;
551 588
552 LayoutRect logicalVisualOverflowRectForPropagation(RenderStyle*) const; 589 LayoutRect logicalVisualOverflowRectForPropagation(RenderStyle*) const;
553 LayoutRect visualOverflowRectForPropagation(RenderStyle*) const; 590 LayoutRect visualOverflowRectForPropagation(RenderStyle*) const;
554 LayoutRect logicalLayoutOverflowRectForPropagation(RenderStyle*) const; 591 LayoutRect logicalLayoutOverflowRectForPropagation(RenderStyle*) const;
555 LayoutRect layoutOverflowRectForPropagation(RenderStyle*) const; 592 LayoutRect layoutOverflowRectForPropagation(RenderStyle*) const;
556 593
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 if (UNLIKELY(inlineBoxWrapper() != 0)) 804 if (UNLIKELY(inlineBoxWrapper() != 0))
768 deleteLineBoxWrapper(); 805 deleteLineBoxWrapper();
769 } 806 }
770 807
771 ensureRareData().m_inlineBoxWrapper = boxWrapper; 808 ensureRareData().m_inlineBoxWrapper = boxWrapper;
772 } 809 }
773 810
774 } // namespace blink 811 } // namespace blink
775 812
776 #endif // RenderBox_h 813 #endif // RenderBox_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698