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

Unified Diff: Source/core/editing/VisibleUnits.cpp

Issue 1288873009: Move hasRenderedNonAnonymousDescendantsWithHeight() to VisibleUnits.cpp from Position.cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-20T18:59:16 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/editing/VisibleUnits.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/VisibleUnits.cpp
diff --git a/Source/core/editing/VisibleUnits.cpp b/Source/core/editing/VisibleUnits.cpp
index 5b5ffa9b7f9ba58ca66e4e57fa0a9fe13cc2715b..88b7d3ec67f5fd222c3ad2ac90b1032d6e3ee68b 100644
--- a/Source/core/editing/VisibleUnits.cpp
+++ b/Source/core/editing/VisibleUnits.cpp
@@ -48,8 +48,10 @@
#include "core/layout/HitTestRequest.h"
#include "core/layout/HitTestResult.h"
#include "core/layout/LayoutBlockFlow.h"
+#include "core/layout/LayoutInline.h"
#include "core/layout/LayoutObject.h"
#include "core/layout/LayoutView.h"
+#include "core/layout/line/InlineIterator.h"
#include "core/layout/line/InlineTextBox.h"
#include "core/paint/DeprecatedPaintLayer.h"
#include "platform/Logging.h"
@@ -1450,6 +1452,25 @@ LayoutRect localCaretRectOfPosition(const PositionWithAffinity& position, Layout
return layoutObject->localCaretRect(boxPosition.inlineBox, boxPosition.offsetInBox);
}
+static int boundingBoxLogicalHeight(LayoutObject *o, const IntRect &rect)
+{
+ return o->style()->isHorizontalWritingMode() ? rect.height() : rect.width();
+}
+
+bool hasRenderedNonAnonymousDescendantsWithHeight(LayoutObject* layoutObject)
+{
+ LayoutObject* stop = layoutObject->nextInPreOrderAfterChildren();
+ for (LayoutObject *o = layoutObject->slowFirstChild(); o && o != stop; o = o->nextInPreOrder()) {
+ if (o->nonPseudoNode()) {
+ if ((o->isText() && boundingBoxLogicalHeight(o, toLayoutText(o)->linesBoundingBox()))
+ || (o->isBox() && toLayoutBox(o)->pixelSnappedLogicalHeight())
+ || (o->isLayoutInline() && isEmptyInline(LineLayoutItem(o)) && boundingBoxLogicalHeight(o, toLayoutInline(o)->linesBoundingBox())))
+ return true;
+ }
+ }
+ return false;
+}
+
VisiblePosition visiblePositionForContentsPoint(const IntPoint& contentsPoint, LocalFrame* frame)
{
HitTestRequest request = HitTestRequest::Move | HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping;
« no previous file with comments | « Source/core/editing/VisibleUnits.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698