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

Side by Side Diff: third_party/WebKit/Source/core/editing/VisibleUnits.cpp

Issue 2650953004: Check isText() when editing traverses layout tree for ::first-letter (Closed)
Patch Set: Created 3 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) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 2680 matching lines...) Expand 10 before | Expand all | Expand 10 after
2691 layoutTextFragment->start() + layoutTextFragment->fragmentLength()); 2691 layoutTextFragment->start() + layoutTextFragment->fragmentLength());
2692 return layoutTextFragment; 2692 return layoutTextFragment;
2693 } 2693 }
2694 if (layoutTextFragment->fragmentLength() && 2694 if (layoutTextFragment->fragmentLength() &&
2695 static_cast<unsigned>(offsetInNode) >= layoutTextFragment->start()) 2695 static_cast<unsigned>(offsetInNode) >= layoutTextFragment->start())
2696 return layoutObject; 2696 return layoutObject;
2697 LayoutObject* firstLetterLayoutObject = 2697 LayoutObject* firstLetterLayoutObject =
2698 layoutTextFragment->firstLetterPseudoElement()->layoutObject(); 2698 layoutTextFragment->firstLetterPseudoElement()->layoutObject();
2699 // TODO(yosin): We're not sure when |firstLetterLayoutObject| has 2699 // TODO(yosin): We're not sure when |firstLetterLayoutObject| has
2700 // multiple child layout object. 2700 // multiple child layout object.
2701 DCHECK_EQ(firstLetterLayoutObject->slowFirstChild(), 2701 LayoutObject* child = firstLetterLayoutObject->slowFirstChild();
2702 firstLetterLayoutObject->slowLastChild()); 2702 CHECK(child && child->isText());
2703 return firstLetterLayoutObject->slowFirstChild(); 2703 DCHECK_EQ(child, firstLetterLayoutObject->slowLastChild());
2704 return child;
2704 } 2705 }
2705 2706
2706 int caretMinOffset(const Node* node) { 2707 int caretMinOffset(const Node* node) {
2707 LayoutObject* layoutObject = associatedLayoutObjectOf(*node, 0); 2708 LayoutObject* layoutObject = associatedLayoutObjectOf(*node, 0);
2708 return layoutObject ? layoutObject->caretMinOffset() : 0; 2709 return layoutObject ? layoutObject->caretMinOffset() : 0;
2709 } 2710 }
2710 2711
2711 int caretMaxOffset(const Node* n) { 2712 int caretMaxOffset(const Node* n) {
2712 return EditingStrategy::caretMaxOffset(*n); 2713 return EditingStrategy::caretMaxOffset(*n);
2713 } 2714 }
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
3918 3919
3919 VisiblePositionInFlatTree previousPositionOf( 3920 VisiblePositionInFlatTree previousPositionOf(
3920 const VisiblePositionInFlatTree& visiblePosition, 3921 const VisiblePositionInFlatTree& visiblePosition,
3921 EditingBoundaryCrossingRule rule) { 3922 EditingBoundaryCrossingRule rule) {
3922 DCHECK(visiblePosition.isValid()) << visiblePosition; 3923 DCHECK(visiblePosition.isValid()) << visiblePosition;
3923 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>( 3924 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>(
3924 visiblePosition.deepEquivalent(), rule); 3925 visiblePosition.deepEquivalent(), rule);
3925 } 3926 }
3926 3927
3927 } // namespace blink 3928 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698