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

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

Issue 150403003: Consider text alignment and direction when computing the left offset for horizontal writing modes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@issue313593
Patch Set: Created 6 years, 10 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 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2009 Google Inc. All rights reserved. 7 * Copyright (C) 2009 Google Inc. All rights reserved.
8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 3285 matching lines...) Expand 10 before | Expand all | Expand 10 after
3296 3296
3297 PositionWithAffinity RenderObject::createPositionWithAffinity(const Position& po sition) 3297 PositionWithAffinity RenderObject::createPositionWithAffinity(const Position& po sition)
3298 { 3298 {
3299 if (position.isNotNull()) 3299 if (position.isNotNull())
3300 return PositionWithAffinity(position); 3300 return PositionWithAffinity(position);
3301 3301
3302 ASSERT(!node()); 3302 ASSERT(!node());
3303 return createPositionWithAffinity(0, DOWNSTREAM); 3303 return createPositionWithAffinity(0, DOWNSTREAM);
3304 } 3304 }
3305 3305
3306 ETextAlign RenderObject::simplifiedTextAlign(const ETextAlign& textAlign, const RootInlineBox* rootInlineBox) const
3307 {
3308 TextDirection direction;
3309 if (rootInlineBox && rootInlineBox->renderer()->style()->unicodeBidi() == Pl aintext)
3310 direction = rootInlineBox->direction();
3311 else
3312 direction = style()->direction();
3313
3314 bool isLTR = isLeftToRightDirection(direction);
3315
3316 switch (textAlign) {
3317 case LEFT:
3318 case WEBKIT_LEFT:
3319 return LEFT;
3320 case RIGHT:
3321 case WEBKIT_RIGHT:
3322 return RIGHT;
3323 case CENTER:
3324 case WEBKIT_CENTER:
3325 return CENTER;
3326 case TASTART:
3327 return isLTR ? LEFT : RIGHT;
3328 case TAEND:
3329 return isLTR ? RIGHT : LEFT;
3330 default:
3331 break;
3332 }
3333
3334 // Return JUSTIFY if reached.
3335 return textAlign;
eae 2014/01/30 18:38:27 Why not change this to "return JUSTIFY" to clarify
mario.prada 2014/02/04 14:30:13 Ok :)
3336 }
3337
3306 CursorDirective RenderObject::getCursor(const LayoutPoint&, Cursor&) const 3338 CursorDirective RenderObject::getCursor(const LayoutPoint&, Cursor&) const
3307 { 3339 {
3308 return SetCursorBasedOnStyle; 3340 return SetCursorBasedOnStyle;
3309 } 3341 }
3310 3342
3311 bool RenderObject::canUpdateSelectionOnRootLineBoxes() 3343 bool RenderObject::canUpdateSelectionOnRootLineBoxes()
3312 { 3344 {
3313 if (needsLayout()) 3345 if (needsLayout())
3314 return false; 3346 return false;
3315 3347
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
3416 { 3448 {
3417 if (object1) { 3449 if (object1) {
3418 const WebCore::RenderObject* root = object1; 3450 const WebCore::RenderObject* root = object1;
3419 while (root->parent()) 3451 while (root->parent())
3420 root = root->parent(); 3452 root = root->parent();
3421 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3453 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3422 } 3454 }
3423 } 3455 }
3424 3456
3425 #endif 3457 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698