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

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: 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
pdr. 2014/10/21 22:11:26 Is it possible to separate the inlining of these s
eae 2014/10/21 22:21:46 Inlining adds about another 2-3% (see the second a
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(document().hasVerticalWritingMode()))
544 return position;
545 if (!style()->isFlippedBlocksWritingMode())
546 return position;
547 return logicalHeight() - position;
548 }
549 LayoutPoint flipForWritingMode(const LayoutPoint& position) const
550 {
551 if (!UNLIKELY(document().hasVerticalWritingMode()))
552 return position;
553 if (!style()->isFlippedBlocksWritingMode())
554 return position;
555 return isHorizontalWritingMode() ? LayoutPoint(position.x(), height() - position.y()) : LayoutPoint(width() - position.x(), position.y());
556 }
542 LayoutPoint flipForWritingModeIncludingColumns(const LayoutPoint&) const; 557 LayoutPoint flipForWritingModeIncludingColumns(const LayoutPoint&) const;
543 LayoutSize flipForWritingMode(const LayoutSize&) const; 558 LayoutSize flipForWritingMode(const LayoutSize& offset) const
544 void flipForWritingMode(LayoutRect&) const; 559 {
545 FloatPoint flipForWritingMode(const FloatPoint&) const; 560 if (!UNLIKELY(document().hasVerticalWritingMode()))
546 void flipForWritingMode(FloatRect&) const; 561 return offset;
562 if (!style()->isFlippedBlocksWritingMode())
563 return offset;
564 return isHorizontalWritingMode() ? LayoutSize(offset.width(), height() - offset.height()) : LayoutSize(width() - offset.width(), offset.height());
565 }
566 void flipForWritingMode(LayoutRect& rect) const
567 {
568 if (!UNLIKELY(document().hasVerticalWritingMode())
569 || !style()->isFlippedBlocksWritingMode()) {
570 return;
571 }
572 if (isHorizontalWritingMode())
573 rect.setY(height() - rect.maxY());
574 else
575 rect.setX(width() - rect.maxX());
576 }
577 FloatPoint flipForWritingMode(const FloatPoint& position) const
578 {
579 if (!UNLIKELY(document().hasVerticalWritingMode()))
580 return position;
581 if (!style()->isFlippedBlocksWritingMode())
582 return position;
583 return isHorizontalWritingMode() ? FloatPoint(position.x(), height() - p osition.y()) : FloatPoint(width() - position.x(), position.y());
584 }
585 void flipForWritingMode(FloatRect& rect) const
586 {
587 if (!UNLIKELY(document().hasVerticalWritingMode()))
588 return;
589 if (!style()->isFlippedBlocksWritingMode())
590 return;
591
592 if (isHorizontalWritingMode())
593 rect.setY(height() - rect.maxY());
594 else
595 rect.setX(width() - rect.maxX());
596 }
547 // These represent your location relative to your container as a physical of fset. 597 // 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()). 598 // In layout related methods you almost always want the logical location (e. g. x() and y()).
549 LayoutPoint topLeftLocation() const; 599 LayoutPoint topLeftLocation() const;
550 LayoutSize topLeftLocationOffset() const; 600 LayoutSize topLeftLocationOffset() const;
551 601
552 LayoutRect logicalVisualOverflowRectForPropagation(RenderStyle*) const; 602 LayoutRect logicalVisualOverflowRectForPropagation(RenderStyle*) const;
553 LayoutRect visualOverflowRectForPropagation(RenderStyle*) const; 603 LayoutRect visualOverflowRectForPropagation(RenderStyle*) const;
554 LayoutRect logicalLayoutOverflowRectForPropagation(RenderStyle*) const; 604 LayoutRect logicalLayoutOverflowRectForPropagation(RenderStyle*) const;
555 LayoutRect layoutOverflowRectForPropagation(RenderStyle*) const; 605 LayoutRect layoutOverflowRectForPropagation(RenderStyle*) const;
556 606
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 if (UNLIKELY(inlineBoxWrapper() != 0)) 817 if (UNLIKELY(inlineBoxWrapper() != 0))
768 deleteLineBoxWrapper(); 818 deleteLineBoxWrapper();
769 } 819 }
770 820
771 ensureRareData().m_inlineBoxWrapper = boxWrapper; 821 ensureRareData().m_inlineBoxWrapper = boxWrapper;
772 } 822 }
773 823
774 } // namespace blink 824 } // namespace blink
775 825
776 #endif // RenderBox_h 826 #endif // RenderBox_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698