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

Side by Side Diff: sky/engine/core/rendering/RootInlineBox.cpp

Issue 688213002: First pass at removing dead vertical writing mode code. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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) 2003, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 // |aaa|bbb|AAA| 313 // |aaa|bbb|AAA|
314 // ___ _ 314 // ___ _
315 // We can see that the |bbb| run is not part of the selection while the runs around it are. 315 // We can see that the |bbb| run is not part of the selection while the runs around it are.
316 if (firstBox && firstBox != lastBox) { 316 if (firstBox && firstBox != lastBox) {
317 // Now fill in any gaps on the line that occurred between two selected e lements. 317 // Now fill in any gaps on the line that occurred between two selected e lements.
318 LayoutUnit lastLogicalLeft = firstBox->logicalRight(); 318 LayoutUnit lastLogicalLeft = firstBox->logicalRight();
319 bool isPreviousBoxSelected = firstBox->selectionState() != RenderObject: :SelectionNone; 319 bool isPreviousBoxSelected = firstBox->selectionState() != RenderObject: :SelectionNone;
320 for (InlineBox* box = firstBox->nextLeafChild(); box; box = box->nextLea fChild()) { 320 for (InlineBox* box = firstBox->nextLeafChild(); box; box = box->nextLea fChild()) {
321 if (box->selectionState() != RenderObject::SelectionNone) { 321 if (box->selectionState() != RenderObject::SelectionNone) {
322 LayoutRect logicalRect(lastLogicalLeft, selTop, box->logicalLeft () - lastLogicalLeft, selHeight); 322 LayoutRect logicalRect(lastLogicalLeft, selTop, box->logicalLeft () - lastLogicalLeft, selHeight);
323 logicalRect.move(renderer().isHorizontalWritingMode() ? offsetFr omRootBlock : LayoutSize(offsetFromRootBlock.height(), offsetFromRootBlock.width ())); 323 logicalRect.move(offsetFromRootBlock);
324 LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBl ockPhysicalPosition, logicalRect); 324 LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBl ockPhysicalPosition, logicalRect);
325 if (isPreviousBoxSelected && gapRect.width() > 0 && gapRect.heig ht() > 0) { 325 if (isPreviousBoxSelected && gapRect.width() > 0 && gapRect.heig ht() > 0) {
326 if (paintInfo) 326 if (paintInfo)
327 paintInfo->context->fillRect(gapRect, box->parent()->ren derer().selectionBackgroundColor()); 327 paintInfo->context->fillRect(gapRect, box->parent()->ren derer().selectionBackgroundColor());
328 // VisibleSelection may be non-contiguous, see comment above . 328 // VisibleSelection may be non-contiguous, see comment above .
329 result.uniteCenter(gapRect); 329 result.uniteCenter(gapRect);
330 } 330 }
331 lastLogicalLeft = box->logicalRight(); 331 lastLogicalLeft = box->logicalRight();
332 } 332 }
333 if (box == lastBox) 333 if (box == lastBox)
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 return toRenderBlockFlow(renderer()); 470 return toRenderBlockFlow(renderer());
471 } 471 }
472 472
473 static bool isEditableLeaf(InlineBox* leaf) 473 static bool isEditableLeaf(InlineBox* leaf)
474 { 474 {
475 return leaf && leaf->renderer().node() && leaf->renderer().node()->hasEditab leStyle(); 475 return leaf && leaf->renderer().node() && leaf->renderer().node()->hasEditab leStyle();
476 } 476 }
477 477
478 InlineBox* RootInlineBox::closestLeafChildForPoint(const IntPoint& pointInConten ts, bool onlyEditableLeaves) 478 InlineBox* RootInlineBox::closestLeafChildForPoint(const IntPoint& pointInConten ts, bool onlyEditableLeaves)
479 { 479 {
480 return closestLeafChildForLogicalLeftPosition(block().isHorizontalWritingMod e() ? pointInContents.x() : pointInContents.y(), onlyEditableLeaves); 480 return closestLeafChildForLogicalLeftPosition(pointInContents.x(), onlyEdita bleLeaves);
481 } 481 }
482 482
483 InlineBox* RootInlineBox::closestLeafChildForLogicalLeftPosition(int leftPositio n, bool onlyEditableLeaves) 483 InlineBox* RootInlineBox::closestLeafChildForLogicalLeftPosition(int leftPositio n, bool onlyEditableLeaves)
484 { 484 {
485 InlineBox* firstLeaf = firstLeafChild(); 485 InlineBox* firstLeaf = firstLeafChild();
486 InlineBox* lastLeaf = lastLeafChild(); 486 InlineBox* lastLeaf = lastLeafChild();
487 487
488 if (firstLeaf != lastLeaf) { 488 if (firstLeaf != lastLeaf) {
489 if (firstLeaf->isLineBreak()) 489 if (firstLeaf->isLineBreak())
490 firstLeaf = firstLeaf->nextLeafChildIgnoringLineBreak(); 490 firstLeaf = firstLeaf->nextLeafChildIgnoringLineBreak();
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 729
730 RenderObject* parent = renderer->parent(); 730 RenderObject* parent = renderer->parent();
731 if (parent->isRenderInline() && parent->style()->verticalAlign() != TOP && p arent->style()->verticalAlign() != BOTTOM) 731 if (parent->isRenderInline() && parent->style()->verticalAlign() != TOP && p arent->style()->verticalAlign() != BOTTOM)
732 verticalPosition = box->parent()->logicalTop(); 732 verticalPosition = box->parent()->logicalTop();
733 733
734 if (verticalAlign != BASELINE) { 734 if (verticalAlign != BASELINE) {
735 const Font& font = parent->style(firstLine)->font(); 735 const Font& font = parent->style(firstLine)->font();
736 const FontMetrics& fontMetrics = font.fontMetrics(); 736 const FontMetrics& fontMetrics = font.fontMetrics();
737 int fontSize = font.fontDescription().computedPixelSize(); 737 int fontSize = font.fontDescription().computedPixelSize();
738 738
739 LineDirectionMode lineDirection = parent->isHorizontalWritingMode() ? Ho rizontalLine : VerticalLine; 739 LineDirectionMode lineDirection = HorizontalLine;
740 740
741 if (verticalAlign == SUB) 741 if (verticalAlign == SUB)
742 verticalPosition += fontSize / 5 + 1; 742 verticalPosition += fontSize / 5 + 1;
743 else if (verticalAlign == SUPER) 743 else if (verticalAlign == SUPER)
744 verticalPosition -= fontSize / 3 + 1; 744 verticalPosition -= fontSize / 3 + 1;
745 else if (verticalAlign == TEXT_TOP) 745 else if (verticalAlign == TEXT_TOP)
746 verticalPosition += renderer->baselinePosition(baselineType(), first Line, lineDirection) - fontMetrics.ascent(baselineType()); 746 verticalPosition += renderer->baselinePosition(baselineType(), first Line, lineDirection) - fontMetrics.ascent(baselineType());
747 else if (verticalAlign == MIDDLE) 747 else if (verticalAlign == MIDDLE)
748 verticalPosition = (verticalPosition - static_cast<LayoutUnit>(fontM etrics.xHeight() / 2) - renderer->lineHeight(firstLine, lineDirection) / 2 + ren derer->baselinePosition(baselineType(), firstLine, lineDirection)).round(); 748 verticalPosition = (verticalPosition - static_cast<LayoutUnit>(fontM etrics.xHeight() / 2) - renderer->lineHeight(firstLine, lineDirection) / 2 + ren derer->baselinePosition(baselineType(), firstLine, lineDirection)).round();
749 else if (verticalAlign == TEXT_BOTTOM) { 749 else if (verticalAlign == TEXT_BOTTOM) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 } 858 }
859 859
860 #ifndef NDEBUG 860 #ifndef NDEBUG
861 const char* RootInlineBox::boxName() const 861 const char* RootInlineBox::boxName() const
862 { 862 {
863 return "RootInlineBox"; 863 return "RootInlineBox";
864 } 864 }
865 #endif 865 #endif
866 866
867 } // namespace blink 867 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderView.cpp ('k') | sky/engine/core/rendering/line/BreakingContextInlineHeaders.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698