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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLElement.cpp

Issue 2051703002: Implement closed shadow adjustment for Element.offsetParent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add one more test, more spec compliant Created 4 years, 5 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) 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 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. 4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved.
5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "core/events/KeyboardEvent.h" 47 #include "core/events/KeyboardEvent.h"
48 #include "core/frame/Settings.h" 48 #include "core/frame/Settings.h"
49 #include "core/frame/UseCounter.h" 49 #include "core/frame/UseCounter.h"
50 #include "core/html/HTMLBRElement.h" 50 #include "core/html/HTMLBRElement.h"
51 #include "core/html/HTMLFormElement.h" 51 #include "core/html/HTMLFormElement.h"
52 #include "core/html/HTMLInputElement.h" 52 #include "core/html/HTMLInputElement.h"
53 #include "core/html/HTMLMenuElement.h" 53 #include "core/html/HTMLMenuElement.h"
54 #include "core/html/HTMLTemplateElement.h" 54 #include "core/html/HTMLTemplateElement.h"
55 #include "core/html/HTMLTextFormControlElement.h" 55 #include "core/html/HTMLTextFormControlElement.h"
56 #include "core/html/parser/HTMLParserIdioms.h" 56 #include "core/html/parser/HTMLParserIdioms.h"
57 #include "core/layout/LayoutBoxModelObject.h"
57 #include "core/layout/LayoutObject.h" 58 #include "core/layout/LayoutObject.h"
58 #include "core/page/SpatialNavigation.h" 59 #include "core/page/SpatialNavigation.h"
59 #include "platform/Language.h" 60 #include "platform/Language.h"
60 #include "platform/text/BidiResolver.h" 61 #include "platform/text/BidiResolver.h"
61 #include "platform/text/BidiTextRun.h" 62 #include "platform/text/BidiTextRun.h"
62 #include "platform/text/TextRunIterator.h" 63 #include "platform/text/TextRunIterator.h"
63 #include "wtf/StdLibExtras.h" 64 #include "wtf/StdLibExtras.h"
64 #include "wtf/text/CString.h" 65 #include "wtf/text/CString.h"
65 66
66 namespace blink { 67 namespace blink {
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 event->setDefaultHandled(); 1045 event->setDefaultHandled();
1045 } 1046 }
1046 } 1047 }
1047 1048
1048 const AtomicString& HTMLElement::eventParameterName() 1049 const AtomicString& HTMLElement::eventParameterName()
1049 { 1050 {
1050 DEFINE_STATIC_LOCAL(const AtomicString, eventString, ("event")); 1051 DEFINE_STATIC_LOCAL(const AtomicString, eventString, ("event"));
1051 return eventString; 1052 return eventString;
1052 } 1053 }
1053 1054
1055 int HTMLElement::offsetLeftForBinding()
1056 {
1057 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
1058 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject())
1059 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedOffsetLeft(unclosedOffsetParent())), layoutObject->styleRef()).round();
1060 return 0;
1061 }
1062
1063 int HTMLElement::offsetTopForBinding()
1064 {
1065 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
1066 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject())
1067 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedOffsetTop(unclosedOffsetParent())), layoutObject->styleRef()).round();
1068 return 0;
1069 }
1070
1071 int HTMLElement::offsetWidthForBinding()
1072 {
1073 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
1074 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject())
1075 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedOffsetWidth(unclosedOffsetParent())), layoutObject->styleRef()).round();
1076 return 0;
1077 }
1078
1079 int HTMLElement::offsetHeightForBinding()
1080 {
1081 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
1082 if (LayoutBoxModelObject* layoutObject = layoutBoxModelObject())
1083 return adjustLayoutUnitForAbsoluteZoom(LayoutUnit(layoutObject->pixelSna ppedOffsetHeight(unclosedOffsetParent())), layoutObject->styleRef()).round();
1084 return 0;
1085 }
1086
1087 Element* HTMLElement::unclosedOffsetParent()
1088 {
1089 document().updateStyleAndLayoutIgnorePendingStylesheetsForNode(this);
1090
1091 LayoutObject* layoutObject = this->layoutObject();
1092 if (!layoutObject)
1093 return nullptr;
1094
1095 return layoutObject->offsetParent(this);
1096 }
1097
1054 } // namespace blink 1098 } // namespace blink
1055 1099
1056 #ifndef NDEBUG 1100 #ifndef NDEBUG
1057 1101
1058 // For use in the debugger 1102 // For use in the debugger
1059 void dumpInnerHTML(blink::HTMLElement*); 1103 void dumpInnerHTML(blink::HTMLElement*);
1060 1104
1061 void dumpInnerHTML(blink::HTMLElement* element) 1105 void dumpInnerHTML(blink::HTMLElement* element)
1062 { 1106 {
1063 printf("%s\n", element->innerHTML().ascii().data()); 1107 printf("%s\n", element->innerHTML().ascii().data());
1064 } 1108 }
1065 #endif 1109 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698