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

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: Rebased patch against master 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
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/RenderText.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3246 matching lines...) Expand 10 before | Expand all | Expand 10 after
3257 3257
3258 PositionWithAffinity RenderObject::createPositionWithAffinity(const Position& po sition) 3258 PositionWithAffinity RenderObject::createPositionWithAffinity(const Position& po sition)
3259 { 3259 {
3260 if (position.isNotNull()) 3260 if (position.isNotNull())
3261 return PositionWithAffinity(position); 3261 return PositionWithAffinity(position);
3262 3262
3263 ASSERT(!node()); 3263 ASSERT(!node());
3264 return createPositionWithAffinity(0, DOWNSTREAM); 3264 return createPositionWithAffinity(0, DOWNSTREAM);
3265 } 3265 }
3266 3266
3267 ETextAlign RenderObject::simplifiedTextAlign(const ETextAlign& textAlign, const RootInlineBox* rootInlineBox) const
3268 {
3269 TextDirection direction;
3270 if (rootInlineBox && rootInlineBox->renderer()->style()->unicodeBidi() == Pl aintext)
3271 direction = rootInlineBox->direction();
3272 else
3273 direction = style()->direction();
3274
3275 bool isLTR = isLeftToRightDirection(direction);
3276
3277 switch (textAlign) {
3278 case LEFT:
3279 case WEBKIT_LEFT:
3280 return LEFT;
3281 case RIGHT:
3282 case WEBKIT_RIGHT:
3283 return RIGHT;
3284 case CENTER:
3285 case WEBKIT_CENTER:
3286 return CENTER;
3287 case TASTART:
3288 return isLTR ? LEFT : RIGHT;
3289 case TAEND:
3290 return isLTR ? RIGHT : LEFT;
3291 default:
3292 break;
3293 }
3294
3295 // The point of this method is to return only LEFT, RIGHT, CENTER or
3296 // JUSTIFY, so we can only return JUSTIFY if this point is reached.
3297 return JUSTIFY;
3298 }
3299
3267 CursorDirective RenderObject::getCursor(const LayoutPoint&, Cursor&) const 3300 CursorDirective RenderObject::getCursor(const LayoutPoint&, Cursor&) const
3268 { 3301 {
3269 return SetCursorBasedOnStyle; 3302 return SetCursorBasedOnStyle;
3270 } 3303 }
3271 3304
3272 bool RenderObject::canUpdateSelectionOnRootLineBoxes() 3305 bool RenderObject::canUpdateSelectionOnRootLineBoxes()
3273 { 3306 {
3274 if (needsLayout()) 3307 if (needsLayout())
3275 return false; 3308 return false;
3276 3309
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
3366 { 3399 {
3367 if (object1) { 3400 if (object1) {
3368 const WebCore::RenderObject* root = object1; 3401 const WebCore::RenderObject* root = object1;
3369 while (root->parent()) 3402 while (root->parent())
3370 root = root->parent(); 3403 root = root->parent();
3371 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); 3404 root->showRenderTreeAndMark(object1, "*", object2, "-", 0);
3372 } 3405 }
3373 } 3406 }
3374 3407
3375 #endif 3408 #endif
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderObject.h ('k') | Source/core/rendering/RenderText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698