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

Side by Side Diff: Source/core/rendering/RenderText.cpp

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 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org) 3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) 6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 return createPositionWithAffinityForBox(box, box->caretLeftmostOffset(), sho uldAffinityBeDownstream); 596 return createPositionWithAffinityForBox(box, box->caretLeftmostOffset(), sho uldAffinityBeDownstream);
597 } 597 }
598 598
599 PositionWithAffinity RenderText::positionForPoint(const LayoutPoint& point) 599 PositionWithAffinity RenderText::positionForPoint(const LayoutPoint& point)
600 { 600 {
601 if (!firstTextBox() || textLength() == 0) 601 if (!firstTextBox() || textLength() == 0)
602 return createPositionWithAffinity(0, DOWNSTREAM); 602 return createPositionWithAffinity(0, DOWNSTREAM);
603 603
604 LayoutUnit pointLineDirection = firstTextBox()->isHorizontal() ? point.x() : point.y(); 604 LayoutUnit pointLineDirection = firstTextBox()->isHorizontal() ? point.x() : point.y();
605 LayoutUnit pointBlockDirection = firstTextBox()->isHorizontal() ? point.y() : point.x(); 605 LayoutUnit pointBlockDirection = firstTextBox()->isHorizontal() ? point.y() : point.x();
606 bool blocksAreFlipped = style()->isFlippedBlocksWritingMode(); 606 bool blocksAreFlipped = style()->slowIsFlippedBlocksWritingMode();
607 607
608 InlineTextBox* lastBox = 0; 608 InlineTextBox* lastBox = 0;
609 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 609 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
610 if (box->isLineBreak() && !box->prevLeafChild() && box->nextLeafChild() && !box->nextLeafChild()->isLineBreak()) 610 if (box->isLineBreak() && !box->prevLeafChild() && box->nextLeafChild() && !box->nextLeafChild()->isLineBreak())
611 box = box->nextTextBox(); 611 box = box->nextTextBox();
612 612
613 RootInlineBox& rootBox = box->root(); 613 RootInlineBox& rootBox = box->root();
614 LayoutUnit top = std::min(rootBox.selectionTop(), rootBox.lineTop()); 614 LayoutUnit top = std::min(rootBox.selectionTop(), rootBox.lineTop());
615 if (pointBlockDirection > top || (!blocksAreFlipped && pointBlockDirecti on == top)) { 615 if (pointBlockDirection > top || (!blocksAreFlipped && pointBlockDirecti on == top)) {
616 LayoutUnit bottom = rootBox.selectionBottom(); 616 LayoutUnit bottom = rootBox.selectionBottom();
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 } 1863 }
1864 secureTextTimer->restartWithNewText(lastTypedCharacterOffset); 1864 secureTextTimer->restartWithNewText(lastTypedCharacterOffset);
1865 } 1865 }
1866 1866
1867 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox() 1867 PassRefPtr<AbstractInlineTextBox> RenderText::firstAbstractInlineTextBox()
1868 { 1868 {
1869 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox); 1869 return AbstractInlineTextBox::getOrCreate(this, m_firstTextBox);
1870 } 1870 }
1871 1871
1872 } // namespace blink 1872 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698