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

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

Issue 1815183002: [Layout API] Add LayoutItem.isBR() and use from editing/VisibleUnits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | third_party/WebKit/Source/core/layout/api/LayoutItem.h » ('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) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "core/frame/Settings.h" 48 #include "core/frame/Settings.h"
49 #include "core/html/HTMLBRElement.h" 49 #include "core/html/HTMLBRElement.h"
50 #include "core/html/HTMLTextFormControlElement.h" 50 #include "core/html/HTMLTextFormControlElement.h"
51 #include "core/layout/HitTestRequest.h" 51 #include "core/layout/HitTestRequest.h"
52 #include "core/layout/HitTestResult.h" 52 #include "core/layout/HitTestResult.h"
53 #include "core/layout/LayoutBlockFlow.h" 53 #include "core/layout/LayoutBlockFlow.h"
54 #include "core/layout/LayoutInline.h" 54 #include "core/layout/LayoutInline.h"
55 #include "core/layout/LayoutObject.h" 55 #include "core/layout/LayoutObject.h"
56 #include "core/layout/LayoutTextFragment.h" 56 #include "core/layout/LayoutTextFragment.h"
57 #include "core/layout/LayoutView.h" 57 #include "core/layout/LayoutView.h"
58 #include "core/layout/api/LayoutItem.h"
58 #include "core/layout/api/LineLayoutAPIShim.h" 59 #include "core/layout/api/LineLayoutAPIShim.h"
59 #include "core/layout/api/LineLayoutItem.h" 60 #include "core/layout/api/LineLayoutItem.h"
60 #include "core/layout/line/InlineIterator.h" 61 #include "core/layout/line/InlineIterator.h"
61 #include "core/layout/line/InlineTextBox.h" 62 #include "core/layout/line/InlineTextBox.h"
62 #include "core/paint/PaintLayer.h" 63 #include "core/paint/PaintLayer.h"
63 #include "platform/Logging.h" 64 #include "platform/Logging.h"
64 #include "platform/RuntimeEnabledFeatures.h" 65 #include "platform/RuntimeEnabledFeatures.h"
65 #include "platform/heap/Handle.h" 66 #include "platform/heap/Handle.h"
66 #include "platform/text/TextBoundaries.h" 67 #include "platform/text/TextBoundaries.h"
67 68
(...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1503 while (n) { 1504 while (n) {
1504 if (boundaryCrossingRule == CannotCrossEditingBoundary && !nodeIsUserSel ectAll(n) && n->hasEditableStyle() != startNodeIsEditable) 1505 if (boundaryCrossingRule == CannotCrossEditingBoundary && !nodeIsUserSel ectAll(n) && n->hasEditableStyle() != startNodeIsEditable)
1505 break; 1506 break;
1506 if (boundaryCrossingRule == CanSkipOverEditingBoundary) { 1507 if (boundaryCrossingRule == CanSkipOverEditingBoundary) {
1507 while (n && n->hasEditableStyle() != startNodeIsEditable) 1508 while (n && n->hasEditableStyle() != startNodeIsEditable)
1508 n = Strategy::previousPostOrder(*n, startBlock); 1509 n = Strategy::previousPostOrder(*n, startBlock);
1509 if (!n || !n->isDescendantOf(highestRoot)) 1510 if (!n || !n->isDescendantOf(highestRoot))
1510 break; 1511 break;
1511 } 1512 }
1512 LayoutObject* r = n->layoutObject(); 1513 LayoutObject* r = n->layoutObject();
1513 if (!r) { 1514 LayoutItem ri = LayoutItem(r);
1515 if (ri.isNull()) {
1514 n = Strategy::previousPostOrder(*n, startBlock); 1516 n = Strategy::previousPostOrder(*n, startBlock);
1515 continue; 1517 continue;
1516 } 1518 }
1517 const ComputedStyle& style = r->styleRef(); 1519 const ComputedStyle& style = ri.styleRef();
1518 if (style.visibility() != VISIBLE) { 1520 if (style.visibility() != VISIBLE) {
1519 n = Strategy::previousPostOrder(*n, startBlock); 1521 n = Strategy::previousPostOrder(*n, startBlock);
1520 continue; 1522 continue;
1521 } 1523 }
1522 1524
1523 if (r->isBR() || isEnclosingBlock(n)) 1525 if (ri.isBR() || isEnclosingBlock(n))
1524 break; 1526 break;
1525 1527
1526 if (r->isText() && toLayoutText(r)->resolvedTextLength()) { 1528 if (ri.isText() && toLayoutText(r)->resolvedTextLength()) {
1527 ASSERT_WITH_SECURITY_IMPLICATION(n->isTextNode()); 1529 ASSERT_WITH_SECURITY_IMPLICATION(n->isTextNode());
1528 type = PositionAnchorType::OffsetInAnchor; 1530 type = PositionAnchorType::OffsetInAnchor;
1529 if (style.preserveNewline()) { 1531 if (style.preserveNewline()) {
1530 LayoutText* text = toLayoutText(r); 1532 LayoutText* text = toLayoutText(r);
1531 int i = text->textLength(); 1533 int i = text->textLength();
1532 int o = offset; 1534 int o = offset;
1533 if (n == startNode && o < i) 1535 if (n == startNode && o < i)
1534 i = max(0, o); 1536 i = max(0, o);
1535 while (--i >= 0) { 1537 while (--i >= 0) {
1536 if ((*text)[i] == '\n') 1538 if ((*text)[i] == '\n')
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after
3252 { 3254 {
3253 return previousPositionOfAlgorithm<EditingStrategy>(visiblePosition, rule); 3255 return previousPositionOfAlgorithm<EditingStrategy>(visiblePosition, rule);
3254 } 3256 }
3255 3257
3256 VisiblePositionInFlatTree previousPositionOf(const VisiblePositionInFlatTree& vi siblePosition, EditingBoundaryCrossingRule rule) 3258 VisiblePositionInFlatTree previousPositionOf(const VisiblePositionInFlatTree& vi siblePosition, EditingBoundaryCrossingRule rule)
3257 { 3259 {
3258 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>(visiblePositio n, rule); 3260 return previousPositionOfAlgorithm<EditingInFlatTreeStrategy>(visiblePositio n, rule);
3259 } 3261 }
3260 3262
3261 } // namespace blink 3263 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/api/LayoutItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698