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

Unified Diff: Source/core/html/HTMLBodyElement.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 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/html/HTMLBaseElement.cpp ('k') | Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLBodyElement.cpp
diff --git a/Source/core/html/HTMLBodyElement.cpp b/Source/core/html/HTMLBodyElement.cpp
index 1d4e7026cf39acbe02882a1fee859e7d89511826..f5b897b994a7ee76bb54ab08765351d2bb7f91bd 100644
--- a/Source/core/html/HTMLBodyElement.cpp
+++ b/Source/core/html/HTMLBodyElement.cpp
@@ -74,7 +74,7 @@ void HTMLBodyElement::collectStyleForPresentationAttribute(const QualifiedName&
if (name == backgroundAttr) {
String url = stripLeadingAndTrailingHTMLSpaces(value);
if (!url.isEmpty()) {
- RefPtr<CSSImageValue> imageValue = CSSImageValue::create(document()->completeURL(url).string());
+ RefPtr<CSSImageValue> imageValue = CSSImageValue::create(document().completeURL(url).string());
imageValue->setInitiator(localName());
style->setProperty(CSSProperty(CSSPropertyBackgroundImage, imageValue.release()));
}
@@ -100,58 +100,58 @@ void HTMLBodyElement::parseAttribute(const QualifiedName& name, const AtomicStri
if (name == vlinkAttr || name == alinkAttr || name == linkAttr) {
if (value.isNull()) {
if (name == linkAttr)
- document()->textLinkColors().resetLinkColor();
+ document().textLinkColors().resetLinkColor();
else if (name == vlinkAttr)
- document()->textLinkColors().resetVisitedLinkColor();
+ document().textLinkColors().resetVisitedLinkColor();
else
- document()->textLinkColors().resetActiveLinkColor();
+ document().textLinkColors().resetActiveLinkColor();
} else {
RGBA32 color;
- if (CSSParser::parseColor(color, value, !document()->inQuirksMode())) {
+ if (CSSParser::parseColor(color, value, !document().inQuirksMode())) {
if (name == linkAttr)
- document()->textLinkColors().setLinkColor(color);
+ document().textLinkColors().setLinkColor(color);
else if (name == vlinkAttr)
- document()->textLinkColors().setVisitedLinkColor(color);
+ document().textLinkColors().setVisitedLinkColor(color);
else
- document()->textLinkColors().setActiveLinkColor(color);
+ document().textLinkColors().setActiveLinkColor(color);
}
}
setNeedsStyleRecalc();
} else if (name == onloadAttr)
- document()->setWindowAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(document()->frame(), name, value));
+ document().setWindowAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(document().frame(), name, value));
else if (name == onbeforeunloadAttr)
- document()->setWindowAttributeEventListener(eventNames().beforeunloadEvent, createAttributeEventListener(document()->frame(), name, value));
+ document().setWindowAttributeEventListener(eventNames().beforeunloadEvent, createAttributeEventListener(document().frame(), name, value));
else if (name == onunloadAttr)
- document()->setWindowAttributeEventListener(eventNames().unloadEvent, createAttributeEventListener(document()->frame(), name, value));
+ document().setWindowAttributeEventListener(eventNames().unloadEvent, createAttributeEventListener(document().frame(), name, value));
else if (name == onpagehideAttr)
- document()->setWindowAttributeEventListener(eventNames().pagehideEvent, createAttributeEventListener(document()->frame(), name, value));
+ document().setWindowAttributeEventListener(eventNames().pagehideEvent, createAttributeEventListener(document().frame(), name, value));
else if (name == onpageshowAttr)
- document()->setWindowAttributeEventListener(eventNames().pageshowEvent, createAttributeEventListener(document()->frame(), name, value));
+ document().setWindowAttributeEventListener(eventNames().pageshowEvent, createAttributeEventListener(document().frame(), name, value));
else if (name == onpopstateAttr)
- document()->setWindowAttributeEventListener(eventNames().popstateEvent, createAttributeEventListener(document()->frame(), name, value));
+ document().setWindowAttributeEventListener(eventNames().popstateEvent, createAttributeEventListener(document().frame(), name, value));
else if (name == onblurAttr)
- document()->setWindowAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(document()->frame(), name, value));
+ document().setWindowAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(document().frame(), name, value));
else if (name == onfocusAttr)
- document()->setWindowAttributeEventListener(eventNames().focusEvent, createAttributeEventListener(document()->frame(), name, value));
+ document().setWindowAttributeEventListener(eventNames().focusEvent, createAttributeEventListener(document().frame(), name, value));
#if ENABLE(ORIENTATION_EVENTS)
else if (name == onorientationchangeAttr)
- document()->setWindowAttributeEventListener(eventNames().orientationchangeEvent, createAttributeEventListener(document()->frame(), name, value));
+ document().setWindowAttributeEventListener(eventNames().orientationchangeEvent, createAttributeEventListener(document().frame(), name, value));
#endif
else if (name == onhashchangeAttr)
- document()->setWindowAttributeEventListener(eventNames().hashchangeEvent, createAttributeEventListener(document()->frame(), name, value));
+ document().setWindowAttributeEventListener(eventNames().hashchangeEvent, createAttributeEventListener(document().frame(), name, value));
else if (name == onresizeAttr)
- document()->setWindowAttributeEventListener(eventNames().resizeEvent, createAttributeEventListener(document()->frame(), name, value));
+ document().setWindowAttributeEventListener(eventNames().resizeEvent, createAttributeEventListener(document().frame(), name, value));
else if (name == onscrollAttr)
- document()->setWindowAttributeEventListener(eventNames().scrollEvent, createAttributeEventListener(document()->frame(), name, value));
+ document().setWindowAttributeEventListener(eventNames().scrollEvent, createAttributeEventListener(document().frame(), name, value));
else if (name == onselectionchangeAttr)
- document()->setAttributeEventListener(eventNames().selectionchangeEvent, createAttributeEventListener(document()->frame(), name, value));
+ document().setAttributeEventListener(eventNames().selectionchangeEvent, createAttributeEventListener(document().frame(), name, value));
else if (name == onstorageAttr)
- document()->setWindowAttributeEventListener(eventNames().storageEvent, createAttributeEventListener(document()->frame(), name, value));
+ document().setWindowAttributeEventListener(eventNames().storageEvent, createAttributeEventListener(document().frame(), name, value));
else if (name == ononlineAttr)
- document()->setWindowAttributeEventListener(eventNames().onlineEvent, createAttributeEventListener(document()->frame(), name, value));
+ document().setWindowAttributeEventListener(eventNames().onlineEvent, createAttributeEventListener(document().frame(), name, value));
else if (name == onofflineAttr)
- document()->setWindowAttributeEventListener(eventNames().offlineEvent, createAttributeEventListener(document()->frame(), name, value));
+ document().setWindowAttributeEventListener(eventNames().offlineEvent, createAttributeEventListener(document().frame(), name, value));
else
HTMLElement::parseAttribute(name, value);
}
@@ -163,7 +163,7 @@ Node::InsertionNotificationRequest HTMLBodyElement::insertedInto(ContainerNode*
// FIXME: It's surprising this is web compatible since it means a marginwidth
// and marginheight attribute can magically appear on the <body> of all documents
// embedded through <iframe> or <frame>.
- Element* ownerElement = document()->ownerElement();
+ Element* ownerElement = document().ownerElement();
if (ownerElement && ownerElement->isFrameElementBase()) {
HTMLFrameElementBase* ownerFrameElement = toHTMLFrameElementBase(ownerElement);
int marginWidth = ownerFrameElement->marginWidth();
@@ -254,17 +254,17 @@ static int adjustForZoom(int value, Document* document)
int HTMLBodyElement::scrollLeft()
{
// Update the document's layout.
- Document* document = this->document();
- document->updateLayoutIgnorePendingStylesheets();
- FrameView* view = document->view();
- return view ? adjustForZoom(view->scrollX(), document) : 0;
+ Document& document = this->document();
+ document.updateLayoutIgnorePendingStylesheets();
+ FrameView* view = document.view();
+ return view ? adjustForZoom(view->scrollX(), &document) : 0;
}
void HTMLBodyElement::setScrollLeft(int scrollLeft)
{
- Document* document = this->document();
- document->updateLayoutIgnorePendingStylesheets();
- Frame* frame = document->frame();
+ Document& document = this->document();
+ document.updateLayoutIgnorePendingStylesheets();
+ Frame* frame = document.frame();
if (!frame)
return;
FrameView* view = frame->view();
@@ -276,17 +276,17 @@ void HTMLBodyElement::setScrollLeft(int scrollLeft)
int HTMLBodyElement::scrollTop()
{
// Update the document's layout.
- Document* document = this->document();
- document->updateLayoutIgnorePendingStylesheets();
- FrameView* view = document->view();
- return view ? adjustForZoom(view->scrollY(), document) : 0;
+ Document& document = this->document();
+ document.updateLayoutIgnorePendingStylesheets();
+ FrameView* view = document.view();
+ return view ? adjustForZoom(view->scrollY(), &document) : 0;
}
void HTMLBodyElement::setScrollTop(int scrollTop)
{
- Document* document = this->document();
- document->updateLayoutIgnorePendingStylesheets();
- Frame* frame = document->frame();
+ Document& document = this->document();
+ document.updateLayoutIgnorePendingStylesheets();
+ Frame* frame = document.frame();
if (!frame)
return;
FrameView* view = frame->view();
@@ -298,26 +298,26 @@ void HTMLBodyElement::setScrollTop(int scrollTop)
int HTMLBodyElement::scrollHeight()
{
// Update the document's layout.
- Document* document = this->document();
- document->updateLayoutIgnorePendingStylesheets();
- FrameView* view = document->view();
- return view ? adjustForZoom(view->contentsHeight(), document) : 0;
+ Document& document = this->document();
+ document.updateLayoutIgnorePendingStylesheets();
+ FrameView* view = document.view();
+ return view ? adjustForZoom(view->contentsHeight(), &document) : 0;
}
int HTMLBodyElement::scrollWidth()
{
// Update the document's layout.
- Document* document = this->document();
- document->updateLayoutIgnorePendingStylesheets();
- FrameView* view = document->view();
- return view ? adjustForZoom(view->contentsWidth(), document) : 0;
+ Document& document = this->document();
+ document.updateLayoutIgnorePendingStylesheets();
+ FrameView* view = document.view();
+ return view ? adjustForZoom(view->contentsWidth(), &document) : 0;
}
void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const
{
HTMLElement::addSubresourceAttributeURLs(urls);
- addSubresourceURL(urls, document()->completeURL(getAttribute(backgroundAttr)));
+ addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr)));
}
} // namespace WebCore
« no previous file with comments | « Source/core/html/HTMLBaseElement.cpp ('k') | Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698