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

Side by Side Diff: Source/core/layout/LayoutObject.cpp

Issue 1303653002: Introduce LayoutObject::createPositionWithAffinity(int offset) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-19T12:20:28 Created 5 years, 4 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/layout/LayoutObject.h ('k') | Source/core/layout/LayoutReplaced.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 2576 matching lines...) Expand 10 before | Expand all | Expand 10 after
2587 void LayoutObject::removeShapeImageClient(ShapeValue* shapeValue) 2587 void LayoutObject::removeShapeImageClient(ShapeValue* shapeValue)
2588 { 2588 {
2589 if (!shapeValue) 2589 if (!shapeValue)
2590 return; 2590 return;
2591 if (StyleImage* shapeImage = shapeValue->image()) 2591 if (StyleImage* shapeImage = shapeValue->image())
2592 shapeImage->removeClient(this); 2592 shapeImage->removeClient(this);
2593 } 2593 }
2594 2594
2595 PositionWithAffinity LayoutObject::positionForPoint(const LayoutPoint&) 2595 PositionWithAffinity LayoutObject::positionForPoint(const LayoutPoint&)
2596 { 2596 {
2597 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM); 2597 return createPositionWithAffinity(caretMinOffset());
2598 } 2598 }
2599 2599
2600 void LayoutObject::updateDragState(bool dragOn) 2600 void LayoutObject::updateDragState(bool dragOn)
2601 { 2601 {
2602 bool valueChanged = (dragOn != isDragging()); 2602 bool valueChanged = (dragOn != isDragging());
2603 setIsDragging(dragOn); 2603 setIsDragging(dragOn);
2604 if (valueChanged && node()) { 2604 if (valueChanged && node()) {
2605 if (node()->isElementNode() && toElement(node())->childrenOrSiblingsAffe ctedByDrag()) 2605 if (node()->isElementNode() && toElement(node())->childrenOrSiblingsAffe ctedByDrag())
2606 node()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFor Tracing::create(StyleChangeReason::Drag)); 2606 node()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFor Tracing::create(StyleChangeReason::Drag));
2607 else if (style()->affectedByDrag()) 2607 else if (style()->affectedByDrag())
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
3029 return PositionWithAffinity(firstPositionInOrBeforeNode(node), DOWNS TREAM); 3029 return PositionWithAffinity(firstPositionInOrBeforeNode(node), DOWNS TREAM);
3030 3030
3031 // Repeat at the next level up. 3031 // Repeat at the next level up.
3032 child = parent; 3032 child = parent;
3033 } 3033 }
3034 3034
3035 // Everything was anonymous. Give up. 3035 // Everything was anonymous. Give up.
3036 return PositionWithAffinity(); 3036 return PositionWithAffinity();
3037 } 3037 }
3038 3038
3039 PositionWithAffinity LayoutObject::createPositionWithAffinity(int offset)
3040 {
3041 return createPositionWithAffinity(offset, DOWNSTREAM);
3042 }
3043
3039 PositionWithAffinity LayoutObject::createPositionWithAffinity(const Position& po sition) 3044 PositionWithAffinity LayoutObject::createPositionWithAffinity(const Position& po sition)
3040 { 3045 {
3041 if (position.isNotNull()) 3046 if (position.isNotNull())
3042 return PositionWithAffinity(position); 3047 return PositionWithAffinity(position);
3043 3048
3044 ASSERT(!node()); 3049 ASSERT(!node());
3045 return createPositionWithAffinity(0, DOWNSTREAM); 3050 return createPositionWithAffinity(0);
3046 } 3051 }
3047 3052
3048 CursorDirective LayoutObject::getCursor(const LayoutPoint&, Cursor&) const 3053 CursorDirective LayoutObject::getCursor(const LayoutPoint&, Cursor&) const
3049 { 3054 {
3050 return SetCursorBasedOnStyle; 3055 return SetCursorBasedOnStyle;
3051 } 3056 }
3052 3057
3053 bool LayoutObject::canUpdateSelectionOnRootLineBoxes() const 3058 bool LayoutObject::canUpdateSelectionOnRootLineBoxes() const
3054 { 3059 {
3055 if (needsLayout()) 3060 if (needsLayout())
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
3397 const blink::LayoutObject* root = object1; 3402 const blink::LayoutObject* root = object1;
3398 while (root->parent()) 3403 while (root->parent())
3399 root = root->parent(); 3404 root = root->parent();
3400 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0); 3405 root->showLayoutTreeAndMark(object1, "*", object2, "-", 0);
3401 } else { 3406 } else {
3402 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n"); 3407 fprintf(stderr, "Cannot showLayoutTree. Root is (nil)\n");
3403 } 3408 }
3404 } 3409 }
3405 3410
3406 #endif 3411 #endif
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutObject.h ('k') | Source/core/layout/LayoutReplaced.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698