Add NULL checks to setting access obtained on frame and document.

https://bugs.webkit.org/show_bug.cgi?id=72002

Patch by Grzegorz Czajkowski <g.czajkowski@samsung.com> on 2012-01-10
Reviewed by Andreas Kling.

Adds NULL checks to setting object where it's required.
Generally WebCore checks NULL which may be returned from setting object obtained
on frame or document but in some cases these are skipped. These checks are not
needed to setting's access on page object.

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::shouldAccelerate):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::scheduleArchiveLoad):
* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::requestPlugin):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::selectCache):
(WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL):
* page/DragController.cpp:
(WebCore::DragController::draggableNode):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseReleaseEvent):
* page/FocusController.cpp:
(WebCore::FocusController::advanceFocusInDocumentOrder):
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::flattenFrameSet):
* rendering/RenderIFrame.cpp:
(WebCore::RenderIFrame::flattenFrame):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateBacking):
* rendering/RenderText.cpp:
(WebCore::SecureTextTimer::restartWithNewText):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104552 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8b490465
2012-01-10 Grzegorz Czajkowski <g.czajkowski@samsung.com>
Add NULL checks to setting access obtained on frame and document.
https://bugs.webkit.org/show_bug.cgi?id=72002
Reviewed by Andreas Kling.
Adds NULL checks to setting object where it's required.
Generally WebCore checks NULL which may be returned from setting object obtained
on frame or document but in some cases these are skipped. These checks are not
needed to setting's access on page object.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::shouldAccelerate):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::scheduleArchiveLoad):
* loader/SubframeLoader.cpp:
(WebCore::SubframeLoader::requestPlugin):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::selectCache):
(WebCore::ApplicationCacheGroup::selectCacheWithoutManifestURL):
* page/DragController.cpp:
(WebCore::DragController::draggableNode):
* page/EventHandler.cpp:
(WebCore::EventHandler::handleMouseReleaseEvent):
* page/FocusController.cpp:
(WebCore::FocusController::advanceFocusInDocumentOrder):
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::flattenFrameSet):
* rendering/RenderIFrame.cpp:
(WebCore::RenderIFrame::flattenFrame):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateBacking):
* rendering/RenderText.cpp:
(WebCore::SecureTextTimer::restartWithNewText):
2012-01-10 Andreas Kling <awesomekling@apple.com>
Matched declaration cache should support mapped attribute declarations.
......@@ -423,13 +423,13 @@ bool HTMLCanvasElement::shouldAccelerate(const IntSize& size) const
{
#if USE(IOSURFACE_CANVAS_BACKING_STORE)
UNUSED_PARAM(size);
return document()->settings()->canvasUsesAcceleratedDrawing();
return document()->settings() && document()->settings()->canvasUsesAcceleratedDrawing();
#elif ENABLE(ACCELERATED_2D_CANVAS)
if (m_context && !m_context->is2d())
return false;
Settings* settings = document()->settings();
if (!settings->accelerated2dCanvasEnabled())
if (!settings || !settings->accelerated2dCanvasEnabled())
return false;
// Do not use acceleration for small canvas.
......
......@@ -640,7 +640,7 @@ bool DocumentLoader::scheduleArchiveLoad(ResourceLoader* loader, const ResourceR
#if ENABLE(WEB_ARCHIVE)
case Archive::WebArchive:
// WebArchiveDebugMode means we fail loads instead of trying to fetch them from the network if they're not in the archive.
return m_frame->settings()->webArchiveDebugModeEnabled() && ArchiveFactory::isArchiveMimeType(responseMIMEType());
return m_frame->settings() && m_frame->settings()->webArchiveDebugModeEnabled() && ArchiveFactory::isArchiveMimeType(responseMIMEType());
#endif
#if ENABLE(MHTML)
case Archive::MHTML:
......
......@@ -109,7 +109,7 @@ bool SubframeLoader::requestPlugin(HTMLPlugInImageElement* ownerElement, const K
// as opposed to third-party code such as Flash. The user agent decides whether or not they are
// permitted, rather than WebKit.
&& !MIMETypeRegistry::isApplicationPluginMIMEType(mimeType))
|| (!settings->isJavaEnabled() && MIMETypeRegistry::isJavaAppletMIMEType(mimeType)))
|| ((!settings || !settings->isJavaEnabled()) && MIMETypeRegistry::isJavaAppletMIMEType(mimeType)))
return false;
if (m_frame->document()) {
......
......@@ -138,7 +138,7 @@ void ApplicationCacheGroup::selectCache(Frame* frame, const KURL& passedManifest
{
ASSERT(frame && frame->page());
if (!frame->settings()->offlineWebApplicationCacheEnabled())
if (!frame->settings() || !frame->settings()->offlineWebApplicationCacheEnabled())
return;
DocumentLoader* documentLoader = frame->loader()->documentLoader();
......@@ -193,7 +193,7 @@ void ApplicationCacheGroup::selectCache(Frame* frame, const KURL& passedManifest
return;
// Don't change anything on disk if private browsing is enabled.
if (!frame->settings() || frame->settings()->privateBrowsingEnabled()) {
if (frame->settings()->privateBrowsingEnabled()) {
postListenerTask(ApplicationCacheHost::CHECKING_EVENT, documentLoader);
postListenerTask(ApplicationCacheHost::ERROR_EVENT, documentLoader);
return;
......@@ -211,7 +211,7 @@ void ApplicationCacheGroup::selectCache(Frame* frame, const KURL& passedManifest
void ApplicationCacheGroup::selectCacheWithoutManifestURL(Frame* frame)
{
if (!frame->settings()->offlineWebApplicationCacheEnabled())
if (!frame->settings() || !frame->settings()->offlineWebApplicationCacheEnabled())
return;
DocumentLoader* documentLoader = frame->loader()->documentLoader();
......
......@@ -626,6 +626,7 @@ Node* DragController::draggableNode(const Frame* src, Node* startNode, const Int
if (dragMode == DRAG_AUTO) {
if ((m_dragSourceAction & DragSourceActionImage)
&& node->hasTagName(HTMLNames::imgTag)
&& src->settings()
&& src->settings()->loadsImagesAutomatically()) {
state.m_dragType = static_cast<DragSourceAction>(state.m_dragType | DragSourceActionImage);
return node;
......
......@@ -771,7 +771,7 @@ bool EventHandler::handleMouseReleaseEvent(const MouseEventWithHitTestResults& e
&& event.event().button() != RightButton) {
VisibleSelection newSelection;
Node* node = targetNode(event);
bool caretBrowsing = m_frame->settings()->caretBrowsingEnabled();
bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
if (node && (caretBrowsing || node->rendererIsEditable()) && node->renderer()) {
VisiblePosition pos = node->renderer()->positionForPoint(event.localPoint());
newSelection = VisibleSelection(pos);
......
......@@ -244,7 +244,7 @@ bool FocusController::advanceFocusInDocumentOrder(FocusDirection direction, Keyb
Node* currentNode = document->focusedNode();
// FIXME: Not quite correct when it comes to focus transitions leaving/entering the WebView itself
bool caretBrowsing = focusedOrMainFrame()->settings()->caretBrowsingEnabled();
bool caretBrowsing = frame->settings() && frame->settings()->caretBrowsingEnabled();
if (caretBrowsing && !currentNode)
currentNode = frame->selection()->start().deprecatedNode();
......
......@@ -662,7 +662,7 @@ void RenderFrameSet::positionFramesWithFlattening()
bool RenderFrameSet::flattenFrameSet() const
{
return frame() && frame()->settings()->frameFlatteningEnabled();
return frame() && frame()->settings() && frame()->settings()->frameFlatteningEnabled();
}
void RenderFrameSet::startResizing(GridAxis& axis, int position)
......
......@@ -95,7 +95,7 @@ bool RenderIFrame::flattenFrame()
}
Frame* frame = element->document()->frame();
bool enabled = frame && frame->settings()->frameFlatteningEnabled();
bool enabled = frame && frame->settings() && frame->settings()->frameFlatteningEnabled();
if (!enabled || !frame->page())
return false;
......
......@@ -368,7 +368,8 @@ bool RenderLayerCompositor::updateBacking(RenderLayer* layer, CompositingChangeR
layer->ensureBacking();
#if PLATFORM(MAC) && USE(CA)
if (m_renderView->document()->settings()->acceleratedDrawingEnabled())
Settings* settings = m_renderView->document()->settings();
if (settings && settings->acceleratedDrawingEnabled())
layer->backing()->graphicsLayer()->setAcceleratesDrawing(true);
else if (layer->renderer()->isCanvas()) {
HTMLCanvasElement* canvas = static_cast<HTMLCanvasElement*>(layer->renderer()->node());
......
......@@ -68,7 +68,8 @@ public:
void restartWithNewText(unsigned lastTypedCharacterOffset)
{
m_lastTypedCharacterOffset = lastTypedCharacterOffset;
startOneShot(m_renderText->document()->settings()->passwordEchoDurationInSeconds());
if (Settings* settings = m_renderText->document()->settings())
startOneShot(settings->passwordEchoDurationInSeconds());
}
void invalidate() { m_lastTypedCharacterOffset = -1; }
unsigned lastTypedCharacterOffset() { return m_lastTypedCharacterOffset; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment